Makefile.inc1 revision 55816
1#
2# $FreeBSD: head/Makefile.inc1 55816 2000-01-11 12:51:56Z green $
3#
4# Make command line options:
5#	-DMAKE_KERBEROS4 to build KerberosIV
6#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
7#	-DNOCLEAN do not clean at all
8#	-DNOCRYPT will prevent building of crypt versions
9#	-DNOPROFILE do not build profiled libraries
10#	-DNOSECURE do not go into secure subdir
11#	-DNOGAMES do not go into games subdir
12#	-DNOSHARE do not go into share subdir
13#	-DNOINFO do not make or install info files
14#	-DNOLIBC_R do not build libc_r.
15#	-DNO_FORTRAN do not build g77 and related libraries.
16#	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
17
18#
19# The intended user-driven targets are:
20# buildworld  - rebuild *everything*, including glue to help do upgrades
21# installworld- install everything built by "buildworld"
22# update      - convenient way to update your source tree (eg: sup/cvs)
23# most        - build user commands, no libraries or include files
24# installmost - install user commands, no libraries or include files
25#
26# Standard targets (not defined here) are documented in the makefiles in
27# /usr/share/mk.  These include:
28#		obj depend all install clean cleandepend cleanobj
29
30# Put initial settings here.
31SUBDIR=
32
33# We must do share/info early so that installation of info `dir'
34# entries works correctly.  Do it first since it is less likely to
35# grow dependencies on include and lib than vice versa.
36.if exists(${.CURDIR}/share/info)
37SUBDIR+= share/info
38.endif
39
40# We must do include and lib early so that the perl *.ph generation
41# works correctly as it uses the header files installed by this.
42.if exists(${.CURDIR}/include)
43SUBDIR+= include
44.endif
45.if exists(${.CURDIR}/lib)
46SUBDIR+= lib
47.endif
48
49.if exists(${.CURDIR}/bin)
50SUBDIR+= bin
51.endif
52.if exists(${.CURDIR}/games) && !defined(NOGAMES)
53SUBDIR+= games
54.endif
55.if exists(${.CURDIR}/gnu)
56SUBDIR+= gnu
57.endif
58.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
59    !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
60SUBDIR+= kerberosIV
61.endif
62.if exists(${.CURDIR}/libexec)
63SUBDIR+= libexec
64.endif
65.if exists(${.CURDIR}/sbin)
66SUBDIR+= sbin
67.endif
68.if exists(${.CURDIR}/share) && !defined(NOSHARE)
69SUBDIR+= share
70.endif
71.if exists(${.CURDIR}/sys)
72SUBDIR+= sys
73.endif
74.if exists(${.CURDIR}/usr.bin)
75SUBDIR+= usr.bin
76.endif
77.if exists(${.CURDIR}/usr.sbin)
78SUBDIR+= usr.sbin
79.endif
80.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
81SUBDIR+= secure
82.endif
83
84# etc must be last for "distribute" to work
85.if exists(${.CURDIR}/etc)
86SUBDIR+= etc
87.endif
88
89# These are last, since it is nice to at least get the base system
90# rebuilt before you do them.
91.if defined(LOCAL_DIRS)
92.for _DIR in ${LOCAL_DIRS}
93.if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
94SUBDIR+= ${_DIR}
95.endif
96.endfor
97.endif
98
99.if defined(NOCLEANDIR)
100CLEANDIR=	clean cleandepend
101.else
102CLEANDIR=	cleandir
103.endif
104
105SUP?=		cvsup
106SUPFLAGS?=	-g -L 2 -P -
107
108MAKEOBJDIRPREFIX?=	/usr/obj
109TARGET_ARCH?=	${MACHINE_ARCH}
110BUILD_ARCH!=	sysctl -n hw.machine_arch
111.if ${BUILD_ARCH} == ${MACHINE_ARCH}
112OBJTREE=	${MAKEOBJDIRPREFIX}
113.else
114OBJTREE=	${MAKEOBJDIRPREFIX}/${MACHINE_ARCH}
115.endif
116WORLDTMP=	${OBJTREE}${.CURDIR}/${BUILD_ARCH}
117# /usr/games added for fortune which depend on strfile
118STRICTTMPPATH=	${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
119TMPPATH=	${STRICTTMPPATH}:${PATH}
120
121#
122# Building a world goes through the following stages
123#
124# bootstrap-tool stage [BMAKE]
125#	This stage is responsible for creating programs that
126#	are needed for backward compatibility reasons. They
127#	are not built as cross-tools.
128# build-tool stage [TMAKE]
129#	This stage is responsible for creating the object
130#	tree and building any tools that are needed during
131#	the build process.
132# cross-tool stage [XMAKE]
133#	This stage is responsible for creating any tools that
134#	are needed for cross-builds. A cross-compiler is one
135#	of them.
136# world stage [WMAKE]
137#	This stage actually builds the world.
138# install stage (optional) [IMAKE]
139#	This stage installs a previously built world.
140#
141
142# Common environment for bootstrap related stages
143BOOTSTRAPENV=	MAKEOBJDIRPREFIX=${WORLDTMP} \
144		DESTDIR=${WORLDTMP} \
145		MACHINE_ARCH=${BUILD_ARCH} \
146		TOOLS_PREFIX=${WORLDTMP} \
147		PATH=${TMPPATH}
148
149# Common environment for world related stages
150CROSSENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
151		COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
152		LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib \
153		OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
154		PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.00503
155
156# bootstrap-tool stage
157BMAKEENV=	${BOOTSTRAPENV}
158BMAKE=		${BMAKEENV} ${MAKE} -f Makefile.inc1 -DNOMAN -DNOINFO -DNOHTML
159
160# build-tool stage
161TMAKEENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
162		PATH=${TMPPATH}
163TMAKE=		${TMAKEENV} ${MAKE} -f Makefile.inc1
164
165# cross-tool stage
166XMAKEENV=	${BOOTSTRAPENV} \
167		TARGET_ARCH=${MACHINE_ARCH}
168XMAKE=		${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNOMAN -DNOINFO -DNOHTML \
169		-DNO_FORTRAN -DNO_GDB
170
171# world stage
172WMAKEENV=	${CROSSENV} \
173		DESTDIR=${WORLDTMP} \
174		PATH=${TMPPATH}
175WMAKE=		${WMAKEENV} ${MAKE} -f Makefile.inc1
176
177# install stage
178IMAKEENV=	${CROSSENV}
179IMAKE=		${IMAKEENV} ${MAKE} -f Makefile.inc1
180
181USRDIRS=	usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
182		usr/libexec/${OBJFORMAT} usr/sbin usr/share/misc
183
184.if ${MACHINE_ARCH} == "i386" && ${MACHINE} == "pc98"
185USRDIRS+=	usr/libexec/aout
186.endif
187
188INCDIRS=	arpa g++/std objc protocols readline rpc rpcsvc openssl \
189		security ss
190
191#
192# buildworld
193#
194# Attempt to rebuild the entire system, with reasonable chance of
195# success, regardless of how old your existing system is.
196#
197buildworld:
198	@echo
199	@echo "--------------------------------------------------------------"
200	@echo ">>> Rebuilding the temporary build tree"
201	@echo "--------------------------------------------------------------"
202.if !defined(NOCLEAN)
203	rm -rf ${WORLDTMP}
204.else
205	for dir in bin games include lib sbin; do \
206		rm -rf ${WORLDTMP}/usr/$$dir; \
207	done
208	rm -f ${WORLDTMP}/sys
209.endif
210.for _dir in ${USRDIRS}
211	mkdir -p ${WORLDTMP}/${_dir}
212.endfor
213.for _dir in ${INCDIRS}
214	mkdir -p ${WORLDTMP}/usr/include/${_dir}
215.endfor
216	ln -sf ${.CURDIR}/sys ${WORLDTMP}/sys
217	@echo
218	@echo "--------------------------------------------------------------"
219	@echo ">>> stage 1: bootstrap tools"
220	@echo "--------------------------------------------------------------"
221	cd ${.CURDIR}; ${BMAKE} bootstrap-tools
222.if !defined(NOCLEAN)
223	@echo
224	@echo "--------------------------------------------------------------"
225	@echo ">>> stage 2: cleaning up the object tree"
226	@echo "--------------------------------------------------------------"
227	cd ${.CURDIR}; ${TMAKE} ${CLEANDIR:S/^/par-/}
228.endif
229	@echo
230	@echo "--------------------------------------------------------------"
231	@echo ">>> stage 2: rebuilding the object tree"
232	@echo "--------------------------------------------------------------"
233	cd ${.CURDIR}; ${TMAKE} par-obj
234	@echo
235	@echo "--------------------------------------------------------------"
236	@echo ">>> stage 2: build tools"
237	@echo "--------------------------------------------------------------"
238	cd ${.CURDIR}; ${TMAKE} build-tools
239	@echo
240	@echo "--------------------------------------------------------------"
241	@echo ">>> stage 3: cross tools"
242	@echo "--------------------------------------------------------------"
243	cd ${.CURDIR}; ${XMAKE} cross-tools
244	@echo
245	@echo "--------------------------------------------------------------"
246	@echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
247	@echo "--------------------------------------------------------------"
248	cd ${.CURDIR}; ${WMAKE} SHARED=symlinks includes
249	@echo
250	@echo "--------------------------------------------------------------"
251	@echo ">>> stage 4: building libraries"
252	@echo "--------------------------------------------------------------"
253	cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN libraries
254	@echo
255	@echo "--------------------------------------------------------------"
256	@echo ">>> stage 4: make dependencies"
257	@echo "--------------------------------------------------------------"
258	cd ${.CURDIR}; ${WMAKE} par-depend
259	@echo
260	@echo "--------------------------------------------------------------"
261	@echo ">>> stage 4: building everything.."
262	@echo "--------------------------------------------------------------"
263	cd ${.CURDIR}; ${WMAKE} all
264
265everything:
266	@echo "--------------------------------------------------------------"
267	@echo ">>> Building everything.."
268	@echo "--------------------------------------------------------------"
269	cd ${.CURDIR}; ${WMAKE} all
270
271#
272# installworld
273#
274# Installs everything compiled by a 'buildworld'.
275#
276installworld:
277	cd ${.CURDIR}; ${IMAKE} reinstall
278
279#
280# reinstall
281#
282# If you have a build server, you can NFS mount the source and obj directories
283# and do a 'make reinstall' on the *client* to install new binaries from the
284# most recent server build.
285#
286reinstall:
287	@echo "--------------------------------------------------------------"
288	@echo ">>> Making hierarchy"
289	@echo "--------------------------------------------------------------"
290	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
291	@echo
292	@echo "--------------------------------------------------------------"
293	@echo ">>> Installing everything.."
294	@echo "--------------------------------------------------------------"
295	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
296.if !defined(NOMAN)
297	@echo
298	@echo "--------------------------------------------------------------"
299	@echo ">>> Rebuilding man page indices"
300	@echo "--------------------------------------------------------------"
301	cd ${.CURDIR}/share/man; ${MAKE} makedb
302.endif
303
304#
305# buildkernel and installkernel
306#
307# Which kernels to build and/or install is specified by setting
308# KERNEL. If not defined a GENERIC kernel is built/installed.
309# Only the existing (depending MACHINE) config files are used
310# for building kernels and only the first of these is designated
311# as the one being installed.
312#
313# Note that we have to use MACHINE instead of MACHINE_ARCH when
314# we're in kernel-land. Since only MACHINE_ARCH is (expected) to
315# be set to cross-build, we have to make sure MACHINE is set
316# properly.
317
318KERNEL?=	GENERIC GENERIC98
319
320# The only exotic MACHINE_ARCH/MACHINE combination valid at this
321# time is i386/pc98. In all other cases set MACHINE equal to
322# MACHINE_ARCH.
323.if ${MACHINE_ARCH} != "i386" || ${MACHINE} != "pc98"
324MACHINE=	${MACHINE_ARCH}
325.endif
326
327KRNLSRCDIR=	${.CURDIR}/sys
328KRNLCONFDIR=	${KRNLSRCDIR}/${MACHINE}/conf
329KRNLOBJDIR=	${OBJTREE}${KRNLSRCDIR}
330
331.if !defined(NOCLEAN)
332CONFIGARGS+=	-r
333.endif
334
335BUILDKERNELS=
336INSTALLKERNEL=
337.for _kernel in ${KERNEL}
338.if exists(${KRNLCONFDIR}/${_kernel})
339BUILDKERNELS+=	${_kernel}
340.if empty(INSTALLKERNEL)
341INSTALLKERNEL= ${_kernel}
342.endif
343.endif
344.endfor
345
346#
347# buildkernel
348#
349# Builds all kernels defined by BUILDKERNELS.
350#
351buildkernel:
352	@echo
353	@echo "--------------------------------------------------------------"
354	@echo ">>> Rebuilding kernel(s)"
355	@echo "--------------------------------------------------------------"
356.for _kernel in ${BUILDKERNELS}
357	@echo "===> ${_kernel}"
358	cd ${KRNLCONFDIR}; \
359		PATH=${TMPPATH} \
360		    config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} ${_kernel}
361	cd ${KRNLOBJDIR}/${_kernel}; \
362		MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx \
363		    ${MAKE} -f ${KRNLSRCDIR}/dev/aic7xxx/Makefile; \
364		${WMAKEENV} MACHINE=${MACHINE} ${MAKE} depend; \
365		${WMAKEENV} MACHINE=${MACHINE} ${MAKE} all
366.endfor
367
368#
369# installkernel
370#
371# Install the kernel defined by INSTALLKERNEL
372#
373installkernel:
374	cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
375		${WMAKEENV} MACHINE=${MACHINE} ${MAKE} install
376
377#
378# update
379#
380# Update the source tree, by running sup and/or running cvs to update to the
381# latest copy.
382#
383update:
384.if defined(SUP_UPDATE)
385	@echo "--------------------------------------------------------------"
386	@echo ">>> Running ${SUP}"
387	@echo "--------------------------------------------------------------"
388.if defined(SUPFILE)
389	@${SUP} ${SUPFLAGS} ${SUPFILE}
390.endif
391.if defined(SUPFILE1)
392	@${SUP} ${SUPFLAGS} ${SUPFILE1}
393.endif
394.if defined(SUPFILE2)
395	@${SUP} ${SUPFLAGS} ${SUPFILE2}
396.endif
397.if defined(PORTSSUPFILE)
398	@${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
399.endif
400.endif
401.if defined(CVS_UPDATE)
402	@echo "--------------------------------------------------------------"
403	@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
404	@echo "--------------------------------------------------------------"
405	cd ${.CURDIR}; cvs -q update -P -d
406.endif
407
408#
409# most
410#
411# Build most of the user binaries on the existing system libs and includes.
412#
413most:
414	@echo "--------------------------------------------------------------"
415	@echo ">>> Building programs only"
416	@echo "--------------------------------------------------------------"
417	cd ${.CURDIR}/bin;		${MAKE} all
418	cd ${.CURDIR}/sbin;		${MAKE} all
419	cd ${.CURDIR}/libexec;		${MAKE} all
420	cd ${.CURDIR}/usr.bin;		${MAKE} all
421	cd ${.CURDIR}/usr.sbin;		${MAKE} all
422	cd ${.CURDIR}/gnu/libexec;	${MAKE} all
423	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} all
424	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} all
425
426#
427# installmost
428#
429# Install the binaries built by the 'most' target.  This does not include
430# libraries or include files.
431#
432installmost:
433	@echo "--------------------------------------------------------------"
434	@echo ">>> Installing programs only"
435	@echo "--------------------------------------------------------------"
436	cd ${.CURDIR}/bin;		${MAKE} install
437	cd ${.CURDIR}/sbin;		${MAKE} install
438	cd ${.CURDIR}/libexec;		${MAKE} install
439	cd ${.CURDIR}/usr.bin;		${MAKE} install
440	cd ${.CURDIR}/usr.sbin;		${MAKE} install
441	cd ${.CURDIR}/gnu/libexec;	${MAKE} install
442	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} install
443	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} install
444
445#
446# ------------------------------------------------------------------------
447#
448# From here onwards are utility targets used by the 'make world' and
449# related targets.  If your 'world' breaks, you may like to try to fix
450# the problem and manually run the following targets to attempt to
451# complete the build.  Beware, this is *not* guaranteed to work, you
452# need to have a pretty good grip on the current state of the system
453# to attempt to manually finish it.  If in doubt, 'make world' again.
454#
455
456#
457# bootstrap-tools: Build tools needed for compatibility
458#
459.if exists(${.CURDIR}/games) && !defined(NOGAMES)
460_strfile=	games/fortune/strfile
461.endif
462
463bootstrap-tools:
464.for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef usr.sbin/config \
465    gnu/usr.bin/bison
466	cd ${.CURDIR}/${_tool}; \
467		${MAKE} obj; \
468		${MAKE} depend; \
469		${MAKE} all; \
470		${MAKE} install
471.endfor
472
473#
474# build-tools: Build special purpose build tools
475#
476.if exists(${.CURDIR}/games) && !defined(NOGAMES)
477_games=	games/adventure games/hack games/phantasia
478.endif
479
480.if exists(${.CURDIR}/share) && !defined(NOSHARE)
481_share=	share/syscons/scrnmaps
482.endif
483
484.if !defined(NO_FORTRAN)
485_fortran= gnu/usr.bin/cc/f771
486.endif
487
488.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
489    !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
490_libroken= kerberosIV/lib/libroken
491.endif
492
493build-tools:
494.for _tool in bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \
495    ${_libroken} lib/libncurses ${_share}
496	cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
497.endfor
498
499#
500# cross-tools: Build cross-building tools
501#
502# WARNING: Because the bootstrap tools are expected to run on the
503# build-machine, MACHINE_ARCH is *always* set to BUILD_ARCH when this
504# target is being made. TARGET_ARCH is *always* set to reflect the
505# target-machine (which you can set by specifying MACHINE_ARCH on
506# make's command-line, get it?).
507# The reason is simple: we build these tools not to be run on the
508# architecture we're cross-building, but on the architecture we're
509# currently building on (ie the host-machine) and we expect these
510# tools to produce output for the architecture we're trying to
511# cross-build.
512#
513.if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
514_elf2exe=	usr.sbin/elf2exe
515.endif
516
517.if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
518_btxld=	usr.sbin/btxld
519.endif
520
521# XXX - MACHINE should actually be TARGET. But we don't set that...
522.if ${TARGET_ARCH} == "i386" && ${MACHINE} == "pc98"
523_aout_tools=	usr.bin/size usr.bin/strip gnu/usr.bin/as gnu/usr.bin/ld
524.endif
525
526cross-tools:
527.for _tool in ${_aout_tools} ${_btxld} ${_elf2exe} usr.bin/genassym \
528    usr.bin/gensetdefs gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc
529	cd ${.CURDIR}/${_tool}; \
530		${MAKE} obj; \
531		${MAKE} depend; \
532		${MAKE} all; \
533		${MAKE} install
534.endfor
535
536#
537# hierarchy - ensure that all the needed directories are present
538#
539hierarchy:
540	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
541
542#
543# includes - possibly generate and install the include files.
544#
545includes:
546	cd ${.CURDIR}/include;			${MAKE} -B all install
547	cd ${.CURDIR}/gnu/include;		${MAKE} install
548	cd ${.CURDIR}/gnu/lib/libmp;		${MAKE} beforeinstall
549	cd ${.CURDIR}/gnu/lib/libobjc;		${MAKE} beforeinstall
550	cd ${.CURDIR}/gnu/lib/libreadline;	${MAKE} beforeinstall
551	cd ${.CURDIR}/gnu/lib/libregex;		${MAKE} beforeinstall
552	cd ${.CURDIR}/gnu/lib/libstdc++;	${MAKE} beforeinstall
553	cd ${.CURDIR}/gnu/lib/libdialog;	${MAKE} beforeinstall
554	cd ${.CURDIR}/gnu/lib/libgmp;		${MAKE} beforeinstall
555	cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus;	${MAKE} beforeinstall
556.if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
557.if exists(${.CURDIR}/secure/lib/libcrypto)
558	cd ${.CURDIR}/secure/lib/libcrypto;	${MAKE} beforeinstall
559.endif
560	cd ${.CURDIR}/secure/lib/libdes;	${MAKE} beforeinstall
561.if exists(${.CURDIR}/secure/lib/libssl)
562	cd ${.CURDIR}/secure/lib/libssl;	${MAKE} beforeinstall
563.endif
564.endif
565.if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
566    defined(MAKE_KERBEROS4)
567	cd ${.CURDIR}/kerberosIV/lib/libacl;	${MAKE} beforeinstall
568	cd ${.CURDIR}/kerberosIV/lib/libkadm;	${MAKE} beforeinstall
569	cd ${.CURDIR}/kerberosIV/lib/libkafs;	${MAKE} beforeinstall
570	cd ${.CURDIR}/kerberosIV/lib/libkdb;	${MAKE} beforeinstall
571	cd ${.CURDIR}/kerberosIV/lib/libkrb;	${MAKE} beforeinstall
572	cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
573.else
574	cd ${.CURDIR}/lib/libtelnet;		${MAKE} beforeinstall
575.endif
576.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
577	cd ${.CURDIR}/lib/csu/${MACHINE_ARCH};	${MAKE} beforeinstall
578.endif
579	cd ${.CURDIR}/lib/libalias;		${MAKE} beforeinstall
580	cd ${.CURDIR}/lib/libatm;		${MAKE} beforeinstall
581	cd ${.CURDIR}/lib/libdevstat;		${MAKE} beforeinstall
582	cd ${.CURDIR}/lib/libc;			${MAKE} beforeinstall
583	cd ${.CURDIR}/lib/libcalendar;		${MAKE} beforeinstall
584	cd ${.CURDIR}/lib/libcam;		${MAKE} beforeinstall
585	cd ${.CURDIR}/lib/libdisk;		${MAKE} beforeinstall
586	cd ${.CURDIR}/lib/libedit;		${MAKE} beforeinstall
587	cd ${.CURDIR}/lib/libftpio;		${MAKE} beforeinstall
588	cd ${.CURDIR}/lib/libkvm;		${MAKE} beforeinstall
589	cd ${.CURDIR}/lib/libmd;		${MAKE} beforeinstall
590.if !defined(WANT_CSRG_LIBM)
591	cd ${.CURDIR}/lib/msun;			${MAKE} beforeinstall
592.endif
593	cd ${.CURDIR}/lib/libncp;		${MAKE} beforeinstall
594	cd ${.CURDIR}/lib/libncurses;		${MAKE} beforeinstall
595	cd ${.CURDIR}/lib/libnetgraph;		${MAKE} beforeinstall
596	cd ${.CURDIR}/lib/libopie;		${MAKE} beforeinstall
597	cd ${.CURDIR}/lib/libpam/libpam;	${MAKE} beforeinstall
598	cd ${.CURDIR}/lib/libpcap;		${MAKE} beforeinstall
599	cd ${.CURDIR}/lib/libradius;		${MAKE} beforeinstall
600	cd ${.CURDIR}/lib/librpcsvc;		${MAKE} beforeinstall
601	cd ${.CURDIR}/lib/libskey;		${MAKE} beforeinstall
602	cd ${.CURDIR}/lib/libstand;		${MAKE} beforeinstall
603	cd ${.CURDIR}/lib/libtacplus;		${MAKE} beforeinstall
604	cd ${.CURDIR}/lib/libcom_err;		${MAKE} beforeinstall
605	cd ${.CURDIR}/lib/libss;		${MAKE} -B hdrs beforeinstall
606	cd ${.CURDIR}/lib/libutil;		${MAKE} beforeinstall
607	cd ${.CURDIR}/lib/libvgl;		${MAKE} beforeinstall
608	cd ${.CURDIR}/lib/libwrap;		${MAKE} beforeinstall
609	cd ${.CURDIR}/lib/libz;			${MAKE} beforeinstall
610	cd ${.CURDIR}/usr.bin/lex;		${MAKE} beforeinstall
611
612#
613# libraries - build all libraries, and install them under ${DESTDIR}.
614#
615# The following dependencies exist between the libraries:
616#
617# lib*: csu
618# libatm: libmd
619# libcrypt: libmd
620# libdialog: libncurses
621# libedit: libncurses
622# libg++: libm
623# libkrb: libcrypt
624# libopie: libmd
625# libpam: libcom_err libcrypt libdes libgcc_pic libkrb libradius libskey \
626#	  libtacplus libutil
627# libradius: libmd
628# libreadline: libncurses
629# libskey: libcrypt libmd
630# libss: libcom_err
631# libstc++: libm
632# libtacplus: libmd
633#
634# Across directories this comes down to (rougly):
635#
636# gnu/lib: lib/libm lib/libncurses
637# kerberosIV/lib: lib/libcrypt
638# lib/libpam: secure/lib/libdes kerberosIV/lib/libkrb gnu/lib/libgcc
639# secure/lib: lib/libmd
640#
641.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
642_csu=	lib/csu/${MACHINE_ARCH}.pcc
643.elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf"
644_csu=	lib/csu/i386-elf
645.else
646_csu=	lib/csu/${MACHINE_ARCH}
647.endif
648
649.if !defined(NOSECURE) && !defined(NOCRYPT)
650_secure_lib=	secure/lib
651.endif
652
653.if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
654_kerberosIV_lib=	kerberosIV/lib
655.endif
656
657.if defined(WANT_CSRG_LIBM)
658_libm=	lib/libm
659.else
660_libm=	lib/msun
661.endif
662
663.if !defined(NOPERL)
664_libperl=	gnu/usr.bin/perl/libperl
665.endif
666
667.if ${MACHINE_ARCH} == "i386"
668_libkeycap=	usr.sbin/pcvt/keycap
669.endif
670
671libraries:
672.for _lib in ${_csu} lib/libmd lib/libcrypt ${_secure_lib} ${_kerberosIV_lib} \
673    gnu/lib/libgcc lib/libcom_err ${_libm} lib/libncurses lib/libradius \
674    lib/libskey lib/libtacplus lib/libutil lib gnu/lib ${_libperl} \
675    usr.bin/lex/lib ${_libkeycap}
676.if exists(${.CURDIR}/${_lib})
677	cd ${.CURDIR}/${_lib}; \
678		${MAKE} depend; \
679		${MAKE} all; \
680		${MAKE} install
681.endif
682.endfor
683
684.for __target in clean cleandepend cleandir depend obj
685.for entry in ${SUBDIR}
686${entry}.${__target}__D: .PHONY
687	@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
688		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
689		edir=${entry}.${MACHINE_ARCH}; \
690		cd ${.CURDIR}/$${edir}; \
691	else \
692		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
693		edir=${entry}; \
694		cd ${.CURDIR}/$${edir}; \
695	fi; \
696	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
697.endfor
698par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
699.endfor
700
701.include <bsd.subdir.mk>
702