# bsd.subdir_ports.mk Tue Apr 12 1994 by Julian Stacey & <}--- are there so the % key in vi can be used, # thus allowing easy matching within long make logs. # The >< in ---{> & <}--- are retained for ornament. # The --- in ---{> & <}--- are retained both for ornament, & # to contribute to the uniqueness of forward & backward search keys. # The brackets () allow subsequent subsidiary makes to ignore possible # error results from previous sibling makes. # A "cd ${.CURDIR} ;" after the subsidiary make is not needed, as nothing # else happens inside the sub shell invoked by the ( ), # it has thus been omitted to assist shell interpreter speed. MFLAGS += -i # to be removed when ports tree error free # used to be MFLAGS ?= -i but something was always defining # MFLAGS, so -i was never seen. GMAKE = gmake MAKE ?= make MAKE_CMD = ${MAKE} ${MFLAGS} GMAKE_CMD = ${GMAKE} ${MFLAGS} AVOID ?= "AVOID set in bsd.subdir_ports.mk avoids broken packages." # Define WAIT_OK if you are prepared for the make to hang # on an open window awaiting a response. # You cant win with DESTDIR, once all packages use DESTDIR, no problem, # till then its a 4 way choice between throwing all stuff in # - ${DESTDIR}/usr/local, # - ${DESTDIR}/usr/gnu, # - ${DESTDIR}/ # - wherever the package Makefile thinks it wants to put it. .if defined(DESTDIR) DESTDIR := ${DESTDIR}/usr/local .else DESTDIR = /usr/local .endif BINDIR?= ${DESTDIR}/bin # maybe BINDIR & DESTDIR interfere on some packages LIBDIR?= ${DESTDIR}/lib # maybe useful to have a default LIBDIR ? # Labels _SUBDIRUSE & ${SUBDIR} supercede labels in bsd.subdir.mk, DIR_EXIST = -e # DIR_EXIST -e rather than -d, as it may be a sym link to a directory FILE_EXIST = -r # FILE_EXIST not -f as it might be a sym link to a local # work_in_progress_Makefile _SUBDIRUSE: .USE @# echo Starting directories that use BSD ${MAKE} @for entry in ${SUBDIR} ; do \ ( \ if test ${DIR_EXIST} ${.CURDIR}/$${entry}.${MACHINE} ; then \ echo "Starting machine specific" > /dev/null ; \ edir=$${entry}.${MACHINE} ; \ else \ echo "Starting generic" > /dev/null ; \ edir=$${entry} ; \ fi ;\ echo -n "---{> $${edir}: " ;\ if test ${FILE_EXIST} ${.CURDIR}/$${edir}/Makefile ; then \ cmd="${MAKE_CMD} \ ${.TARGET:realinstall=install} \ DIRPRFX=${DIRPRFX}$${edir}/"; \ echo "$$cmd"; \ cd ${.CURDIR}/$${edir} ; \ $$cmd ; \ else \ echo "Warning missing directory or Makefile." ;\ fi ;\ echo "<}--- $${edir}" ;\ ) \ done @# echo Finished BSD ${MAKE} directories, Starting ${GMAKE} directories. @for entry in ${G_SUBDIR}; do \ ( \ if test ${DIR_EXIST} ${.CURDIR}/$${entry}.${MACHINE} ; then \ echo "Starting machine specific" > /dev/null ; \ edir=$${entry}.${MACHINE} ; \ else \ echo "Starting generic" > /dev/null ; \ edir=$${entry} ; \ fi ;\ echo -n "---{> $${edir}: " ;\ if test ${FILE_EXIST} ${.CURDIR}/$${edir}/Makefile ; then \ cmd="${GMAKE_CMD} MAKE=${GMAKE} \ ${.TARGET:realinstall=install} \ DIRPRFX=${DIRPRFX}$${edir}/"; \ echo "$$cmd"; \ cd ${.CURDIR}/$${edir} ; \ $$cmd ; \ else \ echo "Warning missing directory or Makefile." ;\ fi ;\ echo "<}--- $${edir}" ;\ ) \ done @# echo Finished ${GMAKE} directories. ${SUBDIR}:: @# echo Starting directories that use BSD ${MAKE} if test ${DIR_EXIST} ${.CURDIR}/${.TARGET}.${MACHINE} ; then \ echo "Starting machine specific" > /dev/null ; \ edir=${.CURDIR}/${.TARGET}.${MACHINE};\ else \ edir=${.CURDIR}/${.TARGET};\ echo "Starting generic" > /dev/null ; \ fi ;\ echo -n "---{> $${edir}: " ;\ if test ${FILE_EXIST} ${.CURDIR}/$${edir}/Makefile ; then \ cmd="${MAKE_CMD} -f $${edir}/Makefile all";\ echo "$$cmd"; \ cd ${.CURDIR}/$${edir} ; \ $$cmd ; \ else \ echo "Warning missing directory or Makefile." ;\ fi ;\ echo "<}--- $${edir}" ;\ ${G_SUBDIR}:: @# echo Starting directories that use BSD ${MAKE} if test ${DIR_EXIST} ${.CURDIR}/${.TARGET}.${MACHINE} ; then \ echo "Starting machine specific" > /dev/null ; \ edir=${.CURDIR}/${.TARGET}.${MACHINE};\ else \ edir=${.CURDIR}/${.TARGET};\ echo "Starting generic" > /dev/null ; \ fi ;\ echo -n "---{> $${edir}: " ;\ if test ${FILE_EXIST} ${.CURDIR}/$${edir}/Makefile ; then \ cmd="${GMAKE_CMD} MAKE=${GMAKE} -f $${edir}/Makefile all";\ echo "$$cmd"; \ cd ${.CURDIR}/$${edir} ; \ $$cmd ; \ else \ echo "Warning missing directory or Makefile." ;\ fi ;\ echo "<}--- $${edir}" ;\ .include .if !target(package) package: _SUBDIRUSE .endif .if !target(world) world: _SUBDIRUSE # note if we append `all' after `_SUBDIRUSE' # then with several levels of SUBDIR makes, we'd get far too many `make all's .endif # End Of File