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