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