ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
(Generate patch)

Comparing trunk/Makefile.inc1 (file contents):
Revision 366 by laffer1, Wed Dec 27 04:04:06 2006 UTC vs.
Revision 5123 by laffer1, Sun Aug 19 14:05:10 2012 UTC

# Line 1 | Line 1
1   #
2 < # $FreeBSD: src/Makefile.inc1,v 1.499.2.7 2006/01/07 19:40:08 netchild Exp $
3 < # $MidnightBSD: src/Makefile.inc1,v 1.5 2006/12/27 02:32:32 laffer1 Exp $
2 > # $MidnightBSD: src/Makefile.inc1,v 1.42 2012/07/20 01:51:49 laffer1 Exp $
3   #
4   # Make command line options:
6 #       -DNO_DYNAMICROOT do not link /bin and /sbin dynamically
7 #       -DNO_KERBEROS Do not build Heimdal (Kerberos 5)
8 #       -DNO_RESCUE do not build rescue binaries
5   #       -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
6   #       -DNO_CLEAN do not clean at all
11 #       -DNO_CRYPT will prevent building of crypt versions
12 #       -DNO_MAN do not build the manual pages
13 #       -DNO_NLS do not build Native Language Support files
14 #       -DNO_PROFILE do not build profiled libraries
15 #       -DNO_GAMES do not go into games subdir
7   #       -DNO_SHARE do not go into share subdir
8 < #       -DNO_INFO do not make or install info files
18 < #       -DNO_LIBC_R do not build libc_r.
19 < #       -DNO_FORTRAN do not build g77 and related libraries.
8 > #       -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ}
9   #       -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
10   #       -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
11   #       -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
12 + #       -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
13   #       -DNO_PORTSUPDATE do not update ports in ${MAKE} update
14   #       -DNO_DOCUPDATE do not update doc in ${MAKE} update
15 + #       -DNO_WWWUPDATE do not update www in ${MAKE} update
16 + #       -DNO_CTF do not run the DTrace CTF conversion tools on built objects
17   #       LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
18 < #       TARGET_ARCH="arch" to crossbuild world to a different arch
18 > #       TARGET="machine" to crossbuild world for a different machine type
19 > #       TARGET_ARCH= may be required when a TARGET supports multiple endians
20  
21   #
22   # The intended user-driven targets are:
23   # buildworld  - rebuild *everything*, including glue to help do upgrades
24   # installworld- install everything built by "buildworld"
25 + # doxygen     - build API documentation of the kernel
26   # update      - convenient way to update your source tree (eg: cvsup/cvs)
27   #
28   # Standard targets (not defined here) are documented in the makefiles in
29   # /usr/share/mk.  These include:
30   #               obj depend all install clean cleandepend cleanobj
31  
32 + # You are supposed to define both of these when calling Makefile.inc1
33 + # directly.  However, some old scripts don't.  Cope for the moment, but
34 + # issue a new warning for a transition period.
35 + .if defined(TARGET) && !defined(TARGET_ARCH)
36 + .warning "You must pass both TARGET and TARGET_ARCH to Makefile.inc1.  Setting TARGET_ARCH=${TARGET}."
37 + TARGET_ARCH=${TARGET}
38 + .endif
39 + .if !defined(TARGET) || !defined(TARGET_ARCH)
40 + .error "Both TARGET and TARGET_ARCH must be defined."
41 + .endif
42 +
43 + .include <bsd.own.mk>
44 + .include <bsd.arch.inc.mk>
45 +
46   # We must do share/info early so that installation of info `dir'
47   # entries works correctly.  Do it first since it is less likely to
48   # grow dependencies on include and lib than vice versa.
49   #
50 < # We must do lib and libexec before bin, because if installworld
50 > # We must do lib/ and libexec/ before bin/, because if installworld
51   # installs a new /bin/sh, the 'make' command will *immediately*
52   # use that new version.  And the new (dynamically-linked) /bin/sh
53   # will expect to find appropriate libraries in /lib and /libexec.
54   #
55 < # We must do etc last for install/distribute to work.
56 < #
57 < SUBDIR= share/info include lib libexec bin
58 < .if !defined(NO_GAMES)
55 > SUBDIR= share/info lib libexec
56 > SUBDIR+=bin
57 > .if ${MK_APACHE} != "no"
58 > SUBDIR+=apache
59 > .endif
60 > .if ${MK_GAMES} != "no"
61   SUBDIR+=games
62   .endif
63 < SUBDIR+=gnu
64 < .if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
63 > .if ${MK_CDDL} != "no"
64 > SUBDIR+=cddl
65 > .else
66 > NO_CTF=1
67 > .endif
68 > SUBDIR+=gnu include
69 > .if ${MK_KERBEROS} != "no"
70   SUBDIR+=kerberos5
71   .endif
72 < .if !defined(NO_RESCUE)
72 > .if ${MK_RESCUE} != "no"
73   SUBDIR+=rescue
74   .endif
75   SUBDIR+=sbin
76 < .if !defined(NO_CRYPT)
76 > .if ${MK_CRYPT} != "no"
77   SUBDIR+=secure
78   .endif
79   .if !defined(NO_SHARE)
80   SUBDIR+=share
81   .endif
82 < SUBDIR+=sys usr.bin usr.sbin etc
82 > SUBDIR+=sys usr.bin usr.sbin
83 > .if ${MK_OFED} != "no"
84 > SUBDIR+=contrib/ofed
85 > .endif
86 > #
87 > # We must do etc/ last for install/distribute to work.
88 > #
89 > SUBDIR+=etc
90  
91   # These are last, since it is nice to at least get the base system
92   # rebuilt before you do them.
# Line 89 | Line 111 | CLEANDIR=      cleandir
111  
112   CVS?=           cvs
113   CVSFLAGS?=      -r . -P -d -I!
114 < SUP?=           /usr/bin/csup
115 < SUPFLAGS?=      -g -L 2
114 > SUP?=           /usr/local/bin/cvsup
115 > SUPFLAGS?=      -g -L 2
116   .if defined(SUPHOST)
117   SUPFLAGS+=      -h ${SUPHOST}
118   .endif
# Line 98 | Line 120 | SUPFLAGS+=     -h ${SUPHOST}
120   MAKEOBJDIRPREFIX?=      /usr/obj
121   .if !defined(OSRELDATE)
122   .if exists(/usr/include/osreldate.h)
123 < OSRELDATE!=     awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
123 > OSRELDATE!=     awk '/^\#define[[:space:]]*__MidnightBSD_version/ { print $$3 }' \
124                  /usr/include/osreldate.h
125   .else
126   OSRELDATE=      0
127   .endif
128   .endif
129 < TARGET_ARCH?=   ${MACHINE_ARCH}
130 < .if ${TARGET_ARCH} == ${MACHINE_ARCH}
131 < TARGET?=        ${MACHINE}
129 >
130 > .if !defined(VERSION)
131 > VERSION!=       uname -srp
132 > VERSION+=       ${OSRELDATE}
133 > .endif
134 >
135 >
136 > KNOWN_ARCHES?=  amd64 i386 sparc64
137 > .if ${TARGET} == ${TARGET_ARCH}
138 > _t=             ${TARGET}
139 > .else
140 > _t=             ${TARGET_ARCH}/${TARGET}
141 > .endif
142 > .for _t in ${_t}
143 > .if empty(KNOWN_ARCHES:M${_t})
144 > .error Unknown target ${TARGET_ARCH}:${TARGET}.
145 > .endif
146 > .endfor
147 >
148 > .if ${TARGET} == ${MACHINE}
149   TARGET_CPUTYPE?=${CPUTYPE}
150   .else
112 TARGET?=        ${TARGET_ARCH}
151   TARGET_CPUTYPE?=
152   .endif
153 +
154   .if !empty(TARGET_CPUTYPE)
155   _TARGET_CPUTYPE=${TARGET_CPUTYPE}
156   .else
# Line 123 | Line 162 | _CPUTYPE!=     MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAK
162   .error CPUTYPE global should be set with ?=.
163   .endif
164   .if make(buildworld)
165 < BUILD_ARCH!=    sysctl -n hw.machine_arch
165 > BUILD_ARCH!=    uname -p
166   .if ${MACHINE_ARCH} != ${BUILD_ARCH}
167   .error To cross-build, set TARGET_ARCH.
168   .endif
169   .endif
170 < .if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING)
170 > .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
171   OBJTREE=        ${MAKEOBJDIRPREFIX}
172   .else
173 < OBJTREE=        ${MAKEOBJDIRPREFIX}/${TARGET}
173 > OBJTREE=        ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
174   .endif
175   WORLDTMP=       ${OBJTREE}${.CURDIR}/tmp
176   # /usr/games added for fortune which depend on strfile
# Line 140 | Line 179 | XPATH=         ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WOR
179   STRICTTMPPATH=  ${BPATH}:${XPATH}
180   TMPPATH=        ${STRICTTMPPATH}:${PATH}
181  
182 + #
183 + # Avoid running mktemp(1) unless actually needed.
184 + # It may not be functional, e.g., due to new ABI
185 + # when in the middle of installing over this system.
186 + #
187 + .if make(distributeworld) || make(installworld)
188   INSTALLTMP!=    /usr/bin/mktemp -d -u -t install
189 + .endif
190  
191   #
192   # Building a world goes through the following stages
# Line 173 | Line 219 | BOOTSTRAPPING?=        0
219   CROSSENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
220                  MACHINE_ARCH=${TARGET_ARCH} \
221                  MACHINE=${TARGET} \
222 <                CPUTYPE=${TARGET_CPUTYPE} \
223 <                GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
222 >                CPUTYPE=${TARGET_CPUTYPE}
223 > .if ${OSRELDATE} < 4015
224 > CROSSENV+=      AR=gnu-ar RANLIB=gnu-ranlib
225 > .endif
226 > .if ${MK_GROFF} != "no"
227 > CROSSENV+=      GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
228                  GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
229                  GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
230 + .endif
231  
232   # bootstrap-tools stage
233   BMAKEENV=       INSTALL="sh ${.CURDIR}/tools/install.sh" \
234                  PATH=${BPATH}:${PATH} \
235                  WORLDTMP=${WORLDTMP} \
236 +                VERSION="${VERSION}" \
237                  MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
238   BMAKE=          MAKEOBJDIRPREFIX=${WORLDTMP} \
239                  ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
240                  DESTDIR= \
241                  BOOTSTRAPPING=${OSRELDATE} \
242 <                -DNO_HTML -DNO_INFO -DNO_LINT -DNO_MAN -DNO_NLS -DNO_PIC \
243 <                -DNO_PROFILE -DNO_SHARED -DNO_CPU_CFLAGS -DNO_WARNS
242 >                SSP_CFLAGS= \
243 >                -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
244 >                -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
245 >                -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
246  
247   # build-tools stage
248   TMAKE=          MAKEOBJDIRPREFIX=${OBJTREE} \
249                  ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
250 +                TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
251                  DESTDIR= \
252 <                BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS
252 >                BOOTSTRAPPING=${OSRELDATE} \
253 >                SSP_CFLAGS= \
254 >                -DNO_LINT \
255 >                -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
256  
257   # cross-tools stage
258 < XMAKE=          TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
258 > XMAKE=          TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
259 >                TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
260 >                -DWITHOUT_GDB
261  
262   # world stage
263   WMAKEENV=       ${CROSSENV} \
264                  _SHLIBDIRPREFIX=${WORLDTMP} \
265 +                _LDSCRIPTROOT= \
266 +                VERSION="${VERSION}" \
267                  INSTALL="sh ${.CURDIR}/tools/install.sh" \
268                  PATH=${TMPPATH}
269 + .if ${MK_CDDL} == "no"
270 + WMAKEENV+=      NO_CTF=1
271 + .endif
272   WMAKE=          ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
273  
274   .if ${TARGET_ARCH} == "amd64"
275   # 32 bit world
276   LIB32TMP=       ${OBJTREE}${.CURDIR}/lib32
277  
278 < LIB32PREFLAGS=  -m32 -march=athlon-xp -msse2 -mfancy-math-387 -DCOMPAT_32BIT
279 < LIB32POSTFLAGS= -I${LIB32TMP}/usr/include \
278 > .if ${TARGET_ARCH} == "amd64"
279 > .if empty(TARGET_CPUTYPE)
280 > LIB32CPUFLAGS=  -march=i686 -mmmx -msse -msse2
281 > .else
282 > LIB32CPUFLAGS=  -march=${TARGET_CPUTYPE}
283 > .endif
284 > LIB32WMAKEENV=  MACHINE=i386 MACHINE_ARCH=i386 \
285 >                MACHINE_CPU="i686 mmx sse sse2" \
286 >                LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
287 >                AS="${AS} --32"
288 > .endif
289 >
290 >
291 > LIB32FLAGS=     -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
292 >                -isystem ${LIB32TMP}/usr/include/ \
293                  -L${LIB32TMP}/usr/lib32 \
294                  -B${LIB32TMP}/usr/lib32
217 LIB32CC=        ${LIB32PREFLAGS} \
218                ${LIB32POSTFLAGS}
219 LIB32CXX=       ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/c++/3.4 \
220                ${LIB32POSTFLAGS}
221 LIB32OBJC=      ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/objc \
222                ${LIB32POSTFLAGS}
295  
296   # Yes, the flags are redundant.
297 < LIB32MAKEENV=   MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
297 > LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
298                  _SHLIBDIRPREFIX=${LIB32TMP} \
299 <                MACHINE=i386 \
300 <                MACHINE_ARCH=i386 \
299 >                _LDSCRIPTROOT=${LIB32TMP} \
300 >                VERSION="${VERSION}" \
301                  INSTALL="sh ${.CURDIR}/tools/install.sh" \
302                  PATH=${TMPPATH} \
303 <                CC="${CC} ${LIB32CC}" \
304 <                CXX="${CXX} ${LIB32CXX}" \
233 <                OBJC="${OBJC} ${LIB32OBJC}" \
234 <                LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
235 <                AS="${AS} --32" \
303 >                CC="${CC} ${LIB32FLAGS}" \
304 >                CXX="${CXX} ${LIB32FLAGS}" \
305                  LIBDIR=/usr/lib32 \
306                  SHLIBDIR=/usr/lib32
307  
308 < LIB32MAKE=      ${LIB32MAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
309 <                -DNO_BIND -DNO_MAN -DNO_NLS -DNO_INFO -DNO_HTML
310 < LIB32IMAKE=     ${LIB32MAKE:NINSTALL=*} -DNO_INCS
308 > LIB32WMAKE=     ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
309 >                -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
310 >                -DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \
311 >                DESTDIR=${LIB32TMP}
312 > LIB32IMAKE=     ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS
313   .endif
314  
315   # install stage
316 + IMAKEENV=       ${CROSSENV:N_LDSCRIPTROOT=*}
317 + IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
318   .if empty(.MAKEFLAGS:M-n)
319 < IMAKEENV=       ${CROSSENV} \
320 <                PATH=${STRICTTMPPATH}:${INSTALLTMP}
319 > IMAKEENV+=      PATH=${STRICTTMPPATH}:${INSTALLTMP} \
320 >                LD_LIBRARY_PATH=${INSTALLTMP} \
321 >                PATH_LOCALE=${INSTALLTMP}/locale
322 > IMAKE+=         __MAKE_SHELL=${INSTALLTMP}/sh
323   .else
324 < IMAKEENV=       ${CROSSENV} \
250 <                PATH=${TMPPATH}:${INSTALLTMP}
324 > IMAKEENV+=      PATH=${TMPPATH}:${INSTALLTMP}
325   .endif
252 IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
326  
327   # kernel stage
328   KMAKEENV=       ${WMAKEENV}
329 + KMAKE=          ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
330  
331   #
332   # buildworld
# Line 275 | Line 349 | _worldtmp:
349          @echo "--------------------------------------------------------------"
350   .if !defined(NO_CLEAN)
351          rm -rf ${WORLDTMP}
352 < .if ${TARGET_ARCH} == "amd64"
352 > .if defined(LIB32TMP)
353          rm -rf ${LIB32TMP}
354   .endif
355   .else
356          rm -rf ${WORLDTMP}/legacy/usr/include
357 <        # XXX - These two can depend on any header file.
357 > #       XXX - These three can depend on any header file.
358          rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
359 +        rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
360          rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
361   .endif
362   .for _dir in \
363 <    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
363 >    lib usr legacy/usr
364          mkdir -p ${WORLDTMP}/${_dir}
365   .endfor
366 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
367 +            -p ${WORLDTMP}/legacy/usr >/dev/null
368 + .if ${MK_GROFF} != "no"
369 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
370 +            -p ${WORLDTMP}/legacy/usr >/dev/null
371 + .endif
372 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
373 +            -p ${WORLDTMP}/usr >/dev/null
374          mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
375              -p ${WORLDTMP}/usr/include >/dev/null
376          ln -sf ${.CURDIR}/sys ${WORLDTMP}
377 < .if defined(WITH_BIND_LIBS) && !defined(NO_BIND)
377 > .if ${MK_BIND_LIBS} != "no"
378          mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
379              -p ${WORLDTMP}/usr/include >/dev/null
380   .endif
# Line 336 | Line 397 | _cleanobj:
397          @echo ">>> stage 2.1: cleaning up the object tree"
398          @echo "--------------------------------------------------------------"
399          ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
400 < .if ${TARGET_ARCH} == "amd64"
401 <        rm -rf ${OBJTREE}/lib32
400 > .if defined(LIB32TMP)
401 >        ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
402   .endif
403   .endif
404   _obj:
# Line 370 | Line 431 | _libraries:
431          @echo ">>> stage 4.2: building libraries"
432          @echo "--------------------------------------------------------------"
433          ${_+_}cd ${.CURDIR}; \
434 <            ${WMAKE} -DNO_FSCHG -DNO_HTML -DNO_INFO -DNO_LINT -DNO_MAN \
435 <            -DNO_NLS -DNO_PROFILE libraries
434 >            ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
435 >            -DWITHOUT_MAN -DWITHOUT_PROFILE libraries
436   _depend:
437          @echo
438          @echo "--------------------------------------------------------------"
# Line 384 | Line 445 | everything:
445          @echo ">>> stage 4.4: building everything"
446          @echo "--------------------------------------------------------------"
447          ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
448 < .if ${TARGET_ARCH} == "amd64"
448 > .if defined(LIB32TMP)
449   build32:
450          @echo
451          @echo "--------------------------------------------------------------"
452          @echo ">>> stage 5.1: building 32 bit shim libraries"
453          @echo "--------------------------------------------------------------"
454 < .for _dir in \
455 <    lib lib32 usr/bin usr/include usr/lib32 usr/libdata/ldscripts \
456 <    usr/libexec usr/sbin usr/share/misc \
396 <    usr/share/snmp/defs usr/share/snmp/mibs
397 <        mkdir -p ${LIB32TMP}/${_dir}
398 < .endfor
454 >        mkdir -p ${LIB32TMP}/usr/include
455 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
456 >            -p ${LIB32TMP}/usr >/dev/null
457          mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
458              -p ${LIB32TMP}/usr/include >/dev/null
459          mkdir -p ${WORLDTMP}
460          ln -sf ${.CURDIR}/sys ${WORLDTMP}
461 < .if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
461 > .if ${MK_KERBEROS} != "no"
462   .for _t in obj depend all
463          cd ${.CURDIR}/kerberos5/tools; \
464 <            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= ${_t}
464 >            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
465 >            DIRPRFX=kerberos5/tools/ ${_t}
466   .endfor
467   .endif
468   .for _t in obj includes
469 <        cd ${.CURDIR}/include; \
470 <            ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
471 <        cd ${.CURDIR}/lib; \
472 <            ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
414 <        cd ${.CURDIR}/gnu/lib; \
415 <            ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
416 < .if !defined(NO_CRYPT)
417 <        cd ${.CURDIR}/secure/lib; \
418 <            ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
469 >        cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
470 >        cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
471 > .if ${MK_APACHE} != "no"
472 >        cd ${.CURDIR}/apache/lib; ${LIB32WMAKE} ${_t}
473   .endif
474 < .if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
475 <        cd ${.CURDIR}/kerberos5/lib; \
422 <            ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
474 > .if ${MK_CDDL} != "no"
475 >        cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
476   .endif
477 +        cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
478 + .if ${MK_CRYPT} != "no"
479 +        cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
480 + .endif
481 + .if ${MK_KERBEROS} != "no"
482 +        cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
483 + .endif
484   .endfor
485 < .for _dir in usr.sbin/pcvt/keycap usr.bin/lex/lib
486 <        cd ${.CURDIR}/${_dir}; \
427 <            ${LIB32MAKE} DESTDIR=${LIB32TMP} obj
485 > .for _dir in usr.bin/lex/lib
486 >        cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
487   .endfor
488 < .for _dir in lib/libncurses lib/libmagic
488 > .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
489          cd ${.CURDIR}/${_dir}; \
490 <            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= build-tools
490 >            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
491 >            DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
492 >            -DEARLY_BUILD build-tools
493   .endfor
494          cd ${.CURDIR}; \
495 <            ${LIB32MAKE} -f Makefile.inc1 DESTDIR=${LIB32TMP} libraries
495 >            ${LIB32WMAKE} -f Makefile.inc1 libraries
496   .for _t in obj depend all
497 <        cd ${.CURDIR}/libexec/rtld-elf; \
498 <            PROG=ld-elf32.so.1 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
497 >        cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
498 >            DIRPRFX=libexec/rtld-elf/ ${_t}
499 >        cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
500 >            DIRPRFX=usr.bin/ldd ${_t}
501   .endfor
502  
503   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
504          cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
505 + .if ${MK_CDDL} != "no"
506 +        cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
507 + .endif
508          cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
509 < .if !defined(NO_CRYPT)
509 > .if ${MK_CRYPT} != "no"
510          cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
511   .endif
512 <        cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
512 > .if ${MK_KERBEROS} != "no"
513 >        cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
514   .endif
515 +        cd ${.CURDIR}/libexec/rtld-elf; \
516 +            PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
517 +        cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
518 + .endif
519  
454
520   WMAKE_TGTS=
521   .if !defined(SUBDIR_OVERRIDE)
522   WMAKE_TGTS+=    _worldtmp _legacy _bootstrap-tools
# Line 461 | Line 526 | WMAKE_TGTS+=   _cleanobj _obj _build-tools
526   WMAKE_TGTS+=    _cross-tools
527   .endif
528   WMAKE_TGTS+=    _includes _libraries _depend everything
529 < .if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32)
529 > .if defined(LIB32TMP) && ${MK_LIB32} != "no"
530   WMAKE_TGTS+=    build32
531   .endif
532  
533 < buildworld: ${WMAKE_TGTS}
534 < .ORDER: ${WMAKE_TGTS}
533 > buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
534 > .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
535  
536 + buildworld_prologue:
537 +        @echo "--------------------------------------------------------------"
538 +        @echo ">>> World build started on `LC_ALL=C date`"
539 +        @echo "--------------------------------------------------------------"
540 +
541 + buildworld_epilogue:
542 +        @echo
543 +        @echo "--------------------------------------------------------------"
544 +        @echo ">>> World build completed on `LC_ALL=C date`"
545 +        @echo "--------------------------------------------------------------"
546 +
547 + #
548 + # We need to have this as a target because the indirection between Makefile
549 + # and Makefile.inc1 causes the correct PATH to be used, rather than a
550 + # modification of the current environment's PATH.  In addition, we need
551 + # to quote multiword values.
552 + #
553 + buildenvvars:
554 +        @echo ${WMAKEENV:Q}
555 +
556   buildenv:
557          @echo Entering world for ${TARGET_ARCH}:${TARGET}
558          @cd ${.CURDIR} && env ${WMAKEENV} sh || true
# Line 477 | Line 562 | toolchain: ${TOOLCHAIN_TGTS}
562   kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
563  
564   #
565 < # Use this to add checks to installworld/installkernel targets.
565 > # installcheck
566   #
567 < SPECIAL_INSTALLCHECKS=
567 > # Checks to be sure system is ready for installworld/installkernel.
568 > #
569 > installcheck:
570  
571   #
572   # Require DESTDIR to be set if installing for a different architecture.
573   #
574   .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
575   .if !make(distributeworld)
576 < SPECIAL_INSTALLCHECKS+= installcheck_DESTDIR
576 > installcheck: installcheck_DESTDIR
577   installcheck_DESTDIR:
578   .if !defined(DESTDIR) || empty(DESTDIR)
579          @echo "ERROR: Please set DESTDIR!"; \
# Line 496 | Line 583 | installcheck_DESTDIR:
583   .endif
584  
585   #
586 < # installcheck
586 > # Check for missing UIDs/GIDs.
587   #
501 # Checks to be sure system is ready for installworld
502 #
588   CHECK_UIDS=
589 < CHECK_GIDS=    
590 < .if !defined(NO_SENDMAIL)
589 > CHECK_GIDS=     audit
590 > .if ${MK_SENDMAIL} != "no"
591   CHECK_UIDS+=    smmsp
592   CHECK_GIDS+=    smmsp
593   .endif
594 < .if !defined(NO_PF)
594 > .if ${MK_PF} != "no"
595   CHECK_UIDS+=    proxy
596   CHECK_GIDS+=    proxy authpf
597   .endif
598 < installcheck: ${SPECIAL_INSTALLCHECKS}
598 > installcheck: installcheck_UGID
599 > installcheck_UGID:
600   .for uid in ${CHECK_UIDS}
601          @if ! `id -u ${uid} >/dev/null 2>&1`; then \
602                  echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
# Line 525 | Line 611 | installcheck: ${SPECIAL_INSTALLCHECKS}
611   .endfor
612  
613   #
614 + # Required install tools to be saved in a scratch dir for safety.
615 + #
616 + .if ${MK_INFO} != "no"
617 + _install-info=  install-info
618 + .endif
619 + .if ${MK_ZONEINFO} != "no"
620 + _zoneinfo=      zic tzsetup
621 + .endif
622 +
623 + ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
624 +        date echo egrep find grep ${_install-info} \
625 +        ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
626 +        test true uname wc ${_zoneinfo}
627 +
628 + #
629   # distributeworld
630   #
631   # Distributes everything compiled by a `buildworld'.
# Line 533 | Line 634 | installcheck: ${SPECIAL_INSTALLCHECKS}
634   #
635   # Installs everything compiled by a 'buildworld'.
636   #
637 +
638 + # Non-base distributions produced by the base system
639 + EXTRA_DISTRIBUTIONS=    doc games
640 + .if defined(LIB32TMP) && ${MK_LIB32} != "no"
641 + EXTRA_DISTRIBUTIONS+=   lib32
642 + .endif
643 +
644   distributeworld installworld: installcheck
645          mkdir -p ${INSTALLTMP}
646 <        for prog in [ awk cap_mkdb cat chflags chmod chown \
647 <            date echo egrep find grep install-info \
648 <            ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
649 <            test true uname wc zic; do \
650 <                cp `which $$prog` ${INSTALLTMP}; \
651 <        done
652 <        ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
653 <        rm -rf ${INSTALLTMP}
646 >        progs=$$(for prog in ${ITOOLS}; do \
647 >                if progpath=`which $$prog`; then \
648 >                        echo $$progpath; \
649 >                else \
650 >                        echo "Required tool $$prog not found in PATH." >&2; \
651 >                        exit 1; \
652 >                fi; \
653 >            done); \
654 >        libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
655 >            while read line; do \
656 >                set -- $$line; \
657 >                if [ "$$2 $$3" != "not found" ]; then \
658 >                        echo $$2; \
659 >                else \
660 >                        echo "Required library $$1 not found." >&2; \
661 >                        exit 1; \
662 >                fi; \
663 >            done); \
664 >        cp $$libs $$progs ${INSTALLTMP}
665 >        cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
666 > .if make(distributeworld)
667 > .for dist in ${EXTRA_DISTRIBUTIONS}
668 >        -mkdir ${DESTDIR}/${DISTDIR}/${dist}
669 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
670 >            -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
671 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
672 >            -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
673 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
674 >            -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
675 > .endfor
676 >        -mkdir ${DESTDIR}/${DISTDIR}/base
677 >        ${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \
678 >            DESTDIR=${DESTDIR}/${DISTDIR}/base
679 > .endif
680 >        ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
681 >            ${IMAKEENV} rm -rf ${INSTALLTMP}
682 > .if make(distributeworld)
683 > .for dist in ${EXTRA_DISTRIBUTIONS}
684 >        find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
685 > .endfor
686 > .endif
687  
688 + packageworld:
689 + .for dist in base ${EXTRA_DISTRIBUTIONS}
690 +        ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
691 +            tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz .
692 + .endfor
693 +
694   #
695   # reinstall
696   #
# Line 551 | Line 698 | distributeworld installworld: installcheck
698   # and do a 'make reinstall' on the *client* to install new binaries from the
699   # most recent server build.
700   #
701 < reinstall: ${SPECIAL_INSTALLCHECKS}
701 > reinstall:
702          @echo "--------------------------------------------------------------"
703          @echo ">>> Making hierarchy"
704          @echo "--------------------------------------------------------------"
# Line 561 | Line 708 | reinstall: ${SPECIAL_INSTALLCHECKS}
708          @echo ">>> Installing everything"
709          @echo "--------------------------------------------------------------"
710          ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
711 < .if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32)
711 > .if defined(LIB32TMP) && ${MK_LIB32} != "no"
712          ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
713   .endif
714  
# Line 570 | Line 717 | redistribute:
717          @echo ">>> Distributing everything"
718          @echo "--------------------------------------------------------------"
719          ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
720 < .if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32)
721 <        ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 DISTRIBUTION=lib32
720 > .if defined(LIB32TMP) && ${MK_LIB32} != "no"
721 >        ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
722 >            DISTRIBUTION=lib32
723   .endif
724  
725   distrib-dirs distribution:
# Line 591 | Line 739 | distrib-dirs distribution:
739   # be set to cross-build, we have to make sure TARGET is set
740   # properly.
741  
742 + .if defined(KERNFAST)
743 + NO_KERNELCLEAN= t
744 + NO_KERNELCONFIG=        t
745 + NO_KERNELDEPEND=        t
746 + NO_KERNELOBJ=           t
747 + # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
748 + .if !defined(KERNCONF) && ${KERNFAST} != "1"
749 + KERNCONF=${KERNFAST}
750 + .endif
751 + .endif
752   .if !defined(KERNCONF) && defined(KERNEL)
753   KERNCONF=       ${KERNEL}
754   KERNWARN=
# Line 653 | Line 811 | buildkernel:
811          @echo "--------------------------------------------------------------"
812          @echo ">>> stage 2.1: cleaning up the object tree"
813          @echo "--------------------------------------------------------------"
814 <        cd ${KRNLOBJDIR}/${_kernel}; \
657 <            ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
814 >        cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
815   .endif
816 + .if !defined(NO_KERNELOBJ)
817          @echo
818          @echo "--------------------------------------------------------------"
819          @echo ">>> stage 2.2: rebuilding the object tree"
820          @echo "--------------------------------------------------------------"
821 <        cd ${KRNLOBJDIR}/${_kernel}; \
822 <            ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
821 >        cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
822 > .endif
823          @echo
824          @echo "--------------------------------------------------------------"
825          @echo ">>> stage 2.3: build tools"
826          @echo "--------------------------------------------------------------"
827          cd ${KRNLOBJDIR}/${_kernel}; \
828 +            PATH=${BPATH}:${PATH} \
829              MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
830 <            ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
830 >            ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \
831 >            -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
832   # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
833   .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
834   .for target in obj depend all
835          cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
836 +            PATH=${BPATH}:${PATH} \
837              MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
838 <            ${MAKE} -DNO_CPU_CFLAGS ${target}
838 >            ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target}
839   .endfor
840   .endif
841   .if !defined(NO_KERNELDEPEND)
# Line 682 | Line 843 | buildkernel:
843          @echo "--------------------------------------------------------------"
844          @echo ">>> stage 3.1: making dependencies"
845          @echo "--------------------------------------------------------------"
846 <        cd ${KRNLOBJDIR}/${_kernel}; \
686 <            ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
846 >        cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
847   .endif
848          @echo
849          @echo "--------------------------------------------------------------"
850          @echo ">>> stage 3.2: building everything"
851          @echo "--------------------------------------------------------------"
852 <        cd ${KRNLOBJDIR}/${_kernel}; \
693 <            ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
852 >        cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
853          @echo "--------------------------------------------------------------"
854          @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
855          @echo "--------------------------------------------------------------"
# Line 702 | Line 861 | buildkernel:
861   # Install the kernel defined by INSTALLKERNEL
862   #
863   installkernel installkernel.debug \
864 < reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS}
864 > reinstallkernel reinstallkernel.debug: installcheck
865   .if empty(INSTALLKERNEL)
866          @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
867          false
868   .endif
869          @echo "--------------------------------------------------------------"
870 <        @echo ">>> Installing kernel"
870 >        @echo ">>> Installing kernel ${INSTALLKERNEL}"
871          @echo "--------------------------------------------------------------"
872          cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
873              ${CROSSENV} PATH=${TMPPATH} \
874              ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
875  
876 + distributekernel distributekernel.debug:
877 + .if empty(INSTALLKERNEL)
878 +        @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
879 +        false
880 + .endif
881 +        cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
882 +            ${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
883 +            DESTDIR=${DESTDIR}/${DISTDIR}/kernel \
884 +            ${.TARGET:S/distributekernel/install/}
885 + .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
886 +        cd ${KRNLOBJDIR}/${_kernel}; \
887 +            ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
888 +            KERNEL=${INSTKERNNAME}.${_kernel} \
889 +            DESTDIR=${DESTDIR}/${DISTDIR}/kernel.${_kernel} \
890 +            ${.TARGET:S/distributekernel/install/}
891 + .endfor
892 +
893 + packagekernel:
894 +        cd ${DESTDIR}/${DISTDIR}/kernel; \
895 +            tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
896 + .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
897 +        cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
898 +            tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
899 + .endfor
900 +
901   #
902 + # doxygen
903 + #
904 + # Build the API documentation with doxygen
905 + #
906 + doxygen:
907 +        @if [ ! -x `/usr/bin/which doxygen` ]; then \
908 +                echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
909 +                exit 1; \
910 +        fi
911 +        cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
912 +
913 + #
914   # update
915   #
916 < # Update the source tree, by running cvsup and/or running cvs to update to the
916 > # Update the source tree(s), by running cvsup/cvs/svn to update to the
917   # latest copy.
918   #
919   update:
# Line 742 | Line 938 | update:
938   .endif
939   .endif
940   .if defined(CVS_UPDATE)
941 <        @echo "--------------------------------------------------------------"
942 <        @echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT}
943 <        @echo "--------------------------------------------------------------"
944 <        cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS}
941 >        @cd ${.CURDIR} ; \
942 >        if [ -d CVS ] ; then \
943 >                echo "--------------------------------------------------------------" ; \
944 >                echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
945 >                echo "--------------------------------------------------------------" ; \
946 >                echo ${CVS} -R -q update ${CVSFLAGS} ; \
947 >                ${CVS} -R -q update ${CVSFLAGS} ; \
948 >        fi
949   .endif
950 + .if defined(SVN_UPDATE)
951 +        @cd ${.CURDIR} ; \
952 +        if [ -d .svn ] ; then \
953 +                echo "--------------------------------------------------------------" ; \
954 +                echo ">>> Updating ${.CURDIR} using Subversion" ; \
955 +                echo "--------------------------------------------------------------" ; \
956 +                echo ${SVN} update ${SVNFLAGS} ; \
957 +                ${SVN} update ${SVNFLAGS} ; \
958 +        fi
959 + .endif
960  
961   #
962   # ------------------------------------------------------------------------
# Line 763 | Line 973 | update:
973   # legacy: Build compatibility shims for the next three targets
974   #
975   legacy:
976 < .if ${BOOTSTRAPPING} < 503000
977 <        @echo "ERROR: Source upgrades from versions prior to 5.3 not supported."; \
976 > .if ${BOOTSTRAPPING} < 1000 && ${BOOTSTRAPPING} != 0
977 >        @echo "ERROR: Source upgrades from versions prior to 0.1 not supported."; \
978          false
979   .endif
980   .for _tool in tools/build
# Line 780 | Line 990 | legacy:
990   #
991   # bootstrap-tools: Build tools needed for compatibility
992   #
993 < .if !defined(NO_GAMES)
993 > .if ${MK_GAMES} != "no"
994   _strfile=       games/fortune/strfile
995   .endif
996  
997 < .if !defined(NO_CXX)
997 > .if ${MK_CXX} != "no"
998   _gperf=         gnu/usr.bin/gperf
999 < .if ${BOOTSTRAPPING} < 600101
999 > .endif
1000 >
1001 > .if ${MK_GROFF} != "no"
1002   _groff=         gnu/usr.bin/groff
791 .else
792 _groff=         gnu/usr.bin/groff/tmac
1003   .endif
1004 +
1005 + .if ${BOOTSTRAPPING} >= 4000 && ${BOOTSTRAPPING} < 4016
1006 + _ar=            usr.bin/ar
1007   .endif
1008  
1009 < .if ${BOOTSTRAPPING} < 600029
1010 < _texinfo=       gnu/usr.bin/texinfo
1009 > .if ${BOOTSTRAPPING} < 4016
1010 > _mklocale=      usr.bin/mklocale
1011   .endif
1012  
1013 < .if ${BOOTSTRAPPING} < 600015
1014 < _cap_mkdb=      usr.bin/cap_mkdb
1013 > .if ${BOOTSTRAPPING} < 4016
1014 > _sed=           usr.bin/sed
1015   .endif
1016  
1017 < .if ${BOOTSTRAPPING} < 600018
1018 < _colldef=       usr.bin/colldef
1017 > .if ${BOOTSTRAPPING} < 4016
1018 > _lex=           usr.bin/lex
1019   .endif
1020  
1021 < .if ${BOOTSTRAPPING} < 600017
1022 < _gencat=        usr.bin/gencat
1021 > .if ${BOOTSTRAPPING} < 4016
1022 > _yacc=          usr.bin/yacc
1023   .endif
1024  
1025 < .if ${BOOTSTRAPPING} < 600016
1026 < _mklocale=      usr.bin/mklocale
1025 > .if ${BOOTSTRAPPING} >= 4016
1026 > _awk=           usr.bin/awk
1027   .endif
1028  
1029 < .if ${BOOTSTRAPPING} < 600106
1030 < _gensnmptree=usr.sbin/bsnmpd/gensnmptree
1029 > .if ${MK_BSNMP} != "no" && \
1030 >    (${BOOTSTRAPPING} < 4015 || !exists(/usr/sbin/gensnmptree))
1031 > _gensnmptree=   usr.sbin/bsnmpd/gensnmptree
1032   .endif
1033  
1034 < .if !defined(NO_RESCUE) && \
1035 <    ${BOOTSTRAPPING} < 600008
1034 > .if ${MK_RESCUE} != "no" && \
1035 >    ${BOOTSTRAPPING} < 4015
1036   _crunchgen=     usr.sbin/crunch/crunchgen
1037   .endif
1038  
1039 < .if ${BOOTSTRAPPING} < 600020
1040 < _pwd_mkdb=      usr.sbin/pwd_mkdb
1039 > .if ${MK_CLANG} != "no"
1040 > _clang_tblgen= \
1041 >        lib/clang/libllvmsupport \
1042 >        lib/clang/libllvmtablegen \
1043 >        usr.bin/clang/tblgen \
1044 >        usr.bin/clang/clang-tblgen
1045   .endif
1046  
1047 + .if ${MK_CDDL} != "no" && \
1048 +    ${BOOTSTRAPPING} < 4016 && \
1049 +    !(${BOOTSTRAPPING} >= 4000 && ${BOOTSTRAPPING} < 4016)
1050 + _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1051 +    lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1052 + .endif
1053 +
1054 + .if ${MK_FDT} != "no"
1055 + _dtc= gnu/usr.bin/dtc
1056 + .endif
1057 +
1058 + #       Please document (add comment) why something is in 'bootstrap-tools'.
1059 + #       Try to bound the building of the bootstrap-tool to just the
1060 + #       MidnightBSD versions that need the tool built at this stage of the build.
1061   bootstrap-tools:
1062   .for _tool in \
1063 +    ${_clang_tblgen} \
1064 +    ${_dtrace_tools} \
1065      ${_strfile} \
1066      ${_gperf} \
1067      ${_groff} \
1068 <    ${_texinfo} \
1069 <    ${_cap_mkdb} \
1070 <    ${_colldef} \
837 <    ${_gencat} \
1068 >    ${_ar} \
1069 >    ${_dtc} \
1070 >    ${_awk} \
1071      usr.bin/lorder \
1072      usr.bin/makewhatis \
1073      ${_mklocale} \
1074      usr.bin/rpcgen \
1075 <    ${_gensnmptree} \
1075 >    ${_sed} \
1076 >    ${_yacc} \
1077 >    ${_lex} \
1078      usr.bin/xinstall \
1079 +    ${_gensnmptree} \
1080      usr.sbin/config \
1081 <    ${_crunchgen} \
846 <    ${_pwd_mkdb}
1081 >    ${_crunchgen}
1082          ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1083                  cd ${.CURDIR}/${_tool}; \
1084                  ${MAKE} DIRPRFX=${_tool}/ obj; \
# Line 863 | Line 1098 | _aicasm= sys/modules/aic7xxx/aicasm
1098   _share= share/syscons/scrnmaps
1099   .endif
1100  
1101 < .if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
1101 > .if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no"
1102 > _gcc_tools= gnu/usr.bin/cc/cc_tools
1103 > .endif
1104 >
1105 > .if ${MK_KERBEROS} != "no"
1106   _kerberos5_tools= kerberos5/tools
1107   .endif
1108  
1109 < .if !defined(NO_RESCUE)
1109 > .if ${MK_RESCUE} != "no"
1110   _rescue= rescue/rescue
1111   .endif
1112  
# Line 876 | Line 1115 | build-tools:
1115      bin/csh \
1116      bin/sh \
1117      ${_rescue} \
1118 <    lib/libncurses \
1118 >    lib/ncurses/ncurses \
1119 >    lib/ncurses/ncursesw \
1120      ${_share} \
1121      ${_aicasm} \
1122      usr.bin/awk \
1123      lib/libmagic \
1124 <    usr.sbin/sysinstall
1124 >    usr.sbin/sysinstall \
1125 >    usr.bin/mkesdb_static \
1126 >    usr.bin/mkcsmapper_static
1127          ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1128                  cd ${.CURDIR}/${_tool}; \
1129                  ${MAKE} DIRPRFX=${_tool}/ obj; \
1130                  ${MAKE} DIRPRFX=${_tool}/ build-tools
1131   .endfor
1132   .for _tool in \
1133 <    gnu/usr.bin/cc/cc_tools \
1133 >    ${_gcc_tools} \
1134      ${_kerberos5_tools}
1135          ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1136                  cd ${.CURDIR}/${_tool}; \
# Line 900 | Line 1142 | build-tools:
1142   #
1143   # cross-tools: Build cross-building tools
1144   #
1145 < .if (${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386") && \
1146 <    ${TARGET_ARCH} != ${MACHINE_ARCH}
1145 > .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 4012
1146 > .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1147   _btxld=         usr.sbin/btxld
1148   .endif
1149 <
1150 < .if (!defined(NO_RESCUE) || defined(RELEASEDIR)) && \
1151 <    ${TARGET_ARCH} != ${MACHINE_ARCH}
1149 > .endif
1150 > .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1151 > .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1152   _crunchide=     usr.sbin/crunch/crunchide
1153   .endif
1154 <
913 < .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
914 <    defined(RELEASEDIR)
1154 > .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1155   _kgzip=         usr.sbin/kgzip
1156   .endif
1157 + .endif
1158  
1159 + .if ${MK_BINUTILS} != "no"
1160 + _binutils=      gnu/usr.bin/binutils
1161 + .endif
1162 +
1163 + .if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")
1164 + _clang=         usr.bin/clang
1165 + _clang_libs=    lib/clang
1166 + .endif
1167 +
1168 + .if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no"
1169 + _cc=            gnu/usr.bin/cc
1170 + .endif
1171 +
1172   cross-tools:
1173   .for _tool in \
1174 <    gnu/usr.bin/binutils \
1175 <    gnu/usr.bin/cc \
1174 >    ${_clang_libs} \
1175 >    ${_clang} \
1176 >    ${_binutils} \
1177 >    ${_cc} \
1178      usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1179      ${_btxld} \
1180      ${_crunchide} \
# Line 946 | Line 1202 | hierarchy:
1202   #
1203   libraries:
1204          cd ${.CURDIR}; \
1205 +            ${MAKE} -f Makefile.inc1 _prereq_libs; \
1206              ${MAKE} -f Makefile.inc1 _startup_libs; \
1207              ${MAKE} -f Makefile.inc1 _prebuild_libs; \
1208              ${MAKE} -f Makefile.inc1 _generic_libs;
1209  
1210 + #
1211 + # static libgcc.a prerequisite for shared libc
1212 + #
1213 + _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1214 +
1215   # These dependencies are not automatically generated:
1216   #
1217 < # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
1218 < # shared libraries for ELF.
1217 > # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1218 > # all shared libraries for ELF.
1219   #
1220 < _startup_libs=  gnu/lib/csu gnu/lib/libgcc
1220 > _startup_libs=  gnu/lib/csu
1221   .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1222   _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1223 < .else
1223 > .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1224   _startup_libs+= lib/csu/${MACHINE_ARCH}
1225 + .else
1226 + _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1227   .endif
1228 + _startup_libs+= gnu/lib/libgcc
1229 + _startup_libs+= lib/libcompiler_rt
1230 + _startup_libs+= lib/libc
1231 + .if ${MK_LIBCPLUSPLUS} != "no"
1232 + _startup_libs+= lib/libcxxrt
1233 + .endif
1234  
1235 < _prebuild_libs=
1235 > gnu/lib/libgcc__L: lib/libc__L
1236 > .if ${MK_LIBCPLUSPLUS} != "no"
1237 > lib/libcxxrt__L: gnu/lib/libgcc__L
1238 > .endif
1239  
1240 < _generic_libs=  gnu/lib
1240 > _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libhdb} \
1241 >                ${_kerberos5_lib_libheimntlm} \
1242 >                ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1243 >                ${_kerberos5_lib_libroken} \
1244 >                lib/libbz2 lib/libcom_err lib/libcrypt \
1245 >                lib/libexpat \
1246 >                ${_lib_libgssapi} ${_lib_libipx} \
1247 >                lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
1248 >                lib/ncurses/ncurses lib/ncurses/ncursesw \
1249 >                lib/libopie lib/libpam ${_lib_libthr} \
1250 >                lib/libradius lib/libsbuf lib/libtacplus \
1251 >                ${_cddl_lib_libumem} \
1252 >                lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1253 >                ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1254 >                ${_secure_lib_libssl} lib/libsqlite3 \
1255 >        lib/libarchive lib/libfetch lib/libmagic
1256 > .if ${MK_LIBTHR} != "no"
1257 > _lib_libthr=    lib/libthr
1258 > .endif
1259  
1260 < .if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
1261 < _prebuild_libs+=        kerberos5/lib/libasn1
971 < _prebuild_libs+=        kerberos5/lib/libgssapi
972 < _prebuild_libs+=        kerberos5/lib/libkrb5
973 < _prebuild_libs+=        kerberos5/lib/libroken
974 < _generic_libs+= kerberos5/lib
1260 > .if ${MK_OFED} != "no"
1261 > _ofed_lib=      contrib/ofed/usr.lib/
1262   .endif
1263  
1264 < _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
978 <                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
1264 > _generic_libs=  ${_apache_lib} ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1265  
1266   lib/libopie__L lib/libtacplus__L: lib/libmd__L
1267  
1268 < _generic_libs+= lib
1268 > .if ${MK_APACHE} != "no"
1269 > _apache_lib= apache/lib
1270 > .endif
1271  
1272 < .if !defined(NO_CRYPT)
1273 < .if !defined(NO_OPENSSL)
1274 < _prebuild_libs+=        secure/lib/libcrypto secure/lib/libssl
1275 < lib/libradius__L: secure/lib/libssl__L
1276 < secure/lib/libssl__L: secure/lib/libcrypto__L
1277 < .if !defined(NO_OPENSSH)
1278 < _prebuild_libs+=        secure/lib/libssh
1272 > .if ${MK_CDDL} != "no"
1273 > _cddl_lib_libumem= cddl/lib/libumem
1274 > _cddl_lib= cddl/lib
1275 > .endif
1276 >
1277 > .if ${MK_CRYPT} != "no"
1278 > .if ${MK_OPENSSL} != "no"
1279 > _secure_lib_libcrypto= secure/lib/libcrypto
1280 > _secure_lib_libssl= secure/lib/libssl
1281 > lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1282 > .if ${MK_OPENSSH} != "no"
1283 > _secure_lib_libssh= secure/lib/libssh
1284   secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1285 < .if !defined(NO_KERBEROS)
1286 < secure/lib/libssh__L: kerberos5/lib/libgssapi__L kerberos5/lib/libkrb5__L \
1287 <    kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \
1288 <    kerberos5/lib/libroken__L
1285 > .if ${MK_KERBEROS_SUPPORT} != "no"
1286 > secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1287 >    kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1288 >    lib/libmd__L kerberos5/lib/libroken__L
1289   .endif
1290   .endif
1291   .endif
1292 < _generic_libs+= secure/lib
1292 > _secure_lib=    secure/lib
1293   .endif
1294  
1295 < .if defined(NO_CRYPT) || defined(NO_OPENSSL)
1296 < lib/libradius__L: lib/libmd__L
1295 > .if ${MK_KERBEROS} != "no"
1296 > kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1297 > kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1298 >    kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L
1299 > kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L
1300 > kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1301 >    secure/lib/libcrypto__L kerberos5/lib/libroken__L
1302 > kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1303 >    lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1304 >    kerberos5/lib/libroken__L
1305 > kerberos5/lib/libroken__L: lib/libcrypt__L
1306   .endif
1307  
1308 < .if !defined(NO_NIS)
1309 < _prebuild_libs+=        lib/libypclnt
1308 > .if ${MK_GSSAPI} != "no"
1309 > _lib_libgssapi= lib/libgssapi
1310   .endif
1311  
1312 < _generic_libs+= usr.bin/lex/lib
1312 > .if ${MK_IPX} != "no"
1313 > _lib_libipx=    lib/libipx
1314 > .endif
1315  
1316 < .if ${MACHINE} == "i386"
1317 < _generic_libs+= usr.sbin/pcvt/keycap
1316 > .if ${MK_KERBEROS} != "no"
1317 > _kerberos5_lib= kerberos5/lib
1318 > _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1319 > _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1320 > _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1321 > _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1322 > _kerberos5_lib_libroken= kerberos5/lib/libroken
1323 > _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1324   .endif
1325  
1326 + .if ${MK_NIS} != "no"
1327 + _lib_libypclnt= lib/libypclnt
1328 + .endif
1329 +
1330 + .if ${MK_OPENSSL} == "no"
1331 + lib/libradius__L: lib/libmd__L
1332 + .endif
1333 +
1334 + .for _lib in ${_prereq_libs}
1335 + ${_lib}__PL: .PHONY
1336 + .if exists(${.CURDIR}/${_lib})
1337 +        ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1338 +                cd ${.CURDIR}/${_lib}; \
1339 +                ${MAKE} DIRPRFX=${_lib}/ obj; \
1340 +                ${MAKE} DIRPRFX=${_lib}/ depend; \
1341 +                ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1342 +                ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1343 + .endif
1344 + .endfor
1345 +
1346   .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1347   ${_lib}__L: .PHONY
1348   .if exists(${.CURDIR}/${_lib})
1349 <        ${_+_}@${ECHODIR} "===> ${_lib} (depend,all,install)"; \
1349 >        ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1350                  cd ${.CURDIR}/${_lib}; \
1351 +                ${MAKE} DIRPRFX=${_lib}/ obj; \
1352                  ${MAKE} DIRPRFX=${_lib}/ depend; \
1353                  ${MAKE} DIRPRFX=${_lib}/ all; \
1354                  ${MAKE} DIRPRFX=${_lib}/ install
# Line 1032 | Line 1359 | ${_lib}__L: .PHONY
1359   # static PAM library, and dynamic PAM library before dynamic PAM
1360   # modules.
1361   lib/libpam__L: .PHONY
1362 <        ${_+_}@${ECHODIR} "===> lib/libpam (depend,all,install)"; \
1362 >        ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1363                  cd ${.CURDIR}/lib/libpam; \
1364 +                ${MAKE} DIRPRFX=lib/libpam/ obj; \
1365                  ${MAKE} DIRPRFX=lib/libpam/ depend; \
1366                  ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1367                  ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1368  
1369 + _prereq_libs: ${_prereq_libs:S/$/__PL/}
1370   _startup_libs: ${_startup_libs:S/$/__L/}
1371   _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1372   _generic_libs: ${_generic_libs:S/$/__L/}
# Line 1061 | Line 1390 | par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1390  
1391   .include <bsd.subdir.mk>
1392  
1393 < .if make(delete-old) || make(delete-old-libs) || make(check-old)
1393 > .if make(check-old) || make(check-old-dirs) || \
1394 >    make(check-old-files) || make(check-old-libs) || \
1395 >    make(delete-old) || make(delete-old-dirs) || \
1396 >    make(delete-old-files) || make(delete-old-libs)
1397  
1398   #
1399   # check for / delete old files section
# Line 1082 | Line 1414 | RM_I=-v
1414  
1415   delete-old-files:
1416          @echo ">>> Removing old files (only deletes safe to delete libs)"
1085 .for file in ${OLD_FILES}
1417   # Ask for every old file if the user really wants to remove it.
1418   # It's annoying, but better safe than sorry.
1419 <        @[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \
1420 <                ||  ([ -f "${DESTDIR}/${file}" ] \
1421 <                        && echo "Removing schg flag on ${DESTDIR}/${file}" \
1422 <                        && chflags noschg "${DESTDIR}/${file}" \
1423 <                        && rm ${RM_I} "${DESTDIR}/${file}"))
1424 < .endfor
1419 > # NB: We cannot pass the list of OLD_FILES as a parameter because the
1420 > # argument list will get too long. Using .for/.endfor make "loops" will make
1421 > # the Makefile parser segfault.
1422 >        @exec 3<&0; \
1423 >        ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1424 >            -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1425 >        while read file; do \
1426 >                if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1427 >                        chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1428 >                        rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1429 >                fi; \
1430 >        done
1431   # Remove catpages without corresponding manpages.
1432 <        @3<&0; \
1432 >        @exec 3<&0; \
1433          find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1434          sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1435          while read catpage; do \
1436                  read manpage; \
1437                  if [ ! -e "$${manpage}" ]; then \
1438 <                        rm ${RM_I} $${catpage} <&3 ; \
1438 >                        rm ${RM_I} $${catpage} <&3; \
1439                  fi; \
1440          done
1441          @echo ">>> Old files removed"
1442  
1443   check-old-files:
1444          @echo ">>> Checking for old files"
1445 < .for file in ${OLD_FILES}
1446 <        @[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}"
1447 < .endfor
1445 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1446 >            -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1447 >        while read file; do \
1448 >                if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1449 >                        echo "${DESTDIR}/$${file}"; \
1450 >                fi; \
1451 >        done
1452   # Check for catpages without corresponding manpages.
1453          @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1454          sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1455          while read catpage; do \
1456                  read manpage; \
1457                  if [ ! -e "$${manpage}" ]; then \
1458 <                        echo $${catpage} ; \
1458 >                        echo $${catpage}; \
1459                  fi; \
1460          done
1461  
1462   delete-old-libs:
1463          @echo ">>> Removing old libraries"
1464          @echo "${OLD_LIBS_MESSAGE}" | fmt
1465 < .for file in ${OLD_LIBS}
1466 <        @[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \
1467 <                ||  ([ -f "${DESTDIR}/${file}" ] \
1468 <                        && echo "Removing schg flag on ${DESTDIR}/${file}" \
1469 <                        && chflags noschg "${DESTDIR}/${file}" \
1470 <                        && rm ${RM_I} "${DESTDIR}/${file}"))
1471 < .endfor
1465 >        @exec 3<&0; \
1466 >        ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1467 >            -V OLD_LIBS | xargs -n1 | \
1468 >        while read file; do \
1469 >                if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1470 >                        chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1471 >                        rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1472 >                fi; \
1473 >        done
1474          @echo ">>> Old libraries removed"
1475  
1476   check-old-libs:
1477          @echo ">>> Checking for old libraries"
1478 < .for file in ${OLD_LIBS}
1479 <        @[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}"
1480 < .endfor
1478 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1479 >            -V OLD_LIBS | xargs -n1 | \
1480 >        while read file; do \
1481 >                if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1482 >                        echo "${DESTDIR}/$${file}"; \
1483 >                fi; \
1484 >        done
1485  
1486   delete-old-dirs:
1487          @echo ">>> Removing old directories"
1488 < .for dir in ${OLD_DIRS}
1489 < # Don't fail if an old directory isn't empty.
1490 <        @[ ! -d "${DESTDIR}/${dir}" ] || (rmdir -v "${DESTDIR}/${dir}" || true)
1491 < .endfor
1488 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1489 >            -V OLD_DIRS | xargs -n1 | \
1490 >        while read dir; do \
1491 >                if [ -d "${DESTDIR}/$${dir}" ]; then \
1492 >                        rmdir -v "${DESTDIR}/$${dir}" || true; \
1493 >                elif [ -L "${DESTDIR}/$${dir}" ]; then \
1494 >                        echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1495 >                fi; \
1496 >        done
1497          @echo ">>> Old directories removed"
1498  
1499   check-old-dirs:
1500          @echo ">>> Checking for old directories"
1501 < .for dir in ${OLD_DIRS}
1502 <        @[ ! -d "${DESTDIR}/${dir}" ] || echo "${DESTDIR}/${dir}"
1503 < .endfor
1501 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1502 >            -V OLD_DIRS | xargs -n1 | \
1503 >        while read dir; do \
1504 >                if [ -d "${DESTDIR}/$${dir}" ]; then \
1505 >                        echo "${DESTDIR}/$${dir}"; \
1506 >                elif [ -L "${DESTDIR}/$${dir}" ]; then \
1507 >                        echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1508 >                fi; \
1509 >        done
1510  
1511   delete-old: delete-old-files delete-old-dirs
1512          @echo "To remove old libraries run '${MAKE} delete-old-libs'."
# Line 1159 | Line 1517 | check-old: check-old-files check-old-libs check-old-di
1517  
1518   .endif
1519  
1520 + #
1521 + # showconfig - show build configuration.
1522 + #
1523 + showconfig:
1524 +        @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
1525 +
1526 + .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1527 + DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1528 +
1529 + .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1530 + .if exists(${KERNCONFDIR}/${KERNCONF})
1531 + FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1532 +        ${KERNCONFDIR}/${KERNCONF}
1533 + .endif
1534 + .endif
1535 +
1536 + .endif
1537 +
1538 + .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1539 + DTBOUTPUTPATH= ${.CURDIR}
1540 + .endif
1541 +
1542 + #
1543 + # Build 'standalone' Device Tree Blob
1544 + #
1545 + builddtb:
1546 +        @if [ "${FDT_DTS_FILE}" = "" ]; then \
1547 +                echo "ERROR: FDT_DTS_FILE must be specified!"; \
1548 +                exit 1; \
1549 +        fi;     \
1550 +        if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
1551 +                echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1552 +                        exist!"; \
1553 +                exit 1; \
1554 +        fi;     \
1555 +        if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then  \
1556 +                echo "WARNING: DTB will be placed in the current working \
1557 +                        directory"; \
1558 +        fi
1559 +        @PATH=${TMPPATH} \
1560 +        dtc -O dtb -o \
1561 +            ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
1562 +            -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
1563 +
1564 + ###############
1565 +
1566 + .if defined(XDEV) && defined(XDEV_ARCH)
1567 +
1568 + .if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
1569 + XDEV_CPUTYPE?=${CPUTYPE}
1570 + .else
1571 + XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1572 + .endif
1573 +
1574 + NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1575 +        -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
1576 +        -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \
1577 +        TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
1578 +        CPUTYPE=${XDEV_CPUTYPE}
1579 +
1580 + XDDIR=${XDEV_ARCH}-midnightbsd
1581 + XDTP=/usr/${XDDIR}
1582 + CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR}
1583 + CDENV= ${CDBENV} \
1584 +        _SHLIBDIRPREFIX=${XDTP} \
1585 +        TOOLS_PREFIX=${XDTP}
1586 + CD2ENV=${CDENV} \
1587 +        MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1588 +
1589 + CDTMP=  ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
1590 + CDMAKE=${CDENV} ${MAKE} ${NOFUN}
1591 + CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1592 + XDDESTDIR=${DESTDIR}${XDTP}
1593 + .if !defined(OSREL)
1594 + OSREL!= uname -r | sed -e 's/[-(].*//'
1595 + .endif
1596 +
1597 + .ORDER: xdev-build xdev-install
1598 + xdev: xdev-build xdev-install
1599 +
1600 + .ORDER: _xb-build-tools _xb-cross-tools
1601 + xdev-build: _xb-build-tools _xb-cross-tools
1602 +
1603 + _xb-build-tools:
1604 +        ${_+_}@cd ${.CURDIR}; \
1605 +        ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1606 +
1607 + _xb-cross-tools:
1608 + .for _tool in \
1609 +    gnu/usr.bin/binutils \
1610 +    gnu/usr.bin/cc \
1611 +    usr.bin/ar
1612 +        ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1613 +        cd ${.CURDIR}/${_tool}; \
1614 +        ${CDMAKE} DIRPRFX=${_tool}/ obj; \
1615 +        ${CDMAKE} DIRPRFX=${_tool}/ depend; \
1616 +        ${CDMAKE} DIRPRFX=${_tool}/ all
1617 + .endfor
1618 +
1619 + _xi-mtree:
1620 +        ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1621 +        mkdir -p ${XDDESTDIR}
1622 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1623 +            -p ${XDDESTDIR} >/dev/null
1624 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1625 +            -p ${XDDESTDIR}/usr >/dev/null
1626 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1627 +            -p ${XDDESTDIR}/usr/include >/dev/null
1628 +
1629 + .ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1630 + xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1631 +
1632 + _xi-cross-tools:
1633 +        @echo "_xi-cross-tools"
1634 + .for _tool in \
1635 +    gnu/usr.bin/binutils \
1636 +    gnu/usr.bin/cc \
1637 +    usr.bin/ar
1638 +        ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1639 +        cd ${.CURDIR}/${_tool}; \
1640 +        ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1641 + .endfor
1642 +
1643 + _xi-includes:
1644 +        ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1645 +                DESTDIR=${XDDESTDIR}
1646 +
1647 + _xi-libraries:
1648 +        ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1649 +                DESTDIR=${XDDESTDIR}
1650 +
1651 + _xi-links:
1652 +        ${_+_}cd ${XDDESTDIR}/usr/bin; \
1653 +                for i in *; do \
1654 +                        ln -sf ../../${XDTP}/usr/bin/$$i \
1655 +                            ../../../../usr/bin/${XDDIR}-$$i; \
1656 +                        ln -sf ../../${XDTP}/usr/bin/$$i \
1657 +                            ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
1658 +                done
1659 + .endif

Comparing trunk/Makefile.inc1 (property cvs2svn:cvs-rev):
Revision 366 by laffer1, Wed Dec 27 04:04:06 2006 UTC vs.
Revision 5123 by laffer1, Sun Aug 19 14:05:10 2012 UTC

# Line 1 | Line 1
1 < 1.6
1 > 1.43

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines