Makefile revision 30169
12061Sjkh#
230169Sjkh#	$Id: Makefile,v 1.151 1997/10/05 22:28:50 fsmp Exp $
32061Sjkh#
42061Sjkh# Make command line options:
515603Smarkm#	-DCLOBBER will remove /usr/include
630169Sjkh#	-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
2030169Sjkh#	-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
4330169Sjkh# We must do share/info early so that installation of info `dir'
4430169Sjkh# entries works correctly.  Do it first since it is less likely to
4530169Sjkh# grow dependencies on include and lib than vice versa.
4630169Sjkh.if exists(share/info)
4730169SjkhSUBDIR+= share/info
4830169Sjkh.endif
4930169Sjkh
5030169Sjkh# 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
6830169Sjkh.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
6930169SjkhSUBDIR+= 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
15730113Sjkh	cd ${.CURDIR} && ${MAKE} -B 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 && \
22630113Sjkh		${IBMAKE} -I${.CURDIR}/share/mk -B ${CLEANDIR} ${OBJDIR} depend && \
22730113Sjkh		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all && \
22829130Speter		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} \
22930132Sfsmp			-B 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 "--------------------------------------------------------------"
24030113Sjkh	cd ${.CURDIR} && ${BMAKE} par-${CLEANDIR}
24127910Sasami.endif
24227910Sasami.if !defined(NOOBJDIR)
24317308Speter	@echo
24417308Speter	@echo "--------------------------------------------------------------"
24527910Sasami	@echo " Rebuilding the obj tree"
24617308Speter	@echo "--------------------------------------------------------------"
24730113Sjkh	cd ${.CURDIR} && ${BMAKE} par-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 "--------------------------------------------------------------"
28330113Sjkh	cd ${.CURDIR} && ${XMAKE} ${.MAKEFLAGS} par-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 "--------------------------------------------------------------"
34430132Sfsmp	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 "--------------------------------------------------------------"
35630113Sjkh	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
35730113Sjkh	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
35830113Sjkh	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
35930113Sjkh	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
36030113Sjkh	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
36130113Sjkh	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
36230113Sjkh	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
36330113Sjkh	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
36430169Sjkh#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
36530169Sjkh#	cd ${.CURDIR}/kerberosIV	&&	${MAKE} ${.MAKEFLAGS} most
36617308Speter#.endif
36717308Speter#.if !defined(NOSECURE) && !defined(NOCRYPT)
36830113Sjkh#	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 "--------------------------------------------------------------"
38130113Sjkh	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
38230113Sjkh	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
38330113Sjkh	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
38430113Sjkh	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
38530113Sjkh	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
38630113Sjkh	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
38730113Sjkh	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
38830113Sjkh	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
38930169Sjkh#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
39030169Sjkh#	cd ${.CURDIR}/kerberosIV &&	${MAKE} ${.MAKEFLAGS} installmost
3913626Swollman#.endif
3923626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
39330113Sjkh#	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 && \
42630113Sjkh		${MAKE} ${MK_FLAGS} all && \
42730113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
42817820Sjkh	cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \
42930113Sjkh		${MAKE} ${MK_FLAGS} all && \
43030113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
43117820Sjkh	cd ${.CURDIR}/usr.bin/lex && ${MAKE} bootstrap && ${MAKE} depend && \
43230113Sjkh		${MAKE} ${MK_FLAGS} -DNOLIB && \
43330113Sjkh		${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
43429938Smckay.if !defined(NOOBJDIR)
43529938Smckay	cd ${.CURDIR}/usr.bin/lex && ${MAKE} obj
43629938Smckay.endif
43717308Speter
43817308Speter#
43917308Speter# include-tools - generally the same as 'bootstrap', except that it's for
44017308Speter# things that are specifically needed to generate include files.
44117308Speter#
44227910Sasami# XXX should be merged with bootstrap, it's not worth keeeping them separate.
44327910Sasami# Well, maybe it is now.  We force 'cleandepend' here to avoid dependencies
44427910Sasami# on cleaned away headers in ${WORLDTMP}.
44517308Speter#
44617308Speterinclude-tools:
44730113Sjkh	cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} -B cleandepend depend && \
44830113Sjkh		${MAKE} ${MK_FLAGS} all && \
44930113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
45017308Speter
45117308Speter#
45217308Speter# includes - possibly generate and install the include files.
45317308Speter#
45414119Speterincludes:
4552061Sjkh.if defined(CLOBBER)
4567130Srgrimes	rm -rf ${DESTDIR}/usr/include/*
4577130Srgrimes	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
4587130Srgrimes		-p ${DESTDIR}/usr/include
4592061Sjkh.endif
46030113Sjkh	cd ${.CURDIR}/include &&		${MAKE} -B all install
46117308Speter	cd ${.CURDIR}/gnu/include &&		${MAKE} install
46230169Sjkh	cd ${.CURDIR}/gnu/lib/libmp &&		${MAKE} beforeinstall
46330169Sjkh	cd ${.CURDIR}/gnu/lib/libobjc &&	${MAKE} beforeinstall
4642685Srgrimes	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
4656927Snate	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
46627790Sasami	cd ${.CURDIR}/gnu/lib/libstdc++ &&	${MAKE} beforeinstall
46727790Sasami	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
46827790Sasami	cd ${.CURDIR}/gnu/lib/libdialog &&	${MAKE} beforeinstall
46930169Sjkh	cd ${.CURDIR}/gnu/lib/libgmp &&		${MAKE} beforeinstall
47030169Sjkh.if exists(secure) && !defined(NOCRYPT)
47130169Sjkh	cd ${.CURDIR}/secure/lib/libdes &&	${MAKE} beforeinstall
4723197Scsgr.endif
47330169Sjkh.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
47430169Sjkh	cd ${.CURDIR}/kerberosIV/lib/libacl &&	${MAKE} beforeinstall
47530169Sjkh	cd ${.CURDIR}/kerberosIV/lib/libkadm &&	${MAKE} beforeinstall
47630169Sjkh	cd ${.CURDIR}/kerberosIV/lib/libkafs &&	${MAKE} beforeinstall
47730169Sjkh	cd ${.CURDIR}/kerberosIV/lib/libkdb &&	${MAKE} beforeinstall
47830169Sjkh	cd ${.CURDIR}/kerberosIV/lib/libkrb &&	${MAKE} beforeinstall
47930169Sjkh	cd ${.CURDIR}/kerberosIV/lib/libtelnet && ${MAKE} beforeinstall
48030169Sjkh.else
48130169Sjkh	cd ${.CURDIR}/lib/libtelnet &&		${MAKE} beforeinstall
48230169Sjkh.endif
48325313Sbde	cd ${.CURDIR}/lib/csu/i386 &&		${MAKE} beforeinstall
48426152Speter	cd ${.CURDIR}/lib/libalias &&		${MAKE} beforeinstall
4852061Sjkh	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
4862061Sjkh	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
48730169Sjkh	cd ${.CURDIR}/lib/libdisk &&		${MAKE} beforeinstall
4882061Sjkh	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
48916786Snate	cd ${.CURDIR}/lib/libftpio &&		${MAKE} beforeinstall
4902883Sphk	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
49127790Sasami	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE} beforeinstall
49217308Speter	cd ${.CURDIR}/lib/libncurses &&		${MAKE} beforeinstall
4937281Srgrimes.if !defined(WANT_CSRG_LIBM)
4943242Spaul	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
4953242Spaul.endif
49630169Sjkh	cd ${.CURDIR}/lib/libopie &&		${MAKE} beforeinstall
4977171Sats	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
4982061Sjkh	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
4993213Spst	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
50030169Sjkh.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \
50130169Sjkh	exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl)
50230169Sjkh	cd ${.CURDIR}/lib/libtcl &&		${MAKE} installhdrs
50330169Sjkh.endif
50417308Speter	cd ${.CURDIR}/lib/libtermcap &&		${MAKE} beforeinstall
5055749Swollman	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
5065772Swollman	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
50717308Speter	cd ${.CURDIR}/lib/libscsi &&		${MAKE} beforeinstall
50817308Speter	cd ${.CURDIR}/lib/libutil &&		${MAKE} beforeinstall
50930169Sjkh	cd ${.CURDIR}/lib/libvgl &&		${MAKE} beforeinstall
51026504Sjhay	cd ${.CURDIR}/lib/libz &&		${MAKE} beforeinstall
51130169Sjkh	cd ${.CURDIR}/usr.bin/f2c &&		${MAKE} beforeinstall
51230169Sjkh	cd ${.CURDIR}/usr.bin/lex &&		${MAKE} beforeinstall
5132061Sjkh
51417308Speter#
51517308Speter# lib-tools - build tools to compile and install the libraries.
51617308Speter#
51727910Sasami# XXX gperf is required for cc
51827910Sasami# XXX a new ld and tsort is required for cc
5195366Snatelib-tools:
52027910Sasami.for d in				\
52127910Sasami		gnu/usr.bin/gperf	\
52227910Sasami		gnu/usr.bin/ld		\
52327910Sasami		usr.bin/tsort		\
52427910Sasami		gnu/usr.bin/as		\
52527910Sasami		gnu/usr.bin/bison	\
52627910Sasami		gnu/usr.bin/cc		\
52727910Sasami		usr.bin/ar		\
52827910Sasami		usr.bin/compile_et	\
52927910Sasami		usr.bin/lex/lib		\
53027910Sasami		usr.bin/mk_cmds		\
53127910Sasami		usr.bin/nm		\
53227910Sasami		usr.bin/ranlib		\
53327910Sasami		usr.bin/uudecode
53427910Sasami	cd ${.CURDIR}/$d && ${MAKE} depend && \
53530113Sjkh		${MAKE} ${MK_FLAGS} all && \
53630113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
53727910Sasami.endfor
5385366Snate
53917308Speter#
54017308Speter# libraries - build and install the libraries
54117308Speter#
5422061Sjkhlibraries:
54324754Sjdp.if exists(lib/csu/i386)
54424754Sjdp	cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
54530113Sjkh		${MAKE} ${MK_FLAGS} all && \
54630113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
54724754Sjdp.endif
5488295Srgrimes.if exists(lib/libcompat)
54917820Sjkh	cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
55030113Sjkh		${MAKE} ${MK_FLAGS} all && \
55130113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5528295Srgrimes.endif
5538489Srgrimes.if exists(lib/libncurses)
55417820Sjkh	cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \
55530113Sjkh		${MAKE} ${MK_FLAGS} all && \
55630113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5578489Srgrimes.endif
5588489Srgrimes.if exists(lib/libtermcap)
55917820Sjkh	cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
56030113Sjkh		${MAKE} ${MK_FLAGS} all && \
56130113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5628489Srgrimes.endif
5638295Srgrimes.if exists(gnu)
56417820Sjkh	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
56530113Sjkh		${MAKE} ${MK_FLAGS} all && \
56630113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5678295Srgrimes.endif
5682160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
56917820Sjkh	cd ${.CURDIR}/secure/lib && ${MAKE} depend && \
57030113Sjkh		${MAKE} ${MK_FLAGS} all && \
57130113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5722160Scsgr.endif
5732279Spaul.if exists(lib)
57417820Sjkh	cd ${.CURDIR}/lib && ${MAKE} depend && \
57530113Sjkh		${MAKE} ${MK_FLAGS} all && \
57630113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5772279Spaul.endif
57817234Sjraynard.if exists(usr.bin/lex/lib)
57917820Sjkh	cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
58030113Sjkh		${MAKE} ${MK_FLAGS} all && \
58130113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
58211772Snate.endif
58330127Smarkm.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
58430127Smarkm	cd ${.CURDIR}/kerberosIV/lib && ${MAKE} depend && \
58530113Sjkh		${MAKE} ${MK_FLAGS} all && \
58630113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5872626Scsgr.endif
5888304Srgrimes.if exists(usr.sbin/pcvt/keycap)
58917820Sjkh	cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \
59030113Sjkh		${MAKE} ${MK_FLAGS} all && \
59130113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5928304Srgrimes.endif
5932061Sjkh
59417308Speter#
59517308Speter# build-tools - build and install any other tools needed to complete the
59617308Speter# compile and install.
59727910Sasami# ifdef stale
59827910Sasami# bc and cpp are required to build groff.  Otherwise, the order here is
59927910Sasami# mostly historical, i.e., bogus.
60027910Sasami# chmod is used to build gcc's tmpmultilib[2] at obscure times.
60127910Sasami# endif stale
60227910Sasami# XXX uname is a bug - the target should not depend on the host.
60317308Speter#
60411806Sphkbuild-tools:
60519175Sbde.for d in				\
60627910Sasami		bin/cat 		\
60727910Sasami		bin/chmod		\
60827910Sasami		bin/cp 			\
60927910Sasami		bin/date		\
61027910Sasami		bin/dd			\
61127910Sasami		bin/echo		\
61227910Sasami		bin/expr		\
61327910Sasami		bin/hostname		\
61427910Sasami		bin/ln			\
61527910Sasami		bin/ls			\
61627910Sasami		bin/mkdir		\
61727910Sasami		bin/mv			\
61827910Sasami		bin/rm			\
61927910Sasami		bin/sh			\
62027910Sasami		bin/test		\
62127910Sasami		gnu/usr.bin/awk		\
62227910Sasami		gnu/usr.bin/bc		\
62327910Sasami		gnu/usr.bin/grep	\
62427910Sasami		gnu/usr.bin/groff	\
62527910Sasami		gnu/usr.bin/gzip	\
62627910Sasami		gnu/usr.bin/man/makewhatis	\
62727910Sasami		gnu/usr.bin/sort	\
62827910Sasami		gnu/usr.bin/texinfo     \
62921673Sjkh		share/info		\
63027910Sasami		usr.bin/basename	\
63127910Sasami		usr.bin/cap_mkdb	\
63227910Sasami		usr.bin/chflags		\
63327910Sasami		usr.bin/cmp		\
63427910Sasami		usr.bin/col		\
63527910Sasami		usr.bin/cpp		\
63627910Sasami		usr.bin/expand		\
63727910Sasami		usr.bin/file2c		\
63827910Sasami		usr.bin/find		\
63927910Sasami		usr.bin/gencat		\
64027910Sasami		usr.bin/lorder		\
64127910Sasami		usr.bin/m4		\
64227910Sasami		usr.bin/mkdep		\
64327910Sasami		usr.bin/paste		\
64427910Sasami		usr.bin/sed		\
64527910Sasami		usr.bin/size		\
64627910Sasami		usr.bin/soelim		\
64727910Sasami		usr.bin/strip		\
64819175Sbde		usr.bin/symorder	\
64927910Sasami		usr.bin/touch		\
65027910Sasami		usr.bin/tr		\
65127910Sasami		usr.bin/true		\
65227910Sasami		usr.bin/uname		\
65327910Sasami		usr.bin/uuencode	\
65427910Sasami		usr.bin/vgrind		\
65527910Sasami		usr.bin/vi		\
65627910Sasami		usr.bin/wc		\
65727910Sasami		usr.bin/yacc		\
65827910Sasami		usr.sbin/chown		\
65927910Sasami		usr.sbin/mtree		\
66027910Sasami		usr.sbin/zic
66119175Sbde	cd ${.CURDIR}/$d && ${MAKE} depend && \
66230113Sjkh		${MAKE} ${MK_FLAGS} all && \
66330113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
66419175Sbde.endfor
6652061Sjkh
66630113Sjkh.for __target in clean cleandir obj depend
66730113Sjkh.for entry in ${SUBDIR}
66830113Sjkh${entry}.${__target}__D: .PHONY
66930113Sjkh	if test -d ${.CURDIR}/${entry}.${MACHINE}; then \
67030113Sjkh		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \
67130113Sjkh		edir=${entry}.${MACHINE}; \
67230113Sjkh		cd ${.CURDIR}/$${edir}; \
67330113Sjkh	else \
67430113Sjkh		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
67530113Sjkh		edir=${entry}; \
67630113Sjkh		cd ${.CURDIR}/$${edir}; \
67730113Sjkh	fi; \
67830113Sjkh	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
67930113Sjkh.endfor
68030113Sjkhpar-${__target}: ${SUBDIR:S/$/.${__target}__D/}
68130113Sjkh.endfor
68230113Sjkh
6831594Srgrimes.include <bsd.subdir.mk>
684