summaryrefslogtreecommitdiff
path: root/Mk/bsd.port.mk
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1994-08-22 11:20:07 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1994-08-22 11:20:07 +0000
commit3556b480dff4bdc71c188b9e2de8f768d418458d (patch)
tree65de86c9aa02e4f9063b1e27fe7863f1258545a6 /Mk/bsd.port.mk
parentI had to bite the bullet: There's now a port.subdir.mk that does the right (diff)
New bsd.port.subdir.mk file for use by ports. This groks all the
special ports building targets and will recurse properly. Sorry, Julian E - no fancy prompts, just recursion! :-) Added a `bundle' target. Purpose is as follows: You want to give someone a complete tree sans distfiles (for sticking on CDROM perhaps?) but the difficulty there is that the first time the user types `make clean', all the unpacked sources are gone again. Typing `make bundle' recreates the original distfile if it can, so someone can "back up" their unpacked tree easily with one command. Whoops, just thought of something - it should warn if you configured the working source. Ok, next commit! :) Submitted by: jkh
Notes
Notes: svn path=/head/; revision=19
Diffstat (limited to 'Mk/bsd.port.mk')
-rw-r--r--Mk/bsd.port.mk84
1 files changed, 55 insertions, 29 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 336a818869d1..e9da5efaf45c 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1,7 +1,7 @@
# bsd.port.mk - 940820 Jordan K. Hubbard.
# This file is in the public domain.
#
-# $Id: bsd.port.mk,v 1.8 1994/08/21 18:26:10 jkh Exp $
+# $Id: bsd.port.mk,v 1.9 1994/08/22 10:46:37 jkh Exp $
#
# Supported Variables and their behaviors:
@@ -35,6 +35,7 @@
# build - Actually compile the sources.
# install - Install the results of a build.
# package - Create a package from a build.
+# bundle - From an unextracted source tree, re-create tarballs.
.if exists(${.CURDIR}/../Makefile.inc)
@@ -56,11 +57,18 @@ SCRIPTDIR?= ${.CURDIR}/scripts
FILESDIR?= ${.CURDIR}/files
PKGDIR?= ${.CURDIR}/pkg
+# Change these if you'd prefer to keep the cookies someplace else.
+EXTRACT_COOKIE?= ${.CURDIR}/.extract_done
+CONFIGURE_COOKIE?= ${.CURDIR}/.configure_done
+
# Miscellaneous overridable commands:
EXTRACT_CMD?= tar
EXTRACT_SUFX?= .tar.gz
EXTRACT_ARGS?= -C ${WRKDIR} -xzf
+BUNDLE_CMD?= tar
+BUNDLE_ARGS?= -C ${WRKDIR} -czf
+
HOME_LOCATION?= <original site unknown>
.MAIN: all
@@ -82,9 +90,11 @@ package:
# install, require or deinstall scripts. Override this rule if your
# package is anything but run-of-the-mill (or show me a way to do this
# more generally).
- @[ -d ${PKGDIR} ] && \
- echo "===> Building package for ${DISTNAME}" ; \
- pkg_create -c pkg/COMMENT -d pkg/DESCR -f pkg/PLIST ${DISTNAME}
+ @if [ -d ${PKGDIR} ]; then
+ echo "===> Building package for ${DISTNAME}"; \
+ pkg_create -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR \
+ -f ${PKGDIR}/PLIST ${DISTNAME}; \
+ fi
.endif
.if !target(build)
@@ -93,12 +103,12 @@ build: configure
.if defined(DEPENDS)
@echo "===> ${DISTNAME} depends on: ${DEPENDS}"
@for i in $(DEPENDS); do \
- echo "===> Verifying build for $$i"; \
- if [ ! -d ${PORTSDIR}/$$i ]; then \
- echo ">> No directory for ${PORTSDIR}/$$i. Skipping.."; \
- else \
- (cd ${PORTSDIR}/$$i; ${MAKE}) ; \
- fi \
+ echo "===> Verifying build for $$i"; \
+ if [ ! -d ${PORTSDIR}/$$i ]; then \
+ echo ">> No directory for ${PORTSDIR}/$$i. Skipping.."; \
+ else \
+ (cd ${PORTSDIR}/$$i; ${MAKE}) ; \
+ fi \
done
@echo "===> Returning to build of ${DISTNAME}"
.endif
@@ -113,33 +123,44 @@ build: configure
# This is done with a .configure because configures are often expensive,
# and you don't want it done again gratuitously when you're trying to get
# a make of the whole tree to work.
-configure: extract ${.CURDIR}/.configure_done
+configure: extract ${CONFIGURE_COOKIE}
-${.CURDIR}/.configure_done:
+${CONFIGURE_COOKIE}:
@echo "===> Configuring for ${DISTNAME}"
@if [ -d ${PATCHDIR} ]; then \
- echo "===> Applying patches for ${DISTNAME}" ; \
- for i in ${PATCHDIR}/patch-*; do \
- patch -d ${WRKSRC} --quiet -E -p0 < $$i; \
- done; \
+ echo "===> Applying patches for ${DISTNAME}" ; \
+ for i in ${PATCHDIR}/patch-*; do \
+ patch -d ${WRKSRC} --quiet -E -p0 < $$i; \
+ done; \
fi
# We have a small convention for our local configure scripts, which
# is that ${PORTSDIR}, ${.CURDIR} and ${WRKSRC} get passed as
# command-line arguments since all other methods are a little
# problematic.
@if [ -f ${SCRIPTDIR}/pre-configure ]; then \
- sh ${SCRIPTDIR}/pre-configure ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
+ sh ${SCRIPTDIR}/pre-configure ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
fi
@if [ -f ${SCRIPTDIR}/configure ]; then \
- sh ${SCRIPTDIR}/configure ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
+ sh ${SCRIPTDIR}/configure ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
fi
.if defined(HAS_CONFIGURE)
@(cd ${WRKSRC}; ./configure ${CONFIGURE_ARGS})
.endif
@if [ -f ${SCRIPTDIR}/post-configure ]; then \
- sh ${SCRIPTDIR}/post-configure ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
+ sh ${SCRIPTDIR}/post-configure ${PORTSDIR} ${.CURDIR} ${WRKSRC}; \
+ fi
+ @touch -f ${CONFIGURE_COOKIE}
+.endif
+
+.if !target(bundle)
+bundle:
+ @if [ ! -f ${EXTRACT_COOKIE} ]; then \
+ echo "There doesn't appear to be a properly extracted"; \
+ echo "distribution for ${DISTNAME}. Skipping.."; \
+ exit 0; \
fi
- @touch -f ${.CURDIR}/.configure_done
+ ${BUNDLE_CMD} ${BUNDLE_ARGS} ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX} \
+ ${DISTNAME}
.endif
.if !target(extract)
@@ -147,27 +168,27 @@ ${.CURDIR}/.configure_done:
# because if the user interrupts the extract in the middle (and it's often
# a long procedure), we get tricked into thinking that we've got a good dist
# in ${WRKDIR}.
-extract: ${.CURDIR}/.extract_done
+extract: ${EXTRACT_COOKIE}
-${.CURDIR}/.extract_done:
+${EXTRACT_COOKIE}:
@echo "===> Extracting for ${DISTNAME}"
@rm -rf ${WRKDIR}
@mkdir -p ${WRKDIR}
@if [ ! -f ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX} ]; then \
- echo "Sorry, can't find: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}"; \
- echo "Please obtain this file from:"; \
- echo " ${HOME_LOCATION}"; \
- echo "before proceeding."; \
- exit 1; \
+ echo "Sorry, can't find: ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}"; \
+ echo "Please obtain this file from:"; \
+ echo " ${HOME_LOCATION}"; \
+ echo "before proceeding."; \
+ exit 1; \
fi
@${EXTRACT_CMD} ${EXTRACT_ARGS} ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX}
- @touch -f ${.CURDIR}/.extract_done
+ @touch -f ${EXTRACT_COOKIE}
.endif
.if !target(clean)
clean:
@echo "===> Cleaning for ${DISTNAME}"
- @rm -f ${.CURDIR}/.extract_done ${.CURDIR}/.configure_done
+ @rm -f ${EXTRACT_COOKIE} ${CONFIGURE_COOKIE}
@rm -rf ${WRKDIR}
.endif
@@ -178,3 +199,8 @@ clean:
.if !target(depend)
depend:
.endif
+
+# Same goes for tags
+.if !target(tags)
+tags:
+.endif