Makefile revision 32427
12061Sjkh#
232427Sjb#	$Id: Makefile,v 1.155 1997/10/10 13:02:36 asami Exp $
32061Sjkh#
432427Sjb# While porting to the Alpha architecture include the bootstrap instead
532427Sjb# of the normal build.
632427Sjb#
732427Sjb.if ${MACHINE} == "alpha"
832427Sjb.include "Makefile.alpha"
932427Sjb.else
1032427Sjb#
112061Sjkh# Make command line options:
1215603Smarkm#	-DCLOBBER will remove /usr/include
1330169Sjkh#	-DMAKE_KERBEROS4 to build KerberosIV
1420710Sasami#	-DALLLANG to build documentation for all languages
1520710Sasami#	  (where available -- see share/doc/Makefile)
163197Scsgr#
172061Sjkh#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
1812483Speter#	-DNOCLEAN do not clean at all
192160Scsgr#	-DNOCRYPT will prevent building of crypt versions
202834Swollman#	-DNOLKM do not build loadable kernel modules
212061Sjkh#	-DNOOBJDIR do not run ``${MAKE} obj''
222061Sjkh#	-DNOPROFILE do not build profiled libraries
232160Scsgr#	-DNOSECURE do not go into secure subdir
2417308Speter#	-DNOGAMES do not go into games subdir
2519320Sadam#	-DNOSHARE do not go into share subdir
2627788Sasami#	-DNOINFO do not make or install info files
2730169Sjkh#	-DNOLIBC_R do not build libc_r.
2825980Sasami#	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
291594Srgrimes
3017308Speter#
3117308Speter# The intended user-driven targets are:
3227910Sasami# buildworld  - rebuild *everything*, including glue to help do upgrades
3327910Sasami# installworld- install everything built by "buildworld"
3427910Sasami# world       - buildworld + installworld
3517308Speter# update      - convenient way to update your source tree (eg: sup/cvs)
3617308Speter# most        - build user commands, no libraries or include files
3717308Speter# installmost - install user commands, no libraries or include files
3819175Sbde#
3919175Sbde# Standard targets (not defined here) are documented in the makefiles in
4019175Sbde# /usr/share/mk.  These include:
4119175Sbde#		obj depend all install clean cleandepend cleanobj
4217308Speter
4327910Sasami.if (!make(world)) && (!make(buildworld)) && (!make(installworld))
4425647Sbde.MAKEFLAGS:=	${.MAKEFLAGS} -m ${.CURDIR}/share/mk
4527910Sasami.endif
4617308Speter
472061Sjkh# Put initial settings here.
482061SjkhSUBDIR=
491594Srgrimes
5030169Sjkh# We must do share/info early so that installation of info `dir'
5130169Sjkh# entries works correctly.  Do it first since it is less likely to
5230169Sjkh# grow dependencies on include and lib than vice versa.
5330169Sjkh.if exists(share/info)
5430169SjkhSUBDIR+= share/info
5530169Sjkh.endif
5630169Sjkh
5730169Sjkh# We must do include and lib early so that the perl *.ph generation
587407Srgrimes# works correctly as it uses the header files installed by this.
597108Sphk.if exists(include)
607108SphkSUBDIR+= include
617108Sphk.endif
627407Srgrimes.if exists(lib)
637407SrgrimesSUBDIR+= lib
647407Srgrimes.endif
657108Sphk
662061Sjkh.if exists(bin)
672061SjkhSUBDIR+= bin
682061Sjkh.endif
6917308Speter.if exists(games) && !defined(NOGAMES)
702061SjkhSUBDIR+= games
712061Sjkh.endif
722061Sjkh.if exists(gnu)
732061SjkhSUBDIR+= gnu
742061Sjkh.endif
7530169Sjkh.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
7630169SjkhSUBDIR+= kerberosIV
772626Scsgr.endif
782061Sjkh.if exists(libexec)
792061SjkhSUBDIR+= libexec
802061Sjkh.endif
812061Sjkh.if exists(sbin)
822061SjkhSUBDIR+= sbin
832061Sjkh.endif
8419320Sadam.if exists(share) && !defined(NOSHARE)
852061SjkhSUBDIR+= share
862061Sjkh.endif
872061Sjkh.if exists(sys)
882061SjkhSUBDIR+= sys
892061Sjkh.endif
902061Sjkh.if exists(usr.bin)
912061SjkhSUBDIR+= usr.bin
922061Sjkh.endif
932061Sjkh.if exists(usr.sbin)
942061SjkhSUBDIR+= usr.sbin
952061Sjkh.endif
962834Swollman.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
972834SwollmanSUBDIR+= secure
982834Swollman.endif
992834Swollman.if exists(lkm) && !defined(NOLKM)
1002834SwollmanSUBDIR+= lkm
1012834Swollman.endif
1021594Srgrimes
1034486Sphk# etc must be last for "distribute" to work
1044486Sphk.if exists(etc) && make(distribute)
1054486SphkSUBDIR+= etc
1064486Sphk.endif
1074486Sphk
1082061Sjkh# These are last, since it is nice to at least get the base system
1092061Sjkh# rebuilt before you do them.
11025979Sjkh.if defined(LOCAL_DIRS)
11125979Sjkh.for _DIR in ${LOCAL_DIRS}
11225979Sjkh.if exists(${_DIR}) & exists(${_DIR}/Makefile)
11325979SjkhSUBDIR+= ${_DIR}
1142061Sjkh.endif
11525979Sjkh.endfor
1162061Sjkh.endif
1172061Sjkh
11817308Speter# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
1192061Sjkh.if defined(NOOBJDIR)
1202061SjkhOBJDIR=
1212061Sjkh.else
1222061SjkhOBJDIR=		obj
1232061Sjkh.endif
12412483Speter
12512483Speter.if defined(NOCLEAN)
12612483SpeterCLEANDIR=
12712483Speter.else
1282061Sjkh.if defined(NOCLEANDIR)
1292061SjkhCLEANDIR=	clean
1308854Srgrimes.else
1312061SjkhCLEANDIR=	cleandir
1322061Sjkh.endif
13312483Speter.endif
1342061Sjkh
13527910SasamiSUP?=		sup
13627910SasamiSUPFLAGS?=	-v
13718714Sache
13817308Speter#
13917308Speter# While building tools for bootstrapping, we dont need to waste time on
14017308Speter# profiled libraries or man pages.  This speeds things up somewhat.
14117308Speter#
14221536SjmacdMK_FLAGS=	-DNOINFO -DNOMAN -DNOPROFILE
14315603Smarkm
14417308Speter#
14517308Speter# world
14617308Speter#
14717308Speter# Attempt to rebuild and reinstall *everything*, with reasonable chance of
14817308Speter# success, regardless of how old your existing system is.
14917308Speter#
15017308Speter# >> Beware, it overwrites the local build environment! <<
15117308Speter#
15217308Speterworld:
15318362Sjkh	@echo "--------------------------------------------------------------"
15419966Sache	@echo "make world started on `LC_TIME=C date`"
15518362Sjkh	@echo "--------------------------------------------------------------"
15617308Speter.if target(pre-world)
15727910Sasami	@echo
15817308Speter	@echo "--------------------------------------------------------------"
15917308Speter	@echo " Making 'pre-world' target"
16017308Speter	@echo "--------------------------------------------------------------"
16128803Speter	cd ${.CURDIR} && ${MAKE} pre-world
16227910Sasami.endif
16328803Speter	cd ${.CURDIR} && ${MAKE} buildworld
16430113Sjkh	cd ${.CURDIR} && ${MAKE} -B installworld
16527910Sasami.if target(post-world)
16617308Speter	@echo
1672061Sjkh	@echo "--------------------------------------------------------------"
16827910Sasami	@echo " Making 'post-world' target"
1692061Sjkh	@echo "--------------------------------------------------------------"
17028803Speter	cd ${.CURDIR} && ${MAKE} post-world
17127910Sasami.endif
1722061Sjkh	@echo
17317308Speter	@echo "--------------------------------------------------------------"
17427910Sasami	@echo "make world completed on `LC_TIME=C date`"
17517308Speter	@echo "--------------------------------------------------------------"
17627910Sasami
17727910Sasami.if defined(MAKEOBJDIRPREFIX)
17827910SasamiWORLDTMP=	${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
17917308Speter.else
18027910SasamiWORLDTMP=	/usr/obj${.CURDIR}/tmp
18117308Speter.endif
18227910SasamiSTRICTTMPPATH=	${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin
18327910SasamiTMPPATH=	${STRICTTMPPATH}:${PATH}
18427910Sasami
18527910Sasami# XXX COMPILER_PATH is needed for finding cc1, ld and as
18627910Sasami# XXX GCC_EXEC_PREFIX is for *crt.o.  It is probably unnecssary now
18727910Sasami#	tbat LIBRARY_PATH is set.  We still can't use -nostdlib, since gcc
18827910Sasami#	wouldn't link *crt.o or libgcc if it were used.
18927910Sasami# XXX LD_LIBRARY_PATH is for ld.so.  It is also used by ld, although we don't
19027910Sasami#	want that - all compile-time library paths should be resolved by gcc.
19127910Sasami#	It fails for set[ug]id executables (are any used?).
19227910SasamiCOMPILER_ENV=	BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \
19327910Sasami		COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
19427910Sasami		GCC_EXEC_PREFIX=${WORLDTMP}/usr/lib/ \
19527910Sasami		LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \
19627910Sasami		LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
19727910Sasami
19827910SasamiBMAKEENV=	PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t
19927910SasamiXMAKEENV=	PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
20027910Sasami		CC='cc -nostdinc'	# XXX -nostdlib
20127910Sasami
20227910Sasami# used to compile and install 'make' in temporary build tree
20327910SasamiIBMAKE=	${BMAKEENV} ${MAKE} DESTDIR=${WORLDTMP}
20427910Sasami# bootstrap make
20527910SasamiBMAKE=	${BMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
20627910Sasami# cross make used for compilation
20727910SasamiXMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
20827910Sasami# cross make used for final installation
20927910SasamiIXMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE}
21027910Sasami
21127910Sasami#
21227910Sasami# buildworld
21327910Sasami#
21427910Sasami# Attempt to rebuild the entire system, with reasonable chance of
21527910Sasami# success, regardless of how old your existing system is.
21627910Sasami#
21727910Sasamibuildworld:
21827910Sasami.if !defined(NOCLEAN)
21917308Speter	@echo
22017308Speter	@echo "--------------------------------------------------------------"
22127910Sasami	@echo " Cleaning up the temporary build tree"
22217308Speter	@echo "--------------------------------------------------------------"
22327910Sasami	mkdir -p ${WORLDTMP}
22427910Sasami	chflags -R noschg ${WORLDTMP}/
22527910Sasami	rm -rf ${WORLDTMP}
22627910Sasami.endif
22717466Speter	@echo
22817308Speter	@echo "--------------------------------------------------------------"
22927910Sasami	@echo " Making make"
23017308Speter	@echo "--------------------------------------------------------------"
23127910Sasami	mkdir -p ${WORLDTMP}/usr/bin
23230277Sasami.if !defined(NOCLEAN) || !defined(NOOBJDIR)
23327910Sasami	cd ${.CURDIR}/usr.bin/make && \
23430277Sasami		${IBMAKE} -I${.CURDIR}/share/mk ${CLEANDIR} ${OBJDIR}
23530277Sasami.endif
23630277Sasami	cd ${.CURDIR}/usr.bin/make && \
23730277Sasami		${IBMAKE} -I${.CURDIR}/share/mk depend && \
23830113Sjkh		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all && \
23930277Sasami		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install && \
24030277Sasami		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean cleandepend
24117308Speter	@echo
24217308Speter	@echo "--------------------------------------------------------------"
24327910Sasami	@echo " Making hierarchy"
24417308Speter	@echo "--------------------------------------------------------------"
24527910Sasami	cd ${.CURDIR} && ${BMAKE} hierarchy
24627910Sasami.if !defined(NOCLEAN)
24717308Speter	@echo
24817308Speter	@echo "--------------------------------------------------------------"
24927910Sasami	@echo " Cleaning up the obj tree"
25017308Speter	@echo "--------------------------------------------------------------"
25130113Sjkh	cd ${.CURDIR} && ${BMAKE} par-${CLEANDIR}
25227910Sasami.endif
25327910Sasami.if !defined(NOOBJDIR)
25417308Speter	@echo
25517308Speter	@echo "--------------------------------------------------------------"
25627910Sasami	@echo " Rebuilding the obj tree"
25717308Speter	@echo "--------------------------------------------------------------"
25830113Sjkh	cd ${.CURDIR} && ${BMAKE} par-obj
25927910Sasami.endif
26017308Speter	@echo
26117308Speter	@echo "--------------------------------------------------------------"
26227910Sasami	@echo " Rebuilding bootstrap tools"
26317308Speter	@echo "--------------------------------------------------------------"
26427910Sasami	cd ${.CURDIR} && ${BMAKE} bootstrap
26517308Speter	@echo
26617308Speter	@echo "--------------------------------------------------------------"
26727910Sasami	@echo " Rebuilding tools necessary to build the include files"
26817308Speter	@echo "--------------------------------------------------------------"
26927910Sasami	cd ${.CURDIR} && ${BMAKE} include-tools
27017308Speter	@echo
27117308Speter	@echo "--------------------------------------------------------------"
27227910Sasami	@echo " Rebuilding /usr/include"
27317308Speter	@echo "--------------------------------------------------------------"
27429503Sbde	cd ${.CURDIR} && SHARED=symlinks ${BMAKE} includes
27517962Speter	@echo
27617962Speter	@echo "--------------------------------------------------------------"
27727910Sasami	@echo " Rebuilding tools needed to build the libraries"
27817962Speter	@echo "--------------------------------------------------------------"
27927910Sasami	cd ${.CURDIR} && ${BMAKE} lib-tools
28017962Speter	@echo
28117962Speter	@echo "--------------------------------------------------------------"
28227910Sasami	@echo " Rebuilding /usr/lib"
28317962Speter	@echo "--------------------------------------------------------------"
28427910Sasami	cd ${.CURDIR} && ${BMAKE} libraries
28517962Speter	@echo
28617962Speter	@echo "--------------------------------------------------------------"
28727910Sasami	@echo " Rebuilding all other tools needed to build the world"
28817962Speter	@echo "--------------------------------------------------------------"
28927910Sasami	cd ${.CURDIR} && ${BMAKE} build-tools
29017308Speter	@echo
29117308Speter	@echo "--------------------------------------------------------------"
29227910Sasami	@echo " Rebuilding dependencies"
29317308Speter	@echo "--------------------------------------------------------------"
29430205Sbde	cd ${.CURDIR} && ${XMAKE} par-depend
29517308Speter	@echo
29617308Speter	@echo "--------------------------------------------------------------"
29727910Sasami	@echo " Building everything.."
29817962Speter	@echo "--------------------------------------------------------------"
29927910Sasami	cd ${.CURDIR} && ${XMAKE} all
3002061Sjkh
30117308Speter#
30227910Sasami# installworld
30327910Sasami#
30427910Sasami# Installs everything compiled by a 'buildworld'.
30527910Sasami#
30627910Sasamiinstallworld:
30727910Sasami	cd ${.CURDIR} && ${IXMAKE} reinstall
30827910Sasami
30927910Sasami#
31017308Speter# reinstall
31117308Speter#
31217308Speter# If you have a build server, you can NFS mount the source and obj directories
31317308Speter# and do a 'make reinstall' on the *client* to install new binaries from the
31417308Speter# most recent server build.
31517308Speter#
31617308Speterreinstall:
31712483Speter	@echo "--------------------------------------------------------------"
31817308Speter	@echo " Making hierarchy"
31912483Speter	@echo "--------------------------------------------------------------"
32017308Speter	cd ${.CURDIR} && ${MAKE} hierarchy
32112483Speter	@echo
3222061Sjkh	@echo "--------------------------------------------------------------"
32317962Speter	@echo " Installing everything.."
32417962Speter	@echo "--------------------------------------------------------------"
32517308Speter	cd ${.CURDIR} && ${MAKE} install
32617962Speter	@echo
32717962Speter	@echo "--------------------------------------------------------------"
32817962Speter	@echo " Rebuilding man page indexes"
32917962Speter	@echo "--------------------------------------------------------------"
33017308Speter	cd ${.CURDIR}/share/man && ${MAKE} makedb
3312061Sjkh
33217308Speter#
33317308Speter# update
33417308Speter#
33517308Speter# Update the source tree, by running sup and/or running cvs to update to the
33617308Speter# latest copy.
33717308Speter#
3382302Spaulupdate:
3392302Spaul.if defined(SUP_UPDATE)
3402302Spaul	@echo "--------------------------------------------------------------"
3412302Spaul	@echo "Running sup"
3422302Spaul	@echo "--------------------------------------------------------------"
34318714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE}
34410760Sache.if defined(SUPFILE1)
34518714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE1}
3462302Spaul.endif
34710760Sache.if defined(SUPFILE2)
34818714Sache	@${SUP} ${SUPFLAGS} ${SUPFILE2}
34910760Sache.endif
35010760Sache.endif
3512302Spaul.if defined(CVS_UPDATE)
3522302Spaul	@echo "--------------------------------------------------------------"
3532302Spaul	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
3542302Spaul	@echo "--------------------------------------------------------------"
35530132Sfsmp	cd ${.CURDIR} && cvs -q update -P -d
3562302Spaul.endif
3572302Spaul
35817308Speter#
35917308Speter# most
36017308Speter#
36117308Speter# Build most of the user binaries on the existing system libs and includes.
36217308Speter#
36317308Spetermost:
3642061Sjkh	@echo "--------------------------------------------------------------"
36517308Speter	@echo " Building programs only"
3662061Sjkh	@echo "--------------------------------------------------------------"
36730205Sbde	cd ${.CURDIR}/bin	&&	${MAKE} all
36830205Sbde	cd ${.CURDIR}/sbin	&&	${MAKE} all
36930205Sbde	cd ${.CURDIR}/libexec	&&	${MAKE} all
37030205Sbde	cd ${.CURDIR}/usr.bin	&&	${MAKE} all
37130205Sbde	cd ${.CURDIR}/usr.sbin	&&	${MAKE} all
37230205Sbde	cd ${.CURDIR}/gnu/libexec &&	${MAKE} all
37330205Sbde	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} all
37430205Sbde	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} all
37530169Sjkh#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
37630205Sbde#	cd ${.CURDIR}/kerberosIV	&&	${MAKE} most
37717308Speter#.endif
37817308Speter#.if !defined(NOSECURE) && !defined(NOCRYPT)
37930205Sbde#	cd ${.CURDIR}/secure	&&	${MAKE} most
38017308Speter#.endif
3812061Sjkh
38217308Speter#
38317308Speter# installmost
38417308Speter#
38517308Speter# Install the binaries built by the 'most' target.  This does not include
38617308Speter# libraries or include files.
38717308Speter#
3883626Swollmaninstallmost:
3893626Swollman	@echo "--------------------------------------------------------------"
3903626Swollman	@echo " Installing programs only"
3913626Swollman	@echo "--------------------------------------------------------------"
39230205Sbde	cd ${.CURDIR}/bin	&&	${MAKE} install
39330205Sbde	cd ${.CURDIR}/sbin	&&	${MAKE} install
39430205Sbde	cd ${.CURDIR}/libexec	&&	${MAKE} install
39530205Sbde	cd ${.CURDIR}/usr.bin	&&	${MAKE} install
39630205Sbde	cd ${.CURDIR}/usr.sbin	&&	${MAKE} install
39730205Sbde	cd ${.CURDIR}/gnu/libexec &&	${MAKE} install
39830205Sbde	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} install
39930205Sbde	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} install
40030169Sjkh#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
40130205Sbde#	cd ${.CURDIR}/kerberosIV &&	${MAKE} installmost
4023626Swollman#.endif
4033626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
40430205Sbde#	cd ${.CURDIR}/secure	&&	${MAKE} installmost
4053626Swollman#.endif
4063626Swollman
40717308Speter#
40817308Speter# ------------------------------------------------------------------------
40917308Speter#
41017308Speter# From here onwards are utility targets used by the 'make world' and
41117308Speter# related targets.  If your 'world' breaks, you may like to try to fix
41217308Speter# the problem and manually run the following targets to attempt to
41317308Speter# complete the build.  Beware, this is *not* guaranteed to work, you
41417308Speter# need to have a pretty good grip on the current state of the system
41517308Speter# to attempt to manually finish it.  If in doubt, 'make world' again.
41617308Speter#
4173626Swollman
41817308Speter#
41917308Speter# heirarchy - ensure that all the needed directories are present
42017308Speter#
42117308Speterhierarchy:
42217308Speter	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
42317308Speter
42417308Speter#
42517308Speter# bootstrap - [re]build tools needed to run the actual build, this includes
42617308Speter# tools needed by 'make depend', as some tools are needed to generate source
42717308Speter# for the dependency information to be gathered from.
42817308Speter#
42917308Speterbootstrap:
43027910Sasami.if defined(DESTDIR)
43127910Sasami	rm -f ${DESTDIR}/usr/src/sys
43227910Sasami	ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src
43327910Sasami	cd ${.CURDIR}/include && find -dx . | cpio -dump ${DESTDIR}/usr/include
43427910Sasami	cd ${.CURDIR}/include && make symlinks
43527910Sasami.endif
43617820Sjkh	cd ${.CURDIR}/usr.bin/make && ${MAKE} depend && \
43730113Sjkh		${MAKE} ${MK_FLAGS} all && \
43830113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
43917820Sjkh	cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \
44030113Sjkh		${MAKE} ${MK_FLAGS} all && \
44130113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
44217820Sjkh	cd ${.CURDIR}/usr.bin/lex && ${MAKE} bootstrap && ${MAKE} depend && \
44330170Sjkh		${MAKE} ${MK_FLAGS} -DNOLIB all && \
44430113Sjkh		${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
44529938Smckay.if !defined(NOOBJDIR)
44629938Smckay	cd ${.CURDIR}/usr.bin/lex && ${MAKE} obj
44729938Smckay.endif
44817308Speter
44917308Speter#
45017308Speter# include-tools - generally the same as 'bootstrap', except that it's for
45117308Speter# things that are specifically needed to generate include files.
45217308Speter#
45327910Sasami# XXX should be merged with bootstrap, it's not worth keeeping them separate.
45427910Sasami# Well, maybe it is now.  We force 'cleandepend' here to avoid dependencies
45527910Sasami# on cleaned away headers in ${WORLDTMP}.
45617308Speter#
45717308Speterinclude-tools:
45830113Sjkh	cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} -B cleandepend depend && \
45930113Sjkh		${MAKE} ${MK_FLAGS} all && \
46030113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
46117308Speter
46217308Speter#
46317308Speter# includes - possibly generate and install the include files.
46417308Speter#
46514119Speterincludes:
4662061Sjkh.if defined(CLOBBER)
4677130Srgrimes	rm -rf ${DESTDIR}/usr/include/*
4687130Srgrimes	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
4697130Srgrimes		-p ${DESTDIR}/usr/include
4702061Sjkh.endif
47130113Sjkh	cd ${.CURDIR}/include &&		${MAKE} -B all install
47217308Speter	cd ${.CURDIR}/gnu/include &&		${MAKE} install
47330169Sjkh	cd ${.CURDIR}/gnu/lib/libmp &&		${MAKE} beforeinstall
47430169Sjkh	cd ${.CURDIR}/gnu/lib/libobjc &&	${MAKE} beforeinstall
4752685Srgrimes	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
4766927Snate	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
47727790Sasami	cd ${.CURDIR}/gnu/lib/libstdc++ &&	${MAKE} beforeinstall
47827790Sasami	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
47927790Sasami	cd ${.CURDIR}/gnu/lib/libdialog &&	${MAKE} beforeinstall
48030169Sjkh	cd ${.CURDIR}/gnu/lib/libgmp &&		${MAKE} beforeinstall
48130169Sjkh.if exists(secure) && !defined(NOCRYPT)
48230169Sjkh	cd ${.CURDIR}/secure/lib/libdes &&	${MAKE} beforeinstall
4833197Scsgr.endif
48430169Sjkh.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
48530169Sjkh	cd ${.CURDIR}/kerberosIV/lib/libacl &&	${MAKE} beforeinstall
48630169Sjkh	cd ${.CURDIR}/kerberosIV/lib/libkadm &&	${MAKE} beforeinstall
48730169Sjkh	cd ${.CURDIR}/kerberosIV/lib/libkafs &&	${MAKE} beforeinstall
48830169Sjkh	cd ${.CURDIR}/kerberosIV/lib/libkdb &&	${MAKE} beforeinstall
48930169Sjkh	cd ${.CURDIR}/kerberosIV/lib/libkrb &&	${MAKE} beforeinstall
49030169Sjkh	cd ${.CURDIR}/kerberosIV/lib/libtelnet && ${MAKE} beforeinstall
49130169Sjkh.else
49230169Sjkh	cd ${.CURDIR}/lib/libtelnet &&		${MAKE} beforeinstall
49330169Sjkh.endif
49432427Sjb.if exists(${.CURDIR}/lib/csu/${MACHINE})
49532427Sjb	cd ${.CURDIR}/lib/csu/${MACHINE} &&	${MAKE} beforeinstall
49632427Sjb.endif
49726152Speter	cd ${.CURDIR}/lib/libalias &&		${MAKE} beforeinstall
4982061Sjkh	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
4992061Sjkh	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
50030169Sjkh	cd ${.CURDIR}/lib/libdisk &&		${MAKE} beforeinstall
5012061Sjkh	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
50216786Snate	cd ${.CURDIR}/lib/libftpio &&		${MAKE} beforeinstall
5032883Sphk	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
50427790Sasami	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE} beforeinstall
50517308Speter	cd ${.CURDIR}/lib/libncurses &&		${MAKE} beforeinstall
5067281Srgrimes.if !defined(WANT_CSRG_LIBM)
5073242Spaul	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
5083242Spaul.endif
50930169Sjkh	cd ${.CURDIR}/lib/libopie &&		${MAKE} beforeinstall
5107171Sats	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
5112061Sjkh	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
5123213Spst	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
51330169Sjkh.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \
51430169Sjkh	exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl)
51530169Sjkh	cd ${.CURDIR}/lib/libtcl &&		${MAKE} installhdrs
51630169Sjkh.endif
51717308Speter	cd ${.CURDIR}/lib/libtermcap &&		${MAKE} beforeinstall
5185749Swollman	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
5195772Swollman	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
52017308Speter	cd ${.CURDIR}/lib/libscsi &&		${MAKE} beforeinstall
52117308Speter	cd ${.CURDIR}/lib/libutil &&		${MAKE} beforeinstall
52230169Sjkh	cd ${.CURDIR}/lib/libvgl &&		${MAKE} beforeinstall
52326504Sjhay	cd ${.CURDIR}/lib/libz &&		${MAKE} beforeinstall
52430169Sjkh	cd ${.CURDIR}/usr.bin/f2c &&		${MAKE} beforeinstall
52530169Sjkh	cd ${.CURDIR}/usr.bin/lex &&		${MAKE} beforeinstall
5262061Sjkh
52717308Speter#
52817308Speter# lib-tools - build tools to compile and install the libraries.
52917308Speter#
53027910Sasami# XXX gperf is required for cc
53127910Sasami# XXX a new ld and tsort is required for cc
5325366Snatelib-tools:
53327910Sasami.for d in				\
53427910Sasami		gnu/usr.bin/gperf	\
53527910Sasami		gnu/usr.bin/ld		\
53627910Sasami		usr.bin/tsort		\
53727910Sasami		gnu/usr.bin/as		\
53827910Sasami		gnu/usr.bin/bison	\
53927910Sasami		gnu/usr.bin/cc		\
54027910Sasami		usr.bin/ar		\
54127910Sasami		usr.bin/compile_et	\
54227910Sasami		usr.bin/lex/lib		\
54327910Sasami		usr.bin/mk_cmds		\
54427910Sasami		usr.bin/nm		\
54527910Sasami		usr.bin/ranlib		\
54627910Sasami		usr.bin/uudecode
54727910Sasami	cd ${.CURDIR}/$d && ${MAKE} depend && \
54830113Sjkh		${MAKE} ${MK_FLAGS} all && \
54930113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
55027910Sasami.endfor
5515366Snate
55217308Speter#
55317308Speter# libraries - build and install the libraries
55417308Speter#
5552061Sjkhlibraries:
55632427Sjb.if exists(lib/csu/${MACHINE})
55732427Sjb	cd ${.CURDIR}/lib/csu/${MACHINE} && ${MAKE} depend && \
55830113Sjkh		${MAKE} ${MK_FLAGS} all && \
55930113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
56024754Sjdp.endif
5618295Srgrimes.if exists(lib/libcompat)
56217820Sjkh	cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
56330113Sjkh		${MAKE} ${MK_FLAGS} all && \
56430113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5658295Srgrimes.endif
5668489Srgrimes.if exists(lib/libncurses)
56717820Sjkh	cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \
56830113Sjkh		${MAKE} ${MK_FLAGS} all && \
56930113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5708489Srgrimes.endif
5718489Srgrimes.if exists(lib/libtermcap)
57217820Sjkh	cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
57330113Sjkh		${MAKE} ${MK_FLAGS} all && \
57430113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5758489Srgrimes.endif
5768295Srgrimes.if exists(gnu)
57717820Sjkh	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
57830113Sjkh		${MAKE} ${MK_FLAGS} all && \
57930113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5808295Srgrimes.endif
5812160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
58217820Sjkh	cd ${.CURDIR}/secure/lib && ${MAKE} depend && \
58330113Sjkh		${MAKE} ${MK_FLAGS} all && \
58430113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5852160Scsgr.endif
5862279Spaul.if exists(lib)
58717820Sjkh	cd ${.CURDIR}/lib && ${MAKE} depend && \
58830113Sjkh		${MAKE} ${MK_FLAGS} all && \
58930113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
5902279Spaul.endif
59117234Sjraynard.if exists(usr.bin/lex/lib)
59217820Sjkh	cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
59330113Sjkh		${MAKE} ${MK_FLAGS} all && \
59430113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
59511772Snate.endif
59630170Sjkh.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
59730127Smarkm	cd ${.CURDIR}/kerberosIV/lib && ${MAKE} depend && \
59830113Sjkh		${MAKE} ${MK_FLAGS} all && \
59930113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
6002626Scsgr.endif
6018304Srgrimes.if exists(usr.sbin/pcvt/keycap)
60217820Sjkh	cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \
60330113Sjkh		${MAKE} ${MK_FLAGS} all && \
60430113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
6058304Srgrimes.endif
6062061Sjkh
60717308Speter#
60817308Speter# build-tools - build and install any other tools needed to complete the
60917308Speter# compile and install.
61027910Sasami# ifdef stale
61127910Sasami# bc and cpp are required to build groff.  Otherwise, the order here is
61227910Sasami# mostly historical, i.e., bogus.
61327910Sasami# chmod is used to build gcc's tmpmultilib[2] at obscure times.
61427910Sasami# endif stale
61527910Sasami# XXX uname is a bug - the target should not depend on the host.
61617308Speter#
61711806Sphkbuild-tools:
61819175Sbde.for d in				\
61927910Sasami		bin/cat 		\
62027910Sasami		bin/chmod		\
62127910Sasami		bin/cp 			\
62227910Sasami		bin/date		\
62327910Sasami		bin/dd			\
62427910Sasami		bin/echo		\
62527910Sasami		bin/expr		\
62627910Sasami		bin/hostname		\
62727910Sasami		bin/ln			\
62827910Sasami		bin/ls			\
62927910Sasami		bin/mkdir		\
63027910Sasami		bin/mv			\
63127910Sasami		bin/rm			\
63227910Sasami		bin/sh			\
63327910Sasami		bin/test		\
63427910Sasami		gnu/usr.bin/awk		\
63527910Sasami		gnu/usr.bin/bc		\
63627910Sasami		gnu/usr.bin/grep	\
63727910Sasami		gnu/usr.bin/groff	\
63827910Sasami		gnu/usr.bin/gzip	\
63927910Sasami		gnu/usr.bin/man/makewhatis	\
64027910Sasami		gnu/usr.bin/sort	\
64127910Sasami		gnu/usr.bin/texinfo     \
64221673Sjkh		share/info		\
64327910Sasami		usr.bin/basename	\
64427910Sasami		usr.bin/cap_mkdb	\
64527910Sasami		usr.bin/chflags		\
64627910Sasami		usr.bin/cmp		\
64727910Sasami		usr.bin/col		\
64827910Sasami		usr.bin/cpp		\
64927910Sasami		usr.bin/expand		\
65027910Sasami		usr.bin/file2c		\
65127910Sasami		usr.bin/find		\
65227910Sasami		usr.bin/gencat		\
65327910Sasami		usr.bin/lorder		\
65427910Sasami		usr.bin/m4		\
65527910Sasami		usr.bin/mkdep		\
65627910Sasami		usr.bin/paste		\
65727910Sasami		usr.bin/sed		\
65827910Sasami		usr.bin/size		\
65927910Sasami		usr.bin/soelim		\
66027910Sasami		usr.bin/strip		\
66119175Sbde		usr.bin/symorder	\
66227910Sasami		usr.bin/touch		\
66327910Sasami		usr.bin/tr		\
66427910Sasami		usr.bin/true		\
66527910Sasami		usr.bin/uname		\
66627910Sasami		usr.bin/uuencode	\
66727910Sasami		usr.bin/vgrind		\
66827910Sasami		usr.bin/vi		\
66927910Sasami		usr.bin/wc		\
67027910Sasami		usr.bin/yacc		\
67127910Sasami		usr.sbin/chown		\
67227910Sasami		usr.sbin/mtree		\
67327910Sasami		usr.sbin/zic
67419175Sbde	cd ${.CURDIR}/$d && ${MAKE} depend && \
67530113Sjkh		${MAKE} ${MK_FLAGS} all && \
67630113Sjkh		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
67719175Sbde.endfor
6782061Sjkh
67930113Sjkh.for __target in clean cleandir obj depend
68030113Sjkh.for entry in ${SUBDIR}
68130113Sjkh${entry}.${__target}__D: .PHONY
68230113Sjkh	if test -d ${.CURDIR}/${entry}.${MACHINE}; then \
68330113Sjkh		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \
68430113Sjkh		edir=${entry}.${MACHINE}; \
68530113Sjkh		cd ${.CURDIR}/$${edir}; \
68630113Sjkh	else \
68730113Sjkh		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
68830113Sjkh		edir=${entry}; \
68930113Sjkh		cd ${.CURDIR}/$${edir}; \
69030113Sjkh	fi; \
69130113Sjkh	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
69230113Sjkh.endfor
69330113Sjkhpar-${__target}: ${SUBDIR:S/$/.${__target}__D/}
69430113Sjkh.endfor
69530113Sjkh
69632427Sjb.endif
69732427Sjb
6981594Srgrimes.include <bsd.subdir.mk>
699