Makefile.inc1 revision 63592
1#
2# $FreeBSD: head/Makefile.inc1 63592 2000-07-20 03:03:23Z 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 cp 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} \
407		    ${MAKE} depend
408.endif
409	cd ${KRNLOBJDIR}/${_kernel}; \
410		${WMAKEENV} MACHINE=${MACHINE} KERNEL=${_kernel} ${MAKE} all
411.endfor
412
413#
414# installkernel
415#
416# Install the kernel defined by INSTALLKERNEL
417#
418installkernel:
419	cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
420		${IMAKEENV} MACHINE=${MACHINE} KERNEL=${INSTALLKERNEL} \
421		    ${MAKE} KERNEL=${INSTALLKERNEL} install
422
423#
424# update
425#
426# Update the source tree, by running sup and/or running cvs to update to the
427# latest copy.
428#
429update:
430.if defined(SUP_UPDATE)
431	@echo "--------------------------------------------------------------"
432	@echo ">>> Running ${SUP}"
433	@echo "--------------------------------------------------------------"
434.if defined(SUPFILE)
435	@${SUP} ${SUPFLAGS} ${SUPFILE}
436.endif
437.if defined(SUPFILE1)
438	@${SUP} ${SUPFLAGS} ${SUPFILE1}
439.endif
440.if defined(SUPFILE2)
441	@${SUP} ${SUPFLAGS} ${SUPFILE2}
442.endif
443.if defined(PORTSSUPFILE)
444	@${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
445.endif
446.endif
447.if defined(CVS_UPDATE)
448	@echo "--------------------------------------------------------------"
449	@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
450	@echo "--------------------------------------------------------------"
451	cd ${.CURDIR}; cvs -q update -A -P -d
452.endif
453
454#
455# most
456#
457# Build most of the user binaries on the existing system libs and includes.
458#
459most:
460	@echo "--------------------------------------------------------------"
461	@echo ">>> Building programs only"
462	@echo "--------------------------------------------------------------"
463	cd ${.CURDIR}/bin;		${MAKE} all
464	cd ${.CURDIR}/sbin;		${MAKE} all
465	cd ${.CURDIR}/libexec;		${MAKE} all
466	cd ${.CURDIR}/usr.bin;		${MAKE} all
467	cd ${.CURDIR}/usr.sbin;		${MAKE} all
468	cd ${.CURDIR}/gnu/libexec;	${MAKE} all
469	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} all
470	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} all
471
472#
473# installmost
474#
475# Install the binaries built by the 'most' target.  This does not include
476# libraries or include files.
477#
478installmost:
479	@echo "--------------------------------------------------------------"
480	@echo ">>> Installing programs only"
481	@echo "--------------------------------------------------------------"
482	cd ${.CURDIR}/bin;		${MAKE} install
483	cd ${.CURDIR}/sbin;		${MAKE} install
484	cd ${.CURDIR}/libexec;		${MAKE} install
485	cd ${.CURDIR}/usr.bin;		${MAKE} install
486	cd ${.CURDIR}/usr.sbin;		${MAKE} install
487	cd ${.CURDIR}/gnu/libexec;	${MAKE} install
488	cd ${.CURDIR}/gnu/usr.bin;	${MAKE} install
489	cd ${.CURDIR}/gnu/usr.sbin;	${MAKE} install
490
491#
492# ------------------------------------------------------------------------
493#
494# From here onwards are utility targets used by the 'make world' and
495# related targets.  If your 'world' breaks, you may like to try to fix
496# the problem and manually run the following targets to attempt to
497# complete the build.  Beware, this is *not* guaranteed to work, you
498# need to have a pretty good grip on the current state of the system
499# to attempt to manually finish it.  If in doubt, 'make world' again.
500#
501
502#
503# bootstrap-tools: Build tools needed for compatibility
504#
505.if exists(${.CURDIR}/games) && !defined(NOGAMES)
506_strfile=	games/fortune/strfile
507.endif
508
509bootstrap-tools:
510.for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef usr.sbin/config \
511    usr.sbin/mtree gnu/usr.bin/gperf gnu/usr.bin/texinfo
512	cd ${.CURDIR}/${_tool}; \
513		${MAKE} obj; \
514		${MAKE} depend; \
515		${MAKE} all; \
516		${MAKE} install
517.endfor
518
519#
520# build-tools: Build special purpose build tools
521#
522.if exists(${.CURDIR}/games) && !defined(NOGAMES)
523_games=	games/adventure games/hack games/phantasia
524.endif
525
526.if exists(${.CURDIR}/share) && !defined(NOSHARE)
527_share=	share/syscons/scrnmaps
528.endif
529
530.if !defined(NO_FORTRAN)
531_fortran= gnu/usr.bin/cc/f771
532.endif
533
534.if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
535    !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
536_libroken4= kerberosIV/lib/libroken
537.endif
538
539.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
540    !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
541_libkrb5= kerberos5/lib/libroken kerberos5/lib/libasn1 kerberos5/lib/libhdb \
542	kerberos5/lib/libsl
543.endif
544
545.if !defined(NOPERL)
546_perl=	gnu/usr.bin/perl
547.endif
548
549build-tools:
550.for _tool in bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \
551    ${_libroken4} ${_libkrb5} lib/libncurses ${_share} ${_perl}
552	cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
553.endfor
554
555#
556# cross-tools: Build cross-building tools
557#
558# WARNING: Because the bootstrap tools are expected to run on the
559# build-machine, MACHINE_ARCH is *always* set to BUILD_ARCH when this
560# target is being made. TARGET_ARCH is *always* set to reflect the
561# target-machine (which you can set by specifying MACHINE_ARCH on
562# make's command-line, get it?).
563# The reason is simple: we build these tools not to be run on the
564# architecture we're cross-building, but on the architecture we're
565# currently building on (ie the host-machine) and we expect these
566# tools to produce output for the architecture we're trying to
567# cross-build.
568#
569.if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
570_elf2exe=	usr.sbin/elf2exe
571.endif
572
573.if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
574_btxld=	usr.sbin/btxld
575.endif
576
577# XXX - MACHINE should actually be TARGET. But we don't set that...
578.if ${TARGET_ARCH} == "i386" && ${MACHINE} == "pc98"
579_aout_tools=	usr.bin/size usr.bin/strip gnu/usr.bin/as gnu/usr.bin/ld
580.endif
581
582cross-tools:
583.for _tool in ${_aout_tools} ${_btxld} ${_elf2exe} usr.bin/genassym \
584    usr.bin/gensetdefs gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc
585	cd ${.CURDIR}/${_tool}; \
586		${MAKE} obj; \
587		${MAKE} depend; \
588		${MAKE} all; \
589		${MAKE} install
590.endfor
591
592#
593# hierarchy - ensure that all the needed directories are present
594#
595hierarchy:
596	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
597
598#
599# includes - possibly generate and install the include files.
600#
601includes:
602	cd ${.CURDIR}/include;			${MAKE} -B all install
603	cd ${.CURDIR}/gnu/include;		${MAKE} install
604	cd ${.CURDIR}/gnu/lib/libmp;		${MAKE} beforeinstall
605	cd ${.CURDIR}/gnu/lib/libobjc;		${MAKE} beforeinstall
606	cd ${.CURDIR}/gnu/lib/libreadline/readline;	${MAKE} beforeinstall
607	cd ${.CURDIR}/gnu/lib/libregex;		${MAKE} beforeinstall
608	cd ${.CURDIR}/gnu/lib/libstdc++;	${MAKE} beforeinstall
609	cd ${.CURDIR}/gnu/lib/libdialog;	${MAKE} beforeinstall
610	cd ${.CURDIR}/gnu/lib/libgmp;		${MAKE} beforeinstall
611	cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus;	${MAKE} beforeinstall
612.if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
613.if exists(${.CURDIR}/secure/lib/libcrypto)
614	cd ${.CURDIR}/secure/lib/libcrypto;	${MAKE} beforeinstall
615.endif
616.if exists(${.CURDIR}/secure/lib/libssl)
617	cd ${.CURDIR}/secure/lib/libssl;	${MAKE} beforeinstall
618.endif
619.endif
620.if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
621    defined(MAKE_KERBEROS4)
622	cd ${.CURDIR}/kerberosIV/lib/libacl;	${MAKE} beforeinstall
623	cd ${.CURDIR}/kerberosIV/lib/libkadm;	${MAKE} beforeinstall
624	cd ${.CURDIR}/kerberosIV/lib/libkafs;	${MAKE} beforeinstall
625	cd ${.CURDIR}/kerberosIV/lib/libkdb;	${MAKE} beforeinstall
626	cd ${.CURDIR}/kerberosIV/lib/libkrb;	${MAKE} beforeinstall
627	cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
628.else
629	cd ${.CURDIR}/lib/libtelnet;		${MAKE} beforeinstall
630.endif
631.if exists(${.CURDIR}/kerberos5) && !defined(NOCRYPT) && \
632    defined(MAKE_KERBEROS5)
633	cd ${.CURDIR}/kerberos5/lib/libasn1;		${MAKE} beforeinstall
634	cd ${.CURDIR}/kerberos5/lib/libhdb;		${MAKE} beforeinstall
635	cd ${.CURDIR}/kerberos5/lib/libkadm5clnt;	${MAKE} beforeinstall
636	cd ${.CURDIR}/kerberos5/lib/libkadm5srv;	${MAKE} beforeinstall
637	cd ${.CURDIR}/kerberos5/lib/libkafs5;		${MAKE} beforeinstall
638	cd ${.CURDIR}/kerberos5/lib/libkrb5;		${MAKE} beforeinstall
639	cd ${.CURDIR}/kerberos5/lib/libsl;		${MAKE} beforeinstall
640.endif
641.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
642	cd ${.CURDIR}/lib/csu/${MACHINE_ARCH};	${MAKE} beforeinstall
643.endif
644	cd ${.CURDIR}/lib/libalias;		${MAKE} beforeinstall
645	cd ${.CURDIR}/lib/libatm;		${MAKE} beforeinstall
646	cd ${.CURDIR}/lib/libdevstat;		${MAKE} beforeinstall
647	cd ${.CURDIR}/lib/libc;			${MAKE} beforeinstall
648	cd ${.CURDIR}/lib/libcalendar;		${MAKE} beforeinstall
649	cd ${.CURDIR}/lib/libcam;		${MAKE} beforeinstall
650	cd ${.CURDIR}/lib/libdisk;		${MAKE} beforeinstall
651	cd ${.CURDIR}/lib/libedit;		${MAKE} beforeinstall
652	cd ${.CURDIR}/lib/libftpio;		${MAKE} beforeinstall
653	cd ${.CURDIR}/lib/libkvm;		${MAKE} beforeinstall
654	cd ${.CURDIR}/lib/libmd;		${MAKE} beforeinstall
655.if !defined(WANT_CSRG_LIBM)
656	cd ${.CURDIR}/lib/msun;			${MAKE} beforeinstall
657.endif
658	cd ${.CURDIR}/lib/libncp;		${MAKE} beforeinstall
659	cd ${.CURDIR}/lib/libncurses;		${MAKE} beforeinstall
660	cd ${.CURDIR}/lib/libnetgraph;		${MAKE} beforeinstall
661	cd ${.CURDIR}/lib/libopie;		${MAKE} beforeinstall
662	cd ${.CURDIR}/lib/libpam/libpam;	${MAKE} beforeinstall
663	cd ${.CURDIR}/lib/libpcap;		${MAKE} beforeinstall
664	cd ${.CURDIR}/lib/libradius;		${MAKE} beforeinstall
665	cd ${.CURDIR}/lib/librpcsvc;		${MAKE} beforeinstall
666	cd ${.CURDIR}/lib/libskey;		${MAKE} beforeinstall
667	cd ${.CURDIR}/lib/libstand;		${MAKE} beforeinstall
668	cd ${.CURDIR}/lib/libtacplus;		${MAKE} beforeinstall
669	cd ${.CURDIR}/lib/libcom_err;		${MAKE} beforeinstall
670	cd ${.CURDIR}/lib/libss;		${MAKE} -B hdrs beforeinstall
671	cd ${.CURDIR}/lib/libutil;		${MAKE} beforeinstall
672	cd ${.CURDIR}/lib/libvgl;		${MAKE} beforeinstall
673	cd ${.CURDIR}/lib/libwrap;		${MAKE} beforeinstall
674	cd ${.CURDIR}/lib/libz;			${MAKE} beforeinstall
675	cd ${.CURDIR}/usr.bin/lex;		${MAKE} beforeinstall
676
677#
678# libraries - build all libraries, and install them under ${DESTDIR}.
679#
680# The following dependencies exist between the libraries:
681#
682# lib*: csu
683# libatm: libmd
684# libcrypt: libmd
685# libdialog: libncurses
686# libedit: libncurses
687# libg++: libm
688# libkrb: libcrypt
689# libopie: libmd
690# libpam: libcom_err libcrypt libcrypto libgcc_pic libkrb libopie libradius \
691#	  libskey libtacplus libutil libz libssh
692# libradius: libmd
693# libreadline: libncurses
694# libskey: libcrypt libmd
695# libss: libcom_err
696# libstc++: libm
697# libtacplus: libmd
698#
699# Across directories this comes down to (rougly):
700#
701# gnu/lib: lib/libm lib/libncurses
702# kerberosIV/lib kerberos5/lib: lib/libcrypt
703# lib/libpam: secure/lib/libcrypto kerberosIV/lib/libkrb gnu/lib/libgcc \
704#             secure/lib/libssh lib/libz
705# secure/lib: lib/libmd
706#
707.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
708_csu=	lib/csu/${MACHINE_ARCH}.pcc
709.elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf"
710_csu=	lib/csu/i386-elf
711.else
712_csu=	lib/csu/${MACHINE_ARCH}
713.endif
714
715.if !defined(NOSECURE) && !defined(NOCRYPT)
716_secure_lib=	secure/lib
717.endif
718
719.if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
720_kerberosIV_lib=	kerberosIV/lib
721.endif
722
723.if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
724_kerberos5_lib=	kerberos5/lib
725.endif
726
727.if defined(WANT_CSRG_LIBM)
728_libm=	lib/libm
729.else
730_libm=	lib/msun
731.endif
732
733.if ${MACHINE_ARCH} == "i386"
734_libkeycap=	usr.sbin/pcvt/keycap
735.endif
736
737libraries:
738.for _lib in ${_csu} lib/libmd lib/libcrypt ${_secure_lib} ${_kerberosIV_lib} \
739    ${_kerberos5_lib} gnu/lib/libgcc lib/libcom_err ${_libm} lib/libncurses \
740    lib/libopie lib/libradius lib/libskey lib/libtacplus lib/libutil \
741    lib/libz lib gnu/lib \
742    ${_libperl} usr.bin/lex/lib ${_libkeycap}
743.if exists(${.CURDIR}/${_lib})
744	cd ${.CURDIR}/${_lib}; \
745		${MAKE} depend; \
746		${MAKE} all; \
747		${MAKE} install
748.endif
749.endfor
750
751.for __target in clean cleandepend cleandir depend obj
752.for entry in ${SUBDIR}
753${entry}.${__target}__D: .PHONY
754	@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
755		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
756		edir=${entry}.${MACHINE_ARCH}; \
757		cd ${.CURDIR}/$${edir}; \
758	else \
759		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
760		edir=${entry}; \
761		cd ${.CURDIR}/$${edir}; \
762	fi; \
763	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
764.endfor
765par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
766.endfor
767
768.include <bsd.subdir.mk>
769