Makefile.inc1 revision 63366
1#
2# $FreeBSD: head/Makefile.inc1 63366 2000-07-18 01:49: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} \
189		PATH=${TMPPATH}
190IMAKE=		${IMAKEENV} ${MAKE} -f Makefile.inc1
191
192USRDIRS=	usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
193		usr/libexec/${OBJFORMAT} usr/sbin usr/share/misc
194
195.if ${MACHINE_ARCH} == "i386" && ${MACHINE} == "pc98"
196USRDIRS+=	usr/libexec/aout
197.endif
198
199INCDIRS=	arpa g++/std objc protocols readline rpc rpcsvc openssl \
200		security ss
201
202#
203# buildworld
204#
205# Attempt to rebuild the entire system, with reasonable chance of
206# success, regardless of how old your existing system is.
207#
208buildworld:
209.if !defined(NOSECURE) && !defined(NO_OPENSSL) && exists(${.CURDIR}/secure) && \
210	(!defined(USA_RESIDENT) || (${USA_RESIDENT} != NO && \
211	${USA_RESIDENT} != YES))
212	@echo
213	@echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
214	@echo ">>> You must define the value of USA_RESIDENT as 'YES' or"
215	@echo ">>> 'NO' as appropriate, in the environment or /etc/make.conf"
216	@echo ">>> before building can proceed."
217	@echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
218	@/usr/bin/false
219.endif
220
221	@echo
222	@echo "--------------------------------------------------------------"
223	@echo ">>> Rebuilding the temporary build tree"
224	@echo "--------------------------------------------------------------"
225.if !defined(NOCLEAN)
226	rm -rf ${WORLDTMP}
227.else
228	for dir in bin games include lib sbin; do \
229		rm -rf ${WORLDTMP}/usr/$$dir; \
230	done
231	rm -f ${WORLDTMP}/sys
232	# XXX - Work-around for broken cc/cc_tools/Makefile.
233	# This is beyond dirty...
234	rm -f ${OBJTREE}${.CURDIR}/gnu/usr.bin/cc/cc_tools/.depend
235.endif
236.for _dir in ${USRDIRS}
237	mkdir -p ${WORLDTMP}/${_dir}
238.endfor
239.for _dir in ${INCDIRS}
240	mkdir -p ${WORLDTMP}/usr/include/${_dir}
241.endfor
242	ln -sf ${.CURDIR}/sys ${WORLDTMP}/sys
243	@echo
244	@echo "--------------------------------------------------------------"
245	@echo ">>> stage 1: bootstrap tools"
246	@echo "--------------------------------------------------------------"
247	cd ${.CURDIR}; ${BMAKE} bootstrap-tools
248.if !defined(NOCLEAN)
249	@echo
250	@echo "--------------------------------------------------------------"
251	@echo ">>> stage 2: cleaning up the object tree"
252	@echo "--------------------------------------------------------------"
253	cd ${.CURDIR}; ${TMAKE} ${CLEANDIR:S/^/par-/}
254.endif
255	@echo
256	@echo "--------------------------------------------------------------"
257	@echo ">>> stage 2: rebuilding the object tree"
258	@echo "--------------------------------------------------------------"
259	cd ${.CURDIR}; ${TMAKE} par-obj
260	@echo
261	@echo "--------------------------------------------------------------"
262	@echo ">>> stage 2: build tools"
263	@echo "--------------------------------------------------------------"
264	cd ${.CURDIR}; ${TMAKE} build-tools
265	@echo
266	@echo "--------------------------------------------------------------"
267	@echo ">>> stage 3: cross tools"
268	@echo "--------------------------------------------------------------"
269	cd ${.CURDIR}; ${XMAKE} cross-tools
270	@echo
271	@echo "--------------------------------------------------------------"
272	@echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
273	@echo "--------------------------------------------------------------"
274	cd ${.CURDIR}; ${WMAKE} SHARED=symlinks includes
275	@echo
276	@echo "--------------------------------------------------------------"
277	@echo ">>> stage 4: building libraries"
278	@echo "--------------------------------------------------------------"
279	cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
280	@echo
281	@echo "--------------------------------------------------------------"
282	@echo ">>> stage 4: make dependencies"
283	@echo "--------------------------------------------------------------"
284	cd ${.CURDIR}; ${WMAKE} par-depend
285	@echo
286	@echo "--------------------------------------------------------------"
287	@echo ">>> stage 4: building everything.."
288	@echo "--------------------------------------------------------------"
289	cd ${.CURDIR}; ${WMAKE} all
290
291everything:
292	@echo "--------------------------------------------------------------"
293	@echo ">>> Building everything.."
294	@echo "--------------------------------------------------------------"
295	cd ${.CURDIR}; ${WMAKE} all
296
297#
298# installworld
299#
300# Installs everything compiled by a 'buildworld'.
301#
302installworld:
303	cd ${.CURDIR}; ${IMAKE} reinstall
304
305#
306# reinstall
307#
308# If you have a build server, you can NFS mount the source and obj directories
309# and do a 'make reinstall' on the *client* to install new binaries from the
310# most recent server build.
311#
312reinstall:
313	@echo "--------------------------------------------------------------"
314	@echo ">>> Making hierarchy"
315	@echo "--------------------------------------------------------------"
316	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
317	@echo
318	@echo "--------------------------------------------------------------"
319	@echo ">>> Installing everything.."
320	@echo "--------------------------------------------------------------"
321	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
322.if !defined(NOMAN)
323	@echo
324	@echo "--------------------------------------------------------------"
325	@echo ">>> Rebuilding man page indices"
326	@echo "--------------------------------------------------------------"
327	cd ${.CURDIR}/share/man; ${MAKE} makedb
328.endif
329
330#
331# buildkernel and installkernel
332#
333# Which kernels to build and/or install is specified by setting
334# KERNEL. If not defined a GENERIC kernel is built/installed.
335# Only the existing (depending MACHINE) config files are used
336# for building kernels and only the first of these is designated
337# as the one being installed.
338#
339# Note that we have to use MACHINE instead of MACHINE_ARCH when
340# we're in kernel-land. Since only MACHINE_ARCH is (expected) to
341# be set to cross-build, we have to make sure MACHINE is set
342# properly.
343
344KERNEL?=	GENERIC
345
346# The only exotic MACHINE_ARCH/MACHINE combination valid at this
347# time is i386/pc98. In all other cases set MACHINE equal to
348# MACHINE_ARCH.
349.if ${MACHINE_ARCH} != "i386" || ${MACHINE} != "pc98"
350MACHINE=	${MACHINE_ARCH}
351.endif
352
353KRNLSRCDIR=	${.CURDIR}/sys
354KRNLCONFDIR=	${KRNLSRCDIR}/${MACHINE}/conf
355KRNLOBJDIR=	${OBJTREE}${KRNLSRCDIR}
356
357.if !defined(NOCLEAN)
358CONFIGARGS+=	-r
359.endif
360
361BUILDKERNELS=
362INSTALLKERNEL=
363.for _kernel in ${KERNEL}
364.if exists(${KRNLCONFDIR}/${_kernel})
365BUILDKERNELS+=	${_kernel}
366.if empty(INSTALLKERNEL)
367INSTALLKERNEL= ${_kernel}
368.endif
369.endif
370.endfor
371
372#
373# buildkernel
374#
375# Builds all kernels defined by BUILDKERNELS.
376#
377buildkernel:
378	@echo
379	@echo "--------------------------------------------------------------"
380	@echo ">>> Rebuilding kernel(s)"
381	@echo "--------------------------------------------------------------"
382.for _kernel in ${BUILDKERNELS}
383	@echo "===> ${_kernel}"
384	mkdir -p ${KRNLOBJDIR}
385.if !defined(NO_KERNELCONFIG)
386	cd ${KRNLCONFDIR}; \
387		PATH=${TMPPATH} \
388		    config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} ${_kernel}
389.endif
390	cd ${KRNLOBJDIR}/${_kernel}; \
391		MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx \
392		    ${MAKE} -f ${KRNLSRCDIR}/dev/aic7xxx/Makefile
393.if !defined(NO_KERNELDEPEND)
394	cd ${KRNLOBJDIR}/${_kernel}; \
395		${WMAKEENV} MACHINE=${MACHINE} KERNEL=${_kernel} \
396		    ${MAKE} depend
397.endif
398	cd ${KRNLOBJDIR}/${_kernel}; \
399		${WMAKEENV} MACHINE=${MACHINE} KERNEL=${_kernel} ${MAKE} all
400.endfor
401
402#
403# installkernel
404#
405# Install the kernel defined by INSTALLKERNEL
406#
407installkernel:
408	cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
409		${IMAKEENV} MACHINE=${MACHINE} KERNEL=${INSTALLKERNEL} \
410		    ${MAKE} KERNEL=${INSTALLKERNEL} install
411
412#
413# update
414#
415# Update the source tree, by running sup and/or running cvs to update to the
416# latest copy.
417#
418update:
419.if defined(SUP_UPDATE)
420	@echo "--------------------------------------------------------------"
421	@echo ">>> Running ${SUP}"
422	@echo "--------------------------------------------------------------"
423.if defined(SUPFILE)
424	@${SUP} ${SUPFLAGS} ${SUPFILE}
425.endif
426.if defined(SUPFILE1)
427	@${SUP} ${SUPFLAGS} ${SUPFILE1}
428.endif
429.if defined(SUPFILE2)
430	@${SUP} ${SUPFLAGS} ${SUPFILE2}
431.endif
432.if defined(PORTSSUPFILE)
433	@${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
434.endif
435.endif
436.if defined(CVS_UPDATE)
437	@echo "--------------------------------------------------------------"
438	@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
439	@echo "--------------------------------------------------------------"
440	cd ${.CURDIR}; cvs -q update -A -P -d
441.endif
442
443#
444# most
445#
446# Build most of the user binaries on the existing system libs and includes.
447#
448most:
449	@echo "--------------------------------------------------------------"
450	@echo ">>> Building programs only"
451	@echo "--------------------------------------------------------------"
452	cd ${.CURDIR}/bin;		${MAKE} all
453	cd ${.CURDIR}/sbin;		${MAKE} all
454	cd ${.CURDIR}/libexec;		${MAKE} all
455	cd ${.CURDIR}/usr.bin;		${MAKE} all
456	cd ${.CURDIR}/usr.sbin;		${MAKE} all
457	cd ${.CURDIR}/gnu/libexec;	${MAKE} all
458	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} all
459	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} all
460
461#
462# installmost
463#
464# Install the binaries built by the 'most' target.  This does not include
465# libraries or include files.
466#
467installmost:
468	@echo "--------------------------------------------------------------"
469	@echo ">>> Installing programs only"
470	@echo "--------------------------------------------------------------"
471	cd ${.CURDIR}/bin;		${MAKE} install
472	cd ${.CURDIR}/sbin;		${MAKE} install
473	cd ${.CURDIR}/libexec;		${MAKE} install
474	cd ${.CURDIR}/usr.bin;		${MAKE} install
475	cd ${.CURDIR}/usr.sbin;		${MAKE} install
476	cd ${.CURDIR}/gnu/libexec;	${MAKE} install
477	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} install
478	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} install
479
480#
481# ------------------------------------------------------------------------
482#
483# From here onwards are utility targets used by the 'make world' and
484# related targets.  If your 'world' breaks, you may like to try to fix
485# the problem and manually run the following targets to attempt to
486# complete the build.  Beware, this is *not* guaranteed to work, you
487# need to have a pretty good grip on the current state of the system
488# to attempt to manually finish it.  If in doubt, 'make world' again.
489#
490
491#
492# bootstrap-tools: Build tools needed for compatibility
493#
494.if exists(${.CURDIR}/games) && !defined(NOGAMES)
495_strfile=	games/fortune/strfile
496.endif
497
498bootstrap-tools:
499.for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef usr.sbin/config \
500    gnu/usr.bin/gperf gnu/usr.bin/texinfo usr.sbin/mtree
501	cd ${.CURDIR}/${_tool}; \
502		${MAKE} obj; \
503		${MAKE} depend; \
504		${MAKE} all; \
505		${MAKE} install
506.endfor
507
508#
509# build-tools: Build special purpose build tools
510#
511.if exists(${.CURDIR}/games) && !defined(NOGAMES)
512_games=	games/adventure games/hack games/phantasia
513.endif
514
515.if exists(${.CURDIR}/share) && !defined(NOSHARE)
516_share=	share/syscons/scrnmaps
517.endif
518
519.if !defined(NO_FORTRAN)
520_fortran= gnu/usr.bin/cc/f771
521.endif
522
523.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
524    !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
525_libroken4= kerberosIV/lib/libroken
526.endif
527
528.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
529    !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
530_libkrb5= kerberos5/lib/libroken kerberos5/lib/libasn1 kerberos5/lib/libhdb \
531	kerberos5/lib/libsl
532.endif
533
534.if !defined(NOPERL)
535_perl=	gnu/usr.bin/perl
536.endif
537
538build-tools:
539.for _tool in bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \
540    ${_libroken4} ${_libkrb5} lib/libncurses ${_share} ${_perl}
541	cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
542.endfor
543
544#
545# cross-tools: Build cross-building tools
546#
547# WARNING: Because the bootstrap tools are expected to run on the
548# build-machine, MACHINE_ARCH is *always* set to BUILD_ARCH when this
549# target is being made. TARGET_ARCH is *always* set to reflect the
550# target-machine (which you can set by specifying MACHINE_ARCH on
551# make's command-line, get it?).
552# The reason is simple: we build these tools not to be run on the
553# architecture we're cross-building, but on the architecture we're
554# currently building on (ie the host-machine) and we expect these
555# tools to produce output for the architecture we're trying to
556# cross-build.
557#
558.if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
559_elf2exe=	usr.sbin/elf2exe
560.endif
561
562.if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
563_btxld=	usr.sbin/btxld
564.endif
565
566# XXX - MACHINE should actually be TARGET. But we don't set that...
567.if ${TARGET_ARCH} == "i386" && ${MACHINE} == "pc98"
568_aout_tools=	usr.bin/size usr.bin/strip gnu/usr.bin/as gnu/usr.bin/ld
569.endif
570
571cross-tools:
572.for _tool in ${_aout_tools} ${_btxld} ${_elf2exe} usr.bin/genassym \
573    usr.bin/gensetdefs gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc
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