Makefile.inc1 revision 189760
12089Ssos# 216565Ssos# $FreeBSD: head/Makefile.inc1 189760 2009-03-13 07:23:58Z imp $ 32089Ssos# 42089Ssos# Make command line options: 52089Ssos# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 62089Ssos# -DNO_CLEAN do not clean at all 72089Ssos# -DNO_SHARE do not go into share subdir 82089Ssos# -DKERNFAST define NO_KERNELCONFIG, NO_KERNELCLEAN and NO_KERNELCONFIG 95994Ssos# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 105994Ssos# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 112089Ssos# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel 122089Ssos# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 132089Ssos# -DNO_DOCUPDATE do not update doc in ${MAKE} update 142089Ssos# -DNO_CTF do not run the DTrace CTF conversion tools on built objects 152089Ssos# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 162089Ssos# TARGET="machine" to crossbuild world for a different machine type 172089Ssos 182089Ssos# 192089Ssos# The intended user-driven targets are: 202089Ssos# buildworld - rebuild *everything*, including glue to help do upgrades 212089Ssos# installworld- install everything built by "buildworld" 222089Ssos# doxygen - build API documentation of the kernel 232089Ssos# update - convenient way to update your source tree (eg: cvsup/cvs) 242089Ssos# 252089Ssos# Standard targets (not defined here) are documented in the makefiles in 262089Ssos# /usr/share/mk. These include: 272089Ssos# obj depend all install clean cleandepend cleanobj 282089Ssos 2930764Scharnier.include <bsd.own.mk> 3030764Scharnier 3139287Ssos.if ${MACHINE_ARCH} == "mips" 3230764ScharnierMK_RESCUE=no # not yet 3330764Scharnier.endif 342089Ssos 3530764Scharnier# We must do share/info early so that installation of info `dir' 362089Ssos# entries works correctly. Do it first since it is less likely to 3723457Sbrian# grow dependencies on include and lib than vice versa. 3830764Scharnier# 3923702Speter# We must do lib/ and libexec/ before bin/, because if installworld 402089Ssos# installs a new /bin/sh, the 'make' command will *immediately* 412089Ssos# use that new version. And the new (dynamically-linked) /bin/sh 422089Ssos# will expect to find appropriate libraries in /lib and /libexec. 4323457Sbrian# 442089SsosSUBDIR= share/info lib libexec 452089SsosSUBDIR+=bin 462089Ssos.if ${MK_GAMES} != "no" 472089SsosSUBDIR+=games 482089Ssos.endif 492089Ssos.if ${MK_CDDL} != "no" 506628SsosSUBDIR+=cddl 512089Ssos.else 526047SsosNO_CTF=1 532089Ssos.endif 542089SsosSUBDIR+=gnu include 552089Ssos.if ${MK_KERBEROS} != "no" 562089SsosSUBDIR+=kerberos5 5730764Scharnier.endif 586628Ssos.if ${MK_RESCUE} != "no" 596628SsosSUBDIR+=rescue 6030764Scharnier.endif 6130764ScharnierSUBDIR+=sbin 6230764Scharnier.if ${MK_CRYPT} != "no" 6330764ScharnierSUBDIR+=secure 6430764Scharnier.endif 656628Ssos.if !defined(NO_SHARE) 666628SsosSUBDIR+=share 672089Ssos.endif 682089SsosSUBDIR+=sys usr.bin usr.sbin 692089Ssos# 702089Ssos# We must do etc/ last for install/distribute to work. 712089Ssos# 7230764ScharnierSUBDIR+=etc 732089Ssos 742089Ssos# These are last, since it is nice to at least get the base system 752089Ssos# rebuilt before you do them. 762089Ssos.for _DIR in ${LOCAL_DIRS} 772089Ssos.if exists(${.CURDIR}/${_DIR}/Makefile) 782089SsosSUBDIR+= ${_DIR} 796628Ssos.endif 806628Ssos.endfor 816628Ssos 822089Ssos.if defined(SUBDIR_OVERRIDE) 832089SsosSUBDIR= ${SUBDIR_OVERRIDE} 842089Ssos.endif 852089Ssos 862089Ssos.if defined(NOCLEAN) 872089SsosNO_CLEAN= ${NOCLEAN} 882089Ssos.endif 892089Ssos.if defined(NO_CLEANDIR) 902089SsosCLEANDIR= clean cleandepend 912089Ssos.else 922089SsosCLEANDIR= cleandir 932089Ssos.endif 942089Ssos 952089SsosCVS?= cvs 962089SsosCVSFLAGS?= -A -P -d -I! 972089SsosSUP?= /usr/bin/csup 982089SsosSUPFLAGS?= -g -L 2 992089Ssos.if defined(SUPHOST) 1002089SsosSUPFLAGS+= -h ${SUPHOST} 1012089Ssos.endif 1022089Ssos 1032089SsosMAKEOBJDIRPREFIX?= /usr/obj 10423457Sbrian.if !defined(OSRELDATE) 1052089Ssos.if exists(/usr/include/osreldate.h) 1062089SsosOSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 1072089Ssos /usr/include/osreldate.h 1082089Ssos.else 1092089SsosOSRELDATE= 0 1102089Ssos.endif 1112089Ssos.endif 1122089Ssos 11323457Sbrian.if !defined(VERSION) 11423457SbrianVERSION!= uname -srp 1152089SsosVERSION+= ${OSRELDATE} 1162089Ssos.endif 1172089Ssos 11830764Scharnier# Guess machine architecture from machine type, and vice versa. 1192089Ssos.if !defined(TARGET_ARCH) && defined(TARGET) 1202089SsosTARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/} 1212089Ssos.elif !defined(TARGET) && defined(TARGET_ARCH) && \ 12223457Sbrian ${TARGET_ARCH} != ${MACHINE_ARCH} 1232089SsosTARGET= ${TARGET_ARCH} 1242089Ssos.endif 12530764Scharnier# Otherwise, default to current machine type and architecture. 12623457SbrianTARGET?= ${MACHINE} 1272089SsosTARGET_ARCH?= ${MACHINE_ARCH} 1282089Ssos 1292089SsosKNOWN_ARCHES?= amd64 arm i386 i386/pc98 ia64 mips powerpc sparc64 sparc64/sun4v 1302089Ssos.if ${TARGET} == ${TARGET_ARCH} 13130764Scharnier_t= ${TARGET} 13223457Sbrian.else 1332089Ssos_t= ${TARGET_ARCH}/${TARGET} 1342089Ssos.endif 1352089Ssos.for _t in ${_t} 1362089Ssos.if empty(KNOWN_ARCHES:M${_t}) 1372089Ssos.error Unknown target ${TARGET_ARCH}:${TARGET}. 1386628Ssos.endif 1392089Ssos.endfor 1402089Ssos 1412089Ssos.if ${TARGET} == ${MACHINE} 1422089SsosTARGET_CPUTYPE?=${CPUTYPE} 1432089Ssos.else 14430764ScharnierTARGET_CPUTYPE?= 1452089Ssos.endif 1462089Ssos 1472089Ssos.if !empty(TARGET_CPUTYPE) 1482089Ssos_TARGET_CPUTYPE=${TARGET_CPUTYPE} 1492089Ssos.else 1502089Ssos_TARGET_CPUTYPE=dummy 1512089Ssos.endif 1522089Ssos_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ 1532089Ssos -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE 15430764Scharnier.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 1552089Ssos.error CPUTYPE global should be set with ?=. 1562089Ssos.endif 1572089Ssos.if make(buildworld) 1582089SsosBUILD_ARCH!= uname -p 1592089Ssos.if ${MACHINE_ARCH} != ${BUILD_ARCH} 1602089Ssos.error To cross-build, set TARGET_ARCH. 1618857Srgrimes.endif 1622089Ssos.endif 1632089Ssos.if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING) 1642089SsosOBJTREE= ${MAKEOBJDIRPREFIX} 1652089Ssos.else 1662089SsosOBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET} 1672089Ssos.endif 1682089SsosWORLDTMP= ${OBJTREE}${.CURDIR}/tmp 1698857Srgrimes# /usr/games added for fortune which depend on strfile 1702089SsosBPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games 1712089SsosXPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games 17223457SbrianSTRICTTMPPATH= ${BPATH}:${XPATH} 17337636SbdeTMPPATH= ${STRICTTMPPATH}:${PATH} 17437636Sbde 1752089Ssos# 1762089Ssos# Avoid running mktemp(1) unless actually needed. 1772089Ssos# It may not be functional, e.g., due to new ABI 1782089Ssos# when in the middle of installing over this system. 1792089Ssos# 1802089Ssos.if make(distributeworld) || make(installworld) 18123457SbrianINSTALLTMP!= /usr/bin/mktemp -d -u -t install 18223457Sbrian.endif 1832089Ssos 1842089Ssos# 1852089Ssos# Building a world goes through the following stages 18630764Scharnier# 1872089Ssos# 1. legacy stage [BMAKE] 1882089Ssos# This stage is responsible for creating compatibility 1892089Ssos# shims that are needed by the bootstrap-tools, 1902089Ssos# build-tools and cross-tools stages. 1912089Ssos# 1. bootstrap-tools stage [BMAKE] 1922089Ssos# This stage is responsible for creating programs that 1932089Ssos# are needed for backward compatibility reasons. They 1942089Ssos# are not built as cross-tools. 1952089Ssos# 2. build-tools stage [TMAKE] 1962089Ssos# This stage is responsible for creating the object 1972089Ssos# tree and building any tools that are needed during 1982089Ssos# the build process. 1992089Ssos# 3. cross-tools stage [XMAKE] 2002089Ssos# This stage is responsible for creating any tools that 2012089Ssos# are needed for cross-builds. A cross-compiler is one 20230764Scharnier# of them. 20323457Sbrian# 4. world stage [WMAKE] 2042089Ssos# This stage actually builds the world. 2052089Ssos# 5. install stage (optional) [IMAKE] 2062089Ssos# This stage installs a previously built world. 2072089Ssos# 2082089Ssos 2092089SsosBOOTSTRAPPING?= 0 21030764Scharnier 21123457Sbrian# Common environment for world related stages 2122089SsosCROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ 2132089Ssos MACHINE_ARCH=${TARGET_ARCH} \ 2142089Ssos MACHINE=${TARGET} \ 2152089Ssos CPUTYPE=${TARGET_CPUTYPE} \ 2162089Ssos GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 21730764Scharnier GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 21823457Sbrian GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 2192089Ssos.if ${OSRELDATE} < 700044 2202089SsosCROSSENV+= AR=gnu-ar RANLIB=gnu-ranlib 2212089Ssos.endif 2222089Ssos 2232089Ssos# bootstrap-tools stage 2242089SsosBMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 2252089Ssos PATH=${BPATH}:${PATH} \ 2262089Ssos WORLDTMP=${WORLDTMP} \ 2272089Ssos VERSION="${VERSION}" \ 2282089Ssos MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" 2292089SsosBMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 2302089Ssos ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 2312089Ssos DESTDIR= \ 23230764Scharnier BOOTSTRAPPING=${OSRELDATE} \ 2332089Ssos SSP_CFLAGS= \ 2342089Ssos -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ 2352089Ssos -DWITHOUT_NLS -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \ 2362089Ssos -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF 23730764Scharnier 2382089Ssos# build-tools stage 2392089SsosTMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 2402089Ssos ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 2415536Ssos TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 2422089Ssos DESTDIR= \ 2435536Ssos SSP_CFLAGS= \ 2442089Ssos BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS \ 2456230Ssos -DNO_WARNS -DNO_CTF 2466230Ssos 2476230Ssos# cross-tools stage 2485536SsosXMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ 2496230Ssos TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 2506230Ssos -DWITHOUT_GDB 2515536Ssos 25230764Scharnier# world stage 2532089SsosWMAKEENV= ${CROSSENV} \ 2542089Ssos _SHLIBDIRPREFIX=${WORLDTMP} \ 2555536Ssos VERSION="${VERSION}" \ 2562089Ssos INSTALL="sh ${.CURDIR}/tools/install.sh" \ 2572089Ssos PATH=${TMPPATH} 25823457Sbrian.if ${MK_CDDL} == "no" || defined(NO_CTF) 2592089SsosWMAKEENV+= NO_CTF=1 2602089Ssos.endif 26137636SbdeWMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} 26239287Ssos 2632089Ssos.if ${TARGET_ARCH} == "amd64" 2642089Ssos# 32 bit world 2652784SsosLIB32TMP= ${OBJTREE}${.CURDIR}/lib32 2662784Ssos 2672784Ssos.if empty(TARGET_CPUTYPE) 2682784SsosLIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 2695536Ssos.else 2705536SsosLIB32CPUFLAGS= -march=${TARGET_CPUTYPE} 2712784Ssos.endif 2722784SsosLIB32FLAGS= -m32 ${LIB32CPUFLAGS} -mfancy-math-387 -DCOMPAT_32BIT \ 2735536Ssos -iprefix ${LIB32TMP}/usr/ \ 2745536Ssos -L${LIB32TMP}/usr/lib32 \ 2752784Ssos -B${LIB32TMP}/usr/lib32 2762784Ssos 2772784Ssos# Yes, the flags are redundant. 2782784SsosLIB32WMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ 2792784Ssos _SHLIBDIRPREFIX=${LIB32TMP} \ 2802784Ssos VERSION="${VERSION}" \ 28139287Ssos MACHINE=i386 \ 28239287Ssos MACHINE_ARCH=i386 \ 28339287Ssos INSTALL="sh ${.CURDIR}/tools/install.sh" \ 28439287Ssos PATH=${TMPPATH} \ 28539287Ssos CC="${CC} ${LIB32FLAGS}" \ 28639287Ssos CXX="${CXX} ${LIB32FLAGS}" \ 28739287Ssos OBJC="${OBJC} ${LIB32FLAGS}" \ 28839287Ssos LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \ 28939287Ssos AS="${AS} --32" \ 29039287Ssos LIBDIR=/usr/lib32 \ 2912089Ssos SHLIBDIR=/usr/lib32 2922089Ssos 2932089SsosLIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \ 29430764Scharnier -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_INFO \ 29539287Ssos -DWITHOUT_HTML -DNO_CTF DESTDIR=${LIB32TMP} 29639287SsosLIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS 29739287Ssos.endif 29839287Ssos 29939287Ssos# install stage 30039287SsosIMAKEENV= ${CROSSENV} 30139287SsosIMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 3022089Ssos.if empty(.MAKEFLAGS:M-n) 3032089SsosIMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ 3042089Ssos LD_LIBRARY_PATH=${INSTALLTMP} \ 3052089Ssos PATH_LOCALE=${INSTALLTMP}/locale 3068857SrgrimesIMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh 3072089Ssos.else 3082089SsosIMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} 3092089Ssos.endif 3102089Ssos 3112089Ssos# kernel stage 3122089SsosKMAKEENV= ${WMAKEENV} 3132089SsosKMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} 3142089Ssos 3152089Ssos# 3162089Ssos# buildworld 3172089Ssos# 31823457Sbrian# Attempt to rebuild the entire system, with reasonable chance of 3192089Ssos# success, regardless of how old your existing system is. 3202089Ssos# 3212089Ssos_worldtmp: 3222089Ssos.if ${.CURDIR:C/[^,]//g} != "" 3232089Ssos# The m4 build of sendmail files doesn't like it if ',' is used 3242089Ssos# anywhere in the path of it's files. 3252089Ssos @echo 3268857Srgrimes @echo "*** Error: path to source tree contains a comma ','" 3278857Srgrimes @echo 3282089Ssos false 3292089Ssos.endif 3302089Ssos @echo 3312089Ssos @echo "--------------------------------------------------------------" 3322089Ssos @echo ">>> Rebuilding the temporary build tree" 3332089Ssos @echo "--------------------------------------------------------------" 3342089Ssos.if !defined(NO_CLEAN) 33523457Sbrian rm -rf ${WORLDTMP} 3362089Ssos.if ${TARGET_ARCH} == "amd64" 3372089Ssos rm -rf ${LIB32TMP} 3382089Ssos.endif 3392089Ssos.else 3402089Ssos rm -rf ${WORLDTMP}/legacy/usr/include 3412089Ssos# XXX - These three can depend on any header file. 3428857Srgrimes rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c 3438857Srgrimes rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c 3442089Ssos rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c 3452089Ssos.endif 3462089Ssos.for _dir in \ 3472089Ssos usr/bin usr/games usr/include/sys usr/lib \ 3482089Ssos usr/libexec usr/sbin usr/share/dict \ 3492089Ssos usr/share/groff_font/devX100 \ 3502089Ssos usr/share/groff_font/devX100-12 \ 35123457Sbrian usr/share/groff_font/devX75 \ 35223457Sbrian usr/share/groff_font/devX75-12 \ 35323457Sbrian usr/share/groff_font/devascii \ 35423457Sbrian usr/share/groff_font/devcp1047 \ 35523457Sbrian usr/share/groff_font/devdvi \ 35623457Sbrian usr/share/groff_font/devhtml \ 35730764Scharnier usr/share/groff_font/devkoi8-r \ 35823457Sbrian usr/share/groff_font/devlatin1 \ 35923457Sbrian usr/share/groff_font/devlbp \ 36023457Sbrian usr/share/groff_font/devlj4 \ 36123457Sbrian usr/share/groff_font/devps \ 36223457Sbrian usr/share/groff_font/devutf8 \ 36330764Scharnier usr/share/tmac/mdoc usr/share/tmac/mm 36423457Sbrian mkdir -p ${WORLDTMP}/legacy/${_dir} 36530764Scharnier.endfor 36623457Sbrian.for _dir in \ 36723457Sbrian lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \ 36823457Sbrian usr/libexec usr/sbin usr/share/misc 3692089Ssos mkdir -p ${WORLDTMP}/${_dir} 3702089Ssos.endfor 3712089Ssos mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 3722089Ssos -p ${WORLDTMP}/usr/include >/dev/null 3732089Ssos ln -sf ${.CURDIR}/sys ${WORLDTMP} 3742089Ssos.if ${MK_BIND_LIBS} != "no" 3752089Ssos mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \ 3762089Ssos -p ${WORLDTMP}/usr/include >/dev/null 3778857Srgrimes.endif 3782089Ssos_legacy: 3792089Ssos @echo 38016565Ssos @echo "--------------------------------------------------------------" 38116565Ssos @echo ">>> stage 1.1: legacy release compatibility shims" 38216565Ssos @echo "--------------------------------------------------------------" 38316565Ssos ${_+_}cd ${.CURDIR}; ${BMAKE} legacy 38416565Ssos_bootstrap-tools: 38516565Ssos @echo 38616565Ssos @echo "--------------------------------------------------------------" 38716565Ssos @echo ">>> stage 1.2: bootstrap tools" 38816565Ssos @echo "--------------------------------------------------------------" 38916565Ssos ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools 39030764Scharnier_cleanobj: 39116565Ssos.if !defined(NO_CLEAN) 39216565Ssos @echo 39316565Ssos @echo "--------------------------------------------------------------" 39416565Ssos @echo ">>> stage 2.1: cleaning up the object tree" 39516565Ssos @echo "--------------------------------------------------------------" 39639287Ssos ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} 39739287Ssos.if ${TARGET_ARCH} == "amd64" 39839287Ssos ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/} 39939287Ssos.endif 40039287Ssos.endif 40139287Ssos_obj: 40239287Ssos @echo 40339287Ssos @echo "--------------------------------------------------------------" 40439287Ssos @echo ">>> stage 2.2: rebuilding the object tree" 40539287Ssos @echo "--------------------------------------------------------------" 40639287Ssos ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj 40739287Ssos_build-tools: 40839287Ssos @echo 40939287Ssos @echo "--------------------------------------------------------------" 41039287Ssos @echo ">>> stage 2.3: build tools" 41139287Ssos @echo "--------------------------------------------------------------" 41239287Ssos ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools 41339287Ssos_cross-tools: 41439287Ssos @echo 41539287Ssos @echo "--------------------------------------------------------------" 41639287Ssos @echo ">>> stage 3: cross tools" 41739287Ssos @echo "--------------------------------------------------------------" 41839287Ssos ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools 41923457Sbrian_includes: 42039287Ssos @echo 42139287Ssos @echo "--------------------------------------------------------------" 42239287Ssos @echo ">>> stage 4.1: building includes" 42339287Ssos @echo "--------------------------------------------------------------" 42439287Ssos ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes 42539287Ssos_libraries: 42639287Ssos @echo 42739287Ssos @echo "--------------------------------------------------------------" 42839287Ssos @echo ">>> stage 4.2: building libraries" 42939287Ssos @echo "--------------------------------------------------------------" 43039287Ssos ${_+_}cd ${.CURDIR}; \ 43139287Ssos ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ 43239287Ssos -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE libraries 43339287Ssos_depend: 43439287Ssos @echo 43539287Ssos @echo "--------------------------------------------------------------" 43639287Ssos @echo ">>> stage 4.3: make dependencies" 43739287Ssos @echo "--------------------------------------------------------------" 43839287Ssos ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend 43939287Ssoseverything: 44039287Ssos @echo 44139287Ssos @echo "--------------------------------------------------------------" 44239287Ssos @echo ">>> stage 4.4: building everything" 44339287Ssos @echo "--------------------------------------------------------------" 44439287Ssos ${_+_}cd ${.CURDIR}; ${WMAKE} par-all 44539287Ssos.if ${TARGET_ARCH} == "amd64" 44639287Ssosbuild32: 44739287Ssos @echo 44839287Ssos @echo "--------------------------------------------------------------" 44939287Ssos @echo ">>> stage 5.1: building 32 bit shim libraries" 45039287Ssos @echo "--------------------------------------------------------------" 45139287Ssos.for _dir in \ 45239287Ssos usr/include usr/lib32 usr/share/misc 45339287Ssos mkdir -p ${LIB32TMP}/${_dir} 45439287Ssos.endfor 45539287Ssos mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 45639287Ssos -p ${LIB32TMP}/usr/include >/dev/null 45739287Ssos mkdir -p ${WORLDTMP} 45839287Ssos ln -sf ${.CURDIR}/sys ${WORLDTMP} 45939287Ssos.if ${MK_KERBEROS} != "no" 46039287Ssos.for _t in obj depend all 46139287Ssos cd ${.CURDIR}/kerberos5/tools; \ 46239287Ssos MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \ 46339287Ssos ${_t} 46439287Ssos.endfor 46539287Ssos.endif 46639287Ssos.for _t in obj includes 46739287Ssos cd ${.CURDIR}/include; ${LIB32WMAKE} ${_t} 46839287Ssos cd ${.CURDIR}/lib; ${LIB32WMAKE} ${_t} 46939287Ssos.if ${MK_CDDL} != "no" 47039287Ssos cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} ${_t} 47139287Ssos.endif 47239287Ssos cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} ${_t} 47339287Ssos.if ${MK_CRYPT} != "no" 47439287Ssos cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} ${_t} 47539287Ssos.endif 47639287Ssos.if ${MK_KERBEROS} != "no" 47739287Ssos cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} ${_t} 47839287Ssos.endif 47939287Ssos.endfor 48039287Ssos.for _dir in usr.bin/lex/lib 48139287Ssos cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} obj 48239287Ssos.endfor 48339287Ssos.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic 48439287Ssos cd ${.CURDIR}/${_dir}; \ 48539287Ssos MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \ 48639287Ssos build-tools 48739287Ssos.endfor 48839287Ssos cd ${.CURDIR}; \ 48939287Ssos ${LIB32WMAKE} -f Makefile.inc1 libraries 49039287Ssos.for _t in obj depend all 49139287Ssos cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} ${_t} 49239287Ssos cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} ${_t} 49339287Ssos.endfor 4942089Ssos 4952089Ssosdistribute32 install32: 4962089Ssos.if make(distribute32) 4972089Ssos mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32 # XXX add to mtree 4982089Ssos mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32/dtrace # XXX add to mtree 4992089Ssos.else 5002089Ssos mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree 5012089Ssos mkdir -p ${DESTDIR}/usr/lib32/dtrace # XXX add to mtree 5022089Ssos.endif 5038857Srgrimes cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 5048857Srgrimes.if ${MK_CDDL} != "no" 5052089Ssos cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 5062089Ssos.endif 5078857Srgrimes cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 5082089Ssos.if ${MK_CRYPT} != "no" 5092089Ssos cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 5102089Ssos.endif 51123457Sbrian.if ${MK_KERBEROS} != "no" 5122089Ssos cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 5132089Ssos.endif 5142089Ssos cd ${.CURDIR}/libexec/rtld-elf; \ 5152089Ssos PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//} 5168857Srgrimes cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//} 5172089Ssos.endif 51830764Scharnier 51930764ScharnierWMAKE_TGTS= 52039287Ssos.if !defined(SUBDIR_OVERRIDE) 5212089SsosWMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools 52216565Ssos.endif 52316565SsosWMAKE_TGTS+= _cleanobj _obj _build-tools 52416565Ssos.if !defined(SUBDIR_OVERRIDE) 5252089SsosWMAKE_TGTS+= _cross-tools 5265536Ssos.endif 5272089SsosWMAKE_TGTS+= _includes _libraries _depend everything 5282089Ssos.if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no" 5292089SsosWMAKE_TGTS+= build32 5302089Ssos.endif 5312089Ssos 5322089Ssosbuildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 5332089Ssos.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 5342089Ssos 53539287Ssosbuildworld_prologue: 53639287Ssos @echo "--------------------------------------------------------------" 53739287Ssos @echo ">>> World build started on `LC_ALL=C date`" 5382089Ssos @echo "--------------------------------------------------------------" 5392089Ssos 5402089Ssosbuildworld_epilogue: 5412089Ssos @echo 5422089Ssos @echo "--------------------------------------------------------------" 5432089Ssos @echo ">>> World build completed on `LC_ALL=C date`" 54416565Ssos @echo "--------------------------------------------------------------" 54516565Ssos 54616565Ssos# 5472089Ssos# We need to have this as a target because the indirection between Makefile 5482089Ssos# and Makefile.inc1 causes the correct PATH to be used, rather than a 5492089Ssos# modification of the current environment's PATH. In addition, we need 55023457Sbrian# to quote multiword values. 55123457Sbrian# 55223457Sbrianbuildenvvars: 5532089Ssos @echo ${WMAKEENV:Q} 5542089Ssos 5552089Ssosbuildenv: 5562089Ssos @echo Entering world for ${TARGET_ARCH}:${TARGET} 5572089Ssos @cd ${.CURDIR} && env ${WMAKEENV} sh || true 5582089Ssos 5592089SsosTOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32} 5602089Ssostoolchain: ${TOOLCHAIN_TGTS} 5612089Ssoskernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} 56223457Sbrian 56323457Sbrian# 5642089Ssos# installcheck 5652089Ssos# 5662089Ssos# Checks to be sure system is ready for installworld/installkernel. 5672089Ssos# 56830764Scharnierinstallcheck: 5692089Ssos 57023457Sbrian# 5712089Ssos# Require DESTDIR to be set if installing for a different architecture. 5722089Ssos# 573.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} 574.if !make(distributeworld) 575installcheck: installcheck_DESTDIR 576installcheck_DESTDIR: 577.if !defined(DESTDIR) || empty(DESTDIR) 578 @echo "ERROR: Please set DESTDIR!"; \ 579 false 580.endif 581.endif 582.endif 583 584# 585# Check for missing UIDs/GIDs. 586# 587CHECK_UIDS= 588CHECK_GIDS= audit 589.if ${MK_SENDMAIL} != "no" 590CHECK_UIDS+= smmsp 591CHECK_GIDS+= smmsp 592.endif 593.if ${MK_PF} != "no" 594CHECK_UIDS+= proxy 595CHECK_GIDS+= proxy authpf 596.endif 597installcheck: installcheck_UGID 598installcheck_UGID: 599.for uid in ${CHECK_UIDS} 600 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 601 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 602 false; \ 603 fi 604.endfor 605.for gid in ${CHECK_GIDS} 606 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 607 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 608 false; \ 609 fi 610.endfor 611 612# 613# Required install tools to be saved in a scratch dir for safety. 614# 615ITOOLS= [ awk cap_mkdb cat chflags chmod chown \ 616 date echo egrep find grep install-info \ 617 ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ 618 test true uname wc zic 619 620# 621# distributeworld 622# 623# Distributes everything compiled by a `buildworld'. 624# 625# installworld 626# 627# Installs everything compiled by a 'buildworld'. 628# 629distributeworld installworld: installcheck 630 mkdir -p ${INSTALLTMP} 631 progs=$$(for prog in ${ITOOLS}; do \ 632 if progpath=`which $$prog`; then \ 633 echo $$progpath; \ 634 else \ 635 echo "Required tool $$prog not found in PATH." >&2; \ 636 exit 1; \ 637 fi; \ 638 done); \ 639 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \ 640 while read line; do \ 641 set -- $$line; \ 642 if [ "$$2 $$3" != "not found" ]; then \ 643 echo $$2; \ 644 else \ 645 echo "Required library $$1 not found." >&2; \ 646 exit 1; \ 647 fi; \ 648 done); \ 649 cp $$libs $$progs ${INSTALLTMP} 650 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale 651 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 652 ${IMAKEENV} rm -rf ${INSTALLTMP} 653 654# 655# reinstall 656# 657# If you have a build server, you can NFS mount the source and obj directories 658# and do a 'make reinstall' on the *client* to install new binaries from the 659# most recent server build. 660# 661reinstall: 662 @echo "--------------------------------------------------------------" 663 @echo ">>> Making hierarchy" 664 @echo "--------------------------------------------------------------" 665 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy 666 @echo 667 @echo "--------------------------------------------------------------" 668 @echo ">>> Installing everything" 669 @echo "--------------------------------------------------------------" 670 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 671.if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no" 672 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 673.endif 674 675redistribute: 676 @echo "--------------------------------------------------------------" 677 @echo ">>> Distributing everything" 678 @echo "--------------------------------------------------------------" 679 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 680.if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no" 681 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \ 682 DISTRIBUTION=lib32 683.endif 684 685distrib-dirs distribution: 686 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET} 687 688# 689# buildkernel and installkernel 690# 691# Which kernels to build and/or install is specified by setting 692# KERNCONF. If not defined a GENERIC kernel is built/installed. 693# Only the existing (depending TARGET) config files are used 694# for building kernels and only the first of these is designated 695# as the one being installed. 696# 697# Note that we have to use TARGET instead of TARGET_ARCH when 698# we're in kernel-land. Since only TARGET_ARCH is (expected) to 699# be set to cross-build, we have to make sure TARGET is set 700# properly. 701 702.if defined(KERNFAST) 703NO_KERNELCLEAN= t 704NO_KERNELCONFIG= t 705NO_KERNELDEPEND= t 706# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 707.if !defined(KERNCONF) && ${KERNFAST} != "1" 708KERNCONF=${KERNFAST} 709.endif 710.endif 711.if !defined(KERNCONF) && defined(KERNEL) 712KERNCONF= ${KERNEL} 713KERNWARN= 714.else 715KERNCONF?= GENERIC 716.endif 717INSTKERNNAME?= kernel 718 719KERNSRCDIR?= ${.CURDIR}/sys 720KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 721KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 722KERNCONFDIR?= ${KRNLCONFDIR} 723 724BUILDKERNELS= 725INSTALLKERNEL= 726.for _kernel in ${KERNCONF} 727.if exists(${KERNCONFDIR}/${_kernel}) 728BUILDKERNELS+= ${_kernel} 729.if empty(INSTALLKERNEL) 730INSTALLKERNEL= ${_kernel} 731.endif 732.endif 733.endfor 734 735# 736# buildkernel 737# 738# Builds all kernels defined by BUILDKERNELS. 739# 740buildkernel: 741.if empty(BUILDKERNELS) 742 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 743 false 744.endif 745.if defined(KERNWARN) 746 @echo "--------------------------------------------------------------" 747 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" 748 @echo "--------------------------------------------------------------" 749 @sleep 3 750.endif 751 @echo 752.for _kernel in ${BUILDKERNELS} 753 @echo "--------------------------------------------------------------" 754 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 755 @echo "--------------------------------------------------------------" 756 @echo "===> ${_kernel}" 757 mkdir -p ${KRNLOBJDIR} 758.if !defined(NO_KERNELCONFIG) 759 @echo 760 @echo "--------------------------------------------------------------" 761 @echo ">>> stage 1: configuring the kernel" 762 @echo "--------------------------------------------------------------" 763 cd ${KRNLCONFDIR}; \ 764 PATH=${TMPPATH} \ 765 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 766 ${KERNCONFDIR}/${_kernel} 767.endif 768.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 769 @echo 770 @echo "--------------------------------------------------------------" 771 @echo ">>> stage 2.1: cleaning up the object tree" 772 @echo "--------------------------------------------------------------" 773 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 774.endif 775 @echo 776 @echo "--------------------------------------------------------------" 777 @echo ">>> stage 2.2: rebuilding the object tree" 778 @echo "--------------------------------------------------------------" 779 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 780 @echo 781 @echo "--------------------------------------------------------------" 782 @echo ">>> stage 2.3: build tools" 783 @echo "--------------------------------------------------------------" 784 cd ${KRNLOBJDIR}/${_kernel}; \ 785 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ 786 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \ 787 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile 788# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. 789.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) 790.for target in obj depend all 791 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ 792 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ 793 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target} 794.endfor 795.endif 796.if !defined(NO_KERNELDEPEND) 797 @echo 798 @echo "--------------------------------------------------------------" 799 @echo ">>> stage 3.1: making dependencies" 800 @echo "--------------------------------------------------------------" 801 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ 802.endif 803 @echo 804 @echo "--------------------------------------------------------------" 805 @echo ">>> stage 3.2: building everything" 806 @echo "--------------------------------------------------------------" 807 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 808 @echo "--------------------------------------------------------------" 809 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 810 @echo "--------------------------------------------------------------" 811.endfor 812 813# 814# installkernel, etc. 815# 816# Install the kernel defined by INSTALLKERNEL 817# 818installkernel installkernel.debug \ 819reinstallkernel reinstallkernel.debug: installcheck 820.if empty(INSTALLKERNEL) 821 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 822 false 823.endif 824 @echo "--------------------------------------------------------------" 825 @echo ">>> Installing kernel" 826 @echo "--------------------------------------------------------------" 827 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 828 ${CROSSENV} PATH=${TMPPATH} \ 829 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 830 831# 832# doxygen 833# 834# Build the API documentation with doxygen 835# 836doxygen: 837 @if [ ! -x `/usr/bin/which doxygen` ]; then \ 838 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 839 exit 1; \ 840 fi 841 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all 842 843# 844# update 845# 846# Update the source tree, by running cvsup and/or running cvs to update to the 847# latest copy. 848# 849update: 850.if defined(SUP_UPDATE) 851 @echo "--------------------------------------------------------------" 852 @echo ">>> Running ${SUP}" 853 @echo "--------------------------------------------------------------" 854.if defined(SUPFILE) 855 @${SUP} ${SUPFLAGS} ${SUPFILE} 856.endif 857.if defined(SUPFILE1) 858 @${SUP} ${SUPFLAGS} ${SUPFILE1} 859.endif 860.if defined(SUPFILE2) 861 @${SUP} ${SUPFLAGS} ${SUPFILE2} 862.endif 863.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) 864 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} 865.endif 866.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) 867 @${SUP} ${SUPFLAGS} ${DOCSUPFILE} 868.endif 869.endif 870.if defined(CVS_UPDATE) 871 @echo "--------------------------------------------------------------" 872 @echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} 873 @echo "--------------------------------------------------------------" 874 cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS} 875.endif 876 877# 878# ------------------------------------------------------------------------ 879# 880# From here onwards are utility targets used by the 'make world' and 881# related targets. If your 'world' breaks, you may like to try to fix 882# the problem and manually run the following targets to attempt to 883# complete the build. Beware, this is *not* guaranteed to work, you 884# need to have a pretty good grip on the current state of the system 885# to attempt to manually finish it. If in doubt, 'make world' again. 886# 887 888# 889# legacy: Build compatibility shims for the next three targets 890# 891legacy: 892.if ${BOOTSTRAPPING} < 600034 && ${BOOTSTRAPPING} != 0 893 @echo "ERROR: Source upgrades from versions prior to 6.0 not supported."; \ 894 false 895.endif 896.for _tool in tools/build 897 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ 898 cd ${.CURDIR}/${_tool}; \ 899 ${MAKE} DIRPRFX=${_tool}/ obj; \ 900 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 901 ${MAKE} DIRPRFX=${_tool}/ depend; \ 902 ${MAKE} DIRPRFX=${_tool}/ all; \ 903 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 904.endfor 905 906# 907# bootstrap-tools: Build tools needed for compatibility 908# 909.if ${MK_GAMES} != "no" 910_strfile= games/fortune/strfile 911.endif 912 913.if ${MK_CXX} != "no" 914_gperf= gnu/usr.bin/gperf 915.if ${BOOTSTRAPPING} < 700004 916_groff= gnu/usr.bin/groff 917.else 918_groff= gnu/usr.bin/groff/tmac 919.endif 920.endif 921 922.if ${BOOTSTRAPPING} >= 700044 && ${BOOTSTRAPPING} < 800022 923_ar= usr.bin/ar 924.endif 925 926.if ${BOOTSTRAPPING} < 800013 927_mklocale= usr.bin/mklocale 928.endif 929 930.if ${BOOTSTRAPPING} < 700018 931_gensnmptree= usr.sbin/bsnmpd/gensnmptree 932.endif 933 934.if ${MK_RESCUE} != "no" && \ 935 ${BOOTSTRAPPING} < 700026 936_crunchgen= usr.sbin/crunch/crunchgen 937.endif 938 939.if ${MK_CDDL} != "no" 940_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \ 941 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge 942.endif 943 944bootstrap-tools: 945.for _tool in \ 946 ${_dtrace_tools} \ 947 ${_strfile} \ 948 ${_gperf} \ 949 ${_groff} \ 950 ${_ar} \ 951 usr.bin/lorder \ 952 usr.bin/makewhatis \ 953 ${_mklocale} \ 954 usr.bin/rpcgen \ 955 usr.bin/xinstall \ 956 ${_gensnmptree} \ 957 usr.sbin/config \ 958 ${_crunchgen} 959 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 960 cd ${.CURDIR}/${_tool}; \ 961 ${MAKE} DIRPRFX=${_tool}/ obj; \ 962 ${MAKE} DIRPRFX=${_tool}/ depend; \ 963 ${MAKE} DIRPRFX=${_tool}/ all; \ 964 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 965.endfor 966 967# 968# build-tools: Build special purpose build tools 969# 970.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) 971_aicasm= sys/modules/aic7xxx/aicasm 972.endif 973 974.if !defined(NO_SHARE) 975_share= share/syscons/scrnmaps 976.endif 977 978.if ${MK_KERBEROS} != "no" 979_kerberos5_tools= kerberos5/tools 980.endif 981 982.if ${MK_RESCUE} != "no" 983_rescue= rescue/rescue 984.endif 985 986build-tools: 987.for _tool in \ 988 bin/csh \ 989 bin/sh \ 990 ${_rescue} \ 991 lib/ncurses/ncurses \ 992 lib/ncurses/ncursesw \ 993 ${_share} \ 994 ${_aicasm} \ 995 usr.bin/awk \ 996 lib/libmagic \ 997 usr.sbin/sysinstall 998 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 999 cd ${.CURDIR}/${_tool}; \ 1000 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1001 ${MAKE} DIRPRFX=${_tool}/ build-tools 1002.endfor 1003.for _tool in \ 1004 gnu/usr.bin/cc/cc_tools \ 1005 ${_kerberos5_tools} 1006 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ 1007 cd ${.CURDIR}/${_tool}; \ 1008 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1009 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1010 ${MAKE} DIRPRFX=${_tool}/ all 1011.endfor 1012 1013# 1014# cross-tools: Build cross-building tools 1015# 1016.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035 1017.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 1018_btxld= usr.sbin/btxld 1019.endif 1020.endif 1021.if ${TARGET_ARCH} != ${MACHINE_ARCH} 1022.if ${MK_RESCUE} != "no" || defined(RELEASEDIR) 1023_crunchide= usr.sbin/crunch/crunchide 1024.endif 1025.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR) 1026_kgzip= usr.sbin/kgzip 1027.endif 1028.endif 1029 1030cross-tools: 1031.for _tool in \ 1032 gnu/usr.bin/binutils \ 1033 gnu/usr.bin/cc \ 1034 usr.bin/sed \ 1035 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ 1036 ${_btxld} \ 1037 ${_crunchide} \ 1038 ${_kgzip} 1039 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1040 cd ${.CURDIR}/${_tool}; \ 1041 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1042 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1043 ${MAKE} DIRPRFX=${_tool}/ all; \ 1044 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 1045.endfor 1046 1047# 1048# hierarchy - ensure that all the needed directories are present 1049# 1050hierarchy: 1051 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 1052 1053# 1054# libraries - build all libraries, and install them under ${DESTDIR}. 1055# 1056# The list of libraries with dependents (${_prebuild_libs}) and their 1057# interdependencies (__L) are built automatically by the 1058# ${.CURDIR}/tools/make_libdeps.sh script. 1059# 1060libraries: 1061 cd ${.CURDIR}; \ 1062 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 1063 ${MAKE} -f Makefile.inc1 _startup_libs; \ 1064 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 1065 ${MAKE} -f Makefile.inc1 _generic_libs; 1066 1067# 1068# static libgcc.a prerequisite for shared libc 1069# 1070_prereq_libs= gnu/lib/libgcc 1071 1072# These dependencies are not automatically generated: 1073# 1074# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 1075# all shared libraries for ELF. 1076# 1077_startup_libs= gnu/lib/csu 1078.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 1079_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 1080.else 1081_startup_libs+= lib/csu/${MACHINE_ARCH} 1082.endif 1083_startup_libs+= gnu/lib/libgcc 1084_startup_libs+= lib/libc 1085 1086gnu/lib/libgcc__L: lib/libc__L 1087 1088_prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libkrb5} \ 1089 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libroken} \ 1090 ${_kerberos5_lib_libheimntlm} ${_kerberos5_lib_libgssapi_krb5} \ 1091 lib/libbz2 lib/libcom_err lib/libcrypt lib/libelf \ 1092 lib/libexpat \ 1093 ${_lib_cddl} ${_lib_libgssapi} ${_lib_libipx} \ 1094 lib/libkiconv lib/libkvm lib/libmd \ 1095 lib/ncurses/ncurses lib/ncurses/ncursesw \ 1096 lib/libopie lib/libpam ${_lib_libthr} \ 1097 lib/libradius lib/libsbuf lib/libtacplus lib/libutil \ 1098 ${_lib_libypclnt} lib/libz lib/msun \ 1099 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ 1100 ${_secure_lib_libssl} lib/libdwarf lib/libproc 1101 1102.if ${MK_LIBTHR} != "no" 1103_lib_libthr= lib/libthr 1104.endif 1105 1106_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib 1107 1108lib/libopie__L lib/libtacplus__L: lib/libmd__L 1109 1110.if ${MK_CDDL} != "no" 1111_cddl_lib= cddl/lib 1112.endif 1113 1114.if ${MK_CRYPT} != "no" 1115.if ${MK_OPENSSL} != "no" 1116_secure_lib_libcrypto= secure/lib/libcrypto 1117_secure_lib_libssl= secure/lib/libssl 1118lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 1119.if ${MK_OPENSSH} != "no" 1120_secure_lib_libssh= secure/lib/libssh 1121secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 1122.if ${MK_KERBEROS} != "no" 1123kerberos5/lib/libgssapi_krb5__L: kerberos5/lib/libkrb5__L \ 1124 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 1125 lib/libmd__L kerberos5/lib/libroken__L secure/lib/libcrypto__L \ 1126 lib/libcrypt__L 1127secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libgssapi_krb5__L 1128.endif 1129.endif 1130.endif 1131_secure_lib= secure/lib 1132.endif 1133 1134.if ${MK_IPX} != "no" 1135_lib_libipx= lib/libipx 1136.endif 1137 1138.if ${MK_KERBEROS} != "no" 1139_kerberos5_lib= kerberos5/lib 1140_kerberos5_lib_libasn1= kerberos5/lib/libasn1 1141_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 1142_kerberos5_lib_libhx509= kerberos5/lib/libhx509 1143_kerberos5_lib_libroken= kerberos5/lib/libroken 1144_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 1145_kerberos5_lib_libgssapi_krb5= kerberos5/lib/libgssapi_krb5 1146_lib_libgssapi= lib/libgssapi 1147.endif 1148 1149.if ${MK_NIS} != "no" 1150_lib_libypclnt= lib/libypclnt 1151.endif 1152 1153.if ${MK_OPENSSL} == "no" 1154lib/libradius__L: lib/libmd__L 1155.endif 1156 1157.for _lib in ${_prereq_libs} 1158${_lib}__PL: .PHONY 1159.if exists(${.CURDIR}/${_lib}) 1160 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1161 cd ${.CURDIR}/${_lib}; \ 1162 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1163 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1164 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \ 1165 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install 1166.endif 1167.endfor 1168 1169.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 1170${_lib}__L: .PHONY 1171.if exists(${.CURDIR}/${_lib}) 1172 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1173 cd ${.CURDIR}/${_lib}; \ 1174 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1175 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1176 ${MAKE} DIRPRFX=${_lib}/ all; \ 1177 ${MAKE} DIRPRFX=${_lib}/ install 1178.endif 1179.endfor 1180 1181# libpam is special: we need to build static PAM modules before 1182# static PAM library, and dynamic PAM library before dynamic PAM 1183# modules. 1184lib/libpam__L: .PHONY 1185 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ 1186 cd ${.CURDIR}/lib/libpam; \ 1187 ${MAKE} DIRPRFX=lib/libpam/ obj; \ 1188 ${MAKE} DIRPRFX=lib/libpam/ depend; \ 1189 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ 1190 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install 1191 1192_prereq_libs: ${_prereq_libs:S/$/__PL/} 1193_startup_libs: ${_startup_libs:S/$/__L/} 1194_prebuild_libs: ${_prebuild_libs:S/$/__L/} 1195_generic_libs: ${_generic_libs:S/$/__L/} 1196 1197.for __target in all clean cleandepend cleandir depend includes obj 1198.for entry in ${SUBDIR} 1199${entry}.${__target}__D: .PHONY 1200 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 1201 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ 1202 edir=${entry}.${MACHINE_ARCH}; \ 1203 cd ${.CURDIR}/$${edir}; \ 1204 else \ 1205 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ 1206 edir=${entry}; \ 1207 cd ${.CURDIR}/$${edir}; \ 1208 fi; \ 1209 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 1210.endfor 1211par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 1212.endfor 1213 1214.include <bsd.subdir.mk> 1215 1216.if make(check-old) || make(check-old-dirs) || \ 1217 make(check-old-files) || make(check-old-libs) || \ 1218 make(delete-old) || make(delete-old-dirs) || \ 1219 make(delete-old-files) || make(delete-old-libs) 1220 1221# 1222# check for / delete old files section 1223# 1224 1225.include "ObsoleteFiles.inc" 1226 1227OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 1228else you can not start such an application. Consult UPDATING for more \ 1229information regarding how to cope with the removal/revision bump of a \ 1230specific library." 1231 1232.if !defined(BATCH_DELETE_OLD_FILES) 1233RM_I=-i 1234.else 1235RM_I=-v 1236.endif 1237 1238delete-old-files: 1239 @echo ">>> Removing old files (only deletes safe to delete libs)" 1240# Ask for every old file if the user really wants to remove it. 1241# It's annoying, but better safe than sorry. 1242 @for file in ${OLD_FILES}; do \ 1243 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1244 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1245 rm ${RM_I} "${DESTDIR}/$${file}"; \ 1246 fi; \ 1247 done 1248# Remove catpages without corresponding manpages. 1249 @3<&0; \ 1250 find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1251 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1252 while read catpage; do \ 1253 read manpage; \ 1254 if [ ! -e "$${manpage}" ]; then \ 1255 rm ${RM_I} $${catpage} <&3 ; \ 1256 fi; \ 1257 done 1258 @echo ">>> Old files removed" 1259 1260check-old-files: 1261 @echo ">>> Checking for old files" 1262 @for file in ${OLD_FILES}; do \ 1263 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1264 echo "${DESTDIR}/$${file}"; \ 1265 fi; \ 1266 done 1267# Check for catpages without corresponding manpages. 1268 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1269 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1270 while read catpage; do \ 1271 read manpage; \ 1272 if [ ! -e "$${manpage}" ]; then \ 1273 echo $${catpage} ; \ 1274 fi; \ 1275 done 1276 1277delete-old-libs: 1278 @echo ">>> Removing old libraries" 1279 @echo "${OLD_LIBS_MESSAGE}" | fmt 1280 @for file in ${OLD_LIBS}; do \ 1281 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1282 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1283 rm ${RM_I} "${DESTDIR}/$${file}"; \ 1284 fi; \ 1285 done 1286 @echo ">>> Old libraries removed" 1287 1288check-old-libs: 1289 @echo ">>> Checking for old libraries" 1290 @for file in ${OLD_LIBS}; do \ 1291 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1292 echo "${DESTDIR}/$${file}"; \ 1293 fi; \ 1294 done 1295 1296delete-old-dirs: 1297 @echo ">>> Removing old directories" 1298 @for dir in ${OLD_DIRS}; do \ 1299 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1300 rmdir -v "${DESTDIR}/$${dir}" || true; \ 1301 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1302 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1303 fi; \ 1304 done 1305 @echo ">>> Old directories removed" 1306 1307check-old-dirs: 1308 @echo ">>> Checking for old directories" 1309 @for dir in ${OLD_DIRS}; do \ 1310 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1311 echo "${DESTDIR}/$${dir}"; \ 1312 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1313 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1314 fi; \ 1315 done 1316 1317delete-old: delete-old-files delete-old-dirs 1318 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1319 1320check-old: check-old-files check-old-libs check-old-dirs 1321 @echo "To remove old files and directories run '${MAKE} delete-old'." 1322 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1323 1324.endif 1325 1326# 1327# showconfig - show build configuration. 1328# 1329showconfig: 1330 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort 1331 1332 1333############### 1334 1335.if defined(XDEV) && defined(XDEV_ARCH) 1336 1337NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ 1338 -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \ 1339 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS 1340 1341XDDIR=${XDEV}-freebsd 1342XDTP=/usr/${XDDIR} 1343CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ 1344 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} 1345CDENV= ${CDBENV} \ 1346 _SHLIBDIRPREFIX=${XDTP} \ 1347 TOOLS_PREFIX=${XDTP} 1348CD2ENV=${CDENV} \ 1349 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH} 1350 1351CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp 1352CDMAKE=${CDENV} ${MAKE} ${NOFUN} 1353CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1354XDDESTDIR=${DESTDIR}${XDTP} 1355 1356.ORDER: xdev-build xdev-install 1357xdev: xdev-build xdev-install 1358 1359.ORDER: _xb-build-tools _xb-cross-tools 1360xdev-build: _xb-build-tools _xb-cross-tools 1361 1362_xb-build-tools: 1363 ${_+_}cd ${.CURDIR}; \ 1364 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools 1365 1366_xb-cross-tools: 1367.for _tool in \ 1368 gnu/usr.bin/binutils \ 1369 gnu/usr.bin/cc 1370 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ 1371 cd ${.CURDIR}/${_tool}; \ 1372 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 1373 ${CDMAKE} DIRPRFX=${_tool}/ depend; \ 1374 ${CDMAKE} DIRPRFX=${_tool}/ all 1375.endfor 1376 1377_xi-mtree: 1378 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 1379 mkdir -p ${XDDESTDIR} 1380 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 1381 -p ${XDDESTDIR} >/dev/null 1382 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1383 -p ${XDDESTDIR}/usr >/dev/null 1384 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1385 -p ${XDDESTDIR}/usr/include >/dev/null 1386 1387.ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1388xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1389 1390_xi-cross-tools: 1391 @echo "_xi-cross-tools" 1392.for _tool in \ 1393 gnu/usr.bin/binutils \ 1394 gnu/usr.bin/cc 1395 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 1396 cd ${.CURDIR}/${_tool}; \ 1397 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 1398.endfor 1399 1400_xi-includes: 1401 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \ 1402 DESTDIR=${XDDESTDIR} 1403 1404_xi-libraries: 1405 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 1406 DESTDIR=${XDDESTDIR} 1407 1408_xi-links: 1409 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 1410 for i in *; do \ 1411 ln -sf ../../${XDTP}/usr/bin/$$i \ 1412 ../../../../usr/bin/${XDDIR}-$$i; \ 1413 ln -sf ../../${XDTP}/usr/bin/$$i \ 1414 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ 1415 done 1416.endif 1417