Makefile revision 29938
12061Sjkh#
229938Smckay#	$Id: Makefile,v 1.147 1997/09/28 09:26:05 markm Exp $
32061Sjkh#
42061Sjkh# Make command line options:
515603Smarkm#	-DCLOBBER will remove /usr/include
629930Smarkm#	-DMAKE_KERBEROS4 to build 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
6829930Smarkm.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
6929930SmarkmSUBDIR+= kerberosIV
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 "--------------------------------------------------------------"
15428803Speter	cd ${.CURDIR} && ${MAKE} pre-world
15527910Sasami.endif
15628803Speter	cd ${.CURDIR} && ${MAKE} buildworld
15728803Speter	cd ${.CURDIR} && ${MAKE} installworld
15827910Sasami.if target(post-world)
15917308Speter	@echo
1602061Sjkh	@echo "--------------------------------------------------------------"
16127910Sasami	@echo " Making 'post-world' target"
1622061Sjkh	@echo "--------------------------------------------------------------"
16328803Speter	cd ${.CURDIR} && ${MAKE} 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 && \
22629130Speter		${IBMAKE} -I${.CURDIR}/share/mk \
22729872Sjkh			${CLEANDIR} ${OBJDIR} depend && \
22829130Speter		${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 "--------------------------------------------------------------"
26329503Sbde	cd ${.CURDIR} && SHARED=symlinks ${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 "--------------------------------------------------------------"
35628803Speter	cd ${.CURDIR}/bin	&&	${MAKE} all
35728803Speter	cd ${.CURDIR}/sbin	&&	${MAKE} all
35828803Speter	cd ${.CURDIR}/libexec	&&	${MAKE} all
35928803Speter	cd ${.CURDIR}/usr.bin	&&	${MAKE} all
36028803Speter	cd ${.CURDIR}/usr.sbin	&&	${MAKE} all
36128803Speter	cd ${.CURDIR}/gnu/libexec &&	${MAKE} all
36228803Speter	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} all
36328803Speter	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} all
36429930Smarkm#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
36529930Smarkm#	cd ${.CURDIR}/kerberosIV	&&	${MAKE} most
36617308Speter#.endif
36717308Speter#.if !defined(NOSECURE) && !defined(NOCRYPT)
36828803Speter#	cd ${.CURDIR}/secure	&&	${MAKE} 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 "--------------------------------------------------------------"
38128803Speter	cd ${.CURDIR}/bin	&&	${MAKE} install
38228803Speter	cd ${.CURDIR}/sbin	&&	${MAKE} install
38328803Speter	cd ${.CURDIR}/libexec	&&	${MAKE} install
38428803Speter	cd ${.CURDIR}/usr.bin	&&	${MAKE} install
38528803Speter	cd ${.CURDIR}/usr.sbin	&&	${MAKE} install
38628803Speter	cd ${.CURDIR}/gnu/libexec &&	${MAKE} install
38728803Speter	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} install
38828803Speter	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} install
38929930Smarkm#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
39029930Smarkm#	cd ${.CURDIR}/kerberosIV &&	${MAKE} installmost
3913626Swollman#.endif
3923626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
39328803Speter#	cd ${.CURDIR}/secure	&&	${MAKE} 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 && \
43029938Smckay		${MAKE} ${MK_FLAGS} -DNOLIB all install ${CLEANDIR}
43129938Smckay.if !defined(NOOBJDIR)
43229938Smckay	cd ${.CURDIR}/usr.bin/lex && ${MAKE} obj
43329938Smckay.endif
43417308Speter
43517308Speter#
43617308Speter# include-tools - generally the same as 'bootstrap', except that it's for
43717308Speter# things that are specifically needed to generate include files.
43817308Speter#
43927910Sasami# XXX should be merged with bootstrap, it's not worth keeeping them separate.
44027910Sasami# Well, maybe it is now.  We force 'cleandepend' here to avoid dependencies
44127910Sasami# on cleaned away headers in ${WORLDTMP}.
44217308Speter#
44317308Speterinclude-tools:
44427910Sasami	cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} cleandepend depend && \
44527910Sasami		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
44617308Speter
44717308Speter#
44817308Speter# includes - possibly generate and install the include files.
44917308Speter#
45014119Speterincludes:
4512061Sjkh.if defined(CLOBBER)
4527130Srgrimes	rm -rf ${DESTDIR}/usr/include/*
4537130Srgrimes	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
4547130Srgrimes		-p ${DESTDIR}/usr/include
4552061Sjkh.endif
45629503Sbde	cd ${.CURDIR}/include &&		${MAKE} all install
45717308Speter	cd ${.CURDIR}/gnu/include &&		${MAKE} install
45828532Sbde	cd ${.CURDIR}/gnu/lib/libmp &&		${MAKE} beforeinstall
45928532Sbde	cd ${.CURDIR}/gnu/lib/libobjc &&	${MAKE} beforeinstall
4602685Srgrimes	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
4616927Snate	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
46227790Sasami	cd ${.CURDIR}/gnu/lib/libstdc++ &&	${MAKE} beforeinstall
46327790Sasami	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
46427790Sasami	cd ${.CURDIR}/gnu/lib/libdialog &&	${MAKE} beforeinstall
46528329Sandreas	cd ${.CURDIR}/gnu/lib/libgmp &&		${MAKE} beforeinstall
46629930Smarkm.if exists(secure) && !defined(NOCRYPT)
46729930Smarkm	cd ${.CURDIR}/secure/lib/libdes &&	${MAKE} beforeinstall
4683197Scsgr.endif
46929930Smarkm.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
47029930Smarkm	cd ${.CURDIR}/kerberosIV/lib/libacl &&	${MAKE} beforeinstall
47129930Smarkm	cd ${.CURDIR}/kerberosIV/lib/libkadm &&	${MAKE} beforeinstall
47229930Smarkm	cd ${.CURDIR}/kerberosIV/lib/libkafs &&	${MAKE} beforeinstall
47329930Smarkm	cd ${.CURDIR}/kerberosIV/lib/libkdb &&	${MAKE} beforeinstall
47429930Smarkm	cd ${.CURDIR}/kerberosIV/lib/libkrb &&	${MAKE} beforeinstall
47529930Smarkm	cd ${.CURDIR}/kerberosIV/lib/libtelnet && ${MAKE} beforeinstall
47629930Smarkm.else
47729930Smarkm	cd ${.CURDIR}/lib/libtelnet &&		${MAKE} beforeinstall
47829930Smarkm.endif
47925313Sbde	cd ${.CURDIR}/lib/csu/i386 &&		${MAKE} beforeinstall
48026152Speter	cd ${.CURDIR}/lib/libalias &&		${MAKE} beforeinstall
4812061Sjkh	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
4822061Sjkh	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
48328532Sbde	cd ${.CURDIR}/lib/libdisk &&		${MAKE} beforeinstall
4842061Sjkh	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
48516786Snate	cd ${.CURDIR}/lib/libftpio &&		${MAKE} beforeinstall
4862883Sphk	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
48727790Sasami	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE} beforeinstall
48817308Speter	cd ${.CURDIR}/lib/libncurses &&		${MAKE} beforeinstall
4897281Srgrimes.if !defined(WANT_CSRG_LIBM)
4903242Spaul	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
4913242Spaul.endif
49228532Sbde	cd ${.CURDIR}/lib/libopie &&		${MAKE} beforeinstall
4937171Sats	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
4942061Sjkh	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
4953213Spst	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
49628104Sasami.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \
49728104Sasami	exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl)
49828728Sbde	cd ${.CURDIR}/lib/libtcl &&		${MAKE} installhdrs
49928104Sasami.endif
50017308Speter	cd ${.CURDIR}/lib/libtermcap &&		${MAKE} beforeinstall
5015749Swollman	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
5025772Swollman	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
50317308Speter	cd ${.CURDIR}/lib/libscsi &&		${MAKE} beforeinstall
50417308Speter	cd ${.CURDIR}/lib/libutil &&		${MAKE} beforeinstall
50528532Sbde	cd ${.CURDIR}/lib/libvgl &&		${MAKE} beforeinstall
50626504Sjhay	cd ${.CURDIR}/lib/libz &&		${MAKE} beforeinstall
50728532Sbde	cd ${.CURDIR}/usr.bin/f2c &&		${MAKE} beforeinstall
50828532Sbde	cd ${.CURDIR}/usr.bin/lex &&		${MAKE} beforeinstall
5092061Sjkh
51017308Speter#
51117308Speter# lib-tools - build tools to compile and install the libraries.
51217308Speter#
51327910Sasami# XXX gperf is required for cc
51427910Sasami# XXX a new ld and tsort is required for cc
5155366Snatelib-tools:
51627910Sasami.for d in				\
51727910Sasami		gnu/usr.bin/gperf	\
51827910Sasami		gnu/usr.bin/ld		\
51927910Sasami		usr.bin/tsort		\
52027910Sasami		gnu/usr.bin/as		\
52127910Sasami		gnu/usr.bin/bison	\
52227910Sasami		gnu/usr.bin/cc		\
52327910Sasami		usr.bin/ar		\
52427910Sasami		usr.bin/compile_et	\
52527910Sasami		usr.bin/lex/lib		\
52627910Sasami		usr.bin/mk_cmds		\
52727910Sasami		usr.bin/nm		\
52827910Sasami		usr.bin/ranlib		\
52927910Sasami		usr.bin/uudecode
53027910Sasami	cd ${.CURDIR}/$d && ${MAKE} depend && \
53117467Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
53227910Sasami.endfor
5335366Snate
53417308Speter#
53517308Speter# libraries - build and install the libraries
53617308Speter#
5372061Sjkhlibraries:
53824754Sjdp.if exists(lib/csu/i386)
53924754Sjdp	cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
54024754Sjdp		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
54124754Sjdp.endif
5428295Srgrimes.if exists(lib/libcompat)
54317820Sjkh	cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
54417308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5458295Srgrimes.endif
5468489Srgrimes.if exists(lib/libncurses)
54717820Sjkh	cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \
54817308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5498489Srgrimes.endif
5508489Srgrimes.if exists(lib/libtermcap)
55117820Sjkh	cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
55217308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5538489Srgrimes.endif
5548295Srgrimes.if exists(gnu)
55517820Sjkh	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
55617308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5578295Srgrimes.endif
5582160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
55917820Sjkh	cd ${.CURDIR}/secure/lib && ${MAKE} depend && \
56017308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5612160Scsgr.endif
5622279Spaul.if exists(lib)
56317820Sjkh	cd ${.CURDIR}/lib && ${MAKE} depend && \
56417308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5652279Spaul.endif
56617234Sjraynard.if exists(usr.bin/lex/lib)
56717820Sjkh	cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
56817308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
56911772Snate.endif
57029930Smarkm.if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
57129930Smarkm	cd ${.CURDIR}/kerberosIV/lib && ${MAKE} depend && \
57217308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5732626Scsgr.endif
5748304Srgrimes.if exists(usr.sbin/pcvt/keycap)
57517820Sjkh	cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \
57617308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
5778304Srgrimes.endif
5782061Sjkh
57917308Speter#
58017308Speter# build-tools - build and install any other tools needed to complete the
58117308Speter# compile and install.
58227910Sasami# ifdef stale
58327910Sasami# bc and cpp are required to build groff.  Otherwise, the order here is
58427910Sasami# mostly historical, i.e., bogus.
58527910Sasami# chmod is used to build gcc's tmpmultilib[2] at obscure times.
58627910Sasami# endif stale
58727910Sasami# XXX uname is a bug - the target should not depend on the host.
58817308Speter#
58911806Sphkbuild-tools:
59019175Sbde.for d in				\
59127910Sasami		bin/cat 		\
59227910Sasami		bin/chmod		\
59327910Sasami		bin/cp 			\
59427910Sasami		bin/date		\
59527910Sasami		bin/dd			\
59627910Sasami		bin/echo		\
59727910Sasami		bin/expr		\
59827910Sasami		bin/hostname		\
59927910Sasami		bin/ln			\
60027910Sasami		bin/ls			\
60127910Sasami		bin/mkdir		\
60227910Sasami		bin/mv			\
60327910Sasami		bin/rm			\
60427910Sasami		bin/sh			\
60527910Sasami		bin/test		\
60627910Sasami		gnu/usr.bin/awk		\
60727910Sasami		gnu/usr.bin/bc		\
60827910Sasami		gnu/usr.bin/grep	\
60927910Sasami		gnu/usr.bin/groff	\
61027910Sasami		gnu/usr.bin/gzip	\
61127910Sasami		gnu/usr.bin/man/makewhatis	\
61227910Sasami		gnu/usr.bin/sort	\
61327910Sasami		gnu/usr.bin/texinfo     \
61421673Sjkh		share/info		\
61527910Sasami		usr.bin/basename	\
61627910Sasami		usr.bin/cap_mkdb	\
61727910Sasami		usr.bin/chflags		\
61827910Sasami		usr.bin/cmp		\
61927910Sasami		usr.bin/col		\
62027910Sasami		usr.bin/cpp		\
62127910Sasami		usr.bin/expand		\
62227910Sasami		usr.bin/file2c		\
62327910Sasami		usr.bin/find		\
62427910Sasami		usr.bin/gencat		\
62527910Sasami		usr.bin/lorder		\
62627910Sasami		usr.bin/m4		\
62727910Sasami		usr.bin/mkdep		\
62827910Sasami		usr.bin/paste		\
62927910Sasami		usr.bin/sed		\
63027910Sasami		usr.bin/size		\
63127910Sasami		usr.bin/soelim		\
63227910Sasami		usr.bin/strip		\
63319175Sbde		usr.bin/symorder	\
63427910Sasami		usr.bin/touch		\
63527910Sasami		usr.bin/tr		\
63627910Sasami		usr.bin/true		\
63727910Sasami		usr.bin/uname		\
63827910Sasami		usr.bin/uuencode	\
63927910Sasami		usr.bin/vgrind		\
64027910Sasami		usr.bin/vi		\
64127910Sasami		usr.bin/wc		\
64227910Sasami		usr.bin/yacc		\
64327910Sasami		usr.sbin/chown		\
64427910Sasami		usr.sbin/mtree		\
64527910Sasami		usr.sbin/zic
64619175Sbde	cd ${.CURDIR}/$d && ${MAKE} depend && \
64717308Speter		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
64819175Sbde.endfor
6492061Sjkh
6501594Srgrimes.include <bsd.subdir.mk>
651