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