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