Makefile.inc1 revision 148685
1#
2# $FreeBSD: head/Makefile.inc1 148685 2005-08-03 20:27:06Z ru $
3#
4# Make command line options:
5#	-DNO_DYNAMICROOT do not link /bin and /sbin dynamically
6#	-DNO_KERBEROS Do not build Heimdal (Kerberos 5)
7#	-DNO_RESCUE do not build rescue binaries
8#	-DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
9#	-DNO_CLEAN do not clean at all
10#	-DNO_CRYPT will prevent building of crypt versions
11#	-DNO_MAN do not build the manual pages
12#	-DNO_NLS do not build Native Language Support files
13#	-DNO_PROFILE do not build profiled libraries
14#	-DNO_GAMES do not go into games subdir
15#	-DNO_SHARE do not go into share subdir
16#	-DNO_INFO do not make or install info files
17#	-DNO_LIBC_R do not build libc_r.
18#	-DNO_FORTRAN do not build g77 and related libraries.
19#	-DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
20#	-DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
21#	-DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
22#	-DNO_PORTSUPDATE do not update ports in ${MAKE} update
23#	-DNO_DOCUPDATE do not update doc in ${MAKE} update
24#	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
25#	TARGET_ARCH="arch" to crossbuild world to a different arch
26
27#
28# The intended user-driven targets are:
29# buildworld  - rebuild *everything*, including glue to help do upgrades
30# installworld- install everything built by "buildworld"
31# update      - convenient way to update your source tree (eg: cvsup/cvs)
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# We must do share/info early so that installation of info `dir'
38# entries works correctly.  Do it first since it is less likely to
39# grow dependencies on include and lib than vice versa.
40#
41# We must do lib and libexec before bin, because if installworld
42# installs a new /bin/sh, the 'make' command will *immediately*
43# use that new version.  And the new (dynamically-linked) /bin/sh
44# will expect to find appropriate libraries in /lib and /libexec.
45#
46# We must do etc last for install/distribute to work.
47#
48SUBDIR=	share/info include lib libexec bin
49.if !defined(NO_GAMES)
50SUBDIR+=games
51.endif
52SUBDIR+=gnu
53.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
54SUBDIR+=kerberos5
55.endif
56.if !defined(NO_RESCUE)
57SUBDIR+=rescue
58.endif
59SUBDIR+=sbin
60.if !defined(NO_CRYPT)
61SUBDIR+=secure
62.endif
63.if !defined(NO_SHARE)
64SUBDIR+=share
65.endif
66SUBDIR+=sys usr.bin usr.sbin etc
67
68# These are last, since it is nice to at least get the base system
69# rebuilt before you do them.
70.for _DIR in ${LOCAL_DIRS}
71.if exists(${.CURDIR}/${_DIR}/Makefile)
72SUBDIR+= ${_DIR}
73.endif
74.endfor
75
76.if defined(SUBDIR_OVERRIDE)
77SUBDIR=		${SUBDIR_OVERRIDE}
78.endif
79
80.if defined(NOCLEAN)
81NO_CLEAN=	${NOCLEAN}
82.endif
83.if defined(NO_CLEANDIR)
84CLEANDIR=	clean cleandepend
85.else
86CLEANDIR=	cleandir
87.endif
88
89CVS?=		cvs
90CVSFLAGS?=	-A -P -d -I!
91SUP?=		/usr/local/bin/cvsup
92SUPFLAGS?=	-g -L 2 -P -
93.if defined(SUPHOST)
94SUPFLAGS+=	-h ${SUPHOST}
95.endif
96
97MAKEOBJDIRPREFIX?=	/usr/obj
98.if !defined(OSRELDATE)
99.if exists(/usr/include/osreldate.h)
100OSRELDATE!=	awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
101		/usr/include/osreldate.h
102.else
103OSRELDATE=	0
104.endif
105.endif
106TARGET_ARCH?=	${MACHINE_ARCH}
107.if ${TARGET_ARCH} == ${MACHINE_ARCH}
108TARGET?=	${MACHINE}
109TARGET_CPUTYPE?=${CPUTYPE}
110.else
111TARGET?=	${TARGET_ARCH}
112TARGET_CPUTYPE?=
113.endif
114.if !empty(TARGET_CPUTYPE)
115_TARGET_CPUTYPE=${TARGET_CPUTYPE}
116.else
117_TARGET_CPUTYPE=dummy
118.endif
119_CPUTYPE!=	MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
120		-f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
121.if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
122.error CPUTYPE global should be set with ?=.
123.endif
124.if make(buildworld)
125BUILD_ARCH!=	sysctl -n hw.machine_arch
126.if ${MACHINE_ARCH} != ${BUILD_ARCH}
127.error To cross-build, set TARGET_ARCH.
128.endif
129.endif
130.if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING)
131OBJTREE=	${MAKEOBJDIRPREFIX}
132.else
133OBJTREE=	${MAKEOBJDIRPREFIX}/${TARGET}
134.endif
135WORLDTMP=	${OBJTREE}${.CURDIR}/tmp
136# /usr/games added for fortune which depend on strfile
137BPATH=		${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
138XPATH=		${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
139STRICTTMPPATH=	${BPATH}:${XPATH}
140TMPPATH=	${STRICTTMPPATH}:${PATH}
141
142INSTALLTMP!=	/usr/bin/mktemp -d -u -t install
143
144#
145# Building a world goes through the following stages
146#
147# 1. legacy stage [BMAKE]
148#	This stage is responsible for creating compatibility
149#	shims that are needed by the bootstrap-tools,
150#	build-tools and cross-tools stages.
151# 1. bootstrap-tools stage [BMAKE]
152#	This stage is responsible for creating programs that
153#	are needed for backward compatibility reasons. They
154#	are not built as cross-tools.
155# 2. build-tools stage [TMAKE]
156#	This stage is responsible for creating the object
157#	tree and building any tools that are needed during
158#	the build process.
159# 3. cross-tools stage [XMAKE]
160#	This stage is responsible for creating any tools that
161#	are needed for cross-builds. A cross-compiler is one
162#	of them.
163# 4. world stage [WMAKE]
164#	This stage actually builds the world.
165# 5. install stage (optional) [IMAKE]
166#	This stage installs a previously built world.
167#
168
169BOOTSTRAPPING?=	0
170
171# Common environment for world related stages
172CROSSENV=	MAKEOBJDIRPREFIX=${OBJTREE} \
173		MACHINE_ARCH=${TARGET_ARCH} \
174		MACHINE=${TARGET} \
175		CPUTYPE=${TARGET_CPUTYPE} \
176		GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
177		GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
178		GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
179
180# bootstrap-tools stage
181BMAKEENV=	INSTALL="sh ${.CURDIR}/tools/install.sh" \
182		PATH=${BPATH}:${PATH} \
183		WORLDTMP=${WORLDTMP} \
184		MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
185BMAKE=		MAKEOBJDIRPREFIX=${WORLDTMP} \
186		${BMAKEENV} ${MAKE} -f Makefile.inc1 \
187		DESTDIR= \
188		BOOTSTRAPPING=${OSRELDATE} \
189		-DNO_HTML -DNO_INFO -DNO_LINT -DNO_MAN -DNO_NLS -DNO_PIC \
190		-DNO_PROFILE -DNO_SHARED -DNO_CPU_CFLAGS -DNO_WARNS
191
192# build-tools stage
193TMAKE=		MAKEOBJDIRPREFIX=${OBJTREE} \
194		${BMAKEENV} ${MAKE} -f Makefile.inc1 \
195		DESTDIR= \
196		BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS
197
198# cross-tools stage
199XMAKE=		TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
200
201# world stage
202WMAKEENV=	${CROSSENV} \
203		_SHLIBDIRPREFIX=${WORLDTMP} \
204		INSTALL="sh ${.CURDIR}/tools/install.sh" \
205		PATH=${TMPPATH}
206WMAKE=		${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
207
208.if ${TARGET_ARCH} == "amd64"
209# 32 bit world
210LIB32TMP=	${OBJTREE}${.CURDIR}/lib32
211
212LIB32PREFLAGS=	-m32 -march=athlon-xp -msse2 -mfancy-math-387 -DCOMPAT_32BIT
213LIB32POSTFLAGS=	-I${LIB32TMP}/usr/include \
214		-L${LIB32TMP}/usr/lib32 \
215		-B${LIB32TMP}/usr/lib32
216LIB32CC=	${LIB32PREFLAGS} \
217		${LIB32POSTFLAGS}
218LIB32CXX=	${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/c++/3.4 \
219		${LIB32POSTFLAGS}
220LIB32OBJC=	${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/objc \
221		${LIB32POSTFLAGS}
222
223# Yes, the flags are redundant.
224LIB32MAKEENV=	MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
225		_SHLIBDIRPREFIX=${LIB32TMP} \
226		MACHINE=i386 \
227		MACHINE_ARCH=i386 \
228		INSTALL="sh ${.CURDIR}/tools/install.sh" \
229		PATH=${TMPPATH} \
230		CC="${CC} ${LIB32CC}" \
231		CXX="${CXX} ${LIB32CXX}" \
232		OBJC="${OBJC} ${LIB32OBJC}" \
233		LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
234		AS="${AS} --32" \
235		LIBDIR=/usr/lib32 \
236		SHLIBDIR=/usr/lib32
237
238LIB32MAKE=	${LIB32MAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
239		-DNO_BIND -DNO_MAN -DNO_NLS -DNO_INFO -DNO_HTML
240LIB32IMAKE=	${LIB32MAKE:NINSTALL=*}
241.endif
242
243# install stage
244.if empty(.MAKEFLAGS:M-n)
245IMAKEENV=	${CROSSENV} \
246		PATH=${STRICTTMPPATH}:${INSTALLTMP}
247.else
248IMAKEENV=	${CROSSENV} \
249		PATH=${TMPPATH}:${INSTALLTMP}
250.endif
251IMAKE=		${IMAKEENV} ${MAKE} -f Makefile.inc1
252
253# kernel stage
254KMAKEENV=	${WMAKEENV}
255
256#
257# buildworld
258#
259# Attempt to rebuild the entire system, with reasonable chance of
260# success, regardless of how old your existing system is.
261#
262_worldtmp:
263.if ${.CURDIR:C/[^,]//g} != ""
264#	The m4 build of sendmail files doesn't like it if ',' is used
265#	anywhere in the path of it's files.
266	@echo
267	@echo "*** Error: path to source tree contains a comma ','"
268	@echo
269	false
270.endif
271	@echo
272	@echo "--------------------------------------------------------------"
273	@echo ">>> Rebuilding the temporary build tree"
274	@echo "--------------------------------------------------------------"
275.if !defined(NO_CLEAN)
276	rm -rf ${WORLDTMP}
277.else
278	rm -rf ${WORLDTMP}/legacy/usr/include
279	# XXX - These two can depend on any header file.
280	rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
281	rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
282.endif
283.for _dir in \
284    usr/bin usr/games usr/include/c++/3.4 usr/include/sys usr/lib \
285    usr/libexec usr/sbin usr/share/dict \
286    usr/share/groff_font/devX100 \
287    usr/share/groff_font/devX100-12 \
288    usr/share/groff_font/devX75 \
289    usr/share/groff_font/devX75-12 \
290    usr/share/groff_font/devascii \
291    usr/share/groff_font/devcp1047 \
292    usr/share/groff_font/devdvi \
293    usr/share/groff_font/devhtml \
294    usr/share/groff_font/devkoi8-r \
295    usr/share/groff_font/devlatin1 \
296    usr/share/groff_font/devlbp \
297    usr/share/groff_font/devlj4 \
298    usr/share/groff_font/devps \
299    usr/share/groff_font/devutf8 \
300    usr/share/tmac/mdoc usr/share/tmac/mm
301	mkdir -p ${WORLDTMP}/legacy/${_dir}
302.endfor
303.for _dir in \
304    lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
305    usr/libexec usr/sbin usr/share/misc \
306    usr/share/snmp/defs usr/share/snmp/mibs
307	mkdir -p ${WORLDTMP}/${_dir}
308.endfor
309	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
310	    -p ${WORLDTMP}/usr/include >/dev/null
311	ln -sf ${.CURDIR}/sys ${WORLDTMP}
312.if defined(WITH_BIND_LIBS) && !defined(NO_BIND)
313	mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
314	    -p ${WORLDTMP}/usr/include >/dev/null
315.endif
316_legacy:
317	@echo
318	@echo "--------------------------------------------------------------"
319	@echo ">>> stage 1.1: legacy release compatibility shims"
320	@echo "--------------------------------------------------------------"
321	${_+_}cd ${.CURDIR}; ${BMAKE} legacy
322_bootstrap-tools:
323	@echo
324	@echo "--------------------------------------------------------------"
325	@echo ">>> stage 1.2: bootstrap tools"
326	@echo "--------------------------------------------------------------"
327	${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
328_cleanobj:
329.if !defined(NO_CLEAN)
330	@echo
331	@echo "--------------------------------------------------------------"
332	@echo ">>> stage 2.1: cleaning up the object tree"
333	@echo "--------------------------------------------------------------"
334	${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
335.endif
336_obj:
337	@echo
338	@echo "--------------------------------------------------------------"
339	@echo ">>> stage 2.2: rebuilding the object tree"
340	@echo "--------------------------------------------------------------"
341	${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
342_build-tools:
343	@echo
344	@echo "--------------------------------------------------------------"
345	@echo ">>> stage 2.3: build tools"
346	@echo "--------------------------------------------------------------"
347	${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
348_cross-tools:
349	@echo
350	@echo "--------------------------------------------------------------"
351	@echo ">>> stage 3: cross tools"
352	@echo "--------------------------------------------------------------"
353	${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
354_includes:
355	@echo
356	@echo "--------------------------------------------------------------"
357	@echo ">>> stage 4.1: building includes"
358	@echo "--------------------------------------------------------------"
359	${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
360_libraries:
361	@echo
362	@echo "--------------------------------------------------------------"
363	@echo ">>> stage 4.2: building libraries"
364	@echo "--------------------------------------------------------------"
365	${_+_}cd ${.CURDIR}; \
366	    ${WMAKE} -DNO_FSCHG -DNO_HTML -DNO_INFO -DNO_LINT -DNO_MAN \
367	    -DNO_NLS -DNO_PROFILE libraries
368_depend:
369	@echo
370	@echo "--------------------------------------------------------------"
371	@echo ">>> stage 4.3: make dependencies"
372	@echo "--------------------------------------------------------------"
373	${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
374everything:
375	@echo
376	@echo "--------------------------------------------------------------"
377	@echo ">>> stage 4.4: building everything"
378	@echo "--------------------------------------------------------------"
379	${_+_}cd ${.CURDIR}; ${WMAKE} par-all
380.if ${TARGET_ARCH} == "amd64"
381build32:
382	@echo
383	@echo "--------------------------------------------------------------"
384	@echo ">>> stage 5.1: building 32 bit shim libraries"
385	@echo "--------------------------------------------------------------"
386.for _dir in \
387    lib lib32 usr/bin usr/include usr/lib32 usr/libdata/ldscripts \
388    usr/libexec usr/sbin usr/share/misc \
389    usr/share/snmp/defs usr/share/snmp/mibs
390	mkdir -p ${LIB32TMP}/${_dir}
391.endfor
392	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
393	    -p ${LIB32TMP}/usr/include >/dev/null
394	ln -sf ${.CURDIR}/sys ${WORLDTMP}
395.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
396.for _t in obj depend all
397	cd ${.CURDIR}/kerberos5/tools; \
398	    MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= ${_t}
399.endfor
400.endif
401.for _t in obj includes
402	cd ${.CURDIR}/include; \
403	    ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
404	cd ${.CURDIR}/lib; \
405	    ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
406	cd ${.CURDIR}/gnu/lib; \
407	    ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
408.if !defined(NO_CRYPT)
409	cd ${.CURDIR}/secure/lib; \
410	    ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
411.endif
412.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
413	cd ${.CURDIR}/kerberos5/lib; \
414	    ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
415.endif
416.endfor
417.for _dir in usr.sbin/pcvt/keycap usr.bin/lex/lib
418	cd ${.CURDIR}/${_dir}; \
419	    ${LIB32MAKE} DESTDIR=${LIB32TMP} obj
420.endfor
421.for _dir in lib/libncurses lib/libmagic
422	cd ${.CURDIR}/${_dir}; \
423	    MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= build-tools
424.endfor
425	cd ${.CURDIR}; \
426	    ${LIB32MAKE} -f Makefile.inc1 DESTDIR=${LIB32TMP} libraries 
427.for _t in obj depend all
428	cd ${.CURDIR}/libexec/rtld-elf; \
429	    PROG=ld-elf32.so.1 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
430.endfor
431
432distribute32 install32:
433.if make(distribute32)
434	mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32	# XXX add to mtree
435.else
436	mkdir -p ${DESTDIR}/usr/lib32			# XXX add to mtree
437.endif
438	cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
439	cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
440.if !defined(NO_CRYPT)
441	cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
442.endif
443	cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
444.endif
445
446
447WMAKE_TGTS=
448.if !defined(SUBDIR_OVERRIDE)
449WMAKE_TGTS+=	_worldtmp _legacy _bootstrap-tools
450.endif
451WMAKE_TGTS+=	_cleanobj _obj _build-tools
452.if !defined(SUBDIR_OVERRIDE)
453WMAKE_TGTS+=	_cross-tools
454.endif
455WMAKE_TGTS+=	_includes _libraries _depend everything
456.if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32)
457WMAKE_TGTS+=	build32
458.endif
459
460buildworld: ${WMAKE_TGTS}
461.ORDER: ${WMAKE_TGTS}
462
463buildenv:
464	@echo Entering world for ${TARGET_ARCH}:${TARGET}
465	@cd ${.CURDIR} && env ${WMAKEENV} sh || true
466
467TOOLCHAIN_TGTS=	${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
468toolchain: ${TOOLCHAIN_TGTS}
469kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
470
471#
472# Use this to add checks to installworld/installkernel targets.
473#
474SPECIAL_INSTALLCHECKS=
475
476#
477# installcheck
478#
479# Checks to be sure system is ready for installworld
480#
481CHECK_UIDS=
482CHECK_GIDS=
483.if !defined(NO_SENDMAIL)
484CHECK_UIDS+=	smmsp
485CHECK_GIDS+=	smmsp
486.endif
487.if !defined(NO_PF)
488CHECK_UIDS+=	proxy
489CHECK_GIDS+=	proxy authpf
490.endif
491installcheck: ${SPECIAL_INSTALLCHECKS}
492.for uid in ${CHECK_UIDS}
493	@if ! `id -u ${uid} >/dev/null 2>&1`; then \
494		echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
495		false; \
496	fi
497.endfor
498.for gid in ${CHECK_GIDS}
499	@if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
500		echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
501		false; \
502	fi
503.endfor
504
505#
506# distributeworld
507#
508# Distributes everything compiled by a `buildworld'.
509#
510# installworld
511#
512# Installs everything compiled by a 'buildworld'.
513#
514distributeworld installworld: installcheck
515	mkdir -p ${INSTALLTMP}
516	for prog in [ awk cap_mkdb cat chflags chmod chown \
517	    date echo egrep find grep install-info \
518	    ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
519	    test true uname wc zic; do \
520		cp `which $$prog` ${INSTALLTMP}; \
521	done
522	${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
523	rm -rf ${INSTALLTMP}
524
525#
526# reinstall
527#
528# If you have a build server, you can NFS mount the source and obj directories
529# and do a 'make reinstall' on the *client* to install new binaries from the
530# most recent server build.
531#
532reinstall: ${SPECIAL_INSTALLCHECKS}
533	@echo "--------------------------------------------------------------"
534	@echo ">>> Making hierarchy"
535	@echo "--------------------------------------------------------------"
536	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
537	@echo
538	@echo "--------------------------------------------------------------"
539	@echo ">>> Installing everything"
540	@echo "--------------------------------------------------------------"
541	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
542.if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32)
543	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
544.endif
545
546redistribute:
547	@echo "--------------------------------------------------------------"
548	@echo ">>> Distributing everything"
549	@echo "--------------------------------------------------------------"
550	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
551.if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32)
552	${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 DISTRIBUTION=lib32
553.endif
554
555distrib-dirs distribution:
556	cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
557
558#
559# buildkernel and installkernel
560#
561# Which kernels to build and/or install is specified by setting
562# KERNCONF. If not defined a GENERIC kernel is built/installed.
563# Only the existing (depending TARGET) config files are used
564# for building kernels and only the first of these is designated
565# as the one being installed.
566#
567# Note that we have to use TARGET instead of TARGET_ARCH when
568# we're in kernel-land. Since only TARGET_ARCH is (expected) to
569# be set to cross-build, we have to make sure TARGET is set
570# properly.
571
572.if !defined(KERNCONF) && defined(KERNEL)
573KERNCONF=	${KERNEL}
574KERNWARN=
575.else
576KERNCONF?=	GENERIC
577.endif
578INSTKERNNAME?=	kernel
579
580KERNSRCDIR?=	${.CURDIR}/sys
581KRNLCONFDIR=	${KERNSRCDIR}/${TARGET}/conf
582KRNLOBJDIR=	${OBJTREE}${KERNSRCDIR}
583KERNCONFDIR?=	${KRNLCONFDIR}
584
585BUILDKERNELS=
586INSTALLKERNEL=
587.for _kernel in ${KERNCONF}
588.if exists(${KERNCONFDIR}/${_kernel})
589BUILDKERNELS+=	${_kernel}
590.if empty(INSTALLKERNEL)
591INSTALLKERNEL= ${_kernel}
592.endif
593.endif
594.endfor
595
596#
597# buildkernel
598#
599# Builds all kernels defined by BUILDKERNELS.
600#
601buildkernel:
602.if empty(BUILDKERNELS)
603	@echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
604	false
605.endif
606.if defined(KERNWARN)
607	@echo "--------------------------------------------------------------"
608	@echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
609	@echo "--------------------------------------------------------------"
610	@sleep 3
611.endif
612	@echo
613.for _kernel in ${BUILDKERNELS}
614	@echo "--------------------------------------------------------------"
615	@echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
616	@echo "--------------------------------------------------------------"
617	@echo "===> ${_kernel}"
618	mkdir -p ${KRNLOBJDIR}
619.if !defined(NO_KERNELCONFIG)
620	@echo
621	@echo "--------------------------------------------------------------"
622	@echo ">>> stage 1: configuring the kernel"
623	@echo "--------------------------------------------------------------"
624	cd ${KRNLCONFDIR}; \
625		PATH=${TMPPATH} \
626		    config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
627			${KERNCONFDIR}/${_kernel}
628.endif
629.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
630	@echo
631	@echo "--------------------------------------------------------------"
632	@echo ">>> stage 2.1: cleaning up the object tree"
633	@echo "--------------------------------------------------------------"
634	cd ${KRNLOBJDIR}/${_kernel}; \
635	    ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
636.endif
637	@echo
638	@echo "--------------------------------------------------------------"
639	@echo ">>> stage 2.2: rebuilding the object tree"
640	@echo "--------------------------------------------------------------"
641	cd ${KRNLOBJDIR}/${_kernel}; \
642	    ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
643	@echo
644	@echo "--------------------------------------------------------------"
645	@echo ">>> stage 2.3: build tools"
646	@echo "--------------------------------------------------------------"
647	cd ${KRNLOBJDIR}/${_kernel}; \
648	    MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
649	    ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
650# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
651.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
652.for target in obj depend all
653	cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
654	    MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
655	    ${MAKE} -DNO_CPU_CFLAGS ${target}
656.endfor
657.endif
658.if !defined(NO_KERNELDEPEND)
659	@echo
660	@echo "--------------------------------------------------------------"
661	@echo ">>> stage 3.1: making dependencies"
662	@echo "--------------------------------------------------------------"
663	cd ${KRNLOBJDIR}/${_kernel}; \
664	    ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
665.endif
666	@echo
667	@echo "--------------------------------------------------------------"
668	@echo ">>> stage 3.2: building everything"
669	@echo "--------------------------------------------------------------"
670	cd ${KRNLOBJDIR}/${_kernel}; \
671	    ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
672	@echo "--------------------------------------------------------------"
673	@echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
674	@echo "--------------------------------------------------------------"
675.endfor
676
677#
678# installkernel, etc.
679#
680# Install the kernel defined by INSTALLKERNEL
681#
682installkernel installkernel.debug \
683reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS}
684.if empty(INSTALLKERNEL)
685	@echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
686	false
687.endif
688	@echo "--------------------------------------------------------------"
689	@echo ">>> Making hierarchy"
690	@echo "--------------------------------------------------------------"
691	cd ${.CURDIR}; \
692	    ${CROSSENV} PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 hierarchy
693	@echo
694	@echo "--------------------------------------------------------------"
695	@echo ">>> Installing kernel"
696	@echo "--------------------------------------------------------------"
697	cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
698	    ${CROSSENV} PATH=${TMPPATH} \
699	    ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
700
701#
702# update
703#
704# Update the source tree, by running cvsup and/or running cvs to update to the
705# latest copy.
706#
707update:
708.if defined(SUP_UPDATE)
709	@echo "--------------------------------------------------------------"
710	@echo ">>> Running ${SUP}"
711	@echo "--------------------------------------------------------------"
712.if defined(SUPFILE)
713	@${SUP} ${SUPFLAGS} ${SUPFILE}
714.endif
715.if defined(SUPFILE1)
716	@${SUP} ${SUPFLAGS} ${SUPFILE1}
717.endif
718.if defined(SUPFILE2)
719	@${SUP} ${SUPFLAGS} ${SUPFILE2}
720.endif
721.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
722	@${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
723.endif
724.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
725	@${SUP} ${SUPFLAGS} ${DOCSUPFILE}
726.endif
727.endif
728.if defined(CVS_UPDATE)
729	@echo "--------------------------------------------------------------"
730	@echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT}
731	@echo "--------------------------------------------------------------"
732	cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS}
733.endif
734
735#
736# ------------------------------------------------------------------------
737#
738# From here onwards are utility targets used by the 'make world' and
739# related targets.  If your 'world' breaks, you may like to try to fix
740# the problem and manually run the following targets to attempt to
741# complete the build.  Beware, this is *not* guaranteed to work, you
742# need to have a pretty good grip on the current state of the system
743# to attempt to manually finish it.  If in doubt, 'make world' again.
744#
745
746#
747# legacy: Build compatibility shims for the next three targets
748#
749legacy:
750.if ${BOOTSTRAPPING} < 503000
751	@echo "ERROR: Source upgrades from versions prior to 5.3 not supported."; \
752	false
753.endif
754.for _tool in tools/build
755	${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
756	    cd ${.CURDIR}/${_tool}; \
757	    ${MAKE} DIRPRFX=${_tool}/ obj; \
758	    ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
759	    ${MAKE} DIRPRFX=${_tool}/ depend; \
760	    ${MAKE} DIRPRFX=${_tool}/ all; \
761	    ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
762.endfor
763
764#
765# bootstrap-tools: Build tools needed for compatibility
766#
767.if !defined(NO_GAMES)
768_strfile=	games/fortune/strfile
769.endif
770
771.if !defined(NO_CXX)
772_gperf=		gnu/usr.bin/gperf
773.if ${BOOTSTRAPPING} < 500113
774_groff=		gnu/usr.bin/groff
775.else
776_groff=		gnu/usr.bin/groff/tmac
777.endif
778.endif
779
780.if ${BOOTSTRAPPING} < 600029
781_texinfo=	gnu/usr.bin/texinfo
782.endif
783
784.if ${BOOTSTRAPPING} < 600015
785_cap_mkdb=	usr.bin/cap_mkdb
786.endif
787
788.if ${BOOTSTRAPPING} < 600018
789_colldef=	usr.bin/colldef
790.endif
791
792.if ${BOOTSTRAPPING} < 600017
793_gencat=	usr.bin/gencat
794.endif
795
796.if ${BOOTSTRAPPING} < 600016
797_mklocale=	usr.bin/mklocale
798.endif
799
800.if !defined(NO_RESCUE) && \
801    ${BOOTSTRAPPING} < 600008
802_crunchgen=	usr.sbin/crunch/crunchgen
803.endif
804
805.if ${BOOTSTRAPPING} < 600020
806_pwd_mkdb=	usr.sbin/pwd_mkdb
807.endif
808
809bootstrap-tools:
810.for _tool in \
811    ${_strfile} \
812    ${_gperf} \
813    ${_groff} \
814    ${_texinfo} \
815    ${_cap_mkdb} \
816    ${_colldef} \
817    ${_gencat} \
818    usr.bin/lorder \
819    usr.bin/makewhatis \
820    ${_mklocale} \
821    usr.bin/rpcgen \
822    usr.bin/xinstall \
823    usr.sbin/config \
824    ${_crunchgen} \
825    ${_pwd_mkdb}
826	${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
827		cd ${.CURDIR}/${_tool}; \
828		${MAKE} DIRPRFX=${_tool}/ obj; \
829		${MAKE} DIRPRFX=${_tool}/ depend; \
830		${MAKE} DIRPRFX=${_tool}/ all; \
831		${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
832.endfor
833
834#
835# build-tools: Build special purpose build tools
836#
837.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
838_aicasm= sys/modules/aic7xxx/aicasm
839.endif
840
841.if !defined(NO_SHARE)
842_share=	share/syscons/scrnmaps
843.endif
844
845.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
846_kerberos5_tools= kerberos5/tools
847.endif
848
849.if !defined(NO_RESCUE)
850_rescue= rescue/rescue
851.endif
852
853build-tools:
854.for _tool in \
855    bin/csh \
856    bin/sh \
857    ${_rescue} \
858    lib/libncurses \
859    ${_share} \
860    ${_aicasm} \
861    usr.bin/awk \
862    lib/libmagic \
863    usr.sbin/sysinstall
864	${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
865		cd ${.CURDIR}/${_tool}; \
866		${MAKE} DIRPRFX=${_tool}/ obj; \
867		${MAKE} DIRPRFX=${_tool}/ build-tools
868.endfor
869.for _tool in \
870    gnu/usr.bin/cc/cc_tools \
871    ${_kerberos5_tools}
872	${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
873		cd ${.CURDIR}/${_tool}; \
874		${MAKE} DIRPRFX=${_tool}/ obj; \
875		${MAKE} DIRPRFX=${_tool}/ depend; \
876		${MAKE} DIRPRFX=${_tool}/ all
877.endfor
878
879#
880# cross-tools: Build cross-building tools
881#
882.if (${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386") && \
883    ${TARGET_ARCH} != ${MACHINE_ARCH}
884_btxld=		usr.sbin/btxld
885.endif
886
887.if (!defined(NO_RESCUE) || defined(RELEASEDIR)) && \
888    ${TARGET_ARCH} != ${MACHINE_ARCH}
889_crunchide=	usr.sbin/crunch/crunchide
890.endif
891
892.if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
893_elf2exe=	usr.sbin/elf2exe
894.endif
895
896.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
897    defined(RELEASEDIR)
898_kgzip=		usr.sbin/kgzip
899.endif
900
901cross-tools:
902.for _tool in \
903    gnu/usr.bin/binutils \
904    gnu/usr.bin/cc \
905    usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
906    ${_btxld} \
907    ${_crunchide} \
908    ${_elf2exe} \
909    ${_kgzip}
910	${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
911		cd ${.CURDIR}/${_tool}; \
912		${MAKE} DIRPRFX=${_tool}/ obj; \
913		${MAKE} DIRPRFX=${_tool}/ depend; \
914		${MAKE} DIRPRFX=${_tool}/ all; \
915		${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
916.endfor
917
918#
919# hierarchy - ensure that all the needed directories are present
920#
921hierarchy:
922	cd ${.CURDIR}/etc;		${MAKE} distrib-dirs
923
924#
925# libraries - build all libraries, and install them under ${DESTDIR}.
926#
927# The list of libraries with dependents (${_prebuild_libs}) and their
928# interdependencies (__L) are built automatically by the
929# ${.CURDIR}/tools/make_libdeps.sh script.
930#
931libraries:
932	cd ${.CURDIR}; \
933	    ${MAKE} -f Makefile.inc1 _startup_libs; \
934	    ${MAKE} -f Makefile.inc1 _prebuild_libs; \
935	    ${MAKE} -f Makefile.inc1 _generic_libs;
936
937# These dependencies are not automatically generated:
938#
939# gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
940# shared libraries for ELF.
941#
942_startup_libs=	gnu/lib/csu gnu/lib/libgcc
943.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
944_startup_libs+=	lib/csu/${MACHINE_ARCH}-elf
945.else
946_startup_libs+=	lib/csu/${MACHINE_ARCH}
947.endif
948
949_prebuild_libs=
950
951_generic_libs=	gnu/lib
952
953.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
954_prebuild_libs+=	kerberos5/lib/libasn1
955_prebuild_libs+=	kerberos5/lib/libgssapi
956_prebuild_libs+=	kerberos5/lib/libkrb5
957_prebuild_libs+=	kerberos5/lib/libroken
958_generic_libs+=	kerberos5/lib
959.endif
960
961_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
962		lib/libkvm lib/libmd \
963		lib/libncurses lib/libnetgraph lib/libopie lib/libpam \
964		lib/libradius \
965		lib/libsbuf lib/libtacplus lib/libutil \
966		lib/libz lib/msun
967
968lib/libopie__L lib/libtacplus__L: lib/libmd__L
969
970_generic_libs+=	lib
971
972.if !defined(NO_CRYPT)
973.if !defined(NO_OPENSSL)
974_prebuild_libs+=	secure/lib/libcrypto secure/lib/libssl
975lib/libradius__L: secure/lib/libssl__L
976secure/lib/libssl__L: secure/lib/libcrypto__L
977.if !defined(NO_OPENSSH)
978_prebuild_libs+=	secure/lib/libssh
979secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
980.if !defined(NO_KERBEROS)
981secure/lib/libssh__L: kerberos5/lib/libgssapi__L kerberos5/lib/libkrb5__L \
982    kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \
983    kerberos5/lib/libroken__L
984.endif
985.endif
986.endif
987_generic_libs+=	secure/lib
988.endif
989
990.if defined(NO_CRYPT) || defined(NO_OPENSSL)
991lib/libradius__L: lib/libmd__L
992.endif
993
994.if !defined(NO_NIS)
995_prebuild_libs+=	lib/libypclnt
996.endif
997
998_generic_libs+=	usr.bin/lex/lib
999
1000.if ${MACHINE_ARCH} == "i386"
1001_generic_libs+=	usr.sbin/pcvt/keycap
1002.endif
1003
1004.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1005${_lib}__L: .PHONY
1006.if exists(${.CURDIR}/${_lib})
1007	${_+_}@${ECHODIR} "===> ${_lib} (depend,all,install)"; \
1008		cd ${.CURDIR}/${_lib}; \
1009		${MAKE} DIRPRFX=${_lib}/ depend; \
1010		${MAKE} DIRPRFX=${_lib}/ all; \
1011		${MAKE} DIRPRFX=${_lib}/ install
1012.endif
1013.endfor
1014
1015# libpam is special: we need to build static PAM modules before
1016# static PAM library, and dynamic PAM library before dynamic PAM
1017# modules.
1018lib/libpam__L: .PHONY
1019	${_+_}@${ECHODIR} "===> lib/libpam (depend,all,install)"; \
1020		cd ${.CURDIR}/lib/libpam; \
1021		${MAKE} DIRPRFX=lib/libpam/ depend; \
1022		${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1023		${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1024
1025_startup_libs: ${_startup_libs:S/$/__L/}
1026_prebuild_libs: ${_prebuild_libs:S/$/__L/}
1027_generic_libs: ${_generic_libs:S/$/__L/}
1028
1029.for __target in all clean cleandepend cleandir depend includes obj
1030.for entry in ${SUBDIR}
1031${entry}.${__target}__D: .PHONY
1032	${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1033		${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1034		edir=${entry}.${MACHINE_ARCH}; \
1035		cd ${.CURDIR}/$${edir}; \
1036	else \
1037		${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1038		edir=${entry}; \
1039		cd ${.CURDIR}/$${edir}; \
1040	fi; \
1041	${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1042.endfor
1043par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1044.endfor
1045
1046.include <bsd.subdir.mk>
1047
1048.if make(delete-old) || make(delete-old-libs) || make(check-old)
1049
1050#
1051# check for / delete old files section
1052#
1053
1054.include "ObsoleteFiles.inc"
1055
1056OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1057else you can not start such an application. Consult UPDATING for more \
1058information regarding how to cope with the removal/revision bump of a \
1059specific library."
1060
1061.if !defined(BATCH_DELETE_OLD_FILES)
1062RM_I=-i
1063.else
1064RM_I=-v
1065.endif
1066
1067delete-old-files:
1068	@echo ">>> Removing old files (only deletes safe to delete libs)"
1069.for file in ${OLD_FILES}
1070# Ask for every old file if the user really wants to remove it.
1071# It's anoying, but beter safe than sorry.
1072	@[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \
1073                ||  ([ -f "${DESTDIR}/${file}" ] \
1074                        && echo "Removing schg flag on ${DESTDIR}/${file}" \
1075                        && chflags noschg "${DESTDIR}/${file}" \
1076                        && rm ${RM_I} "${DESTDIR}/${file}"))
1077.endfor
1078	@echo ">>> Old files removed"
1079
1080check-old-files:
1081	@echo ">>> Checking for old files"
1082.for file in ${OLD_FILES}
1083	@[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}"
1084.endfor
1085
1086delete-old-libs:
1087	@echo ">>> Removing old libraries"
1088	@echo "${OLD_LIBS_MESSAGE}" | fmt
1089.for file in ${OLD_LIBS}
1090	@[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \
1091		||  ([ -f "${DESTDIR}/${file}" ] \
1092			&& echo "Removing schg flag on ${DESTDIR}/${file}" \
1093			&& chflags noschg "${DESTDIR}/${file}" \
1094			&& rm ${RM_I} "${DESTDIR}/${file}"))
1095.endfor
1096	@echo ">>> Old libraries removed"
1097
1098check-old-libs:
1099	@echo ">>> Checking for old libraries"
1100.for file in ${OLD_LIBS}
1101	@[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}"
1102.endfor
1103
1104delete-old-dirs:
1105	@echo ">>> Removing old directories"
1106.for dir in ${OLD_DIRS}
1107# Don't fail if an old directory isn't empty.
1108	@[ ! -d "${DESTDIR}/${dir}" ] || (rmdir -v "${DESTDIR}/${dir}" || true)
1109.endfor
1110	@echo ">>> Old directories removed"
1111
1112check-old-dirs:
1113	@echo ">>> Checking for old directories"
1114.for dir in ${OLD_DIRS}
1115	@[ ! -d "${DESTDIR}/${dir}" ] || echo "${DESTDIR}/${dir}"
1116.endfor
1117
1118delete-old: delete-old-files delete-old-dirs
1119	@echo "To remove old libraries run '${MAKE} delete-old-libs'."
1120
1121check-old: check-old-files check-old-libs check-old-dirs
1122	@echo "To remove old files and directories run '${MAKE} delete-old'."
1123	@echo "To remove old libraries run '${MAKE} delete-old-libs'."
1124
1125.endif
1126
1127