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