Makefile revision 30113
12061Sjkh#
230113Sjkh#	$Id: Makefile,v 1.109.2.19 1997/09/28 16:33:05 mckay Exp $
32061Sjkh#
42061Sjkh# Make command line options:
515603Smarkm#	-DCLOBBER will remove /usr/include
630113Sjkh#	-DMAKE_EBONES to build eBones (KerberosIV)
720710Sasami#	-DALLLANG to build documentation for all languages
820710Sasami#	  (where available -- see share/doc/Makefile)
93197Scsgr#
102061Sjkh#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
1112483Speter#	-DNOCLEAN do not clean at all
122160Scsgr#	-DNOCRYPT will prevent building of crypt versions
132834Swollman#	-DNOLKM do not build loadable kernel modules
142061Sjkh#	-DNOOBJDIR do not run ``${MAKE} obj''
152061Sjkh#	-DNOPROFILE do not build profiled libraries
162160Scsgr#	-DNOSECURE do not go into secure subdir
1717308Speter#	-DNOGAMES do not go into games subdir
1819320Sadam#	-DNOSHARE do not go into share subdir
1927788Sasami#	-DNOINFO do not make or install info files
2025980Sasami#	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
211594Srgrimes
2217308Speter#
2317308Speter# The intended user-driven targets are:
2427910Sasami# buildworld  - rebuild *everything*, including glue to help do upgrades
2527910Sasami# installworld- install everything built by "buildworld"
2627910Sasami# world       - buildworld + installworld
2717308Speter# update      - convenient way to update your source tree (eg: sup/cvs)
2817308Speter# most        - build user commands, no libraries or include files
2917308Speter# installmost - install user commands, no libraries or include files
3019175Sbde#
3119175Sbde# Standard targets (not defined here) are documented in the makefiles in
3219175Sbde# /usr/share/mk.  These include:
3319175Sbde#		obj depend all install clean cleandepend cleanobj
3417308Speter
3527910Sasami.if (!make(world)) && (!make(buildworld)) && (!make(installworld))
3625647Sbde.MAKEFLAGS:=	${.MAKEFLAGS} -m ${.CURDIR}/share/mk
3727910Sasami.endif
3817308Speter
392061Sjkh# Put initial settings here.
402061SjkhSUBDIR=
411594Srgrimes
4230113Sjkh# We must do include and lib first so that the perl *.ph generation
437407Srgrimes# works correctly as it uses the header files installed by this.
447108Sphk.if exists(include)
457108SphkSUBDIR+= include
467108Sphk.endif
477407Srgrimes.if exists(lib)
487407SrgrimesSUBDIR+= lib
497407Srgrimes.endif
507108Sphk
512061Sjkh.if exists(bin)
522061SjkhSUBDIR+= bin
532061Sjkh.endif
5417308Speter.if exists(games) && !defined(NOGAMES)
552061SjkhSUBDIR+= games
562061Sjkh.endif
572061Sjkh.if exists(gnu)
582061SjkhSUBDIR+= gnu
592061Sjkh.endif
6030113Sjkh.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
6130113SjkhSUBDIR+= eBones
622626Scsgr.endif
632061Sjkh.if exists(libexec)
642061SjkhSUBDIR+= libexec
652061Sjkh.endif
662061Sjkh.if exists(sbin)
672061SjkhSUBDIR+= sbin
682061Sjkh.endif
6919320Sadam.if exists(share) && !defined(NOSHARE)
702061SjkhSUBDIR+= share
712061Sjkh.endif
722061Sjkh.if exists(sys)
732061SjkhSUBDIR+= sys
742061Sjkh.endif
752061Sjkh.if exists(usr.bin)
762061SjkhSUBDIR+= usr.bin
772061Sjkh.endif
782061Sjkh.if exists(usr.sbin)
792061SjkhSUBDIR+= usr.sbin
802061Sjkh.endif
812834Swollman.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
822834SwollmanSUBDIR+= secure
832834Swollman.endif
842834Swollman.if exists(lkm) && !defined(NOLKM)
852834SwollmanSUBDIR+= lkm
862834Swollman.endif
871594Srgrimes
884486Sphk# etc must be last for "distribute" to work
894486Sphk.if exists(etc) && make(distribute)
904486SphkSUBDIR+= etc
914486Sphk.endif
924486Sphk
932061Sjkh# These are last, since it is nice to at least get the base system
942061Sjkh# rebuilt before you do them.
9525979Sjkh.if defined(LOCAL_DIRS)
9625979Sjkh.for _DIR in ${LOCAL_DIRS}
9725979Sjkh.if exists(${_DIR}) & exists(${_DIR}/Makefile)
9825979SjkhSUBDIR+= ${_DIR}
992061Sjkh.endif
10025979Sjkh.endfor
1012061Sjkh.endif
1022061Sjkh
10317308Speter# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
1042061Sjkh.if defined(NOOBJDIR)
1052061SjkhOBJDIR=
1062061Sjkh.else
1072061SjkhOBJDIR=		obj
1082061Sjkh.endif
10912483Speter
11012483Speter.if defined(NOCLEAN)
11112483SpeterCLEANDIR=
11212483Speter.else
1132061Sjkh.if defined(NOCLEANDIR)
1142061SjkhCLEANDIR=	clean
1158854Srgrimes.else
1162061SjkhCLEANDIR=	cleandir
1172061Sjkh.endif
11812483Speter.endif
1192061Sjkh
12027910SasamiSUP?=		sup
12127910SasamiSUPFLAGS?=	-v
12218714Sache
12317308Speter#
12417308Speter# While building tools for bootstrapping, we dont need to waste time on
12517308Speter# profiled libraries or man pages.  This speeds things up somewhat.
12617308Speter#
12721536SjmacdMK_FLAGS=	-DNOINFO -DNOMAN -DNOPROFILE
12815603Smarkm
12917308Speter#
13017308Speter# world
13117308Speter#
13217308Speter# Attempt to rebuild and reinstall *everything*, with reasonable chance of
13317308Speter# success, regardless of how old your existing system is.
13417308Speter#
13517308Speter# >> Beware, it overwrites the local build environment! <<
13617308Speter#
13717308Speterworld:
13818362Sjkh	@echo "--------------------------------------------------------------"
13919966Sache	@echo "make world started on `LC_TIME=C date`"
14018362Sjkh	@echo "--------------------------------------------------------------"
14117308Speter.if target(pre-world)
14227910Sasami	@echo
14317308Speter	@echo "--------------------------------------------------------------"
14417308Speter	@echo " Making 'pre-world' target"
14517308Speter	@echo "--------------------------------------------------------------"
14628803Speter	cd ${.CURDIR} && ${MAKE} pre-world
14727910Sasami.endif
14828803Speter	cd ${.CURDIR} && ${MAKE} buildworld
14930113Sjkh	cd ${.CURDIR} && ${MAKE} -B installworld
15027910Sasami.if target(post-world)
15117308Speter	@echo
1522061Sjkh	@echo "--------------------------------------------------------------"
15327910Sasami	@echo " Making 'post-world' target"
1542061Sjkh	@echo "--------------------------------------------------------------"
15528803Speter	cd ${.CURDIR} && ${MAKE} post-world
15627910Sasami.endif
1572061Sjkh	@echo
15817308Speter	@echo "--------------------------------------------------------------"
15927910Sasami	@echo "make world completed on `LC_TIME=C date`"
16017308Speter	@echo "--------------------------------------------------------------"
16127910Sasami
16227910Sasami.if defined(MAKEOBJDIRPREFIX)
16327910SasamiWORLDTMP=	${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
16417308Speter.else
16527910SasamiWORLDTMP=	/usr/obj${.CURDIR}/tmp
16617308Speter.endif
16727910SasamiSTRICTTMPPATH=	${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin
16827910SasamiTMPPATH=	${STRICTTMPPATH}:${PATH}
16927910Sasami
17027910Sasami# XXX COMPILER_PATH is needed for finding cc1, ld and as
17127910Sasami# XXX GCC_EXEC_PREFIX is for *crt.o.  It is probably unnecssary now
17227910Sasami#	tbat LIBRARY_PATH is set.  We still can't use -nostdlib, since gcc
17327910Sasami#	wouldn't link *crt.o or libgcc if it were used.
17427910Sasami# XXX LD_LIBRARY_PATH is for ld.so.  It is also used by ld, although we don't
17527910Sasami#	want that - all compile-time library paths should be resolved by gcc.
17627910Sasami#	It fails for set[ug]id executables (are any used?).
17727910SasamiCOMPILER_ENV=	BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \
17827910Sasami		COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
17927910Sasami		GCC_EXEC_PREFIX=${WORLDTMP}/usr/lib/ \
18027910Sasami		LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \
18127910Sasami		LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
18227910Sasami
18327910SasamiBMAKEENV=	PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t
18427910SasamiXMAKEENV=	PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
18527910Sasami		CC='cc -nostdinc'	# XXX -nostdlib
18627910Sasami
18727910Sasami# used to compile and install 'make' in temporary build tree
18827910SasamiIBMAKE=	${BMAKEENV} ${MAKE} DESTDIR=${WORLDTMP}
18927910Sasami# bootstrap make
19027910SasamiBMAKE=	${BMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
19127910Sasami# cross make used for compilation
19227910SasamiXMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
19327910Sasami# cross make used for final installation
19427910SasamiIXMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE}
19527910Sasami
19627910Sasami#
19727910Sasami# buildworld
19827910Sasami#
19927910Sasami# Attempt to rebuild the entire system, with reasonable chance of
20027910Sasami# success, regardless of how old your existing system is.
20127910Sasami#
20227910Sasamibuildworld:
20327910Sasami.if !defined(NOCLEAN)
20417308Speter	@echo
20517308Speter	@echo "--------------------------------------------------------------"
20627910Sasami	@echo " Cleaning up the temporary build tree"
20717308Speter	@echo "--------------------------------------------------------------"
20827910Sasami	mkdir -p ${WORLDTMP}
20927910Sasami	chflags -R noschg ${WORLDTMP}/
21027910Sasami	rm -rf ${WORLDTMP}
21127910Sasami.endif
21217466Speter	@echo
21317308Speter	@echo "--------------------------------------------------------------"
21427910Sasami	@echo " Making make"
21517308Speter	@echo "--------------------------------------------------------------"
21627910Sasami	mkdir -p ${WORLDTMP}/usr/bin
21727910Sasami	cd ${.CURDIR}/usr.bin/make && \
21830113Sjkh		${IBMAKE} -I${.CURDIR}/share/mk -B ${CLEANDIR} ${OBJDIR} depend && \
21930113Sjkh		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all && \
22029130Speter		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} \
22130113Sjkh			-B all install clean cleandepend
22217308Speter	@echo
22317308Speter	@echo "--------------------------------------------------------------"
22427910Sasami	@echo " Making hierarchy"
22517308Speter	@echo "--------------------------------------------------------------"
22627910Sasami	cd ${.CURDIR} && ${BMAKE} hierarchy
22727910Sasami.if !defined(NOCLEAN)
22817308Speter	@echo
22917308Speter	@echo "--------------------------------------------------------------"
23027910Sasami	@echo " Cleaning up the obj tree"
23117308Speter	@echo "--------------------------------------------------------------"
23230113Sjkh	cd ${.CURDIR} && ${BMAKE} par-${CLEANDIR}
23327910Sasami.endif
23427910Sasami.if !defined(NOOBJDIR)
23517308Speter	@echo
23617308Speter	@echo "--------------------------------------------------------------"
23727910Sasami	@echo " Rebuilding the obj tree"
23817308Speter	@echo "--------------------------------------------------------------"
23930113Sjkh	cd ${.CURDIR} && ${BMAKE} par-obj
24027910Sasami.endif
24117308Speter	@echo
24217308Speter	@echo "--------------------------------------------------------------"
24327910Sasami	@echo " Rebuilding bootstrap tools"
24417308Speter	@echo "--------------------------------------------------------------"
24527910Sasami	cd ${.CURDIR} && ${BMAKE} bootstrap
24617308Speter	@echo
24717308Speter	@echo "--------------------------------------------------------------"
24827910Sasami	@echo " Rebuilding tools necessary to build the include files"
24917308Speter	@echo "--------------------------------------------------------------"
25027910Sasami	cd ${.CURDIR} && ${BMAKE} include-tools
25117308Speter	@echo
25217308Speter	@echo "--------------------------------------------------------------"
25327910Sasami	@echo " Rebuilding /usr/include"
25417308Speter	@echo "--------------------------------------------------------------"
25529503Sbde	cd ${.CURDIR} && SHARED=symlinks ${BMAKE} includes
25617962Speter	@echo
25717962Speter	@echo "--------------------------------------------------------------"
25827910Sasami	@echo " Rebuilding tools needed to build the libraries"
25917962Speter	@echo "--------------------------------------------------------------"
26027910Sasami	cd ${.CURDIR} && ${BMAKE} lib-tools
26117962Speter	@echo
26217962Speter	@echo "--------------------------------------------------------------"
26327910Sasami	@echo " Rebuilding /usr/lib"
26417962Speter	@echo "--------------------------------------------------------------"
26527910Sasami	cd ${.CURDIR} && ${BMAKE} libraries
26617962Speter	@echo
26717962Speter	@echo "--------------------------------------------------------------"
26827910Sasami	@echo " Rebuilding all other tools needed to build the world"
26917962Speter	@echo "--------------------------------------------------------------"
27027910Sasami	cd ${.CURDIR} && ${BMAKE} build-tools
27117308Speter	@echo
27217308Speter	@echo "--------------------------------------------------------------"
27327910Sasami	@echo " Rebuilding dependencies"
27417308Speter	@echo "--------------------------------------------------------------"
27530113Sjkh	cd ${.CURDIR} && ${XMAKE} ${.MAKEFLAGS} par-depend
27617308Speter	@echo
27717308Speter	@echo "--------------------------------------------------------------"
27827910Sasami	@echo " Building everything.."
27917962Speter	@echo "--------------------------------------------------------------"
28027910Sasami	cd ${.CURDIR} && ${XMAKE} all
2812061Sjkh
28217308Speter#
28327910Sasami# installworld
28427910Sasami#
28527910Sasami# Installs everything compiled by a 'buildworld'.
28627910Sasami#
28727910Sasamiinstallworld:
28827910Sasami	cd ${.CURDIR} && ${IXMAKE} reinstall
28927910Sasami
29027910Sasami#
29117308Speter# reinstall
29217308Speter#
29317308Speter# If you have a build server, you can NFS mount the source and obj directories
29417308Speter# and do a 'make reinstall' on the *client* to install new binaries from the
29517308Speter# most recent server build.
29617308Speter#
29717308Speterreinstall:
29812483Speter	@echo "--------------------------------------------------------------"
29917308Speter	@echo " Making hierarchy"
30012483Speter	@echo "--------------------------------------------------------------"
30117308Speter	cd ${.CURDIR} && ${MAKE} hierarchy
30212483Speter	@echo
3032061Sjkh	@echo "--------------------------------------------------------------"
30417962Speter	@echo " Installing everything.."
30517962Speter	@echo "--------------------------------------------------------------"
30617308Speter	cd ${.CURDIR} && ${MAKE} install
30717962Speter	@echo
30817962Speter	@echo "--------------------------------------------------------------"
30917962Speter	@echo " Rebuilding man page indexes"
31017962Speter	@echo "--------------------------------------------------------------"
31117308Speter	cd ${.CURDIR}/share/man && ${MAKE} makedb
3122061Sjkh
31317308Speter#
31417308Speter# update
31517308Speter#
31617308Speter# Update the source tree, by running sup and/or running cvs to update to the
31717308Speter# latest copy.
31817308Speter#
3192302Spaulupdate:
3202302Spaul.if defined(SUP_UPDATE)
3212302Spaul	@echo "--------------------------------------------------------------"
3222302Spaul	@echo "Running sup"
3232302Spaul	@echo "--------------------------------------------------------------"
32418714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE}
32510760Sache.if defined(SUPFILE1)
32618714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE1}
3272302Spaul.endif
32810760Sache.if defined(SUPFILE2)
32918714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE2}
33010760Sache.endif
33110760Sache.endif
3322302Spaul.if defined(CVS_UPDATE)
3332302Spaul	@echo "--------------------------------------------------------------"
3342302Spaul	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
3352302Spaul	@echo "--------------------------------------------------------------"
33630113Sjkh	cd ${.CURDIR} && cvs -q update -P -d -r RELENG_2_2
3372302Spaul.endif
3382302Spaul
33917308Speter#
34017308Speter# most
34117308Speter#
34217308Speter# Build most of the user binaries on the existing system libs and includes.
34317308Speter#
34417308Spetermost:
3452061Sjkh	@echo "--------------------------------------------------------------"
34617308Speter	@echo " Building programs only"
3472061Sjkh	@echo "--------------------------------------------------------------"
34830113Sjkh	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
34930113Sjkh	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
35030113Sjkh	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
35130113Sjkh	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
35230113Sjkh	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
35330113Sjkh	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
35430113Sjkh	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
35530113Sjkh	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
35630113Sjkh#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
35730113Sjkh#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
35817308Speter#.endif
35917308Speter#.if !defined(NOSECURE) && !defined(NOCRYPT)
36030113Sjkh#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
36117308Speter#.endif
3622061Sjkh
36317308Speter#
36417308Speter# installmost
36517308Speter#
36617308Speter# Install the binaries built by the 'most' target.  This does not include
36717308Speter# libraries or include files.
36817308Speter#
3693626Swollmaninstallmost:
3703626Swollman	@echo "--------------------------------------------------------------"
3713626Swollman	@echo " Installing programs only"
3723626Swollman	@echo "--------------------------------------------------------------"
37330113Sjkh	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
37430113Sjkh	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
37530113Sjkh	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
37630113Sjkh	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
37730113Sjkh	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
37830113Sjkh	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
37930113Sjkh	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
38030113Sjkh	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
38130113Sjkh#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
38230113Sjkh#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
3833626Swollman#.endif
3843626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
38530113Sjkh#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
3863626Swollman#.endif
3873626Swollman
38817308Speter#
38917308Speter# ------------------------------------------------------------------------
39017308Speter#
39117308Speter# From here onwards are utility targets used by the 'make world' and
39217308Speter# related targets.  If your 'world' breaks, you may like to try to fix
39317308Speter# the problem and manually run the following targets to attempt to
39417308Speter# complete the build.  Beware, this is *not* guaranteed to work, you
39517308Speter# need to have a pretty good grip on the current state of the system
39617308Speter# to attempt to manually finish it.  If in doubt, 'make world' again.
39717308Speter#
3983626Swollman
39917308Speter#
40017308Speter# heirarchy - ensure that all the needed directories are present
40117308Speter#
40217308Speterhierarchy:
40317308Speter	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
40417308Speter
40517308Speter#
40617308Speter# bootstrap - [re]build tools needed to run the actual build, this includes
40717308Speter# tools needed by 'make depend', as some tools are needed to generate source
40817308Speter# for the dependency information to be gathered from.
40917308Speter#
41017308Speterbootstrap:
41127910Sasami.if defined(DESTDIR)
41227910Sasami	rm -f ${DESTDIR}/usr/src/sys
41327910Sasami	ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src
41427910Sasami	cd ${.CURDIR}/include && find -dx . | cpio -dump ${DESTDIR}/usr/include
41527910Sasami	cd ${.CURDIR}/include && make symlinks
41627910Sasami.endif
41717820Sjkh	cd ${.CURDIR}/usr.bin/make && ${MAKE} depend && \
41830113Sjkh		${MAKE} ${MK_FLAGS} all && \
41930113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
42017820Sjkh	cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \
42130113Sjkh		${MAKE} ${MK_FLAGS} all && \
42230113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
42317820Sjkh	cd ${.CURDIR}/usr.bin/lex && ${MAKE} bootstrap && ${MAKE} depend && \
42430113Sjkh		${MAKE} ${MK_FLAGS} -DNOLIB && \
42530113Sjkh		${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
42629938Smckay.if !defined(NOOBJDIR)
42729938Smckay	cd ${.CURDIR}/usr.bin/lex && ${MAKE} obj
42829938Smckay.endif
42917308Speter
43017308Speter#
43117308Speter# include-tools - generally the same as 'bootstrap', except that it's for
43217308Speter# things that are specifically needed to generate include files.
43317308Speter#
43427910Sasami# XXX should be merged with bootstrap, it's not worth keeeping them separate.
43527910Sasami# Well, maybe it is now.  We force 'cleandepend' here to avoid dependencies
43627910Sasami# on cleaned away headers in ${WORLDTMP}.
43717308Speter#
43817308Speterinclude-tools:
43930113Sjkh	cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} -B cleandepend depend && \
44030113Sjkh		${MAKE} ${MK_FLAGS} all && \
44130113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
44217308Speter
44317308Speter#
44417308Speter# includes - possibly generate and install the include files.
44517308Speter#
44614119Speterincludes:
4472061Sjkh.if defined(CLOBBER)
4487130Srgrimes	rm -rf ${DESTDIR}/usr/include/*
4497130Srgrimes	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
4507130Srgrimes		-p ${DESTDIR}/usr/include
4512061Sjkh.endif
45230113Sjkh	cd ${.CURDIR}/include &&		${MAKE} -B all install
45317308Speter	cd ${.CURDIR}/gnu/include &&		${MAKE} install
4542685Srgrimes	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
4556927Snate	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
45627790Sasami	cd ${.CURDIR}/gnu/lib/libstdc++ &&	${MAKE} beforeinstall
45727790Sasami	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
45827790Sasami	cd ${.CURDIR}/gnu/lib/libdialog &&	${MAKE} beforeinstall
45930113Sjkh.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
46030113Sjkh	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
46130113Sjkh	cd ${.CURDIR}/eBones/lib/libkrb &&	${MAKE} beforeinstall
46230113Sjkh	cd ${.CURDIR}/eBones/lib/libkadm &&	${MAKE} beforeinstall
4633197Scsgr.endif
46425313Sbde	cd ${.CURDIR}/lib/csu/i386 &&		${MAKE} beforeinstall
46526152Speter	cd ${.CURDIR}/lib/libalias &&		${MAKE} beforeinstall
4662061Sjkh	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
4672061Sjkh	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
4682061Sjkh	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
46916786Snate	cd ${.CURDIR}/lib/libftpio &&		${MAKE} beforeinstall
4702883Sphk	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
47127790Sasami	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE} beforeinstall
47217308Speter	cd ${.CURDIR}/lib/libncurses &&		${MAKE} beforeinstall
4737281Srgrimes.if !defined(WANT_CSRG_LIBM)
4743242Spaul	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
4753242Spaul.endif
4767171Sats	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
4772061Sjkh	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
4783213Spst	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
47917308Speter	cd ${.CURDIR}/lib/libtermcap &&		${MAKE} beforeinstall
4805749Swollman	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
4815772Swollman	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
48217308Speter	cd ${.CURDIR}/lib/libscsi &&		${MAKE} beforeinstall
48317308Speter	cd ${.CURDIR}/lib/libutil &&		${MAKE} beforeinstall
48426504Sjhay	cd ${.CURDIR}/lib/libz &&		${MAKE} beforeinstall
4852061Sjkh
48617308Speter#
48717308Speter# lib-tools - build tools to compile and install the libraries.
48817308Speter#
48927910Sasami# XXX gperf is required for cc
49027910Sasami# XXX a new ld and tsort is required for cc
4915366Snatelib-tools:
49227910Sasami.for d in				\
49327910Sasami		gnu/usr.bin/gperf	\
49427910Sasami		gnu/usr.bin/ld		\
49527910Sasami		usr.bin/tsort		\
49627910Sasami		gnu/usr.bin/as		\
49727910Sasami		gnu/usr.bin/bison	\
49827910Sasami		gnu/usr.bin/cc		\
49927910Sasami		usr.bin/ar		\
50027910Sasami		usr.bin/compile_et	\
50127910Sasami		usr.bin/lex/lib		\
50227910Sasami		usr.bin/mk_cmds		\
50327910Sasami		usr.bin/nm		\
50427910Sasami		usr.bin/ranlib		\
50527910Sasami		usr.bin/uudecode
50627910Sasami	cd ${.CURDIR}/$d && ${MAKE} depend && \
50730113Sjkh		${MAKE} ${MK_FLAGS} all && \
50830113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
50927910Sasami.endfor
5105366Snate
51117308Speter#
51217308Speter# libraries - build and install the libraries
51317308Speter#
5142061Sjkhlibraries:
51524754Sjdp.if exists(lib/csu/i386)
51624754Sjdp	cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
51730113Sjkh		${MAKE} ${MK_FLAGS} all && \
51830113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
51924754Sjdp.endif
5208295Srgrimes.if exists(lib/libcompat)
52117820Sjkh	cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
52230113Sjkh		${MAKE} ${MK_FLAGS} all && \
52330113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5248295Srgrimes.endif
5258489Srgrimes.if exists(lib/libncurses)
52617820Sjkh	cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \
52730113Sjkh		${MAKE} ${MK_FLAGS} all && \
52830113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5298489Srgrimes.endif
5308489Srgrimes.if exists(lib/libtermcap)
53117820Sjkh	cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
53230113Sjkh		${MAKE} ${MK_FLAGS} all && \
53330113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5348489Srgrimes.endif
5358295Srgrimes.if exists(gnu)
53617820Sjkh	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
53730113Sjkh		${MAKE} ${MK_FLAGS} all && \
53830113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5398295Srgrimes.endif
5402160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
54117820Sjkh	cd ${.CURDIR}/secure/lib && ${MAKE} depend && \
54230113Sjkh		${MAKE} ${MK_FLAGS} all && \
54330113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5442160Scsgr.endif
5452279Spaul.if exists(lib)
54617820Sjkh	cd ${.CURDIR}/lib && ${MAKE} depend && \
54730113Sjkh		${MAKE} ${MK_FLAGS} all && \
54830113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5492279Spaul.endif
55017234Sjraynard.if exists(usr.bin/lex/lib)
55117820Sjkh	cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
55230113Sjkh		${MAKE} ${MK_FLAGS} all && \
55330113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
55411772Snate.endif
55530113Sjkh.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
55630113Sjkh	cd ${.CURDIR}/eBones/lib && ${MAKE} depend && \
55730113Sjkh		${MAKE} ${MK_FLAGS} all && \
55830113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5592626Scsgr.endif
5608304Srgrimes.if exists(usr.sbin/pcvt/keycap)
56117820Sjkh	cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \
56230113Sjkh		${MAKE} ${MK_FLAGS} all && \
56330113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5648304Srgrimes.endif
5652061Sjkh
56617308Speter#
56717308Speter# build-tools - build and install any other tools needed to complete the
56817308Speter# compile and install.
56927910Sasami# ifdef stale
57027910Sasami# bc and cpp are required to build groff.  Otherwise, the order here is
57127910Sasami# mostly historical, i.e., bogus.
57227910Sasami# chmod is used to build gcc's tmpmultilib[2] at obscure times.
57327910Sasami# endif stale
57427910Sasami# XXX uname is a bug - the target should not depend on the host.
57517308Speter#
57611806Sphkbuild-tools:
57719175Sbde.for d in				\
57827910Sasami		bin/cat 		\
57927910Sasami		bin/chmod		\
58027910Sasami		bin/cp 			\
58127910Sasami		bin/date		\
58227910Sasami		bin/dd			\
58327910Sasami		bin/echo		\
58427910Sasami		bin/expr		\
58527910Sasami		bin/hostname		\
58627910Sasami		bin/ln			\
58727910Sasami		bin/ls			\
58827910Sasami		bin/mkdir		\
58927910Sasami		bin/mv			\
59027910Sasami		bin/rm			\
59127910Sasami		bin/sh			\
59227910Sasami		bin/test		\
59327910Sasami		gnu/usr.bin/awk		\
59427910Sasami		gnu/usr.bin/bc		\
59527910Sasami		gnu/usr.bin/grep	\
59627910Sasami		gnu/usr.bin/groff	\
59727910Sasami		gnu/usr.bin/gzip	\
59827910Sasami		gnu/usr.bin/man/makewhatis	\
59927910Sasami		gnu/usr.bin/sort	\
60027910Sasami		gnu/usr.bin/texinfo     \
60121673Sjkh		share/info		\
60227910Sasami		usr.bin/basename	\
60327910Sasami		usr.bin/cap_mkdb	\
60427910Sasami		usr.bin/chflags		\
60527910Sasami		usr.bin/cmp		\
60627910Sasami		usr.bin/col		\
60727910Sasami		usr.bin/cpp		\
60827910Sasami		usr.bin/expand		\
60927910Sasami		usr.bin/file2c		\
61027910Sasami		usr.bin/find		\
61127910Sasami		usr.bin/gencat		\
61227910Sasami		usr.bin/lorder		\
61327910Sasami		usr.bin/m4		\
61427910Sasami		usr.bin/mkdep		\
61527910Sasami		usr.bin/paste		\
61627910Sasami		usr.bin/sed		\
61727910Sasami		usr.bin/size		\
61827910Sasami		usr.bin/soelim		\
61927910Sasami		usr.bin/strip		\
62019175Sbde		usr.bin/symorder	\
62127910Sasami		usr.bin/touch		\
62227910Sasami		usr.bin/tr		\
62327910Sasami		usr.bin/true		\
62427910Sasami		usr.bin/uname		\
62527910Sasami		usr.bin/uuencode	\
62627910Sasami		usr.bin/vgrind		\
62727910Sasami		usr.bin/vi		\
62827910Sasami		usr.bin/wc		\
62927910Sasami		usr.bin/yacc		\
63027910Sasami		usr.sbin/chown		\
63127910Sasami		usr.sbin/mtree		\
63227910Sasami		usr.sbin/zic
63319175Sbde	cd ${.CURDIR}/$d && ${MAKE} depend && \
63430113Sjkh		${MAKE} ${MK_FLAGS} all && \
63530113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
63619175Sbde.endfor
6372061Sjkh
63830113Sjkh.for __target in clean cleandir obj depend
63930113Sjkh.for entry in ${SUBDIR}
64030113Sjkh${entry}.${__target}__D: .PHONY
64130113Sjkh	if test -d ${.CURDIR}/${entry}.${MACHINE}; then \
64230113Sjkh		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \
64330113Sjkh		edir=${entry}.${MACHINE}; \
64430113Sjkh		cd ${.CURDIR}/$${edir}; \
64530113Sjkh	else \
64630113Sjkh		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
64730113Sjkh		edir=${entry}; \
64830113Sjkh		cd ${.CURDIR}/$${edir}; \
64930113Sjkh	fi; \
65030113Sjkh	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
65130113Sjkh.endfor
65230113Sjkhpar-${__target}: ${SUBDIR:S/$/.${__target}__D/}
65330113Sjkh.endfor
65430113Sjkh
6551594Srgrimes.include <bsd.subdir.mk>
656