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 2744 by laffer1, Sun Apr 5 23:35:06 2009 UTC vs.
Revision 5123 by laffer1, Sun Aug 19 14:05:10 2012 UTC

# Line 1 | Line 1
1   #
2 < # $FreeBSD: src/Makefile.inc1,v 1.499.2.7 2006/01/07 19:40:08 netchild Exp $
3 < # $MidnightBSD: src/Makefile.inc1,v 1.15 2009/04/05 23:02:05 laffer1 Exp $
2 > # $MidnightBSD: src/Makefile.inc1,v 1.42 2012/07/20 01:51:49 laffer1 Exp $
3   #
4   # Make command line options:
5   #       -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
6   #       -DNO_CLEAN do not clean at all
7   #       -DNO_SHARE do not go into share subdir
8 + #       -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="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:
# Line 25 | Line 29
29   # /usr/share/mk.  These include:
30   #               obj depend all install clean cleandepend cleanobj
31  
32 + # You are supposed to define both of these when calling Makefile.inc1
33 + # directly.  However, some old scripts don't.  Cope for the moment, but
34 + # issue a new warning for a transition period.
35 + .if defined(TARGET) && !defined(TARGET_ARCH)
36 + .warning "You must pass both TARGET and TARGET_ARCH to Makefile.inc1.  Setting TARGET_ARCH=${TARGET}."
37 + TARGET_ARCH=${TARGET}
38 + .endif
39 + .if !defined(TARGET) || !defined(TARGET_ARCH)
40 + .error "Both TARGET and TARGET_ARCH must be defined."
41 + .endif
42 +
43   .include <bsd.own.mk>
44 + .include <bsd.arch.inc.mk>
45  
46   # We must do share/info early so that installation of info `dir'
47   # entries works correctly.  Do it first since it is less likely to
# Line 38 | Line 54
54   #
55   SUBDIR= share/info lib libexec
56   SUBDIR+=bin
57 + .if ${MK_APACHE} != "no"
58 + SUBDIR+=apache
59 + .endif
60   .if ${MK_GAMES} != "no"
61   SUBDIR+=games
62   .endif
63   .if ${MK_CDDL} != "no"
64   SUBDIR+=cddl
65 + .else
66 + NO_CTF=1
67   .endif
68   SUBDIR+=gnu include
69   .if ${MK_KERBEROS} != "no"
# Line 59 | Line 80 | SUBDIR+=secure
80   SUBDIR+=share
81   .endif
82   SUBDIR+=sys usr.bin usr.sbin
83 + .if ${MK_OFED} != "no"
84 + SUBDIR+=contrib/ofed
85 + .endif
86   #
87   # We must do etc/ last for install/distribute to work.
88   #
# Line 108 | Line 132 | VERSION!=      uname -srp
132   VERSION+=       ${OSRELDATE}
133   .endif
134  
111 # Guess machine architecture from machine type, and vice versa.
112 .if !defined(TARGET_ARCH) && defined(TARGET)
113 TARGET_ARCH=    ${TARGET:S/sun4v/sparc64/}
114 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
115    ${TARGET_ARCH} != ${MACHINE_ARCH}
116 TARGET=         ${TARGET_ARCH}
117 .endif
118 # Otherwise, default to current machine type and architecture.
119 TARGET?=        ${MACHINE}
120 TARGET_ARCH?=   ${MACHINE_ARCH}
135  
136 < KNOWN_ARCHES?=  amd64 i386 sparc64 sparc64/sun4v
136 > KNOWN_ARCHES?=  amd64 i386 sparc64
137   .if ${TARGET} == ${TARGET_ARCH}
138   _t=             ${TARGET}
139   .else
# Line 153 | Line 167 | BUILD_ARCH!=   uname -p
167   .error To cross-build, set TARGET_ARCH.
168   .endif
169   .endif
170 < .if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING)
170 > .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
171   OBJTREE=        ${MAKEOBJDIRPREFIX}
172   .else
173 < OBJTREE=        ${MAKEOBJDIRPREFIX}/${TARGET}
173 > OBJTREE=        ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
174   .endif
175   WORLDTMP=       ${OBJTREE}${.CURDIR}/tmp
176   # /usr/games added for fortune which depend on strfile
# Line 165 | Line 179 | XPATH=         ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WOR
179   STRICTTMPPATH=  ${BPATH}:${XPATH}
180   TMPPATH=        ${STRICTTMPPATH}:${PATH}
181  
182 + #
183 + # Avoid running mktemp(1) unless actually needed.
184 + # It may not be functional, e.g., due to new ABI
185 + # when in the middle of installing over this system.
186 + #
187 + .if make(distributeworld) || make(installworld)
188   INSTALLTMP!=    /usr/bin/mktemp -d -u -t install
189 + .endif
190  
191   #
192   # Building a world goes through the following stages
# Line 198 | Line 219 | BOOTSTRAPPING?=        0
219   CROSSENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
220                  MACHINE_ARCH=${TARGET_ARCH} \
221                  MACHINE=${TARGET} \
222 <                CPUTYPE=${TARGET_CPUTYPE} \
223 <                GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
222 >                CPUTYPE=${TARGET_CPUTYPE}
223 > .if ${OSRELDATE} < 4015
224 > CROSSENV+=      AR=gnu-ar RANLIB=gnu-ranlib
225 > .endif
226 > .if ${MK_GROFF} != "no"
227 > CROSSENV+=      GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
228                  GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
229                  GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
230 + .endif
231  
232   # bootstrap-tools stage
233   BMAKEENV=       INSTALL="sh ${.CURDIR}/tools/install.sh" \
234                  PATH=${BPATH}:${PATH} \
235                  WORLDTMP=${WORLDTMP} \
236 <                VERSION=${VERSION} \
236 >                VERSION="${VERSION}" \
237                  MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
238   BMAKE=          MAKEOBJDIRPREFIX=${WORLDTMP} \
239                  ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
240                  DESTDIR= \
241                  BOOTSTRAPPING=${OSRELDATE} \
242 +                SSP_CFLAGS= \
243                  -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
244 <                -DWITHOUT_NLS -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
245 <                -DNO_CPU_CFLAGS -DNO_WARNS
244 >                -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
245 >                -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
246  
247   # build-tools stage
248   TMAKE=          MAKEOBJDIRPREFIX=${OBJTREE} \
249                  ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
250                  TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
251                  DESTDIR= \
252 <                BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS
252 >                BOOTSTRAPPING=${OSRELDATE} \
253 >                SSP_CFLAGS= \
254 >                -DNO_LINT \
255 >                -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
256  
257   # cross-tools stage
258   XMAKE=          TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
# Line 232 | Line 262 | XMAKE=         TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
262   # world stage
263   WMAKEENV=       ${CROSSENV} \
264                  _SHLIBDIRPREFIX=${WORLDTMP} \
265 +                _LDSCRIPTROOT= \
266 +                VERSION="${VERSION}" \
267                  INSTALL="sh ${.CURDIR}/tools/install.sh" \
268                  PATH=${TMPPATH}
269 + .if ${MK_CDDL} == "no"
270 + WMAKEENV+=      NO_CTF=1
271 + .endif
272   WMAKE=          ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
273  
274   .if ${TARGET_ARCH} == "amd64"
275   # 32 bit world
276   LIB32TMP=       ${OBJTREE}${.CURDIR}/lib32
277  
278 + .if ${TARGET_ARCH} == "amd64"
279   .if empty(TARGET_CPUTYPE)
280 < LIB32CPUTYPE=   -march=i686 -mmmx -msse -msse2
280 > LIB32CPUFLAGS=  -march=i686 -mmmx -msse -msse2
281   .else
282 < LIB32CPUTYPE=   ${TARGET_CPUTYPE}
282 > LIB32CPUFLAGS=  -march=${TARGET_CPUTYPE}
283   .endif
284 < LIB32FLAGS=     -m32 -march=${LIB32CPUTYPE} -mfancy-math-387 -DCOMPAT_32BIT \
285 <                -iprefix ${LIB32TMP}/usr/ \
284 > LIB32WMAKEENV=  MACHINE=i386 MACHINE_ARCH=i386 \
285 >                MACHINE_CPU="i686 mmx sse sse2" \
286 >                LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
287 >                AS="${AS} --32"
288 > .endif
289 >
290 >
291 > LIB32FLAGS=     -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
292 >                -isystem ${LIB32TMP}/usr/include/ \
293                  -L${LIB32TMP}/usr/lib32 \
294                  -B${LIB32TMP}/usr/lib32
295  
296   # Yes, the flags are redundant.
297 < LIB32WMAKEENV=  MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
297 > LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
298                  _SHLIBDIRPREFIX=${LIB32TMP} \
299 <                MACHINE=i386 \
300 <                MACHINE_ARCH=i386 \
299 >                _LDSCRIPTROOT=${LIB32TMP} \
300 >                VERSION="${VERSION}" \
301                  INSTALL="sh ${.CURDIR}/tools/install.sh" \
302                  PATH=${TMPPATH} \
303                  CC="${CC} ${LIB32FLAGS}" \
304                  CXX="${CXX} ${LIB32FLAGS}" \
262                OBJC="${OBJC} ${LIB32FLAGS}" \
263                LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
264                AS="${AS} --32" \
305                  LIBDIR=/usr/lib32 \
306                  SHLIBDIR=/usr/lib32
307  
308   LIB32WMAKE=     ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
309 <                -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_INFO \
310 <                -DWITHOUT_HTML DESTDIR=${LIB32TMP}
311 < LIB32IMAKE=     ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
309 >                -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
310 >                -DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \
311 >                DESTDIR=${LIB32TMP}
312 > LIB32IMAKE=     ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS
313   .endif
314  
315   # install stage
316 + IMAKEENV=       ${CROSSENV:N_LDSCRIPTROOT=*}
317 + IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
318   .if empty(.MAKEFLAGS:M-n)
319 < IMAKEENV=       ${CROSSENV} \
320 <                PATH=${STRICTTMPPATH}:${INSTALLTMP}
319 > IMAKEENV+=      PATH=${STRICTTMPPATH}:${INSTALLTMP} \
320 >                LD_LIBRARY_PATH=${INSTALLTMP} \
321 >                PATH_LOCALE=${INSTALLTMP}/locale
322 > IMAKE+=         __MAKE_SHELL=${INSTALLTMP}/sh
323   .else
324 < IMAKEENV=       ${CROSSENV} \
280 <                PATH=${TMPPATH}:${INSTALLTMP}
324 > IMAKEENV+=      PATH=${TMPPATH}:${INSTALLTMP}
325   .endif
282 IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
326  
327   # kernel stage
328   KMAKEENV=       ${WMAKEENV}
# Line 306 | Line 349 | _worldtmp:
349          @echo "--------------------------------------------------------------"
350   .if !defined(NO_CLEAN)
351          rm -rf ${WORLDTMP}
352 < .if ${TARGET_ARCH} == "amd64"
352 > .if defined(LIB32TMP)
353          rm -rf ${LIB32TMP}
354   .endif
355   .else
356          rm -rf ${WORLDTMP}/legacy/usr/include
357 < #       XXX - These two can depend on any header file.
357 > #       XXX - These three can depend on any header file.
358          rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
359 +        rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
360          rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
361   .endif
362   .for _dir in \
363 <    usr/bin usr/games usr/include/sys usr/lib \
320 <    usr/libexec usr/sbin usr/share/dict \
321 <    usr/share/groff_font/devX100 \
322 <    usr/share/groff_font/devX100-12 \
323 <    usr/share/groff_font/devX75 \
324 <    usr/share/groff_font/devX75-12 \
325 <    usr/share/groff_font/devascii \
326 <    usr/share/groff_font/devcp1047 \
327 <    usr/share/groff_font/devdvi \
328 <    usr/share/groff_font/devhtml \
329 <    usr/share/groff_font/devkoi8-r \
330 <    usr/share/groff_font/devlatin1 \
331 <    usr/share/groff_font/devlbp \
332 <    usr/share/groff_font/devlj4 \
333 <    usr/share/groff_font/devps \
334 <    usr/share/groff_font/devutf8 \
335 <    usr/share/tmac/mdoc usr/share/tmac/mm
336 <        mkdir -p ${WORLDTMP}/legacy/${_dir}
337 < .endfor
338 < .for _dir in \
339 <    lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
340 <    usr/libexec usr/sbin usr/share/misc
363 >    lib usr legacy/usr
364          mkdir -p ${WORLDTMP}/${_dir}
365   .endfor
366 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
367 +            -p ${WORLDTMP}/legacy/usr >/dev/null
368 + .if ${MK_GROFF} != "no"
369 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
370 +            -p ${WORLDTMP}/legacy/usr >/dev/null
371 + .endif
372 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
373 +            -p ${WORLDTMP}/usr >/dev/null
374          mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
375              -p ${WORLDTMP}/usr/include >/dev/null
376          ln -sf ${.CURDIR}/sys ${WORLDTMP}
# Line 366 | Line 397 | _cleanobj:
397          @echo ">>> stage 2.1: cleaning up the object tree"
398          @echo "--------------------------------------------------------------"
399          ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
400 < .if ${TARGET_ARCH} == "amd64"
400 > .if defined(LIB32TMP)
401          ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
402   .endif
403   .endif
# Line 401 | Line 432 | _libraries:
432          @echo "--------------------------------------------------------------"
433          ${_+_}cd ${.CURDIR}; \
434              ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
435 <            -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE libraries
435 >            -DWITHOUT_MAN -DWITHOUT_PROFILE libraries
436   _depend:
437          @echo
438          @echo "--------------------------------------------------------------"
# Line 414 | Line 445 | everything:
445          @echo ">>> stage 4.4: building everything"
446          @echo "--------------------------------------------------------------"
447          ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
448 < .if ${TARGET_ARCH} == "amd64"
448 > .if defined(LIB32TMP)
449   build32:
450          @echo
451          @echo "--------------------------------------------------------------"
452          @echo ">>> stage 5.1: building 32 bit shim libraries"
453          @echo "--------------------------------------------------------------"
454 < .for _dir in \
455 <    usr/include usr/lib32 usr/share/misc
456 <        mkdir -p ${LIB32TMP}/${_dir}
426 < .endfor
454 >        mkdir -p ${LIB32TMP}/usr/include
455 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
456 >            -p ${LIB32TMP}/usr >/dev/null
457          mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
458              -p ${LIB32TMP}/usr/include >/dev/null
459          mkdir -p ${WORLDTMP}
# Line 431 | Line 461 | build32:
461   .if ${MK_KERBEROS} != "no"
462   .for _t in obj depend all
463          cd ${.CURDIR}/kerberos5/tools; \
464 <            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= ${_t}
464 >            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
465 >            DIRPRFX=kerberos5/tools/ ${_t}
466   .endfor
467   .endif
468   .for _t in obj includes
469 <        cd ${.CURDIR}/include; ${LIB32WMAKE} ${_t}
470 <        cd ${.CURDIR}/lib; ${LIB32WMAKE} ${_t}
469 >        cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
470 >        cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
471 > .if ${MK_APACHE} != "no"
472 >        cd ${.CURDIR}/apache/lib; ${LIB32WMAKE} ${_t}
473 > .endif
474   .if ${MK_CDDL} != "no"
475 <        cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} ${_t}
475 >        cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
476   .endif
477 <        cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} ${_t}
477 >        cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
478   .if ${MK_CRYPT} != "no"
479 <        cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} ${_t}
479 >        cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
480   .endif
481   .if ${MK_KERBEROS} != "no"
482 <        cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} ${_t}
482 >        cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
483   .endif
484   .endfor
485   .for _dir in usr.bin/lex/lib
486 <        cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} obj
486 >        cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
487   .endfor
488   .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
489          cd ${.CURDIR}/${_dir}; \
490 <            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= build-tools
490 >            MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
491 >            DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
492 >            -DEARLY_BUILD build-tools
493   .endfor
494          cd ${.CURDIR}; \
495              ${LIB32WMAKE} -f Makefile.inc1 libraries
496   .for _t in obj depend all
497 <        cd ${.CURDIR}/libexec/rtld-elf; \
498 <            PROG=ld-elf32.so.1 ${LIB32WMAKE} ${_t}
497 >        cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
498 >            DIRPRFX=libexec/rtld-elf/ ${_t}
499 >        cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
500 >            DIRPRFX=usr.bin/ldd ${_t}
501   .endfor
502  
503   distribute32 install32:
466 .if make(distribute32)
467        mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32   # XXX add to mtree
468 .else
469        mkdir -p ${DESTDIR}/usr/lib32                   # XXX add to mtree
470 .endif
504          cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
505 + .if ${MK_CDDL} != "no"
506 +        cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
507 + .endif
508          cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
509   .if ${MK_CRYPT} != "no"
510          cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
511   .endif
512 <        cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
512 > .if ${MK_KERBEROS} != "no"
513 >        cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
514   .endif
515 +        cd ${.CURDIR}/libexec/rtld-elf; \
516 +            PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
517 +        cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
518 + .endif
519  
479
520   WMAKE_TGTS=
521   .if !defined(SUBDIR_OVERRIDE)
522   WMAKE_TGTS+=    _worldtmp _legacy _bootstrap-tools
# Line 486 | Line 526 | WMAKE_TGTS+=   _cleanobj _obj _build-tools
526   WMAKE_TGTS+=    _cross-tools
527   .endif
528   WMAKE_TGTS+=    _includes _libraries _depend everything
529 < .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
529 > .if defined(LIB32TMP) && ${MK_LIB32} != "no"
530   WMAKE_TGTS+=    build32
531   .endif
532  
# Line 571 | Line 611 | installcheck_UGID:
611   .endfor
612  
613   #
614 + # Required install tools to be saved in a scratch dir for safety.
615 + #
616 + .if ${MK_INFO} != "no"
617 + _install-info=  install-info
618 + .endif
619 + .if ${MK_ZONEINFO} != "no"
620 + _zoneinfo=      zic tzsetup
621 + .endif
622 +
623 + ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
624 +        date echo egrep find grep ${_install-info} \
625 +        ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
626 +        test true uname wc ${_zoneinfo}
627 +
628 + #
629   # distributeworld
630   #
631   # Distributes everything compiled by a `buildworld'.
# Line 579 | Line 634 | installcheck_UGID:
634   #
635   # Installs everything compiled by a 'buildworld'.
636   #
637 +
638 + # Non-base distributions produced by the base system
639 + EXTRA_DISTRIBUTIONS=    doc games
640 + .if defined(LIB32TMP) && ${MK_LIB32} != "no"
641 + EXTRA_DISTRIBUTIONS+=   lib32
642 + .endif
643 +
644   distributeworld installworld: installcheck
645          mkdir -p ${INSTALLTMP}
646 <        for prog in [ awk cap_mkdb cat chflags chmod chown \
647 <            date echo egrep find grep install-info \
648 <            ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
649 <            test true uname wc zic; do \
650 <                cp `which $$prog` ${INSTALLTMP}; \
651 <        done
652 <        ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
653 <        rm -rf ${INSTALLTMP}
646 >        progs=$$(for prog in ${ITOOLS}; do \
647 >                if progpath=`which $$prog`; then \
648 >                        echo $$progpath; \
649 >                else \
650 >                        echo "Required tool $$prog not found in PATH." >&2; \
651 >                        exit 1; \
652 >                fi; \
653 >            done); \
654 >        libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
655 >            while read line; do \
656 >                set -- $$line; \
657 >                if [ "$$2 $$3" != "not found" ]; then \
658 >                        echo $$2; \
659 >                else \
660 >                        echo "Required library $$1 not found." >&2; \
661 >                        exit 1; \
662 >                fi; \
663 >            done); \
664 >        cp $$libs $$progs ${INSTALLTMP}
665 >        cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
666 > .if make(distributeworld)
667 > .for dist in ${EXTRA_DISTRIBUTIONS}
668 >        -mkdir ${DESTDIR}/${DISTDIR}/${dist}
669 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
670 >            -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
671 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
672 >            -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
673 >        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
674 >            -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
675 > .endfor
676 >        -mkdir ${DESTDIR}/${DISTDIR}/base
677 >        ${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \
678 >            DESTDIR=${DESTDIR}/${DISTDIR}/base
679 > .endif
680 >        ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
681 >            ${IMAKEENV} rm -rf ${INSTALLTMP}
682 > .if make(distributeworld)
683 > .for dist in ${EXTRA_DISTRIBUTIONS}
684 >        find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
685 > .endfor
686 > .endif
687  
688 + packageworld:
689 + .for dist in base ${EXTRA_DISTRIBUTIONS}
690 +        ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
691 +            tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz .
692 + .endfor
693 +
694   #
695   # reinstall
696   #
# Line 607 | Line 708 | reinstall:
708          @echo ">>> Installing everything"
709          @echo "--------------------------------------------------------------"
710          ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
711 < .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
711 > .if defined(LIB32TMP) && ${MK_LIB32} != "no"
712          ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
713   .endif
714  
# Line 616 | Line 717 | redistribute:
717          @echo ">>> Distributing everything"
718          @echo "--------------------------------------------------------------"
719          ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
720 < .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
721 <        ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 DISTRIBUTION=lib32
720 > .if defined(LIB32TMP) && ${MK_LIB32} != "no"
721 >        ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
722 >            DISTRIBUTION=lib32
723   .endif
724  
725   distrib-dirs distribution:
# Line 637 | Line 739 | distrib-dirs distribution:
739   # be set to cross-build, we have to make sure TARGET is set
740   # properly.
741  
742 + .if defined(KERNFAST)
743 + NO_KERNELCLEAN= t
744 + NO_KERNELCONFIG=        t
745 + NO_KERNELDEPEND=        t
746 + NO_KERNELOBJ=           t
747 + # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
748 + .if !defined(KERNCONF) && ${KERNFAST} != "1"
749 + KERNCONF=${KERNFAST}
750 + .endif
751 + .endif
752   .if !defined(KERNCONF) && defined(KERNEL)
753   KERNCONF=       ${KERNEL}
754   KERNWARN=
# Line 701 | Line 813 | buildkernel:
813          @echo "--------------------------------------------------------------"
814          cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
815   .endif
816 + .if !defined(NO_KERNELOBJ)
817          @echo
818          @echo "--------------------------------------------------------------"
819          @echo ">>> stage 2.2: rebuilding the object tree"
820          @echo "--------------------------------------------------------------"
821          cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
822 + .endif
823          @echo
824          @echo "--------------------------------------------------------------"
825          @echo ">>> stage 2.3: build tools"
826          @echo "--------------------------------------------------------------"
827          cd ${KRNLOBJDIR}/${_kernel}; \
828 +            PATH=${BPATH}:${PATH} \
829              MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
830 <            ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
830 >            ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \
831 >            -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
832   # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
833   .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
834   .for target in obj depend all
835          cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
836 +            PATH=${BPATH}:${PATH} \
837              MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
838 <            ${MAKE} -DNO_CPU_CFLAGS ${target}
838 >            ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target}
839   .endfor
840   .endif
841   .if !defined(NO_KERNELDEPEND)
# Line 750 | Line 867 | reinstallkernel reinstallkernel.debug: installcheck
867          false
868   .endif
869          @echo "--------------------------------------------------------------"
870 <        @echo ">>> Installing kernel"
870 >        @echo ">>> Installing kernel ${INSTALLKERNEL}"
871          @echo "--------------------------------------------------------------"
872          cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
873              ${CROSSENV} PATH=${TMPPATH} \
874              ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
875  
876 + distributekernel distributekernel.debug:
877 + .if empty(INSTALLKERNEL)
878 +        @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
879 +        false
880 + .endif
881 +        cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
882 +            ${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
883 +            DESTDIR=${DESTDIR}/${DISTDIR}/kernel \
884 +            ${.TARGET:S/distributekernel/install/}
885 + .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
886 +        cd ${KRNLOBJDIR}/${_kernel}; \
887 +            ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
888 +            KERNEL=${INSTKERNNAME}.${_kernel} \
889 +            DESTDIR=${DESTDIR}/${DISTDIR}/kernel.${_kernel} \
890 +            ${.TARGET:S/distributekernel/install/}
891 + .endfor
892 +
893 + packagekernel:
894 +        cd ${DESTDIR}/${DISTDIR}/kernel; \
895 +            tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
896 + .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
897 +        cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
898 +            tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
899 + .endfor
900 +
901   #
902   # doxygen
903   #
# Line 771 | Line 913 | doxygen:
913   #
914   # update
915   #
916 < # Update the source tree, by running cvsup and/or running cvs to update to the
916 > # Update the source tree(s), by running cvsup/cvs/svn to update to the
917   # latest copy.
918   #
919   update:
# Line 796 | Line 938 | update:
938   .endif
939   .endif
940   .if defined(CVS_UPDATE)
941 <        @echo "--------------------------------------------------------------"
942 <        @echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT}
943 <        @echo "--------------------------------------------------------------"
944 <        cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS}
941 >        @cd ${.CURDIR} ; \
942 >        if [ -d CVS ] ; then \
943 >                echo "--------------------------------------------------------------" ; \
944 >                echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
945 >                echo "--------------------------------------------------------------" ; \
946 >                echo ${CVS} -R -q update ${CVSFLAGS} ; \
947 >                ${CVS} -R -q update ${CVSFLAGS} ; \
948 >        fi
949   .endif
950 + .if defined(SVN_UPDATE)
951 +        @cd ${.CURDIR} ; \
952 +        if [ -d .svn ] ; then \
953 +                echo "--------------------------------------------------------------" ; \
954 +                echo ">>> Updating ${.CURDIR} using Subversion" ; \
955 +                echo "--------------------------------------------------------------" ; \
956 +                echo ${SVN} update ${SVNFLAGS} ; \
957 +                ${SVN} update ${SVNFLAGS} ; \
958 +        fi
959 + .endif
960  
961   #
962   # ------------------------------------------------------------------------
# Line 817 | Line 973 | update:
973   # legacy: Build compatibility shims for the next three targets
974   #
975   legacy:
976 + .if ${BOOTSTRAPPING} < 1000 && ${BOOTSTRAPPING} != 0
977 +        @echo "ERROR: Source upgrades from versions prior to 0.1 not supported."; \
978 +        false
979 + .endif
980   .for _tool in tools/build
981          ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
982              cd ${.CURDIR}/${_tool}; \
# Line 836 | Line 996 | _strfile=      games/fortune/strfile
996  
997   .if ${MK_CXX} != "no"
998   _gperf=         gnu/usr.bin/gperf
999 < .if ${BOOTSTRAPPING} < 700004
999 > .endif
1000 >
1001 > .if ${MK_GROFF} != "no"
1002   _groff=         gnu/usr.bin/groff
841 .else
842 _groff=         gnu/usr.bin/groff/tmac
1003   .endif
1004 +
1005 + .if ${BOOTSTRAPPING} >= 4000 && ${BOOTSTRAPPING} < 4016
1006 + _ar=            usr.bin/ar
1007   .endif
1008  
1009 < .if ${BOOTSTRAPPING} < 700018
1009 > .if ${BOOTSTRAPPING} < 4016
1010 > _mklocale=      usr.bin/mklocale
1011 > .endif
1012 >
1013 > .if ${BOOTSTRAPPING} < 4016
1014 > _sed=           usr.bin/sed
1015 > .endif
1016 >
1017 > .if ${BOOTSTRAPPING} < 4016
1018 > _lex=           usr.bin/lex
1019 > .endif
1020 >
1021 > .if ${BOOTSTRAPPING} < 4016
1022 > _yacc=          usr.bin/yacc
1023 > .endif
1024 >
1025 > .if ${BOOTSTRAPPING} >= 4016
1026 > _awk=           usr.bin/awk
1027 > .endif
1028 >
1029 > .if ${MK_BSNMP} != "no" && \
1030 >    (${BOOTSTRAPPING} < 4015 || !exists(/usr/sbin/gensnmptree))
1031   _gensnmptree=   usr.sbin/bsnmpd/gensnmptree
1032   .endif
1033  
1034   .if ${MK_RESCUE} != "no" && \
1035 <    ${BOOTSTRAPPING} < 700026
1035 >    ${BOOTSTRAPPING} < 4015
1036   _crunchgen=     usr.sbin/crunch/crunchgen
1037   .endif
1038  
1039 + .if ${MK_CLANG} != "no"
1040 + _clang_tblgen= \
1041 +        lib/clang/libllvmsupport \
1042 +        lib/clang/libllvmtablegen \
1043 +        usr.bin/clang/tblgen \
1044 +        usr.bin/clang/clang-tblgen
1045 + .endif
1046 +
1047 + .if ${MK_CDDL} != "no" && \
1048 +    ${BOOTSTRAPPING} < 4016 && \
1049 +    !(${BOOTSTRAPPING} >= 4000 && ${BOOTSTRAPPING} < 4016)
1050 + _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1051 +    lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1052 + .endif
1053 +
1054 + .if ${MK_FDT} != "no"
1055 + _dtc= gnu/usr.bin/dtc
1056 + .endif
1057 +
1058 + #       Please document (add comment) why something is in 'bootstrap-tools'.
1059 + #       Try to bound the building of the bootstrap-tool to just the
1060 + #       MidnightBSD versions that need the tool built at this stage of the build.
1061   bootstrap-tools:
1062   .for _tool in \
1063 +    ${_clang_tblgen} \
1064 +    ${_dtrace_tools} \
1065      ${_strfile} \
1066      ${_gperf} \
1067      ${_groff} \
1068 +    ${_ar} \
1069 +    ${_dtc} \
1070 +    ${_awk} \
1071      usr.bin/lorder \
1072      usr.bin/makewhatis \
1073 +    ${_mklocale} \
1074      usr.bin/rpcgen \
1075 +    ${_sed} \
1076 +    ${_yacc} \
1077 +    ${_lex} \
1078      usr.bin/xinstall \
1079      ${_gensnmptree} \
1080      usr.sbin/config \
1081 <    ${_crunchgen} \
1081 >    ${_crunchgen}
1082          ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1083                  cd ${.CURDIR}/${_tool}; \
1084                  ${MAKE} DIRPRFX=${_tool}/ obj; \
# Line 883 | Line 1098 | _aicasm= sys/modules/aic7xxx/aicasm
1098   _share= share/syscons/scrnmaps
1099   .endif
1100  
1101 + .if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no"
1102 + _gcc_tools= gnu/usr.bin/cc/cc_tools
1103 + .endif
1104 +
1105   .if ${MK_KERBEROS} != "no"
1106   _kerberos5_tools= kerberos5/tools
1107   .endif
# Line 902 | Line 1121 | build-tools:
1121      ${_aicasm} \
1122      usr.bin/awk \
1123      lib/libmagic \
1124 <    usr.sbin/sysinstall
1124 >    usr.sbin/sysinstall \
1125 >    usr.bin/mkesdb_static \
1126 >    usr.bin/mkcsmapper_static
1127          ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1128                  cd ${.CURDIR}/${_tool}; \
1129                  ${MAKE} DIRPRFX=${_tool}/ obj; \
1130                  ${MAKE} DIRPRFX=${_tool}/ build-tools
1131   .endfor
1132   .for _tool in \
1133 <    gnu/usr.bin/cc/cc_tools \
1133 >    ${_gcc_tools} \
1134      ${_kerberos5_tools}
1135          ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1136                  cd ${.CURDIR}/${_tool}; \
# Line 921 | Line 1142 | build-tools:
1142   #
1143   # cross-tools: Build cross-building tools
1144   #
1145 < .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1145 > .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 4012
1146   .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1147   _btxld=         usr.sbin/btxld
1148   .endif
1149 + .endif
1150 + .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1151   .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1152   _crunchide=     usr.sbin/crunch/crunchide
1153   .endif
# Line 933 | Line 1156 | _kgzip=                usr.sbin/kgzip
1156   .endif
1157   .endif
1158  
1159 + .if ${MK_BINUTILS} != "no"
1160 + _binutils=      gnu/usr.bin/binutils
1161 + .endif
1162 +
1163 + .if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")
1164 + _clang=         usr.bin/clang
1165 + _clang_libs=    lib/clang
1166 + .endif
1167 +
1168 + .if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no"
1169 + _cc=            gnu/usr.bin/cc
1170 + .endif
1171 +
1172   cross-tools:
1173   .for _tool in \
1174 <    gnu/usr.bin/binutils \
1175 <    gnu/usr.bin/cc \
1176 <    usr.bin/sed \
1174 >    ${_clang_libs} \
1175 >    ${_clang} \
1176 >    ${_binutils} \
1177 >    ${_cc} \
1178      usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1179      ${_btxld} \
1180      ${_crunchide} \
# Line 973 | Line 1210 | libraries:
1210   #
1211   # static libgcc.a prerequisite for shared libc
1212   #
1213 < _prereq_libs= gnu/lib/libgcc
1213 > _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1214  
1215   # These dependencies are not automatically generated:
1216   #
# Line 983 | Line 1220 | _prereq_libs= gnu/lib/libgcc
1220   _startup_libs=  gnu/lib/csu
1221   .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1222   _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1223 < .else
1223 > .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1224   _startup_libs+= lib/csu/${MACHINE_ARCH}
1225 + .else
1226 + _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1227   .endif
1228   _startup_libs+= gnu/lib/libgcc
1229 + _startup_libs+= lib/libcompiler_rt
1230   _startup_libs+= lib/libc
1231 + .if ${MK_LIBCPLUSPLUS} != "no"
1232 + _startup_libs+= lib/libcxxrt
1233 + .endif
1234  
1235   gnu/lib/libgcc__L: lib/libc__L
1236 + .if ${MK_LIBCPLUSPLUS} != "no"
1237 + lib/libcxxrt__L: gnu/lib/libgcc__L
1238 + .endif
1239  
1240 < _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libkrb5} \
1240 > _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libhdb} \
1241 >                ${_kerberos5_lib_libheimntlm} \
1242 >                ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1243                  ${_kerberos5_lib_libroken} \
1244 <                lib/libbz2 lib/libcom_err lib/libcrypt lib/libexpat \
1244 >                lib/libbz2 lib/libcom_err lib/libcrypt \
1245 >                lib/libexpat \
1246                  ${_lib_libgssapi} ${_lib_libipx} \
1247 <                lib/libkiconv lib/libkvm lib/libmd \
1247 >                lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
1248                  lib/ncurses/ncurses lib/ncurses/ncursesw \
1249 <                lib/libopie lib/libpam ${_default_thread_lib} \
1250 <                lib/libradius lib/libsbuf lib/libtacplus lib/libutil \
1251 <                ${_lib_libypclnt} lib/libz lib/msun \
1249 >                lib/libopie lib/libpam ${_lib_libthr} \
1250 >                lib/libradius lib/libsbuf lib/libtacplus \
1251 >                ${_cddl_lib_libumem} \
1252 >                lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1253                  ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1254 <                ${_secure_lib_libssl}
1254 >                ${_secure_lib_libssl} lib/libsqlite3 \
1255 >        lib/libarchive lib/libfetch lib/libmagic
1256 > .if ${MK_LIBTHR} != "no"
1257 > _lib_libthr=    lib/libthr
1258 > .endif
1259  
1260 < .if ${MK_LIBTHR} != "no" && ${MK_LIBKSE} != "no"
1261 < _default_thread_lib=    lib/${DEFAULT_THREAD_LIB}
1008 < .elif ${MK_LIBTHR} != "no"
1009 < _default_thread_lib=    lib/libthr
1010 < .elif ${MK_LIBKSE} != "no"
1011 < _default_thread_lib=    lib/libkse
1260 > .if ${MK_OFED} != "no"
1261 > _ofed_lib=      contrib/ofed/usr.lib/
1262   .endif
1263  
1264 < _generic_libs=  ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib
1264 > _generic_libs=  ${_apache_lib} ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1265  
1266   lib/libopie__L lib/libtacplus__L: lib/libmd__L
1267  
1268 + .if ${MK_APACHE} != "no"
1269 + _apache_lib= apache/lib
1270 + .endif
1271 +
1272   .if ${MK_CDDL} != "no"
1273 + _cddl_lib_libumem= cddl/lib/libumem
1274   _cddl_lib= cddl/lib
1275   .endif
1276  
# Line 1027 | Line 1282 | lib/libradius__L secure/lib/libssl__L: secure/lib/libc
1282   .if ${MK_OPENSSH} != "no"
1283   _secure_lib_libssh= secure/lib/libssh
1284   secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1285 < .if ${MK_KERBEROS} != "no"
1285 > .if ${MK_KERBEROS_SUPPORT} != "no"
1286   secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1287 <    kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \
1288 <    kerberos5/lib/libroken__L
1287 >    kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1288 >    lib/libmd__L kerberos5/lib/libroken__L
1289   .endif
1290   .endif
1291   .endif
1292   _secure_lib=    secure/lib
1293   .endif
1294  
1295 + .if ${MK_KERBEROS} != "no"
1296 + kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1297 + kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1298 +    kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L
1299 + kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L
1300 + kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1301 +    secure/lib/libcrypto__L kerberos5/lib/libroken__L
1302 + kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1303 +    lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1304 +    kerberos5/lib/libroken__L
1305 + kerberos5/lib/libroken__L: lib/libcrypt__L
1306 + .endif
1307 +
1308 + .if ${MK_GSSAPI} != "no"
1309 + _lib_libgssapi= lib/libgssapi
1310 + .endif
1311 +
1312   .if ${MK_IPX} != "no"
1313   _lib_libipx=    lib/libipx
1314   .endif
# Line 1044 | Line 1316 | _lib_libipx=   lib/libipx
1316   .if ${MK_KERBEROS} != "no"
1317   _kerberos5_lib= kerberos5/lib
1318   _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1319 + _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1320   _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1321 + _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1322   _kerberos5_lib_libroken= kerberos5/lib/libroken
1323 < _lib_libgssapi= lib/libgssapi
1323 > _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1324   .endif
1325  
1326   .if ${MK_NIS} != "no"
# Line 1142 | Line 1416 | delete-old-files:
1416          @echo ">>> Removing old files (only deletes safe to delete libs)"
1417   # Ask for every old file if the user really wants to remove it.
1418   # It's annoying, but better safe than sorry.
1419 <        @for file in ${OLD_FILES}; do \
1419 > # NB: We cannot pass the list of OLD_FILES as a parameter because the
1420 > # argument list will get too long. Using .for/.endfor make "loops" will make
1421 > # the Makefile parser segfault.
1422 >        @exec 3<&0; \
1423 >        ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1424 >            -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1425 >        while read file; do \
1426                  if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1427                          chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1428 <                        rm ${RM_I} "${DESTDIR}/$${file}"; \
1428 >                        rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1429                  fi; \
1430          done
1431   # Remove catpages without corresponding manpages.
1432 <        @3<&0; \
1432 >        @exec 3<&0; \
1433          find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1434          sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1435          while read catpage; do \
1436                  read manpage; \
1437                  if [ ! -e "$${manpage}" ]; then \
1438 <                        rm ${RM_I} $${catpage} <&3 ; \
1438 >                        rm ${RM_I} $${catpage} <&3; \
1439                  fi; \
1440          done
1441          @echo ">>> Old files removed"
1442  
1443   check-old-files:
1444          @echo ">>> Checking for old files"
1445 <        @for file in ${OLD_FILES}; do \
1445 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1446 >            -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1447 >        while read file; do \
1448                  if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1449                          echo "${DESTDIR}/$${file}"; \
1450                  fi; \
# Line 1173 | Line 1455 | check-old-files:
1455          while read catpage; do \
1456                  read manpage; \
1457                  if [ ! -e "$${manpage}" ]; then \
1458 <                        echo $${catpage} ; \
1458 >                        echo $${catpage}; \
1459                  fi; \
1460          done
1461  
1462   delete-old-libs:
1463          @echo ">>> Removing old libraries"
1464          @echo "${OLD_LIBS_MESSAGE}" | fmt
1465 <        @for file in ${OLD_LIBS}; do \
1465 >        @exec 3<&0; \
1466 >        ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1467 >            -V OLD_LIBS | xargs -n1 | \
1468 >        while read file; do \
1469                  if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1470                          chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1471 <                        rm ${RM_I} "${DESTDIR}/$${file}"; \
1471 >                        rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1472                  fi; \
1473          done
1474          @echo ">>> Old libraries removed"
1475  
1476   check-old-libs:
1477          @echo ">>> Checking for old libraries"
1478 <        @for file in ${OLD_LIBS}; do \
1478 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1479 >            -V OLD_LIBS | xargs -n1 | \
1480 >        while read file; do \
1481                  if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1482                          echo "${DESTDIR}/$${file}"; \
1483                  fi; \
# Line 1198 | Line 1485 | check-old-libs:
1485  
1486   delete-old-dirs:
1487          @echo ">>> Removing old directories"
1488 <        @for dir in ${OLD_DIRS}; do \
1488 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1489 >            -V OLD_DIRS | xargs -n1 | \
1490 >        while read dir; do \
1491                  if [ -d "${DESTDIR}/$${dir}" ]; then \
1492                          rmdir -v "${DESTDIR}/$${dir}" || true; \
1493                  elif [ -L "${DESTDIR}/$${dir}" ]; then \
# Line 1209 | Line 1498 | delete-old-dirs:
1498  
1499   check-old-dirs:
1500          @echo ">>> Checking for old directories"
1501 <        @for dir in ${OLD_DIRS}; do \
1501 >        @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1502 >            -V OLD_DIRS | xargs -n1 | \
1503 >        while read dir; do \
1504                  if [ -d "${DESTDIR}/$${dir}" ]; then \
1505                          echo "${DESTDIR}/$${dir}"; \
1506                  elif [ -L "${DESTDIR}/$${dir}" ]; then \
# Line 1231 | Line 1522 | check-old: check-old-files check-old-libs check-old-di
1522   #
1523   showconfig:
1524          @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
1525 +
1526 + .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1527 + DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1528 +
1529 + .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1530 + .if exists(${KERNCONFDIR}/${KERNCONF})
1531 + FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1532 +        ${KERNCONFDIR}/${KERNCONF}
1533 + .endif
1534 + .endif
1535 +
1536 + .endif
1537 +
1538 + .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1539 + DTBOUTPUTPATH= ${.CURDIR}
1540 + .endif
1541 +
1542 + #
1543 + # Build 'standalone' Device Tree Blob
1544 + #
1545 + builddtb:
1546 +        @if [ "${FDT_DTS_FILE}" = "" ]; then \
1547 +                echo "ERROR: FDT_DTS_FILE must be specified!"; \
1548 +                exit 1; \
1549 +        fi;     \
1550 +        if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
1551 +                echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1552 +                        exist!"; \
1553 +                exit 1; \
1554 +        fi;     \
1555 +        if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then  \
1556 +                echo "WARNING: DTB will be placed in the current working \
1557 +                        directory"; \
1558 +        fi
1559 +        @PATH=${TMPPATH} \
1560 +        dtc -O dtb -o \
1561 +            ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
1562 +            -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
1563 +
1564 + ###############
1565 +
1566 + .if defined(XDEV) && defined(XDEV_ARCH)
1567 +
1568 + .if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
1569 + XDEV_CPUTYPE?=${CPUTYPE}
1570 + .else
1571 + XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1572 + .endif
1573 +
1574 + NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1575 +        -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
1576 +        -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \
1577 +        TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
1578 +        CPUTYPE=${XDEV_CPUTYPE}
1579 +
1580 + XDDIR=${XDEV_ARCH}-midnightbsd
1581 + XDTP=/usr/${XDDIR}
1582 + CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR}
1583 + CDENV= ${CDBENV} \
1584 +        _SHLIBDIRPREFIX=${XDTP} \
1585 +        TOOLS_PREFIX=${XDTP}
1586 + CD2ENV=${CDENV} \
1587 +        MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1588 +
1589 + CDTMP=  ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
1590 + CDMAKE=${CDENV} ${MAKE} ${NOFUN}
1591 + CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1592 + XDDESTDIR=${DESTDIR}${XDTP}
1593 + .if !defined(OSREL)
1594 + OSREL!= uname -r | sed -e 's/[-(].*//'
1595 + .endif
1596 +
1597 + .ORDER: xdev-build xdev-install
1598 + xdev: xdev-build xdev-install
1599 +
1600 + .ORDER: _xb-build-tools _xb-cross-tools
1601 + xdev-build: _xb-build-tools _xb-cross-tools
1602 +
1603 + _xb-build-tools:
1604 +        ${_+_}@cd ${.CURDIR}; \
1605 +        ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1606 +
1607 + _xb-cross-tools:
1608 + .for _tool in \
1609 +    gnu/usr.bin/binutils \
1610 +    gnu/usr.bin/cc \
1611 +    usr.bin/ar
1612 +        ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1613 +        cd ${.CURDIR}/${_tool}; \
1614 +        ${CDMAKE} DIRPRFX=${_tool}/ obj; \
1615 +        ${CDMAKE} DIRPRFX=${_tool}/ depend; \
1616 +        ${CDMAKE} DIRPRFX=${_tool}/ all
1617 + .endfor
1618 +
1619 + _xi-mtree:
1620 +        ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1621 +        mkdir -p ${XDDESTDIR}
1622 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1623 +            -p ${XDDESTDIR} >/dev/null
1624 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1625 +            -p ${XDDESTDIR}/usr >/dev/null
1626 +        mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1627 +            -p ${XDDESTDIR}/usr/include >/dev/null
1628 +
1629 + .ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1630 + xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1631 +
1632 + _xi-cross-tools:
1633 +        @echo "_xi-cross-tools"
1634 + .for _tool in \
1635 +    gnu/usr.bin/binutils \
1636 +    gnu/usr.bin/cc \
1637 +    usr.bin/ar
1638 +        ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1639 +        cd ${.CURDIR}/${_tool}; \
1640 +        ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1641 + .endfor
1642 +
1643 + _xi-includes:
1644 +        ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1645 +                DESTDIR=${XDDESTDIR}
1646 +
1647 + _xi-libraries:
1648 +        ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1649 +                DESTDIR=${XDDESTDIR}
1650 +
1651 + _xi-links:
1652 +        ${_+_}cd ${XDDESTDIR}/usr/bin; \
1653 +                for i in *; do \
1654 +                        ln -sf ../../${XDTP}/usr/bin/$$i \
1655 +                            ../../../../usr/bin/${XDDIR}-$$i; \
1656 +                        ln -sf ../../${XDTP}/usr/bin/$$i \
1657 +                            ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
1658 +                done
1659 + .endif

Comparing trunk/Makefile.inc1 (property cvs2svn:cvs-rev):
Revision 2744 by laffer1, Sun Apr 5 23:35:06 2009 UTC vs.
Revision 5123 by laffer1, Sun Aug 19 14:05:10 2012 UTC

# Line 1 | Line 1
1 < 1.16
1 > 1.43

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines