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