Makefile.inc1 revision 56769
1#
2# $FreeBSD: head/Makefile.inc1 56769 2000-01-28 21:15:24Z imp $
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 exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
507    !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
508_libroken4= kerberosIV/lib/libroken
509.endif
510
511.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
512    !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
513_libroken5= kerberos5/lib/libroken
514.endif
515
516build-tools:
517.for _tool in bin/sh ${_games} gnu/usr.bin/cc/cc_tools \
518    ${_libroken4} ${_libroken5} lib/libncurses ${_share}
519	cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
520.endfor
521
522#
523# cross-tools: Build cross-building tools
524#
525# WARNING: Because the bootstrap tools are expected to run on the
526# build-machine, MACHINE_ARCH is *always* set to BUILD_ARCH when this
527# target is being made. TARGET_ARCH is *always* set to reflect the
528# target-machine (which you can set by specifying MACHINE_ARCH on
529# make's command-line, get it?).
530# The reason is simple: we build these tools not to be run on the
531# architecture we're cross-building, but on the architecture we're
532# currently building on (ie the host-machine) and we expect these
533# tools to produce output for the architecture we're trying to
534# cross-build.
535#
536.if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
537_elf2exe=	usr.sbin/elf2exe
538.endif
539
540.if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
541_btxld=	usr.sbin/btxld
542.endif
543
544# XXX - MACHINE should actually be TARGET. But we don't set that...
545.if ${TARGET_ARCH} == "i386" && ${MACHINE} == "pc98"
546_aout_tools=	usr.bin/size usr.bin/strip gnu/usr.bin/as gnu/usr.bin/ld
547.endif
548
549cross-tools:
550.for _tool in ${_aout_tools} ${_btxld} ${_elf2exe} usr.bin/genassym \
551    usr.bin/gensetdefs gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc
552	cd ${.CURDIR}/${_tool}; \
553		${MAKE} obj; \
554		${MAKE} depend; \
555		${MAKE} all; \
556		${MAKE} install
557.endfor
558
559#
560# hierarchy - ensure that all the needed directories are present
561#
562hierarchy:
563	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
564
565#
566# includes - possibly generate and install the include files.
567#
568includes:
569	cd ${.CURDIR}/include;			${MAKE} -B all install
570	cd ${.CURDIR}/gnu/include;		${MAKE} install
571	cd ${.CURDIR}/gnu/lib/libmp;		${MAKE} beforeinstall
572	cd ${.CURDIR}/gnu/lib/libobjc;		${MAKE} beforeinstall
573	cd ${.CURDIR}/gnu/lib/libreadline;	${MAKE} beforeinstall
574	cd ${.CURDIR}/gnu/lib/libregex;		${MAKE} beforeinstall
575	cd ${.CURDIR}/gnu/lib/libstdc++;	${MAKE} beforeinstall
576	cd ${.CURDIR}/gnu/lib/libdialog;	${MAKE} beforeinstall
577	cd ${.CURDIR}/gnu/lib/libgmp;		${MAKE} beforeinstall
578	cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus;	${MAKE} beforeinstall
579.if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
580.if exists(${.CURDIR}/secure/lib/libcrypto)
581	cd ${.CURDIR}/secure/lib/libcrypto;	${MAKE} beforeinstall
582.endif
583	cd ${.CURDIR}/secure/lib/libdes;	${MAKE} beforeinstall
584.if exists(${.CURDIR}/secure/lib/libssl)
585	cd ${.CURDIR}/secure/lib/libssl;	${MAKE} beforeinstall
586.endif
587.endif
588.if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
589    defined(MAKE_KERBEROS4)
590	cd ${.CURDIR}/kerberosIV/lib/libacl;	${MAKE} beforeinstall
591	cd ${.CURDIR}/kerberosIV/lib/libkadm;	${MAKE} beforeinstall
592	cd ${.CURDIR}/kerberosIV/lib/libkafs;	${MAKE} beforeinstall
593	cd ${.CURDIR}/kerberosIV/lib/libkdb;	${MAKE} beforeinstall
594	cd ${.CURDIR}/kerberosIV/lib/libkrb;	${MAKE} beforeinstall
595	cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
596.else
597	cd ${.CURDIR}/lib/libtelnet;		${MAKE} beforeinstall
598.endif
599.if exists(${.CURDIR}/kerberos5) && !defined(NOCRYPT) && \
600    defined(MAKE_KERBEROS5)
601	cd ${.CURDIR}/kerberos5/lib/libasn1;		${MAKE} beforeinstall
602	cd ${.CURDIR}/kerberos5/lib/libhdb;		${MAKE} beforeinstall
603	cd ${.CURDIR}/kerberos5/lib/libkadm5clnt;	${MAKE} beforeinstall
604	cd ${.CURDIR}/kerberos5/lib/libkadm5srv;	${MAKE} beforeinstall
605	cd ${.CURDIR}/kerberos5/lib/libkafs5;		${MAKE} beforeinstall
606	cd ${.CURDIR}/kerberos5/lib/libkrb5;		${MAKE} beforeinstall
607	cd ${.CURDIR}/kerberos5/lib/libsl;		${MAKE} beforeinstall
608.endif
609.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
610	cd ${.CURDIR}/lib/csu/${MACHINE_ARCH};	${MAKE} beforeinstall
611.endif
612	cd ${.CURDIR}/lib/libalias;		${MAKE} beforeinstall
613	cd ${.CURDIR}/lib/libatm;		${MAKE} beforeinstall
614	cd ${.CURDIR}/lib/libdevstat;		${MAKE} beforeinstall
615	cd ${.CURDIR}/lib/libc;			${MAKE} beforeinstall
616	cd ${.CURDIR}/lib/libcalendar;		${MAKE} beforeinstall
617	cd ${.CURDIR}/lib/libcam;		${MAKE} beforeinstall
618	cd ${.CURDIR}/lib/libdisk;		${MAKE} beforeinstall
619	cd ${.CURDIR}/lib/libedit;		${MAKE} beforeinstall
620	cd ${.CURDIR}/lib/libftpio;		${MAKE} beforeinstall
621	cd ${.CURDIR}/lib/libkvm;		${MAKE} beforeinstall
622	cd ${.CURDIR}/lib/libmd;		${MAKE} beforeinstall
623.if !defined(WANT_CSRG_LIBM)
624	cd ${.CURDIR}/lib/msun;			${MAKE} beforeinstall
625.endif
626	cd ${.CURDIR}/lib/libncp;		${MAKE} beforeinstall
627	cd ${.CURDIR}/lib/libncurses;		${MAKE} beforeinstall
628	cd ${.CURDIR}/lib/libnetgraph;		${MAKE} beforeinstall
629	cd ${.CURDIR}/lib/libopie;		${MAKE} beforeinstall
630	cd ${.CURDIR}/lib/libpam/libpam;	${MAKE} beforeinstall
631	cd ${.CURDIR}/lib/libpcap;		${MAKE} beforeinstall
632	cd ${.CURDIR}/lib/libradius;		${MAKE} beforeinstall
633	cd ${.CURDIR}/lib/librpcsvc;		${MAKE} beforeinstall
634	cd ${.CURDIR}/lib/libskey;		${MAKE} beforeinstall
635	cd ${.CURDIR}/lib/libstand;		${MAKE} beforeinstall
636	cd ${.CURDIR}/lib/libtacplus;		${MAKE} beforeinstall
637	cd ${.CURDIR}/lib/libcom_err;		${MAKE} beforeinstall
638	cd ${.CURDIR}/lib/libss;		${MAKE} -B hdrs beforeinstall
639	cd ${.CURDIR}/lib/libutil;		${MAKE} beforeinstall
640	cd ${.CURDIR}/lib/libvgl;		${MAKE} beforeinstall
641	cd ${.CURDIR}/lib/libwrap;		${MAKE} beforeinstall
642	cd ${.CURDIR}/lib/libz;			${MAKE} beforeinstall
643	cd ${.CURDIR}/usr.bin/lex;		${MAKE} beforeinstall
644
645#
646# libraries - build all libraries, and install them under ${DESTDIR}.
647#
648# The following dependencies exist between the libraries:
649#
650# lib*: csu
651# libatm: libmd
652# libcrypt: libmd
653# libdialog: libncurses
654# libedit: libncurses
655# libg++: libm
656# libkrb: libcrypt
657# libopie: libmd
658# libpam: libcom_err libcrypt libdes libgcc_pic libkrb libradius libskey \
659#	  libtacplus libutil
660# libradius: libmd
661# libreadline: libncurses
662# libskey: libcrypt libmd
663# libss: libcom_err
664# libstc++: libm
665# libtacplus: libmd
666#
667# Across directories this comes down to (rougly):
668#
669# gnu/lib: lib/libm lib/libncurses
670# kerberosIV/lib kerberos5/lib: lib/libcrypt
671# lib/libpam: secure/lib/libdes kerberosIV/lib/libkrb gnu/lib/libgcc
672# secure/lib: lib/libmd
673#
674.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
675_csu=	lib/csu/${MACHINE_ARCH}.pcc
676.elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf"
677_csu=	lib/csu/i386-elf
678.else
679_csu=	lib/csu/${MACHINE_ARCH}
680.endif
681
682.if !defined(NOSECURE) && !defined(NOCRYPT)
683_secure_lib=	secure/lib
684.endif
685
686.if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
687_kerberosIV_lib=	kerberosIV/lib
688.endif
689
690.if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
691_kerberos5_lib=	kerberos5/lib
692.endif
693
694.if defined(WANT_CSRG_LIBM)
695_libm=	lib/libm
696.else
697_libm=	lib/msun
698.endif
699
700.if !defined(NOPERL)
701_libperl=	gnu/usr.bin/perl/libperl
702.endif
703
704.if ${MACHINE_ARCH} == "i386"
705_libkeycap=	usr.sbin/pcvt/keycap
706.endif
707
708libraries:
709.for _lib in ${_csu} lib/libmd lib/libcrypt ${_secure_lib} ${_kerberosIV_lib} \
710    ${_kerberos5_lib} gnu/lib/libgcc lib/libcom_err ${_libm} lib/libncurses \
711    lib/libradius lib/libskey lib/libtacplus lib/libutil lib gnu/lib \
712    ${_libperl} usr.bin/lex/lib ${_libkeycap}
713.if exists(${.CURDIR}/${_lib})
714	cd ${.CURDIR}/${_lib}; \
715		${MAKE} depend; \
716		${MAKE} all; \
717		${MAKE} install
718.endif
719.endfor
720
721.for __target in clean cleandepend cleandir depend obj
722.for entry in ${SUBDIR}
723${entry}.${__target}__D: .PHONY
724	@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
725		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
726		edir=${entry}.${MACHINE_ARCH}; \
727		cd ${.CURDIR}/$${edir}; \
728	else \
729		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
730		edir=${entry}; \
731		cd ${.CURDIR}/$${edir}; \
732	fi; \
733	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
734.endfor
735par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
736.endfor
737
738.include <bsd.subdir.mk>
739