Makefile.inc1 revision 94851
164382Skbyanc#
264382Skbyanc# $FreeBSD: head/Makefile.inc1 94851 2002-04-16 14:35:01Z ru $
364382Skbyanc#
464382Skbyanc# Make command line options:
539214Sgibbs#	-DMAKE_KERBEROS4 to build KerberosIV
639214Sgibbs#	-DMAKE_KERBEROS5 to build Kerberos5
739214Sgibbs#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
839214Sgibbs#	-DNOCLEAN do not clean at all
939214Sgibbs#	-DNOCRYPT will prevent building of crypt versions
1039214Sgibbs#	-DNOPROFILE do not build profiled libraries
1164382Skbyanc#	-DNOSECURE do not go into secure subdir
1264382Skbyanc#	-DNOGAMES do not go into games subdir
1339214Sgibbs#	-DNOSHARE do not go into share subdir
1439214Sgibbs#	-DNOINFO do not make or install info files
1564382Skbyanc#	-DNOLIBC_R do not build libc_r.
1664382Skbyanc#	-DNO_FORTRAN do not build g77 and related libraries.
1764382Skbyanc#	-DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
1864382Skbyanc#	-DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
1964382Skbyanc#	-DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
2064382Skbyanc#	-DNO_PERL do not build perl5 and related libraries
2164382Skbyanc#	-DNO_PORTSUPDATE do not update ports in ${MAKE} update
2264382Skbyanc#	-DNO_DOCUPDATE do not update doc in ${MAKE} update
2364382Skbyanc#	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
2464382Skbyanc#	TARGET_ARCH="arch" to crossbuild world to a different arch
2564382Skbyanc
2664382Skbyanc#
2739214Sgibbs# The intended user-driven targets are:
2864382Skbyanc# buildworld  - rebuild *everything*, including glue to help do upgrades
29114513Sobrien# installworld- install everything built by "buildworld"
30114513Sobrien# update      - convenient way to update your source tree (eg: sup/cvs)
3139214Sgibbs# most        - build user commands, no libraries or include files
3264382Skbyanc# installmost - install user commands, no libraries or include files
3364382Skbyanc#
3464382Skbyanc# Standard targets (not defined here) are documented in the makefiles in
3564382Skbyanc# /usr/share/mk.  These include:
3639214Sgibbs#		obj depend all install clean cleandepend cleanobj
3739214Sgibbs
3839214Sgibbs# Put initial settings here.
3964382SkbyancSUBDIR=
4039214Sgibbs
4139214Sgibbs# We must do share/info early so that installation of info `dir'
4264382Skbyanc# entries works correctly.  Do it first since it is less likely to
4339214Sgibbs# grow dependencies on include and lib than vice versa.
4439214Sgibbs.if exists(${.CURDIR}/share/info)
4564382SkbyancSUBDIR+= share/info
4639214Sgibbs.endif
4739214Sgibbs
4839214Sgibbs# We must do include and lib early so that the perl *.ph generation
4939214Sgibbs# works correctly as it uses the header files installed by this.
5039214Sgibbs.if exists(${.CURDIR}/include)
5164382SkbyancSUBDIR+= include
5264382Skbyanc.endif
5364382Skbyanc.if exists(${.CURDIR}/lib)
5464382SkbyancSUBDIR+= lib
5564382Skbyanc.endif
5664382Skbyanc
5764382Skbyanc.if exists(${.CURDIR}/bin)
5864382SkbyancSUBDIR+= bin
5964382Skbyanc.endif
6064382Skbyanc.if exists(${.CURDIR}/games) && !defined(NOGAMES)
6164382SkbyancSUBDIR+= games
6264474Skbyanc.endif
6364382Skbyanc.if exists(${.CURDIR}/gnu)
6464382SkbyancSUBDIR+= gnu
6564382Skbyanc.endif
6664382Skbyanc.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
6764382Skbyanc    !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS4)
6864382SkbyancSUBDIR+= kerberosIV
6964382Skbyanc.endif
7064382Skbyanc.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
7164382Skbyanc    !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5)
7264382SkbyancSUBDIR+= kerberos5
7364382Skbyanc.endif
7464382Skbyanc.if exists(${.CURDIR}/libexec)
7564382SkbyancSUBDIR+= libexec
7664382Skbyanc.endif
7764382Skbyanc.if exists(${.CURDIR}/sbin)
7864382SkbyancSUBDIR+= sbin
7964382Skbyanc.endif
8064382Skbyanc.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
8164382SkbyancSUBDIR+= secure
8264382Skbyanc.endif
8364382Skbyanc.if exists(${.CURDIR}/share) && !defined(NOSHARE)
84237740SscottlSUBDIR+= share
85237740Sscottl.endif
8664382Skbyanc.if exists(${.CURDIR}/sys)
8764382SkbyancSUBDIR+= sys
8864382Skbyanc.endif
8964382Skbyanc.if exists(${.CURDIR}/usr.bin)
9064382SkbyancSUBDIR+= usr.bin
9164382Skbyanc.endif
92237740Sscottl.if exists(${.CURDIR}/usr.sbin)
9364382SkbyancSUBDIR+= usr.sbin
9464382Skbyanc.endif
9564382Skbyanc
9664382Skbyanc# etc must be last for "distribute" to work
9764382Skbyanc.if exists(${.CURDIR}/etc)
9864382SkbyancSUBDIR+= etc
9964382Skbyanc.endif
10064382Skbyanc
10164382Skbyanc# These are last, since it is nice to at least get the base system
10264382Skbyanc# rebuilt before you do them.
10364382Skbyanc.if defined(LOCAL_DIRS)
10464382Skbyanc.for _DIR in ${LOCAL_DIRS}
10564382Skbyanc.if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
10664382SkbyancSUBDIR+= ${_DIR}
10764382Skbyanc.endif
10864382Skbyanc.endfor
10964382Skbyanc.endif
11064382Skbyanc
11164382Skbyanc.if defined(NOCLEANDIR)
11264382SkbyancCLEANDIR=	clean cleandepend
11364382Skbyanc.else
11464382SkbyancCLEANDIR=	cleandir
11564382Skbyanc.endif
11664382Skbyanc
117118478SjohanCVS?=		cvs
11864382SkbyancSUP?=		/usr/local/bin/cvsup
11964382SkbyancSUPFLAGS?=	-g -L 2 -P -
12064382Skbyanc.if defined(SUPHOST)
12164382SkbyancSUPFLAGS+=	-h ${SUPHOST}
12264382Skbyanc.endif
12364382Skbyanc
12464382SkbyancMAKEOBJDIRPREFIX?=	/usr/obj
12564382SkbyancTARGET_ARCH?=	${MACHINE_ARCH}
12664382Skbyanc.if ${TARGET_ARCH} == ${MACHINE_ARCH}
12764382SkbyancTARGET?=	${MACHINE}
12864382Skbyanc.else
12964382SkbyancTARGET?=	${TARGET_ARCH}
13064382Skbyanc.endif
13164382Skbyanc.if make(buildworld)
13264382SkbyancBUILD_ARCH!=	sysctl -n hw.machine_arch
13364382Skbyanc.if ${MACHINE_ARCH} != ${BUILD_ARCH}
134119252Simp.error To cross-build, set TARGET_ARCH.
13564382Skbyanc.endif
13664382Skbyanc.endif
13764382Skbyanc.if ${MACHINE} == ${TARGET}
13864382SkbyancOBJTREE=	${MAKEOBJDIRPREFIX}
13964382Skbyanc.else
14064382SkbyancOBJTREE=	${MAKEOBJDIRPREFIX}/${TARGET}
141118478Sjohan.endif
142118478SjohanWORLDTMP=	${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
14339214Sgibbs# /usr/games added for fortune which depend on strfile
14464382SkbyancSTRICTTMPPATH=	${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
14539214SgibbsTMPPATH=	${STRICTTMPPATH}:${PATH}
14664382SkbyancOBJFORMAT_PATH?=	/usr/libexec
14764382Skbyanc
14864382SkbyancINSTALLTMP!=	/usr/bin/mktemp -d -u -t install
14964382Skbyanc
15039214Sgibbs#
15164382Skbyanc# Building a world goes through the following stages
15264382Skbyanc#
15339214Sgibbs# 1. bootstrap-tool stage [BMAKE]
15464382Skbyanc#	This stage is responsible for creating programs that
15564382Skbyanc#	are needed for backward compatibility reasons. They
15664382Skbyanc#	are not built as cross-tools.
15764382Skbyanc# 2. build-tool stage [TMAKE]
15864382Skbyanc#	This stage is responsible for creating the object
15964382Skbyanc#	tree and building any tools that are needed during
16039214Sgibbs#	the build process.
16139214Sgibbs# 3. cross-tool stage [XMAKE]
16264382Skbyanc#	This stage is responsible for creating any tools that
163118478Sjohan#	are needed for cross-builds. A cross-compiler is one
164118478Sjohan#	of them.
16539214Sgibbs# 4. world stage [WMAKE]
16664382Skbyanc#	This stage actually builds the world.
16739214Sgibbs# 5. install stage (optional) [IMAKE]
16864382Skbyanc#	This stage installs a previously built world.
16964382Skbyanc#
17064382Skbyanc
17164382Skbyanc# Common environment for world related stages
17264382SkbyancCROSSENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
17364382Skbyanc		MACHINE_ARCH=${TARGET_ARCH} \
17464382Skbyanc		MACHINE=${TARGET} \
17564382Skbyanc		OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
17664382Skbyanc		PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.6.1 \
17764382Skbyanc		GROFF_BIN_PATH=${WORLDTMP}/usr/bin \
17864382Skbyanc		GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
17964382Skbyanc		GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
18064382Skbyanc
18164382Skbyanc# bootstrap-tool stage
18264382SkbyancBMAKEENV=	MAKEOBJDIRPREFIX=${WORLDTMP} \
18364382Skbyanc		DESTDIR= \
18464382Skbyanc		INSTALL="sh ${.CURDIR}/tools/install.sh"
18564382SkbyancBMAKE=		${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \
18697636Swollman		-DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
18739214Sgibbs		-DNO_WERROR
18864382Skbyanc
18939214Sgibbs# build-tool stage
19064382SkbyancTMAKEENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
191118478Sjohan		DESTDIR= \
19264382Skbyanc		INSTALL="sh ${.CURDIR}/tools/install.sh"
19364382SkbyancTMAKE=		${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING
19439214Sgibbs
19564382Skbyanc# cross-tool stage
19664382SkbyancXMAKE=		TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
19764382Skbyanc
19864382Skbyanc# world stage
19964382SkbyancWMAKEENV=	${CROSSENV} \
20064382Skbyanc		DESTDIR=${WORLDTMP} \
20164382Skbyanc		INSTALL="sh ${.CURDIR}/tools/install.sh" \
20264382Skbyanc		PATH=${TMPPATH}
20364382SkbyancWMAKE=		${WMAKEENV} ${MAKE} -f Makefile.inc1
20464382Skbyanc
20564382Skbyanc# install stage
20664382SkbyancIMAKEENV=	${CROSSENV} \
20764382Skbyanc		PATH=${STRICTTMPPATH}:${INSTALLTMP}
20864382SkbyancIMAKE=		${IMAKEENV} ${MAKE} -f Makefile.inc1
20964382Skbyanc
21064382Skbyanc# kernel stage
21197636SwollmanKMAKEENV=	${WMAKEENV} \
21264382Skbyanc		OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:${OBJFORMAT_PATH}
21364382Skbyanc
21464382SkbyancUSRDIRS=	usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
21539214Sgibbs		usr/libexec/${OBJFORMAT} usr/sbin usr/share/misc \
21639214Sgibbs		usr/share/dict \
21764382Skbyanc		usr/share/groff_font/devX100 \
21864382Skbyanc		usr/share/groff_font/devX100-12 \
21939214Sgibbs		usr/share/groff_font/devX75 \
22064382Skbyanc		usr/share/groff_font/devX75-12 \
22139214Sgibbs		usr/share/groff_font/devascii \
22264382Skbyanc		usr/share/groff_font/devcp1047 \
22339214Sgibbs		usr/share/groff_font/devdvi \
22464382Skbyanc		usr/share/groff_font/devhtml \
22564382Skbyanc		usr/share/groff_font/devkoi8-r \
22664382Skbyanc		usr/share/groff_font/devlatin1 \
22764382Skbyanc		usr/share/groff_font/devlbp \
22839214Sgibbs		usr/share/groff_font/devlj4 \
22964382Skbyanc		usr/share/groff_font/devps \
23064382Skbyanc		usr/share/groff_font/devutf8 \
23164382Skbyanc		usr/share/tmac/mdoc usr/share/tmac/mm
23239214Sgibbs
23364382SkbyancINCDIRS=	arpa dev fs g++/std isc isofs objc protocols \
23464382Skbyanc		readline rpc rpcsvc openssl security ufs
23564382Skbyanc
23664382Skbyanc#
23764382Skbyanc# buildworld
23864382Skbyanc#
23964382Skbyanc# Attempt to rebuild the entire system, with reasonable chance of
24064382Skbyanc# success, regardless of how old your existing system is.
24139214Sgibbs#
24264382Skbyancbuildworld:
24364382Skbyanc	@echo
24464382Skbyanc	@echo "--------------------------------------------------------------"
24564382Skbyanc	@echo ">>> Rebuilding the temporary build tree"
24664382Skbyanc	@echo "--------------------------------------------------------------"
24764382Skbyanc.if !defined(NOCLEAN)
24864382Skbyanc	rm -rf ${WORLDTMP}
249118478Sjohan.else
25064382Skbyanc	# XXX - These two can depend on any header file.
25164382Skbyanc	rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
25264382Skbyanc	rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
25364382Skbyanc.endif
25464382Skbyanc.for _dir in ${USRDIRS}
25564382Skbyanc	mkdir -p ${WORLDTMP}/${_dir}
25664382Skbyanc.endfor
25764382Skbyanc.for _dir in ${INCDIRS}
25864382Skbyanc	mkdir -p ${WORLDTMP}/usr/include/${_dir}
25964382Skbyanc.endfor
26064382Skbyanc	ln -sf ${.CURDIR}/sys ${WORLDTMP}
26164382Skbyanc	@echo
26264382Skbyanc	@echo "--------------------------------------------------------------"
26364382Skbyanc	@echo ">>> stage 1: bootstrap tools"
26464382Skbyanc	@echo "--------------------------------------------------------------"
26564382Skbyanc	cd ${.CURDIR}; ${BMAKE} bootstrap-tools
26664382Skbyanc.if !defined(NOCLEAN)
26764382Skbyanc	@echo
26864382Skbyanc	@echo "--------------------------------------------------------------"
26964382Skbyanc	@echo ">>> stage 2: cleaning up the object tree"
27064382Skbyanc	@echo "--------------------------------------------------------------"
27164382Skbyanc	cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
27264382Skbyanc.endif
27364382Skbyanc	@echo
27439214Sgibbs	@echo "--------------------------------------------------------------"
27564382Skbyanc	@echo ">>> stage 2: rebuilding the object tree"
27664382Skbyanc	@echo "--------------------------------------------------------------"
27764382Skbyanc	cd ${.CURDIR}; ${WMAKE} par-obj
27864382Skbyanc	@echo
27939214Sgibbs	@echo "--------------------------------------------------------------"
28064382Skbyanc	@echo ">>> stage 2: build tools"
28164382Skbyanc	@echo "--------------------------------------------------------------"
28264382Skbyanc	cd ${.CURDIR}; ${TMAKE} build-tools
28364382Skbyanc	@echo
28464382Skbyanc	@echo "--------------------------------------------------------------"
28564382Skbyanc	@echo ">>> stage 3: cross tools"
28664382Skbyanc	@echo "--------------------------------------------------------------"
28764382Skbyanc	cd ${.CURDIR}; ${XMAKE} cross-tools
288118478Sjohan	@echo
28964382Skbyanc	@echo "--------------------------------------------------------------"
290118478Sjohan	@echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
291118478Sjohan	@echo "--------------------------------------------------------------"
292118478Sjohan	cd ${.CURDIR}; ${WMAKE} SHARED=symlinks includes
293118478Sjohan	@echo
294118478Sjohan	@echo "--------------------------------------------------------------"
29564382Skbyanc	@echo ">>> stage 4: building libraries"
29664382Skbyanc	@echo "--------------------------------------------------------------"
29764382Skbyanc	cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
29864382Skbyanc	@echo
29964382Skbyanc	@echo "--------------------------------------------------------------"
30064382Skbyanc	@echo ">>> stage 4: make dependencies"
30164382Skbyanc	@echo "--------------------------------------------------------------"
30264382Skbyanc	cd ${.CURDIR}; ${WMAKE} par-depend
30364382Skbyanc	@echo
30464382Skbyanc	@echo "--------------------------------------------------------------"
30564382Skbyanc	@echo ">>> stage 4: building everything.."
30664382Skbyanc	@echo "--------------------------------------------------------------"
30764382Skbyanc	cd ${.CURDIR}; ${WMAKE} all
30864382Skbyanc
30964382Skbyanceverything:
31039214Sgibbs	@echo "--------------------------------------------------------------"
31139214Sgibbs	@echo ">>> Building everything.."
31264382Skbyanc	@echo "--------------------------------------------------------------"
31397636Swollman	cd ${.CURDIR}; ${WMAKE} all
31439214Sgibbs
31564382Skbyanc#
31664382Skbyanc# installworld
31764382Skbyanc#
31839214Sgibbs# Installs everything compiled by a 'buildworld'.
31939214Sgibbs#
32039214Sgibbsinstallworld:
32164382Skbyanc	mkdir -p ${INSTALLTMP}
32264382Skbyanc	for prog in [ awk cat chflags chmod chown date echo egrep find grep \
32339214Sgibbs	    ln make makewhatis mkdir mtree mv perl rm sed sh sysctl \
32464382Skbyanc	    test true uname wc zic; do \
32564382Skbyanc		cp `which $$prog` ${INSTALLTMP}; \
32639214Sgibbs	done
32764382Skbyanc	cd ${.CURDIR}; ${IMAKE} reinstall
32864382Skbyanc	rm -rf ${INSTALLTMP}
32964382Skbyanc
33064382Skbyanc#
33139214Sgibbs# reinstall
33264382Skbyanc#
33364382Skbyanc# If you have a build server, you can NFS mount the source and obj directories
33464382Skbyanc# and do a 'make reinstall' on the *client* to install new binaries from the
33564382Skbyanc# most recent server build.
33664382Skbyanc#
33764382Skbyancreinstall:
33864382Skbyanc	@echo "--------------------------------------------------------------"
33964382Skbyanc	@echo ">>> Making hierarchy"
34064382Skbyanc	@echo "--------------------------------------------------------------"
34164382Skbyanc	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
34264382Skbyanc	@echo
34364382Skbyanc	@echo "--------------------------------------------------------------"
34464382Skbyanc	@echo ">>> Installing everything.."
34564382Skbyanc	@echo "--------------------------------------------------------------"
34639214Sgibbs	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
34739214Sgibbs.if !defined(NOMAN)
34864382Skbyanc	@echo
34964382Skbyanc	@echo "--------------------------------------------------------------"
35039214Sgibbs	@echo ">>> Rebuilding man page indices"
35139214Sgibbs	@echo "--------------------------------------------------------------"
35264382Skbyanc	cd ${.CURDIR}/share/man; ${MAKE} makedb
353118478Sjohan.endif
35439214Sgibbs
35564382Skbyanc#
35664382Skbyanc# distribworld
35764382Skbyanc#
35864382Skbyanc# Front-end to distribute to make sure the search path contains
35964382Skbyanc# the object directory. Needed for miniperl.
36064382Skbyanc#
36164382Skbyancdistribworld:
36264382Skbyanc	cd ${.CURDIR}; PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 distribute
363124830Sgrehan
36464382Skbyanc#
36539214Sgibbs# buildkernel and installkernel
36664382Skbyanc#
36764382Skbyanc# Which kernels to build and/or install is specified by setting
36864382Skbyanc# KERNCONF. If not defined a GENERIC kernel is built/installed.
36964382Skbyanc# Only the existing (depending TARGET) config files are used
37064382Skbyanc# for building kernels and only the first of these is designated
37164382Skbyanc# as the one being installed.
37239214Sgibbs#
37364382Skbyanc# Note that we have to use TARGET instead of TARGET_ARCH when
37464382Skbyanc# we're in kernel-land. Since only TARGET_ARCH is (expected) to
37564382Skbyanc# be set to cross-build, we have to make sure TARGET is set
37664382Skbyanc# properly.
37739214Sgibbs
37864382Skbyanc.if !defined(KERNCONF) && defined(KERNEL)
37964382SkbyancKERNCONF=	${KERNEL}
38064382SkbyancKERNWARN=	yes
38164382Skbyanc.else
38239214SgibbsKERNCONF?=	GENERIC
38364382Skbyanc.endif
38464382SkbyancINSTKERNNAME?=	kernel
38564382Skbyanc
38664382SkbyancKRNLSRCDIR=	${.CURDIR}/sys
38739214SgibbsKRNLCONFDIR=	${KRNLSRCDIR}/${TARGET}/conf
38864382SkbyancKRNLOBJDIR=	${OBJTREE}${KRNLSRCDIR}
38939214SgibbsKERNCONFDIR?=	${KRNLCONFDIR}
39064382Skbyanc
39164382SkbyancBUILDKERNELS=
39239214SgibbsINSTALLKERNEL=
39364382Skbyanc.for _kernel in ${KERNCONF}
39439214Sgibbs.if exists(${KERNCONFDIR}/${_kernel})
395209051SuqsBUILDKERNELS+=	${_kernel}
39664382Skbyanc.if empty(INSTALLKERNEL)
39764382SkbyancINSTALLKERNEL= ${_kernel}
39864382Skbyanc.endif
39964382Skbyanc.endif
400124830Sgrehan.endfor
40139214Sgibbs
40264382Skbyanc#
40364382Skbyanc# buildkernel
40464382Skbyanc#
40564382Skbyanc# Builds all kernels defined by BUILDKERNELS.
406124830Sgrehan#
40764382Skbyancbuildkernel:
408124830Sgrehan.if empty(BUILDKERNELS)
409124830Sgrehan	@echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
41064382Skbyanc	@false
41164382Skbyanc.endif
41264382Skbyanc.if defined(KERNWARN)
413124830Sgrehan	@echo "--------------------------------------------------------------"
41464382Skbyanc	@echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
41564382Skbyanc	@echo "--------------------------------------------------------------"
41664382Skbyanc	@sleep 3
41764382Skbyanc.endif
41864382Skbyanc	@echo
41964382Skbyanc.for _kernel in ${BUILDKERNELS}
42064382Skbyanc	@echo "--------------------------------------------------------------"
42164382Skbyanc	@echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
42264382Skbyanc	@echo "--------------------------------------------------------------"
42364382Skbyanc	@echo "===> ${_kernel}"
42464382Skbyanc	mkdir -p ${KRNLOBJDIR}
42564382Skbyanc.if !defined(NO_KERNELCONFIG)
42664382Skbyanc	cd ${KRNLCONFDIR}; \
42739214Sgibbs		PATH=${TMPPATH} \
42864382Skbyanc		    config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
42939214Sgibbs			${KERNCONFDIR}/${_kernel}
43064382Skbyanc.endif
43164382Skbyanc.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
43264382Skbyanc	cd ${KRNLOBJDIR}/${_kernel}; \
43364382Skbyanc	    ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} -DNO_MODULES clean
43464382Skbyanc.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules)
43564382Skbyanc	cd ${KRNLOBJDIR}/${_kernel}; \
43664382Skbyanc	    ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} cleandir
43764382Skbyanc.endif
43864382Skbyanc.endif
43964382Skbyanc	cd ${KRNLOBJDIR}/${_kernel}; \
44064382Skbyanc		MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx/aicasm \
44164382Skbyanc		    ${MAKE} -f ${KRNLSRCDIR}/dev/aic7xxx/aicasm/Makefile
44264382Skbyanc.if !defined(NO_KERNELDEPEND)
44364382Skbyanc	cd ${KRNLOBJDIR}/${_kernel}; \
44464382Skbyanc	    ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend
44564382Skbyanc.endif
44664382Skbyanc	cd ${KRNLOBJDIR}/${_kernel}; \
44764382Skbyanc	    ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all
44864382Skbyanc	@echo "--------------------------------------------------------------"
44964382Skbyanc	@echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
45064382Skbyanc	@echo "--------------------------------------------------------------"
45164382Skbyanc.endfor
45264382Skbyanc
45364382Skbyanc#
45464382Skbyanc# installkernel
45564382Skbyanc#
45664382Skbyanc# Install the kernel defined by INSTALLKERNEL
45764382Skbyanc#
45864382Skbyancinstallkernel:
45964382Skbyanc	cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
46064382Skbyanc	    ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} install
46164382Skbyancreinstallkernel:
46264382Skbyanc	cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
46364382Skbyanc	    ${CROSSENV} ${MAKE} KERNEL=${INSTKERNNAME} reinstall
46464382Skbyanc
46564382Skbyanc#
46664382Skbyanc# kernel
46764382Skbyanc#
46864382Skbyanc# Short hand for `make buildkernel installkernel'
469112254Sru#
47064382Skbyanckernel: buildkernel installkernel
47164382Skbyanc
47239214Sgibbs#
47364382Skbyanc# update
47464382Skbyanc#
47564382Skbyanc# Update the source tree, by running sup and/or running cvs to update to the
47664382Skbyanc# latest copy.
47764382Skbyanc#
47864382Skbyancupdate:
47964382Skbyanc.if defined(SUP_UPDATE)
48064382Skbyanc	@echo "--------------------------------------------------------------"
48164382Skbyanc	@echo ">>> Running ${SUP}"
48264382Skbyanc	@echo "--------------------------------------------------------------"
48364382Skbyanc.if defined(SUPFILE)
48464382Skbyanc	@${SUP} ${SUPFLAGS} ${SUPFILE}
485112254Sru.endif
48664382Skbyanc.if defined(SUPFILE1)
48764382Skbyanc	@${SUP} ${SUPFLAGS} ${SUPFILE1}
48839214Sgibbs.endif
48964382Skbyanc.if defined(SUPFILE2)
49039214Sgibbs	@${SUP} ${SUPFLAGS} ${SUPFILE2}
49164382Skbyanc.endif
49264382Skbyanc.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
49364382Skbyanc	@${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
49464382Skbyanc.endif
49564382Skbyanc.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
49664382Skbyanc	@${SUP} ${SUPFLAGS} ${DOCSUPFILE}
49764382Skbyanc.endif
49864382Skbyanc.endif
49964382Skbyanc.if defined(CVS_UPDATE)
50064382Skbyanc	@echo "--------------------------------------------------------------"
50164382Skbyanc	@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
502112254Sru	@echo "--------------------------------------------------------------"
50364382Skbyanc	cd ${.CURDIR}; ${CVS} -q update -A -P -d
50464382Skbyanc.endif
50539214Sgibbs
50664382Skbyanc#
50764382Skbyanc# most
50864382Skbyanc#
50997636Swollman# Build most of the user binaries on the existing system libs and includes.
51039214Sgibbs#
51164382Skbyancmost:
51264382Skbyanc	@echo "--------------------------------------------------------------"
51339214Sgibbs	@echo ">>> Building programs only"
51439214Sgibbs	@echo "--------------------------------------------------------------"
51564382Skbyanc	cd ${.CURDIR}/bin;		${MAKE} all
51664382Skbyanc	cd ${.CURDIR}/sbin;		${MAKE} all
51739214Sgibbs	cd ${.CURDIR}/libexec;		${MAKE} all
51864382Skbyanc	cd ${.CURDIR}/usr.bin;		${MAKE} all
51964382Skbyanc	cd ${.CURDIR}/usr.sbin;		${MAKE} all
52039214Sgibbs	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} all
52164382Skbyanc	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} all
52264382Skbyanc
52339214Sgibbs#
52464382Skbyanc# installmost
52539214Sgibbs#
52639214Sgibbs# Install the binaries built by the 'most' target.  This does not include
52739214Sgibbs# libraries or include files.
52864382Skbyanc#
52964382Skbyancinstallmost:
53039214Sgibbs	@echo "--------------------------------------------------------------"
53164382Skbyanc	@echo ">>> Installing programs only"
53264382Skbyanc	@echo "--------------------------------------------------------------"
53364382Skbyanc	cd ${.CURDIR}/bin;		${MAKE} install
53464382Skbyanc	cd ${.CURDIR}/sbin;		${MAKE} install
53539214Sgibbs	cd ${.CURDIR}/libexec;		${MAKE} install
53664382Skbyanc	cd ${.CURDIR}/usr.bin;		${MAKE} install
53739214Sgibbs	cd ${.CURDIR}/usr.sbin;		${MAKE} install
53864382Skbyanc	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} install
53964382Skbyanc	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} install
54064382Skbyanc
54139214Sgibbs#
54264382Skbyanc# ------------------------------------------------------------------------
54364382Skbyanc#
54464382Skbyanc# From here onwards are utility targets used by the 'make world' and
54539214Sgibbs# related targets.  If your 'world' breaks, you may like to try to fix
54664382Skbyanc# the problem and manually run the following targets to attempt to
54764382Skbyanc# complete the build.  Beware, this is *not* guaranteed to work, you
54864382Skbyanc# need to have a pretty good grip on the current state of the system
54939214Sgibbs# to attempt to manually finish it.  If in doubt, 'make world' again.
55064382Skbyanc#
55164382Skbyanc
55264382Skbyanc#
55364382Skbyanc# bootstrap-tools: Build tools needed for compatibility
55464382Skbyanc#
55539214Sgibbs.if exists(${.CURDIR}/games) && !defined(NOGAMES)
55639214Sgibbs_strfile=	games/fortune/strfile
55739214Sgibbs.endif
55864382Skbyanc
55964382Skbyancbootstrap-tools:
56039214Sgibbs.for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef \
56164382Skbyanc    usr.bin/xargs usr.bin/xinstall \
56264382Skbyanc    usr.sbin/config usr.sbin/kbdcontrol \
56364382Skbyanc    gnu/usr.bin/gperf gnu/usr.bin/groff gnu/usr.bin/texinfo
56464382Skbyanc	cd ${.CURDIR}/${_tool}; \
56551737Sken		${MAKE} obj; \
56664382Skbyanc		${MAKE} depend; \
56764382Skbyanc		${MAKE} all; \
56864382Skbyanc		${MAKE} DESTDIR=${MAKEOBJDIRPREFIX} install
56939214Sgibbs.endfor
57064382Skbyanc
57164393Skbyanc#
57264382Skbyanc# build-tools: Build special purpose build tools
57364382Skbyanc#
57464382Skbyanc.if exists(${.CURDIR}/games) && !defined(NOGAMES)
57564382Skbyanc_games=	games/adventure games/hack games/phantasia
57664393Skbyanc.endif
57764393Skbyanc
57839214Sgibbs.if exists(${.CURDIR}/share) && !defined(NOSHARE)
57964382Skbyanc_share=	share/syscons/scrnmaps
58064382Skbyanc.endif
58164393Skbyanc
58264393Skbyanc.if !defined(NO_FORTRAN)
58339214Sgibbs_fortran= gnu/usr.bin/cc/f771
58464393Skbyanc.endif
58564435Sjhb
58664382Skbyanc.if !defined(NOPERL) && !defined(NO_PERL)
58739214Sgibbs_perl=	gnu/usr.bin/perl/miniperl
58864393Skbyanc.endif
58964393Skbyanc
59064393Skbyanc.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
59139214Sgibbs    !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
59264382Skbyanc_libroken4= kerberosIV/lib/libroken
59364382Skbyanc.endif
59464382Skbyanc
59564393Skbyanc.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
59664393Skbyanc    !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
59739214Sgibbs_libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
59864382Skbyanc    kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
59964382Skbyanc.endif
60064382Skbyanc
60164382Skbyancbuild-tools:
60264382Skbyanc.for _tool in bin/csh bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \
60364382Skbyanc    ${_perl} ${_libroken4} ${_libkrb5} lib/libncurses ${_share} \
60464382Skbyanc    usr.bin/awk usr.bin/file usr.sbin/sysinstall
60564382Skbyanc	cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
60664474Skbyanc.endfor
60764474Skbyanc
60864474Skbyanc#
60964474Skbyanc# cross-tools: Build cross-building tools
61039214Sgibbs#
61139214Sgibbs.if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
61264382Skbyanc_elf2exe=	usr.sbin/elf2exe
61364382Skbyanc.endif
61439214Sgibbs
61564382Skbyanc.if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
61664382Skbyanc_btxld=	usr.sbin/btxld
61739214Sgibbs.endif
61864382Skbyanc
61964382Skbyanc_xlint=	usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint
62064382Skbyanc
62164382Skbyanccross-tools:
62264382Skbyanc.for _tool in ${_btxld} ${_elf2exe} \
62364382Skbyanc    gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc ${_xlint}
62464382Skbyanc	cd ${.CURDIR}/${_tool}; \
62564382Skbyanc		${MAKE} obj; \
62664382Skbyanc		${MAKE} depend; \
62764382Skbyanc		${MAKE} all; \
62864382Skbyanc		${MAKE} DESTDIR=${MAKEOBJDIRPREFIX} install
62939214Sgibbs.endfor
63064382Skbyanc
63139214Sgibbs#
63239214Sgibbs# hierarchy - ensure that all the needed directories are present
63339214Sgibbs#
63464382Skbyanchierarchy:
63539214Sgibbs	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
63664382Skbyanc
63764382Skbyanc#
63864382Skbyanc# includes - possibly generate and install the include files.
63964382Skbyanc#
640111195Sjohanincludes:
64139214Sgibbs	cd ${.CURDIR}/include;			${MAKE} -B all install
64264382Skbyanc	cd ${.CURDIR}/gnu/include;		${MAKE} install
64364382Skbyanc	cd ${.CURDIR}/gnu/lib/libobjc;		${MAKE} beforeinstall
64464382Skbyanc	cd ${.CURDIR}/gnu/lib/libreadline/readline;	${MAKE} beforeinstall
64564382Skbyanc	cd ${.CURDIR}/gnu/lib/libregex;		${MAKE} beforeinstall
64664382Skbyanc	cd ${.CURDIR}/gnu/lib/libstdc++;	${MAKE} beforeinstall
64739214Sgibbs	cd ${.CURDIR}/gnu/lib/libdialog;	${MAKE} beforeinstall
64864382Skbyanc	cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus;	${MAKE} beforeinstall
64964382Skbyanc.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
65064382Skbyanc.if exists(${.CURDIR}/secure/lib/libcrypto)
65164382Skbyanc	cd ${.CURDIR}/secure/lib/libcrypto;	${MAKE} beforeinstall
65239214Sgibbs.endif
65364382Skbyanc.if exists(${.CURDIR}/secure/lib/libssl)
65464382Skbyanc	cd ${.CURDIR}/secure/lib/libssl;	${MAKE} beforeinstall
65564382Skbyanc.endif
65664382Skbyanc.endif
65764382Skbyanc.if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
65839214Sgibbs    defined(MAKE_KERBEROS4)
65964382Skbyanc	cd ${.CURDIR}/kerberosIV/lib/libacl;	${MAKE} beforeinstall
66064382Skbyanc	cd ${.CURDIR}/kerberosIV/lib/libkadm;	${MAKE} beforeinstall
66164382Skbyanc	cd ${.CURDIR}/kerberosIV/lib/libkafs;	${MAKE} beforeinstall
66264382Skbyanc	cd ${.CURDIR}/kerberosIV/lib/libkdb;	${MAKE} beforeinstall
66364382Skbyanc	cd ${.CURDIR}/kerberosIV/lib/libkrb;	${MAKE} beforeinstall
66464382Skbyanc	cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
66564382Skbyanc.elif exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
66664382Skbyanc	cd ${.CURDIR}/secure/lib/libtelnet;	${MAKE} beforeinstall
66764382Skbyanc.else
66864382Skbyanc	cd ${.CURDIR}/lib/libtelnet;		${MAKE} beforeinstall
66964382Skbyanc.endif
67064382Skbyanc.if exists(${.CURDIR}/kerberos5) && !defined(NOCRYPT) && \
67164382Skbyanc    defined(MAKE_KERBEROS5)
67264382Skbyanc	cd ${.CURDIR}/kerberos5/lib/libasn1;		${MAKE} beforeinstall
67364382Skbyanc	cd ${.CURDIR}/kerberos5/lib/libhdb;		${MAKE} beforeinstall
67464382Skbyanc	cd ${.CURDIR}/kerberos5/lib/libkadm5clnt;	${MAKE} beforeinstall
67564382Skbyanc	cd ${.CURDIR}/kerberos5/lib/libkadm5srv;	${MAKE} beforeinstall
67664382Skbyanc	cd ${.CURDIR}/kerberos5/lib/libkafs5;		${MAKE} beforeinstall
67764382Skbyanc	cd ${.CURDIR}/kerberos5/lib/libkrb5;		${MAKE} beforeinstall
67864382Skbyanc	cd ${.CURDIR}/kerberos5/lib/libsl;		${MAKE} beforeinstall
67964382Skbyanc.endif
68064382Skbyanc.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
68164382Skbyanc	cd ${.CURDIR}/lib/csu/${MACHINE_ARCH};	${MAKE} beforeinstall
68264382Skbyanc.endif
68364382Skbyanc	cd ${.CURDIR}/gnu/lib/csu;		${MAKE} beforeinstall
68464382Skbyanc	cd ${.CURDIR}/lib/libalias;		${MAKE} beforeinstall
68564382Skbyanc	cd ${.CURDIR}/lib/libatm;		${MAKE} beforeinstall
68664382Skbyanc	cd ${.CURDIR}/lib/libdevstat;		${MAKE} beforeinstall
68764382Skbyanc	cd ${.CURDIR}/lib/libc;			${MAKE} beforeinstall
68864382Skbyanc	cd ${.CURDIR}/lib/libcalendar;		${MAKE} beforeinstall
68964382Skbyanc	cd ${.CURDIR}/lib/libcam;		${MAKE} beforeinstall
69064382Skbyanc	cd ${.CURDIR}/lib/libdisk;		${MAKE} beforeinstall
69164382Skbyanc	cd ${.CURDIR}/lib/libedit;		${MAKE} beforeinstall
69264382Skbyanc	cd ${.CURDIR}/lib/libfetch;		${MAKE} beforeinstall
69364382Skbyanc	cd ${.CURDIR}/lib/libftpio;		${MAKE} beforeinstall
69464382Skbyanc	cd ${.CURDIR}/lib/libkvm;		${MAKE} beforeinstall
69564382Skbyanc	cd ${.CURDIR}/lib/libmd;		${MAKE} beforeinstall
69664382Skbyanc	cd ${.CURDIR}/lib/libmp;		${MAKE} beforeinstall
69764382Skbyanc	cd ${.CURDIR}/lib/msun;			${MAKE} beforeinstall
69864382Skbyanc	cd ${.CURDIR}/lib/libncp;		${MAKE} beforeinstall
69964382Skbyanc	cd ${.CURDIR}/lib/libncurses;		${MAKE} beforeinstall
70064382Skbyanc	cd ${.CURDIR}/lib/libnetgraph;		${MAKE} beforeinstall
70164382Skbyanc	cd ${.CURDIR}/lib/libopie;		${MAKE} beforeinstall
70264382Skbyanc	cd ${.CURDIR}/lib/libpcap;		${MAKE} beforeinstall
70364382Skbyanc	cd ${.CURDIR}/lib/libradius;		${MAKE} beforeinstall
70464382Skbyanc	cd ${.CURDIR}/lib/librpcsvc;		${MAKE} beforeinstall
70564382Skbyanc	cd ${.CURDIR}/lib/libpam/libpam;	${MAKE} beforeinstall
70664382Skbyanc	cd ${.CURDIR}/lib/libsbuf;		${MAKE} beforeinstall
70764382Skbyanc	cd ${.CURDIR}/lib/libstand;		${MAKE} beforeinstall
70864382Skbyanc	cd ${.CURDIR}/lib/libtacplus;		${MAKE} beforeinstall
70939214Sgibbs	cd ${.CURDIR}/lib/libcom_err;		${MAKE} beforeinstall
71064382Skbyanc	cd ${.CURDIR}/lib/libusbhid;		${MAKE} beforeinstall
71139214Sgibbs	cd ${.CURDIR}/lib/libutil;		${MAKE} beforeinstall
71264382Skbyanc	cd ${.CURDIR}/lib/libvgl;		${MAKE} beforeinstall
71339214Sgibbs	cd ${.CURDIR}/lib/libwrap;		${MAKE} beforeinstall
71439214Sgibbs	cd ${.CURDIR}/lib/libypclnt;		${MAKE} beforeinstall
71539214Sgibbs	cd ${.CURDIR}/lib/libz;			${MAKE} beforeinstall
71664382Skbyanc	cd ${.CURDIR}/usr.bin/lex;		${MAKE} beforeinstall
71739214Sgibbs
718118478Sjohan#
71964382Skbyanc# libraries - build all libraries, and install them under ${DESTDIR}.
72064382Skbyanc#
72164382Skbyanc# The list of libraries with dependents (${_prebuild_libs}) and their
72239214Sgibbs# interdependencies (__L) are built automatically by the
72364382Skbyanc# ${.CURDIR}/tools/make_libdeps.sh script.
72464382Skbyanc#
72564382Skbyanclibraries:
72664382Skbyanc	cd ${.CURDIR}; \
72764382Skbyanc	    ${MAKE} -f Makefile.inc1 _startup_libs; \
72839214Sgibbs	    ${MAKE} -f Makefile.inc1 _prebuild_libs; \
72964382Skbyanc	    ${MAKE} -f Makefile.inc1 _generic_libs;
73064382Skbyanc
73164382Skbyanc.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-${OBJFORMAT})
73239214Sgibbs_startup_libs=	lib/csu/${MACHINE_ARCH}-${OBJFORMAT}
73364382Skbyanc.else
73464382Skbyanc_startup_libs=	lib/csu/${MACHINE_ARCH}
73564382Skbyanc.endif
73639214Sgibbs_startup_libs+=	gnu/lib/csu gnu/lib/libgcc
73764382Skbyanc
73839214Sgibbs_prebuild_libs=	lib/libcom_err lib/libcrypt lib/libkvm lib/libmd \
73964382Skbyanc		lib/libncurses lib/libopie lib/libradius lib/librpcsvc \
74064382Skbyanc		lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
74139214Sgibbs		lib/libz lib/msun
74264382Skbyanc
74339214Sgibbslib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
74464382Skbyanclib/libypclnt__L: lib/librpcsvc__L
74564382Skbyanc
74664382Skbyanc_generic_libs=	lib gnu/lib
74764382Skbyanc
74864382Skbyanc.if !defined(NOPERL) && !defined(NO_PERL)
74964382Skbyanc_generic_libs+=	gnu/usr.bin/perl/libperl
75064382Skbyanc.endif
75139214Sgibbs
75239214Sgibbs.if !defined(NOCRYPT)
75364382Skbyanc.if defined(MAKE_KERBEROS4)
75464382Skbyanc_prebuild_libs+=	kerberosIV/lib/libkrb
75564382SkbyanckerberosIV/lib/libkrb__L: lib/libcrypt__L
75664382Skbyanc_generic_libs+=	kerberosIV/lib
75764382Skbyanc.endif
75864382Skbyanc.if defined(MAKE_KERBEROS5)
75964382Skbyanc_prebuild_libs+=	kerberos5/lib/libasn1
76064382Skbyanc_prebuild_libs+=	kerberos5/lib/libgssapi
76164382Skbyanc_prebuild_libs+=	kerberos5/lib/libkrb5
76239214Sgibbs_prebuild_libs+=	kerberos5/lib/libroken
76364382Skbyanc_generic_libs+=	kerberos5/lib
76464382Skbyanc.endif
76564382Skbyanc.if !defined(NOSECURE)
76664382Skbyanc_prebuild_libs+=	secure/lib/libcrypto
76739214Sgibbs.if !defined(NO_OPENSSH)
76864382Skbyanc_prebuild_libs+=	secure/lib/libssh
76964382Skbyancsecure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
77039214Sgibbs.endif
77164382Skbyanc_generic_libs+=	secure/lib
77264382Skbyanc.endif !defined(NOSECURE)
77339214Sgibbs.endif !defined(NOCRYPT)
77464382Skbyanc
77564382Skbyanc_generic_libs+=	usr.bin/lex/lib
77639214Sgibbs.if ${MACHINE_ARCH} == "i386"
77764382Skbyanc_generic_libs+=	usr.sbin/pcvt/keycap
77864382Skbyanc.endif
77964382Skbyanc
78064382Skbyanc.for _lib in ${_startup_libs} ${_prebuild_libs} ${_generic_libs}
78164382Skbyanc${_lib}__L: .PHONY
78264382Skbyanc.if exists(${.CURDIR}/${_lib})
78364382Skbyanc	cd ${.CURDIR}/${_lib}; \
78464382Skbyanc		${MAKE} depend; \
785118478Sjohan		${MAKE} all; \
78639214Sgibbs		${MAKE} install
78764382Skbyanc.endif
78864382Skbyanc.endfor
78939214Sgibbs
79064382Skbyanc_startup_libs: ${_startup_libs:S/$/__L/}
79164382Skbyanc_prebuild_libs: ${_prebuild_libs:S/$/__L/}
79264382Skbyanc_generic_libs: ${_generic_libs:S/$/__L/}
79339214Sgibbs
79464382Skbyanc.for __target in clean cleandepend cleandir depend obj
795118478Sjohan.for entry in ${SUBDIR}
796118478Sjohan${entry}.${__target}__D: .PHONY
797118478Sjohan	@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
79864382Skbyanc		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
79964382Skbyanc		edir=${entry}.${MACHINE_ARCH}; \
80064382Skbyanc		cd ${.CURDIR}/$${edir}; \
80139214Sgibbs	else \
80264382Skbyanc		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
80364382Skbyanc		edir=${entry}; \
80464382Skbyanc		cd ${.CURDIR}/$${edir}; \
80564382Skbyanc	fi; \
80664382Skbyanc	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
80764382Skbyanc.endfor
80864382Skbyancpar-${__target}: ${SUBDIR:S/$/.${__target}__D/}
80964382Skbyanc.endfor
81064382Skbyanc
81139214Sgibbs.include <bsd.subdir.mk>
81264382Skbyanc