]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.inc1
This commit was generated by cvs2svn to compensate for changes in r161863,
[FreeBSD/FreeBSD.git] / Makefile.inc1
1 #
2 # $FreeBSD$
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
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 #
40 SUBDIR= share/info include lib libexec bin
41 .if ${MK_GAMES} != "no"
42 SUBDIR+=games
43 .endif
44 SUBDIR+=gnu
45 .if ${MK_KERBEROS} != "no"
46 SUBDIR+=kerberos5
47 .endif
48 .if ${MK_RESCUE} != "no"
49 SUBDIR+=rescue
50 .endif
51 SUBDIR+=sbin
52 .if ${MK_CRYPT} != "no"
53 SUBDIR+=secure
54 .endif
55 .if !defined(NO_SHARE)
56 SUBDIR+=share
57 .endif
58 SUBDIR+=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)
64 SUBDIR+= ${_DIR}
65 .endif
66 .endfor
67
68 .if defined(SUBDIR_OVERRIDE)
69 SUBDIR=         ${SUBDIR_OVERRIDE}
70 .endif
71
72 .if defined(NOCLEAN)
73 NO_CLEAN=       ${NOCLEAN}
74 .endif
75 .if defined(NO_CLEANDIR)
76 CLEANDIR=       clean cleandepend
77 .else
78 CLEANDIR=       cleandir
79 .endif
80
81 CVS?=           cvs
82 CVSFLAGS?=      -A -P -d -I!
83 SUP?=           /usr/bin/csup
84 SUPFLAGS?=      -g -L 2
85 .if defined(SUPHOST)
86 SUPFLAGS+=      -h ${SUPHOST}
87 .endif
88
89 MAKEOBJDIRPREFIX?=      /usr/obj
90 .if !defined(OSRELDATE)
91 .if exists(/usr/include/osreldate.h)
92 OSRELDATE!=     awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
93                 /usr/include/osreldate.h
94 .else
95 OSRELDATE=      0
96 .endif
97 .endif
98 TARGET_ARCH?=   ${MACHINE_ARCH}
99 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
100 TARGET?=        ${MACHINE}
101 TARGET_CPUTYPE?=${CPUTYPE}
102 .else
103 TARGET?=        ${TARGET_ARCH}
104 TARGET_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)
117 BUILD_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)
123 OBJTREE=        ${MAKEOBJDIRPREFIX}
124 .else
125 OBJTREE=        ${MAKEOBJDIRPREFIX}/${TARGET}
126 .endif
127 WORLDTMP=       ${OBJTREE}${.CURDIR}/tmp
128 # /usr/games added for fortune which depend on strfile
129 BPATH=          ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
130 XPATH=          ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
131 STRICTTMPPATH=  ${BPATH}:${XPATH}
132 TMPPATH=        ${STRICTTMPPATH}:${PATH}
133
134 INSTALLTMP!=    /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
161 BOOTSTRAPPING?= 0
162
163 # Common environment for world related stages
164 CROSSENV=       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
173 BMAKEENV=       INSTALL="sh ${.CURDIR}/tools/install.sh" \
174                 PATH=${BPATH}:${PATH} \
175                 WORLDTMP=${WORLDTMP} \
176                 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
177 BMAKE=          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
186 TMAKE=          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
192 XMAKE=          TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
193                 -DWITHOUT_FORTRAN -DWITHOUT_GDB
194
195 # world stage
196 WMAKEENV=       ${CROSSENV} \
197                 _SHLIBDIRPREFIX=${WORLDTMP} \
198                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
199                 PATH=${TMPPATH}
200 WMAKE=          ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
201
202 .if ${TARGET_ARCH} == "amd64"
203 # 32 bit world
204 LIB32TMP=       ${OBJTREE}${.CURDIR}/lib32
205
206 .if empty(TARGET_CPUTYPE)
207 LIB32CPUTYPE=   k8
208 .else
209 LIB32CPUTYPE=   ${TARGET_CPUTYPE}
210 .endif
211 LIB32PREFLAGS=  -m32 -march=${LIB32CPUTYPE} -mfancy-math-387 -DCOMPAT_32BIT
212 LIB32POSTFLAGS= -I${LIB32TMP}/usr/include \
213                 -L${LIB32TMP}/usr/lib32 \
214                 -B${LIB32TMP}/usr/lib32
215 LIB32CC=        ${LIB32PREFLAGS} \
216                 ${LIB32POSTFLAGS}
217 LIB32CXX=       ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/c++/3.4 \
218                 ${LIB32POSTFLAGS}
219 LIB32OBJC=      ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/objc \
220                 ${LIB32POSTFLAGS}
221
222 # Yes, the flags are redundant.
223 LIB32MAKEENV=   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
237 LIB32MAKE=      ${LIB32MAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
238                 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_INFO \
239                 -DWITHOUT_HTML
240 LIB32IMAKE=     ${LIB32MAKE:NINSTALL=*} -DNO_INCS
241 .endif
242
243 # install stage
244 .if empty(.MAKEFLAGS:M-n)
245 IMAKEENV=       ${CROSSENV} \
246                 PATH=${STRICTTMPPATH}:${INSTALLTMP}
247 .else
248 IMAKEENV=       ${CROSSENV} \
249                 PATH=${TMPPATH}:${INSTALLTMP}
250 .endif
251 IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
252
253 # kernel stage
254 KMAKEENV=       ${WMAKEENV}
255 KMAKE=          ${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
381 everything:
382         @echo
383         @echo "--------------------------------------------------------------"
384         @echo ">>> stage 4.4: building everything"
385         @echo "--------------------------------------------------------------"
386         ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
387 .if ${TARGET_ARCH} == "amd64"
388 build32:
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
440 distribute32 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
455 WMAKE_TGTS=
456 .if !defined(SUBDIR_OVERRIDE)
457 WMAKE_TGTS+=    _worldtmp _legacy _bootstrap-tools
458 .endif
459 WMAKE_TGTS+=    _cleanobj _obj _build-tools
460 .if !defined(SUBDIR_OVERRIDE)
461 WMAKE_TGTS+=    _cross-tools
462 .endif
463 WMAKE_TGTS+=    _includes _libraries _depend everything
464 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
465 WMAKE_TGTS+=    build32
466 .endif
467
468 buildworld: ${WMAKE_TGTS}
469 .ORDER: ${WMAKE_TGTS}
470
471
472 #
473 # We need to have this as a target because the indirection between Makefile
474 # and Makefile.inc1 causes the correct PATH to be used, rather than a
475 # modification of the current environment's PATH.  In addition, we need
476 # to quote multiword values.
477
478 buildenvvars:
479         @echo ${WMAKEENV:Q}
480
481 buildenv:
482         @echo Entering world for ${TARGET_ARCH}:${TARGET}
483         @cd ${.CURDIR} && env ${WMAKEENV} sh || true
484
485 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
486 toolchain: ${TOOLCHAIN_TGTS}
487 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
488
489 #
490 # installcheck
491 #
492 # Checks to be sure system is ready for installworld/installkernel.
493 #
494 installcheck:
495
496 #
497 # Require DESTDIR to be set if installing for a different architecture.
498 #
499 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
500 .if !make(distributeworld)
501 installcheck: installcheck_DESTDIR
502 installcheck_DESTDIR:
503 .if !defined(DESTDIR) || empty(DESTDIR)
504         @echo "ERROR: Please set DESTDIR!"; \
505         false
506 .endif
507 .endif
508 .endif
509
510 #
511 # Check for missing UIDs/GIDs.
512 #
513 CHECK_UIDS=
514 CHECK_GIDS=     audit
515 .if ${MK_SENDMAIL} != "no"
516 CHECK_UIDS+=    smmsp
517 CHECK_GIDS+=    smmsp
518 .endif
519 .if ${MK_PF} != "no"
520 CHECK_UIDS+=    proxy
521 CHECK_GIDS+=    proxy authpf
522 .endif
523 installcheck: installcheck_UGID
524 installcheck_UGID:
525 .for uid in ${CHECK_UIDS}
526         @if ! `id -u ${uid} >/dev/null 2>&1`; then \
527                 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
528                 false; \
529         fi
530 .endfor
531 .for gid in ${CHECK_GIDS}
532         @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
533                 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
534                 false; \
535         fi
536 .endfor
537
538 #
539 # distributeworld
540 #
541 # Distributes everything compiled by a `buildworld'.
542 #
543 # installworld
544 #
545 # Installs everything compiled by a 'buildworld'.
546 #
547 distributeworld installworld: installcheck
548         mkdir -p ${INSTALLTMP}
549         for prog in [ awk cap_mkdb cat chflags chmod chown \
550             date echo egrep find grep install-info \
551             ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
552             test true uname wc zic; do \
553                 cp `which $$prog` ${INSTALLTMP}; \
554         done
555         ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
556         rm -rf ${INSTALLTMP}
557
558 #
559 # reinstall
560 #
561 # If you have a build server, you can NFS mount the source and obj directories
562 # and do a 'make reinstall' on the *client* to install new binaries from the
563 # most recent server build.
564 #
565 reinstall:
566         @echo "--------------------------------------------------------------"
567         @echo ">>> Making hierarchy"
568         @echo "--------------------------------------------------------------"
569         ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
570         @echo
571         @echo "--------------------------------------------------------------"
572         @echo ">>> Installing everything"
573         @echo "--------------------------------------------------------------"
574         ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
575 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
576         ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
577 .endif
578
579 redistribute:
580         @echo "--------------------------------------------------------------"
581         @echo ">>> Distributing everything"
582         @echo "--------------------------------------------------------------"
583         ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
584 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
585         ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 DISTRIBUTION=lib32
586 .endif
587
588 distrib-dirs distribution:
589         cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
590
591 #
592 # buildkernel and installkernel
593 #
594 # Which kernels to build and/or install is specified by setting
595 # KERNCONF. If not defined a GENERIC kernel is built/installed.
596 # Only the existing (depending TARGET) config files are used
597 # for building kernels and only the first of these is designated
598 # as the one being installed.
599 #
600 # Note that we have to use TARGET instead of TARGET_ARCH when
601 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
602 # be set to cross-build, we have to make sure TARGET is set
603 # properly.
604
605 .if !defined(KERNCONF) && defined(KERNEL)
606 KERNCONF=       ${KERNEL}
607 KERNWARN=
608 .else
609 KERNCONF?=      GENERIC
610 .endif
611 INSTKERNNAME?=  kernel
612
613 KERNSRCDIR?=    ${.CURDIR}/sys
614 KRNLCONFDIR=    ${KERNSRCDIR}/${TARGET}/conf
615 KRNLOBJDIR=     ${OBJTREE}${KERNSRCDIR}
616 KERNCONFDIR?=   ${KRNLCONFDIR}
617
618 BUILDKERNELS=
619 INSTALLKERNEL=
620 .for _kernel in ${KERNCONF}
621 .if exists(${KERNCONFDIR}/${_kernel})
622 BUILDKERNELS+=  ${_kernel}
623 .if empty(INSTALLKERNEL)
624 INSTALLKERNEL= ${_kernel}
625 .endif
626 .endif
627 .endfor
628
629 #
630 # buildkernel
631 #
632 # Builds all kernels defined by BUILDKERNELS.
633 #
634 buildkernel:
635 .if empty(BUILDKERNELS)
636         @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
637         false
638 .endif
639 .if defined(KERNWARN)
640         @echo "--------------------------------------------------------------"
641         @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
642         @echo "--------------------------------------------------------------"
643         @sleep 3
644 .endif
645         @echo
646 .for _kernel in ${BUILDKERNELS}
647         @echo "--------------------------------------------------------------"
648         @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
649         @echo "--------------------------------------------------------------"
650         @echo "===> ${_kernel}"
651         mkdir -p ${KRNLOBJDIR}
652 .if !defined(NO_KERNELCONFIG)
653         @echo
654         @echo "--------------------------------------------------------------"
655         @echo ">>> stage 1: configuring the kernel"
656         @echo "--------------------------------------------------------------"
657         cd ${KRNLCONFDIR}; \
658                 PATH=${TMPPATH} \
659                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
660                         ${KERNCONFDIR}/${_kernel}
661 .endif
662 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
663         @echo
664         @echo "--------------------------------------------------------------"
665         @echo ">>> stage 2.1: cleaning up the object tree"
666         @echo "--------------------------------------------------------------"
667         cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
668 .endif
669         @echo
670         @echo "--------------------------------------------------------------"
671         @echo ">>> stage 2.2: rebuilding the object tree"
672         @echo "--------------------------------------------------------------"
673         cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
674         @echo
675         @echo "--------------------------------------------------------------"
676         @echo ">>> stage 2.3: build tools"
677         @echo "--------------------------------------------------------------"
678         cd ${KRNLOBJDIR}/${_kernel}; \
679             MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
680             ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
681 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
682 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
683 .for target in obj depend all
684         cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
685             MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
686             ${MAKE} -DNO_CPU_CFLAGS ${target}
687 .endfor
688 .endif
689 .if !defined(NO_KERNELDEPEND)
690         @echo
691         @echo "--------------------------------------------------------------"
692         @echo ">>> stage 3.1: making dependencies"
693         @echo "--------------------------------------------------------------"
694         cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
695 .endif
696         @echo
697         @echo "--------------------------------------------------------------"
698         @echo ">>> stage 3.2: building everything"
699         @echo "--------------------------------------------------------------"
700         cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
701         @echo "--------------------------------------------------------------"
702         @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
703         @echo "--------------------------------------------------------------"
704 .endfor
705
706 #
707 # installkernel, etc.
708 #
709 # Install the kernel defined by INSTALLKERNEL
710 #
711 installkernel installkernel.debug \
712 reinstallkernel reinstallkernel.debug: installcheck
713 .if empty(INSTALLKERNEL)
714         @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
715         false
716 .endif
717         @echo "--------------------------------------------------------------"
718         @echo ">>> Installing kernel"
719         @echo "--------------------------------------------------------------"
720         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
721             ${CROSSENV} PATH=${TMPPATH} \
722             ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
723
724 #
725 # doxygen
726 #
727 # Build the API documentation with doxygen
728 #
729 doxygen:
730         @if [ ! -x `/usr/bin/which doxygen` ]; then \
731                 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
732                 exit 1; \
733         fi
734         cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
735
736 #
737 # update
738 #
739 # Update the source tree, by running cvsup and/or running cvs to update to the
740 # latest copy.
741 #
742 update:
743 .if defined(SUP_UPDATE)
744         @echo "--------------------------------------------------------------"
745         @echo ">>> Running ${SUP}"
746         @echo "--------------------------------------------------------------"
747 .if defined(SUPFILE)
748         @${SUP} ${SUPFLAGS} ${SUPFILE}
749 .endif
750 .if defined(SUPFILE1)
751         @${SUP} ${SUPFLAGS} ${SUPFILE1}
752 .endif
753 .if defined(SUPFILE2)
754         @${SUP} ${SUPFLAGS} ${SUPFILE2}
755 .endif
756 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
757         @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
758 .endif
759 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
760         @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
761 .endif
762 .endif
763 .if defined(CVS_UPDATE)
764         @echo "--------------------------------------------------------------"
765         @echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT}
766         @echo "--------------------------------------------------------------"
767         cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS}
768 .endif
769
770 #
771 # ------------------------------------------------------------------------
772 #
773 # From here onwards are utility targets used by the 'make world' and
774 # related targets.  If your 'world' breaks, you may like to try to fix
775 # the problem and manually run the following targets to attempt to
776 # complete the build.  Beware, this is *not* guaranteed to work, you
777 # need to have a pretty good grip on the current state of the system
778 # to attempt to manually finish it.  If in doubt, 'make world' again.
779 #
780
781 #
782 # legacy: Build compatibility shims for the next three targets
783 #
784 legacy:
785 .if ${BOOTSTRAPPING} < 503000
786         @echo "ERROR: Source upgrades from versions prior to 5.3 not supported."; \
787         false
788 .endif
789 .for _tool in tools/build
790         ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
791             cd ${.CURDIR}/${_tool}; \
792             ${MAKE} DIRPRFX=${_tool}/ obj; \
793             ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
794             ${MAKE} DIRPRFX=${_tool}/ depend; \
795             ${MAKE} DIRPRFX=${_tool}/ all; \
796             ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
797 .endfor
798
799 #
800 # bootstrap-tools: Build tools needed for compatibility
801 #
802 .if ${MK_GAMES} != "no"
803 _strfile=       games/fortune/strfile
804 .endif
805
806 .if ${MK_CXX} != "no"
807 _gperf=         gnu/usr.bin/gperf
808 .if ${BOOTSTRAPPING} < 700004
809 _groff=         gnu/usr.bin/groff
810 .else
811 _groff=         gnu/usr.bin/groff/tmac
812 .endif
813 .endif
814
815 .if ${BOOTSTRAPPING} < 600029
816 _texinfo=       gnu/usr.bin/texinfo
817 .endif
818
819 .if ${BOOTSTRAPPING} < 600015
820 _cap_mkdb=      usr.bin/cap_mkdb
821 .endif
822
823 .if ${BOOTSTRAPPING} < 600018
824 _colldef=       usr.bin/colldef
825 .endif
826
827 .if ${BOOTSTRAPPING} < 600017
828 _gencat=        usr.bin/gencat
829 .endif
830
831 .if ${BOOTSTRAPPING} < 600016
832 _mklocale=      usr.bin/mklocale
833 .endif
834
835 .if ${BOOTSTRAPPING} < 700015
836 _gensnmptree=   usr.sbin/bsnmpd/gensnmptree
837 .endif
838
839 .if ${MK_RESCUE} != "no" && \
840     ${BOOTSTRAPPING} < 600008
841 _crunchgen=     usr.sbin/crunch/crunchgen
842 .endif
843
844 .if ${BOOTSTRAPPING} < 600020
845 _pwd_mkdb=      usr.sbin/pwd_mkdb
846 .endif
847
848 bootstrap-tools:
849 .for _tool in \
850     ${_strfile} \
851     ${_gperf} \
852     ${_groff} \
853     ${_texinfo} \
854     ${_cap_mkdb} \
855     ${_colldef} \
856     ${_gencat} \
857     usr.bin/lorder \
858     usr.bin/makewhatis \
859     ${_mklocale} \
860     usr.bin/rpcgen \
861     usr.bin/xinstall \
862     ${_gensnmptree} \
863     usr.sbin/config \
864     ${_crunchgen} \
865     ${_pwd_mkdb}
866         ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
867                 cd ${.CURDIR}/${_tool}; \
868                 ${MAKE} DIRPRFX=${_tool}/ obj; \
869                 ${MAKE} DIRPRFX=${_tool}/ depend; \
870                 ${MAKE} DIRPRFX=${_tool}/ all; \
871                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
872 .endfor
873
874 #
875 # build-tools: Build special purpose build tools
876 #
877 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
878 _aicasm= sys/modules/aic7xxx/aicasm
879 .endif
880
881 .if !defined(NO_SHARE)
882 _share= share/syscons/scrnmaps
883 .endif
884
885 .if ${MK_KERBEROS} != "no"
886 _kerberos5_tools= kerberos5/tools
887 .endif
888
889 .if ${MK_RESCUE} != "no"
890 _rescue= rescue/rescue
891 .endif
892
893 build-tools:
894 .for _tool in \
895     bin/csh \
896     bin/sh \
897     ${_rescue} \
898     lib/libncurses \
899     ${_share} \
900     ${_aicasm} \
901     usr.bin/awk \
902     lib/libmagic \
903     usr.sbin/sysinstall
904         ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
905                 cd ${.CURDIR}/${_tool}; \
906                 ${MAKE} DIRPRFX=${_tool}/ obj; \
907                 ${MAKE} DIRPRFX=${_tool}/ build-tools
908 .endfor
909 .for _tool in \
910     gnu/usr.bin/cc/cc_tools \
911     ${_kerberos5_tools}
912         ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
913                 cd ${.CURDIR}/${_tool}; \
914                 ${MAKE} DIRPRFX=${_tool}/ obj; \
915                 ${MAKE} DIRPRFX=${_tool}/ depend; \
916                 ${MAKE} DIRPRFX=${_tool}/ all
917 .endfor
918
919 #
920 # cross-tools: Build cross-building tools
921 #
922 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
923 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
924 _btxld=         usr.sbin/btxld
925 .endif
926 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
927 _crunchide=     usr.sbin/crunch/crunchide
928 .endif
929 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
930 _kgzip=         usr.sbin/kgzip
931 .endif
932 .endif
933
934 cross-tools:
935 .for _tool in \
936     gnu/usr.bin/binutils \
937     gnu/usr.bin/cc \
938     usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
939     ${_btxld} \
940     ${_crunchide} \
941     ${_kgzip}
942         ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
943                 cd ${.CURDIR}/${_tool}; \
944                 ${MAKE} DIRPRFX=${_tool}/ obj; \
945                 ${MAKE} DIRPRFX=${_tool}/ depend; \
946                 ${MAKE} DIRPRFX=${_tool}/ all; \
947                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
948 .endfor
949
950 #
951 # hierarchy - ensure that all the needed directories are present
952 #
953 hierarchy:
954         cd ${.CURDIR}/etc;              ${MAKE} distrib-dirs
955
956 #
957 # libraries - build all libraries, and install them under ${DESTDIR}.
958 #
959 # The list of libraries with dependents (${_prebuild_libs}) and their
960 # interdependencies (__L) are built automatically by the
961 # ${.CURDIR}/tools/make_libdeps.sh script.
962 #
963 libraries:
964         cd ${.CURDIR}; \
965             ${MAKE} -f Makefile.inc1 _startup_libs; \
966             ${MAKE} -f Makefile.inc1 _prebuild_libs; \
967             ${MAKE} -f Makefile.inc1 _generic_libs;
968
969 # These dependencies are not automatically generated:
970 #
971 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
972 # shared libraries for ELF.
973 #
974 _startup_libs=  gnu/lib/csu gnu/lib/libgcc
975 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
976 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
977 .else
978 _startup_libs+= lib/csu/${MACHINE_ARCH}
979 .endif
980
981 _prebuild_libs=
982
983 _generic_libs=  gnu/lib
984
985 .if ${MK_IPX} != "no"
986 _prebuild_libs+= lib/libipx
987 .endif
988
989 .if ${MK_KERBEROS} != "no"
990 _prebuild_libs+=        kerberos5/lib/libasn1
991 _prebuild_libs+=        kerberos5/lib/libkrb5
992 _prebuild_libs+=        kerberos5/lib/libroken
993 _generic_libs+= kerberos5/lib
994 .endif
995
996 _prebuild_libs+= lib/libbz2 lib/libcom_err lib/libcrypt lib/libexpat \
997                 lib/libkiconv lib/libkvm lib/libmd \
998                 lib/libncurses lib/libnetgraph lib/libopie lib/libpam \
999                 lib/libradius \
1000                 lib/libsbuf lib/libtacplus lib/libutil \
1001                 lib/libz lib/msun lib/libgssapi
1002
1003 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1004
1005 _generic_libs+= lib
1006
1007 .if ${MK_CRYPT} != "no"
1008 .if ${MK_OPENSSL} != "no"
1009 _prebuild_libs+=        secure/lib/libcrypto secure/lib/libssl
1010 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1011 .if ${MK_OPENSSH} != "no"
1012 _prebuild_libs+=        secure/lib/libssh
1013 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1014 .if ${MK_KERBEROS} != "no"
1015 secure/lib/libssh__L: lib/libgssapi__L
1016 .endif
1017 .endif
1018 .endif
1019 _generic_libs+= secure/lib
1020 .endif
1021
1022 .if ${MK_OPENSSL} == "no"
1023 lib/libradius__L: lib/libmd__L
1024 .endif
1025
1026 .if ${MK_NIS} != "no"
1027 _prebuild_libs+=        lib/libypclnt
1028 .endif
1029
1030 _generic_libs+= usr.bin/lex/lib
1031
1032 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1033 ${_lib}__L: .PHONY
1034 .if exists(${.CURDIR}/${_lib})
1035         ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1036                 cd ${.CURDIR}/${_lib}; \
1037                 ${MAKE} DIRPRFX=${_lib}/ obj; \
1038                 ${MAKE} DIRPRFX=${_lib}/ depend; \
1039                 ${MAKE} DIRPRFX=${_lib}/ all; \
1040                 ${MAKE} DIRPRFX=${_lib}/ install
1041 .endif
1042 .endfor
1043
1044 # libpam is special: we need to build static PAM modules before
1045 # static PAM library, and dynamic PAM library before dynamic PAM
1046 # modules.
1047 lib/libpam__L: .PHONY
1048         ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1049                 cd ${.CURDIR}/lib/libpam; \
1050                 ${MAKE} DIRPRFX=lib/libpam/ obj; \
1051                 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1052                 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1053                 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1054
1055 _startup_libs: ${_startup_libs:S/$/__L/}
1056 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1057 _generic_libs: ${_generic_libs:S/$/__L/}
1058
1059 .for __target in all clean cleandepend cleandir depend includes obj
1060 .for entry in ${SUBDIR}
1061 ${entry}.${__target}__D: .PHONY
1062         ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1063                 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1064                 edir=${entry}.${MACHINE_ARCH}; \
1065                 cd ${.CURDIR}/$${edir}; \
1066         else \
1067                 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1068                 edir=${entry}; \
1069                 cd ${.CURDIR}/$${edir}; \
1070         fi; \
1071         ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1072 .endfor
1073 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1074 .endfor
1075
1076 .include <bsd.subdir.mk>
1077
1078 .if make(delete-old) || make(delete-old-libs) || make(check-old)
1079
1080 #
1081 # check for / delete old files section
1082 #
1083
1084 .include "ObsoleteFiles.inc"
1085
1086 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1087 else you can not start such an application. Consult UPDATING for more \
1088 information regarding how to cope with the removal/revision bump of a \
1089 specific library."
1090
1091 .if !defined(BATCH_DELETE_OLD_FILES)
1092 RM_I=-i
1093 .else
1094 RM_I=-v
1095 .endif
1096
1097 delete-old-files:
1098         @echo ">>> Removing old files (only deletes safe to delete libs)"
1099 .for file in ${OLD_FILES}
1100 # Ask for every old file if the user really wants to remove it.
1101 # It's annoying, but better safe than sorry.
1102         @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \
1103                 rm ${RM_I} "${DESTDIR}/${file}" || true; \
1104                 if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then\
1105                         echo "Removing schg flag on ${DESTDIR}/${file}"; \
1106                         chflags noschg "${DESTDIR}/${file}"; \
1107                         rm ${RM_I} "${DESTDIR}/${file}"; \
1108                 fi; \
1109         fi
1110 .endfor
1111 # Remove catpages without corresponding manpages.
1112         @3<&0; \
1113         find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1114         sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1115         while read catpage; do \
1116                 read manpage; \
1117                 if [ ! -e "$${manpage}" ]; then \
1118                         rm ${RM_I} $${catpage} <&3 ; \
1119                 fi; \
1120         done
1121         @echo ">>> Old files removed"
1122
1123 check-old-files:
1124         @echo ">>> Checking for old files"
1125 .for file in ${OLD_FILES}
1126         @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \
1127                  echo "${DESTDIR}/${file}"; \
1128         fi
1129 .endfor
1130 # Check for catpages without corresponding manpages.
1131         @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1132         sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1133         while read catpage; do \
1134                 read manpage; \
1135                 if [ ! -e "$${manpage}" ]; then \
1136                         echo $${catpage} ; \
1137                 fi; \
1138         done
1139
1140 delete-old-libs:
1141         @echo ">>> Removing old libraries"
1142         @echo "${OLD_LIBS_MESSAGE}" | fmt
1143 .for file in ${OLD_LIBS}
1144         @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \
1145                 rm ${RM_I} "${DESTDIR}/${file}" || true; \
1146                 if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then\
1147                         echo "Removing schg flag on ${DESTDIR}/${file}"; \
1148                         chflags noschg "${DESTDIR}/${file}"; \
1149                         rm ${RM_I} "${DESTDIR}/${file}"; \
1150                 fi; \
1151         fi
1152 .endfor
1153         @echo ">>> Old libraries removed"
1154
1155 check-old-libs:
1156         @echo ">>> Checking for old libraries"
1157 .for file in ${OLD_LIBS}
1158         @if [ -f "${DESTDIR}/${file}" -o -L "${DESTDIR}/${file}" ]; then \
1159                 echo "${DESTDIR}/${file}"; \
1160         fi
1161 .endfor
1162
1163 delete-old-dirs:
1164         @echo ">>> Removing old directories"
1165 .for dir in ${OLD_DIRS}
1166 # Don't fail if an old directory isn't empty.
1167         @if [ -d "${DESTDIR}/${dir}" ]; then \
1168                 rmdir -v "${DESTDIR}/${dir}" || true; \
1169         else \
1170                 if [ -L "${DESTDIR}/${dir}" ]; then \
1171                         echo "${DESTDIR}/${dir} is a link, please remove everything manually."; \
1172                 fi; \
1173         fi
1174 .endfor
1175         @echo ">>> Old directories removed"
1176
1177 check-old-dirs:
1178         @echo ">>> Checking for old directories"
1179 .for dir in ${OLD_DIRS}
1180         @if [ -d "${DESTDIR}/${dir}" ]; then \
1181                 echo "${DESTDIR}/${dir}"; \
1182         else \
1183                 if [ -L "${DESTDIR}/${dir}" ]; then \
1184                         echo "${DESTDIR}/${dir} is a link, please remove everything manually."; \
1185                 fi; \
1186         fi
1187 .endfor
1188
1189 delete-old: delete-old-files delete-old-dirs
1190         @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1191
1192 check-old: check-old-files check-old-libs check-old-dirs
1193         @echo "To remove old files and directories run '${MAKE} delete-old'."
1194         @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1195
1196 .endif
1197
1198 #
1199 # showconfig - show build configuration.
1200 #
1201 showconfig:
1202         @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort