Makefile.inc1 revision 113099
1#
2# $FreeBSD: head/Makefile.inc1 113099 2003-04-04 22:46:08Z imp $
3#
4# Make command line options:
5#	-DMAKE_KERBEROS5 to build Kerberos5
6#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
7#	-DNOCLEAN do not clean at all
8#	-DNOCRYPT will prevent building of crypt versions
9#	-DNOMAN do not build the manual pages
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_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
19#	-DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
20#	-DNO_PORTSUPDATE do not update ports in ${MAKE} update
21#	-DNO_DOCUPDATE do not update doc in ${MAKE} update
22#	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
23#	TARGET_ARCH="arch" to crossbuild world to a different arch
24
25#
26# The intended user-driven targets are:
27# buildworld  - rebuild *everything*, including glue to help do upgrades
28# installworld- install everything built by "buildworld"
29# update      - convenient way to update your source tree (eg: sup/cvs)
30# most        - build user commands, no libraries or include files
31# installmost - install user commands, no libraries or include files
32#
33# Standard targets (not defined here) are documented in the makefiles in
34# /usr/share/mk.  These include:
35#		obj depend all install clean cleandepend cleanobj
36
37# Put initial settings here.
38SUBDIR=
39
40# We must do share/info early so that installation of info `dir'
41# entries works correctly.  Do it first since it is less likely to
42# grow dependencies on include and lib than vice versa.
43.if exists(${.CURDIR}/share/info)
44SUBDIR+= share/info
45.endif
46
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}/kerberos5) && exists(${.CURDIR}/crypto) && \
64    !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5)
65SUBDIR+= kerberos5
66.endif
67.if exists(${.CURDIR}/libexec)
68SUBDIR+= libexec
69.endif
70.if exists(${.CURDIR}/sbin)
71SUBDIR+= sbin
72.endif
73.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
74SUBDIR+= secure
75.endif
76.if exists(${.CURDIR}/share) && !defined(NOSHARE)
77SUBDIR+= share
78.endif
79.if exists(${.CURDIR}/sys)
80SUBDIR+= sys
81.endif
82.if exists(${.CURDIR}/usr.bin)
83SUBDIR+= usr.bin
84.endif
85.if exists(${.CURDIR}/usr.sbin)
86SUBDIR+= usr.sbin
87.endif
88
89# etc must be last for "distribute" to work
90.if exists(${.CURDIR}/etc)
91SUBDIR+= etc
92.endif
93
94# These are last, since it is nice to at least get the base system
95# rebuilt before you do them.
96.if defined(LOCAL_DIRS)
97.for _DIR in ${LOCAL_DIRS}
98.if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
99SUBDIR+= ${_DIR}
100.endif
101.endfor
102.endif
103
104.if defined(SUBDIR_OVERRIDE)
105SUBDIR=		${SUBDIR_OVERRIDE}
106.endif
107
108.if defined(NOCLEANDIR)
109CLEANDIR=	clean cleandepend
110.else
111CLEANDIR=	cleandir
112.endif
113
114CVS?=		cvs
115SUP?=		/usr/local/bin/cvsup
116SUPFLAGS?=	-g -L 2 -P -
117.if defined(SUPHOST)
118SUPFLAGS+=	-h ${SUPHOST}
119.endif
120
121MAKEOBJDIRPREFIX?=	/usr/obj
122OSRELDATE!=	sysctl -n kern.osreldate
123TARGET_ARCH?=	${MACHINE_ARCH}
124.if ${TARGET_ARCH} == ${MACHINE_ARCH}
125TARGET?=	${MACHINE}
126TARGET_CPUTYPE?=${CPUTYPE}
127.else
128TARGET?=	${TARGET_ARCH}
129TARGET_CPUTYPE?=
130.endif
131.if !empty(TARGET_CPUTYPE)
132_TARGET_CPUTYPE=${TARGET_CPUTYPE}
133.else
134_TARGET_CPUTYPE=dummy
135.endif
136_CPUTYPE!=	${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
137		CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
138.if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
139.error CPUTYPE global should be set with ?=.
140.endif
141.if make(buildworld)
142BUILD_ARCH!=	sysctl -n hw.machine_arch
143.if ${MACHINE_ARCH} != ${BUILD_ARCH}
144.error To cross-build, set TARGET_ARCH.
145.endif
146.endif
147.if ${MACHINE} == ${TARGET}
148OBJTREE=	${MAKEOBJDIRPREFIX}
149.else
150OBJTREE=	${MAKEOBJDIRPREFIX}/${TARGET}
151.endif
152WORLDTMP=	${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
153# /usr/games added for fortune which depend on strfile
154STRICTTMPPATH=	${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
155TMPPATH=	${STRICTTMPPATH}:${PATH}
156
157INSTALLTMP!=	/usr/bin/mktemp -d -u -t install
158
159#
160# Building a world goes through the following stages
161#
162# 1. bootstrap-tool stage [BMAKE]
163#	This stage is responsible for creating programs that
164#	are needed for backward compatibility reasons. They
165#	are not built as cross-tools.
166# 2. build-tool stage [TMAKE]
167#	This stage is responsible for creating the object
168#	tree and building any tools that are needed during
169#	the build process.
170# 3. cross-tool stage [XMAKE]
171#	This stage is responsible for creating any tools that
172#	are needed for cross-builds. A cross-compiler is one
173#	of them.
174# 4. world stage [WMAKE]
175#	This stage actually builds the world.
176# 5. install stage (optional) [IMAKE]
177#	This stage installs a previously built world.
178#
179
180# Common environment for world related stages
181CROSSENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
182		MACHINE_ARCH=${TARGET_ARCH} \
183		MACHINE=${TARGET} \
184		CPUTYPE=${TARGET_CPUTYPE} \
185		GROFF_BIN_PATH=${WORLDTMP}/usr/bin \
186		GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
187		GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
188
189# bootstrap-tool stage
190BMAKEENV=	MAKEOBJDIRPREFIX=${WORLDTMP} \
191		DESTDIR= \
192		INSTALL="sh ${.CURDIR}/tools/install.sh"
193BMAKE=		${BMAKEENV} ${MAKE} -f Makefile.inc1 \
194		BOOTSTRAPPING=${OSRELDATE} \
195		-DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
196		-DNO_CPU_CFLAGS -DNO_WARNS
197
198# build-tool stage
199TMAKEENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
200		DESTDIR= \
201		INSTALL="sh ${.CURDIR}/tools/install.sh"
202TMAKE=		${TMAKEENV} ${MAKE} -f Makefile.inc1 \
203		BOOTSTRAPPING=${OSRELDATE} -DNO_CPU_CFLAGS -DNO_WARNS
204
205# cross-tool stage
206XMAKE=		TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
207
208# world stage
209WMAKEENV=	${CROSSENV} \
210		DESTDIR=${WORLDTMP} \
211		INSTALL="sh ${.CURDIR}/tools/install.sh" \
212		PATH=${TMPPATH}
213WMAKE=		${WMAKEENV} ${MAKE} -f Makefile.inc1
214
215# install stage
216IMAKEENV=	${CROSSENV} \
217		PATH=${STRICTTMPPATH}:${INSTALLTMP}
218IMAKE=		${IMAKEENV} ${MAKE} -f Makefile.inc1
219
220# kernel stage
221KMAKEENV=	${WMAKEENV}
222
223USRDIRS=	usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
224		usr/libexec usr/sbin usr/share/misc \
225		usr/share/dict \
226		usr/share/groff_font/devX100 \
227		usr/share/groff_font/devX100-12 \
228		usr/share/groff_font/devX75 \
229		usr/share/groff_font/devX75-12 \
230		usr/share/groff_font/devascii \
231		usr/share/groff_font/devcp1047 \
232		usr/share/groff_font/devdvi \
233		usr/share/groff_font/devhtml \
234		usr/share/groff_font/devkoi8-r \
235		usr/share/groff_font/devlatin1 \
236		usr/share/groff_font/devlbp \
237		usr/share/groff_font/devlj4 \
238		usr/share/groff_font/devps \
239		usr/share/groff_font/devutf8 \
240		usr/share/tmac/mdoc usr/share/tmac/mm
241
242INCDIRS=	arpa dev fs g++/backward g++/bits g++/ext isc isofs libmilter \
243		objc openssl protocols readline rpc rpcsvc security ufs
244
245#
246# buildworld
247#
248# Attempt to rebuild the entire system, with reasonable chance of
249# success, regardless of how old your existing system is.
250#
251_worldtmp:
252.if ${.CURDIR:C/[^,]//g} != ""
253#	The m4 build of sendmail files doesn't like it if ',' is used
254#	anywhere in the path of it's files.
255	@echo
256	@echo "*** Error: path to source tree contains a comma ','"
257	@echo
258	@false
259.endif
260	@echo
261	@echo "--------------------------------------------------------------"
262	@echo ">>> Rebuilding the temporary build tree"
263	@echo "--------------------------------------------------------------"
264.if !defined(NOCLEAN)
265	rm -rf ${WORLDTMP}
266.else
267	# XXX - These two can depend on any header file.
268	rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
269	rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
270.endif
271.for _dir in ${USRDIRS}
272	mkdir -p ${WORLDTMP}/${_dir}
273.endfor
274.for _dir in ${INCDIRS}
275	mkdir -p ${WORLDTMP}/usr/include/${_dir}
276.endfor
277	ln -sf ${.CURDIR}/sys ${WORLDTMP}
278_bootstrap-tools:
279	@echo
280	@echo "--------------------------------------------------------------"
281	@echo ">>> stage 1: bootstrap tools"
282	@echo "--------------------------------------------------------------"
283	cd ${.CURDIR}; ${BMAKE} bootstrap-tools
284_cleanobj:
285.if !defined(NOCLEAN)
286	@echo
287	@echo "--------------------------------------------------------------"
288	@echo ">>> stage 2: cleaning up the object tree"
289	@echo "--------------------------------------------------------------"
290	cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
291.endif
292_obj:
293	@echo
294	@echo "--------------------------------------------------------------"
295	@echo ">>> stage 2: rebuilding the object tree"
296	@echo "--------------------------------------------------------------"
297	cd ${.CURDIR}; ${WMAKE} par-obj
298_build-tools:
299	@echo
300	@echo "--------------------------------------------------------------"
301	@echo ">>> stage 2: build tools"
302	@echo "--------------------------------------------------------------"
303	cd ${.CURDIR}; ${TMAKE} build-tools
304_cross-tools:
305	@echo
306	@echo "--------------------------------------------------------------"
307	@echo ">>> stage 3: cross tools"
308	@echo "--------------------------------------------------------------"
309	cd ${.CURDIR}; ${XMAKE} cross-tools
310_includes:
311	@echo
312	@echo "--------------------------------------------------------------"
313	@echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
314	@echo "--------------------------------------------------------------"
315	cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
316_libraries:
317	@echo
318	@echo "--------------------------------------------------------------"
319	@echo ">>> stage 4: building libraries"
320	@echo "--------------------------------------------------------------"
321	cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
322_depend:
323	@echo
324	@echo "--------------------------------------------------------------"
325	@echo ">>> stage 4: make dependencies"
326	@echo "--------------------------------------------------------------"
327	cd ${.CURDIR}; ${WMAKE} par-depend
328everything:
329	@echo
330	@echo "--------------------------------------------------------------"
331	@echo ">>> stage 4: building everything.."
332	@echo "--------------------------------------------------------------"
333	cd ${.CURDIR}; ${WMAKE} par-all
334
335
336WMAKE_TGTS=
337.if !defined(SUBDIR_OVERRIDE)
338WMAKE_TGTS+=	_worldtmp _bootstrap-tools
339.endif
340WMAKE_TGTS+=	_cleanobj _obj _build-tools
341.if !defined(SUBDIR_OVERRIDE)
342WMAKE_TGTS+=	_cross-tools
343.endif
344WMAKE_TGTS+=	_includes _libraries _depend everything
345
346buildworld: ${WMAKE_TGTS}
347.ORDER: ${WMAKE_TGTS}
348
349#
350# installcheck
351#
352# Checks to be sure system is ready for installworld
353#
354installcheck:
355.if !defined(NO_SENDMAIL)
356	@if ! `grep -q '^smmsp:' /etc/passwd`; then \
357		echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
358		false; \
359	fi
360	@if ! `grep -q '^smmsp:' /etc/group`; then \
361		echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
362		false; \
363	fi
364.endif
365.if ${TARGET_ARCH} == ${MACHINE_ARCH} && !defined(DISTDIR) && \
366    (!defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/")
367	@echo "Checking to see if your booted kernel is fresh enough.."
368	${.OBJDIR}/bin/sh/sh -c \
369	    'echo "Testing installed kernel for new sigaction(2) syscall"'
370	@echo "Seems ok.."
371.endif
372
373#
374# distributeworld
375#
376# Distributes everything compiled by a `buildworld'.
377#
378# installworld
379#
380# Installs everything compiled by a 'buildworld'.
381#
382distributeworld installworld: installcheck
383	mkdir -p ${INSTALLTMP}
384	for prog in [ awk cap_mkdb cat chflags chmod chown \
385	    date echo egrep find grep \
386	    ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
387	    test true uname wc zic; do \
388		cp `which $$prog` ${INSTALLTMP}; \
389	done
390	cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
391	rm -rf ${INSTALLTMP}
392
393#
394# reinstall
395#
396# If you have a build server, you can NFS mount the source and obj directories
397# and do a 'make reinstall' on the *client* to install new binaries from the
398# most recent server build.
399#
400reinstall:
401	@echo "--------------------------------------------------------------"
402	@echo ">>> Making hierarchy"
403	@echo "--------------------------------------------------------------"
404	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
405	@echo
406	@echo "--------------------------------------------------------------"
407	@echo ">>> Installing everything.."
408	@echo "--------------------------------------------------------------"
409	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
410.if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
411	@echo
412	@echo "--------------------------------------------------------------"
413	@echo ">>> Rebuilding man page indices"
414	@echo "--------------------------------------------------------------"
415	cd ${.CURDIR}/share/man; ${MAKE} makedb
416.endif
417
418redistribute:
419	@echo "--------------------------------------------------------------"
420	@echo ">>> Distributing everything.."
421	@echo "--------------------------------------------------------------"
422	cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
423
424#
425# buildkernel and installkernel
426#
427# Which kernels to build and/or install is specified by setting
428# KERNCONF. If not defined a GENERIC kernel is built/installed.
429# Only the existing (depending TARGET) config files are used
430# for building kernels and only the first of these is designated
431# as the one being installed.
432#
433# Note that we have to use TARGET instead of TARGET_ARCH when
434# we're in kernel-land. Since only TARGET_ARCH is (expected) to
435# be set to cross-build, we have to make sure TARGET is set
436# properly.
437
438.if !defined(KERNCONF) && defined(KERNEL)
439KERNCONF=	${KERNEL}
440KERNWARN=	yes
441.else
442KERNCONF?=	GENERIC
443.endif
444INSTKERNNAME?=	kernel
445
446KRNLSRCDIR=	${.CURDIR}/sys
447KRNLCONFDIR=	${KRNLSRCDIR}/${TARGET}/conf
448KRNLOBJDIR=	${OBJTREE}${KRNLSRCDIR}
449KERNCONFDIR?=	${KRNLCONFDIR}
450
451BUILDKERNELS=
452INSTALLKERNEL=
453.for _kernel in ${KERNCONF}
454.if exists(${KERNCONFDIR}/${_kernel})
455BUILDKERNELS+=	${_kernel}
456.if empty(INSTALLKERNEL)
457INSTALLKERNEL= ${_kernel}
458.endif
459.endif
460.endfor
461
462#
463# buildkernel
464#
465# Builds all kernels defined by BUILDKERNELS.
466#
467buildkernel:
468.if empty(BUILDKERNELS)
469	@echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
470	@false
471.endif
472.if defined(KERNWARN)
473	@echo "--------------------------------------------------------------"
474	@echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
475	@echo "--------------------------------------------------------------"
476	@sleep 3
477.endif
478	@echo
479.for _kernel in ${BUILDKERNELS}
480	@echo "--------------------------------------------------------------"
481	@echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
482	@echo "--------------------------------------------------------------"
483	@echo "===> ${_kernel}"
484	mkdir -p ${KRNLOBJDIR}
485.if !defined(NO_KERNELCONFIG)
486	cd ${KRNLCONFDIR}; \
487		PATH=${TMPPATH} \
488		    config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
489			${KERNCONFDIR}/${_kernel}
490.endif
491.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
492	cd ${KRNLOBJDIR}/${_kernel}; \
493	    ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
494.endif
495	cd ${KRNLOBJDIR}/${_kernel}; \
496	    MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx/aicasm \
497	    ${MAKE} -DNO_CPU_CFLAGS -f ${KRNLSRCDIR}/dev/aic7xxx/aicasm/Makefile
498	cd ${KRNLOBJDIR}/${_kernel}; \
499	    ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
500# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
501.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules)
502.for target in obj depend all
503	cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
504	    MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
505	    ${MAKE} -DNO_CPU_CFLAGS ${target}
506.endfor
507.endif
508.if !defined(NO_KERNELDEPEND)
509	cd ${KRNLOBJDIR}/${_kernel}; \
510	    ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
511.endif
512	cd ${KRNLOBJDIR}/${_kernel}; \
513	    ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
514	@echo "--------------------------------------------------------------"
515	@echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
516	@echo "--------------------------------------------------------------"
517.endfor
518
519#
520# installkernel
521#
522# Install the kernel defined by INSTALLKERNEL
523#
524installkernel reinstallkernel:
525.if empty(INSTALLKERNEL)
526	@echo "ERROR: No kernel \"${KERNCONF}\" to install."
527	@false
528.endif
529	cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
530	    ${CROSSENV} PATH=${TMPPATH} \
531	    ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
532
533#
534# update
535#
536# Update the source tree, by running sup and/or running cvs to update to the
537# latest copy.
538#
539update:
540.if defined(SUP_UPDATE)
541	@echo "--------------------------------------------------------------"
542	@echo ">>> Running ${SUP}"
543	@echo "--------------------------------------------------------------"
544.if defined(SUPFILE)
545	@${SUP} ${SUPFLAGS} ${SUPFILE}
546.endif
547.if defined(SUPFILE1)
548	@${SUP} ${SUPFLAGS} ${SUPFILE1}
549.endif
550.if defined(SUPFILE2)
551	@${SUP} ${SUPFLAGS} ${SUPFILE2}
552.endif
553.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
554	@${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
555.endif
556.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
557	@${SUP} ${SUPFLAGS} ${DOCSUPFILE}
558.endif
559.endif
560.if defined(CVS_UPDATE)
561	@echo "--------------------------------------------------------------"
562	@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
563	@echo "--------------------------------------------------------------"
564	cd ${.CURDIR}; ${CVS} -R -q update -A -P -d
565.endif
566
567#
568# most
569#
570# Build most of the user binaries on the existing system libs and includes.
571#
572most:
573	@echo "--------------------------------------------------------------"
574	@echo ">>> Building programs only"
575	@echo "--------------------------------------------------------------"
576.for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
577	cd ${.CURDIR}/${_dir};		${MAKE} DIRPRFX=${_dir}/ all
578.endfor
579
580#
581# installmost
582#
583# Install the binaries built by the 'most' target.  This does not include
584# libraries or include files.
585#
586installmost:
587	@echo "--------------------------------------------------------------"
588	@echo ">>> Installing programs only"
589	@echo "--------------------------------------------------------------"
590.for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
591	cd ${.CURDIR}/${_dir};		${MAKE} DIRPRFX=${_dir}/ install
592.endfor
593
594#
595# ------------------------------------------------------------------------
596#
597# From here onwards are utility targets used by the 'make world' and
598# related targets.  If your 'world' breaks, you may like to try to fix
599# the problem and manually run the following targets to attempt to
600# complete the build.  Beware, this is *not* guaranteed to work, you
601# need to have a pretty good grip on the current state of the system
602# to attempt to manually finish it.  If in doubt, 'make world' again.
603#
604
605#
606# bootstrap-tools: Build tools needed for compatibility
607#
608.if exists(${.CURDIR}/games) && !defined(NOGAMES)
609_strfile=	games/fortune/strfile
610.endif
611
612bootstrap-tools:
613.for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef \
614    usr.bin/makewhatis usr.bin/rpcgen usr.bin/uudecode \
615    usr.bin/xargs usr.bin/xinstall \
616    usr.sbin/config usr.sbin/kbdcontrol \
617    gnu/usr.bin/gperf gnu/usr.bin/groff gnu/usr.bin/texinfo
618	@${ECHODIR} "===> ${_tool}"; \
619		cd ${.CURDIR}/${_tool}; \
620		${MAKE} DIRPRFX=${_tool}/ obj; \
621		${MAKE} DIRPRFX=${_tool}/ depend; \
622		${MAKE} DIRPRFX=${_tool}/ all; \
623		${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
624.endfor
625
626#
627# build-tools: Build special purpose build tools
628#
629.if defined(MODULES_WITH_WORLD) && exists(${KRNLSRCDIR}/modules)
630_aicasm= sys/modules/aic7xxx/aicasm
631.endif
632
633.if exists(${.CURDIR}/share) && !defined(NOSHARE)
634_share=	share/syscons/scrnmaps
635.endif
636
637.if !defined(NO_FORTRAN)
638_fortran= gnu/usr.bin/cc/f771
639.endif
640
641.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
642    !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
643_libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
644    kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
645.endif
646
647build-tools:
648.for _tool in bin/csh bin/sh gnu/usr.bin/cc/cc_tools ${_fortran} \
649    ${_libkrb5} lib/libncurses ${_share} \
650    ${_aicasm} usr.bin/awk usr.bin/file usr.sbin/sysinstall
651	@${ECHODIR} "===> ${_tool}"; \
652		cd ${.CURDIR}/${_tool}; \
653		${MAKE} DIRPRFX=${_tool}/ obj; \
654		${MAKE} DIRPRFX=${_tool}/ build-tools
655.endfor
656
657#
658# cross-tools: Build cross-building tools
659#
660.if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
661_elf2exe=	usr.sbin/elf2exe
662.endif
663
664.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
665_btxld=	usr.sbin/btxld
666.if defined(RELEASEDIR)
667_kgzip=	usr.sbin/kgzip
668.endif
669.endif
670
671.if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH}
672_elf2aout=	usr.bin/elf2aout
673.endif
674
675.if defined(RELEASEDIR)
676_crunchide=	usr.sbin/crunch/crunchide
677.endif
678
679_xlint=	usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint
680
681cross-tools:
682.for _tool in ${_btxld} ${_elf2aout} ${_elf2exe} \
683    gnu/usr.bin/binutils ${_crunchide} \
684    gnu/usr.bin/cc ${_xlint} ${_kgzip}
685	@${ECHODIR} "===> ${_tool}"; \
686		cd ${.CURDIR}/${_tool}; \
687		${MAKE} DIRPRFX=${_tool}/ obj; \
688		${MAKE} DIRPRFX=${_tool}/ depend; \
689		${MAKE} DIRPRFX=${_tool}/ all; \
690		${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
691.endfor
692
693#
694# hierarchy - ensure that all the needed directories are present
695#
696hierarchy:
697	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
698
699#
700# libraries - build all libraries, and install them under ${DESTDIR}.
701#
702# The list of libraries with dependents (${_prebuild_libs}) and their
703# interdependencies (__L) are built automatically by the
704# ${.CURDIR}/tools/make_libdeps.sh script.
705#
706libraries:
707	cd ${.CURDIR}; \
708	    ${MAKE} -f Makefile.inc1 _startup_libs; \
709	    ${MAKE} -f Makefile.inc1 _prebuild_libs; \
710	    ${MAKE} -f Makefile.inc1 _generic_libs;
711
712# These dependencies are not automatically generated:
713#
714# gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
715# shared libraries for ELF.
716#
717_startup_libs=	gnu/lib/csu gnu/lib/libgcc
718.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
719_startup_libs+=	lib/csu/${MACHINE_ARCH}-elf
720.else
721_startup_libs+=	lib/csu/${MACHINE_ARCH}
722.endif
723
724_prebuild_libs=
725
726_generic_libs=	gnu/lib
727
728.if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
729_prebuild_libs+=	kerberos5/lib/libasn1
730_prebuild_libs+=	kerberos5/lib/libgssapi
731_prebuild_libs+=	kerberos5/lib/libkrb5
732_prebuild_libs+=	kerberos5/lib/libroken
733_generic_libs+=	kerberos5/lib
734.endif
735
736_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libkvm lib/libmd \
737		lib/libncurses lib/libopie lib/libpam lib/libradius \
738		lib/librpcsvc \
739		lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
740		lib/libz lib/msun
741
742lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
743lib/libypclnt__L: lib/librpcsvc__L
744
745_generic_libs+=	lib
746
747.if !defined(NOCRYPT) && !defined(NOSECURE)
748.if !defined(NO_OPENSSL)
749_prebuild_libs+=	secure/lib/libcrypto secure/lib/libssl
750.if !defined(NO_OPENSSH)
751_prebuild_libs+=	secure/lib/libssh
752secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
753.endif
754.endif
755_generic_libs+=	secure/lib
756.endif
757
758_generic_libs+=	usr.bin/lex/lib
759
760.if ${MACHINE_ARCH} == "i386"
761_generic_libs+=	usr.sbin/pcvt/keycap
762.endif
763
764.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
765${_lib}__L: .PHONY
766.if exists(${.CURDIR}/${_lib})
767	@${ECHODIR} "===> ${_lib}"; \
768		cd ${.CURDIR}/${_lib}; \
769		${MAKE} DIRPRFX=${_lib}/ depend; \
770		${MAKE} DIRPRFX=${_lib}/ all; \
771		${MAKE} DIRPRFX=${_lib}/ install
772.endif
773.endfor
774
775# libpam is special: we need to build static PAM modules before
776# static PAM library, and dynamic PAM library before dynamic PAM
777# modules.
778lib/libpam__L: .PHONY
779	@${ECHODIR} "===> lib/libpam"; \
780		cd ${.CURDIR}/lib/libpam; \
781		${MAKE} DIRPRFX=lib/libpam/ depend; \
782		${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
783		${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
784
785_startup_libs: ${_startup_libs:S/$/__L/}
786_prebuild_libs: ${_prebuild_libs:S/$/__L/}
787_generic_libs: ${_generic_libs:S/$/__L/}
788
789.for __target in all clean cleandepend cleandir depend includes obj
790.for entry in ${SUBDIR}
791${entry}.${__target}__D: .PHONY
792	@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
793		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
794		edir=${entry}.${MACHINE_ARCH}; \
795		cd ${.CURDIR}/$${edir}; \
796	else \
797		${ECHODIR} "===> ${DIRPRFX}${entry}"; \
798		edir=${entry}; \
799		cd ${.CURDIR}/$${edir}; \
800	fi; \
801	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
802.endfor
803par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
804.endfor
805
806.include <bsd.subdir.mk>
807