Makefile revision 27910
12061Sjkh#
227910Sasami#	$Id: Makefile,v 1.132 1997/07/31 08:31:50 asami 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
4327910Sasami# We must do include and lib first so that the perl *.ph generation
447407Srgrimes# works correctly as it uses the header files installed by this.
457108Sphk.if exists(include)
467108SphkSUBDIR+= include
477108Sphk.endif
487407Srgrimes.if exists(lib)
497407SrgrimesSUBDIR+= lib
507407Srgrimes.endif
517108Sphk
522061Sjkh.if exists(bin)
532061SjkhSUBDIR+= bin
542061Sjkh.endif
5517308Speter.if exists(games) && !defined(NOGAMES)
562061SjkhSUBDIR+= games
572061Sjkh.endif
582061Sjkh.if exists(gnu)
592061SjkhSUBDIR+= gnu
602061Sjkh.endif
613197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
622626ScsgrSUBDIR+= eBones
632626Scsgr.endif
642061Sjkh.if exists(libexec)
652061SjkhSUBDIR+= libexec
662061Sjkh.endif
672061Sjkh.if exists(sbin)
682061SjkhSUBDIR+= sbin
692061Sjkh.endif
7019320Sadam.if exists(share) && !defined(NOSHARE)
712061SjkhSUBDIR+= share
722061Sjkh.endif
732061Sjkh.if exists(sys)
742061SjkhSUBDIR+= sys
752061Sjkh.endif
762061Sjkh.if exists(usr.bin)
772061SjkhSUBDIR+= usr.bin
782061Sjkh.endif
792061Sjkh.if exists(usr.sbin)
802061SjkhSUBDIR+= usr.sbin
812061Sjkh.endif
822834Swollman.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
832834SwollmanSUBDIR+= secure
842834Swollman.endif
852834Swollman.if exists(lkm) && !defined(NOLKM)
862834SwollmanSUBDIR+= lkm
872834Swollman.endif
881594Srgrimes
894486Sphk# etc must be last for "distribute" to work
904486Sphk.if exists(etc) && make(distribute)
914486SphkSUBDIR+= etc
924486Sphk.endif
934486Sphk
942061Sjkh# These are last, since it is nice to at least get the base system
952061Sjkh# rebuilt before you do them.
9625979Sjkh.if defined(LOCAL_DIRS)
9725979Sjkh.for _DIR in ${LOCAL_DIRS}
9825979Sjkh.if exists(${_DIR}) & exists(${_DIR}/Makefile)
9925979SjkhSUBDIR+= ${_DIR}
1002061Sjkh.endif
10125979Sjkh.endfor
1022061Sjkh.endif
1032061Sjkh
10417308Speter# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
1052061Sjkh.if defined(NOOBJDIR)
1062061SjkhOBJDIR=
1072061Sjkh.else
1082061SjkhOBJDIR=		obj
1092061Sjkh.endif
11012483Speter
11112483Speter.if defined(NOCLEAN)
11212483SpeterCLEANDIR=
11312483Speter.else
1142061Sjkh.if defined(NOCLEANDIR)
1152061SjkhCLEANDIR=	clean
1168854Srgrimes.else
1172061SjkhCLEANDIR=	cleandir
1182061Sjkh.endif
11912483Speter.endif
1202061Sjkh
12127910SasamiSUP?=		sup
12227910SasamiSUPFLAGS?=	-v
12318714Sache
12417308Speter#
12517308Speter# While building tools for bootstrapping, we dont need to waste time on
12617308Speter# profiled libraries or man pages.  This speeds things up somewhat.
12717308Speter#
12821536SjmacdMK_FLAGS=	-DNOINFO -DNOMAN -DNOPROFILE
12915603Smarkm
13017308Speter#
13117308Speter# world
13217308Speter#
13317308Speter# Attempt to rebuild and reinstall *everything*, with reasonable chance of
13417308Speter# success, regardless of how old your existing system is.
13517308Speter#
13617308Speter# >> Beware, it overwrites the local build environment! <<
13717308Speter#
13817308Speterworld:
13918362Sjkh	@echo "--------------------------------------------------------------"
14019966Sache	@echo "make world started on `LC_TIME=C date`"
14118362Sjkh	@echo "--------------------------------------------------------------"
14217308Speter.if target(pre-world)
14327910Sasami	@echo
14417308Speter	@echo "--------------------------------------------------------------"
14517308Speter	@echo " Making 'pre-world' target"
14617308Speter	@echo "--------------------------------------------------------------"
14717308Speter	cd ${.CURDIR} && ${MAKE} pre-world
14827910Sasami.endif
14927910Sasami	cd ${.CURDIR} && ${MAKE} buildworld
15027910Sasami	cd ${.CURDIR} && ${MAKE} installworld
15127910Sasami.if target(post-world)
15217308Speter	@echo
1532061Sjkh	@echo "--------------------------------------------------------------"
15427910Sasami	@echo " Making 'post-world' target"
1552061Sjkh	@echo "--------------------------------------------------------------"
15627910Sasami	cd ${.CURDIR} && ${MAKE} post-world
15727910Sasami.endif
1582061Sjkh	@echo
15917308Speter	@echo "--------------------------------------------------------------"
16027910Sasami	@echo "make world completed on `LC_TIME=C date`"
16117308Speter	@echo "--------------------------------------------------------------"
16227910Sasami
16327910Sasami.if defined(MAKEOBJDIRPREFIX)
16427910SasamiWORLDTMP=	${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
16517308Speter.else
16627910SasamiWORLDTMP=	/usr/obj${.CURDIR}/tmp
16717308Speter.endif
16827910SasamiSTRICTTMPPATH=	${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin
16927910SasamiTMPPATH=	${STRICTTMPPATH}:${PATH}
17027910Sasami
17127910Sasami# XXX COMPILER_PATH is needed for finding cc1, ld and as
17227910Sasami# XXX GCC_EXEC_PREFIX is for *crt.o.  It is probably unnecssary now
17327910Sasami#	tbat LIBRARY_PATH is set.  We still can't use -nostdlib, since gcc
17427910Sasami#	wouldn't link *crt.o or libgcc if it were used.
17527910Sasami# XXX LD_LIBRARY_PATH is for ld.so.  It is also used by ld, although we don't
17627910Sasami#	want that - all compile-time library paths should be resolved by gcc.
17727910Sasami#	It fails for set[ug]id executables (are any used?).
17827910SasamiCOMPILER_ENV=	BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \
17927910Sasami		COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
18027910Sasami		GCC_EXEC_PREFIX=${WORLDTMP}/usr/lib/ \
18127910Sasami		LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \
18227910Sasami		LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
18327910Sasami
18427910SasamiBMAKEENV=	PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t
18527910SasamiXMAKEENV=	PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
18627910Sasami		CC='cc -nostdinc'	# XXX -nostdlib
18727910Sasami
18827910Sasami# used to compile and install 'make' in temporary build tree
18927910SasamiIBMAKE=	${BMAKEENV} ${MAKE} DESTDIR=${WORLDTMP}
19027910Sasami# bootstrap make
19127910SasamiBMAKE=	${BMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
19227910Sasami# cross make used for compilation
19327910SasamiXMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
19427910Sasami# cross make used for final installation
19527910SasamiIXMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE}
19627910Sasami
19727910Sasami#
19827910Sasami# buildworld
19927910Sasami#
20027910Sasami# Attempt to rebuild the entire system, with reasonable chance of
20127910Sasami# success, regardless of how old your existing system is.
20227910Sasami#
20327910Sasamibuildworld:
20427910Sasami.if !defined(NOCLEAN)
20517308Speter	@echo
20617308Speter	@echo "--------------------------------------------------------------"
20727910Sasami	@echo " Cleaning up the temporary build tree"
20817308Speter	@echo "--------------------------------------------------------------"
20927910Sasami	mkdir -p ${WORLDTMP}
21027910Sasami	chflags -R noschg ${WORLDTMP}/
21127910Sasami	rm -rf ${WORLDTMP}
21227910Sasami.endif
21317466Speter	@echo
21417308Speter	@echo "--------------------------------------------------------------"
21527910Sasami	@echo " Making make"
21617308Speter	@echo "--------------------------------------------------------------"
21727910Sasami	mkdir -p ${WORLDTMP}/usr/bin
21827910Sasami	cd ${.CURDIR}/usr.bin/make && \
21927910Sasami		${IBMAKE} -I${.CURDIR}/share/mk ${OBJDIR} clean cleandepend depend && \
22027910Sasami		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all install clean cleandepend
22117308Speter	@echo
22217308Speter	@echo "--------------------------------------------------------------"
22327910Sasami	@echo " Making hierarchy"
22417308Speter	@echo "--------------------------------------------------------------"
22527910Sasami	cd ${.CURDIR} && ${BMAKE} hierarchy
22627910Sasami.if !defined(NOCLEAN)
22717308Speter	@echo
22817308Speter	@echo "--------------------------------------------------------------"
22927910Sasami	@echo " Cleaning up the obj tree"
23017308Speter	@echo "--------------------------------------------------------------"
23127910Sasami	cd ${.CURDIR} && ${BMAKE} ${CLEANDIR}
23227910Sasami.endif
23327910Sasami.if !defined(NOOBJDIR)
23417308Speter	@echo
23517308Speter	@echo "--------------------------------------------------------------"
23627910Sasami	@echo " Rebuilding the obj tree"
23717308Speter	@echo "--------------------------------------------------------------"
23827910Sasami	cd ${.CURDIR} && ${BMAKE} obj
23927910Sasami.endif
24017308Speter	@echo
24117308Speter	@echo "--------------------------------------------------------------"
24227910Sasami	@echo " Rebuilding bootstrap tools"
24317308Speter	@echo "--------------------------------------------------------------"
24427910Sasami	cd ${.CURDIR} && ${BMAKE} bootstrap
24517308Speter	@echo
24617308Speter	@echo "--------------------------------------------------------------"
24727910Sasami	@echo " Rebuilding tools necessary to build the include files"
24817308Speter	@echo "--------------------------------------------------------------"
24927910Sasami	cd ${.CURDIR} && ${BMAKE} include-tools
25017308Speter	@echo
25117308Speter	@echo "--------------------------------------------------------------"
25227910Sasami	@echo " Rebuilding /usr/include"
25317308Speter	@echo "--------------------------------------------------------------"
25427910Sasami	cd ${.CURDIR} && ${BMAKE} includes
25517962Speter	@echo
25617962Speter	@echo "--------------------------------------------------------------"
25727910Sasami	@echo " Rebuilding tools needed to build the libraries"
25817962Speter	@echo "--------------------------------------------------------------"
25927910Sasami	cd ${.CURDIR} && ${BMAKE} lib-tools
26017962Speter	@echo
26117962Speter	@echo "--------------------------------------------------------------"
26227910Sasami	@echo " Rebuilding /usr/lib"
26317962Speter	@echo "--------------------------------------------------------------"
26427910Sasami	cd ${.CURDIR} && ${BMAKE} libraries
26517962Speter	@echo
26617962Speter	@echo "--------------------------------------------------------------"
26727910Sasami	@echo " Rebuilding all other tools needed to build the world"
26817962Speter	@echo "--------------------------------------------------------------"
26927910Sasami	cd ${.CURDIR} && ${BMAKE} build-tools
27017308Speter	@echo
27117308Speter	@echo "--------------------------------------------------------------"
27227910Sasami	@echo " Rebuilding dependencies"
27317308Speter	@echo "--------------------------------------------------------------"
27427910Sasami	cd ${.CURDIR} && ${XMAKE} depend
27517308Speter	@echo
27617308Speter	@echo "--------------------------------------------------------------"
27727910Sasami	@echo " Building everything.."
27817962Speter	@echo "--------------------------------------------------------------"
27927910Sasami	cd ${.CURDIR} && ${XMAKE} all
2802061Sjkh
28117308Speter#
28227910Sasami# installworld
28327910Sasami#
28427910Sasami# Installs everything compiled by a 'buildworld'.
28527910Sasami#
28627910Sasamiinstallworld:
28727910Sasami	cd ${.CURDIR} && ${IXMAKE} reinstall
28827910Sasami
28927910Sasami#
29017308Speter# reinstall
29117308Speter#
29217308Speter# If you have a build server, you can NFS mount the source and obj directories
29317308Speter# and do a 'make reinstall' on the *client* to install new binaries from the
29417308Speter# most recent server build.
29517308Speter#
29617308Speterreinstall:
29712483Speter	@echo "--------------------------------------------------------------"
29817308Speter	@echo " Making hierarchy"
29912483Speter	@echo "--------------------------------------------------------------"
30017308Speter	cd ${.CURDIR} && ${MAKE} hierarchy
30112483Speter	@echo
3022061Sjkh	@echo "--------------------------------------------------------------"
30317962Speter	@echo " Installing everything.."
30417962Speter	@echo "--------------------------------------------------------------"
30517308Speter	cd ${.CURDIR} && ${MAKE} install
30617962Speter	@echo
30717962Speter	@echo "--------------------------------------------------------------"
30817962Speter	@echo " Rebuilding man page indexes"
30917962Speter	@echo "--------------------------------------------------------------"
31017308Speter	cd ${.CURDIR}/share/man && ${MAKE} makedb
3112061Sjkh
31217308Speter#
31317308Speter# update
31417308Speter#
31517308Speter# Update the source tree, by running sup and/or running cvs to update to the
31617308Speter# latest copy.
31717308Speter#
3182302Spaulupdate:
3192302Spaul.if defined(SUP_UPDATE)
3202302Spaul	@echo "--------------------------------------------------------------"
3212302Spaul	@echo "Running sup"
3222302Spaul	@echo "--------------------------------------------------------------"
32318714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE}
32410760Sache.if defined(SUPFILE1)
32518714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE1}
3262302Spaul.endif
32710760Sache.if defined(SUPFILE2)
32818714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE2}
32910760Sache.endif
33010760Sache.endif
3312302Spaul.if defined(CVS_UPDATE)
3322302Spaul	@echo "--------------------------------------------------------------"
3332302Spaul	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
3342302Spaul	@echo "--------------------------------------------------------------"
33527790Sasami	cd ${.CURDIR} && cvs -q update -P -d
3362302Spaul.endif
3372302Spaul
33817308Speter#
33917308Speter# most
34017308Speter#
34117308Speter# Build most of the user binaries on the existing system libs and includes.
34217308Speter#
34317308Spetermost:
3442061Sjkh	@echo "--------------------------------------------------------------"
34517308Speter	@echo " Building programs only"
3462061Sjkh	@echo "--------------------------------------------------------------"
34717308Speter	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
34817308Speter	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
34917308Speter	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
35017308Speter	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
35117308Speter	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
35217308Speter	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
35317308Speter	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
35417308Speter	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
35517308Speter#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
35617308Speter#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
35717308Speter#.endif
35817308Speter#.if !defined(NOSECURE) && !defined(NOCRYPT)
35917308Speter#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
36017308Speter#.endif
3612061Sjkh
36217308Speter#
36317308Speter# installmost
36417308Speter#
36517308Speter# Install the binaries built by the 'most' target.  This does not include
36617308Speter# libraries or include files.
36717308Speter#
3683626Swollmaninstallmost:
3693626Swollman	@echo "--------------------------------------------------------------"
3703626Swollman	@echo " Installing programs only"
3713626Swollman	@echo "--------------------------------------------------------------"
3723626Swollman	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
3733626Swollman	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
3743626Swollman	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
3753626Swollman	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
3763626Swollman	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
3773626Swollman	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
3783626Swollman	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
3797059Sroberto	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
3803626Swollman#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
3813626Swollman#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
3823626Swollman#.endif
3833626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
3843626Swollman#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
3853626Swollman#.endif
3863626Swollman
38717308Speter#
38817308Speter# ------------------------------------------------------------------------
38917308Speter#
39017308Speter# From here onwards are utility targets used by the 'make world' and
39117308Speter# related targets.  If your 'world' breaks, you may like to try to fix
39217308Speter# the problem and manually run the following targets to attempt to
39317308Speter# complete the build.  Beware, this is *not* guaranteed to work, you
39417308Speter# need to have a pretty good grip on the current state of the system
39517308Speter# to attempt to manually finish it.  If in doubt, 'make world' again.
39617308Speter#
3973626Swollman
39817308Speter#
39917308Speter# heirarchy - ensure that all the needed directories are present
40017308Speter#
40117308Speterhierarchy:
40217308Speter	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
40317308Speter
40417308Speter#
40517308Speter# bootstrap - [re]build tools needed to run the actual build, this includes
40617308Speter# tools needed by 'make depend', as some tools are needed to generate source
40717308Speter# for the dependency information to be gathered from.
40817308Speter#
40917308Speterbootstrap:
41027910Sasami.if defined(DESTDIR)
41127910Sasami	rm -f ${DESTDIR}/usr/src/sys
41227910Sasami	ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src
41327910Sasami	cd ${.CURDIR}/include && find -dx . | cpio -dump ${DESTDIR}/usr/include
41427910Sasami	cd ${.CURDIR}/include && make symlinks
41527910Sasami.endif
41617820Sjkh	cd ${.CURDIR}/usr.bin/make && ${MAKE} depend && \
41717308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
41817820Sjkh	cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \
41917308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
42017820Sjkh	cd ${.CURDIR}/usr.bin/lex && ${MAKE} bootstrap && ${MAKE} depend && \
42117467Speter		${MAKE} ${MK_FLAGS} -DNOLIB all install ${CLEANDIR} ${OBJDIR}
42217308Speter
42317308Speter#
42417308Speter# include-tools - generally the same as 'bootstrap', except that it's for
42517308Speter# things that are specifically needed to generate include files.
42617308Speter#
42727910Sasami# XXX should be merged with bootstrap, it's not worth keeeping them separate.
42827910Sasami# Well, maybe it is now.  We force 'cleandepend' here to avoid dependencies
42927910Sasami# on cleaned away headers in ${WORLDTMP}.
43017308Speter#
43117308Speterinclude-tools:
43227910Sasami	cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} cleandepend depend && \
43327910Sasami		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
43417308Speter
43517308Speter#
43617308Speter# includes - possibly generate and install the include files.
43717308Speter#
43814119Speterincludes:
4392061Sjkh.if defined(CLOBBER)
4407130Srgrimes	rm -rf ${DESTDIR}/usr/include/*
4417130Srgrimes	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
4427130Srgrimes		-p ${DESTDIR}/usr/include
4432061Sjkh.endif
44425783Speter	cd ${.CURDIR}/include &&		${MAKE} all install
44517308Speter	cd ${.CURDIR}/gnu/include &&		${MAKE} install
4462685Srgrimes	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
4476927Snate	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
44827790Sasami	cd ${.CURDIR}/gnu/lib/libstdc++ &&	${MAKE} beforeinstall
44927790Sasami	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
45027790Sasami	cd ${.CURDIR}/gnu/lib/libdialog &&	${MAKE} beforeinstall
4513197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
4523197Scsgr	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
45312166Sjkh	cd ${.CURDIR}/eBones/lib/libkrb &&	${MAKE} beforeinstall
45412485Sjkh	cd ${.CURDIR}/eBones/lib/libkadm &&	${MAKE} beforeinstall
4553197Scsgr.endif
45625313Sbde	cd ${.CURDIR}/lib/csu/i386 &&		${MAKE} beforeinstall
45726152Speter	cd ${.CURDIR}/lib/libalias &&		${MAKE} beforeinstall
4582061Sjkh	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
4592061Sjkh	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
4602061Sjkh	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
46116786Snate	cd ${.CURDIR}/lib/libftpio &&		${MAKE} beforeinstall
4622883Sphk	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
46327790Sasami	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE} beforeinstall
46417308Speter	cd ${.CURDIR}/lib/libncurses &&		${MAKE} beforeinstall
4657281Srgrimes.if !defined(WANT_CSRG_LIBM)
4663242Spaul	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
4673242Spaul.endif
4687171Sats	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
4692061Sjkh	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
4703213Spst	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
47117308Speter	cd ${.CURDIR}/lib/libtcl &&		${MAKE} beforeinstall
47217308Speter	cd ${.CURDIR}/lib/libtermcap &&		${MAKE} beforeinstall
4735749Swollman	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
4745772Swollman	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
47517308Speter	cd ${.CURDIR}/lib/libscsi &&		${MAKE} beforeinstall
47617308Speter	cd ${.CURDIR}/lib/libutil &&		${MAKE} beforeinstall
47726504Sjhay	cd ${.CURDIR}/lib/libz &&		${MAKE} beforeinstall
4782061Sjkh
47917308Speter#
48017308Speter# lib-tools - build tools to compile and install the libraries.
48117308Speter#
48227910Sasami# XXX gperf is required for cc
48327910Sasami# XXX a new ld and tsort is required for cc
4845366Snatelib-tools:
48527910Sasami.for d in				\
48627910Sasami		gnu/usr.bin/gperf	\
48727910Sasami		gnu/usr.bin/ld		\
48827910Sasami		usr.bin/tsort		\
48927910Sasami		gnu/usr.bin/as		\
49027910Sasami		gnu/usr.bin/bison	\
49127910Sasami		gnu/usr.bin/cc		\
49227910Sasami		usr.bin/ar		\
49327910Sasami		usr.bin/compile_et	\
49427910Sasami		usr.bin/lex/lib		\
49527910Sasami		usr.bin/mk_cmds		\
49627910Sasami		usr.bin/nm		\
49727910Sasami		usr.bin/ranlib		\
49827910Sasami		usr.bin/uudecode
49927910Sasami	cd ${.CURDIR}/$d && ${MAKE} depend && \
50017467Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
50127910Sasami.endfor
5025366Snate
50317308Speter#
50417308Speter# libraries - build and install the libraries
50517308Speter#
5062061Sjkhlibraries:
50724754Sjdp.if exists(lib/csu/i386)
50824754Sjdp	cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
50924754Sjdp		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
51024754Sjdp.endif
5118295Srgrimes.if exists(lib/libcompat)
51217820Sjkh	cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
51317308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5148295Srgrimes.endif
5158489Srgrimes.if exists(lib/libncurses)
51617820Sjkh	cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \
51717308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5188489Srgrimes.endif
5198489Srgrimes.if exists(lib/libtermcap)
52017820Sjkh	cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
52117308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5228489Srgrimes.endif
5238295Srgrimes.if exists(gnu)
52417820Sjkh	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
52517308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5268295Srgrimes.endif
5272160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
52817820Sjkh	cd ${.CURDIR}/secure/lib && ${MAKE} depend && \
52917308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5302160Scsgr.endif
5312279Spaul.if exists(lib)
53217820Sjkh	cd ${.CURDIR}/lib && ${MAKE} depend && \
53317308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5342279Spaul.endif
53517234Sjraynard.if exists(usr.bin/lex/lib)
53617820Sjkh	cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
53717308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
53811772Snate.endif
5393197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
54017820Sjkh	cd ${.CURDIR}/eBones/lib && ${MAKE} depend && \
54117308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5422626Scsgr.endif
5438304Srgrimes.if exists(usr.sbin/pcvt/keycap)
54417820Sjkh	cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \
54517308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5468304Srgrimes.endif
5472061Sjkh
54817308Speter#
54917308Speter# build-tools - build and install any other tools needed to complete the
55017308Speter# compile and install.
55127910Sasami# ifdef stale
55227910Sasami# bc and cpp are required to build groff.  Otherwise, the order here is
55327910Sasami# mostly historical, i.e., bogus.
55427910Sasami# chmod is used to build gcc's tmpmultilib[2] at obscure times.
55527910Sasami# endif stale
55627910Sasami# XXX uname is a bug - the target should not depend on the host.
55717308Speter#
55811806Sphkbuild-tools:
55919175Sbde.for d in				\
56027910Sasami		bin/cat 		\
56127910Sasami		bin/chmod		\
56227910Sasami		bin/cp 			\
56327910Sasami		bin/date		\
56427910Sasami		bin/dd			\
56527910Sasami		bin/echo		\
56627910Sasami		bin/expr		\
56727910Sasami		bin/hostname		\
56827910Sasami		bin/ln			\
56927910Sasami		bin/ls			\
57027910Sasami		bin/mkdir		\
57127910Sasami		bin/mv			\
57227910Sasami		bin/rm			\
57327910Sasami		bin/sh			\
57427910Sasami		bin/test		\
57527910Sasami		gnu/usr.bin/awk		\
57627910Sasami		gnu/usr.bin/bc		\
57727910Sasami		gnu/usr.bin/grep	\
57827910Sasami		gnu/usr.bin/groff	\
57927910Sasami		gnu/usr.bin/gzip	\
58027910Sasami		gnu/usr.bin/man/makewhatis	\
58127910Sasami		gnu/usr.bin/sort	\
58227910Sasami		gnu/usr.bin/texinfo     \
58321673Sjkh		share/info		\
58427910Sasami		usr.bin/basename	\
58527910Sasami		usr.bin/cap_mkdb	\
58627910Sasami		usr.bin/chflags		\
58727910Sasami		usr.bin/cmp		\
58827910Sasami		usr.bin/col		\
58927910Sasami		usr.bin/cpp		\
59027910Sasami		usr.bin/expand		\
59127910Sasami		usr.bin/file2c		\
59227910Sasami		usr.bin/find		\
59327910Sasami		usr.bin/gencat		\
59427910Sasami		usr.bin/lorder		\
59527910Sasami		usr.bin/m4		\
59627910Sasami		usr.bin/mkdep		\
59727910Sasami		usr.bin/paste		\
59827910Sasami		usr.bin/sed		\
59927910Sasami		usr.bin/size		\
60027910Sasami		usr.bin/soelim		\
60127910Sasami		usr.bin/strip		\
60219175Sbde		usr.bin/symorder	\
60327910Sasami		usr.bin/touch		\
60427910Sasami		usr.bin/tr		\
60527910Sasami		usr.bin/true		\
60627910Sasami		usr.bin/uname		\
60727910Sasami		usr.bin/uuencode	\
60827910Sasami		usr.bin/vgrind		\
60927910Sasami		usr.bin/vi		\
61027910Sasami		usr.bin/wc		\
61127910Sasami		usr.bin/yacc		\
61227910Sasami		usr.sbin/chown		\
61327910Sasami		usr.sbin/mtree		\
61427910Sasami		usr.sbin/zic
61519175Sbde	cd ${.CURDIR}/$d && ${MAKE} depend && \
61617308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
61719175Sbde.endfor
6182061Sjkh
6191594Srgrimes.include <bsd.subdir.mk>
620