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

Comparing:
branches/MidnightBSD/Makefile.inc1 (file contents), Revision 2 by laffer1, Sat Feb 25 02:29:52 2006 UTC vs.
trunk/Makefile.inc1 (file contents), Revision 7138 by laffer1, Fri Jul 24 22:40:44 2015 UTC

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

Comparing:
branches/MidnightBSD/Makefile.inc1 (property cvs2svn:cvs-rev), Revision 2 by laffer1, Sat Feb 25 02:29:52 2006 UTC vs.
trunk/Makefile.inc1 (property cvs2svn:cvs-rev), Revision 7138 by laffer1, Fri Jul 24 22:40:44 2015 UTC

# Line 1 | Line 0
1 1.1.1.1

Comparing:
branches/MidnightBSD/Makefile.inc1 (property svn:keywords), Revision 2 by laffer1, Sat Feb 25 02:29:52 2006 UTC vs.
trunk/Makefile.inc1 (property svn:keywords), Revision 7138 by laffer1, Fri Jul 24 22:40:44 2015 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines