Makefile revision 38042
12061Sjkh#
238042Sbde#	$Id: Makefile,v 1.206 1998/08/02 09:24:59 wosch Exp $
32061Sjkh#
433611Sjb# While porting to the another architecture include the bootstrap instead
532427Sjb# of the normal build.
632427Sjb#
736111Sjb.if exists(${.CURDIR}/Makefile.${MACHINE}) && defined(BOOTSTRAP_WORLD)
833611Sjb.include "${.CURDIR}/Makefile.${MACHINE}"
932427Sjb.else
1032427Sjb#
112061Sjkh# Make command line options:
1215603Smarkm#	-DCLOBBER will remove /usr/include
1330169Sjkh#	-DMAKE_KERBEROS4 to build KerberosIV
142061Sjkh#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
1512483Speter#	-DNOCLEAN do not clean at all
1634509Sbde#	-DNOTOOLS do not rebuild any tools first
172160Scsgr#	-DNOCRYPT will prevent building of crypt versions
182834Swollman#	-DNOLKM do not build loadable kernel modules
192061Sjkh#	-DNOOBJDIR do not run ``${MAKE} obj''
202061Sjkh#	-DNOPROFILE do not build profiled libraries
212160Scsgr#	-DNOSECURE do not go into secure subdir
2217308Speter#	-DNOGAMES do not go into games subdir
2319320Sadam#	-DNOSHARE do not go into share subdir
2427788Sasami#	-DNOINFO do not make or install info files
2530169Sjkh#	-DNOLIBC_R do not build libc_r.
2625980Sasami#	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
271594Srgrimes
2817308Speter#
2917308Speter# The intended user-driven targets are:
3027910Sasami# buildworld  - rebuild *everything*, including glue to help do upgrades
3127910Sasami# installworld- install everything built by "buildworld"
3227910Sasami# world       - buildworld + installworld
3317308Speter# update      - convenient way to update your source tree (eg: sup/cvs)
3417308Speter# most        - build user commands, no libraries or include files
3517308Speter# installmost - install user commands, no libraries or include files
3619175Sbde#
3719175Sbde# Standard targets (not defined here) are documented in the makefiles in
3819175Sbde# /usr/share/mk.  These include:
3919175Sbde#		obj depend all install clean cleandepend cleanobj
4017308Speter
4127910Sasami.if (!make(world)) && (!make(buildworld)) && (!make(installworld))
4234509Sbde.MAKEFLAGS:=	-m ${.CURDIR}/share/mk ${.MAKEFLAGS}
4327910Sasami.endif
4417308Speter
4538042Sbde#
4638042Sbde# Pick up any macros that are defined in the src-relative bsd.own.mk
4738042Sbde# but not in the "system" bsd.own.mk.  The "system" version has
4838042Sbde# unfortunately already been included by the "system" sys.mk, so this
4938042Sbde# only works for new macros.  First undefine old macros that cause
5038042Sbde# problems.
5138042Sbde#
5238042Sbde.undef LIBDIR
5338042Sbde.include "${.CURDIR}/share/mk/bsd.own.mk"
5438042Sbde
552061Sjkh# Put initial settings here.
562061SjkhSUBDIR=
571594Srgrimes
5830169Sjkh# We must do share/info early so that installation of info `dir'
5930169Sjkh# entries works correctly.  Do it first since it is less likely to
6030169Sjkh# grow dependencies on include and lib than vice versa.
6130169Sjkh.if exists(share/info)
6230169SjkhSUBDIR+= share/info
6330169Sjkh.endif
6430169Sjkh
6530169Sjkh# We must do include and lib early so that the perl *.ph generation
667407Srgrimes# works correctly as it uses the header files installed by this.
677108Sphk.if exists(include)
687108SphkSUBDIR+= include
697108Sphk.endif
707407Srgrimes.if exists(lib)
717407SrgrimesSUBDIR+= lib
727407Srgrimes.endif
737108Sphk
742061Sjkh.if exists(bin)
752061SjkhSUBDIR+= bin
762061Sjkh.endif
7717308Speter.if exists(games) && !defined(NOGAMES)
782061SjkhSUBDIR+= games
792061Sjkh.endif
802061Sjkh.if exists(gnu)
812061SjkhSUBDIR+= gnu
822061Sjkh.endif
8335427Sbde.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && \
8435427Sbde    defined(MAKE_KERBEROS4)
8530169SjkhSUBDIR+= kerberosIV
862626Scsgr.endif
872061Sjkh.if exists(libexec)
882061SjkhSUBDIR+= libexec
892061Sjkh.endif
902061Sjkh.if exists(sbin)
912061SjkhSUBDIR+= sbin
922061Sjkh.endif
9319320Sadam.if exists(share) && !defined(NOSHARE)
942061SjkhSUBDIR+= share
952061Sjkh.endif
962061Sjkh.if exists(sys)
972061SjkhSUBDIR+= sys
982061Sjkh.endif
992061Sjkh.if exists(usr.bin)
1002061SjkhSUBDIR+= usr.bin
1012061Sjkh.endif
1022061Sjkh.if exists(usr.sbin)
1032061SjkhSUBDIR+= usr.sbin
1042061Sjkh.endif
1052834Swollman.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
1062834SwollmanSUBDIR+= secure
1072834Swollman.endif
1082834Swollman.if exists(lkm) && !defined(NOLKM)
1092834SwollmanSUBDIR+= lkm
1102834Swollman.endif
1111594Srgrimes
1124486Sphk# etc must be last for "distribute" to work
1134486Sphk.if exists(etc) && make(distribute)
1144486SphkSUBDIR+= etc
1154486Sphk.endif
1164486Sphk
1172061Sjkh# These are last, since it is nice to at least get the base system
1182061Sjkh# rebuilt before you do them.
11925979Sjkh.if defined(LOCAL_DIRS)
12025979Sjkh.for _DIR in ${LOCAL_DIRS}
12125979Sjkh.if exists(${_DIR}) & exists(${_DIR}/Makefile)
12225979SjkhSUBDIR+= ${_DIR}
1232061Sjkh.endif
12425979Sjkh.endfor
1252061Sjkh.endif
1262061Sjkh
12717308Speter# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
1282061Sjkh.if defined(NOOBJDIR)
1292061SjkhOBJDIR=
1302061Sjkh.else
1312061SjkhOBJDIR=		obj
1322061Sjkh.endif
13312483Speter
13412483Speter.if defined(NOCLEAN)
13512483SpeterCLEANDIR=
13612483Speter.else
1372061Sjkh.if defined(NOCLEANDIR)
13835479SbdeCLEANDIR=	clean cleandepend
1398854Srgrimes.else
1402061SjkhCLEANDIR=	cleandir
1412061Sjkh.endif
14212483Speter.endif
1432061Sjkh
14435479Sbde.if !defined(NOCLEAN) && ${.MAKEFLAGS:M-j} == ""
14535479Sbde_NODEPEND=	true
14635479Sbde.endif
14735479Sbde.if defined(_NODEPEND)
14835479Sbde_DEPEND=	cleandepend
14935479Sbde.else
15035479Sbde_DEPEND=	depend
15135479Sbde.endif
15235479Sbde
15335462SjkhSUP?=		cvsup
15435462SjkhSUPFLAGS?=	-g -L 2 -P -
15518714Sache
15617308Speter#
15734541Sbde# While building tools for bootstrapping, we don't need to waste time on
15834575Sbde# shared or profiled libraries, shared linkage, or documentation, except
15934575Sbde# when the tools won't get cleaned we must use the defaults for shared
16034575Sbde# libraries and shared linkage (and this doesn't waste time).
16134592Sbde# XXX actually, we do need to waste time building shared libraries.
16217308Speter#
16334575Sbde.if defined(NOCLEAN)
16435427SbdeMK_FLAGS=	-DNOINFO -DNOMAN         -DNOPROFILE
16534575Sbde.else
16635427SbdeMK_FLAGS=	-DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED
16734575Sbde.endif
16815603Smarkm
16917308Speter#
17017308Speter# world
17117308Speter#
17217308Speter# Attempt to rebuild and reinstall *everything*, with reasonable chance of
17317308Speter# success, regardless of how old your existing system is.
17417308Speter#
17517308Speter# >> Beware, it overwrites the local build environment! <<
17617308Speter#
17717308Speterworld:
17818362Sjkh	@echo "--------------------------------------------------------------"
17919966Sache	@echo "make world started on `LC_TIME=C date`"
18018362Sjkh	@echo "--------------------------------------------------------------"
18117308Speter.if target(pre-world)
18227910Sasami	@echo
18317308Speter	@echo "--------------------------------------------------------------"
18417308Speter	@echo " Making 'pre-world' target"
18517308Speter	@echo "--------------------------------------------------------------"
18636074Sbde	cd ${.CURDIR}; ${MAKE} pre-world
18727910Sasami.endif
18836074Sbde	cd ${.CURDIR}; ${MAKE} buildworld
18936074Sbde	cd ${.CURDIR}; ${MAKE} -B installworld
19027910Sasami.if target(post-world)
19117308Speter	@echo
1922061Sjkh	@echo "--------------------------------------------------------------"
19327910Sasami	@echo " Making 'post-world' target"
1942061Sjkh	@echo "--------------------------------------------------------------"
19536074Sbde	cd ${.CURDIR}; ${MAKE} post-world
19627910Sasami.endif
1972061Sjkh	@echo
19817308Speter	@echo "--------------------------------------------------------------"
19927910Sasami	@echo "make world completed on `LC_TIME=C date`"
20017308Speter	@echo "--------------------------------------------------------------"
20127910Sasami
20227910Sasami.if defined(MAKEOBJDIRPREFIX)
20327910SasamiWORLDTMP=	${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
20417308Speter.else
20527910SasamiWORLDTMP=	/usr/obj${.CURDIR}/tmp
20617308Speter.endif
20727910SasamiSTRICTTMPPATH=	${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin
20827910SasamiTMPPATH=	${STRICTTMPPATH}:${PATH}
20927910Sasami
21027910Sasami# XXX COMPILER_PATH is needed for finding cc1, ld and as
21136622Scharnier# XXX GCC_EXEC_PREFIX is for *crt.o.  It is probably unnecessary now
21236622Scharnier#	that LIBRARY_PATH is set.  We still can't use -nostdlib, since gcc
21327910Sasami#	wouldn't link *crt.o or libgcc if it were used.
21427910Sasami# XXX LD_LIBRARY_PATH is for ld.so.  It is also used by ld, although we don't
21527910Sasami#	want that - all compile-time library paths should be resolved by gcc.
21627910Sasami#	It fails for set[ug]id executables (are any used?).
21727910SasamiCOMPILER_ENV=	BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \
21827910Sasami		COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
21934509Sbde		GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \
22027910Sasami		LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \
22127910Sasami		LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
22227910Sasami
22336423SpeterBMAKEENV=	PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t \
22436423Speter		OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:/usr/libexec
22527910SasamiXMAKEENV=	PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
22636423Speter		OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
22735479Sbde		CFLAGS="-nostdinc ${CFLAGS}"	# XXX -nostdlib
22827910Sasami
22927910Sasami# used to compile and install 'make' in temporary build tree
23034688SbdeMAKETMP=	${WORLDTMP}/make
23134688SbdeIBMAKE=	${BMAKEENV} MAKEOBJDIR=${MAKETMP} ${MAKE} DESTDIR=${WORLDTMP}
23227910Sasami# bootstrap make
23335427SbdeBMAKE=	${BMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
23427910Sasami# cross make used for compilation
23535427SbdeXMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
23627910Sasami# cross make used for final installation
23735427SbdeIXMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/make
23827910Sasami
23927910Sasami#
24027910Sasami# buildworld
24127910Sasami#
24227910Sasami# Attempt to rebuild the entire system, with reasonable chance of
24327910Sasami# success, regardless of how old your existing system is.
24427910Sasami#
24527910Sasamibuildworld:
24627910Sasami.if !defined(NOCLEAN)
24717308Speter	@echo
24817308Speter	@echo "--------------------------------------------------------------"
24927910Sasami	@echo " Cleaning up the temporary build tree"
25017308Speter	@echo "--------------------------------------------------------------"
25127910Sasami	mkdir -p ${WORLDTMP}
25227910Sasami	chflags -R noschg ${WORLDTMP}/
25327910Sasami	rm -rf ${WORLDTMP}
25427910Sasami.endif
25533133Sadam.if !defined(NOTOOLS)
25617466Speter	@echo
25717308Speter	@echo "--------------------------------------------------------------"
25827910Sasami	@echo " Making make"
25917308Speter	@echo "--------------------------------------------------------------"
26034688Sbde	mkdir -p ${WORLDTMP}/usr/bin ${MAKETMP}
26134688Sbde	( \
26236074Sbde	cd ${.CURDIR}/usr.bin/make; \
26336074Sbde		MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
26436074Sbde		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \
26536074Sbde		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \
26634688Sbde		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \
26734688Sbde	)
26836722Ssos	@echo
26936722Ssos	@echo "--------------------------------------------------------------"
27036800Sbde	@echo " Making mtree"
27136722Ssos	@echo "--------------------------------------------------------------"
27236800Sbde	mkdir -p ${WORLDTMP}/usr/sbin ${WORLDTMP}/mtree
27336722Ssos	( \
27436722Ssos	cd ${.CURDIR}/usr.sbin/mtree; \
27536722Ssos		MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
27636800Sbde		export MAKEOBJDIR=${WORLDTMP}/mtree; \
27736800Sbde		${BMAKE} ${MK_FLAGS} all; \
27836800Sbde		${BMAKE} ${MK_FLAGS} -B install clean \
27936722Ssos	)
28033133Sadam.endif
28117308Speter	@echo
28217308Speter	@echo "--------------------------------------------------------------"
28327910Sasami	@echo " Making hierarchy"
28417308Speter	@echo "--------------------------------------------------------------"
28536074Sbde	cd ${.CURDIR}; ${BMAKE} hierarchy
28627910Sasami.if !defined(NOCLEAN)
28717308Speter	@echo
28817308Speter	@echo "--------------------------------------------------------------"
28927910Sasami	@echo " Cleaning up the obj tree"
29017308Speter	@echo "--------------------------------------------------------------"
29136074Sbde	cd ${.CURDIR}; ${BMAKE} ${CLEANDIR:S/^/par-/}
29227910Sasami.endif
29327910Sasami.if !defined(NOOBJDIR)
29417308Speter	@echo
29517308Speter	@echo "--------------------------------------------------------------"
29627910Sasami	@echo " Rebuilding the obj tree"
29717308Speter	@echo "--------------------------------------------------------------"
29836074Sbde	cd ${.CURDIR}; ${BMAKE} par-${OBJDIR}
29927910Sasami.endif
30033133Sadam.if !defined(NOTOOLS)
30117308Speter	@echo
30217308Speter	@echo "--------------------------------------------------------------"
30327910Sasami	@echo " Rebuilding bootstrap tools"
30417308Speter	@echo "--------------------------------------------------------------"
30536074Sbde	cd ${.CURDIR}; ${BMAKE} bootstrap
30617308Speter	@echo
30717308Speter	@echo "--------------------------------------------------------------"
30827910Sasami	@echo " Rebuilding tools necessary to build the include files"
30917308Speter	@echo "--------------------------------------------------------------"
31036074Sbde	cd ${.CURDIR}; ${BMAKE} include-tools
31133133Sadam.endif
31217308Speter	@echo
31317308Speter	@echo "--------------------------------------------------------------"
31434509Sbde	@echo " Rebuilding ${DESTDIR}/usr/include"
31517308Speter	@echo "--------------------------------------------------------------"
31636429Speter	cd ${.CURDIR}; SHARED=copies ${BMAKE} includes
31735851Sjb	@echo
31835851Sjb	@echo "--------------------------------------------------------------"
31935851Sjb	@echo " Rebuilding bootstrap libraries"
32035851Sjb	@echo "--------------------------------------------------------------"
32136074Sbde	cd ${.CURDIR}; ${BMAKE} bootstrap-libraries
32233133Sadam.if !defined(NOTOOLS)
32317962Speter	@echo
32417962Speter	@echo "--------------------------------------------------------------"
32535851Sjb	@echo " Rebuilding tools needed to build libraries"
32617962Speter	@echo "--------------------------------------------------------------"
32736074Sbde	cd ${.CURDIR}; ${BMAKE} lib-tools
32833133Sadam.endif
32933133Sadam.if !defined(NOTOOLS)
33017962Speter	@echo
33117962Speter	@echo "--------------------------------------------------------------"
33227910Sasami	@echo " Rebuilding all other tools needed to build the world"
33317962Speter	@echo "--------------------------------------------------------------"
33436074Sbde	cd ${.CURDIR}; ${BMAKE} build-tools
33533133Sadam.endif
33635479Sbde.if !defined(_NODEPEND)
33717308Speter	@echo
33817308Speter	@echo "--------------------------------------------------------------"
33927910Sasami	@echo " Rebuilding dependencies"
34017308Speter	@echo "--------------------------------------------------------------"
34136074Sbde	cd ${.CURDIR}; ${XMAKE} par-depend
34235479Sbde.endif
34317308Speter	@echo
34417308Speter	@echo "--------------------------------------------------------------"
34535427Sbde	@echo " Building libraries"
34635427Sbde	@echo "--------------------------------------------------------------"
34736074Sbde	cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries
34835427Sbde	@echo
34935427Sbde	@echo "--------------------------------------------------------------"
35027910Sasami	@echo " Building everything.."
35117962Speter	@echo "--------------------------------------------------------------"
35236074Sbde	cd ${.CURDIR}; ${XMAKE} all
3532061Sjkh
35417308Speter#
35527910Sasami# installworld
35627910Sasami#
35727910Sasami# Installs everything compiled by a 'buildworld'.
35827910Sasami#
35927910Sasamiinstallworld:
36036074Sbde	cd ${.CURDIR}; ${IXMAKE} reinstall
36127910Sasami
36227910Sasami#
36317308Speter# reinstall
36417308Speter#
36517308Speter# If you have a build server, you can NFS mount the source and obj directories
36617308Speter# and do a 'make reinstall' on the *client* to install new binaries from the
36717308Speter# most recent server build.
36817308Speter#
36917308Speterreinstall:
37012483Speter	@echo "--------------------------------------------------------------"
37117308Speter	@echo " Making hierarchy"
37212483Speter	@echo "--------------------------------------------------------------"
37336074Sbde	cd ${.CURDIR}; ${MAKE} hierarchy
37412483Speter	@echo
3752061Sjkh	@echo "--------------------------------------------------------------"
37617962Speter	@echo " Installing everything.."
37717962Speter	@echo "--------------------------------------------------------------"
37836074Sbde	cd ${.CURDIR}; ${MAKE} install
37938042Sbde.if ${MACHINE_ARCH} == "i386"
38017962Speter	@echo
38117962Speter	@echo "--------------------------------------------------------------"
38233595Snate	@echo " Re-scanning the shared libraries.."
38333595Snate	@echo "--------------------------------------------------------------"
38436683Sbde	cd ${.CURDIR}; /sbin/ldconfig -R
38536638Sjb.endif
38633595Snate	@echo
38733595Snate	@echo "--------------------------------------------------------------"
38817962Speter	@echo " Rebuilding man page indexes"
38917962Speter	@echo "--------------------------------------------------------------"
39036074Sbde	cd ${.CURDIR}/share/man; ${MAKE} makedb
3912061Sjkh
39217308Speter#
39317308Speter# update
39417308Speter#
39517308Speter# Update the source tree, by running sup and/or running cvs to update to the
39617308Speter# latest copy.
39717308Speter#
3982302Spaulupdate:
3992302Spaul.if defined(SUP_UPDATE)
4002302Spaul	@echo "--------------------------------------------------------------"
40135462Sjkh	@echo "Running ${SUP}"
4022302Spaul	@echo "--------------------------------------------------------------"
40318714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE}
40410760Sache.if defined(SUPFILE1)
40518714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE1}
4062302Spaul.endif
40710760Sache.if defined(SUPFILE2)
40818714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE2}
40910760Sache.endif
41010760Sache.endif
4112302Spaul.if defined(CVS_UPDATE)
4122302Spaul	@echo "--------------------------------------------------------------"
4132302Spaul	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
4142302Spaul	@echo "--------------------------------------------------------------"
41536074Sbde	cd ${.CURDIR}; cvs -q update -P -d
4162302Spaul.endif
4172302Spaul
41817308Speter#
41917308Speter# most
42017308Speter#
42117308Speter# Build most of the user binaries on the existing system libs and includes.
42217308Speter#
42317308Spetermost:
4242061Sjkh	@echo "--------------------------------------------------------------"
42517308Speter	@echo " Building programs only"
4262061Sjkh	@echo "--------------------------------------------------------------"
42736074Sbde	cd ${.CURDIR}/bin;		${MAKE} all
42836074Sbde	cd ${.CURDIR}/sbin;		${MAKE} all
42936074Sbde	cd ${.CURDIR}/libexec;		${MAKE} all
43036074Sbde	cd ${.CURDIR}/usr.bin;		${MAKE} all
43136074Sbde	cd ${.CURDIR}/usr.sbin;		${MAKE} all
43236074Sbde	cd ${.CURDIR}/gnu/libexec;	${MAKE} all
43336074Sbde	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} all
43436074Sbde	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} all
43530169Sjkh#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
43636074Sbde#	cd ${.CURDIR}/kerberosIV;	${MAKE} most
43717308Speter#.endif
43817308Speter#.if !defined(NOSECURE) && !defined(NOCRYPT)
43936074Sbde#	cd ${.CURDIR}/secure;		${MAKE} most
44017308Speter#.endif
4412061Sjkh
44217308Speter#
44317308Speter# installmost
44417308Speter#
44517308Speter# Install the binaries built by the 'most' target.  This does not include
44617308Speter# libraries or include files.
44717308Speter#
4483626Swollmaninstallmost:
4493626Swollman	@echo "--------------------------------------------------------------"
4503626Swollman	@echo " Installing programs only"
4513626Swollman	@echo "--------------------------------------------------------------"
45236074Sbde	cd ${.CURDIR}/bin;		${MAKE} install
45336074Sbde	cd ${.CURDIR}/sbin;		${MAKE} install
45436074Sbde	cd ${.CURDIR}/libexec;		${MAKE} install
45536074Sbde	cd ${.CURDIR}/usr.bin;		${MAKE} install
45636074Sbde	cd ${.CURDIR}/usr.sbin;		${MAKE} install
45736074Sbde	cd ${.CURDIR}/gnu/libexec;	${MAKE} install
45836074Sbde	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} install
45936074Sbde	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} install
46030169Sjkh#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
46136074Sbde#	cd ${.CURDIR}/kerberosIV;	${MAKE} installmost
4623626Swollman#.endif
4633626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
46436074Sbde#	cd ${.CURDIR}/secure;		${MAKE} installmost
4653626Swollman#.endif
4663626Swollman
46717308Speter#
46817308Speter# ------------------------------------------------------------------------
46917308Speter#
47017308Speter# From here onwards are utility targets used by the 'make world' and
47117308Speter# related targets.  If your 'world' breaks, you may like to try to fix
47217308Speter# the problem and manually run the following targets to attempt to
47317308Speter# complete the build.  Beware, this is *not* guaranteed to work, you
47417308Speter# need to have a pretty good grip on the current state of the system
47517308Speter# to attempt to manually finish it.  If in doubt, 'make world' again.
47617308Speter#
4773626Swollman
47817308Speter#
47917308Speter# heirarchy - ensure that all the needed directories are present
48017308Speter#
48117308Speterhierarchy:
48236074Sbde	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
48317308Speter
48417308Speter#
48517308Speter# bootstrap - [re]build tools needed to run the actual build, this includes
48617308Speter# tools needed by 'make depend', as some tools are needed to generate source
48717308Speter# for the dependency information to be gathered from.
48817308Speter#
48917308Speterbootstrap:
49027910Sasami.if defined(DESTDIR)
49127910Sasami	rm -f ${DESTDIR}/usr/src/sys
49227910Sasami	ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src
49336074Sbde	cd ${.CURDIR}/include; find -dx . | cpio -dump ${DESTDIR}/usr/include
49436442Speter.for d in net netinet posix4 sys vm machine
49536442Speter	if [ -h ${DESTDIR}/usr/include/$d ]; then \
49636442Speter		rm -f ${DESTDIR}/usr/include/$d ; \
49736442Speter	fi
49836442Speter.endfor
49936429Speter	cd ${.CURDIR}/sys; \
50036429Speter		find -dx net netinet posix4 sys vm -name '*.h' -o -type d | \
50136429Speter		cpio -dump ${DESTDIR}/usr/include
50236429Speter	mkdir -p ${DESTDIR}/usr/include/machine
50336638Sjb	cd ${.CURDIR}/sys/${MACHINE_ARCH}/include; find -dx . -name '*.h' -o -type d | \
50436429Speter		cpio -dump ${DESTDIR}/usr/include/machine
50527910Sasami.endif
50636074Sbde	cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
50736074Sbde		${MAKE} ${MK_FLAGS} all; \
50830113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
50936074Sbde	cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
51036074Sbde		${MAKE} ${MK_FLAGS} all; \
51130113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
51237026Sbde	cd ${.CURDIR}/usr.bin/yacc; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
51337026Sbde		${MAKE} ${MK_FLAGS} all; \
51437026Sbde		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
51536074Sbde	cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \
51636074Sbde		${MAKE} ${MK_FLAGS} ${_DEPEND}; \
51736074Sbde		${MAKE} ${MK_FLAGS} -DNOLIB all; \
51836682Sbde		${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
51936682Sbde.if !defined(NOOBJDIR)
52036682Sbde	cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR}
52136682Sbde.endif
52236672Sjkh	cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
52336672Sjkh		${MAKE} ${MK_FLAGS} all; \
52436672Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
52536429Speter.if defined(DESTDIR)
52636429Speter	cd ${.CURDIR}/include && ${MAKE} copies
52736429Speter.endif
52817308Speter
52917308Speter#
53017308Speter# include-tools - generally the same as 'bootstrap', except that it's for
53117308Speter# things that are specifically needed to generate include files.
53217308Speter#
53327910Sasami# XXX should be merged with bootstrap, it's not worth keeeping them separate.
53427910Sasami# Well, maybe it is now.  We force 'cleandepend' here to avoid dependencies
53527910Sasami# on cleaned away headers in ${WORLDTMP}.
53617308Speter#
53717308Speterinclude-tools:
53834520Sbde.for d in usr.bin/compile_et usr.bin/rpcgen
53936074Sbde	cd ${.CURDIR}/$d; ${MAKE} cleandepend; \
54036074Sbde		${MAKE} ${MK_FLAGS} ${_DEPEND}; \
54136074Sbde		${MAKE} ${MK_FLAGS} all; \
54230113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
54334520Sbde.endfor
54417308Speter
54517308Speter#
54617308Speter# includes - possibly generate and install the include files.
54717308Speter#
54814119Speterincludes:
5492061Sjkh.if defined(CLOBBER)
5507130Srgrimes	rm -rf ${DESTDIR}/usr/include/*
5517130Srgrimes	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
5527130Srgrimes		-p ${DESTDIR}/usr/include
5532061Sjkh.endif
55436074Sbde	cd ${.CURDIR}/include;			${MAKE} -B all install
55536074Sbde	cd ${.CURDIR}/gnu/include;		${MAKE} install
55636074Sbde	cd ${.CURDIR}/gnu/lib/libmp;		${MAKE} beforeinstall
55736074Sbde	cd ${.CURDIR}/gnu/lib/libobjc;		${MAKE} beforeinstall
55836074Sbde	cd ${.CURDIR}/gnu/lib/libreadline;	${MAKE} beforeinstall
55936074Sbde	cd ${.CURDIR}/gnu/lib/libregex;		${MAKE} beforeinstall
56036074Sbde	cd ${.CURDIR}/gnu/lib/libstdc++;	${MAKE} beforeinstall
56136074Sbde	cd ${.CURDIR}/gnu/lib/libg++;		${MAKE} beforeinstall
56236074Sbde	cd ${.CURDIR}/gnu/lib/libdialog;	${MAKE} beforeinstall
56336074Sbde	cd ${.CURDIR}/gnu/lib/libgmp;		${MAKE} beforeinstall
56430169Sjkh.if exists(secure) && !defined(NOCRYPT)
56536074Sbde	cd ${.CURDIR}/secure/lib/libdes;	${MAKE} beforeinstall
5663197Scsgr.endif
56730169Sjkh.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
56836074Sbde	cd ${.CURDIR}/kerberosIV/lib/libacl;	${MAKE} beforeinstall
56936074Sbde	cd ${.CURDIR}/kerberosIV/lib/libkadm;	${MAKE} beforeinstall
57036074Sbde	cd ${.CURDIR}/kerberosIV/lib/libkafs;	${MAKE} beforeinstall
57136074Sbde	cd ${.CURDIR}/kerberosIV/lib/libkdb;	${MAKE} beforeinstall
57236074Sbde	cd ${.CURDIR}/kerberosIV/lib/libkrb;	${MAKE} beforeinstall
57336074Sbde	cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
57430169Sjkh.else
57536074Sbde	cd ${.CURDIR}/lib/libtelnet;		${MAKE} beforeinstall
57630169Sjkh.endif
57732427Sjb.if exists(${.CURDIR}/lib/csu/${MACHINE})
57836074Sbde	cd ${.CURDIR}/lib/csu/${MACHINE};	${MAKE} beforeinstall
57932427Sjb.endif
58036074Sbde	cd ${.CURDIR}/lib/libalias;		${MAKE} beforeinstall
58136074Sbde	cd ${.CURDIR}/lib/libc;			${MAKE} beforeinstall
58236074Sbde	cd ${.CURDIR}/lib/libcalendar;		${MAKE} beforeinstall
58336074Sbde	cd ${.CURDIR}/lib/libcurses;		${MAKE} beforeinstall
58436074Sbde	cd ${.CURDIR}/lib/libdisk;		${MAKE} beforeinstall
58536074Sbde	cd ${.CURDIR}/lib/libedit;		${MAKE} beforeinstall
58636074Sbde	cd ${.CURDIR}/lib/libftpio;		${MAKE} beforeinstall
58736074Sbde	cd ${.CURDIR}/lib/libmd;		${MAKE} beforeinstall
58836074Sbde	cd ${.CURDIR}/lib/libmytinfo;		${MAKE} beforeinstall
58936074Sbde	cd ${.CURDIR}/lib/libncurses;		${MAKE} beforeinstall
5907281Srgrimes.if !defined(WANT_CSRG_LIBM)
59136074Sbde	cd ${.CURDIR}/lib/msun;			${MAKE} beforeinstall
5923242Spaul.endif
59336074Sbde	cd ${.CURDIR}/lib/libopie;		${MAKE} beforeinstall
59436074Sbde	cd ${.CURDIR}/lib/libpcap;		${MAKE} beforeinstall
59536074Sbde	cd ${.CURDIR}/lib/librpcsvc;		${MAKE} beforeinstall
59636074Sbde	cd ${.CURDIR}/lib/libskey;		${MAKE} beforeinstall
59730169Sjkh.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \
59830169Sjkh	exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl)
59936074Sbde	cd ${.CURDIR}/lib/libtcl;		${MAKE} installhdrs
60030169Sjkh.endif
60136074Sbde	cd ${.CURDIR}/lib/libtermcap;		${MAKE} beforeinstall
60236074Sbde	cd ${.CURDIR}/lib/libcom_err;		${MAKE} beforeinstall
60336074Sbde	cd ${.CURDIR}/lib/libss;		${MAKE} -B hdrs beforeinstall
60436074Sbde	cd ${.CURDIR}/lib/libscsi;		${MAKE} beforeinstall
60536074Sbde	cd ${.CURDIR}/lib/libutil;		${MAKE} beforeinstall
60636074Sbde	cd ${.CURDIR}/lib/libvgl;		${MAKE} beforeinstall
60736074Sbde	cd ${.CURDIR}/lib/libz;			${MAKE} beforeinstall
60836074Sbde	cd ${.CURDIR}/usr.bin/f2c;		${MAKE} beforeinstall
60936074Sbde	cd ${.CURDIR}/usr.bin/lex;		${MAKE} beforeinstall
6102061Sjkh
61117308Speter#
61236638Sjb# Declare tools if they are not required on all architectures.
61336638Sjb#
61438042Sbde.if ${MACHINE_ARCH} == "i386"
61536638Sjb# aout tools:
61636638Sjb_aout_ar	= usr.bin/ar
61736638Sjb_aout_as	= gnu/usr.bin/as
61836638Sjb_aout_ld	= gnu/usr.bin/ld
61936638Sjb_aout_nm	= usr.bin/nm
62036638Sjb_aout_ranlib	= usr.bin/ranlib
62136638Sjb_aout_size	= usr.bin/size
62236638Sjb_aout_strip	= usr.bin/strip
62336638Sjb_objformat	= usr.bin/objformat
62436638Sjb.endif
62536638Sjb
62636638Sjb#
62717308Speter# lib-tools - build tools to compile and install the libraries.
62817308Speter#
62927910Sasami# XXX gperf is required for cc
63027910Sasami# XXX a new ld and tsort is required for cc
6315366Snatelib-tools:
63227910Sasami.for d in				\
63327910Sasami		gnu/usr.bin/gperf	\
63436638Sjb		${_aout_ld}		\
63527910Sasami		usr.bin/tsort		\
63636638Sjb		${_aout_as}		\
63727910Sasami		gnu/usr.bin/bison	\
63827910Sasami		gnu/usr.bin/cc		\
63936638Sjb		${_aout_ar}		\
64036683Sbde		usr.bin/env		\
64127910Sasami		usr.bin/lex/lib		\
64227910Sasami		usr.bin/mk_cmds		\
64336638Sjb		${_aout_nm}		\
64436638Sjb		${_aout_ranlib}		\
64536638Sjb		${_aout_strip}		\
64636374Ssos		gnu/usr.bin/binutils	\
64736419Speter		usr.bin/uudecode	\
64836638Sjb		${_objformat}
64936074Sbde	cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
65036074Sbde		${MAKE} ${MK_FLAGS} all; \
65136074Sbde		${MAKE} ${MK_FLAGS} -B install; \
65234575Sbde		${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR}
65327910Sasami.endfor
6545366Snate
65517308Speter#
65635427Sbde# We have to know too much about ordering and subdirs in the lib trees:
65717308Speter#
65835427Sbde# To satisfy shared library linkage when only the libraries being built
65935427Sbde# are visible:
66035427Sbde#
66135427Sbde# libcom_err must be built before libss.
66235427Sbde# libcrypt and libmd must be built before libskey.
66335427Sbde# libm must be built before libtcl.
66435427Sbde# libmytinfo must be built before libdialog and libncurses.
66535427Sbde# libncurses must be built before libdialog.
66635427Sbde# libtermcap must be built before libcurses, libedit and libreadline.
66735427Sbde#
66835427Sbde# Some libraries are built conditionally and/or are in inconsistently
66935427Sbde# named directories:
67035427Sbde#
67135427Sbde.if exists(lib/csu/${MACHINE}.pcc)
67235427Sbde_csu=lib/csu/${MACHINE}.pcc
67334541Sbde.else
67435427Sbde_csu=lib/csu/${MACHINE}
67524754Sjdp.endif
67634541Sbde
67736683Sbde.if !defined(NOSECURE) && !defined(NOCRYPT)
67836683Sbde_libcrypt=	secure/lib/libcrypt lib/libcrypt
67936444Speter.else
68035427Sbde_libcrypt=	lib/libcrypt
68135427Sbde.endif
68235427Sbde
68334541Sbde.if defined(WANT_CSRG_LIBM)
68435427Sbde_libm=	lib/libm
68534541Sbde.else
68635427Sbde_libm=	lib/msun
6878295Srgrimes.endif
68834541Sbde
68934541Sbde#
69035427Sbde# bootstrap-libraries - build just enough libraries for the bootstrap
69135427Sbde# tools, and install them under ${WORLDTMP}.
69234541Sbde#
69335427Sbde# Build csu and libgcc early so that some tools get linked to the new
69435427Sbde# versions (too late for the main tools, however).  Then build the
69535427Sbde# necessary prerequisite libraries (libtermcap just needs to be before
69635427Sbde# libcurses, and this only matters for the NOCLEAN case when NOPIC is
69735427Sbde# not set).
69834541Sbde#
69935427Sbde# This is mostly wrong.  The build tools must run on the host system,
70035427Sbde# so they should use host libraries.  We depend on the target being
70135427Sbde# similar enough to the host for new target libraries to work on the
70235427Sbde# host.
70334541Sbde#
70435427Sbdebootstrap-libraries:
70535427Sbde.for _lib in ${_csu} gnu/usr.bin/cc/libgcc lib/libtermcap \
70636397Ssos    gnu/lib/libregex gnu/lib/libreadline lib/libc \
70736444Speter    ${_libcrypt} lib/libcurses lib/libedit ${_libm} \
70835427Sbde    lib/libmd lib/libutil lib/libz usr.bin/lex/lib
70934541Sbde.if exists(${.CURDIR}/${_lib})
71036074Sbde	cd ${.CURDIR}/${_lib}; \
71136074Sbde		${MAKE} ${MK_FLAGS} ${_DEPEND}; \
71236074Sbde		${MAKE} ${MK_FLAGS} all; \
71330113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
7148489Srgrimes.endif
71534541Sbde.endfor
71635427Sbde
71735427Sbde#
71835427Sbde# libraries - build all libraries, and install them under ${DESTDIR}.
71935427Sbde#
72035427Sbde# The ordering is not as special as for bootstrap-libraries.  Build
72135427Sbde# the prerequisites first, then build almost everything else in
72235427Sbde# alphabetical order.
72335427Sbde#
72435427Sbdelibraries:
72535427Sbde.for _lib in lib/libcom_err ${_libcrypt} ${_libm} lib/libmytinfo \
72635427Sbde    lib/libncurses lib/libtermcap \
72735427Sbde    gnu/lib gnu/usr.bin/cc/libgcc lib usr.bin/lex/lib usr.sbin/pcvt/keycap
72835427Sbde.if exists(${.CURDIR}/${_lib})
72936074Sbde	cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install
73035427Sbde.endif
73135427Sbde.endfor
73234541Sbde.if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE)
73336074Sbde	cd ${.CURDIR}/secure/lib; ${MAKE} all; ${MAKE} -B install
7342160Scsgr.endif
73534541Sbde.if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \
73634541Sbde    defined(MAKE_KERBEROS4)
73736074Sbde	cd ${.CURDIR}/kerberosIV/lib; ${MAKE} all; ${MAKE} -B install
7382626Scsgr.endif
7392061Sjkh
74037475Sbde#
74137475Sbde# Exclude unused tools from build-tools.
74237475Sbde#
74337475Sbde.if !defined(NOGAMES) && exists(${.CURDIR}/games)
74437475Sbde_adventure=	games/adventure
74537475Sbde_caesar=	games/caesar
74637475Sbde_hack=		games/hack
74737475Sbde_phantasia=	games/phantasia
74837475Sbde_strfile=	games/fortune/strfile
74936589Sjhay.endif
75037475Sbde.if !defined(NOPERL)
75137475Sbde_perl=		gnu/usr.bin/perl/perl
75237475Sbde.endif
75337475Sbde.if !defined(NOSHARE) && exists(${.CURDIR}/share)
75437475Sbde_scrnmaps=	share/syscons/scrnmaps
75537475Sbde.endif
75637475Sbde.if !defined(NOLKM) && exists(${.CURDIR}/lkm)
75737475Sbde_linux=		lkm/linux
75837475Sbde.endif
75936589Sjhay
76037475SbdeBTMAKEFLAGS=	${MK_FLAGS} -D_BUILD_TOOLS
76137475Sbde
76217308Speter#
76317308Speter# build-tools - build and install any other tools needed to complete the
76417308Speter# compile and install.
76527910Sasami# ifdef stale
76627910Sasami# bc and cpp are required to build groff.  Otherwise, the order here is
76727910Sasami# mostly historical, i.e., bogus.
76827910Sasami# chmod is used to build gcc's tmpmultilib[2] at obscure times.
76927910Sasami# endif stale
77027910Sasami# XXX uname is a bug - the target should not depend on the host.
77117308Speter#
77211806Sphkbuild-tools:
77319175Sbde.for d in				\
77427910Sasami		bin/cat 		\
77527910Sasami		bin/chmod		\
77627910Sasami		bin/cp 			\
77727910Sasami		bin/date		\
77827910Sasami		bin/dd			\
77927910Sasami		bin/echo		\
78027910Sasami		bin/expr		\
78127910Sasami		bin/hostname		\
78227910Sasami		bin/ln			\
78327910Sasami		bin/ls			\
78427910Sasami		bin/mkdir		\
78527910Sasami		bin/mv			\
78627910Sasami		bin/rm			\
78727910Sasami		bin/test		\
78837475Sbde		${_caesar}		\
78937475Sbde		${_strfile}		\
79027910Sasami		gnu/usr.bin/awk		\
79127910Sasami		gnu/usr.bin/bc		\
79227910Sasami		gnu/usr.bin/grep	\
79327910Sasami		gnu/usr.bin/groff	\
79427910Sasami		gnu/usr.bin/gzip	\
79527910Sasami		gnu/usr.bin/man/makewhatis	\
79635621Sbde		gnu/usr.bin/patch	\
79736589Sjhay		${_perl}		\
79827910Sasami		gnu/usr.bin/sort	\
79934509Sbde		gnu/usr.bin/texinfo	\
80027910Sasami		usr.bin/basename	\
80127910Sasami		usr.bin/cap_mkdb	\
80227910Sasami		usr.bin/chflags		\
80327910Sasami		usr.bin/cmp		\
80427910Sasami		usr.bin/col		\
80537473Sbde		usr.bin/colldef		\
80627910Sasami		usr.bin/cpp		\
80727910Sasami		usr.bin/expand		\
80827910Sasami		usr.bin/file2c		\
80927910Sasami		usr.bin/find		\
81027910Sasami		usr.bin/gencat		\
81136454Sjkh		usr.bin/id		\
81236939Speter		usr.bin/join		\
81327910Sasami		usr.bin/lorder		\
81427910Sasami		usr.bin/m4		\
81527910Sasami		usr.bin/mkdep		\
81637473Sbde		usr.bin/mklocale	\
81727910Sasami		usr.bin/paste		\
81827910Sasami		usr.bin/sed		\
81936638Sjb		${_aout_size}		\
82027910Sasami		usr.bin/soelim		\
82119175Sbde		usr.bin/symorder	\
82227910Sasami		usr.bin/touch		\
82327910Sasami		usr.bin/tr		\
82427910Sasami		usr.bin/true		\
82527910Sasami		usr.bin/uname		\
82627910Sasami		usr.bin/uuencode	\
82727910Sasami		usr.bin/vgrind		\
82827910Sasami		usr.bin/vi		\
82927910Sasami		usr.bin/wc		\
83034688Sbde		usr.bin/xargs		\
83127910Sasami		usr.bin/yacc		\
83227910Sasami		usr.sbin/chown		\
83327910Sasami		usr.sbin/mtree		\
83436455Sjkh		usr.sbin/zic		\
83536455Sjkh		bin/sh
83637475Sbde	cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} ${_DEPEND}; \
83737475Sbde		${MAKE} ${BTMAKEFLAGS} all; \
83837475Sbde		${MAKE} ${BTMAKEFLAGS} -B install ${CLEANDIR} ${OBJDIR}
83919175Sbde.endfor
84037475Sbde.if !defined(NOGAMES) && exists(${.CURDIR}/games)
84137473Sbde	cd ${DESTDIR}/usr/games; cp -p caesar strfile ${DESTDIR}/usr/bin
84237475Sbde.endif
84337473Sbde.for d in				\
84437473Sbde		bin/sh			\
84537475Sbde		${_adventure}		\
84637475Sbde		${_hack}		\
84737475Sbde		${_phantasia}		\
84837473Sbde		gnu/usr.bin/cc/cc_tools	\
84937473Sbde		lib/libmytinfo		\
85037475Sbde		${_linux}		\
85137475Sbde		${_scrnmaps}		\
85237473Sbde		sys/i386/boot/netboot
85337475Sbde	cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} build-tools
85437473Sbde.endfor
85537475Sbde	cd ${.CURDIR}/usr.bin/tn3270/tools; ${MAKE} ${BTMAKEFLAGS} all
8562061Sjkh
85735479Sbde.for __target in clean cleandepend cleandir depend obj
85830113Sjkh.for entry in ${SUBDIR}
85930113Sjkh${entry}.${__target}__D: .PHONY
86035294Sdt	@if test -d ${.CURDIR}/${entry}.${MACHINE}; then \
86130113Sjkh		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \
86230113Sjkh		edir=${entry}.${MACHINE}; \
86330113Sjkh		cd ${.CURDIR}/$${edir}; \
86430113Sjkh	else \
86530113Sjkh		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
86630113Sjkh		edir=${entry}; \
86730113Sjkh		cd ${.CURDIR}/$${edir}; \
86830113Sjkh	fi; \
86930113Sjkh	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
87030113Sjkh.endfor
87130113Sjkhpar-${__target}: ${SUBDIR:S/$/.${__target}__D/}
87230113Sjkh.endfor
87330113Sjkh
87432427Sjb.endif
87532427Sjb
8761594Srgrimes.include <bsd.subdir.mk>
877