Makefile.inc1 revision 56263
1#
2# $FreeBSD: head/Makefile.inc1 56263 2000-01-19 04:03:48Z kris $
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		INSTALL="sh ${.CURDIR}/tools/install.sh" \
146		MACHINE_ARCH=${BUILD_ARCH} \
147		TOOLS_PREFIX=${WORLDTMP} \
148		PATH=${TMPPATH}
149
150# Common environment for world related stages
151CROSSENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
152		COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
153		LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib \
154		OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
155		PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.00503
156
157# bootstrap-tool stage
158BMAKEENV=	${BOOTSTRAPENV}
159BMAKE=		${BMAKEENV} ${MAKE} -f Makefile.inc1 -DNOMAN -DNOINFO -DNOHTML
160
161# build-tool stage
162TMAKEENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
163		INSTALL="sh ${.CURDIR}/tools/install.sh" \
164		PATH=${TMPPATH}
165TMAKE=		${TMAKEENV} ${MAKE} -f Makefile.inc1
166
167# cross-tool stage
168XMAKEENV=	${BOOTSTRAPENV} \
169		TARGET_ARCH=${MACHINE_ARCH}
170XMAKE=		${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNOMAN -DNOINFO -DNOHTML \
171		-DNO_FORTRAN -DNO_GDB
172
173# world stage
174WMAKEENV=	${CROSSENV} \
175		DESTDIR=${WORLDTMP} \
176		INSTALL="sh ${.CURDIR}/tools/install.sh" \
177		PATH=${TMPPATH}
178WMAKE=		${WMAKEENV} ${MAKE} -f Makefile.inc1
179
180# install stage
181IMAKEENV=	${CROSSENV}
182IMAKE=		${IMAKEENV} ${MAKE} -f Makefile.inc1
183
184USRDIRS=	usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
185		usr/libexec/${OBJFORMAT} usr/sbin usr/share/misc
186
187.if ${MACHINE_ARCH} == "i386" && ${MACHINE} == "pc98"
188USRDIRS+=	usr/libexec/aout
189.endif
190
191INCDIRS=	arpa g++/std objc protocols readline rpc rpcsvc openssl \
192		security ss
193
194#
195# buildworld
196#
197# Attempt to rebuild the entire system, with reasonable chance of
198# success, regardless of how old your existing system is.
199#
200buildworld:
201.if !defined(NOSECURE) && exists(${.CURDIR}/secure) && \
202	(!defined(USA_RESIDENT) || (${USA_RESIDENT} != NO && \
203	${USA_RESIDENT} != YES))
204	@echo
205	@echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
206	@echo ">>> You must define the value of USA_RESIDENT as 'YES' or"
207	@echo ">>> 'NO' as appropriate, in the environment or /etc/make.conf"
208	@echo ">>> before building can proceed."
209	@echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
210	@/usr/bin/false
211.endif
212
213	@echo
214	@echo "--------------------------------------------------------------"
215	@echo ">>> Rebuilding the temporary build tree"
216	@echo "--------------------------------------------------------------"
217.if !defined(NOCLEAN)
218	rm -rf ${WORLDTMP}
219.else
220	for dir in bin games include lib sbin; do \
221		rm -rf ${WORLDTMP}/usr/$$dir; \
222	done
223	rm -f ${WORLDTMP}/sys
224	# XXX - Work-around for broken cc/cc_tools/Makefile.
225	# This is beyond dirty...
226	rm -f ${OBJTREE}${.CURDIR}/gnu/usr.bin/cc/cc_tools/.depend
227.endif
228.for _dir in ${USRDIRS}
229	mkdir -p ${WORLDTMP}/${_dir}
230.endfor
231.for _dir in ${INCDIRS}
232	mkdir -p ${WORLDTMP}/usr/include/${_dir}
233.endfor
234	ln -sf ${.CURDIR}/sys ${WORLDTMP}/sys
235	@echo
236	@echo "--------------------------------------------------------------"
237	@echo ">>> stage 1: bootstrap tools"
238	@echo "--------------------------------------------------------------"
239	cd ${.CURDIR}; ${BMAKE} bootstrap-tools
240.if !defined(NOCLEAN)
241	@echo
242	@echo "--------------------------------------------------------------"
243	@echo ">>> stage 2: cleaning up the object tree"
244	@echo "--------------------------------------------------------------"
245	cd ${.CURDIR}; ${TMAKE} ${CLEANDIR:S/^/par-/}
246.endif
247	@echo
248	@echo "--------------------------------------------------------------"
249	@echo ">>> stage 2: rebuilding the object tree"
250	@echo "--------------------------------------------------------------"
251	cd ${.CURDIR}; ${TMAKE} par-obj
252	@echo
253	@echo "--------------------------------------------------------------"
254	@echo ">>> stage 2: build tools"
255	@echo "--------------------------------------------------------------"
256	cd ${.CURDIR}; ${TMAKE} build-tools
257	@echo
258	@echo "--------------------------------------------------------------"
259	@echo ">>> stage 3: cross tools"
260	@echo "--------------------------------------------------------------"
261	cd ${.CURDIR}; ${XMAKE} cross-tools
262	@echo
263	@echo "--------------------------------------------------------------"
264	@echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
265	@echo "--------------------------------------------------------------"
266	cd ${.CURDIR}; ${WMAKE} SHARED=symlinks includes
267	@echo
268	@echo "--------------------------------------------------------------"
269	@echo ">>> stage 4: building libraries"
270	@echo "--------------------------------------------------------------"
271	cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN libraries
272	@echo
273	@echo "--------------------------------------------------------------"
274	@echo ">>> stage 4: make dependencies"
275	@echo "--------------------------------------------------------------"
276	cd ${.CURDIR}; ${WMAKE} par-depend
277	@echo
278	@echo "--------------------------------------------------------------"
279	@echo ">>> stage 4: building everything.."
280	@echo "--------------------------------------------------------------"
281	cd ${.CURDIR}; ${WMAKE} all
282
283everything:
284	@echo "--------------------------------------------------------------"
285	@echo ">>> Building everything.."
286	@echo "--------------------------------------------------------------"
287	cd ${.CURDIR}; ${WMAKE} all
288
289#
290# installworld
291#
292# Installs everything compiled by a 'buildworld'.
293#
294installworld:
295	cd ${.CURDIR}; ${IMAKE} reinstall
296
297#
298# reinstall
299#
300# If you have a build server, you can NFS mount the source and obj directories
301# and do a 'make reinstall' on the *client* to install new binaries from the
302# most recent server build.
303#
304reinstall:
305	@echo "--------------------------------------------------------------"
306	@echo ">>> Making hierarchy"
307	@echo "--------------------------------------------------------------"
308	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
309	@echo
310	@echo "--------------------------------------------------------------"
311	@echo ">>> Installing everything.."
312	@echo "--------------------------------------------------------------"
313	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
314.if !defined(NOMAN)
315	@echo
316	@echo "--------------------------------------------------------------"
317	@echo ">>> Rebuilding man page indices"
318	@echo "--------------------------------------------------------------"
319	cd ${.CURDIR}/share/man; ${MAKE} makedb
320.endif
321
322#
323# buildkernel and installkernel
324#
325# Which kernels to build and/or install is specified by setting
326# KERNEL. If not defined a GENERIC kernel is built/installed.
327# Only the existing (depending MACHINE) config files are used
328# for building kernels and only the first of these is designated
329# as the one being installed.
330#
331# Note that we have to use MACHINE instead of MACHINE_ARCH when
332# we're in kernel-land. Since only MACHINE_ARCH is (expected) to
333# be set to cross-build, we have to make sure MACHINE is set
334# properly.
335
336KERNEL?=	GENERIC GENERIC98
337
338# The only exotic MACHINE_ARCH/MACHINE combination valid at this
339# time is i386/pc98. In all other cases set MACHINE equal to
340# MACHINE_ARCH.
341.if ${MACHINE_ARCH} != "i386" || ${MACHINE} != "pc98"
342MACHINE=	${MACHINE_ARCH}
343.endif
344
345KRNLSRCDIR=	${.CURDIR}/sys
346KRNLCONFDIR=	${KRNLSRCDIR}/${MACHINE}/conf
347KRNLOBJDIR=	${OBJTREE}${KRNLSRCDIR}
348
349.if !defined(NOCLEAN)
350CONFIGARGS+=	-r
351.endif
352
353BUILDKERNELS=
354INSTALLKERNEL=
355.for _kernel in ${KERNEL}
356.if exists(${KRNLCONFDIR}/${_kernel})
357BUILDKERNELS+=	${_kernel}
358.if empty(INSTALLKERNEL)
359INSTALLKERNEL= ${_kernel}
360.endif
361.endif
362.endfor
363
364#
365# buildkernel
366#
367# Builds all kernels defined by BUILDKERNELS.
368#
369buildkernel:
370	@echo
371	@echo "--------------------------------------------------------------"
372	@echo ">>> Rebuilding kernel(s)"
373	@echo "--------------------------------------------------------------"
374.for _kernel in ${BUILDKERNELS}
375	@echo "===> ${_kernel}"
376	cd ${KRNLCONFDIR}; \
377		PATH=${TMPPATH} \
378		    config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} ${_kernel}
379	cd ${KRNLOBJDIR}/${_kernel}; \
380		MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx \
381		    ${MAKE} -f ${KRNLSRCDIR}/dev/aic7xxx/Makefile; \
382		${WMAKEENV} MACHINE=${MACHINE} ${MAKE} depend; \
383		${WMAKEENV} MACHINE=${MACHINE} ${MAKE} all
384.endfor
385
386#
387# installkernel
388#
389# Install the kernel defined by INSTALLKERNEL
390#
391installkernel:
392	cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
393		${IMAKEENV} MACHINE=${MACHINE} ${MAKE} install
394
395#
396# update
397#
398# Update the source tree, by running sup and/or running cvs to update to the
399# latest copy.
400#
401update:
402.if defined(SUP_UPDATE)
403	@echo "--------------------------------------------------------------"
404	@echo ">>> Running ${SUP}"
405	@echo "--------------------------------------------------------------"
406.if defined(SUPFILE)
407	@${SUP} ${SUPFLAGS} ${SUPFILE}
408.endif
409.if defined(SUPFILE1)
410	@${SUP} ${SUPFLAGS} ${SUPFILE1}
411.endif
412.if defined(SUPFILE2)
413	@${SUP} ${SUPFLAGS} ${SUPFILE2}
414.endif
415.if defined(PORTSSUPFILE)
416	@${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
417.endif
418.endif
419.if defined(CVS_UPDATE)
420	@echo "--------------------------------------------------------------"
421	@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
422	@echo "--------------------------------------------------------------"
423	cd ${.CURDIR}; cvs -q update -P -d
424.endif
425
426#
427# most
428#
429# Build most of the user binaries on the existing system libs and includes.
430#
431most:
432	@echo "--------------------------------------------------------------"
433	@echo ">>> Building programs only"
434	@echo "--------------------------------------------------------------"
435	cd ${.CURDIR}/bin;		${MAKE} all
436	cd ${.CURDIR}/sbin;		${MAKE} all
437	cd ${.CURDIR}/libexec;		${MAKE} all
438	cd ${.CURDIR}/usr.bin;		${MAKE} all
439	cd ${.CURDIR}/usr.sbin;		${MAKE} all
440	cd ${.CURDIR}/gnu/libexec;	${MAKE} all
441	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} all
442	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} all
443
444#
445# installmost
446#
447# Install the binaries built by the 'most' target.  This does not include
448# libraries or include files.
449#
450installmost:
451	@echo "--------------------------------------------------------------"
452	@echo ">>> Installing programs only"
453	@echo "--------------------------------------------------------------"
454	cd ${.CURDIR}/bin;		${MAKE} install
455	cd ${.CURDIR}/sbin;		${MAKE} install
456	cd ${.CURDIR}/libexec;		${MAKE} install
457	cd ${.CURDIR}/usr.bin;		${MAKE} install
458	cd ${.CURDIR}/usr.sbin;		${MAKE} install
459	cd ${.CURDIR}/gnu/libexec;	${MAKE} install
460	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} install
461	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} install
462
463#
464# ------------------------------------------------------------------------
465#
466# From here onwards are utility targets used by the 'make world' and
467# related targets.  If your 'world' breaks, you may like to try to fix
468# the problem and manually run the following targets to attempt to
469# complete the build.  Beware, this is *not* guaranteed to work, you
470# need to have a pretty good grip on the current state of the system
471# to attempt to manually finish it.  If in doubt, 'make world' again.
472#
473
474#
475# bootstrap-tools: Build tools needed for compatibility
476#
477.if exists(${.CURDIR}/games) && !defined(NOGAMES)
478_strfile=	games/fortune/strfile
479.endif
480
481bootstrap-tools:
482.for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef usr.sbin/config \
483    gnu/usr.bin/texinfo
484	cd ${.CURDIR}/${_tool}; \
485		${MAKE} obj; \
486		${MAKE} depend; \
487		${MAKE} all; \
488		${MAKE} install
489.endfor
490
491#
492# build-tools: Build special purpose build tools
493#
494.if exists(${.CURDIR}/games) && !defined(NOGAMES)
495_games=	games/adventure games/hack games/phantasia
496.endif
497
498.if exists(${.CURDIR}/share) && !defined(NOSHARE)
499_share=	share/syscons/scrnmaps
500.endif
501
502.if !defined(NO_FORTRAN)
503_fortran= gnu/usr.bin/cc/f771
504.endif
505
506.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
507    !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
508_libroken= kerberosIV/lib/libroken
509.endif
510
511build-tools:
512.for _tool in bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \
513    ${_libroken} lib/libncurses ${_share}
514	cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
515.endfor
516
517#
518# cross-tools: Build cross-building tools
519#
520# WARNING: Because the bootstrap tools are expected to run on the
521# build-machine, MACHINE_ARCH is *always* set to BUILD_ARCH when this
522# target is being made. TARGET_ARCH is *always* set to reflect the
523# target-machine (which you can set by specifying MACHINE_ARCH on
524# make's command-line, get it?).
525# The reason is simple: we build these tools not to be run on the
526# architecture we're cross-building, but on the architecture we're
527# currently building on (ie the host-machine) and we expect these
528# tools to produce output for the architecture we're trying to
529# cross-build.
530#
531.if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
532_elf2exe=	usr.sbin/elf2exe
533.endif
534
535.if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
536_btxld=	usr.sbin/btxld
537.endif
538
539# XXX - MACHINE should actually be TARGET. But we don't set that...
540.if ${TARGET_ARCH} == "i386" && ${MACHINE} == "pc98"
541_aout_tools=	usr.bin/size usr.bin/strip gnu/usr.bin/as gnu/usr.bin/ld
542.endif
543
544cross-tools:
545.for _tool in ${_aout_tools} ${_btxld} ${_elf2exe} usr.bin/genassym \
546    usr.bin/gensetdefs gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc
547	cd ${.CURDIR}/${_tool}; \
548		${MAKE} obj; \
549		${MAKE} depend; \
550		${MAKE} all; \
551		${MAKE} install
552.endfor
553
554#
555# hierarchy - ensure that all the needed directories are present
556#
557hierarchy:
558	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
559
560#
561# includes - possibly generate and install the include files.
562#
563includes:
564	cd ${.CURDIR}/include;			${MAKE} -B all install
565	cd ${.CURDIR}/gnu/include;		${MAKE} install
566	cd ${.CURDIR}/gnu/lib/libmp;		${MAKE} beforeinstall
567	cd ${.CURDIR}/gnu/lib/libobjc;		${MAKE} beforeinstall
568	cd ${.CURDIR}/gnu/lib/libreadline;	${MAKE} beforeinstall
569	cd ${.CURDIR}/gnu/lib/libregex;		${MAKE} beforeinstall
570	cd ${.CURDIR}/gnu/lib/libstdc++;	${MAKE} beforeinstall
571	cd ${.CURDIR}/gnu/lib/libdialog;	${MAKE} beforeinstall
572	cd ${.CURDIR}/gnu/lib/libgmp;		${MAKE} beforeinstall
573	cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus;	${MAKE} beforeinstall
574.if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
575.if exists(${.CURDIR}/secure/lib/libcrypto)
576	cd ${.CURDIR}/secure/lib/libcrypto;	${MAKE} beforeinstall
577.endif
578	cd ${.CURDIR}/secure/lib/libdes;	${MAKE} beforeinstall
579.if exists(${.CURDIR}/secure/lib/libssl)
580	cd ${.CURDIR}/secure/lib/libssl;	${MAKE} beforeinstall
581.endif
582.endif
583.if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
584    defined(MAKE_KERBEROS4)
585	cd ${.CURDIR}/kerberosIV/lib/libacl;	${MAKE} beforeinstall
586	cd ${.CURDIR}/kerberosIV/lib/libkadm;	${MAKE} beforeinstall
587	cd ${.CURDIR}/kerberosIV/lib/libkafs;	${MAKE} beforeinstall
588	cd ${.CURDIR}/kerberosIV/lib/libkdb;	${MAKE} beforeinstall
589	cd ${.CURDIR}/kerberosIV/lib/libkrb;	${MAKE} beforeinstall
590	cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
591.else
592	cd ${.CURDIR}/lib/libtelnet;		${MAKE} beforeinstall
593.endif
594.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
595	cd ${.CURDIR}/lib/csu/${MACHINE_ARCH};	${MAKE} beforeinstall
596.endif
597	cd ${.CURDIR}/lib/libalias;		${MAKE} beforeinstall
598	cd ${.CURDIR}/lib/libatm;		${MAKE} beforeinstall
599	cd ${.CURDIR}/lib/libdevstat;		${MAKE} beforeinstall
600	cd ${.CURDIR}/lib/libc;			${MAKE} beforeinstall
601	cd ${.CURDIR}/lib/libcalendar;		${MAKE} beforeinstall
602	cd ${.CURDIR}/lib/libcam;		${MAKE} beforeinstall
603	cd ${.CURDIR}/lib/libdisk;		${MAKE} beforeinstall
604	cd ${.CURDIR}/lib/libedit;		${MAKE} beforeinstall
605	cd ${.CURDIR}/lib/libftpio;		${MAKE} beforeinstall
606	cd ${.CURDIR}/lib/libkvm;		${MAKE} beforeinstall
607	cd ${.CURDIR}/lib/libmd;		${MAKE} beforeinstall
608.if !defined(WANT_CSRG_LIBM)
609	cd ${.CURDIR}/lib/msun;			${MAKE} beforeinstall
610.endif
611	cd ${.CURDIR}/lib/libncp;		${MAKE} beforeinstall
612	cd ${.CURDIR}/lib/libncurses;		${MAKE} beforeinstall
613	cd ${.CURDIR}/lib/libnetgraph;		${MAKE} beforeinstall
614	cd ${.CURDIR}/lib/libopie;		${MAKE} beforeinstall
615	cd ${.CURDIR}/lib/libpam/libpam;	${MAKE} beforeinstall
616	cd ${.CURDIR}/lib/libpcap;		${MAKE} beforeinstall
617	cd ${.CURDIR}/lib/libradius;		${MAKE} beforeinstall
618	cd ${.CURDIR}/lib/librpcsvc;		${MAKE} beforeinstall
619	cd ${.CURDIR}/lib/libskey;		${MAKE} beforeinstall
620	cd ${.CURDIR}/lib/libstand;		${MAKE} beforeinstall
621	cd ${.CURDIR}/lib/libtacplus;		${MAKE} beforeinstall
622	cd ${.CURDIR}/lib/libcom_err;		${MAKE} beforeinstall
623	cd ${.CURDIR}/lib/libss;		${MAKE} -B hdrs beforeinstall
624	cd ${.CURDIR}/lib/libutil;		${MAKE} beforeinstall
625	cd ${.CURDIR}/lib/libvgl;		${MAKE} beforeinstall
626	cd ${.CURDIR}/lib/libwrap;		${MAKE} beforeinstall
627	cd ${.CURDIR}/lib/libz;			${MAKE} beforeinstall
628	cd ${.CURDIR}/usr.bin/lex;		${MAKE} beforeinstall
629
630#
631# libraries - build all libraries, and install them under ${DESTDIR}.
632#
633# The following dependencies exist between the libraries:
634#
635# lib*: csu
636# libatm: libmd
637# libcrypt: libmd
638# libdialog: libncurses
639# libedit: libncurses
640# libg++: libm
641# libkrb: libcrypt
642# libopie: libmd
643# libpam: libcom_err libcrypt libdes libgcc_pic libkrb libradius libskey \
644#	  libtacplus libutil
645# libradius: libmd
646# libreadline: libncurses
647# libskey: libcrypt libmd
648# libss: libcom_err
649# libstc++: libm
650# libtacplus: libmd
651#
652# Across directories this comes down to (rougly):
653#
654# gnu/lib: lib/libm lib/libncurses
655# kerberosIV/lib: lib/libcrypt
656# lib/libpam: secure/lib/libdes kerberosIV/lib/libkrb gnu/lib/libgcc
657# secure/lib: lib/libmd
658#
659.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
660_csu=	lib/csu/${MACHINE_ARCH}.pcc
661.elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf"
662_csu=	lib/csu/i386-elf
663.else
664_csu=	lib/csu/${MACHINE_ARCH}
665.endif
666
667.if !defined(NOSECURE) && !defined(NOCRYPT)
668_secure_lib=	secure/lib
669.endif
670
671.if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
672_kerberosIV_lib=	kerberosIV/lib
673.endif
674
675.if defined(WANT_CSRG_LIBM)
676_libm=	lib/libm
677.else
678_libm=	lib/msun
679.endif
680
681.if !defined(NOPERL)
682_libperl=	gnu/usr.bin/perl/libperl
683.endif
684
685.if ${MACHINE_ARCH} == "i386"
686_libkeycap=	usr.sbin/pcvt/keycap
687.endif
688
689libraries:
690.for _lib in ${_csu} lib/libmd lib/libcrypt ${_secure_lib} ${_kerberosIV_lib} \
691    gnu/lib/libgcc lib/libcom_err ${_libm} lib/libncurses lib/libradius \
692    lib/libskey lib/libtacplus lib/libutil lib gnu/lib ${_libperl} \
693    usr.bin/lex/lib ${_libkeycap}
694.if exists(${.CURDIR}/${_lib})
695	cd ${.CURDIR}/${_lib}; \
696		${MAKE} depend; \
697		${MAKE} all; \
698		${MAKE} install
699.endif
700.endfor
701
702.for __target in clean cleandepend cleandir depend obj
703.for entry in ${SUBDIR}
704${entry}.${__target}__D: .PHONY
705	@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
706		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
707		edir=${entry}.${MACHINE_ARCH}; \
708		cd ${.CURDIR}/$${edir}; \
709	else \
710		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
711		edir=${entry}; \
712		cd ${.CURDIR}/$${edir}; \
713	fi; \
714	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
715.endfor
716par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
717.endfor
718
719.include <bsd.subdir.mk>
720