Makefile revision 28532
12061Sjkh#
228532Sbde#	$Id: Makefile,v 1.138 1997/08/21 15:16:07 bde Exp $
32061Sjkh#
42061Sjkh# Make command line options:
515603Smarkm#	-DCLOBBER will remove /usr/include
63197Scsgr#	-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
2027788Sasami#	-DNOLIBC_R do not build libc_r.
2125980Sasami#	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
221594Srgrimes
2317308Speter#
2417308Speter# The intended user-driven targets are:
2527910Sasami# buildworld  - rebuild *everything*, including glue to help do upgrades
2627910Sasami# installworld- install everything built by "buildworld"
2727910Sasami# world       - buildworld + installworld
2817308Speter# update      - convenient way to update your source tree (eg: sup/cvs)
2917308Speter# most        - build user commands, no libraries or include files
3017308Speter# installmost - install user commands, no libraries or include files
3119175Sbde#
3219175Sbde# Standard targets (not defined here) are documented in the makefiles in
3319175Sbde# /usr/share/mk.  These include:
3419175Sbde#		obj depend all install clean cleandepend cleanobj
3517308Speter
3627910Sasami.if (!make(world)) && (!make(buildworld)) && (!make(installworld))
3725647Sbde.MAKEFLAGS:=	${.MAKEFLAGS} -m ${.CURDIR}/share/mk
3827910Sasami.endif
3917308Speter
402061Sjkh# Put initial settings here.
412061SjkhSUBDIR=
421594Srgrimes
4328531Sbde# We must do share/info early so that installation of info `dir'
4428531Sbde# entries works correctly.  Do it first since it is less likely to
4528531Sbde# grow dependencies on include and lib than vice versa.
4628531Sbde.if exists(share/info)
4728531SbdeSUBDIR+= share/info
4828531Sbde.endif
4928531Sbde
5028531Sbde# We must do include and lib early so that the perl *.ph generation
517407Srgrimes# works correctly as it uses the header files installed by this.
527108Sphk.if exists(include)
537108SphkSUBDIR+= include
547108Sphk.endif
557407Srgrimes.if exists(lib)
567407SrgrimesSUBDIR+= lib
577407Srgrimes.endif
587108Sphk
592061Sjkh.if exists(bin)
602061SjkhSUBDIR+= bin
612061Sjkh.endif
6217308Speter.if exists(games) && !defined(NOGAMES)
632061SjkhSUBDIR+= games
642061Sjkh.endif
652061Sjkh.if exists(gnu)
662061SjkhSUBDIR+= gnu
672061Sjkh.endif
683197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
692626ScsgrSUBDIR+= eBones
702626Scsgr.endif
712061Sjkh.if exists(libexec)
722061SjkhSUBDIR+= libexec
732061Sjkh.endif
742061Sjkh.if exists(sbin)
752061SjkhSUBDIR+= sbin
762061Sjkh.endif
7719320Sadam.if exists(share) && !defined(NOSHARE)
782061SjkhSUBDIR+= share
792061Sjkh.endif
802061Sjkh.if exists(sys)
812061SjkhSUBDIR+= sys
822061Sjkh.endif
832061Sjkh.if exists(usr.bin)
842061SjkhSUBDIR+= usr.bin
852061Sjkh.endif
862061Sjkh.if exists(usr.sbin)
872061SjkhSUBDIR+= usr.sbin
882061Sjkh.endif
892834Swollman.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
902834SwollmanSUBDIR+= secure
912834Swollman.endif
922834Swollman.if exists(lkm) && !defined(NOLKM)
932834SwollmanSUBDIR+= lkm
942834Swollman.endif
951594Srgrimes
964486Sphk# etc must be last for "distribute" to work
974486Sphk.if exists(etc) && make(distribute)
984486SphkSUBDIR+= etc
994486Sphk.endif
1004486Sphk
1012061Sjkh# These are last, since it is nice to at least get the base system
1022061Sjkh# rebuilt before you do them.
10325979Sjkh.if defined(LOCAL_DIRS)
10425979Sjkh.for _DIR in ${LOCAL_DIRS}
10525979Sjkh.if exists(${_DIR}) & exists(${_DIR}/Makefile)
10625979SjkhSUBDIR+= ${_DIR}
1072061Sjkh.endif
10825979Sjkh.endfor
1092061Sjkh.endif
1102061Sjkh
11117308Speter# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
1122061Sjkh.if defined(NOOBJDIR)
1132061SjkhOBJDIR=
1142061Sjkh.else
1152061SjkhOBJDIR=		obj
1162061Sjkh.endif
11712483Speter
11812483Speter.if defined(NOCLEAN)
11912483SpeterCLEANDIR=
12012483Speter.else
1212061Sjkh.if defined(NOCLEANDIR)
1222061SjkhCLEANDIR=	clean
1238854Srgrimes.else
1242061SjkhCLEANDIR=	cleandir
1252061Sjkh.endif
12612483Speter.endif
1272061Sjkh
12827910SasamiSUP?=		sup
12927910SasamiSUPFLAGS?=	-v
13018714Sache
13117308Speter#
13217308Speter# While building tools for bootstrapping, we dont need to waste time on
13317308Speter# profiled libraries or man pages.  This speeds things up somewhat.
13417308Speter#
13521536SjmacdMK_FLAGS=	-DNOINFO -DNOMAN -DNOPROFILE
13615603Smarkm
13717308Speter#
13817308Speter# world
13917308Speter#
14017308Speter# Attempt to rebuild and reinstall *everything*, with reasonable chance of
14117308Speter# success, regardless of how old your existing system is.
14217308Speter#
14317308Speter# >> Beware, it overwrites the local build environment! <<
14417308Speter#
14517308Speterworld:
14618362Sjkh	@echo "--------------------------------------------------------------"
14719966Sache	@echo "make world started on `LC_TIME=C date`"
14818362Sjkh	@echo "--------------------------------------------------------------"
14917308Speter.if target(pre-world)
15027910Sasami	@echo
15117308Speter	@echo "--------------------------------------------------------------"
15217308Speter	@echo " Making 'pre-world' target"
15317308Speter	@echo "--------------------------------------------------------------"
15428358Speter	cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} pre-world
15527910Sasami.endif
15628358Speter	cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} buildworld
15728358Speter	cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} installworld
15827910Sasami.if target(post-world)
15917308Speter	@echo
1602061Sjkh	@echo "--------------------------------------------------------------"
16127910Sasami	@echo " Making 'post-world' target"
1622061Sjkh	@echo "--------------------------------------------------------------"
16328358Speter	cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} post-world
16427910Sasami.endif
1652061Sjkh	@echo
16617308Speter	@echo "--------------------------------------------------------------"
16727910Sasami	@echo "make world completed on `LC_TIME=C date`"
16817308Speter	@echo "--------------------------------------------------------------"
16927910Sasami
17027910Sasami.if defined(MAKEOBJDIRPREFIX)
17127910SasamiWORLDTMP=	${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
17217308Speter.else
17327910SasamiWORLDTMP=	/usr/obj${.CURDIR}/tmp
17417308Speter.endif
17527910SasamiSTRICTTMPPATH=	${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin
17627910SasamiTMPPATH=	${STRICTTMPPATH}:${PATH}
17727910Sasami
17827910Sasami# XXX COMPILER_PATH is needed for finding cc1, ld and as
17927910Sasami# XXX GCC_EXEC_PREFIX is for *crt.o.  It is probably unnecssary now
18027910Sasami#	tbat LIBRARY_PATH is set.  We still can't use -nostdlib, since gcc
18127910Sasami#	wouldn't link *crt.o or libgcc if it were used.
18227910Sasami# XXX LD_LIBRARY_PATH is for ld.so.  It is also used by ld, although we don't
18327910Sasami#	want that - all compile-time library paths should be resolved by gcc.
18427910Sasami#	It fails for set[ug]id executables (are any used?).
18527910SasamiCOMPILER_ENV=	BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \
18627910Sasami		COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
18727910Sasami		GCC_EXEC_PREFIX=${WORLDTMP}/usr/lib/ \
18827910Sasami		LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \
18927910Sasami		LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
19027910Sasami
19127910SasamiBMAKEENV=	PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t
19227910SasamiXMAKEENV=	PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
19327910Sasami		CC='cc -nostdinc'	# XXX -nostdlib
19427910Sasami
19527910Sasami# used to compile and install 'make' in temporary build tree
19627910SasamiIBMAKE=	${BMAKEENV} ${MAKE} DESTDIR=${WORLDTMP}
19727910Sasami# bootstrap make
19827910SasamiBMAKE=	${BMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
19927910Sasami# cross make used for compilation
20027910SasamiXMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
20127910Sasami# cross make used for final installation
20227910SasamiIXMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE}
20327910Sasami
20427910Sasami#
20527910Sasami# buildworld
20627910Sasami#
20727910Sasami# Attempt to rebuild the entire system, with reasonable chance of
20827910Sasami# success, regardless of how old your existing system is.
20927910Sasami#
21027910Sasamibuildworld:
21127910Sasami.if !defined(NOCLEAN)
21217308Speter	@echo
21317308Speter	@echo "--------------------------------------------------------------"
21427910Sasami	@echo " Cleaning up the temporary build tree"
21517308Speter	@echo "--------------------------------------------------------------"
21627910Sasami	mkdir -p ${WORLDTMP}
21727910Sasami	chflags -R noschg ${WORLDTMP}/
21827910Sasami	rm -rf ${WORLDTMP}
21927910Sasami.endif
22017466Speter	@echo
22117308Speter	@echo "--------------------------------------------------------------"
22227910Sasami	@echo " Making make"
22317308Speter	@echo "--------------------------------------------------------------"
22427910Sasami	mkdir -p ${WORLDTMP}/usr/bin
22527910Sasami	cd ${.CURDIR}/usr.bin/make && \
22628531Sbde		${IBMAKE} -I${.CURDIR}/share/mk \
22728531Sbde			${OBJDIR} clean cleandepend depend && \
22828531Sbde		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} \
22928531Sbde			all install clean cleandepend
23017308Speter	@echo
23117308Speter	@echo "--------------------------------------------------------------"
23227910Sasami	@echo " Making hierarchy"
23317308Speter	@echo "--------------------------------------------------------------"
23427910Sasami	cd ${.CURDIR} && ${BMAKE} hierarchy
23527910Sasami.if !defined(NOCLEAN)
23617308Speter	@echo
23717308Speter	@echo "--------------------------------------------------------------"
23827910Sasami	@echo " Cleaning up the obj tree"
23917308Speter	@echo "--------------------------------------------------------------"
24027910Sasami	cd ${.CURDIR} && ${BMAKE} ${CLEANDIR}
24127910Sasami.endif
24227910Sasami.if !defined(NOOBJDIR)
24317308Speter	@echo
24417308Speter	@echo "--------------------------------------------------------------"
24527910Sasami	@echo " Rebuilding the obj tree"
24617308Speter	@echo "--------------------------------------------------------------"
24727910Sasami	cd ${.CURDIR} && ${BMAKE} obj
24827910Sasami.endif
24917308Speter	@echo
25017308Speter	@echo "--------------------------------------------------------------"
25127910Sasami	@echo " Rebuilding bootstrap tools"
25217308Speter	@echo "--------------------------------------------------------------"
25327910Sasami	cd ${.CURDIR} && ${BMAKE} bootstrap
25417308Speter	@echo
25517308Speter	@echo "--------------------------------------------------------------"
25627910Sasami	@echo " Rebuilding tools necessary to build the include files"
25717308Speter	@echo "--------------------------------------------------------------"
25827910Sasami	cd ${.CURDIR} && ${BMAKE} include-tools
25917308Speter	@echo
26017308Speter	@echo "--------------------------------------------------------------"
26127910Sasami	@echo " Rebuilding /usr/include"
26217308Speter	@echo "--------------------------------------------------------------"
26327910Sasami	cd ${.CURDIR} && ${BMAKE} includes
26417962Speter	@echo
26517962Speter	@echo "--------------------------------------------------------------"
26627910Sasami	@echo " Rebuilding tools needed to build the libraries"
26717962Speter	@echo "--------------------------------------------------------------"
26827910Sasami	cd ${.CURDIR} && ${BMAKE} lib-tools
26917962Speter	@echo
27017962Speter	@echo "--------------------------------------------------------------"
27127910Sasami	@echo " Rebuilding /usr/lib"
27217962Speter	@echo "--------------------------------------------------------------"
27327910Sasami	cd ${.CURDIR} && ${BMAKE} libraries
27417962Speter	@echo
27517962Speter	@echo "--------------------------------------------------------------"
27627910Sasami	@echo " Rebuilding all other tools needed to build the world"
27717962Speter	@echo "--------------------------------------------------------------"
27827910Sasami	cd ${.CURDIR} && ${BMAKE} build-tools
27917308Speter	@echo
28017308Speter	@echo "--------------------------------------------------------------"
28127910Sasami	@echo " Rebuilding dependencies"
28217308Speter	@echo "--------------------------------------------------------------"
28327910Sasami	cd ${.CURDIR} && ${XMAKE} depend
28417308Speter	@echo
28517308Speter	@echo "--------------------------------------------------------------"
28627910Sasami	@echo " Building everything.."
28717962Speter	@echo "--------------------------------------------------------------"
28827910Sasami	cd ${.CURDIR} && ${XMAKE} all
2892061Sjkh
29017308Speter#
29127910Sasami# installworld
29227910Sasami#
29327910Sasami# Installs everything compiled by a 'buildworld'.
29427910Sasami#
29527910Sasamiinstallworld:
29627910Sasami	cd ${.CURDIR} && ${IXMAKE} reinstall
29727910Sasami
29827910Sasami#
29917308Speter# reinstall
30017308Speter#
30117308Speter# If you have a build server, you can NFS mount the source and obj directories
30217308Speter# and do a 'make reinstall' on the *client* to install new binaries from the
30317308Speter# most recent server build.
30417308Speter#
30517308Speterreinstall:
30612483Speter	@echo "--------------------------------------------------------------"
30717308Speter	@echo " Making hierarchy"
30812483Speter	@echo "--------------------------------------------------------------"
30917308Speter	cd ${.CURDIR} && ${MAKE} hierarchy
31012483Speter	@echo
3112061Sjkh	@echo "--------------------------------------------------------------"
31217962Speter	@echo " Installing everything.."
31317962Speter	@echo "--------------------------------------------------------------"
31417308Speter	cd ${.CURDIR} && ${MAKE} install
31517962Speter	@echo
31617962Speter	@echo "--------------------------------------------------------------"
31717962Speter	@echo " Rebuilding man page indexes"
31817962Speter	@echo "--------------------------------------------------------------"
31917308Speter	cd ${.CURDIR}/share/man && ${MAKE} makedb
3202061Sjkh
32117308Speter#
32217308Speter# update
32317308Speter#
32417308Speter# Update the source tree, by running sup and/or running cvs to update to the
32517308Speter# latest copy.
32617308Speter#
3272302Spaulupdate:
3282302Spaul.if defined(SUP_UPDATE)
3292302Spaul	@echo "--------------------------------------------------------------"
3302302Spaul	@echo "Running sup"
3312302Spaul	@echo "--------------------------------------------------------------"
33218714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE}
33310760Sache.if defined(SUPFILE1)
33418714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE1}
3352302Spaul.endif
33610760Sache.if defined(SUPFILE2)
33718714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE2}
33810760Sache.endif
33910760Sache.endif
3402302Spaul.if defined(CVS_UPDATE)
3412302Spaul	@echo "--------------------------------------------------------------"
3422302Spaul	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
3432302Spaul	@echo "--------------------------------------------------------------"
34427790Sasami	cd ${.CURDIR} && cvs -q update -P -d
3452302Spaul.endif
3462302Spaul
34717308Speter#
34817308Speter# most
34917308Speter#
35017308Speter# Build most of the user binaries on the existing system libs and includes.
35117308Speter#
35217308Spetermost:
3532061Sjkh	@echo "--------------------------------------------------------------"
35417308Speter	@echo " Building programs only"
3552061Sjkh	@echo "--------------------------------------------------------------"
35617308Speter	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
35717308Speter	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
35817308Speter	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
35917308Speter	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
36017308Speter	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
36117308Speter	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
36217308Speter	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
36317308Speter	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
36417308Speter#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
36517308Speter#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
36617308Speter#.endif
36717308Speter#.if !defined(NOSECURE) && !defined(NOCRYPT)
36817308Speter#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
36917308Speter#.endif
3702061Sjkh
37117308Speter#
37217308Speter# installmost
37317308Speter#
37417308Speter# Install the binaries built by the 'most' target.  This does not include
37517308Speter# libraries or include files.
37617308Speter#
3773626Swollmaninstallmost:
3783626Swollman	@echo "--------------------------------------------------------------"
3793626Swollman	@echo " Installing programs only"
3803626Swollman	@echo "--------------------------------------------------------------"
3813626Swollman	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
3823626Swollman	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
3833626Swollman	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
3843626Swollman	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
3853626Swollman	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
3863626Swollman	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
3873626Swollman	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
3887059Sroberto	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
3893626Swollman#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
3903626Swollman#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
3913626Swollman#.endif
3923626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
3933626Swollman#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
3943626Swollman#.endif
3953626Swollman
39617308Speter#
39717308Speter# ------------------------------------------------------------------------
39817308Speter#
39917308Speter# From here onwards are utility targets used by the 'make world' and
40017308Speter# related targets.  If your 'world' breaks, you may like to try to fix
40117308Speter# the problem and manually run the following targets to attempt to
40217308Speter# complete the build.  Beware, this is *not* guaranteed to work, you
40317308Speter# need to have a pretty good grip on the current state of the system
40417308Speter# to attempt to manually finish it.  If in doubt, 'make world' again.
40517308Speter#
4063626Swollman
40717308Speter#
40817308Speter# heirarchy - ensure that all the needed directories are present
40917308Speter#
41017308Speterhierarchy:
41117308Speter	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
41217308Speter
41317308Speter#
41417308Speter# bootstrap - [re]build tools needed to run the actual build, this includes
41517308Speter# tools needed by 'make depend', as some tools are needed to generate source
41617308Speter# for the dependency information to be gathered from.
41717308Speter#
41817308Speterbootstrap:
41927910Sasami.if defined(DESTDIR)
42027910Sasami	rm -f ${DESTDIR}/usr/src/sys
42127910Sasami	ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src
42227910Sasami	cd ${.CURDIR}/include && find -dx . | cpio -dump ${DESTDIR}/usr/include
42327910Sasami	cd ${.CURDIR}/include && make symlinks
42427910Sasami.endif
42517820Sjkh	cd ${.CURDIR}/usr.bin/make && ${MAKE} depend && \
42617308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
42717820Sjkh	cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \
42817308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
42917820Sjkh	cd ${.CURDIR}/usr.bin/lex && ${MAKE} bootstrap && ${MAKE} depend && \
43017467Speter		${MAKE} ${MK_FLAGS} -DNOLIB all install ${CLEANDIR} ${OBJDIR}
43117308Speter
43217308Speter#
43317308Speter# include-tools - generally the same as 'bootstrap', except that it's for
43417308Speter# things that are specifically needed to generate include files.
43517308Speter#
43627910Sasami# XXX should be merged with bootstrap, it's not worth keeeping them separate.
43727910Sasami# Well, maybe it is now.  We force 'cleandepend' here to avoid dependencies
43827910Sasami# on cleaned away headers in ${WORLDTMP}.
43917308Speter#
44017308Speterinclude-tools:
44127910Sasami	cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} cleandepend depend && \
44227910Sasami		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
44317308Speter
44417308Speter#
44517308Speter# includes - possibly generate and install the include files.
44617308Speter#
44714119Speterincludes:
4482061Sjkh.if defined(CLOBBER)
4497130Srgrimes	rm -rf ${DESTDIR}/usr/include/*
4507130Srgrimes	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
4517130Srgrimes		-p ${DESTDIR}/usr/include
4522061Sjkh.endif
45328357Speter	cd ${.CURDIR}/include &&		${MAKE} all installhdrs symlinks
45417308Speter	cd ${.CURDIR}/gnu/include &&		${MAKE} install
45528532Sbde	cd ${.CURDIR}/gnu/lib/libmp &&		${MAKE} beforeinstall
45628532Sbde	cd ${.CURDIR}/gnu/lib/libobjc &&	${MAKE} beforeinstall
4572685Srgrimes	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
4586927Snate	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
45927790Sasami	cd ${.CURDIR}/gnu/lib/libstdc++ &&	${MAKE} beforeinstall
46027790Sasami	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
46127790Sasami	cd ${.CURDIR}/gnu/lib/libdialog &&	${MAKE} beforeinstall
46228329Sandreas	cd ${.CURDIR}/gnu/lib/libgmp &&		${MAKE} beforeinstall
4633197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
4643197Scsgr	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
46512166Sjkh	cd ${.CURDIR}/eBones/lib/libkrb &&	${MAKE} beforeinstall
46612485Sjkh	cd ${.CURDIR}/eBones/lib/libkadm &&	${MAKE} beforeinstall
4673197Scsgr.endif
46825313Sbde	cd ${.CURDIR}/lib/csu/i386 &&		${MAKE} beforeinstall
46926152Speter	cd ${.CURDIR}/lib/libalias &&		${MAKE} beforeinstall
4702061Sjkh	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
4712061Sjkh	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
47228532Sbde	cd ${.CURDIR}/lib/libdisk &&		${MAKE} beforeinstall
4732061Sjkh	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
47416786Snate	cd ${.CURDIR}/lib/libftpio &&		${MAKE} beforeinstall
4752883Sphk	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
47627790Sasami	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE} beforeinstall
47717308Speter	cd ${.CURDIR}/lib/libncurses &&		${MAKE} beforeinstall
4787281Srgrimes.if !defined(WANT_CSRG_LIBM)
4793242Spaul	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
4803242Spaul.endif
48128532Sbde	cd ${.CURDIR}/lib/libopie &&		${MAKE} beforeinstall
4827171Sats	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
4832061Sjkh	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
4843213Spst	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
48528104Sasami.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \
48628104Sasami	exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl)
48717308Speter	cd ${.CURDIR}/lib/libtcl &&		${MAKE} beforeinstall
48828104Sasami.endif
48917308Speter	cd ${.CURDIR}/lib/libtermcap &&		${MAKE} beforeinstall
4905749Swollman	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
4915772Swollman	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
49217308Speter	cd ${.CURDIR}/lib/libscsi &&		${MAKE} beforeinstall
49317308Speter	cd ${.CURDIR}/lib/libutil &&		${MAKE} beforeinstall
49428532Sbde	cd ${.CURDIR}/lib/libvgl &&		${MAKE} beforeinstall
49526504Sjhay	cd ${.CURDIR}/lib/libz &&		${MAKE} beforeinstall
49628532Sbde	cd ${.CURDIR}/usr.bin/f2c &&		${MAKE} beforeinstall
49728532Sbde	cd ${.CURDIR}/usr.bin/lex &&		${MAKE} beforeinstall
4982061Sjkh
49917308Speter#
50017308Speter# lib-tools - build tools to compile and install the libraries.
50117308Speter#
50227910Sasami# XXX gperf is required for cc
50327910Sasami# XXX a new ld and tsort is required for cc
5045366Snatelib-tools:
50527910Sasami.for d in				\
50627910Sasami		gnu/usr.bin/gperf	\
50727910Sasami		gnu/usr.bin/ld		\
50827910Sasami		usr.bin/tsort		\
50927910Sasami		gnu/usr.bin/as		\
51027910Sasami		gnu/usr.bin/bison	\
51127910Sasami		gnu/usr.bin/cc		\
51227910Sasami		usr.bin/ar		\
51327910Sasami		usr.bin/compile_et	\
51427910Sasami		usr.bin/lex/lib		\
51527910Sasami		usr.bin/mk_cmds		\
51627910Sasami		usr.bin/nm		\
51727910Sasami		usr.bin/ranlib		\
51827910Sasami		usr.bin/uudecode
51927910Sasami	cd ${.CURDIR}/$d && ${MAKE} depend && \
52017467Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
52127910Sasami.endfor
5225366Snate
52317308Speter#
52417308Speter# libraries - build and install the libraries
52517308Speter#
5262061Sjkhlibraries:
52724754Sjdp.if exists(lib/csu/i386)
52824754Sjdp	cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
52924754Sjdp		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
53024754Sjdp.endif
5318295Srgrimes.if exists(lib/libcompat)
53217820Sjkh	cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
53317308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5348295Srgrimes.endif
5358489Srgrimes.if exists(lib/libncurses)
53617820Sjkh	cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \
53717308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5388489Srgrimes.endif
5398489Srgrimes.if exists(lib/libtermcap)
54017820Sjkh	cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
54117308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5428489Srgrimes.endif
5438295Srgrimes.if exists(gnu)
54417820Sjkh	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
54517308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5468295Srgrimes.endif
5472160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
54817820Sjkh	cd ${.CURDIR}/secure/lib && ${MAKE} depend && \
54917308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5502160Scsgr.endif
5512279Spaul.if exists(lib)
55217820Sjkh	cd ${.CURDIR}/lib && ${MAKE} depend && \
55317308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5542279Spaul.endif
55517234Sjraynard.if exists(usr.bin/lex/lib)
55617820Sjkh	cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
55717308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
55811772Snate.endif
5593197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
56017820Sjkh	cd ${.CURDIR}/eBones/lib && ${MAKE} depend && \
56117308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5622626Scsgr.endif
5638304Srgrimes.if exists(usr.sbin/pcvt/keycap)
56417820Sjkh	cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \
56517308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5668304Srgrimes.endif
5672061Sjkh
56817308Speter#
56917308Speter# build-tools - build and install any other tools needed to complete the
57017308Speter# compile and install.
57127910Sasami# ifdef stale
57227910Sasami# bc and cpp are required to build groff.  Otherwise, the order here is
57327910Sasami# mostly historical, i.e., bogus.
57427910Sasami# chmod is used to build gcc's tmpmultilib[2] at obscure times.
57527910Sasami# endif stale
57627910Sasami# XXX uname is a bug - the target should not depend on the host.
57717308Speter#
57811806Sphkbuild-tools:
57919175Sbde.for d in				\
58027910Sasami		bin/cat 		\
58127910Sasami		bin/chmod		\
58227910Sasami		bin/cp 			\
58327910Sasami		bin/date		\
58427910Sasami		bin/dd			\
58527910Sasami		bin/echo		\
58627910Sasami		bin/expr		\
58727910Sasami		bin/hostname		\
58827910Sasami		bin/ln			\
58927910Sasami		bin/ls			\
59027910Sasami		bin/mkdir		\
59127910Sasami		bin/mv			\
59227910Sasami		bin/rm			\
59327910Sasami		bin/sh			\
59427910Sasami		bin/test		\
59527910Sasami		gnu/usr.bin/awk		\
59627910Sasami		gnu/usr.bin/bc		\
59727910Sasami		gnu/usr.bin/grep	\
59827910Sasami		gnu/usr.bin/groff	\
59927910Sasami		gnu/usr.bin/gzip	\
60027910Sasami		gnu/usr.bin/man/makewhatis	\
60127910Sasami		gnu/usr.bin/sort	\
60227910Sasami		gnu/usr.bin/texinfo     \
60321673Sjkh		share/info		\
60427910Sasami		usr.bin/basename	\
60527910Sasami		usr.bin/cap_mkdb	\
60627910Sasami		usr.bin/chflags		\
60727910Sasami		usr.bin/cmp		\
60827910Sasami		usr.bin/col		\
60927910Sasami		usr.bin/cpp		\
61027910Sasami		usr.bin/expand		\
61127910Sasami		usr.bin/file2c		\
61227910Sasami		usr.bin/find		\
61327910Sasami		usr.bin/gencat		\
61427910Sasami		usr.bin/lorder		\
61527910Sasami		usr.bin/m4		\
61627910Sasami		usr.bin/mkdep		\
61727910Sasami		usr.bin/paste		\
61827910Sasami		usr.bin/sed		\
61927910Sasami		usr.bin/size		\
62027910Sasami		usr.bin/soelim		\
62127910Sasami		usr.bin/strip		\
62219175Sbde		usr.bin/symorder	\
62327910Sasami		usr.bin/touch		\
62427910Sasami		usr.bin/tr		\
62527910Sasami		usr.bin/true		\
62627910Sasami		usr.bin/uname		\
62727910Sasami		usr.bin/uuencode	\
62827910Sasami		usr.bin/vgrind		\
62927910Sasami		usr.bin/vi		\
63027910Sasami		usr.bin/wc		\
63127910Sasami		usr.bin/yacc		\
63227910Sasami		usr.sbin/chown		\
63327910Sasami		usr.sbin/mtree		\
63427910Sasami		usr.sbin/zic
63519175Sbde	cd ${.CURDIR}/$d && ${MAKE} depend && \
63617308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
63719175Sbde.endfor
6382061Sjkh
6391594Srgrimes.include <bsd.subdir.mk>
640