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