diff options
author | asami <asami@FreeBSD.org> | 1995-08-18 18:06:28 +0800 |
---|---|---|
committer | asami <asami@FreeBSD.org> | 1995-08-18 18:06:28 +0800 |
commit | a1f6a79e3abed50328943d8cb9f0f60491bb58c2 (patch) | |
tree | 9bc812d95fc3247b69f1b66a5744c7873b332bfb | |
parent | 55a975ba3870b30ca5b838be31576cbc9031dabc (diff) | |
download | freebsd-ports-graphics-a1f6a79e3abed50328943d8cb9f0f60491bb58c2.tar.gz freebsd-ports-graphics-a1f6a79e3abed50328943d8cb9f0f60491bb58c2.tar.zst freebsd-ports-graphics-a1f6a79e3abed50328943d8cb9f0f60491bb58c2.zip |
Merge all the "skeleton" target into one macro. This is an enormous
change, but I've been testing this on thud and silvia for quite a
while, also I haven't gotten any bug reports from the ports list, so
I'm going to let it loose!
It cleans up this file quite a bit, now I can go in and start adding
some more "interesting" things.... ;)
-rw-r--r-- | Mk/bsd.port.mk | 386 |
1 files changed, 149 insertions, 237 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 3d2d88075e5..46994c4a5bf 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -3,7 +3,7 @@ # bsd.port.mk - 940820 Jordan K. Hubbard. # This file is in the public domain. # -# $Id: bsd.port.mk,v 1.173 1995/07/17 16:20:58 jkh Exp $ +# $Id: bsd.port.mk,v 1.174 1995/07/24 08:02:07 asami Exp $ # # Please view me with 4 column tabs! @@ -209,7 +209,8 @@ EXEC_DEPENDS+= gmake:${PORTSDIR}/devel/gmake .include "${PORTSDIR}/../Makefile.inc" .endif -# Change these if you'd prefer to keep the cookies someplace else. +# Don't change these!!! These names are built into the _TARGET_USE macro, +# there is no way to refer to them cleanly from within the macro AFAIK. EXTRACT_COOKIE?= ${WRKDIR}/.extract_done CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done INSTALL_COOKIE?= ${WRKDIR}/.install_done @@ -608,220 +609,195 @@ do-install: .endif .endif -################################################################ -# Skeleton targets start here -# -# You shouldn't have to change these. Either add the pre-* or -# post-* targets/scripts or redefine the do-* targets. These -# targets don't do anything other than checking for cookies and -# call the necessary targets/scripts. -################################################################ +# Package -# Fetch - -.if !target(fetch) -fetch: depends -.if target(pre-fetch) - @${MAKE} ${.MAKEFLAGS} pre-fetch -.endif - @if [ -f ${SCRIPTDIR}/pre-fetch ]; then \ - /usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ - WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ - FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ - DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ - /bin/sh ${SCRIPTDIR}/pre-fetch; \ - fi - @${MAKE} ${.MAKEFLAGS} do-fetch -.if target(post-fetch) - @${MAKE} ${.MAKEFLAGS} post-fetch -.endif - @if [ -f ${SCRIPTDIR}/post-fetch ]; then \ - /usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ - WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ - FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ - DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ - /bin/sh ${SCRIPTDIR}/post-fetch; \ +.if !target(do-package) +do-package: + @if [ -e ${PKGDIR}/PLIST ]; then \ + ${ECHO_MSG} "===> Building package for ${PKGNAME}"; \ + if [ -d ${PACKAGES} ]; then \ + if [ ! -d ${PKGREPOSITORY} ]; then \ + if ! /bin/mkdir -p ${PKGREPOSITORY}; then \ + ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \ + exit 1; \ + fi; \ + fi; \ + fi; \ + if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \ + if [ -d ${PACKAGES} ]; then \ + ${MAKE} ${.MAKEFLAGS} package-links; \ + fi; \ + else \ + ${MAKE} ${.MAKEFLAGS} delete-package; \ + exit 1; \ + fi; \ fi .endif -# Extract - -.if !target(extract) -extract: checksum ${EXTRACT_COOKIE} +# Some support rules for do-package -${EXTRACT_COOKIE}: - @${ECHO_MSG} "===> Extracting for ${PKGNAME}" -.if target(pre-extract) - @${MAKE} ${.MAKEFLAGS} pre-extract -.endif - @if [ -f ${SCRIPTDIR}/pre-extract ]; then \ - /usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ - WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ - FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ - DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ - /bin/sh ${SCRIPTDIR}/pre-extract; \ - fi - @${MAKE} ${.MAKEFLAGS} do-extract -.if target(post-extract) - @${MAKE} ${.MAKEFLAGS} post-extract +.if !target(package-links) +package-links: + @${MAKE} ${.MAKEFLAGS} delete-package-links + @for cat in ${CATEGORIES}; do \ + if [ ! -d ${PACKAGES}/$$cat ]; then \ + if ! /bin/mkdir -p ${PACKAGES}/$$cat; then \ + ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \ + exit 1; \ + fi; \ + fi; \ + ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \ + done; .endif - @if [ -f ${SCRIPTDIR}/post-extract ]; then \ - /usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ - WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ - FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ - DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ - /bin/sh ${SCRIPTDIR}/post-extract; \ - fi - @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE} + +.if !target(delete-package-links) +delete-package-links: + @/bin/rm -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX}; .endif -# Patch +.if !target(delete-package) +delete-package: + @${MAKE} ${.MAKEFLAGS} delete-package-links + @/bin/rm -f ${PKGFILE} +.endif -.if !target(patch) -patch: extract ${PATCH_COOKIE} +################################################################ +# This is the "generic" port target, actually a macro used from the +# six main targets. See below for more. +################################################################ -${PATCH_COOKIE}: - @${ECHO_MSG} "===> Patching for ${PKGNAME}" -.if target(pre-patch) - @${MAKE} ${.MAKEFLAGS} pre-patch +_PORT_USE: .USE +.if make(real-install) +.if !defined(NO_MTREE) + @if [ `id -u` = 0 ]; then \ + ${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \ + else \ + ${ECHO_MSG} "Warning: not superuser, can't run mtree."; \ + ${ECHO_MSG} "Become root and try again to ensure correct permissions."; \ + fi .endif - @if [ -f ${SCRIPTDIR}/pre-patch ]; then \ +.endif + @${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/} + @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \ /usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ - /bin/sh ${SCRIPTDIR}/pre-patch; \ + /bin/sh ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/}; \ fi - @${MAKE} ${.MAKEFLAGS} do-patch -.if target(post-patch) - @${MAKE} ${.MAKEFLAGS} post-patch -.endif - @if [ -f ${SCRIPTDIR}/post-patch ]; then \ + @${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/} + @${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/} + @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \ /usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ - /bin/sh ${SCRIPTDIR}/post-patch; \ + /bin/sh ${SCRIPTDIR}/${.TARGET:S/^real-/post-/}; \ fi -.if !defined(PATCH_CHECK_ONLY) - @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE} +.if make(real-install) + @${MAKE} ${.MAKEFLAGS} fake-pkg .endif +.if !make(real-fetch) \ + && (!make(real-patch) || !defined(PATCH_CHECK_ONLY)) \ + && (!make(real-package) || !defined(PACKAGE_NOINSTALL)) + @${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.${.TARGET:S/^real-//}_done .endif -# Checkpatch -# -# Special target to verify patches +################################################################ +# Skeleton targets start here +# +# You shouldn't have to change these. Either add the pre-* or +# post-* targets/scripts or redefine the do-* targets. These +# targets don't do anything other than checking for cookies and +# call the necessary targets/scripts. +################################################################ -.if !target(checkpatch) -checkpatch: - @${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch +.if !target(fetch) +fetch: depends + @${MAKE} ${.MAKEFLAGS} real-fetch .endif -# Configure +.if !target(extract) +extract: checksum ${EXTRACT_COOKIE} +.endif + +.if !target(patch) +patch: extract ${PATCH_COOKIE} +.endif .if !target(configure) configure: patch ${CONFIGURE_COOKIE} - -${CONFIGURE_COOKIE}: - @${ECHO_MSG} "===> Configuring for ${PKGNAME}" -.if target(pre-configure) - @${MAKE} ${.MAKEFLAGS} pre-configure -.endif - @if [ -f ${SCRIPTDIR}/pre-configure ]; then \ - /usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ - WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ - FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ - DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ - /bin/sh ${SCRIPTDIR}/pre-configure; \ - fi - @${MAKE} ${.MAKEFLAGS} do-configure -.if target(post-configure) - @${MAKE} ${.MAKEFLAGS} post-configure -.endif - @if [ -f ${SCRIPTDIR}/post-configure ]; then \ - /usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ - WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ - FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ - DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ - /bin/sh ${SCRIPTDIR}/post-configure; \ - fi - @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE} .endif -# Build - .if !target(build) build: configure ${BUILD_COOKIE} - -${BUILD_COOKIE}: - @${ECHO_MSG} "===> Building for ${PKGNAME}" -.if target(pre-build) - @${MAKE} ${.MAKEFLAGS} pre-build -.endif - @if [ -f ${SCRIPTDIR}/pre-build ]; then \ - /usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ - WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ - FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ - DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ - /bin/sh ${SCRIPTDIR}/pre-build; \ - fi - @${MAKE} ${.MAKEFLAGS} do-build -.if target(post-build) - @${MAKE} ${.MAKEFLAGS} post-build -.endif - @if [ -f ${SCRIPTDIR}/post-build ]; then \ - /usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ - WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ - FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ - DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ - /bin/sh ${SCRIPTDIR}/post-build; \ - fi - @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} .endif -# Install - .if !target(install) install: build ${INSTALL_COOKIE} +.endif +.if !target(package) +package: install ${PACKAGE_COOKIE} +.endif + +${EXTRACT_COOKIE}: + @${MAKE} ${.MAKEFLAGS} real-extract +${PATCH_COOKIE}: + @${MAKE} ${.MAKEFLAGS} real-patch +${CONFIGURE_COOKIE}: + @${MAKE} ${.MAKEFLAGS} real-configure +${BUILD_COOKIE}: + @${MAKE} ${.MAKEFLAGS} real-build ${INSTALL_COOKIE}: + @${MAKE} ${.MAKEFLAGS} real-install +${PACKAGE_COOKIE}: + @${MAKE} ${.MAKEFLAGS} real-package + +# And call the macros + +real-fetch: _PORT_USE +real-extract: _PORT_USE + @${ECHO_MSG} "===> Extracting for ${PKGNAME}" +real-patch: _PORT_USE + @${ECHO_MSG} "===> Patching for ${PKGNAME}" +real-configure: _PORT_USE + @${ECHO_MSG} "===> Configuring for ${PKGNAME}" +real-build: _PORT_USE + @${ECHO_MSG} "===> Building for ${PKGNAME}" +real-install: _PORT_USE @${ECHO_MSG} "===> Installing for ${PKGNAME}" -.if !defined(NO_MTREE) - @if [ `id -u` = 0 ]; then \ - ${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \ - else \ - ${ECHO_MSG} "Warning: not superuser, can't run mtree."; \ - ${ECHO_MSG} "Become root and try again to ensure correct permissions."; \ - fi -.endif -.if target(pre-install) - @${MAKE} ${.MAKEFLAGS} pre-install +real-package: _PORT_USE + +# Empty pre-* and post-* targets, note we can't use .if !target() +# in the _PORT_USE macro + +.for name in fetch extract patch configure build install package + +.if !target(pre-${name}) +pre-${name}: + @${DO_NADA} .endif - @if [ -f ${SCRIPTDIR}/pre-install ]; then \ - /usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ - WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ - FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ - DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ - /bin/sh ${SCRIPTDIR}/pre-install; \ - fi - @${MAKE} ${.MAKEFLAGS} do-install -.if target(post-install) - @${MAKE} ${.MAKEFLAGS} post-install + +.if !target(post-${name}) +post-${name}: + @${DO_NADA} .endif - @if [ -f ${SCRIPTDIR}/post-install ]; then \ - /usr/bin/env CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \ - WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \ - FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \ - DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \ - /bin/sh ${SCRIPTDIR}/post-install; \ - fi - @${MAKE} ${.MAKEFLAGS} fake-pkg - @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE} + +.endfor + +# Checkpatch +# +# Special target to verify patches + +.if !target(checkpatch) +checkpatch: + @${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch .endif # Reinstall # -# This is a special target to re-run install +# Special target to re-run install .if !target(reinstall) reinstall: pre-reinstall install @@ -921,11 +897,12 @@ checksum: fetch .endif ################################################################ -# The package-building targets +# The special package-building targets # You probably won't need to touch these ################################################################ # Nobody should want to override this unless PKGNAME is simply bogus. + .if !target(package-name) package-name: .if !defined(NO_PACKAGE) @@ -934,6 +911,7 @@ package-name: .endif # Show (recursively) all the packages this package depends on. + .if !target(package-depends) package-depends: @for i in ${EXEC_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \ @@ -942,19 +920,6 @@ package-depends: done .endif -# Build a package - -.if !target(package) -package: install ${PACKAGE_COOKIE} - -${PACKAGE_COOKIE}: -.if target(pre-package) - @${MAKE} ${.MAKEFLAGS} pre-package -.endif - @${MAKE} ${.MAKEFLAGS} do-package - @${TOUCH} ${TOUCH_FLAGS} ${PACKAGE_COOKIE} -.endif - # Build a package but don't check the package cookie .if !target(repackage) @@ -969,60 +934,7 @@ pre-repackage: .if !target(package-noinstall) package-noinstall: -.if target(pre-package) - @${MAKE} ${.MAKEFLAGS} pre-package -.endif - @${MAKE} ${.MAKEFLAGS} do-package -.endif - -# The body of the package-building target - -.if !target(do-package) -do-package: - @if [ -e ${PKGDIR}/PLIST ]; then \ - ${ECHO_MSG} "===> Building package for ${PKGNAME}"; \ - if [ -d ${PACKAGES} ]; then \ - if [ ! -d ${PKGREPOSITORY} ]; then \ - if ! /bin/mkdir -p ${PKGREPOSITORY}; then \ - ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \ - exit 1; \ - fi; \ - fi; \ - fi; \ - if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \ - if [ -d ${PACKAGES} ]; then \ - ${MAKE} ${.MAKEFLAGS} package-links; \ - fi; \ - else \ - ${MAKE} ${.MAKEFLAGS} delete-package; \ - exit 1; \ - fi; \ - fi -.endif - -.if !target(package-links) -package-links: - @${MAKE} ${.MAKEFLAGS} delete-package-links - @for cat in ${CATEGORIES}; do \ - if [ ! -d ${PACKAGES}/$$cat ]; then \ - if ! /bin/mkdir -p ${PACKAGES}/$$cat; then \ - ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \ - exit 1; \ - fi; \ - fi; \ - ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \ - done; -.endif - -.if !target(delete-package-links) -delete-package-links: - @/bin/rm -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX}; -.endif - -.if !target(delete-package) -delete-package: - @${MAKE} ${.MAKEFLAGS} delete-package-links - @/bin/rm -f ${PKGFILE} + @${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package .endif ################################################################ |