Makefile revision 32427
1#
2#	$Id: Makefile,v 1.155 1997/10/10 13:02:36 asami Exp $
3#
4# While porting to the Alpha architecture include the bootstrap instead
5# of the normal build.
6#
7.if ${MACHINE} == "alpha"
8.include "Makefile.alpha"
9.else
10#
11# Make command line options:
12#	-DCLOBBER will remove /usr/include
13#	-DMAKE_KERBEROS4 to build KerberosIV
14#	-DALLLANG to build documentation for all languages
15#	  (where available -- see share/doc/Makefile)
16#
17#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
18#	-DNOCLEAN do not clean at all
19#	-DNOCRYPT will prevent building of crypt versions
20#	-DNOLKM do not build loadable kernel modules
21#	-DNOOBJDIR do not run ``${MAKE} obj''
22#	-DNOPROFILE do not build profiled libraries
23#	-DNOSECURE do not go into secure subdir
24#	-DNOGAMES do not go into games subdir
25#	-DNOSHARE do not go into share subdir
26#	-DNOINFO do not make or install info files
27#	-DNOLIBC_R do not build libc_r.
28#	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
29
30#
31# The intended user-driven targets are:
32# buildworld  - rebuild *everything*, including glue to help do upgrades
33# installworld- install everything built by "buildworld"
34# world       - buildworld + installworld
35# update      - convenient way to update your source tree (eg: sup/cvs)
36# most        - build user commands, no libraries or include files
37# installmost - install user commands, no libraries or include files
38#
39# Standard targets (not defined here) are documented in the makefiles in
40# /usr/share/mk.  These include:
41#		obj depend all install clean cleandepend cleanobj
42
43.if (!make(world)) && (!make(buildworld)) && (!make(installworld))
44.MAKEFLAGS:=	${.MAKEFLAGS} -m ${.CURDIR}/share/mk
45.endif
46
47# Put initial settings here.
48SUBDIR=
49
50# We must do share/info early so that installation of info `dir'
51# entries works correctly.  Do it first since it is less likely to
52# grow dependencies on include and lib than vice versa.
53.if exists(share/info)
54SUBDIR+= share/info
55.endif
56
57# We must do include and lib early so that the perl *.ph generation
58# works correctly as it uses the header files installed by this.
59.if exists(include)
60SUBDIR+= include
61.endif
62.if exists(lib)
63SUBDIR+= lib
64.endif
65
66.if exists(bin)
67SUBDIR+= bin
68.endif
69.if exists(games) && !defined(NOGAMES)
70SUBDIR+= games
71.endif
72.if exists(gnu)
73SUBDIR+= gnu
74.endif
75.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
76SUBDIR+= kerberosIV
77.endif
78.if exists(libexec)
79SUBDIR+= libexec
80.endif
81.if exists(sbin)
82SUBDIR+= sbin
83.endif
84.if exists(share) && !defined(NOSHARE)
85SUBDIR+= share
86.endif
87.if exists(sys)
88SUBDIR+= sys
89.endif
90.if exists(usr.bin)
91SUBDIR+= usr.bin
92.endif
93.if exists(usr.sbin)
94SUBDIR+= usr.sbin
95.endif
96.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
97SUBDIR+= secure
98.endif
99.if exists(lkm) && !defined(NOLKM)
100SUBDIR+= lkm
101.endif
102
103# etc must be last for "distribute" to work
104.if exists(etc) && make(distribute)
105SUBDIR+= etc
106.endif
107
108# These are last, since it is nice to at least get the base system
109# rebuilt before you do them.
110.if defined(LOCAL_DIRS)
111.for _DIR in ${LOCAL_DIRS}
112.if exists(${_DIR}) & exists(${_DIR}/Makefile)
113SUBDIR+= ${_DIR}
114.endif
115.endfor
116.endif
117
118# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
119.if defined(NOOBJDIR)
120OBJDIR=
121.else
122OBJDIR=		obj
123.endif
124
125.if defined(NOCLEAN)
126CLEANDIR=
127.else
128.if defined(NOCLEANDIR)
129CLEANDIR=	clean
130.else
131CLEANDIR=	cleandir
132.endif
133.endif
134
135SUP?=		sup
136SUPFLAGS?=	-v
137
138#
139# While building tools for bootstrapping, we dont need to waste time on
140# profiled libraries or man pages.  This speeds things up somewhat.
141#
142MK_FLAGS=	-DNOINFO -DNOMAN -DNOPROFILE
143
144#
145# world
146#
147# Attempt to rebuild and reinstall *everything*, with reasonable chance of
148# success, regardless of how old your existing system is.
149#
150# >> Beware, it overwrites the local build environment! <<
151#
152world:
153	@echo "--------------------------------------------------------------"
154	@echo "make world started on `LC_TIME=C date`"
155	@echo "--------------------------------------------------------------"
156.if target(pre-world)
157	@echo
158	@echo "--------------------------------------------------------------"
159	@echo " Making 'pre-world' target"
160	@echo "--------------------------------------------------------------"
161	cd ${.CURDIR} && ${MAKE} pre-world
162.endif
163	cd ${.CURDIR} && ${MAKE} buildworld
164	cd ${.CURDIR} && ${MAKE} -B installworld
165.if target(post-world)
166	@echo
167	@echo "--------------------------------------------------------------"
168	@echo " Making 'post-world' target"
169	@echo "--------------------------------------------------------------"
170	cd ${.CURDIR} && ${MAKE} post-world
171.endif
172	@echo
173	@echo "--------------------------------------------------------------"
174	@echo "make world completed on `LC_TIME=C date`"
175	@echo "--------------------------------------------------------------"
176
177.if defined(MAKEOBJDIRPREFIX)
178WORLDTMP=	${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
179.else
180WORLDTMP=	/usr/obj${.CURDIR}/tmp
181.endif
182STRICTTMPPATH=	${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin
183TMPPATH=	${STRICTTMPPATH}:${PATH}
184
185# XXX COMPILER_PATH is needed for finding cc1, ld and as
186# XXX GCC_EXEC_PREFIX is for *crt.o.  It is probably unnecssary now
187#	tbat LIBRARY_PATH is set.  We still can't use -nostdlib, since gcc
188#	wouldn't link *crt.o or libgcc if it were used.
189# XXX LD_LIBRARY_PATH is for ld.so.  It is also used by ld, although we don't
190#	want that - all compile-time library paths should be resolved by gcc.
191#	It fails for set[ug]id executables (are any used?).
192COMPILER_ENV=	BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \
193		COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
194		GCC_EXEC_PREFIX=${WORLDTMP}/usr/lib/ \
195		LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \
196		LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
197
198BMAKEENV=	PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t
199XMAKEENV=	PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
200		CC='cc -nostdinc'	# XXX -nostdlib
201
202# used to compile and install 'make' in temporary build tree
203IBMAKE=	${BMAKEENV} ${MAKE} DESTDIR=${WORLDTMP}
204# bootstrap make
205BMAKE=	${BMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
206# cross make used for compilation
207XMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
208# cross make used for final installation
209IXMAKE=	${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE}
210
211#
212# buildworld
213#
214# Attempt to rebuild the entire system, with reasonable chance of
215# success, regardless of how old your existing system is.
216#
217buildworld:
218.if !defined(NOCLEAN)
219	@echo
220	@echo "--------------------------------------------------------------"
221	@echo " Cleaning up the temporary build tree"
222	@echo "--------------------------------------------------------------"
223	mkdir -p ${WORLDTMP}
224	chflags -R noschg ${WORLDTMP}/
225	rm -rf ${WORLDTMP}
226.endif
227	@echo
228	@echo "--------------------------------------------------------------"
229	@echo " Making make"
230	@echo "--------------------------------------------------------------"
231	mkdir -p ${WORLDTMP}/usr/bin
232.if !defined(NOCLEAN) || !defined(NOOBJDIR)
233	cd ${.CURDIR}/usr.bin/make && \
234		${IBMAKE} -I${.CURDIR}/share/mk ${CLEANDIR} ${OBJDIR}
235.endif
236	cd ${.CURDIR}/usr.bin/make && \
237		${IBMAKE} -I${.CURDIR}/share/mk depend && \
238		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all && \
239		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install && \
240		${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean cleandepend
241	@echo
242	@echo "--------------------------------------------------------------"
243	@echo " Making hierarchy"
244	@echo "--------------------------------------------------------------"
245	cd ${.CURDIR} && ${BMAKE} hierarchy
246.if !defined(NOCLEAN)
247	@echo
248	@echo "--------------------------------------------------------------"
249	@echo " Cleaning up the obj tree"
250	@echo "--------------------------------------------------------------"
251	cd ${.CURDIR} && ${BMAKE} par-${CLEANDIR}
252.endif
253.if !defined(NOOBJDIR)
254	@echo
255	@echo "--------------------------------------------------------------"
256	@echo " Rebuilding the obj tree"
257	@echo "--------------------------------------------------------------"
258	cd ${.CURDIR} && ${BMAKE} par-obj
259.endif
260	@echo
261	@echo "--------------------------------------------------------------"
262	@echo " Rebuilding bootstrap tools"
263	@echo "--------------------------------------------------------------"
264	cd ${.CURDIR} && ${BMAKE} bootstrap
265	@echo
266	@echo "--------------------------------------------------------------"
267	@echo " Rebuilding tools necessary to build the include files"
268	@echo "--------------------------------------------------------------"
269	cd ${.CURDIR} && ${BMAKE} include-tools
270	@echo
271	@echo "--------------------------------------------------------------"
272	@echo " Rebuilding /usr/include"
273	@echo "--------------------------------------------------------------"
274	cd ${.CURDIR} && SHARED=symlinks ${BMAKE} includes
275	@echo
276	@echo "--------------------------------------------------------------"
277	@echo " Rebuilding tools needed to build the libraries"
278	@echo "--------------------------------------------------------------"
279	cd ${.CURDIR} && ${BMAKE} lib-tools
280	@echo
281	@echo "--------------------------------------------------------------"
282	@echo " Rebuilding /usr/lib"
283	@echo "--------------------------------------------------------------"
284	cd ${.CURDIR} && ${BMAKE} libraries
285	@echo
286	@echo "--------------------------------------------------------------"
287	@echo " Rebuilding all other tools needed to build the world"
288	@echo "--------------------------------------------------------------"
289	cd ${.CURDIR} && ${BMAKE} build-tools
290	@echo
291	@echo "--------------------------------------------------------------"
292	@echo " Rebuilding dependencies"
293	@echo "--------------------------------------------------------------"
294	cd ${.CURDIR} && ${XMAKE} par-depend
295	@echo
296	@echo "--------------------------------------------------------------"
297	@echo " Building everything.."
298	@echo "--------------------------------------------------------------"
299	cd ${.CURDIR} && ${XMAKE} all
300
301#
302# installworld
303#
304# Installs everything compiled by a 'buildworld'.
305#
306installworld:
307	cd ${.CURDIR} && ${IXMAKE} reinstall
308
309#
310# reinstall
311#
312# If you have a build server, you can NFS mount the source and obj directories
313# and do a 'make reinstall' on the *client* to install new binaries from the
314# most recent server build.
315#
316reinstall:
317	@echo "--------------------------------------------------------------"
318	@echo " Making hierarchy"
319	@echo "--------------------------------------------------------------"
320	cd ${.CURDIR} && ${MAKE} hierarchy
321	@echo
322	@echo "--------------------------------------------------------------"
323	@echo " Installing everything.."
324	@echo "--------------------------------------------------------------"
325	cd ${.CURDIR} && ${MAKE} install
326	@echo
327	@echo "--------------------------------------------------------------"
328	@echo " Rebuilding man page indexes"
329	@echo "--------------------------------------------------------------"
330	cd ${.CURDIR}/share/man && ${MAKE} makedb
331
332#
333# update
334#
335# Update the source tree, by running sup and/or running cvs to update to the
336# latest copy.
337#
338update:
339.if defined(SUP_UPDATE)
340	@echo "--------------------------------------------------------------"
341	@echo "Running sup"
342	@echo "--------------------------------------------------------------"
343	@${SUP} ${SUPFLAGS} ${SUPFILE}
344.if defined(SUPFILE1)
345	@${SUP} ${SUPFLAGS} ${SUPFILE1}
346.endif
347.if defined(SUPFILE2)
348	@${SUP} ${SUPFLAGS} ${SUPFILE2}
349.endif
350.endif
351.if defined(CVS_UPDATE)
352	@echo "--------------------------------------------------------------"
353	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
354	@echo "--------------------------------------------------------------"
355	cd ${.CURDIR} && cvs -q update -P -d
356.endif
357
358#
359# most
360#
361# Build most of the user binaries on the existing system libs and includes.
362#
363most:
364	@echo "--------------------------------------------------------------"
365	@echo " Building programs only"
366	@echo "--------------------------------------------------------------"
367	cd ${.CURDIR}/bin	&&	${MAKE} all
368	cd ${.CURDIR}/sbin	&&	${MAKE} all
369	cd ${.CURDIR}/libexec	&&	${MAKE} all
370	cd ${.CURDIR}/usr.bin	&&	${MAKE} all
371	cd ${.CURDIR}/usr.sbin	&&	${MAKE} all
372	cd ${.CURDIR}/gnu/libexec &&	${MAKE} all
373	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} all
374	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} all
375#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
376#	cd ${.CURDIR}/kerberosIV	&&	${MAKE} most
377#.endif
378#.if !defined(NOSECURE) && !defined(NOCRYPT)
379#	cd ${.CURDIR}/secure	&&	${MAKE} most
380#.endif
381
382#
383# installmost
384#
385# Install the binaries built by the 'most' target.  This does not include
386# libraries or include files.
387#
388installmost:
389	@echo "--------------------------------------------------------------"
390	@echo " Installing programs only"
391	@echo "--------------------------------------------------------------"
392	cd ${.CURDIR}/bin	&&	${MAKE} install
393	cd ${.CURDIR}/sbin	&&	${MAKE} install
394	cd ${.CURDIR}/libexec	&&	${MAKE} install
395	cd ${.CURDIR}/usr.bin	&&	${MAKE} install
396	cd ${.CURDIR}/usr.sbin	&&	${MAKE} install
397	cd ${.CURDIR}/gnu/libexec &&	${MAKE} install
398	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} install
399	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} install
400#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
401#	cd ${.CURDIR}/kerberosIV &&	${MAKE} installmost
402#.endif
403#.if !defined(NOSECURE) && !defined(NOCRYPT)
404#	cd ${.CURDIR}/secure	&&	${MAKE} installmost
405#.endif
406
407#
408# ------------------------------------------------------------------------
409#
410# From here onwards are utility targets used by the 'make world' and
411# related targets.  If your 'world' breaks, you may like to try to fix
412# the problem and manually run the following targets to attempt to
413# complete the build.  Beware, this is *not* guaranteed to work, you
414# need to have a pretty good grip on the current state of the system
415# to attempt to manually finish it.  If in doubt, 'make world' again.
416#
417
418#
419# heirarchy - ensure that all the needed directories are present
420#
421hierarchy:
422	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
423
424#
425# bootstrap - [re]build tools needed to run the actual build, this includes
426# tools needed by 'make depend', as some tools are needed to generate source
427# for the dependency information to be gathered from.
428#
429bootstrap:
430.if defined(DESTDIR)
431	rm -f ${DESTDIR}/usr/src/sys
432	ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src
433	cd ${.CURDIR}/include && find -dx . | cpio -dump ${DESTDIR}/usr/include
434	cd ${.CURDIR}/include && make symlinks
435.endif
436	cd ${.CURDIR}/usr.bin/make && ${MAKE} depend && \
437		${MAKE} ${MK_FLAGS} all && \
438		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
439	cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \
440		${MAKE} ${MK_FLAGS} all && \
441		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
442	cd ${.CURDIR}/usr.bin/lex && ${MAKE} bootstrap && ${MAKE} depend && \
443		${MAKE} ${MK_FLAGS} -DNOLIB all && \
444		${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
445.if !defined(NOOBJDIR)
446	cd ${.CURDIR}/usr.bin/lex && ${MAKE} obj
447.endif
448
449#
450# include-tools - generally the same as 'bootstrap', except that it's for
451# things that are specifically needed to generate include files.
452#
453# XXX should be merged with bootstrap, it's not worth keeeping them separate.
454# Well, maybe it is now.  We force 'cleandepend' here to avoid dependencies
455# on cleaned away headers in ${WORLDTMP}.
456#
457include-tools:
458	cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} -B cleandepend depend && \
459		${MAKE} ${MK_FLAGS} all && \
460		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
461
462#
463# includes - possibly generate and install the include files.
464#
465includes:
466.if defined(CLOBBER)
467	rm -rf ${DESTDIR}/usr/include/*
468	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
469		-p ${DESTDIR}/usr/include
470.endif
471	cd ${.CURDIR}/include &&		${MAKE} -B all install
472	cd ${.CURDIR}/gnu/include &&		${MAKE} install
473	cd ${.CURDIR}/gnu/lib/libmp &&		${MAKE} beforeinstall
474	cd ${.CURDIR}/gnu/lib/libobjc &&	${MAKE} beforeinstall
475	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
476	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
477	cd ${.CURDIR}/gnu/lib/libstdc++ &&	${MAKE} beforeinstall
478	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
479	cd ${.CURDIR}/gnu/lib/libdialog &&	${MAKE} beforeinstall
480	cd ${.CURDIR}/gnu/lib/libgmp &&		${MAKE} beforeinstall
481.if exists(secure) && !defined(NOCRYPT)
482	cd ${.CURDIR}/secure/lib/libdes &&	${MAKE} beforeinstall
483.endif
484.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
485	cd ${.CURDIR}/kerberosIV/lib/libacl &&	${MAKE} beforeinstall
486	cd ${.CURDIR}/kerberosIV/lib/libkadm &&	${MAKE} beforeinstall
487	cd ${.CURDIR}/kerberosIV/lib/libkafs &&	${MAKE} beforeinstall
488	cd ${.CURDIR}/kerberosIV/lib/libkdb &&	${MAKE} beforeinstall
489	cd ${.CURDIR}/kerberosIV/lib/libkrb &&	${MAKE} beforeinstall
490	cd ${.CURDIR}/kerberosIV/lib/libtelnet && ${MAKE} beforeinstall
491.else
492	cd ${.CURDIR}/lib/libtelnet &&		${MAKE} beforeinstall
493.endif
494.if exists(${.CURDIR}/lib/csu/${MACHINE})
495	cd ${.CURDIR}/lib/csu/${MACHINE} &&	${MAKE} beforeinstall
496.endif
497	cd ${.CURDIR}/lib/libalias &&		${MAKE} beforeinstall
498	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
499	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
500	cd ${.CURDIR}/lib/libdisk &&		${MAKE} beforeinstall
501	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
502	cd ${.CURDIR}/lib/libftpio &&		${MAKE} beforeinstall
503	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
504	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE} beforeinstall
505	cd ${.CURDIR}/lib/libncurses &&		${MAKE} beforeinstall
506.if !defined(WANT_CSRG_LIBM)
507	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
508.endif
509	cd ${.CURDIR}/lib/libopie &&		${MAKE} beforeinstall
510	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
511	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
512	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
513.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \
514	exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl)
515	cd ${.CURDIR}/lib/libtcl &&		${MAKE} installhdrs
516.endif
517	cd ${.CURDIR}/lib/libtermcap &&		${MAKE} beforeinstall
518	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
519	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
520	cd ${.CURDIR}/lib/libscsi &&		${MAKE} beforeinstall
521	cd ${.CURDIR}/lib/libutil &&		${MAKE} beforeinstall
522	cd ${.CURDIR}/lib/libvgl &&		${MAKE} beforeinstall
523	cd ${.CURDIR}/lib/libz &&		${MAKE} beforeinstall
524	cd ${.CURDIR}/usr.bin/f2c &&		${MAKE} beforeinstall
525	cd ${.CURDIR}/usr.bin/lex &&		${MAKE} beforeinstall
526
527#
528# lib-tools - build tools to compile and install the libraries.
529#
530# XXX gperf is required for cc
531# XXX a new ld and tsort is required for cc
532lib-tools:
533.for d in				\
534		gnu/usr.bin/gperf	\
535		gnu/usr.bin/ld		\
536		usr.bin/tsort		\
537		gnu/usr.bin/as		\
538		gnu/usr.bin/bison	\
539		gnu/usr.bin/cc		\
540		usr.bin/ar		\
541		usr.bin/compile_et	\
542		usr.bin/lex/lib		\
543		usr.bin/mk_cmds		\
544		usr.bin/nm		\
545		usr.bin/ranlib		\
546		usr.bin/uudecode
547	cd ${.CURDIR}/$d && ${MAKE} depend && \
548		${MAKE} ${MK_FLAGS} all && \
549		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
550.endfor
551
552#
553# libraries - build and install the libraries
554#
555libraries:
556.if exists(lib/csu/${MACHINE})
557	cd ${.CURDIR}/lib/csu/${MACHINE} && ${MAKE} depend && \
558		${MAKE} ${MK_FLAGS} all && \
559		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
560.endif
561.if exists(lib/libcompat)
562	cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
563		${MAKE} ${MK_FLAGS} all && \
564		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
565.endif
566.if exists(lib/libncurses)
567	cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \
568		${MAKE} ${MK_FLAGS} all && \
569		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
570.endif
571.if exists(lib/libtermcap)
572	cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
573		${MAKE} ${MK_FLAGS} all && \
574		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
575.endif
576.if exists(gnu)
577	cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
578		${MAKE} ${MK_FLAGS} all && \
579		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
580.endif
581.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
582	cd ${.CURDIR}/secure/lib && ${MAKE} depend && \
583		${MAKE} ${MK_FLAGS} all && \
584		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
585.endif
586.if exists(lib)
587	cd ${.CURDIR}/lib && ${MAKE} depend && \
588		${MAKE} ${MK_FLAGS} all && \
589		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
590.endif
591.if exists(usr.bin/lex/lib)
592	cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
593		${MAKE} ${MK_FLAGS} all && \
594		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
595.endif
596.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
597	cd ${.CURDIR}/kerberosIV/lib && ${MAKE} depend && \
598		${MAKE} ${MK_FLAGS} all && \
599		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
600.endif
601.if exists(usr.sbin/pcvt/keycap)
602	cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \
603		${MAKE} ${MK_FLAGS} all && \
604		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
605.endif
606
607#
608# build-tools - build and install any other tools needed to complete the
609# compile and install.
610# ifdef stale
611# bc and cpp are required to build groff.  Otherwise, the order here is
612# mostly historical, i.e., bogus.
613# chmod is used to build gcc's tmpmultilib[2] at obscure times.
614# endif stale
615# XXX uname is a bug - the target should not depend on the host.
616#
617build-tools:
618.for d in				\
619		bin/cat 		\
620		bin/chmod		\
621		bin/cp 			\
622		bin/date		\
623		bin/dd			\
624		bin/echo		\
625		bin/expr		\
626		bin/hostname		\
627		bin/ln			\
628		bin/ls			\
629		bin/mkdir		\
630		bin/mv			\
631		bin/rm			\
632		bin/sh			\
633		bin/test		\
634		gnu/usr.bin/awk		\
635		gnu/usr.bin/bc		\
636		gnu/usr.bin/grep	\
637		gnu/usr.bin/groff	\
638		gnu/usr.bin/gzip	\
639		gnu/usr.bin/man/makewhatis	\
640		gnu/usr.bin/sort	\
641		gnu/usr.bin/texinfo     \
642		share/info		\
643		usr.bin/basename	\
644		usr.bin/cap_mkdb	\
645		usr.bin/chflags		\
646		usr.bin/cmp		\
647		usr.bin/col		\
648		usr.bin/cpp		\
649		usr.bin/expand		\
650		usr.bin/file2c		\
651		usr.bin/find		\
652		usr.bin/gencat		\
653		usr.bin/lorder		\
654		usr.bin/m4		\
655		usr.bin/mkdep		\
656		usr.bin/paste		\
657		usr.bin/sed		\
658		usr.bin/size		\
659		usr.bin/soelim		\
660		usr.bin/strip		\
661		usr.bin/symorder	\
662		usr.bin/touch		\
663		usr.bin/tr		\
664		usr.bin/true		\
665		usr.bin/uname		\
666		usr.bin/uuencode	\
667		usr.bin/vgrind		\
668		usr.bin/vi		\
669		usr.bin/wc		\
670		usr.bin/yacc		\
671		usr.sbin/chown		\
672		usr.sbin/mtree		\
673		usr.sbin/zic
674	cd ${.CURDIR}/$d && ${MAKE} depend && \
675		${MAKE} ${MK_FLAGS} all && \
676		${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
677.endfor
678
679.for __target in clean cleandir obj depend
680.for entry in ${SUBDIR}
681${entry}.${__target}__D: .PHONY
682	if test -d ${.CURDIR}/${entry}.${MACHINE}; then \
683		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \
684		edir=${entry}.${MACHINE}; \
685		cd ${.CURDIR}/$${edir}; \
686	else \
687		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
688		edir=${entry}; \
689		cd ${.CURDIR}/$${edir}; \
690	fi; \
691	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
692.endfor
693par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
694.endfor
695
696.endif
697
698.include <bsd.subdir.mk>
699