Makefile revision 28358
11573Srgrimes#
21573Srgrimes#	$Id: Makefile,v 1.136 1997/08/18 06:44:44 peter Exp $
31573Srgrimes#
41573Srgrimes# Make command line options:
51573Srgrimes#	-DCLOBBER will remove /usr/include
61573Srgrimes#	-DMAKE_EBONES to build eBones (KerberosIV)
71573Srgrimes#	-DALLLANG to build documentation for all languages
81573Srgrimes#	  (where available -- see share/doc/Makefile)
91573Srgrimes#
101573Srgrimes#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
111573Srgrimes#	-DNOCLEAN do not clean at all
121573Srgrimes#	-DNOCRYPT will prevent building of crypt versions
131573Srgrimes#	-DNOLKM do not build loadable kernel modules
141573Srgrimes#	-DNOOBJDIR do not run ``${MAKE} obj''
151573Srgrimes#	-DNOPROFILE do not build profiled libraries
161573Srgrimes#	-DNOSECURE do not go into secure subdir
171573Srgrimes#	-DNOGAMES do not go into games subdir
181573Srgrimes#	-DNOSHARE do not go into share subdir
191573Srgrimes#	-DNOINFO do not make or install info files
201573Srgrimes#	-DNOLIBC_R do not build libc_r.
211573Srgrimes#	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
221573Srgrimes
231573Srgrimes#
241573Srgrimes# The intended user-driven targets are:
251573Srgrimes# buildworld  - rebuild *everything*, including glue to help do upgrades
261573Srgrimes# installworld- install everything built by "buildworld"
271573Srgrimes# world       - buildworld + installworld
281573Srgrimes# update      - convenient way to update your source tree (eg: sup/cvs)
291573Srgrimes# most        - build user commands, no libraries or include files
301573Srgrimes# installmost - install user commands, no libraries or include files
311573Srgrimes#
321573Srgrimes# Standard targets (not defined here) are documented in the makefiles in
331573Srgrimes# /usr/share/mk.  These include:
341573Srgrimes#		obj depend all install clean cleandepend cleanobj
351573Srgrimes
361573Srgrimes.if (!make(world)) && (!make(buildworld)) && (!make(installworld))
371573Srgrimes.MAKEFLAGS:=	${.MAKEFLAGS} -m ${.CURDIR}/share/mk
381573Srgrimes.endif
391573Srgrimes
401573Srgrimes# Put initial settings here.
411573SrgrimesSUBDIR=
421573Srgrimes
431573Srgrimes# We must do include and lib first so that the perl *.ph generation
441573Srgrimes# works correctly as it uses the header files installed by this.
451573Srgrimes.if exists(include)
461573SrgrimesSUBDIR+= include
471573Srgrimes.endif
481573Srgrimes.if exists(lib)
491573SrgrimesSUBDIR+= lib
501573Srgrimes.endif
511573Srgrimes
521573Srgrimes.if exists(bin)
531573SrgrimesSUBDIR+= bin
541573Srgrimes.endif
551573Srgrimes.if exists(games) && !defined(NOGAMES)
568870SrgrimesSUBDIR+= games
578870Srgrimes.endif
581573Srgrimes.if exists(gnu)
591573SrgrimesSUBDIR+= gnu
601573Srgrimes.endif
611573Srgrimes.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
621573SrgrimesSUBDIR+= eBones
631573Srgrimes.endif
641573Srgrimes.if exists(libexec)
651573SrgrimesSUBDIR+= libexec
661573Srgrimes.endif
671573Srgrimes.if exists(sbin)
681573SrgrimesSUBDIR+= sbin
691573Srgrimes.endif
701573Srgrimes.if exists(share) && !defined(NOSHARE)
711573SrgrimesSUBDIR+= share
721573Srgrimes.endif
731573Srgrimes.if exists(sys)
749272ShsuSUBDIR+= sys
751573Srgrimes.endif
761573Srgrimes.if exists(usr.bin)
771573SrgrimesSUBDIR+= usr.bin
781573Srgrimes.endif
791573Srgrimes.if exists(usr.sbin)
801573SrgrimesSUBDIR+= usr.sbin
811573Srgrimes.endif
829272Shsu.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
831573SrgrimesSUBDIR+= secure
841573Srgrimes.endif
851573Srgrimes.if exists(lkm) && !defined(NOLKM)
861573SrgrimesSUBDIR+= lkm
871573Srgrimes.endif
881573Srgrimes
891573Srgrimes# etc must be last for "distribute" to work
901573Srgrimes.if exists(etc) && make(distribute)
911573SrgrimesSUBDIR+= etc
921573Srgrimes.endif
931573Srgrimes
941573Srgrimes# These are last, since it is nice to at least get the base system
951573Srgrimes# rebuilt before you do them.
961573Srgrimes.if defined(LOCAL_DIRS)
971573Srgrimes.for _DIR in ${LOCAL_DIRS}
981573Srgrimes.if exists(${_DIR}) & exists(${_DIR}/Makefile)
991573SrgrimesSUBDIR+= ${_DIR}
1001573Srgrimes.endif
1011573Srgrimes.endfor
1021573Srgrimes.endif
1031573Srgrimes
1041573Srgrimes# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
1051573Srgrimes.if defined(NOOBJDIR)
1061573SrgrimesOBJDIR=
1071573Srgrimes.else
1081573SrgrimesOBJDIR=		obj
1091573Srgrimes.endif
1101573Srgrimes
1111573Srgrimes.if defined(NOCLEAN)
1121573SrgrimesCLEANDIR=
1131573Srgrimes.else
1141573Srgrimes.if defined(NOCLEANDIR)
1151573SrgrimesCLEANDIR=	clean
1161573Srgrimes.else
1171573SrgrimesCLEANDIR=	cleandir
1181573Srgrimes.endif
1191573Srgrimes.endif
1201573Srgrimes
1211573SrgrimesSUP?=		sup
1221573SrgrimesSUPFLAGS?=	-v
1231573Srgrimes
1241573Srgrimes#
1251573Srgrimes# While building tools for bootstrapping, we dont need to waste time on
1261573Srgrimes# profiled libraries or man pages.  This speeds things up somewhat.
1271573Srgrimes#
1281573SrgrimesMK_FLAGS=	-DNOINFO -DNOMAN -DNOPROFILE
1291573Srgrimes
1301573Srgrimes#
1311573Srgrimes# world
1321573Srgrimes#
1331573Srgrimes# Attempt to rebuild and reinstall *everything*, with reasonable chance of
1341573Srgrimes# success, regardless of how old your existing system is.
1351573Srgrimes#
1361573Srgrimes# >> Beware, it overwrites the local build environment! <<
1371573Srgrimes#
1381573Srgrimesworld:
1391573Srgrimes	@echo "--------------------------------------------------------------"
1401573Srgrimes	@echo "make world started on `LC_TIME=C date`"
1411573Srgrimes	@echo "--------------------------------------------------------------"
1421573Srgrimes.if target(pre-world)
1431573Srgrimes	@echo
1441573Srgrimes	@echo "--------------------------------------------------------------"
1451573Srgrimes	@echo " Making 'pre-world' target"
1461573Srgrimes	@echo "--------------------------------------------------------------"
1471573Srgrimes	cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} pre-world
1481573Srgrimes.endif
1491573Srgrimes	cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} buildworld
1501573Srgrimes	cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} installworld
1511573Srgrimes.if target(post-world)
1521573Srgrimes	@echo
1531573Srgrimes	@echo "--------------------------------------------------------------"
1541573Srgrimes	@echo " Making 'post-world' target"
1551573Srgrimes	@echo "--------------------------------------------------------------"
1561573Srgrimes	cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} post-world
1571573Srgrimes.endif
1588870Srgrimes	@echo
1591573Srgrimes	@echo "--------------------------------------------------------------"
1601573Srgrimes	@echo "make world completed on `LC_TIME=C date`"
161	@echo "--------------------------------------------------------------"
162
163.if defined(MAKEOBJDIRPREFIX)
164WORLDTMP=	${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
165.else
166WORLDTMP=	/usr/obj${.CURDIR}/tmp
167.endif
168STRICTTMPPATH=	${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin
169TMPPATH=	${STRICTTMPPATH}:${PATH}
170
171# XXX COMPILER_PATH is needed for finding cc1, ld and as
172# XXX GCC_EXEC_PREFIX is for *crt.o.  It is probably unnecssary now
173#	tbat LIBRARY_PATH is set.  We still can't use -nostdlib, since gcc
174#	wouldn't link *crt.o or libgcc if it were used.
175# XXX LD_LIBRARY_PATH is for ld.so.  It is also used by ld, although we don't
176#	want that - all compile-time library paths should be resolved by gcc.
177#	It fails for set[ug]id executables (are any used?).
178COMPILER_ENV=	BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \
179		COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
180		GCC_EXEC_PREFIX=${WORLDTMP}/usr/lib/ \
181		LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \
182		LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
183
184BMAKEENV=	PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t
185XMAKEENV=	PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
186		CC='cc -nostdinc'	# XXX -nostdlib
187
188# used to compile and install 'make' in temporary build tree
189IBMAKE=	${BMAKEENV} ${MAKE} DESTDIR=${WORLDTMP}
190# bootstrap make
191BMAKE=	${BMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
192# cross make used for compilation
193XMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
194# cross make used for final installation
195IXMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE}
196
197#
198# buildworld
199#
200# Attempt to rebuild the entire system, with reasonable chance of
201# success, regardless of how old your existing system is.
202#
203buildworld:
204.if !defined(NOCLEAN)
205	@echo
206	@echo "--------------------------------------------------------------"
207	@echo " Cleaning up the temporary build tree"
208	@echo "--------------------------------------------------------------"
209	mkdir -p ${WORLDTMP}
210	chflags -R noschg ${WORLDTMP}/
211	rm -rf ${WORLDTMP}
212.endif
213	@echo
214	@echo "--------------------------------------------------------------"
215	@echo " Making make"
216	@echo "--------------------------------------------------------------"
217	mkdir -p ${WORLDTMP}/usr/bin
218	cd ${.CURDIR}/usr.bin/make && \
219		${IBMAKE} -I${.CURDIR}/share/mk ${OBJDIR} clean cleandepend depend && \
220		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all install clean cleandepend
221	@echo
222	@echo "--------------------------------------------------------------"
223	@echo " Making hierarchy"
224	@echo "--------------------------------------------------------------"
225	cd ${.CURDIR} && ${BMAKE} hierarchy
226.if !defined(NOCLEAN)
227	@echo
228	@echo "--------------------------------------------------------------"
229	@echo " Cleaning up the obj tree"
230	@echo "--------------------------------------------------------------"
231	cd ${.CURDIR} && ${BMAKE} ${CLEANDIR}
232.endif
233.if !defined(NOOBJDIR)
234	@echo
235	@echo "--------------------------------------------------------------"
236	@echo " Rebuilding the obj tree"
237	@echo "--------------------------------------------------------------"
238	cd ${.CURDIR} && ${BMAKE} obj
239.endif
240	@echo
241	@echo "--------------------------------------------------------------"
242	@echo " Rebuilding bootstrap tools"
243	@echo "--------------------------------------------------------------"
244	cd ${.CURDIR} && ${BMAKE} bootstrap
245	@echo
246	@echo "--------------------------------------------------------------"
247	@echo " Rebuilding tools necessary to build the include files"
248	@echo "--------------------------------------------------------------"
249	cd ${.CURDIR} && ${BMAKE} include-tools
250	@echo
251	@echo "--------------------------------------------------------------"
252	@echo " Rebuilding /usr/include"
253	@echo "--------------------------------------------------------------"
254	cd ${.CURDIR} && ${BMAKE} includes
255	@echo
256	@echo "--------------------------------------------------------------"
257	@echo " Rebuilding tools needed to build the libraries"
258	@echo "--------------------------------------------------------------"
259	cd ${.CURDIR} && ${BMAKE} lib-tools
260	@echo
261	@echo "--------------------------------------------------------------"
262	@echo " Rebuilding /usr/lib"
263	@echo "--------------------------------------------------------------"
264	cd ${.CURDIR} && ${BMAKE} libraries
265	@echo
266	@echo "--------------------------------------------------------------"
267	@echo " Rebuilding all other tools needed to build the world"
268	@echo "--------------------------------------------------------------"
269	cd ${.CURDIR} && ${BMAKE} build-tools
270	@echo
271	@echo "--------------------------------------------------------------"
272	@echo " Rebuilding dependencies"
273	@echo "--------------------------------------------------------------"
274	cd ${.CURDIR} && ${XMAKE} depend
275	@echo
276	@echo "--------------------------------------------------------------"
277	@echo " Building everything.."
278	@echo "--------------------------------------------------------------"
279	cd ${.CURDIR} && ${XMAKE} all
280
281#
282# installworld
283#
284# Installs everything compiled by a 'buildworld'.
285#
286installworld:
287	cd ${.CURDIR} && ${IXMAKE} reinstall
288
289#
290# reinstall
291#
292# If you have a build server, you can NFS mount the source and obj directories
293# and do a 'make reinstall' on the *client* to install new binaries from the
294# most recent server build.
295#
296reinstall:
297	@echo "--------------------------------------------------------------"
298	@echo " Making hierarchy"
299	@echo "--------------------------------------------------------------"
300	cd ${.CURDIR} && ${MAKE} hierarchy
301	@echo
302	@echo "--------------------------------------------------------------"
303	@echo " Installing everything.."
304	@echo "--------------------------------------------------------------"
305	cd ${.CURDIR} && ${MAKE} install
306	@echo
307	@echo "--------------------------------------------------------------"
308	@echo " Rebuilding man page indexes"
309	@echo "--------------------------------------------------------------"
310	cd ${.CURDIR}/share/man && ${MAKE} makedb
311
312#
313# update
314#
315# Update the source tree, by running sup and/or running cvs to update to the
316# latest copy.
317#
318update:
319.if defined(SUP_UPDATE)
320	@echo "--------------------------------------------------------------"
321	@echo "Running sup"
322	@echo "--------------------------------------------------------------"
323	@${SUP} ${SUPFLAGS} ${SUPFILE}
324.if defined(SUPFILE1)
325	@${SUP} ${SUPFLAGS} ${SUPFILE1}
326.endif
327.if defined(SUPFILE2)
328	@${SUP} ${SUPFLAGS} ${SUPFILE2}
329.endif
330.endif
331.if defined(CVS_UPDATE)
332	@echo "--------------------------------------------------------------"
333	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
334	@echo "--------------------------------------------------------------"
335	cd ${.CURDIR} && cvs -q update -P -d
336.endif
337
338#
339# most
340#
341# Build most of the user binaries on the existing system libs and includes.
342#
343most:
344	@echo "--------------------------------------------------------------"
345	@echo " Building programs only"
346	@echo "--------------------------------------------------------------"
347	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
348	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
349	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
350	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
351	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
352	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
353	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
354	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
355#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
356#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
357#.endif
358#.if !defined(NOSECURE) && !defined(NOCRYPT)
359#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
360#.endif
361
362#
363# installmost
364#
365# Install the binaries built by the 'most' target.  This does not include
366# libraries or include files.
367#
368installmost:
369	@echo "--------------------------------------------------------------"
370	@echo " Installing programs only"
371	@echo "--------------------------------------------------------------"
372	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
373	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
374	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
375	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
376	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
377	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
378	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
379	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
380#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
381#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
382#.endif
383#.if !defined(NOSECURE) && !defined(NOCRYPT)
384#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
385#.endif
386
387#
388# ------------------------------------------------------------------------
389#
390# From here onwards are utility targets used by the 'make world' and
391# related targets.  If your 'world' breaks, you may like to try to fix
392# the problem and manually run the following targets to attempt to
393# complete the build.  Beware, this is *not* guaranteed to work, you
394# need to have a pretty good grip on the current state of the system
395# to attempt to manually finish it.  If in doubt, 'make world' again.
396#
397
398#
399# heirarchy - ensure that all the needed directories are present
400#
401hierarchy:
402	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
403
404#
405# bootstrap - [re]build tools needed to run the actual build, this includes
406# tools needed by 'make depend', as some tools are needed to generate source
407# for the dependency information to be gathered from.
408#
409bootstrap:
410.if defined(DESTDIR)
411	rm -f ${DESTDIR}/usr/src/sys
412	ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src
413	cd ${.CURDIR}/include && find -dx . | cpio -dump ${DESTDIR}/usr/include
414	cd ${.CURDIR}/include && make symlinks
415.endif
416	cd ${.CURDIR}/usr.bin/make && ${MAKE} depend && \
417		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
418	cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \
419		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
420	cd ${.CURDIR}/usr.bin/lex && ${MAKE} bootstrap && ${MAKE} depend && \
421		${MAKE} ${MK_FLAGS} -DNOLIB all install ${CLEANDIR} ${OBJDIR}
422
423#
424# include-tools - generally the same as 'bootstrap', except that it's for
425# things that are specifically needed to generate include files.
426#
427# XXX should be merged with bootstrap, it's not worth keeeping them separate.
428# Well, maybe it is now.  We force 'cleandepend' here to avoid dependencies
429# on cleaned away headers in ${WORLDTMP}.
430#
431include-tools:
432	cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} cleandepend depend && \
433		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
434
435#
436# includes - possibly generate and install the include files.
437#
438includes:
439.if defined(CLOBBER)
440	rm -rf ${DESTDIR}/usr/include/*
441	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
442		-p ${DESTDIR}/usr/include
443.endif
444	cd ${.CURDIR}/include &&		${MAKE} all installhdrs symlinks
445	cd ${.CURDIR}/gnu/include &&		${MAKE} install
446	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
447	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
448	cd ${.CURDIR}/gnu/lib/libstdc++ &&	${MAKE} beforeinstall
449	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
450	cd ${.CURDIR}/gnu/lib/libdialog &&	${MAKE} beforeinstall
451	cd ${.CURDIR}/gnu/lib/libgmp &&		${MAKE} beforeinstall
452.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
453	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
454	cd ${.CURDIR}/eBones/lib/libkrb &&	${MAKE} beforeinstall
455	cd ${.CURDIR}/eBones/lib/libkadm &&	${MAKE} beforeinstall
456.endif
457	cd ${.CURDIR}/lib/csu/i386 &&		${MAKE} beforeinstall
458	cd ${.CURDIR}/lib/libalias &&		${MAKE} beforeinstall
459	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
460	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
461	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
462	cd ${.CURDIR}/lib/libftpio &&		${MAKE} beforeinstall
463	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
464	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE} beforeinstall
465	cd ${.CURDIR}/lib/libncurses &&		${MAKE} beforeinstall
466.if !defined(WANT_CSRG_LIBM)
467	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
468.endif
469	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
470	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
471	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
472.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \
473	exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl)
474	cd ${.CURDIR}/lib/libtcl &&		${MAKE} beforeinstall
475.endif
476	cd ${.CURDIR}/lib/libtermcap &&		${MAKE} beforeinstall
477	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
478	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
479	cd ${.CURDIR}/lib/libscsi &&		${MAKE} beforeinstall
480	cd ${.CURDIR}/lib/libutil &&		${MAKE} beforeinstall
481	cd ${.CURDIR}/lib/libz &&		${MAKE} beforeinstall
482
483#
484# lib-tools - build tools to compile and install the libraries.
485#
486# XXX gperf is required for cc
487# XXX a new ld and tsort is required for cc
488lib-tools:
489.for d in				\
490		gnu/usr.bin/gperf	\
491		gnu/usr.bin/ld		\
492		usr.bin/tsort		\
493		gnu/usr.bin/as		\
494		gnu/usr.bin/bison	\
495		gnu/usr.bin/cc		\
496		usr.bin/ar		\
497		usr.bin/compile_et	\
498		usr.bin/lex/lib		\
499		usr.bin/mk_cmds		\
500		usr.bin/nm		\
501		usr.bin/ranlib		\
502		usr.bin/uudecode
503	cd ${.CURDIR}/$d && ${MAKE} depend && \
504		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
505.endfor
506
507#
508# libraries - build and install the libraries
509#
510libraries:
511.if exists(lib/csu/i386)
512	cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
513		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
514.endif
515.if exists(lib/libcompat)
516	cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
517		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
518.endif
519.if exists(lib/libncurses)
520	cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \
521		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
522.endif
523.if exists(lib/libtermcap)
524	cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
525		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
526.endif
527.if exists(gnu)
528	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
529		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
530.endif
531.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
532	cd ${.CURDIR}/secure/lib && ${MAKE} depend && \
533		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
534.endif
535.if exists(lib)
536	cd ${.CURDIR}/lib && ${MAKE} depend && \
537		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
538.endif
539.if exists(usr.bin/lex/lib)
540	cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
541		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
542.endif
543.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
544	cd ${.CURDIR}/eBones/lib && ${MAKE} depend && \
545		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
546.endif
547.if exists(usr.sbin/pcvt/keycap)
548	cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \
549		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
550.endif
551
552#
553# build-tools - build and install any other tools needed to complete the
554# compile and install.
555# ifdef stale
556# bc and cpp are required to build groff.  Otherwise, the order here is
557# mostly historical, i.e., bogus.
558# chmod is used to build gcc's tmpmultilib[2] at obscure times.
559# endif stale
560# XXX uname is a bug - the target should not depend on the host.
561#
562build-tools:
563.for d in				\
564		bin/cat 		\
565		bin/chmod		\
566		bin/cp 			\
567		bin/date		\
568		bin/dd			\
569		bin/echo		\
570		bin/expr		\
571		bin/hostname		\
572		bin/ln			\
573		bin/ls			\
574		bin/mkdir		\
575		bin/mv			\
576		bin/rm			\
577		bin/sh			\
578		bin/test		\
579		gnu/usr.bin/awk		\
580		gnu/usr.bin/bc		\
581		gnu/usr.bin/grep	\
582		gnu/usr.bin/groff	\
583		gnu/usr.bin/gzip	\
584		gnu/usr.bin/man/makewhatis	\
585		gnu/usr.bin/sort	\
586		gnu/usr.bin/texinfo     \
587		share/info		\
588		usr.bin/basename	\
589		usr.bin/cap_mkdb	\
590		usr.bin/chflags		\
591		usr.bin/cmp		\
592		usr.bin/col		\
593		usr.bin/cpp		\
594		usr.bin/expand		\
595		usr.bin/file2c		\
596		usr.bin/find		\
597		usr.bin/gencat		\
598		usr.bin/lorder		\
599		usr.bin/m4		\
600		usr.bin/mkdep		\
601		usr.bin/paste		\
602		usr.bin/sed		\
603		usr.bin/size		\
604		usr.bin/soelim		\
605		usr.bin/strip		\
606		usr.bin/symorder	\
607		usr.bin/touch		\
608		usr.bin/tr		\
609		usr.bin/true		\
610		usr.bin/uname		\
611		usr.bin/uuencode	\
612		usr.bin/vgrind		\
613		usr.bin/vi		\
614		usr.bin/wc		\
615		usr.bin/yacc		\
616		usr.sbin/chown		\
617		usr.sbin/mtree		\
618		usr.sbin/zic
619	cd ${.CURDIR}/$d && ${MAKE} depend && \
620		${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
621.endfor
622
623.include <bsd.subdir.mk>
624