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 1551 by laffer1, Tue Apr 29 01:36:03 2008 UTC vs.
Revision 7136 by laffer1, Fri Jul 24 22:31:33 2015 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.8 2008/04/29 00:23:55 laffer1 Exp $
2 > # $MidnightBSD$
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 + .include <bsd.compiler.mk>
46 +
47   # We must do share/info early so that installation of info `dir'
48   # entries works correctly.  Do it first since it is less likely to
49   # grow dependencies on include and lib than vice versa.
50   #
51 < # We must do lib and libexec before bin, because if installworld
51 > # We must do lib/ and libexec/ before bin/, because if installworld
52   # installs a new /bin/sh, the 'make' command will *immediately*
53   # use that new version.  And the new (dynamically-linked) /bin/sh
54   # will expect to find appropriate libraries in /lib and /libexec.
55   #
56 < # We must do etc last for install/distribute to work.
57 < #
58 < SUBDIR= share/info include lib libexec bin
59 < .if !defined(NO_GAMES)
56 > SUBDIR= share/info lib libexec
57 > SUBDIR+=bin
58 > .if ${MK_APACHE} != "no"
59 > SUBDIR+=apache
60 > .endif
61 > .if ${MK_GAMES} != "no"
62   SUBDIR+=games
63   .endif
64 < SUBDIR+=gnu
65 < .if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
64 > .if ${MK_CDDL} != "no"
65 > SUBDIR+=cddl
66 > .else
67 > NO_CTF=1
68 > .endif
69 > SUBDIR+=gnu include
70 > .if ${MK_KERBEROS} != "no"
71   SUBDIR+=kerberos5
72   .endif
73 < .if !defined(NO_RESCUE)
73 > .if ${MK_RESCUE} != "no"
74   SUBDIR+=rescue
75   .endif
76   SUBDIR+=sbin
77 < .if !defined(NO_CRYPT)
77 > .if ${MK_CRYPT} != "no"
78   SUBDIR+=secure
79   .endif
80   .if !defined(NO_SHARE)
81   SUBDIR+=share
82   .endif
83 < SUBDIR+=sys usr.bin usr.sbin etc
83 > SUBDIR+=sys usr.bin usr.sbin
84 > .if ${MK_OFED} != "no"
85 > SUBDIR+=contrib/ofed
86 > .endif
87 > #
88 > # We must do etc/ last for install/distribute to work.
89 > #
90 > SUBDIR+=etc
91  
92   # These are last, since it is nice to at least get the base system
93   # rebuilt before you do them.
# Line 89 | Line 112 | CLEANDIR=      cleandir
112  
113   CVS?=           cvs
114   CVSFLAGS?=      -r . -P -d -I!
115 < SUP?=           /usr/bin/csup
116 < SUPFLAGS?=      -g -L 2
115 > SUP?=           /usr/local/bin/cvsup
116 > SUPFLAGS?=      -g -L 2
117   .if defined(SUPHOST)
118   SUPFLAGS+=      -h ${SUPHOST}
119   .endif
# Line 98 | Line 121 | SUPFLAGS+=     -h ${SUPHOST}
121   MAKEOBJDIRPREFIX?=      /usr/obj
122   .if !defined(OSRELDATE)
123   .if exists(/usr/include/osreldate.h)
124 < OSRELDATE!=     awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
124 > OSRELDATE!=     awk '/^\#define[[:space:]]*__MidnightBSD_version/ { print $$3 }' \
125                  /usr/include/osreldate.h
126   .else
127   OSRELDATE=      0
128   .endif
129   .endif
130 < TARGET_ARCH?=   ${MACHINE_ARCH}
131 < .if ${TARGET_ARCH} == ${MACHINE_ARCH}
132 < TARGET?=        ${MACHINE}
130 >
131 > .if !defined(VERSION)
132 > VERSION!=       uname -srp
133 > VERSION+=       ${OSRELDATE}
134 > .endif
135 >
136 >
137 > KNOWN_ARCHES?=  amd64 i386
138 > .if ${TARGET} == ${TARGET_ARCH}
139 > _t=             ${TARGET}
140 > .else
141 > _t=             ${TARGET_ARCH}/${TARGET}
142 > .endif
143 > .for _t in ${_t}
144 > .if empty(KNOWN_ARCHES:M${_t})
145 > .error Unknown target ${TARGET_ARCH}:${TARGET}.
146 > .endif
147 > .endfor
148 >
149 > .if ${TARGET} == ${MACHINE}
150   TARGET_CPUTYPE?=${CPUTYPE}
151   .else
112 TARGET?=        ${TARGET_ARCH}
152   TARGET_CPUTYPE?=
153   .endif
154 +
155   .if !empty(TARGET_CPUTYPE)
156   _TARGET_CPUTYPE=${TARGET_CPUTYPE}
157   .else
# Line 123 | Line 163 | _CPUTYPE!=     MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAK
163   .error CPUTYPE global should be set with ?=.
164   .endif
165   .if make(buildworld)
166 < BUILD_ARCH!=    sysctl -n hw.machine_arch
166 > BUILD_ARCH!=    uname -p
167   .if ${MACHINE_ARCH} != ${BUILD_ARCH}
168   .error To cross-build, set TARGET_ARCH.
169   .endif
170   .endif
171 < .if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING)
171 > .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
172   OBJTREE=        ${MAKEOBJDIRPREFIX}
173   .else
174 < OBJTREE=        ${MAKEOBJDIRPREFIX}/${TARGET}
174 > OBJTREE=        ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
175   .endif
176   WORLDTMP=       ${OBJTREE}${.CURDIR}/tmp
177   # /usr/games added for fortune which depend on strfile
# Line 140 | Line 180 | XPATH=         ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WOR
180   STRICTTMPPATH=  ${BPATH}:${XPATH}
181   TMPPATH=        ${STRICTTMPPATH}:${PATH}
182  
183 + #
184 + # Avoid running mktemp(1) unless actually needed.
185 + # It may not be functional, e.g., due to new ABI
186 + # when in the middle of installing over this system.
187 + #
188 + .if make(distributeworld) || make(installworld)
189   INSTALLTMP!=    /usr/bin/mktemp -d -u -t install
190 + .endif
191  
192   #
193   # Building a world goes through the following stages
# Line 173 | Line 220 | BOOTSTRAPPING?=        0
220   CROSSENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
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                  PATH=${BPATH}:${PATH} \
236                  WORLDTMP=${WORLDTMP} \
237 <                MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
237 >                VERSION="${VERSION}" \
238 >                MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
239 >                COMPILER_TYPE=${COMPILER_TYPE}
240   BMAKE=          MAKEOBJDIRPREFIX=${WORLDTMP} \
241                  ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
242                  DESTDIR= \
243                  BOOTSTRAPPING=${OSRELDATE} \
244 <                -DNO_HTML -DNO_INFO -DNO_LINT -DNO_MAN -DNO_NLS -DNO_PIC \
245 <                -DNO_PROFILE -DNO_SHARED -DNO_CPU_CFLAGS -DNO_WARNS
244 >                SSP_CFLAGS= \
245 >                -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
246 >                -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
247 >                -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
248  
249   # build-tools stage
250   TMAKE=          MAKEOBJDIRPREFIX=${OBJTREE} \
251                  ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
252 +                TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
253                  DESTDIR= \
254 <                BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS
254 >                BOOTSTRAPPING=${OSRELDATE} \
255 >                SSP_CFLAGS= \
256 >                -DNO_LINT \
257 >                -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
258  
259   # cross-tools stage
260 < XMAKE=          TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
260 > XMAKE=          TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
261 >                TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
262 >                -DWITHOUT_GDB
263  
264   # world stage
265   WMAKEENV=       ${CROSSENV} \
266                  _SHLIBDIRPREFIX=${WORLDTMP} \
267 +                _LDSCRIPTROOT= \
268 +                VERSION="${VERSION}" \
269                  INSTALL="sh ${.CURDIR}/tools/install.sh" \
270                  PATH=${TMPPATH}
271 + .if ${MK_CDDL} == "no"
272 + WMAKEENV+=      NO_CTF=1
273 + .endif
274 + .if ${CC:T:Mgcc} == "gcc"
275 + WMAKE_COMPILER_TYPE=    gcc
276 + .elif ${CC:T:Mclang} == "clang"
277 + WMAKE_COMPILER_TYPE=    clang
278 + .elif ${MK_CLANG_IS_CC} == "no"
279 + WMAKE_COMPILER_TYPE=    gcc
280 + .else
281 + WMAKE_COMPILER_TYPE=    clang
282 + .endif
283 + WMAKEENV+=      COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
284   WMAKE=          ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
285  
286   .if ${TARGET_ARCH} == "amd64"
287   # 32 bit world
288   LIB32TMP=       ${OBJTREE}${.CURDIR}/lib32
289  
290 < LIB32PREFLAGS=  -m32 -march=athlon-xp -msse2 -mfancy-math-387 -DCOMPAT_32BIT
291 < LIB32POSTFLAGS= -I${LIB32TMP}/usr/include \
290 > .if ${TARGET_ARCH} == "amd64"
291 > .if empty(TARGET_CPUTYPE)
292 > LIB32CPUFLAGS=  -march=i686 -mmmx -msse -msse2
293 > .else
294 > LIB32CPUFLAGS=  -march=${TARGET_CPUTYPE}
295 > .endif
296 > LIB32WMAKEENV=  MACHINE=i386 MACHINE_ARCH=i386 \
297 >                MACHINE_CPU="i686 mmx sse sse2" \
298 >                LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
299 >                AS="${AS} --32"
300 > .endif
301 >
302 >
303 > LIB32FLAGS=     -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
304 >                -isystem ${LIB32TMP}/usr/include/ \
305                  -L${LIB32TMP}/usr/lib32 \
306                  -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}
307  
308   # Yes, the flags are redundant.
309 < LIB32MAKEENV=   MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
309 > LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
310                  _SHLIBDIRPREFIX=${LIB32TMP} \
311 <                MACHINE=i386 \
312 <                MACHINE_ARCH=i386 \
311 >                _LDSCRIPTROOT=${LIB32TMP} \
312 >                VERSION="${VERSION}" \
313                  INSTALL="sh ${.CURDIR}/tools/install.sh" \
314                  PATH=${TMPPATH} \
315 <                CC="${CC} ${LIB32CC}" \
316 <                CXX="${CXX} ${LIB32CXX}" \
233 <                OBJC="${OBJC} ${LIB32OBJC}" \
234 <                LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
235 <                AS="${AS} --32" \
315 >                CC="${CC} ${LIB32FLAGS}" \
316 >                CXX="${CXX} ${LIB32FLAGS}" \
317                  LIBDIR=/usr/lib32 \
318 <                SHLIBDIR=/usr/lib32
318 >                SHLIBDIR=/usr/lib32 \
319 >                COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
320  
321 < LIB32MAKE=      ${LIB32MAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
322 <                -DNO_BIND -DNO_MAN -DNO_NLS -DNO_INFO -DNO_HTML
323 < LIB32IMAKE=     ${LIB32MAKE:NINSTALL=*} -DNO_INCS
321 > LIB32WMAKE=     ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
322 >                -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
323 >                -DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \
324 >                DESTDIR=${LIB32TMP}
325 > LIB32IMAKE=     ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS
326   .endif
327  
328   # install stage
329 + IMAKEENV=       ${CROSSENV:N_LDSCRIPTROOT=*}
330 + IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
331   .if empty(.MAKEFLAGS:M-n)
332 < IMAKEENV=       ${CROSSENV} \
333 <                PATH=${STRICTTMPPATH}:${INSTALLTMP}
332 > IMAKEENV+=      PATH=${STRICTTMPPATH}:${INSTALLTMP} \
333 >                LD_LIBRARY_PATH=${INSTALLTMP} \
334 >                PATH_LOCALE=${INSTALLTMP}/locale
335 > IMAKE+=         __MAKE_SHELL=${INSTALLTMP}/sh
336   .else
337 < IMAKEENV=       ${CROSSENV} \
250 <                PATH=${TMPPATH}:${INSTALLTMP}
337 > IMAKEENV+=      PATH=${TMPPATH}:${INSTALLTMP}
338   .endif
252 IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
339  
340   # kernel stage
341   KMAKEENV=       ${WMAKEENV}
342 + KMAKE=          ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
343  
344   #
345   # buildworld
# Line 275 | Line 362 | _worldtmp:
362          @echo "--------------------------------------------------------------"
363   .if !defined(NO_CLEAN)
364          rm -rf ${WORLDTMP}
365 < .if ${TARGET_ARCH} == "amd64"
365 > .if defined(LIB32TMP)
366          rm -rf ${LIB32TMP}
367   .endif
368   .else
369          rm -rf ${WORLDTMP}/legacy/usr/include
370 <        # XXX - These two can depend on any header file.
370 > #       XXX - These three can depend on any header file.
371          rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
372 +        rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
373          rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
374   .endif
375   .for _dir in \
376 <    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
376 >    lib usr legacy/usr
377          mkdir -p ${WORLDTMP}/${_dir}
378   .endfor
379 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
380 +            -p ${WORLDTMP}/legacy/usr >/dev/null
381 + .if ${MK_GROFF} != "no"
382 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
383 +            -p ${WORLDTMP}/legacy/usr >/dev/null
384 + .endif
385 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
386 +            -p ${WORLDTMP}/usr >/dev/null
387          mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
388              -p ${WORLDTMP}/usr/include >/dev/null
389          ln -sf ${.CURDIR}/sys ${WORLDTMP}
390 < .if defined(WITH_BIND_LIBS) && !defined(NO_BIND)
390 > .if ${MK_BIND_LIBS} != "no"
391          mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
392              -p ${WORLDTMP}/usr/include >/dev/null
393   .endif
# Line 335 | Line 410 | _cleanobj:
410          @echo ">>> stage 2.1: cleaning up the object tree"
411          @echo "--------------------------------------------------------------"
412          ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
413 < .if ${TARGET_ARCH} == "amd64"
414 <        rm -rf ${OBJTREE}/lib32
413 > .if defined(LIB32TMP)
414 >        ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
415   .endif
416   .endif
417   _obj:
# Line 369 | Line 444 | _libraries:
444          @echo ">>> stage 4.2: building libraries"
445          @echo "--------------------------------------------------------------"
446          ${_+_}cd ${.CURDIR}; \
447 <            ${WMAKE} -DNO_FSCHG -DNO_HTML -DNO_INFO -DNO_LINT -DNO_MAN \
448 <            -DNO_NLS -DNO_PROFILE libraries
447 >            ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
448 >            -DWITHOUT_MAN -DWITHOUT_PROFILE libraries
449   _depend:
450          @echo
451          @echo "--------------------------------------------------------------"
# Line 383 | Line 458 | everything:
458          @echo ">>> stage 4.4: building everything"
459          @echo "--------------------------------------------------------------"
460          ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
461 < .if ${TARGET_ARCH} == "amd64"
461 > .if defined(LIB32TMP)
462   build32:
463          @echo
464          @echo "--------------------------------------------------------------"
465          @echo ">>> stage 5.1: building 32 bit shim libraries"
466          @echo "--------------------------------------------------------------"
467 < .for _dir in \
468 <    lib32 usr/include usr/lib32 \
469 <    usr/share/misc
395 <        mkdir -p ${LIB32TMP}/${_dir}
396 < .endfor
467 >        mkdir -p ${LIB32TMP}/usr/include
468 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
469 >            -p ${LIB32TMP}/usr >/dev/null
470          mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
471              -p ${LIB32TMP}/usr/include >/dev/null
472          mkdir -p ${WORLDTMP}
473          ln -sf ${.CURDIR}/sys ${WORLDTMP}
474 < .if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
474 > .if ${MK_KERBEROS} != "no"
475   .for _t in obj depend all
476          cd ${.CURDIR}/kerberos5/tools; \
477 <            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= ${_t}
477 >            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
478 >            DIRPRFX=kerberos5/tools/ ${_t}
479   .endfor
480   .endif
481   .for _t in obj includes
482 <        cd ${.CURDIR}/include; \
483 <            ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
484 <        cd ${.CURDIR}/lib; \
485 <            ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
412 <        cd ${.CURDIR}/gnu/lib; \
413 <            ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
414 < .if !defined(NO_CRYPT)
415 <        cd ${.CURDIR}/secure/lib; \
416 <            ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
482 >        cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
483 >        cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
484 > .if ${MK_APACHE} != "no"
485 >        cd ${.CURDIR}/apache/lib; ${LIB32WMAKE} ${_t}
486   .endif
487 < .if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
488 <        cd ${.CURDIR}/kerberos5/lib; \
420 <            ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
487 > .if ${MK_CDDL} != "no"
488 >        cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
489   .endif
490 +        cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
491 + .if ${MK_CRYPT} != "no"
492 +        cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
493 + .endif
494 + .if ${MK_KERBEROS} != "no"
495 +        cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
496 + .endif
497   .endfor
498   .for _dir in usr.bin/lex/lib
499 <        cd ${.CURDIR}/${_dir}; \
425 <            ${LIB32MAKE} DESTDIR=${LIB32TMP} obj
499 >        cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
500   .endfor
501 < .for _dir in lib/libncurses lib/libmagic
501 > .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
502          cd ${.CURDIR}/${_dir}; \
503 <            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= build-tools
503 >            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
504 >            DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
505 >            -DEARLY_BUILD build-tools
506   .endfor
507          cd ${.CURDIR}; \
508 <            ${LIB32MAKE} -f Makefile.inc1 DESTDIR=${LIB32TMP} libraries
508 >            ${LIB32WMAKE} -f Makefile.inc1 libraries
509   .for _t in obj depend all
510 <        cd ${.CURDIR}/libexec/rtld-elf; \
511 <            PROG=ld-elf32.so.1 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
510 >        cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
511 >            DIRPRFX=libexec/rtld-elf/ ${_t}
512 >        cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
513 >            DIRPRFX=usr.bin/ldd ${_t}
514   .endfor
515  
516   distribute32 install32:
439 .if make(distribute32)
440        mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32   # XXX add to mtree
441 .else
442        mkdir -p ${DESTDIR}/usr/lib32                   # XXX add to mtree
443 .endif
517          cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
518 + .if ${MK_CDDL} != "no"
519 +        cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
520 + .endif
521          cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
522 < .if !defined(NO_CRYPT)
522 > .if ${MK_CRYPT} != "no"
523          cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
524   .endif
525 <        cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
525 > .if ${MK_KERBEROS} != "no"
526 >        cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
527   .endif
528 +        cd ${.CURDIR}/libexec/rtld-elf; \
529 +            PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
530 +        cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
531 + .endif
532  
452
533   WMAKE_TGTS=
534   .if !defined(SUBDIR_OVERRIDE)
535   WMAKE_TGTS+=    _worldtmp _legacy _bootstrap-tools
# Line 459 | Line 539 | WMAKE_TGTS+=   _cleanobj _obj _build-tools
539   WMAKE_TGTS+=    _cross-tools
540   .endif
541   WMAKE_TGTS+=    _includes _libraries _depend everything
542 < .if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32)
542 > .if defined(LIB32TMP) && ${MK_LIB32} != "no"
543   WMAKE_TGTS+=    build32
544   .endif
545  
546 < buildworld: ${WMAKE_TGTS}
547 < .ORDER: ${WMAKE_TGTS}
546 > buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
547 > .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
548  
549 + buildworld_prologue:
550 +        @echo "--------------------------------------------------------------"
551 +        @echo ">>> World build started on `LC_ALL=C date`"
552 +        @echo "--------------------------------------------------------------"
553 +
554 + buildworld_epilogue:
555 +        @echo
556 +        @echo "--------------------------------------------------------------"
557 +        @echo ">>> World build completed on `LC_ALL=C date`"
558 +        @echo "--------------------------------------------------------------"
559 +
560 + #
561 + # We need to have this as a target because the indirection between Makefile
562 + # and Makefile.inc1 causes the correct PATH to be used, rather than a
563 + # modification of the current environment's PATH.  In addition, we need
564 + # to quote multiword values.
565 + #
566 + buildenvvars:
567 +        @echo ${WMAKEENV:Q}
568 +
569   buildenv:
570          @echo Entering world for ${TARGET_ARCH}:${TARGET}
571          @cd ${.CURDIR} && env ${WMAKEENV} sh || true
# Line 475 | Line 575 | toolchain: ${TOOLCHAIN_TGTS}
575   kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
576  
577   #
578 < # Use this to add checks to installworld/installkernel targets.
578 > # installcheck
579   #
580 < SPECIAL_INSTALLCHECKS=
580 > # Checks to be sure system is ready for installworld/installkernel.
581 > #
582 > installcheck:
583  
584   #
585   # Require DESTDIR to be set if installing for a different architecture.
586   #
587   .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
588   .if !make(distributeworld)
589 < SPECIAL_INSTALLCHECKS+= installcheck_DESTDIR
589 > installcheck: installcheck_DESTDIR
590   installcheck_DESTDIR:
591   .if !defined(DESTDIR) || empty(DESTDIR)
592          @echo "ERROR: Please set DESTDIR!"; \
# Line 494 | Line 596 | installcheck_DESTDIR:
596   .endif
597  
598   #
599 < # installcheck
599 > # Check for missing UIDs/GIDs.
600   #
499 # Checks to be sure system is ready for installworld
500 #
601   CHECK_UIDS=
602   CHECK_GIDS=     audit
603 < .if !defined(NO_SENDMAIL)
603 > .if ${MK_SENDMAIL} != "no"
604   CHECK_UIDS+=    smmsp
605   CHECK_GIDS+=    smmsp
606   .endif
607 < .if !defined(NO_PF)
607 > .if ${MK_PF} != "no"
608   CHECK_UIDS+=    proxy
609   CHECK_GIDS+=    proxy authpf
610   .endif
611 < installcheck: ${SPECIAL_INSTALLCHECKS}
611 > installcheck: installcheck_UGID
612 > installcheck_UGID:
613   .for uid in ${CHECK_UIDS}
614          @if ! `id -u ${uid} >/dev/null 2>&1`; then \
615                  echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
# Line 523 | Line 624 | installcheck: ${SPECIAL_INSTALLCHECKS}
624   .endfor
625  
626   #
627 + # Required install tools to be saved in a scratch dir for safety.
628 + #
629 + .if ${MK_INFO} != "no"
630 + _install-info=  install-info
631 + .endif
632 + .if ${MK_ZONEINFO} != "no"
633 + _zoneinfo=      zic tzsetup
634 + .endif
635 +
636 + ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
637 +        date echo egrep find grep ${_install-info} \
638 +        ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
639 +        test true uname wc ${_zoneinfo}
640 +
641 + #
642   # distributeworld
643   #
644   # Distributes everything compiled by a `buildworld'.
# Line 531 | Line 647 | installcheck: ${SPECIAL_INSTALLCHECKS}
647   #
648   # Installs everything compiled by a 'buildworld'.
649   #
650 +
651 + # Non-base distributions produced by the base system
652 + EXTRA_DISTRIBUTIONS=    doc games
653 + .if defined(LIB32TMP) && ${MK_LIB32} != "no"
654 + EXTRA_DISTRIBUTIONS+=   lib32
655 + .endif
656 +
657   distributeworld installworld: installcheck
658          mkdir -p ${INSTALLTMP}
659 <        for prog in [ awk cap_mkdb cat chflags chmod chown \
660 <            date echo egrep find grep install-info \
661 <            ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
662 <            test true uname wc zic; do \
663 <                cp `which $$prog` ${INSTALLTMP}; \
664 <        done
665 <        ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
666 <        rm -rf ${INSTALLTMP}
659 >        progs=$$(for prog in ${ITOOLS}; do \
660 >                if progpath=`which $$prog`; then \
661 >                        echo $$progpath; \
662 >                else \
663 >                        echo "Required tool $$prog not found in PATH." >&2; \
664 >                        exit 1; \
665 >                fi; \
666 >            done); \
667 >        libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
668 >            while read line; do \
669 >                set -- $$line; \
670 >                if [ "$$2 $$3" != "not found" ]; then \
671 >                        echo $$2; \
672 >                else \
673 >                        echo "Required library $$1 not found." >&2; \
674 >                        exit 1; \
675 >                fi; \
676 >            done); \
677 >        cp $$libs $$progs ${INSTALLTMP}
678 >        cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
679 > .if make(distributeworld)
680 > .for dist in ${EXTRA_DISTRIBUTIONS}
681 >        -mkdir ${DESTDIR}/${DISTDIR}/${dist}
682 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
683 >            -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
684 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
685 >            -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
686 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
687 >            -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
688 > .endfor
689 >        -mkdir ${DESTDIR}/${DISTDIR}/base
690 >        ${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \
691 >            DESTDIR=${DESTDIR}/${DISTDIR}/base
692 > .endif
693 >        ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
694 >            ${IMAKEENV} rm -rf ${INSTALLTMP}
695 > .if make(distributeworld)
696 > .for dist in ${EXTRA_DISTRIBUTIONS}
697 >        find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
698 > .endfor
699 > .endif
700  
701 + packageworld:
702 + .for dist in base ${EXTRA_DISTRIBUTIONS}
703 +        ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
704 +            tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz .
705 + .endfor
706 +
707   #
708   # reinstall
709   #
# Line 549 | Line 711 | distributeworld installworld: installcheck
711   # and do a 'make reinstall' on the *client* to install new binaries from the
712   # most recent server build.
713   #
714 < reinstall: ${SPECIAL_INSTALLCHECKS}
714 > reinstall:
715          @echo "--------------------------------------------------------------"
716          @echo ">>> Making hierarchy"
717          @echo "--------------------------------------------------------------"
# Line 559 | Line 721 | reinstall: ${SPECIAL_INSTALLCHECKS}
721          @echo ">>> Installing everything"
722          @echo "--------------------------------------------------------------"
723          ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
724 < .if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32)
724 > .if defined(LIB32TMP) && ${MK_LIB32} != "no"
725          ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
726   .endif
727  
# Line 568 | Line 730 | redistribute:
730          @echo ">>> Distributing everything"
731          @echo "--------------------------------------------------------------"
732          ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
733 < .if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32)
734 <        ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 DISTRIBUTION=lib32
733 > .if defined(LIB32TMP) && ${MK_LIB32} != "no"
734 >        ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
735 >            DISTRIBUTION=lib32
736   .endif
737  
738   distrib-dirs distribution:
# Line 589 | Line 752 | distrib-dirs distribution:
752   # be set to cross-build, we have to make sure TARGET is set
753   # properly.
754  
755 + .if defined(KERNFAST)
756 + NO_KERNELCLEAN= t
757 + NO_KERNELCONFIG=        t
758 + NO_KERNELDEPEND=        t
759 + NO_KERNELOBJ=           t
760 + # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
761 + .if !defined(KERNCONF) && ${KERNFAST} != "1"
762 + KERNCONF=${KERNFAST}
763 + .endif
764 + .endif
765   .if !defined(KERNCONF) && defined(KERNEL)
766   KERNCONF=       ${KERNEL}
767   KERNWARN=
# Line 651 | Line 824 | buildkernel:
824          @echo "--------------------------------------------------------------"
825          @echo ">>> stage 2.1: cleaning up the object tree"
826          @echo "--------------------------------------------------------------"
827 <        cd ${KRNLOBJDIR}/${_kernel}; \
655 <            ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
827 >        cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
828   .endif
829 + .if !defined(NO_KERNELOBJ)
830          @echo
831          @echo "--------------------------------------------------------------"
832          @echo ">>> stage 2.2: rebuilding the object tree"
833          @echo "--------------------------------------------------------------"
834 <        cd ${KRNLOBJDIR}/${_kernel}; \
835 <            ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
834 >        cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
835 > .endif
836          @echo
837          @echo "--------------------------------------------------------------"
838          @echo ">>> stage 2.3: build tools"
839          @echo "--------------------------------------------------------------"
840          cd ${KRNLOBJDIR}/${_kernel}; \
841 +            PATH=${BPATH}:${PATH} \
842              MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
843 <            ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
843 >            ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \
844 >            -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
845   # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
846   .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
847   .for target in obj depend all
848          cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
849 +            PATH=${BPATH}:${PATH} \
850              MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
851 <            ${MAKE} -DNO_CPU_CFLAGS ${target}
851 >            ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target}
852   .endfor
853   .endif
854   .if !defined(NO_KERNELDEPEND)
# Line 680 | Line 856 | buildkernel:
856          @echo "--------------------------------------------------------------"
857          @echo ">>> stage 3.1: making dependencies"
858          @echo "--------------------------------------------------------------"
859 <        cd ${KRNLOBJDIR}/${_kernel}; \
684 <            ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
859 >        cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
860   .endif
861          @echo
862          @echo "--------------------------------------------------------------"
863          @echo ">>> stage 3.2: building everything"
864          @echo "--------------------------------------------------------------"
865 <        cd ${KRNLOBJDIR}/${_kernel}; \
691 <            ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
865 >        cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
866          @echo "--------------------------------------------------------------"
867          @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
868          @echo "--------------------------------------------------------------"
# Line 700 | Line 874 | buildkernel:
874   # Install the kernel defined by INSTALLKERNEL
875   #
876   installkernel installkernel.debug \
877 < reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS}
877 > reinstallkernel reinstallkernel.debug: installcheck
878   .if empty(INSTALLKERNEL)
879          @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
880          false
881   .endif
882          @echo "--------------------------------------------------------------"
883 <        @echo ">>> Installing kernel"
883 >        @echo ">>> Installing kernel ${INSTALLKERNEL}"
884          @echo "--------------------------------------------------------------"
885          cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
886              ${CROSSENV} PATH=${TMPPATH} \
887              ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
888  
889 + distributekernel distributekernel.debug:
890 + .if empty(INSTALLKERNEL)
891 +        @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
892 +        false
893 + .endif
894 +        cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
895 +            ${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
896 +            DESTDIR=${DESTDIR}/${DISTDIR}/kernel \
897 +            ${.TARGET:S/distributekernel/install/}
898 + .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
899 +        cd ${KRNLOBJDIR}/${_kernel}; \
900 +            ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
901 +            KERNEL=${INSTKERNNAME}.${_kernel} \
902 +            DESTDIR=${DESTDIR}/${DISTDIR}/kernel.${_kernel} \
903 +            ${.TARGET:S/distributekernel/install/}
904 + .endfor
905 +
906 + packagekernel:
907 +        cd ${DESTDIR}/${DISTDIR}/kernel; \
908 +            tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
909 + .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
910 +        cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
911 +            tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
912 + .endfor
913 +
914   #
915 + # doxygen
916 + #
917 + # Build the API documentation with doxygen
918 + #
919 + doxygen:
920 +        @if [ ! -x `/usr/bin/which doxygen` ]; then \
921 +                echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
922 +                exit 1; \
923 +        fi
924 +        cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
925 +
926 + #
927   # update
928   #
929 < # Update the source tree, by running cvsup and/or running cvs to update to the
929 > # Update the source tree(s), by running cvsup/cvs/svn to update to the
930   # latest copy.
931   #
932   update:
# Line 740 | Line 951 | update:
951   .endif
952   .endif
953   .if defined(CVS_UPDATE)
954 <        @echo "--------------------------------------------------------------"
955 <        @echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT}
956 <        @echo "--------------------------------------------------------------"
957 <        cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS}
954 >        @cd ${.CURDIR} ; \
955 >        if [ -d CVS ] ; then \
956 >                echo "--------------------------------------------------------------" ; \
957 >                echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
958 >                echo "--------------------------------------------------------------" ; \
959 >                echo ${CVS} -R -q update ${CVSFLAGS} ; \
960 >                ${CVS} -R -q update ${CVSFLAGS} ; \
961 >        fi
962   .endif
963 + .if defined(SVN_UPDATE)
964 +        @cd ${.CURDIR} ; \
965 +        if [ -d .svn ] ; then \
966 +                echo "--------------------------------------------------------------" ; \
967 +                echo ">>> Updating ${.CURDIR} using Subversion" ; \
968 +                echo "--------------------------------------------------------------" ; \
969 +                echo ${SVN} update ${SVNFLAGS} ; \
970 +                ${SVN} update ${SVNFLAGS} ; \
971 +        fi
972 + .endif
973  
974   #
975   # ------------------------------------------------------------------------
# Line 761 | Line 986 | update:
986   # legacy: Build compatibility shims for the next three targets
987   #
988   legacy:
989 < .if ${BOOTSTRAPPING} < 503000
990 <        @echo "ERROR: Source upgrades from versions prior to 5.3 not supported."; \
989 > .if ${BOOTSTRAPPING} < 4000 && ${BOOTSTRAPPING} != 0
990 >        @echo "ERROR: Source upgrades from versions prior to 0.4 not supported."; \
991          false
992   .endif
993   .for _tool in tools/build
994          ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
995 <            cd ${.CURDIR}/${_tool}; \
996 <            ${MAKE} DIRPRFX=${_tool}/ obj; \
997 <            ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
998 <            ${MAKE} DIRPRFX=${_tool}/ depend; \
999 <            ${MAKE} DIRPRFX=${_tool}/ all; \
995 >            cd ${.CURDIR}/${_tool} && \
996 >            ${MAKE} DIRPRFX=${_tool}/ obj && \
997 >            ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
998 >            ${MAKE} DIRPRFX=${_tool}/ depend && \
999 >            ${MAKE} DIRPRFX=${_tool}/ all && \
1000              ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1001   .endfor
1002  
1003   #
1004   # bootstrap-tools: Build tools needed for compatibility
1005   #
1006 < .if !defined(NO_GAMES)
1006 > .if ${MK_GAMES} != "no"
1007   _strfile=       games/fortune/strfile
1008   .endif
1009  
1010 < .if !defined(NO_CXX)
1010 > .if ${MK_CXX} != "no"
1011   _gperf=         gnu/usr.bin/gperf
1012 < .if ${BOOTSTRAPPING} < 600101
1012 > .endif
1013 >
1014 > .if ${MK_GROFF} != "no"
1015   _groff=         gnu/usr.bin/groff
789 .else
790 _groff=         gnu/usr.bin/groff/tmac
1016   .endif
1017 +
1018 + .if ${BOOTSTRAPPING} >= 4000 && ${BOOTSTRAPPING} < 4015
1019 + _ar=            usr.bin/ar
1020   .endif
1021  
1022 < .if ${BOOTSTRAPPING} < 600029
1023 < _texinfo=       gnu/usr.bin/texinfo
1022 > .if ${BOOTSTRAPPING} < 4015
1023 > _mklocale=      usr.bin/mklocale
1024   .endif
1025  
1026 < .if ${BOOTSTRAPPING} < 600015
1027 < _cap_mkdb=      usr.bin/cap_mkdb
1026 > .if ${BOOTSTRAPPING} < 4015
1027 > _sed=           usr.bin/sed
1028   .endif
1029  
1030 < .if ${BOOTSTRAPPING} < 600018
1031 < _colldef=       usr.bin/colldef
1030 > .if ${BOOTSTRAPPING} < 7002
1031 > _m4=            usr.bin/m4
1032   .endif
1033  
1034 < .if ${BOOTSTRAPPING} < 600017
1035 < _gencat=        usr.bin/gencat
1034 > .if ${BOOTSTRAPPING} < 7002
1035 > _lex=           usr.bin/lex
1036   .endif
1037  
1038 < .if ${BOOTSTRAPPING} < 600016
1039 < _mklocale=      usr.bin/mklocale
1038 > .if ${BOOTSTRAPPING} < 7002
1039 > _yacc=          lib/liby \
1040 >                usr.bin/yacc
1041   .endif
1042  
1043 < .if ${BOOTSTRAPPING} < 600106
1043 > .if ${MK_BSNMP} != "no" && \
1044 >    (${BOOTSTRAPPING} < 4015 || !exists(/usr/sbin/gensnmptree))
1045   _gensnmptree=   usr.sbin/bsnmpd/gensnmptree
1046   .endif
1047  
1048 < .if !defined(NO_RESCUE) && \
1049 <    ${BOOTSTRAPPING} < 600008
1048 > .if ${MK_RESCUE} != "no" && \
1049 >    ${BOOTSTRAPPING} < 4015
1050   _crunchgen=     usr.sbin/crunch/crunchgen
1051   .endif
1052  
1053 < .if ${BOOTSTRAPPING} < 600020
1054 < _pwd_mkdb=      usr.sbin/pwd_mkdb
1053 > .if ${MK_CLANG} != "no"
1054 > _clang_tblgen= \
1055 >        lib/clang/libllvmsupport \
1056 >        lib/clang/libllvmtablegen \
1057 >        usr.bin/clang/tblgen \
1058 >        usr.bin/clang/clang-tblgen
1059   .endif
1060  
1061 + .if ${MK_CDDL} != "no" && \
1062 +    ${BOOTSTRAPPING} < 4015 && \
1063 +    !(${BOOTSTRAPPING} >= 4000 && ${BOOTSTRAPPING} < 4015)
1064 + _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1065 +    lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1066 + .endif
1067 +
1068 + .if ${MK_FDT} != "no"
1069 + _dtc= gnu/usr.bin/dtc
1070 + .endif
1071 +
1072 + #       Please document (add comment) why something is in 'bootstrap-tools'.
1073 + #       Try to bound the building of the bootstrap-tool to just the
1074 + #       MidnightBSD versions that need the tool built at this stage of the build.
1075   bootstrap-tools:
1076   .for _tool in \
1077 +    ${_clang_tblgen} \
1078 +    ${_dtrace_tools} \
1079      ${_strfile} \
1080      ${_gperf} \
1081      ${_groff} \
1082 <    ${_texinfo} \
1083 <    ${_cap_mkdb} \
1084 <    ${_colldef} \
835 <    ${_gencat} \
1082 >    ${_ar} \
1083 >    ${_dtc} \
1084 >    ${_awk} \
1085      usr.bin/lorder \
1086      usr.bin/makewhatis \
1087      ${_mklocale} \
1088      usr.bin/rpcgen \
1089 <    ${_gensnmptree} \
1089 >    ${_sed} \
1090 >    ${_yacc} \
1091 >    ${_lex} \
1092      usr.bin/xinstall \
1093 +    ${_gensnmptree} \
1094      usr.sbin/config \
1095 <    ${_crunchgen} \
844 <    ${_pwd_mkdb}
1095 >    ${_crunchgen}
1096          ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1097                  cd ${.CURDIR}/${_tool}; \
1098                  ${MAKE} DIRPRFX=${_tool}/ obj; \
# Line 861 | Line 1112 | _aicasm= sys/modules/aic7xxx/aicasm
1112   _share= share/syscons/scrnmaps
1113   .endif
1114  
1115 < .if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
1115 > .if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no"
1116 > _gcc_tools= gnu/usr.bin/cc/cc_tools
1117 > .endif
1118 >
1119 > .if ${MK_KERBEROS} != "no"
1120   _kerberos5_tools= kerberos5/tools
1121   .endif
1122  
1123 < .if !defined(NO_RESCUE)
1123 > .if ${MK_RESCUE} != "no"
1124   _rescue= rescue/rescue
1125   .endif
1126  
# Line 874 | Line 1129 | build-tools:
1129      bin/csh \
1130      bin/sh \
1131      ${_rescue} \
1132 <    lib/libncurses \
1132 >    lib/ncurses/ncurses \
1133 >    lib/ncurses/ncursesw \
1134      ${_share} \
1135      ${_aicasm} \
1136      usr.bin/awk \
1137      lib/libmagic \
1138 <    usr.sbin/sysinstall
1138 >    usr.sbin/sysinstall \
1139 >    usr.bin/mkesdb_static \
1140 >    usr.bin/mkcsmapper_static
1141          ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1142                  cd ${.CURDIR}/${_tool}; \
1143                  ${MAKE} DIRPRFX=${_tool}/ obj; \
1144                  ${MAKE} DIRPRFX=${_tool}/ build-tools
1145   .endfor
1146   .for _tool in \
1147 <    gnu/usr.bin/cc/cc_tools \
1147 >    ${_gcc_tools} \
1148      ${_kerberos5_tools}
1149          ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1150                  cd ${.CURDIR}/${_tool}; \
# Line 898 | Line 1156 | build-tools:
1156   #
1157   # cross-tools: Build cross-building tools
1158   #
1159 < .if (${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386") && \
1160 <    ${TARGET_ARCH} != ${MACHINE_ARCH}
1159 > .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 4016
1160 > .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1161   _btxld=         usr.sbin/btxld
1162   .endif
1163 <
1164 < .if (!defined(NO_RESCUE) || defined(RELEASEDIR)) && \
1165 <    ${TARGET_ARCH} != ${MACHINE_ARCH}
1163 > .endif
1164 > .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1165 > .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1166   _crunchide=     usr.sbin/crunch/crunchide
1167   .endif
1168 <
911 < .if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
912 <    defined(RELEASEDIR)
1168 > .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1169   _kgzip=         usr.sbin/kgzip
1170   .endif
1171 + .endif
1172  
1173 + .if ${MK_BINUTILS} != "no"
1174 + _binutils=      gnu/usr.bin/binutils
1175 + .endif
1176 +
1177 + .if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")
1178 + _clang=         usr.bin/clang
1179 + _clang_libs=    lib/clang
1180 + .endif
1181 +
1182 + .if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no"
1183 + _cc=            gnu/usr.bin/cc
1184 + .endif
1185 +
1186   cross-tools:
1187   .for _tool in \
1188 <    gnu/usr.bin/binutils \
1189 <    gnu/usr.bin/cc \
1188 >    ${_clang_libs} \
1189 >    ${_clang} \
1190 >    ${_binutils} \
1191 >    ${_cc} \
1192      usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1193      ${_btxld} \
1194      ${_crunchide} \
# Line 944 | Line 1216 | hierarchy:
1216   #
1217   libraries:
1218          cd ${.CURDIR}; \
1219 +            ${MAKE} -f Makefile.inc1 _prereq_libs; \
1220              ${MAKE} -f Makefile.inc1 _startup_libs; \
1221              ${MAKE} -f Makefile.inc1 _prebuild_libs; \
1222              ${MAKE} -f Makefile.inc1 _generic_libs;
1223  
1224 + #
1225 + # static libgcc.a prerequisite for shared libc
1226 + #
1227 + _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1228 +
1229   # These dependencies are not automatically generated:
1230   #
1231 < # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
1232 < # shared libraries for ELF.
1231 > # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1232 > # all shared libraries for ELF.
1233   #
1234 < _startup_libs=  gnu/lib/csu gnu/lib/libgcc
1234 > _startup_libs=  gnu/lib/csu
1235   .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1236   _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1237 < .else
1237 > .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1238   _startup_libs+= lib/csu/${MACHINE_ARCH}
1239 + .else
1240 + _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1241   .endif
1242 + _startup_libs+= gnu/lib/libgcc
1243 + _startup_libs+= lib/libcompiler_rt
1244 + _startup_libs+= lib/libc
1245 + .if ${MK_LIBCPLUSPLUS} != "no"
1246 + _startup_libs+= lib/libcxxrt
1247 + .endif
1248  
1249 < _prebuild_libs=
1249 > gnu/lib/libgcc__L: lib/libc__L
1250 > .if ${MK_LIBCPLUSPLUS} != "no"
1251 > lib/libcxxrt__L: gnu/lib/libgcc__L
1252 > .endif
1253  
1254 < _generic_libs=  gnu/lib
1254 > _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libhdb} \
1255 >                ${_kerberos5_lib_libheimntlm} \
1256 >                ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1257 >                ${_kerberos5_lib_libroken} \
1258 >                lib/libbz2 lib/libcom_err lib/libcrypt \
1259 >                lib/libexpat \
1260 >                ${_lib_libgssapi} ${_lib_libipx} \
1261 >                lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
1262 >                lib/ncurses/ncurses lib/ncurses/ncursesw \
1263 >                lib/libopie lib/libpam ${_lib_libthr} \
1264 >                lib/libradius lib/libsbuf lib/libtacplus \
1265 >                ${_cddl_lib_libumem} \
1266 >                lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1267 >                ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1268 >                ${_secure_lib_libssl} lib/libsqlite3 \
1269 >        lib/libarchive lib/libfetch lib/libmagic
1270 > .if ${MK_LIBTHR} != "no"
1271 > _lib_libthr=    lib/libthr
1272 > .endif
1273  
1274 < .if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
1275 < _prebuild_libs+=        kerberos5/lib/libasn1
969 < _prebuild_libs+=        kerberos5/lib/libgssapi
970 < _prebuild_libs+=        kerberos5/lib/libkrb5
971 < _prebuild_libs+=        kerberos5/lib/libroken
972 < _generic_libs+= kerberos5/lib
1274 > .if ${MK_OFED} != "no"
1275 > _ofed_lib=      contrib/ofed/usr.lib/
1276   .endif
1277  
1278 < _prebuild_libs+= lib/libbz2 lib/libcom_err lib/libcrypt lib/libexpat \
976 <                lib/libkvm lib/libmd \
977 <                lib/libncurses \
978 <                lib/libnetgraph lib/libopie lib/libpam \
979 <                lib/libpthread lib/libthr lib/libradius \
980 <                lib/libsbuf lib/libtacplus lib/libutil \
981 <                lib/libz lib/msun
1278 > _generic_libs=  ${_apache_lib} ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1279  
1280   lib/libopie__L lib/libtacplus__L: lib/libmd__L
1281  
1282 < _generic_libs+= lib
1282 > .if ${MK_APACHE} != "no"
1283 > _apache_lib= apache/lib
1284 > .endif
1285  
1286 < .if !defined(NO_CRYPT)
1287 < .if !defined(NO_OPENSSL)
1288 < _prebuild_libs+=        secure/lib/libcrypto secure/lib/libssl
1289 < lib/libradius__L: secure/lib/libssl__L
1290 < secure/lib/libssl__L: secure/lib/libcrypto__L
1291 < .if !defined(NO_OPENSSH)
1292 < _prebuild_libs+=        secure/lib/libssh
1293 < secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L \
1294 <    lib/libmd__L
1295 < .if !defined(NO_KERBEROS)
1296 < secure/lib/libssh__L: kerberos5/lib/libgssapi__L kerberos5/lib/libkrb5__L \
1297 <    kerberos5/lib/libasn1__L lib/libcom_err__L \
1286 > .if ${MK_CDDL} != "no"
1287 > _cddl_lib_libumem= cddl/lib/libumem
1288 > _cddl_lib= cddl/lib
1289 > .endif
1290 >
1291 > .if ${MK_CRYPT} != "no"
1292 > .if ${MK_OPENSSL} != "no"
1293 > _secure_lib_libcrypto= secure/lib/libcrypto
1294 > _secure_lib_libssl= secure/lib/libssl
1295 > lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1296 > .if ${MK_OPENSSH} != "no"
1297 > _secure_lib_libssh= secure/lib/libssh
1298 > secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1299 > .if ${MK_KERBEROS_SUPPORT} != "no"
1300 > secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1301 >    kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1302 >    lib/libmd__L kerberos5/lib/libroken__L
1303 > .endif
1304 > .endif
1305 > .endif
1306 > _secure_lib=    secure/lib
1307 > .endif
1308 >
1309 > .if ${MK_KERBEROS} != "no"
1310 > kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1311 > kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1312 >    kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L
1313 > kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L
1314 > kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1315 >    secure/lib/libcrypto__L kerberos5/lib/libroken__L
1316 > kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1317 >    lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1318      kerberos5/lib/libroken__L
1319 + kerberos5/lib/libroken__L: lib/libcrypt__L
1320   .endif
1321 +
1322 + .if ${MK_GSSAPI} != "no"
1323 + _lib_libgssapi= lib/libgssapi
1324   .endif
1325 +
1326 + .if ${MK_IPX} != "no"
1327 + _lib_libipx=    lib/libipx
1328   .endif
1329 < _generic_libs+= secure/lib
1329 >
1330 > .if ${MK_KERBEROS} != "no"
1331 > _kerberos5_lib= kerberos5/lib
1332 > _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1333 > _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1334 > _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1335 > _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1336 > _kerberos5_lib_libroken= kerberos5/lib/libroken
1337 > _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1338   .endif
1339  
1340 < .if defined(NO_CRYPT) || defined(NO_OPENSSL)
1340 > .if ${MK_NIS} != "no"
1341 > _lib_libypclnt= lib/libypclnt
1342 > .endif
1343 >
1344 > .if ${MK_OPENSSL} == "no"
1345   lib/libradius__L: lib/libmd__L
1346   .endif
1347  
1348 < .if !defined(NO_NIS)
1349 < _prebuild_libs+=        lib/libypclnt
1348 > .for _lib in ${_prereq_libs}
1349 > ${_lib}__PL: .PHONY
1350 > .if exists(${.CURDIR}/${_lib})
1351 >        ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1352 >                cd ${.CURDIR}/${_lib}; \
1353 >                ${MAKE} DIRPRFX=${_lib}/ obj; \
1354 >                ${MAKE} DIRPRFX=${_lib}/ depend; \
1355 >                ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1356 >                ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1357   .endif
1358 + .endfor
1359  
1014 _generic_libs+= usr.bin/lex/lib
1015
1360   .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1361   ${_lib}__L: .PHONY
1362   .if exists(${.CURDIR}/${_lib})
# Line 1036 | Line 1380 | lib/libpam__L: .PHONY
1380                  ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1381                  ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1382  
1383 + _prereq_libs: ${_prereq_libs:S/$/__PL/}
1384   _startup_libs: ${_startup_libs:S/$/__L/}
1385   _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1386   _generic_libs: ${_generic_libs:S/$/__L/}
# Line 1059 | Line 1404 | par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1404  
1405   .include <bsd.subdir.mk>
1406  
1407 < .if make(delete-old) || make(delete-old-libs) || make(check-old)
1407 > .if make(check-old) || make(check-old-dirs) || \
1408 >    make(check-old-files) || make(check-old-libs) || \
1409 >    make(delete-old) || make(delete-old-dirs) || \
1410 >    make(delete-old-files) || make(delete-old-libs)
1411  
1412   #
1413   # check for / delete old files section
# Line 1080 | Line 1428 | RM_I=-v
1428  
1429   delete-old-files:
1430          @echo ">>> Removing old files (only deletes safe to delete libs)"
1083 .for file in ${OLD_FILES}
1431   # Ask for every old file if the user really wants to remove it.
1432   # It's annoying, but better safe than sorry.
1433 <        @[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \
1434 <                ||  ([ -f "${DESTDIR}/${file}" ] \
1435 <                        && echo "Removing schg flag on ${DESTDIR}/${file}" \
1436 <                        && chflags noschg "${DESTDIR}/${file}" \
1437 <                        && rm ${RM_I} "${DESTDIR}/${file}"))
1438 < .endfor
1433 > # NB: We cannot pass the list of OLD_FILES as a parameter because the
1434 > # argument list will get too long. Using .for/.endfor make "loops" will make
1435 > # the Makefile parser segfault.
1436 >        @exec 3<&0; \
1437 >        ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1438 >            -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1439 >        while read file; do \
1440 >                if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1441 >                        chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1442 >                        rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1443 >                fi; \
1444 >        done
1445   # Remove catpages without corresponding manpages.
1446 <        @3<&0; \
1446 >        @exec 3<&0; \
1447          find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1448          sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1449          while read catpage; do \
1450                  read manpage; \
1451                  if [ ! -e "$${manpage}" ]; then \
1452 <                        rm ${RM_I} $${catpage} <&3 ; \
1452 >                        rm ${RM_I} $${catpage} <&3; \
1453                  fi; \
1454          done
1455          @echo ">>> Old files removed"
1456  
1457   check-old-files:
1458          @echo ">>> Checking for old files"
1459 < .for file in ${OLD_FILES}
1460 <        @[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}"
1461 < .endfor
1459 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1460 >            -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1461 >        while read file; do \
1462 >                if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1463 >                        echo "${DESTDIR}/$${file}"; \
1464 >                fi; \
1465 >        done
1466   # Check for catpages without corresponding manpages.
1467          @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1468          sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1469          while read catpage; do \
1470                  read manpage; \
1471                  if [ ! -e "$${manpage}" ]; then \
1472 <                        echo $${catpage} ; \
1472 >                        echo $${catpage}; \
1473                  fi; \
1474          done
1475  
1476   delete-old-libs:
1477          @echo ">>> Removing old libraries"
1478          @echo "${OLD_LIBS_MESSAGE}" | fmt
1479 < .for file in ${OLD_LIBS}
1480 <        @[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \
1481 <                ||  ([ -f "${DESTDIR}/${file}" ] \
1482 <                        && echo "Removing schg flag on ${DESTDIR}/${file}" \
1483 <                        && chflags noschg "${DESTDIR}/${file}" \
1484 <                        && rm ${RM_I} "${DESTDIR}/${file}"))
1485 < .endfor
1479 >        @exec 3<&0; \
1480 >        ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1481 >            -V OLD_LIBS | xargs -n1 | \
1482 >        while read file; do \
1483 >                if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1484 >                        chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1485 >                        rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1486 >                fi; \
1487 >        done
1488          @echo ">>> Old libraries removed"
1489  
1490   check-old-libs:
1491          @echo ">>> Checking for old libraries"
1492 < .for file in ${OLD_LIBS}
1493 <        @[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}"
1494 < .endfor
1492 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1493 >            -V OLD_LIBS | xargs -n1 | \
1494 >        while read file; do \
1495 >                if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1496 >                        echo "${DESTDIR}/$${file}"; \
1497 >                fi; \
1498 >        done
1499  
1500   delete-old-dirs:
1501          @echo ">>> Removing old directories"
1502 < .for dir in ${OLD_DIRS}
1503 < # Don't fail if an old directory isn't empty.
1504 <        @[ ! -d "${DESTDIR}/${dir}" ] || (rmdir -v "${DESTDIR}/${dir}" || true)
1505 < .endfor
1502 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1503 >            -V OLD_DIRS | xargs -n1 | \
1504 >        while read dir; do \
1505 >                if [ -d "${DESTDIR}/$${dir}" ]; then \
1506 >                        rmdir -v "${DESTDIR}/$${dir}" || true; \
1507 >                elif [ -L "${DESTDIR}/$${dir}" ]; then \
1508 >                        echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1509 >                fi; \
1510 >        done
1511          @echo ">>> Old directories removed"
1512  
1513   check-old-dirs:
1514          @echo ">>> Checking for old directories"
1515 < .for dir in ${OLD_DIRS}
1516 <        @[ ! -d "${DESTDIR}/${dir}" ] || echo "${DESTDIR}/${dir}"
1517 < .endfor
1515 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1516 >            -V OLD_DIRS | xargs -n1 | \
1517 >        while read dir; do \
1518 >                if [ -d "${DESTDIR}/$${dir}" ]; then \
1519 >                        echo "${DESTDIR}/$${dir}"; \
1520 >                elif [ -L "${DESTDIR}/$${dir}" ]; then \
1521 >                        echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1522 >                fi; \
1523 >        done
1524  
1525   delete-old: delete-old-files delete-old-dirs
1526          @echo "To remove old libraries run '${MAKE} delete-old-libs'."
# Line 1157 | Line 1531 | check-old: check-old-files check-old-libs check-old-di
1531  
1532   .endif
1533  
1534 + #
1535 + # showconfig - show build configuration.
1536 + #
1537 + showconfig:
1538 +        @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
1539 +
1540 + .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1541 + DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1542 +
1543 + .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1544 + .if exists(${KERNCONFDIR}/${KERNCONF})
1545 + FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1546 +        ${KERNCONFDIR}/${KERNCONF}
1547 + .endif
1548 + .endif
1549 +
1550 + .endif
1551 +
1552 + .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1553 + DTBOUTPUTPATH= ${.CURDIR}
1554 + .endif
1555 +
1556 + #
1557 + # Build 'standalone' Device Tree Blob
1558 + #
1559 + builddtb:
1560 +        @if [ "${FDT_DTS_FILE}" = "" ]; then \
1561 +                echo "ERROR: FDT_DTS_FILE must be specified!"; \
1562 +                exit 1; \
1563 +        fi;     \
1564 +        if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
1565 +                echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1566 +                        exist!"; \
1567 +                exit 1; \
1568 +        fi;     \
1569 +        if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then  \
1570 +                echo "WARNING: DTB will be placed in the current working \
1571 +                        directory"; \
1572 +        fi
1573 +        @PATH=${TMPPATH} \
1574 +        dtc -O dtb -o \
1575 +            ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
1576 +            -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
1577 +
1578 + ###############
1579 +
1580 + .if defined(XDEV) && defined(XDEV_ARCH)
1581 +
1582 + .if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
1583 + XDEV_CPUTYPE?=${CPUTYPE}
1584 + .else
1585 + XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1586 + .endif
1587 +
1588 + NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1589 +        -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
1590 +        -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \
1591 +        TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
1592 +        CPUTYPE=${XDEV_CPUTYPE}
1593 +
1594 + XDDIR=${XDEV_ARCH}-midnightbsd
1595 + XDTP=/usr/${XDDIR}
1596 + CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR}
1597 + CDENV= ${CDBENV} \
1598 +        _SHLIBDIRPREFIX=${XDTP} \
1599 +        TOOLS_PREFIX=${XDTP}
1600 + CD2ENV=${CDENV} \
1601 +        MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1602 +
1603 + CDTMP=  ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
1604 + CDMAKE=${CDENV} ${MAKE} ${NOFUN}
1605 + CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1606 + XDDESTDIR=${DESTDIR}${XDTP}
1607 + .if !defined(OSREL)
1608 + OSREL!= uname -r | sed -e 's/[-(].*//'
1609 + .endif
1610 +
1611 + .ORDER: xdev-build xdev-install
1612 + xdev: xdev-build xdev-install
1613 +
1614 + .ORDER: _xb-build-tools _xb-cross-tools
1615 + xdev-build: _xb-build-tools _xb-cross-tools
1616 +
1617 + _xb-build-tools:
1618 +        ${_+_}@cd ${.CURDIR}; \
1619 +        ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1620 +
1621 + _xb-cross-tools:
1622 + .for _tool in \
1623 +    gnu/usr.bin/binutils \
1624 +    gnu/usr.bin/cc \
1625 +    usr.bin/ar
1626 +        ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1627 +        cd ${.CURDIR}/${_tool}; \
1628 +        ${CDMAKE} DIRPRFX=${_tool}/ obj; \
1629 +        ${CDMAKE} DIRPRFX=${_tool}/ depend; \
1630 +        ${CDMAKE} DIRPRFX=${_tool}/ all
1631 + .endfor
1632 +
1633 + _xi-mtree:
1634 +        ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1635 +        mkdir -p ${XDDESTDIR}
1636 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1637 +            -p ${XDDESTDIR} >/dev/null
1638 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1639 +            -p ${XDDESTDIR}/usr >/dev/null
1640 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1641 +            -p ${XDDESTDIR}/usr/include >/dev/null
1642 +
1643 + .ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1644 + xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1645 +
1646 + _xi-cross-tools:
1647 +        @echo "_xi-cross-tools"
1648 + .for _tool in \
1649 +    gnu/usr.bin/binutils \
1650 +    gnu/usr.bin/cc \
1651 +    usr.bin/ar
1652 +        ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1653 +        cd ${.CURDIR}/${_tool}; \
1654 +        ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1655 + .endfor
1656 +
1657 + _xi-includes:
1658 +        ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1659 +                DESTDIR=${XDDESTDIR}
1660 +
1661 + _xi-libraries:
1662 +        ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1663 +                DESTDIR=${XDDESTDIR}
1664 +
1665 + _xi-links:
1666 +        ${_+_}cd ${XDDESTDIR}/usr/bin; \
1667 +                for i in *; do \
1668 +                        ln -sf ../../${XDTP}/usr/bin/$$i \
1669 +                            ../../../../usr/bin/${XDDIR}-$$i; \
1670 +                        ln -sf ../../${XDTP}/usr/bin/$$i \
1671 +                            ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
1672 +                done
1673 + .endif

Comparing trunk/Makefile.inc1 (property cvs2svn:cvs-rev):
Revision 1551 by laffer1, Tue Apr 29 01:36:03 2008 UTC vs.
Revision 7136 by laffer1, Fri Jul 24 22:31:33 2015 UTC

# Line 1 | Line 0
1 1.9

Comparing trunk/Makefile.inc1 (property svn:keywords):
Revision 1551 by laffer1, Tue Apr 29 01:36:03 2008 UTC vs.
Revision 7136 by laffer1, Fri Jul 24 22:31:33 2015 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines