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