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