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