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
This commit is contained in:
Jordan K. Hubbard 1994-08-22 11:20:07 +00:00
parent 72d8a92aca
commit 3556b480df
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=19
2 changed files with 60 additions and 42 deletions

View file

@ -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 ${.CURDIR}/.configure_done
@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
${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

View file

@ -1,5 +1,5 @@
# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
# $Id$
# $Id: bsd.port.subdir.mk,v 1.1 1994/08/22 10:46:38 jkh Exp $
.MAIN: all
@ -35,6 +35,10 @@ ${SUBDIR}::
all: _SUBDIRUSE
.endif
.if !target(bundle)
bundle: _SUBDIRUSE
.endif
.if !target(extract)
extract: _SUBDIRUSE
.endif
@ -55,10 +59,6 @@ clean: _SUBDIRUSE
depend: _SUBDIRUSE
.endif
.if !target (maninstall)
maninstall: _SUBDIRUSE
.endif
.if !target(install)
.if !target(beforeinstall)
beforeinstall:
@ -71,14 +71,6 @@ afterinstall: realinstall
realinstall: beforeinstall _SUBDIRUSE
.endif
.if !target(lint)
lint: _SUBDIRUSE
.endif
.if !target(obj)
obj: _SUBDIRUSE
.endif
.if !target(tags)
tags: _SUBDIRUSE
.endif