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