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 1926 by laffer1, Tue Oct 7 01:56:49 2008 UTC vs.
Revision 9755 by laffer1, Sat Jan 20 20:39:41 2018 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.11 2008/10/05 21:14:01 laffer1 Exp $
2 > # $MidnightBSD$
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 + #       -DDB_FROM_SRC use the user/group databases in src/etc instead of
8 + #           the system database when installing.
9   #       -DNO_SHARE do not go into share subdir
10 + #       -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ}
11   #       -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
12   #       -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
13   #       -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
14 + #       -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
15   #       -DNO_PORTSUPDATE do not update ports in ${MAKE} update
16 + #       -DNO_ROOT install without using root privilege
17   #       -DNO_DOCUPDATE do not update doc in ${MAKE} update
18 + #       -DNO_CTF do not run the DTrace CTF conversion tools on built objects
19   #       LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
20 + #       LOCAL_MTREE="list of mtree files" to process to allow local directories
21 + #           to be created before files are installed
22 + #       METALOG="path to metadata log" to write permission and ownership
23 + #           when NO_ROOT is set.  (default: ${DESTDIR}/METALOG)
24   #       TARGET="machine" to crossbuild world for a different machine type
25 + #       TARGET_ARCH= may be required when a TARGET supports multiple endians
26  
27   #
28   # The intended user-driven targets are:
# Line 25 | Line 35
35   # /usr/share/mk.  These include:
36   #               obj depend all install clean cleandepend cleanobj
37  
38 + # You are supposed to define both of these when calling Makefile.inc1
39 + # directly.  However, some old scripts don't.  Cope for the moment, but
40 + # issue a new warning for a transition period.
41 + .if defined(TARGET) && !defined(TARGET_ARCH)
42 + .warning "You must pass both TARGET and TARGET_ARCH to Makefile.inc1.  Setting TARGET_ARCH=${TARGET}."
43 + TARGET_ARCH=${TARGET}
44 + .endif
45 + .if !defined(TARGET) || !defined(TARGET_ARCH)
46 + .error "Both TARGET and TARGET_ARCH must be defined."
47 + .endif
48 +
49   .include <bsd.own.mk>
50 + .include <bsd.arch.inc.mk>
51 + .include <bsd.compiler.mk>
52  
53   # We must do share/info early so that installation of info `dir'
54   # entries works correctly.  Do it first since it is less likely to
# Line 38 | Line 61
61   #
62   SUBDIR= share/info lib libexec
63   SUBDIR+=bin
64 + .if ${MK_APACHE} != "no"
65 + SUBDIR+=apache
66 + .endif
67   .if ${MK_GAMES} != "no"
68   SUBDIR+=games
69   .endif
# Line 59 | Line 85 | SUBDIR+=secure
85   SUBDIR+=share
86   .endif
87   SUBDIR+=sys usr.bin usr.sbin
88 + .if ${MK_OFED} != "no"
89 + SUBDIR+=contrib/ofed
90 + .endif
91   #
92   # We must do etc/ last for install/distribute to work.
93   #
# Line 85 | Line 114 | CLEANDIR=      clean cleandepend
114   CLEANDIR=       cleandir
115   .endif
116  
117 < CVS?=           cvs
118 < CVSFLAGS?=      -r . -P -d -I!
90 < SUP?=           /usr/bin/csup
91 < SUPFLAGS?=      -g -L 2
92 < .if defined(SUPHOST)
93 < SUPFLAGS+=      -h ${SUPHOST}
94 < .endif
117 > SVN?=           /usr/local/bin/svn
118 > SVNFLAGS?=      -r HEAD
119  
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  
130 < # Guess machine architecture from machine type, and vice versa.
131 < .if !defined(TARGET_ARCH) && defined(TARGET)
132 < TARGET_ARCH=    ${TARGET:S/pc98/i386/:S/sun4v/sparc64/}
109 < .elif !defined(TARGET) && defined(TARGET_ARCH) && \
110 <    ${TARGET_ARCH} != ${MACHINE_ARCH}
111 < TARGET=         ${TARGET_ARCH}
130 > .if !defined(VERSION)
131 > VERSION!=       uname -srp
132 > VERSION+=       ${OSRELDATE}
133   .endif
113 # Otherwise, default to current machine type and architecture.
114 TARGET?=        ${MACHINE}
115 TARGET_ARCH?=   ${MACHINE_ARCH}
134  
135 < KNOWN_ARCHES?=  amd64 arm i386 i386/pc98 ia64 powerpc sparc64 sparc64/sun4v
135 >
136 > KNOWN_ARCHES?=  amd64 i386
137   .if ${TARGET} == ${TARGET_ARCH}
138   _t=             ${TARGET}
139   .else
# Line 148 | Line 167 | BUILD_ARCH!=   uname -p
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
177 < BPATH=          ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
177 > BPATH=          ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games:${WORLDTMP}/legacy/bin
178   XPATH=          ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
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 191 | Line 217 | BOOTSTRAPPING?=        0
217  
218   # Common environment for world related stages
219   CROSSENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
220 +                MACHINE_INCLUDES="${WORLDTMP}/include" \
221                  MACHINE_ARCH=${TARGET_ARCH} \
222                  MACHINE=${TARGET} \
223 <                CPUTYPE=${TARGET_CPUTYPE} \
224 <                GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
223 >                CPUTYPE=${TARGET_CPUTYPE}
224 > .if ${OSRELDATE} < 4015
225 > CROSSENV+=      AR=gnu-ar RANLIB=gnu-ranlib
226 > .endif
227 > .if ${MK_GROFF} != "no"
228 > CROSSENV+=      GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
229                  GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
230                  GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
231 + .endif
232  
233   # bootstrap-tools stage
234   BMAKEENV=       INSTALL="sh ${.CURDIR}/tools/install.sh" \
235 +                MACHINE_INCLUDES="${WORLDTMP}/include" \
236                  PATH=${BPATH}:${PATH} \
237                  WORLDTMP=${WORLDTMP} \
238 <                MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
238 >                VERSION="${VERSION}" \
239 >                MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
240 >                COMPILER_TYPE=${COMPILER_TYPE}
241   BMAKE=          MAKEOBJDIRPREFIX=${WORLDTMP} \
242                  ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
243                  DESTDIR= \
244                  BOOTSTRAPPING=${OSRELDATE} \
245 +                SSP_CFLAGS= \
246                  -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
247 <                -DWITHOUT_NLS -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
248 <                -DNO_CPU_CFLAGS -DNO_WARNS
247 >                -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
248 >                -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
249  
250   # build-tools stage
251   TMAKE=          MAKEOBJDIRPREFIX=${OBJTREE} \
252                  ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
253                  TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
254                  DESTDIR= \
255 <                BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS
255 >                BOOTSTRAPPING=${OSRELDATE} \
256 >                SSP_CFLAGS= \
257 >                -DNO_LINT \
258 >                -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
259  
260   # cross-tools stage
261   XMAKE=          TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
# Line 226 | Line 265 | XMAKE=         TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
265   # world stage
266   WMAKEENV=       ${CROSSENV} \
267                  _SHLIBDIRPREFIX=${WORLDTMP} \
268 +                _LDSCRIPTROOT= \
269 +                MACHINE_INCLUDES="${WORLDTMP}/include" \
270 +                VERSION="${VERSION}" \
271                  INSTALL="sh ${.CURDIR}/tools/install.sh" \
272                  PATH=${TMPPATH}
273 + .if ${MK_CDDL} == "no"
274 + WMAKEENV+=      NO_CTF=1
275 + .endif
276 + .if ${CC:T:Mgcc} == "gcc"
277 + WMAKE_COMPILER_TYPE=    gcc
278 + .elif ${CC:T:Mclang} == "clang"
279 + WMAKE_COMPILER_TYPE=    clang
280 + .elif ${MK_CLANG_IS_CC} == "no"
281 + WMAKE_COMPILER_TYPE=    gcc
282 + .else
283 + WMAKE_COMPILER_TYPE=    clang
284 + .endif
285 + WMAKEENV+=      COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
286   WMAKE=          ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
287  
288   .if ${TARGET_ARCH} == "amd64"
289   # 32 bit world
290   LIB32TMP=       ${OBJTREE}${.CURDIR}/lib32
291  
292 + .if ${TARGET_ARCH} == "amd64"
293   .if empty(TARGET_CPUTYPE)
294 < LIB32CPUTYPE=   k8
294 > LIB32CPUFLAGS=  -march=i686 -mmmx -msse -msse2
295   .else
296 < LIB32CPUTYPE=   ${TARGET_CPUTYPE}
296 > LIB32CPUFLAGS=  -march=${TARGET_CPUTYPE}
297   .endif
298 < LIB32FLAGS=     -m32 -march=${LIB32CPUTYPE} -mfancy-math-387 -DCOMPAT_32BIT \
299 <                -iprefix ${LIB32TMP}/usr/ \
298 > LIB32WMAKEENV=  MACHINE=i386 MACHINE_ARCH=i386 \
299 >                MACHINE_CPU="i686 mmx sse sse2"
300 > LIB32WMAKEFLAGS=        \
301 >                AS="${AS} --32" \
302 >                LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
303 > .endif
304 >
305 >
306 > LIB32FLAGS=     -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
307 >                -isystem ${LIB32TMP}/usr/include/ \
308                  -L${LIB32TMP}/usr/lib32 \
309                  -B${LIB32TMP}/usr/lib32
310  
311   # Yes, the flags are redundant.
312 < LIB32WMAKEENV=  MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
312 > LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
313                  _SHLIBDIRPREFIX=${LIB32TMP} \
314 <                MACHINE=i386 \
315 <                MACHINE_ARCH=i386 \
314 >                _LDSCRIPTROOT=${LIB32TMP} \
315 >                VERSION="${VERSION}" \
316                  INSTALL="sh ${.CURDIR}/tools/install.sh" \
317                  PATH=${TMPPATH} \
318 +                LIBDIR=/usr/lib32 \
319 +                SHLIBDIR=/usr/lib32 \
320 +                LIBPRIVATEDIR=/usr/lib32/private \
321 +                MACHINE_INCLUDES="${WORLDTMP}/include" \
322 +                COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
323 + LIB32WMAKEFLAGS+=       \
324                  CC="${CC} ${LIB32FLAGS}" \
325                  CXX="${CXX} ${LIB32FLAGS}" \
326 <                OBJC="${OBJC} ${LIB32FLAGS}" \
327 <                LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
328 <                AS="${AS} --32" \
329 <                LIBDIR=/usr/lib32 \
330 <                SHLIBDIR=/usr/lib32
326 >                DESTDIR=${LIB32TMP} \
327 >                -DCOMPAT_32BIT \
328 >                -DLIBRARIES_ONLY \
329 >                -DNO_CPU_CFLAGS \
330 >                -DNO_CTF \
331 >                -DNO_LINT
332  
333 < LIB32WMAKE=     ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
334 <                -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_INFO \
335 <                -DWITHOUT_HTML DESTDIR=${LIB32TMP}
336 < LIB32IMAKE=     ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
333 > LIB32WMAKE=     ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
334 >                -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
335 >                -DWITHOUT_HTML -DNO_CTF -DNO_LINT \
336 >                DESTDIR=${LIB32TMP}
337 > LIB32IMAKE=     ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \
338 >                ${IMAKE_INSTALL}
339   .endif
340  
341 < # install stage
341 > IMAKEENV=       ${CROSSENV:N_LDSCRIPTROOT=*}
342 > IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
343 >                ${IMAKE_INSTALL} ${IMAKE_MTREE}
344   .if empty(.MAKEFLAGS:M-n)
345 < IMAKEENV=       ${CROSSENV} \
346 <                PATH=${STRICTTMPPATH}:${INSTALLTMP}
345 > IMAKEENV+=      PATH=${STRICTTMPPATH}:${INSTALLTMP} \
346 >                LD_LIBRARY_PATH=${INSTALLTMP} \
347 >                PATH_LOCALE=${INSTALLTMP}/locale
348 > IMAKE+=         __MAKE_SHELL=${INSTALLTMP}/sh
349   .else
350 < IMAKEENV=       ${CROSSENV} \
274 <                PATH=${TMPPATH}:${INSTALLTMP}
350 > IMAKEENV+=      PATH=${TMPPATH}:${INSTALLTMP}
351   .endif
352 < IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
352 > .if defined(DB_FROM_SRC)
353 > INSTALLFLAGS+=  -N ${.CURDIR}/etc
354 > MTREEFLAGS+=    -N ${.CURDIR}/etc
355 > .endif
356 > .if defined(NO_ROOT)
357 > METALOG?=       ${DESTDIR}/${DISTDIR}/METALOG
358 > IMAKE+=         -DNO_ROOT METALOG=${METALOG}
359 > INSTALL_DDIR=   ${DESTDIR}/${DISTDIR}
360 > INSTALLFLAGS+=  -U -M ${METALOG} -D ${INSTALL_DDIR:S://:/:g:C:/$::}
361 > MTREEFLAGS+=    -W
362 > .endif
363 > .if defined(DB_FROM_SRC) || defined(NO_ROOT)
364 > IMAKE_INSTALL=  INSTALL="install ${INSTALLFLAGS}"
365 > IMAKE_MTREE=    MTREE_CMD="nmtree ${MTREEFLAGS}"
366 > .endif
367  
368   # kernel stage
369   KMAKEENV=       ${WMAKEENV}
# Line 300 | Line 390 | _worldtmp:
390          @echo "--------------------------------------------------------------"
391   .if !defined(NO_CLEAN)
392          rm -rf ${WORLDTMP}
393 < .if ${TARGET_ARCH} == "amd64"
393 > .if defined(LIB32TMP)
394          rm -rf ${LIB32TMP}
395   .endif
396   .else
397          rm -rf ${WORLDTMP}/legacy/usr/include
398 < #       XXX - These two can depend on any header file.
398 > #       XXX - These three can depend on any header file.
399          rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
400 +        rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
401          rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
402   .endif
403   .for _dir in \
404 <    usr/bin usr/games usr/include/sys usr/lib \
314 <    usr/libexec usr/sbin usr/share/dict \
315 <    usr/share/groff_font/devX100 \
316 <    usr/share/groff_font/devX100-12 \
317 <    usr/share/groff_font/devX75 \
318 <    usr/share/groff_font/devX75-12 \
319 <    usr/share/groff_font/devascii \
320 <    usr/share/groff_font/devcp1047 \
321 <    usr/share/groff_font/devdvi \
322 <    usr/share/groff_font/devhtml \
323 <    usr/share/groff_font/devkoi8-r \
324 <    usr/share/groff_font/devlatin1 \
325 <    usr/share/groff_font/devlbp \
326 <    usr/share/groff_font/devlj4 \
327 <    usr/share/groff_font/devps \
328 <    usr/share/groff_font/devutf8 \
329 <    usr/share/tmac/mdoc usr/share/tmac/mm
330 <        mkdir -p ${WORLDTMP}/legacy/${_dir}
331 < .endfor
332 < .for _dir in \
333 <    lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
334 <    usr/libexec usr/sbin usr/share/misc
404 >    lib usr legacy/bin legacy/usr legacy/usr/bin legacy/usr/sbin
405          mkdir -p ${WORLDTMP}/${_dir}
406   .endfor
407 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
408 +            -p ${WORLDTMP}/legacy/usr >/dev/null
409 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
410 +            -p ${WORLDTMP}/usr >/dev/null
411          mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
412              -p ${WORLDTMP}/usr/include >/dev/null
413          ln -sf ${.CURDIR}/sys ${WORLDTMP}
# Line 341 | Line 415 | _worldtmp:
415          mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
416              -p ${WORLDTMP}/usr/include >/dev/null
417   .endif
418 + .for _mtree in ${LOCAL_MTREE}
419 +        mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
420 + .endfor
421   _legacy:
422          @echo
423          @echo "--------------------------------------------------------------"
# Line 360 | Line 437 | _cleanobj:
437          @echo ">>> stage 2.1: cleaning up the object tree"
438          @echo "--------------------------------------------------------------"
439          ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
440 < .if ${TARGET_ARCH} == "amd64"
440 > .if defined(LIB32TMP)
441          ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
442   .endif
443   .endif
# Line 395 | Line 472 | _libraries:
472          @echo "--------------------------------------------------------------"
473          ${_+_}cd ${.CURDIR}; \
474              ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
475 <            -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE libraries
475 >            -DWITHOUT_MAN -DWITHOUT_PROFILE libraries
476   _depend:
477          @echo
478          @echo "--------------------------------------------------------------"
# Line 408 | Line 485 | everything:
485          @echo ">>> stage 4.4: building everything"
486          @echo "--------------------------------------------------------------"
487          ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
488 < .if ${TARGET_ARCH} == "amd64"
488 > .if defined(LIB32TMP)
489   build32:
490          @echo
491          @echo "--------------------------------------------------------------"
492          @echo ">>> stage 5.1: building 32 bit shim libraries"
493          @echo "--------------------------------------------------------------"
494 < .for _dir in \
495 <    usr/include usr/lib32 usr/share/misc
496 <        mkdir -p ${LIB32TMP}/${_dir}
420 < .endfor
494 >        mkdir -p ${LIB32TMP}/usr/include
495 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
496 >            -p ${LIB32TMP}/usr >/dev/null
497          mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
498              -p ${LIB32TMP}/usr/include >/dev/null
499          mkdir -p ${WORLDTMP}
500          ln -sf ${.CURDIR}/sys ${WORLDTMP}
425 .if ${MK_KERBEROS} != "no"
426 .for _t in obj depend all
427        cd ${.CURDIR}/kerberos5/tools; \
428            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= ${_t}
429 .endfor
430 .endif
501   .for _t in obj includes
502 <        cd ${.CURDIR}/include; ${LIB32WMAKE} ${_t}
503 <        cd ${.CURDIR}/lib; ${LIB32WMAKE} ${_t}
502 >        cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
503 >        cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
504 > .if ${MK_APACHE} != "no"
505 >        cd ${.CURDIR}/apache/lib; ${LIB32WMAKE} ${_t}
506 > .endif
507   .if ${MK_CDDL} != "no"
508 <        cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} ${_t}
508 >        cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
509   .endif
510 <        cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} ${_t}
510 >        cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
511   .if ${MK_CRYPT} != "no"
512 <        cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} ${_t}
512 >        cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
513   .endif
514   .if ${MK_KERBEROS} != "no"
515 <        cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} ${_t}
515 >        cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
516   .endif
517   .endfor
518   .for _dir in usr.bin/lex/lib
519 <        cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} obj
519 >        cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
520   .endfor
521   .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
522          cd ${.CURDIR}/${_dir}; \
523 <            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= build-tools
523 >            WORLDTMP=${WORLDTMP} \
524 >            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
525 >            DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
526 >            -DEARLY_BUILD build-tools
527   .endfor
528          cd ${.CURDIR}; \
529              ${LIB32WMAKE} -f Makefile.inc1 libraries
530   .for _t in obj depend all
531 <        cd ${.CURDIR}/libexec/rtld-elf; \
532 <            PROG=ld-elf32.so.1 ${LIB32WMAKE} ${_t}
531 >        cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
532 >            DIRPRFX=libexec/rtld-elf/ ${_t}
533 >        cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
534 >            DIRPRFX=usr.bin/ldd ${_t}
535   .endfor
536  
537   distribute32 install32:
460 .if make(distribute32)
461        mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32   # XXX add to mtree
462 .else
463        mkdir -p ${DESTDIR}/usr/lib32                   # XXX add to mtree
464 .endif
538          cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
539 + .if ${MK_CDDL} != "no"
540 +        cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
541 + .endif
542          cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
543   .if ${MK_CRYPT} != "no"
544          cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
545   .endif
546 <        cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
546 > .if ${MK_KERBEROS} != "no"
547 >        cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
548   .endif
549 +        cd ${.CURDIR}/libexec/rtld-elf; \
550 +            PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
551 +        cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
552 + .endif
553  
473
554   WMAKE_TGTS=
555   .if !defined(SUBDIR_OVERRIDE)
556   WMAKE_TGTS+=    _worldtmp _legacy _bootstrap-tools
# Line 480 | Line 560 | WMAKE_TGTS+=   _cleanobj _obj _build-tools
560   WMAKE_TGTS+=    _cross-tools
561   .endif
562   WMAKE_TGTS+=    _includes _libraries _depend everything
563 < .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
563 > .if defined(LIB32TMP) && ${MK_LIB32} != "no"
564   WMAKE_TGTS+=    build32
565   .endif
566  
# Line 521 | Line 601 | kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_librar
601   # Checks to be sure system is ready for installworld/installkernel.
602   #
603   installcheck:
604 + installcheck_UGID:
605  
606   #
607 < # Require DESTDIR to be set if installing for a different architecture.
607 > # Require DESTDIR to be set if installing for a different architecture or
608 > # using the user/group database in the source tree.
609   #
610 < .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
610 > .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
611 >    defined(DB_FROM_SRC)
612   .if !make(distributeworld)
613   installcheck: installcheck_DESTDIR
614   installcheck_DESTDIR:
# Line 536 | Line 619 | installcheck_DESTDIR:
619   .endif
620   .endif
621  
622 + .if !defined(DB_FROM_SRC)
623   #
624   # Check for missing UIDs/GIDs.
625   #
626 < CHECK_UIDS=
626 > CHECK_UIDS=     auditdistd
627   CHECK_GIDS=     audit
628   .if ${MK_SENDMAIL} != "no"
629   CHECK_UIDS+=    smmsp
# Line 549 | Line 633 | CHECK_GIDS+=   smmsp
633   CHECK_UIDS+=    proxy
634   CHECK_GIDS+=    proxy authpf
635   .endif
552 installcheck: installcheck_UGID
636   installcheck_UGID:
637   .for uid in ${CHECK_UIDS}
638          @if ! `id -u ${uid} >/dev/null 2>&1`; then \
# Line 563 | Line 646 | installcheck_UGID:
646                  false; \
647          fi
648   .endfor
649 + .endif
650  
651   #
652 + # Required install tools to be saved in a scratch dir for safety.
653 + #
654 + .if ${MK_INFO} != "no"
655 + _install-info=  install-info
656 + .endif
657 + .if ${MK_ZONEINFO} != "no"
658 + _zoneinfo=      zic tzsetup
659 + .endif
660 +
661 + .if exists(/usr/sbin/nmtree)
662 + _nmtree_itools= nmtree
663 + .endif
664 +
665 + ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
666 +        date echo egrep find grep id install ${_install-info} \
667 +        ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \
668 +        rm sed sh sysctl test true uname wc ${_zoneinfo}
669 +
670 + #
671   # distributeworld
672   #
673   # Distributes everything compiled by a `buildworld'.
# Line 573 | Line 676 | installcheck_UGID:
676   #
677   # Installs everything compiled by a 'buildworld'.
678   #
679 < distributeworld installworld: installcheck
679 >
680 > # Non-base distributions produced by the base system
681 > EXTRA_DISTRIBUTIONS=    doc
682 > .if ${MK_GAMES} != "no"
683 > EXTRA_DISTRIBUTIONS+=   games
684 > .endif
685 > .if defined(LIB32TMP) && ${MK_LIB32} != "no"
686 > EXTRA_DISTRIBUTIONS+=   lib32
687 > .endif
688 >
689 > MTREE_MAGIC?=   mtree 2.0
690 >
691 > distributeworld installworld: installcheck installcheck_UGID
692          mkdir -p ${INSTALLTMP}
693 <        for prog in [ awk cap_mkdb cat chflags chmod chown \
694 <            date echo egrep find grep install-info \
695 <            ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
696 <            test true uname wc zic; do \
697 <                cp `which $$prog` ${INSTALLTMP}; \
698 <        done
699 <        ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
700 <        rm -rf ${INSTALLTMP}
693 >        progs=$$(for prog in ${ITOOLS}; do \
694 >                if progpath=`which $$prog`; then \
695 >                        echo $$progpath; \
696 >                else \
697 >                        echo "Required tool $$prog not found in PATH." >&2; \
698 >                        exit 1; \
699 >                fi; \
700 >            done); \
701 >        libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
702 >            while read line; do \
703 >                set -- $$line; \
704 >                if [ "$$2 $$3" != "not found" ]; then \
705 >                        echo $$2; \
706 >                else \
707 >                        echo "Required library $$1 not found." >&2; \
708 >                        exit 1; \
709 >                fi; \
710 >            done); \
711 >        cp $$libs $$progs ${INSTALLTMP}
712 >        cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
713 > .if defined(NO_ROOT)
714 >        echo "#${MTREE_MAGIC}" > ${METALOG}
715 > .endif
716 > .if make(distributeworld)
717 > .for dist in ${EXTRA_DISTRIBUTIONS}
718 >        -mkdir ${DESTDIR}/${DISTDIR}/${dist}
719 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
720 >            -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
721 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
722 >            -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
723 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
724 >            -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
725 > .if defined(NO_ROOT)
726 >        ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
727 >            sed -e 's#^\./#./${dist}/#' >> ${METALOG}
728 >        ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
729 >            sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
730 >        ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
731 >            sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
732 > .endif
733 > .endfor
734 >        -mkdir ${DESTDIR}/${DISTDIR}/base
735 >        cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
736 >            METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
737 >            DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
738 >            LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
739 > .endif
740 >        ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
741 >            ${IMAKEENV} rm -rf ${INSTALLTMP}
742 > .if make(distributeworld)
743 > .for dist in ${EXTRA_DISTRIBUTIONS}
744 >        find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
745 > .endfor
746 > .if defined(NO_ROOT)
747 > .for dist in base ${EXTRA_DISTRIBUTIONS}
748 >        @# For each file that exists in this dist, print the corresponding
749 >        @# line from the METALOG.  This relies on the fact that
750 >        @# a line containing only the filename will sort immediatly before
751 >        @# the relevant mtree line.
752 >        cd ${DESTDIR}/${DISTDIR}; \
753 >        find ./${dist} | sort -u ${METALOG} - | \
754 >        awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
755 >        ${DESTDIR}/${DISTDIR}/${dist}.meta
756 > .endfor
757 > .endif
758 > .endif
759  
760 + packageworld:
761 + .for dist in base ${EXTRA_DISTRIBUTIONS}
762 + .if defined(NO_ROOT)
763 +        ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
764 +            tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
765 +            @${DESTDIR}/${DISTDIR}/${dist}.meta
766 + .else
767 +        ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
768 +            tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz .
769 + .endif
770 + .endfor
771 +
772   #
773   # reinstall
774   #
# Line 595 | Line 780 | reinstall:
780          @echo "--------------------------------------------------------------"
781          @echo ">>> Making hierarchy"
782          @echo "--------------------------------------------------------------"
783 <        ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
783 >        ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
784 >            LOCAL_MTREE=${LOCAL_MTREE} hierarchy
785          @echo
786          @echo "--------------------------------------------------------------"
787          @echo ">>> Installing everything"
788          @echo "--------------------------------------------------------------"
789          ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
790 < .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
790 > .if defined(LIB32TMP) && ${MK_LIB32} != "no"
791          ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
792   .endif
793  
# Line 610 | Line 796 | redistribute:
796          @echo ">>> Distributing everything"
797          @echo "--------------------------------------------------------------"
798          ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
799 < .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
800 <        ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 DISTRIBUTION=lib32
799 > .if defined(LIB32TMP) && ${MK_LIB32} != "no"
800 >        ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
801 >            DISTRIBUTION=lib32
802   .endif
803  
804   distrib-dirs distribution:
805 <        cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
805 >        cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
806 >            ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
807  
808   #
809   # buildkernel and installkernel
# Line 631 | Line 819 | distrib-dirs distribution:
819   # be set to cross-build, we have to make sure TARGET is set
820   # properly.
821  
822 + .if defined(KERNFAST)
823 + NO_KERNELCLEAN= t
824 + NO_KERNELCONFIG=        t
825 + NO_KERNELDEPEND=        t
826 + NO_KERNELOBJ=           t
827 + # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
828 + .if !defined(KERNCONF) && ${KERNFAST} != "1"
829 + KERNCONF=${KERNFAST}
830 + .endif
831 + .endif
832   .if !defined(KERNCONF) && defined(KERNEL)
833   KERNCONF=       ${KERNEL}
834   KERNWARN=
# Line 695 | Line 893 | buildkernel:
893          @echo "--------------------------------------------------------------"
894          cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
895   .endif
896 + .if !defined(NO_KERNELOBJ)
897          @echo
898          @echo "--------------------------------------------------------------"
899          @echo ">>> stage 2.2: rebuilding the object tree"
900          @echo "--------------------------------------------------------------"
901          cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
902 + .endif
903          @echo
904          @echo "--------------------------------------------------------------"
905          @echo ">>> stage 2.3: build tools"
906          @echo "--------------------------------------------------------------"
907          cd ${KRNLOBJDIR}/${_kernel}; \
908 +            PATH=${BPATH}:${PATH} \
909              MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
910 <            ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
910 >            ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \
911 >            -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
912   # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
913   .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
914   .for target in obj depend all
915          cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
916 +            PATH=${BPATH}:${PATH} \
917              MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
918 <            ${MAKE} -DNO_CPU_CFLAGS ${target}
918 >            ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target}
919   .endfor
920   .endif
921   .if !defined(NO_KERNELDEPEND)
# Line 744 | Line 947 | reinstallkernel reinstallkernel.debug: installcheck
947          false
948   .endif
949          @echo "--------------------------------------------------------------"
950 <        @echo ">>> Installing kernel"
950 >        @echo ">>> Installing kernel ${INSTALLKERNEL}"
951          @echo "--------------------------------------------------------------"
952          cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
953              ${CROSSENV} PATH=${TMPPATH} \
954 <            ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
954 >            ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
955  
956 + distributekernel distributekernel.debug:
957 + .if empty(INSTALLKERNEL)
958 +        @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
959 +        false
960 + .endif
961 +        cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
962 +            ${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
963 +            DESTDIR=${DESTDIR}/${DISTDIR}/kernel \
964 +            ${.TARGET:S/distributekernel/install/}
965 + .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
966 +        cd ${KRNLOBJDIR}/${_kernel}; \
967 +            ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
968 +            KERNEL=${INSTKERNNAME}.${_kernel} \
969 +            DESTDIR=${DESTDIR}/${DISTDIR}/kernel.${_kernel} \
970 +            ${.TARGET:S/distributekernel/install/}
971 + .endfor
972 +
973 + packagekernel:
974 +        cd ${DESTDIR}/${DISTDIR}/kernel; \
975 +            tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
976 + .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
977 +        cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
978 +            tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
979 + .endfor
980 +
981   #
982   # doxygen
983   #
# Line 765 | Line 993 | doxygen:
993   #
994   # update
995   #
996 < # Update the source tree, by running cvsup and/or running cvs to update to the
996 > # Update the source tree(s), by running cvsup/cvs/svn to update to the
997   # latest copy.
998   #
999   update:
# Line 790 | Line 1018 | update:
1018   .endif
1019   .endif
1020   .if defined(CVS_UPDATE)
1021 <        @echo "--------------------------------------------------------------"
1022 <        @echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT}
1023 <        @echo "--------------------------------------------------------------"
1024 <        cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS}
1021 >        @cd ${.CURDIR} ; \
1022 >        if [ -d CVS ] ; then \
1023 >                echo "--------------------------------------------------------------" ; \
1024 >                echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
1025 >                echo "--------------------------------------------------------------" ; \
1026 >                echo ${CVS} -R -q update ${CVSFLAGS} ; \
1027 >                ${CVS} -R -q update ${CVSFLAGS} ; \
1028 >        fi
1029   .endif
1030 + .if defined(SVN_UPDATE)
1031 +        @cd ${.CURDIR} ; \
1032 +        if [ -d .svn ] ; then \
1033 +                echo "--------------------------------------------------------------" ; \
1034 +                echo ">>> Updating ${.CURDIR} using Subversion" ; \
1035 +                echo "--------------------------------------------------------------" ; \
1036 +                echo ${SVN} update ${SVNFLAGS} ; \
1037 +                ${SVN} update ${SVNFLAGS} ; \
1038 +        fi
1039 + .endif
1040  
1041   #
1042   # ------------------------------------------------------------------------
# Line 811 | Line 1053 | update:
1053   # legacy: Build compatibility shims for the next three targets
1054   #
1055   legacy:
1056 < .if ${BOOTSTRAPPING} < 503000
1057 <        @echo "ERROR: Source upgrades from versions prior to 5.3 not supported."; \
1056 > .if ${BOOTSTRAPPING} < 7000 && ${BOOTSTRAPPING} != 0
1057 >        @echo "ERROR: Source upgrades from versions prior to 0.7 not supported."; \
1058          false
1059   .endif
1060 +        mkdir -p ${MAKEOBJDIRPREFIX}/legacy/usr/bin
1061   .for _tool in tools/build
1062          ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1063 <            cd ${.CURDIR}/${_tool}; \
1064 <            ${MAKE} DIRPRFX=${_tool}/ obj; \
1065 <            ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
1066 <            ${MAKE} DIRPRFX=${_tool}/ depend; \
1067 <            ${MAKE} DIRPRFX=${_tool}/ all; \
1063 >            cd ${.CURDIR}/${_tool} && \
1064 >            ${MAKE} DIRPRFX=${_tool}/ obj && \
1065 >            ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1066 >            ${MAKE} DIRPRFX=${_tool}/ depend && \
1067 >            ${MAKE} DIRPRFX=${_tool}/ all && \
1068              ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1069   .endfor
1070  
# Line 834 | Line 1077 | _strfile=      games/fortune/strfile
1077  
1078   .if ${MK_CXX} != "no"
1079   _gperf=         gnu/usr.bin/gperf
1080 < .if ${BOOTSTRAPPING} < 700004
1080 > .endif
1081 >
1082 > .if ${MK_GROFF} != "no"
1083   _groff=         gnu/usr.bin/groff
839 .else
840 _groff=         gnu/usr.bin/groff/tmac
1084   .endif
1085 +
1086 + .if ${BOOTSTRAPPING} >= 4000 && ${BOOTSTRAPPING} < 4015
1087 + _ar=            usr.bin/ar
1088   .endif
1089  
1090 < .if ${BOOTSTRAPPING} < 600029
1091 < _texinfo=       gnu/usr.bin/texinfo
1090 > .if ${BOOTSTRAPPING} < 4015
1091 > _mklocale=      usr.bin/mklocale
1092   .endif
1093  
1094 < .if ${BOOTSTRAPPING} < 600015
1095 < _cap_mkdb=      usr.bin/cap_mkdb
1094 > .if ${BOOTSTRAPPING} < 4015
1095 > _sed=           usr.bin/sed
1096   .endif
1097  
1098 < .if ${BOOTSTRAPPING} < 600018
1099 < _colldef=       usr.bin/colldef
1098 > .if ${BOOTSTRAPPING} < 7003
1099 > _m4=            usr.bin/m4
1100   .endif
1101  
1102 < .if ${BOOTSTRAPPING} < 600017
1103 < _gencat=        usr.bin/gencat
1102 > .if ${BOOTSTRAPPING} < 7003
1103 > _lex=           usr.bin/lex
1104   .endif
1105  
1106 < .if ${BOOTSTRAPPING} < 600016
1107 < _mklocale=      usr.bin/mklocale
1106 > .if ${BOOTSTRAPPING} < 7003
1107 > _yacc=          lib/liby \
1108 >                usr.bin/yacc
1109   .endif
1110  
1111 < .if ${BOOTSTRAPPING} < 700018
1111 > .if ${BOOTSTRAPPING} < 9002
1112 > _nmtree=       lib/libnetbsd \
1113 >               usr.sbin/nmtree
1114 > .endif
1115 >
1116 >
1117 > .if ${MK_BSNMP} != "no" && \
1118 >    (${BOOTSTRAPPING} < 4015 || !exists(/usr/sbin/gensnmptree))
1119   _gensnmptree=   usr.sbin/bsnmpd/gensnmptree
1120   .endif
1121  
1122   .if ${MK_RESCUE} != "no" && \
1123 <    ${BOOTSTRAPPING} < 700026
1123 >    ${BOOTSTRAPPING} < 4015
1124   _crunchgen=     usr.sbin/crunch/crunchgen
1125   .endif
1126  
1127 < .if ${BOOTSTRAPPING} < 600020
1128 < _pwd_mkdb=      usr.sbin/pwd_mkdb
1127 > .if ${MK_CLANG} != "no"
1128 > _clang_tblgen= \
1129 >        lib/clang/libllvmsupport \
1130 >        lib/clang/libllvmtablegen \
1131 >        usr.bin/clang/tblgen \
1132 >        usr.bin/clang/clang-tblgen
1133   .endif
1134  
1135 + .if ${MK_CDDL} != "no" && \
1136 +    ${BOOTSTRAPPING} < 4015 && \
1137 +    !(${BOOTSTRAPPING} >= 4000 && ${BOOTSTRAPPING} < 4015)
1138 + _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1139 +    lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1140 + .endif
1141 +
1142 + .if ${MK_FDT} != "no"
1143 + _dtc= gnu/usr.bin/dtc
1144 + .endif
1145 +
1146 + #       Please document (add comment) why something is in 'bootstrap-tools'.
1147 + #       Try to bound the building of the bootstrap-tool to just the
1148 + #       MidnightBSD versions that need the tool built at this stage of the build.
1149   bootstrap-tools:
1150   .for _tool in \
1151 +    ${_clang_tblgen} \
1152 +    ${_kerberos5_bootstrap_tools} \
1153 +    ${_dtrace_tools} \
1154      ${_strfile} \
1155      ${_gperf} \
1156      ${_groff} \
1157 <    ${_texinfo} \
1158 <    ${_cap_mkdb} \
1159 <    ${_colldef} \
1160 <    ${_gencat} \
1157 >    ${_ar} \
1158 >    ${_dtc} \
1159 >    ${_awk} \
1160 >    ${_cat} \
1161      usr.bin/lorder \
1162      usr.bin/makewhatis \
1163      ${_mklocale} \
1164      usr.bin/rpcgen \
1165 +    ${_sed} \
1166 +    ${_yacc} \
1167 +    ${_m4} \
1168 +    ${_lex} \
1169 +    lib/libmd \
1170      usr.bin/xinstall \
1171      ${_gensnmptree} \
1172      usr.sbin/config \
1173      ${_crunchgen} \
1174 <    ${_pwd_mkdb}
1174 >    ${_nmtree}
1175          ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1176                  cd ${.CURDIR}/${_tool}; \
1177                  ${MAKE} DIRPRFX=${_tool}/ obj; \
# Line 911 | Line 1191 | _aicasm= sys/modules/aic7xxx/aicasm
1191   _share= share/syscons/scrnmaps
1192   .endif
1193  
1194 + .if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
1195 + _gcc_tools= gnu/usr.bin/cc/cc_tools
1196 + .endif
1197 +
1198   .if ${MK_KERBEROS} != "no"
1199 < _kerberos5_tools= kerberos5/tools
1199 > _kerberos5_bootstrap_tools= \
1200 >        kerberos5/tools/make-roken \
1201 >        kerberos5/lib/libroken \
1202 >        kerberos5/lib/libvers \
1203 >        kerberos5/tools/asn1_compile \
1204 >        kerberos5/tools/slc \
1205 >        usr.bin/compile_et
1206 >
1207 > .ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g}
1208   .endif
1209  
1210   .if ${MK_RESCUE} != "no"
# Line 930 | Line 1222 | build-tools:
1222      ${_aicasm} \
1223      usr.bin/awk \
1224      lib/libmagic \
1225 <    usr.sbin/sysinstall
1225 >    usr.sbin/sysinstall \
1226 >    usr.bin/mkesdb_static \
1227 >    usr.bin/mkcsmapper_static
1228          ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1229                  cd ${.CURDIR}/${_tool}; \
1230                  ${MAKE} DIRPRFX=${_tool}/ obj; \
1231                  ${MAKE} DIRPRFX=${_tool}/ build-tools
1232   .endfor
1233   .for _tool in \
1234 <    gnu/usr.bin/cc/cc_tools \
1235 <    ${_kerberos5_tools}
1236 <        ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1237 <                cd ${.CURDIR}/${_tool}; \
1238 <                ${MAKE} DIRPRFX=${_tool}/ obj; \
1239 <                ${MAKE} DIRPRFX=${_tool}/ depend; \
1240 <                ${MAKE} DIRPRFX=${_tool}/ all
1234 >    ${_gcc_tools} \
1235 >    ${_kerberos5_bootstrap_tools}
1236 >        ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1237 >                cd ${.CURDIR}/${_tool} && \
1238 >                ${MAKE} DIRPRFX=${_tool}/ obj && \
1239 >                ${MAKE} DIRPRFX=${_tool}/ depend && \
1240 >                ${MAKE} DIRPRFX=${_tool}/ all && \
1241 >                ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy install
1242   .endfor
1243  
1244   #
1245   # cross-tools: Build cross-building tools
1246   #
1247 < .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1247 > .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 4016
1248   .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1249   _btxld=         usr.sbin/btxld
1250   .endif
1251 + .endif
1252 + .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1253   .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1254   _crunchide=     usr.sbin/crunch/crunchide
1255   .endif
# Line 961 | Line 1258 | _kgzip=                usr.sbin/kgzip
1258   .endif
1259   .endif
1260  
1261 + .if ${MK_BINUTILS} != "no"
1262 + _binutils=      gnu/usr.bin/binutils
1263 + .endif
1264 +
1265 + .if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")
1266 + _clang=         usr.bin/clang
1267 + _clang_libs=    lib/clang
1268 + .endif
1269 +
1270 + .if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
1271 + _cc=            gnu/usr.bin/cc
1272 + .endif
1273 +
1274   cross-tools:
1275   .for _tool in \
1276 <    gnu/usr.bin/binutils \
1277 <    gnu/usr.bin/cc \
1278 <    usr.bin/sed \
1276 >    ${_clang_libs} \
1277 >    ${_clang} \
1278 >    ${_binutils} \
1279 >    ${_cc} \
1280      usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1281      ${_btxld} \
1282      ${_crunchide} \
# Line 982 | Line 1293 | cross-tools:
1293   # hierarchy - ensure that all the needed directories are present
1294   #
1295   hierarchy:
1296 <        cd ${.CURDIR}/etc;              ${MAKE} distrib-dirs
1296 > .if defined(NO_ROOT)
1297 >        cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} \
1298 >            -DNO_ROOT METALOG=${METALOG} distrib-dirs
1299 > .else
1300 >        cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
1301 > .endif
1302  
1303   #
1304   # libraries - build all libraries, and install them under ${DESTDIR}.
# Line 1001 | Line 1317 | libraries:
1317   #
1318   # static libgcc.a prerequisite for shared libc
1319   #
1320 < _prereq_libs= gnu/lib/libgcc
1320 > _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1321  
1322   # These dependencies are not automatically generated:
1323   #
# Line 1011 | Line 1327 | _prereq_libs= gnu/lib/libgcc
1327   _startup_libs=  gnu/lib/csu
1328   .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1329   _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1330 < .else
1330 > .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1331   _startup_libs+= lib/csu/${MACHINE_ARCH}
1332 + .else
1333 + _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1334   .endif
1335   _startup_libs+= gnu/lib/libgcc
1336 + _startup_libs+= lib/libcompiler_rt
1337   _startup_libs+= lib/libc
1338 + _startup_libs+= lib/libc_nonshared
1339 + .if ${MK_LIBCPLUSPLUS} != "no"
1340 + _startup_libs+= lib/libcxxrt
1341 + .endif
1342  
1343   gnu/lib/libgcc__L: lib/libc__L
1344 + gnu/lib/libgcc__L: lib/libc_nonshared__L
1345 + .if ${MK_LIBCPLUSPLUS} != "no"
1346 + lib/libcxxrt__L: gnu/lib/libgcc__L
1347 + .endif
1348  
1349 < _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libkrb5} \
1349 > _prebuild_libs= ${_kerberos5_lib_libasn1} \
1350 >                ${_kerberos5_lib_libhdb} \
1351 >                ${_kerberos5_lib_libheimbase} \
1352 >                ${_kerberos5_lib_libheimntlm} \
1353 >                ${_kerberos5_lib_libheimsqlite} \
1354 >                ${_kerberos5_lib_libheimipcc} \
1355 >                ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1356                  ${_kerberos5_lib_libroken} \
1357 <                lib/libbz2 lib/libcom_err lib/libcrypt lib/libexpat \
1357 >                ${_kerberos5_lib_libwind} \
1358 >                lib/libbz2 lib/libcom_err lib/libcrypt \
1359 >                lib/libelf lib/libexpat \
1360                  ${_lib_libgssapi} ${_lib_libipx} \
1361 <                lib/libkiconv lib/libkvm lib/libmd \
1361 >                lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
1362                  lib/ncurses/ncurses lib/ncurses/ncursesw \
1363 <                lib/libopie lib/libpam ${_default_thread_lib} \
1364 <                lib/libradius lib/libsbuf lib/libtacplus lib/libutil \
1365 <                ${_lib_libypclnt} lib/libz lib/msun \
1363 >                lib/libopie lib/libpam ${_lib_libthr} \
1364 >                lib/libradius lib/libsbuf lib/libtacplus \
1365 >                ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1366 >                ${_cddl_lib_libzfs_core} \
1367 >                lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1368                  ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1369 <                ${_secure_lib_libssl}
1369 >                ${_secure_lib_libssl} lib/libsqlite3 \
1370 >                lib/libarchive lib/libfetch lib/libmagic \
1371 >                lib/libblocksruntime
1372 > .if ${MK_LIBTHR} != "no"
1373 > _lib_libthr=    lib/libthr
1374 > .endif
1375  
1376 < .if ${MK_LIBTHR} != "no" && ${MK_LIBKSE} != "no"
1377 < _default_thread_lib=    lib/${DEFAULT_THREAD_LIB}
1036 < .elif ${MK_LIBTHR} != "no"
1037 < _default_thread_lib=    lib/libthr
1038 < .elif ${MK_LIBKSE} != "no"
1039 < _default_thread_lib=    lib/libkse
1376 > .if ${MK_OFED} != "no"
1377 > _ofed_lib=      contrib/ofed/usr.lib/
1378   .endif
1379  
1380 < _generic_libs=  ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib
1380 > _generic_libs=  ${_apache_lib} ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1381  
1382   lib/libopie__L lib/libtacplus__L: lib/libmd__L
1383  
1384 + .if ${MK_APACHE} != "no"
1385 + _apache_lib= apache/lib
1386 + .endif
1387 +
1388   .if ${MK_CDDL} != "no"
1389 + _cddl_lib_libumem= cddl/lib/libumem
1390 + _cddl_lib_libnvpair= cddl/lib/libnvpair
1391 + _cddl_lib_libzfs_core= cddl/lib/libzfs_core
1392   _cddl_lib= cddl/lib
1393 + cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1394   .endif
1395  
1396   .if ${MK_CRYPT} != "no"
# Line 1055 | Line 1401 | lib/libradius__L secure/lib/libssl__L: secure/lib/libc
1401   .if ${MK_OPENSSH} != "no"
1402   _secure_lib_libssh= secure/lib/libssh
1403   secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1404 < .if ${MK_KERBEROS} != "no"
1404 > .if ${MK_KERBEROS_SUPPORT} != "no"
1405   secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1406 <    kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \
1407 <    kerberos5/lib/libroken__L
1406 >    kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1407 >    lib/libmd__L kerberos5/lib/libroken__L
1408   .endif
1409   .endif
1410   .endif
1411   _secure_lib=    secure/lib
1412   .endif
1413  
1414 + .if ${MK_KERBEROS} != "no"
1415 + kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1416 + kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1417 +    kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1418 +    kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
1419 + kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1420 +    kerberos5/lib/libroken__L lib/libcom_err__L
1421 + kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1422 +    secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1423 + kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1424 +    lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1425 +    kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1426 +    kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1427 + kerberos5/lib/libroken__L: lib/libcrypt__L
1428 + kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1429 + kerberos5/lib/libheimbase__L: lib/libthr__L
1430 + kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1431 + kerberos5/lib/libheimsqlite__L: lib/libthr__L
1432 + .endif
1433 +
1434 + .if ${MK_GSSAPI} != "no"
1435 + _lib_libgssapi= lib/libgssapi
1436 + .endif
1437 +
1438   .if ${MK_IPX} != "no"
1439   _lib_libipx=    lib/libipx
1440   .endif
1441  
1442   .if ${MK_KERBEROS} != "no"
1443 < _kerberos5_lib= kerberos5/lib
1443 > _kerberos5_lib= kerberos5/lib
1444   _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1445 + _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1446 + _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1447   _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1448 + _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1449   _kerberos5_lib_libroken= kerberos5/lib/libroken
1450 < _lib_libgssapi= lib/libgssapi
1450 > _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1451 > _kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1452 > _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1453 > _kerberos5_lib_libwind= kerberos5/lib/libwind
1454 > _libcom_err= lib/libcom_err
1455   .endif
1456  
1457   .if ${MK_NIS} != "no"
# Line 1086 | Line 1463 | lib/libradius__L: lib/libmd__L
1463   .endif
1464  
1465   .for _lib in ${_prereq_libs}
1466 < ${_lib}__PL: .PHONY
1466 > ${_lib}__PL: .PHONY .MAKE
1467   .if exists(${.CURDIR}/${_lib})
1468          ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1469 <                cd ${.CURDIR}/${_lib}; \
1470 <                ${MAKE} DIRPRFX=${_lib}/ obj; \
1471 <                ${MAKE} DIRPRFX=${_lib}/ depend; \
1472 <                ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1469 >                cd ${.CURDIR}/${_lib} && \
1470 >                ${MAKE} DIRPRFX=${_lib}/ obj && \
1471 >                ${MAKE} DIRPRFX=${_lib}/ depend && \
1472 >                ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all && \
1473                  ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1474   .endif
1475   .endfor
# Line 1101 | Line 1478 | ${_lib}__PL: .PHONY
1478   ${_lib}__L: .PHONY
1479   .if exists(${.CURDIR}/${_lib})
1480          ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1481 <                cd ${.CURDIR}/${_lib}; \
1482 <                ${MAKE} DIRPRFX=${_lib}/ obj; \
1483 <                ${MAKE} DIRPRFX=${_lib}/ depend; \
1484 <                ${MAKE} DIRPRFX=${_lib}/ all; \
1481 >                cd ${.CURDIR}/${_lib} && \
1482 >                ${MAKE} DIRPRFX=${_lib}/ obj && \
1483 >                ${MAKE} DIRPRFX=${_lib}/ depend && \
1484 >                ${MAKE} DIRPRFX=${_lib}/ all && \
1485                  ${MAKE} DIRPRFX=${_lib}/ install
1486   .endif
1487   .endfor
# Line 1170 | Line 1547 | delete-old-files:
1547          @echo ">>> Removing old files (only deletes safe to delete libs)"
1548   # Ask for every old file if the user really wants to remove it.
1549   # It's annoying, but better safe than sorry.
1550 <        @for file in ${OLD_FILES}; do \
1550 > # NB: We cannot pass the list of OLD_FILES as a parameter because the
1551 > # argument list will get too long. Using .for/.endfor make "loops" will make
1552 > # the Makefile parser segfault.
1553 >        @exec 3<&0; \
1554 >        ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1555 >            -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1556 >        while read file; do \
1557                  if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1558                          chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1559 <                        rm ${RM_I} "${DESTDIR}/$${file}"; \
1559 >                        rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1560                  fi; \
1561          done
1562   # Remove catpages without corresponding manpages.
1563 <        @3<&0; \
1563 >        @exec 3<&0; \
1564          find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1565          sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1566          while read catpage; do \
1567                  read manpage; \
1568                  if [ ! -e "$${manpage}" ]; then \
1569 <                        rm ${RM_I} $${catpage} <&3 ; \
1569 >                        rm ${RM_I} $${catpage} <&3; \
1570                  fi; \
1571          done
1572          @echo ">>> Old files removed"
1573  
1574   check-old-files:
1575          @echo ">>> Checking for old files"
1576 <        @for file in ${OLD_FILES}; do \
1576 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1577 >            -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1578 >        while read file; do \
1579                  if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1580                          echo "${DESTDIR}/$${file}"; \
1581                  fi; \
# Line 1201 | Line 1586 | check-old-files:
1586          while read catpage; do \
1587                  read manpage; \
1588                  if [ ! -e "$${manpage}" ]; then \
1589 <                        echo $${catpage} ; \
1589 >                        echo $${catpage}; \
1590                  fi; \
1591          done
1592  
1593   delete-old-libs:
1594          @echo ">>> Removing old libraries"
1595          @echo "${OLD_LIBS_MESSAGE}" | fmt
1596 <        @for file in ${OLD_LIBS}; do \
1596 >        @exec 3<&0; \
1597 >        ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1598 >            -V OLD_LIBS | xargs -n1 | \
1599 >        while read file; do \
1600                  if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1601                          chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1602 <                        rm ${RM_I} "${DESTDIR}/$${file}"; \
1602 >                        rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1603                  fi; \
1604          done
1605          @echo ">>> Old libraries removed"
1606  
1607   check-old-libs:
1608          @echo ">>> Checking for old libraries"
1609 <        @for file in ${OLD_LIBS}; do \
1609 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1610 >            -V OLD_LIBS | xargs -n1 | \
1611 >        while read file; do \
1612                  if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1613                          echo "${DESTDIR}/$${file}"; \
1614                  fi; \
# Line 1226 | Line 1616 | check-old-libs:
1616  
1617   delete-old-dirs:
1618          @echo ">>> Removing old directories"
1619 <        @for dir in ${OLD_DIRS}; do \
1619 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1620 >            -V OLD_DIRS | xargs -n1 | \
1621 >        while read dir; do \
1622                  if [ -d "${DESTDIR}/$${dir}" ]; then \
1623                          rmdir -v "${DESTDIR}/$${dir}" || true; \
1624                  elif [ -L "${DESTDIR}/$${dir}" ]; then \
# Line 1237 | Line 1629 | delete-old-dirs:
1629  
1630   check-old-dirs:
1631          @echo ">>> Checking for old directories"
1632 <        @for dir in ${OLD_DIRS}; do \
1632 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1633 >            -V OLD_DIRS | xargs -n1 | \
1634 >        while read dir; do \
1635                  if [ -d "${DESTDIR}/$${dir}" ]; then \
1636                          echo "${DESTDIR}/$${dir}"; \
1637                  elif [ -L "${DESTDIR}/$${dir}" ]; then \
# Line 1259 | Line 1653 | check-old: check-old-files check-old-libs check-old-di
1653   #
1654   showconfig:
1655          @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
1656 +
1657 + .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1658 + DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1659 +
1660 + .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1661 + .if exists(${KERNCONFDIR}/${KERNCONF})
1662 + FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1663 +        ${KERNCONFDIR}/${KERNCONF} ; echo
1664 + .endif
1665 + .endif
1666 +
1667 + .endif
1668 +
1669 + .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1670 + DTBOUTPUTPATH= ${.CURDIR}
1671 + .endif
1672 +
1673 + #
1674 + # Build 'standalone' Device Tree Blob
1675 + #
1676 + builddtb:
1677 +        @if [ "${FDT_DTS_FILE}" = "" ]; then \
1678 +                echo "ERROR: FDT_DTS_FILE must be specified!"; \
1679 +                exit 1; \
1680 +        fi;     \
1681 +        if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
1682 +                echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1683 +                        exist!"; \
1684 +                exit 1; \
1685 +        fi;     \
1686 +        if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then  \
1687 +                echo "WARNING: DTB will be placed in the current working \
1688 +                        directory"; \
1689 +        fi
1690 +        @PATH=${TMPPATH} \
1691 +        dtc -O dtb -o \
1692 +            ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
1693 +            -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
1694 +
1695 + ###############
1696 +
1697 + .if defined(XDEV) && defined(XDEV_ARCH)
1698 +
1699 + .if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
1700 + XDEV_CPUTYPE?=${CPUTYPE}
1701 + .else
1702 + XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1703 + .endif
1704 +
1705 + NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1706 +        -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
1707 +        -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \
1708 +        TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
1709 +        CPUTYPE=${XDEV_CPUTYPE}
1710 +
1711 + XDDIR=${XDEV_ARCH}-midnightbsd
1712 + XDTP=/usr/${XDDIR}
1713 + CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
1714 +        INSTALL="sh ${.CURDIR}/tools/install.sh"
1715 + CDENV= ${CDBENV} \
1716 +        _SHLIBDIRPREFIX=${XDTP} \
1717 +        TOOLS_PREFIX=${XDTP}
1718 + CD2ENV=${CDENV} \
1719 +        MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1720 +
1721 + CDTMP=  ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
1722 + CDMAKE=${CDENV} ${MAKE} ${NOFUN}
1723 + CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1724 + XDDESTDIR=${DESTDIR}${XDTP}
1725 + .if !defined(OSREL)
1726 + OSREL!= uname -r | sed -e 's/[-(].*//'
1727 + .endif
1728 +
1729 + .ORDER: xdev-build xdev-install
1730 + xdev: xdev-build xdev-install
1731 +
1732 + .ORDER: _xb-build-tools _xb-cross-tools
1733 + xdev-build: _xb-build-tools _xb-cross-tools
1734 +
1735 + _xb-build-tools:
1736 +        ${_+_}@cd ${.CURDIR}; \
1737 +        ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1738 +
1739 + _xb-cross-tools:
1740 + .for _tool in \
1741 +    gnu/usr.bin/binutils \
1742 +    gnu/usr.bin/cc \
1743 +    usr.bin/ar
1744 +        ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1745 +        cd ${.CURDIR}/${_tool}; \
1746 +        ${CDMAKE} DIRPRFX=${_tool}/ obj; \
1747 +        ${CDMAKE} DIRPRFX=${_tool}/ depend; \
1748 +        ${CDMAKE} DIRPRFX=${_tool}/ all
1749 + .endfor
1750 +
1751 + _xi-mtree:
1752 +        ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1753 +        mkdir -p ${XDDESTDIR}
1754 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1755 +            -p ${XDDESTDIR} >/dev/null
1756 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1757 +            -p ${XDDESTDIR}/usr >/dev/null
1758 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1759 +            -p ${XDDESTDIR}/usr/include >/dev/null
1760 +
1761 + .ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1762 + xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1763 +
1764 + _xi-cross-tools:
1765 +        @echo "_xi-cross-tools"
1766 + .for _tool in \
1767 +    gnu/usr.bin/binutils \
1768 +    gnu/usr.bin/cc \
1769 +    usr.bin/ar
1770 +        ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1771 +        cd ${.CURDIR}/${_tool}; \
1772 +        ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1773 + .endfor
1774 +
1775 + _xi-includes:
1776 +        ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1777 +                DESTDIR=${XDDESTDIR}
1778 +
1779 + _xi-libraries:
1780 +        ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1781 +                DESTDIR=${XDDESTDIR}
1782 +
1783 + _xi-links:
1784 +        ${_+_}cd ${XDDESTDIR}/usr/bin; \
1785 +                for i in *; do \
1786 +                        ln -sf ../../${XDTP}/usr/bin/$$i \
1787 +                            ../../../../usr/bin/${XDDIR}-$$i; \
1788 +                        ln -sf ../../${XDTP}/usr/bin/$$i \
1789 +                            ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
1790 +                done
1791 + .endif

Comparing trunk/Makefile.inc1 (property cvs2svn:cvs-rev):
Revision 1926 by laffer1, Tue Oct 7 01:56:49 2008 UTC vs.
Revision 9755 by laffer1, Sat Jan 20 20:39:41 2018 UTC

# Line 1 | Line 0
1 1.12

Comparing trunk/Makefile.inc1 (property svn:keywords):
Revision 1926 by laffer1, Tue Oct 7 01:56:49 2008 UTC vs.
Revision 9755 by laffer1, Sat Jan 20 20:39:41 2018 UTC

# Line 0 | Line 1
1 + MidnightBSD=%H

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines