Makefile.inc1 revision 251750
11539Srgrimes# 21539Srgrimes# $FreeBSD: head/Makefile.inc1 251750 2013-06-14 16:30:11Z sjg $ 31539Srgrimes# 41539Srgrimes# Make command line options: 51539Srgrimes# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 61539Srgrimes# -DNO_CLEAN do not clean at all 71539Srgrimes# -DDB_FROM_SRC use the user/group databases in src/etc instead of 81539Srgrimes# the system database when installing. 91539Srgrimes# -DNO_SHARE do not go into share subdir 101539Srgrimes# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ} 111539Srgrimes# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 121539Srgrimes# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 13203964Simp# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel 141539Srgrimes# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel 151539Srgrimes# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 161539Srgrimes# -DNO_ROOT install without using root privilege 171539Srgrimes# -DNO_DOCUPDATE do not update doc in ${MAKE} update 181539Srgrimes# -DNO_CTF do not run the DTrace CTF conversion tools on built objects 191539Srgrimes# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 201539Srgrimes# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target 211539Srgrimes# LOCAL_MTREE="list of mtree files" to process to allow local directories 221539Srgrimes# to be created before files are installed 231539Srgrimes# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools 241539Srgrimes# list 251539Srgrimes# METALOG="path to metadata log" to write permission and ownership 261539Srgrimes# when NO_ROOT is set. (default: ${DESTDIR}/METALOG) 271539Srgrimes# TARGET="machine" to crossbuild world for a different machine type 281539Srgrimes# TARGET_ARCH= may be required when a TARGET supports multiple endians 2923657Speter# BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh) 3055031Sbde# WORLD_FLAGS= additional flags to pass to make(1) during buildworld 311539Srgrimes# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel 321539Srgrimes 331539Srgrimes# 347865Sbde# The intended user-driven targets are: 351539Srgrimes# buildworld - rebuild *everything*, including glue to help do upgrades 3633861Sbde# installworld- install everything built by "buildworld" 37123257Smarcel# doxygen - build API documentation of the kernel 38102227Smike# update - convenient way to update your source tree (eg: svn/svnup) 3933861Sbde# 40103728Swollman# Standard targets (not defined here) are documented in the makefiles in 41102227Smike# /usr/share/mk. These include: 42102227Smike# obj depend all install clean cleandepend cleanobj 43102227Smike 4415483Sbde.if !defined(TARGET) || !defined(TARGET_ARCH) 4515483Sbde.error "Both TARGET and TARGET_ARCH must be defined." 4615483Sbde.endif 47102227Smike 48102227Smike.include <bsd.own.mk> 49102227Smike.include <bsd.arch.inc.mk> 501539Srgrimes.include <bsd.compiler.mk> 511539Srgrimes 5299640Sobrien# We must do share/info early so that installation of info `dir' 53102227Smike# entries works correctly. Do it first since it is less likely to 54102227Smike# grow dependencies on include and lib than vice versa. 55102227Smike# 561539Srgrimes# We must do lib/ and libexec/ before bin/, because if installworld 5799640Sobrien# installs a new /bin/sh, the 'make' command will *immediately* 581539Srgrimes# use that new version. And the new (dynamically-linked) /bin/sh 591539Srgrimes# will expect to find appropriate libraries in /lib and /libexec. 60103766Sbde# 61103766Sbde.if defined(SUBDIR_OVERRIDE) 621539SrgrimesSUBDIR= ${SUBDIR_OVERRIDE} 631539Srgrimes.else 641539SrgrimesSUBDIR= share/info lib libexec 65103766SbdeSUBDIR+=bin 66103766Sbde.if ${MK_GAMES} != "no" 671539SrgrimesSUBDIR+=games 681539Srgrimes.endif 691539Srgrimes.if ${MK_CDDL} != "no" 701539SrgrimesSUBDIR+=cddl 711539Srgrimes.endif 721539SrgrimesSUBDIR+=gnu include 731539Srgrimes.if ${MK_KERBEROS} != "no" 74235785StheravenSUBDIR+=kerberos5 75235785Stheraven.endif 76235785Stheraven.if ${MK_RESCUE} != "no" 77235785StheravenSUBDIR+=rescue 781539Srgrimes.endif 79235785StheravenSUBDIR+=sbin 80235785Stheraven.if ${MK_CRYPT} != "no" 811539SrgrimesSUBDIR+=secure 82235786Stheraven.endif 8393032Simp.if !defined(NO_SHARE) 8493032SimpSUBDIR+=share 8593032Simp.endif 8693032SimpSUBDIR+=sys usr.bin usr.sbin 8793032Simp.if ${MK_OFED} != "no" 8893032SimpSUBDIR+=contrib/ofed 8993032Simp.endif 90187961Sdas# 9193032Simp# We must do etc/ last for install/distribute to work. 92235786Stheraven# 9393032SimpSUBDIR+=etc 9493032Simp 9593032Simp# These are last, since it is nice to at least get the base system 9693032Simp# rebuilt before you do them. 97187961Sdas.for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS} 98103728Swollman.if exists(${.CURDIR}/${_DIR}/Makefile) 99103766SbdeSUBDIR+= ${_DIR} 100103728Swollman.endif 10193032Simp.endfor 10293032Simp.endif 10393032Simp 10493032Simp.if defined(NOCLEAN) 10593032SimpNO_CLEAN= ${NOCLEAN} 106103766Sbde.endif 107112163Sdas.if defined(NO_CLEANDIR) 108103766SbdeCLEANDIR= clean cleandepend 109112163Sdas.else 110112163SdasCLEANDIR= cleandir 1111539Srgrimes.endif 112103012Stjr 11393032SimpLOCAL_TOOL_DIRS?= 11493032Simp 115103012StjrBUILDENV_SHELL?=/bin/sh 1161539Srgrimes 117103728SwollmanSVN?= /usr/local/bin/svn 118103728SwollmanSVNFLAGS?= -r HEAD 119103728Swollman 120103728SwollmanMAKEOBJDIRPREFIX?= /usr/obj 121103728Swollman.if !defined(OSRELDATE) 122103728Swollman.if exists(/usr/include/osreldate.h) 123103728SwollmanOSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 124103728Swollman /usr/include/osreldate.h 125103728Swollman.else 126103728SwollmanOSRELDATE= 0 127103728Swollman.endif 128103728Swollman.endif 129103728Swollman 130103728Swollman.if !defined(VERSION) 131103728SwollmanVERSION!= uname -srp 132103728SwollmanVERSION+= ${OSRELDATE} 133103728Swollman.endif 13469201Sphk 135103728SwollmanKNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6eb/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64 136103728Swollman.if ${TARGET} == ${TARGET_ARCH} 137103728Swollman_t= ${TARGET} 138103728Swollman.else 139103728Swollman_t= ${TARGET_ARCH}/${TARGET} 140103728Swollman.endif 141103728Swollman.for _t in ${_t} 142103728Swollman.if empty(KNOWN_ARCHES:M${_t}) 143103728Swollman.error Unknown target ${TARGET_ARCH}:${TARGET}. 144103766Sbde.endif 145103766Sbde.endfor 146103728Swollman 147103728Swollman.if ${TARGET} == ${MACHINE} 148103766SbdeTARGET_CPUTYPE?=${CPUTYPE} 149103728Swollman.else 150103728SwollmanTARGET_CPUTYPE?= 151235786Stheraven.endif 152103728Swollman 153103728Swollman.if !empty(TARGET_CPUTYPE) 154103728Swollman_TARGET_CPUTYPE=${TARGET_CPUTYPE} 155235786Stheraven.else 156235786Stheraven_TARGET_CPUTYPE=dummy 157235786Stheraven.endif 158243405Sed_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ 159235786Stheraven -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE 160235786Stheraven.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 161235786Stheraven.error CPUTYPE global should be set with ?=. 162235786Stheraven.endif 163235786Stheraven.if make(buildworld) 164103728SwollmanBUILD_ARCH!= uname -p 165103728Swollman.if ${MACHINE_ARCH} != ${BUILD_ARCH} 166103728Swollman.error To cross-build, set TARGET_ARCH. 167103728Swollman.endif 168103728Swollman.endif 169154250Sjasone.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING) 170103728SwollmanOBJTREE= ${MAKEOBJDIRPREFIX} 171206997Skib.else 17293032SimpOBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} 173171195Sscf.endif 174103728SwollmanWORLDTMP= ${OBJTREE}${.CURDIR}/tmp 1751539Srgrimes# /usr/games added for fortune which depend on strfile 176189349SdasBPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games:${WORLDTMP}/legacy/bin 177189349SdasXPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games 178189349SdasSTRICTTMPPATH= ${BPATH}:${XPATH} 179189349SdasTMPPATH= ${STRICTTMPPATH}:${PATH} 180189349Sdas 181189349Sdas# 182189349Sdas# Avoid running mktemp(1) unless actually needed. 183189349Sdas# It may not be functional, e.g., due to new ABI 184189349Sdas# when in the middle of installing over this system. 185189349Sdas# 186189349Sdas.if make(distributeworld) || make(installworld) 187189349SdasINSTALLTMP!= /usr/bin/mktemp -d -u -t install 188103728Swollman.endif 189103728Swollman 190103728Swollman# 191103728Swollman# Building a world goes through the following stages 192103728Swollman# 193103728Swollman# 1. legacy stage [BMAKE] 194103728Swollman# This stage is responsible for creating compatibility 195103728Swollman# shims that are needed by the bootstrap-tools, 196153707Strhodes# build-tools and cross-tools stages. 19793032Simp# 1. bootstrap-tools stage [BMAKE] 198103766Sbde# This stage is responsible for creating programs that 19993032Simp# are needed for backward compatibility reasons. They 200103766Sbde# are not built as cross-tools. 201103766Sbde# 2. build-tools stage [TMAKE] 202108574Sjmallett# This stage is responsible for creating the object 203103728Swollman# tree and building any tools that are needed during 20493032Simp# the build process. 205153707Strhodes# 3. cross-tools stage [XMAKE] 20693032Simp# This stage is responsible for creating any tools that 20793032Simp# are needed for cross-builds. A cross-compiler is one 208189782Sdas# of them. 209103728Swollman# 4. world stage [WMAKE] 210103766Sbde# This stage actually builds the world. 211103728Swollman# 5. install stage (optional) [IMAKE] 21293032Simp# This stage installs a previously built world. 21393032Simp# 214108574Sjmallett 215108574SjmallettBOOTSTRAPPING?= 0 216171195Sscf 217103728Swollman# Common environment for world related stages 2187865SbdeCROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ 21993032Simp MACHINE_ARCH=${TARGET_ARCH} \ 220103728Swollman MACHINE=${TARGET} \ 221103728Swollman CPUTYPE=${TARGET_CPUTYPE} 222103728Swollman.if ${MK_GROFF} != "no" 223103728SwollmanCROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 224103728Swollman GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 22593032Simp GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 226103728Swollman.endif 227108574Sjmallett 228103728Swollman# bootstrap-tools stage 2294749SatsBMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 230103728Swollman PATH=${BPATH}:${PATH} \ 231103728Swollman WORLDTMP=${WORLDTMP} \ 232103766Sbde VERSION="${VERSION}" \ 233103766Sbde MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ 234103728Swollman COMPILER_TYPE=${COMPILER_TYPE} 235116397SdesBMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 236116397Sdes ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 237116397Sdes DESTDIR= \ 238116397Sdes BOOTSTRAPPING=${OSRELDATE} \ 239116397Sdes SSP_CFLAGS= \ 240116397Sdes -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ 241116397Sdes -DNO_PIC -DNO_PROFILE -DNO_SHARED \ 242116397Sdes -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD 243116397Sdes 244116831Sobrien# build-tools stage 245116831SobrienTMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 246116397Sdes ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 247116831Sobrien TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 248116831Sobrien DESTDIR= \ 249116397Sdes BOOTSTRAPPING=${OSRELDATE} \ 250116397Sdes SSP_CFLAGS= \ 251189820Sdas -DNO_LINT \ 25241927Sdt -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD 25393032Simp 254180658Sache# cross-tools stage 255180658SacheXMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ 25693032Simp TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 257180689Sache -DWITHOUT_GDB 258180689Sache 259108445Sobrien# world stage 260103728SwollmanWMAKEENV= ${CROSSENV} \ 26193032Simp _SHLIBDIRPREFIX=${WORLDTMP} \ 26293032Simp _LDSCRIPTROOT= \ 26393032Simp VERSION="${VERSION}" \ 26493032Simp INSTALL="sh ${.CURDIR}/tools/install.sh" \ 26593032Simp PATH=${TMPPATH} 26693032Simp.if ${MK_CDDL} == "no" 26793032SimpWMAKEENV+= NO_CTF=1 26893032Simp.endif 26993032Simp 27093032Simp.if defined(CROSS_TOOLCHAIN_PREFIX) 2711539SrgrimesCROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 27293032SimpCROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 273150052Sstefanf.endif 274150052SstefanfXCOMPILERS= CC CXX CPP 275188497Sed.for COMPILER in ${XCOMPILERS} 276188497Sed.if defined(CROSS_COMPILER_PREFIX) 27793032SimpX${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}} 27888399Smike.else 27993032SimpX${COMPILER}?= ${${COMPILER}} 2801539Srgrimes.endif 28193032Simp.endfor 282153707StrhodesXBINUTILS= AS AR LD NM OBJDUMP RANLIB STRINGS 28393032Simp.for BINUTIL in ${XBINUTILS} 284103164Swollman.if defined(CROSS_BINUTILS_PREFIX) 285103164SwollmanX${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}} 28693032Simp.else 28793032SimpX${BINUTIL}?= ${${BINUTIL}} 28893032Simp.endif 289139922Stjr.endfor 29093032SimpWMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \ 291103164Swollman CPP="${XCPP} ${XFLAGS}" \ 292103164Swollman AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ 29393032Simp OBJDUMP=${XOBJDUMP} RANLIB=${XRANLIB} STRINGS=${XSTRINGS} 29493032Simp 295156707Sandre.if ${XCC:T:Mgcc} == "gcc" 296156707SandreWMAKE_COMPILER_TYPE= gcc 297103728Swollman.elif ${XCC:T:Mclang} == "clang" 298103728SwollmanWMAKE_COMPILER_TYPE= clang 299103766Sbde.elif ${MK_CLANG_IS_CC} == "no" 300103766SbdeWMAKE_COMPILER_TYPE= gcc 30141927Sdt.else 30293032SimpWMAKE_COMPILER_TYPE= clang 303126136Sache.endif 304126136SacheIMAKE_COMPILER_TYPE= COMPILER_TYPE=${WMAKE_COMPILER_TYPE} 305103728Swollman 3061539Srgrimes.if ${XCC:M/*} 3071539SrgrimesXFLAGS= --sysroot=${WORLDTMP} 3087865Sbde.if defined(CROSS_BINUTILS_PREFIX) 309# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a 310# directory, but the compiler will look in the right place for it's 311# tools so we don't need to tell it where to look. 312.if exists(${CROSS_BINUTILS_PREFIX}) 313XFLAGS+= -B${CROSS_BINUTILS_PREFIX} 314.endif 315.else 316XFLAGS+= -B${WORLDTMP}/usr/bin 317.endif 318.if ${TARGET_ARCH} != ${MACHINE_ARCH} && ${WMAKE_COMPILER_TYPE} == "clang" 319.if (${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "armv6") && \ 320${MK_ARM_EABI} != "no" 321TARGET_ABI= gnueabi 322.else 323TARGET_ABI= unknown 324.endif 325TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.0 326XFLAGS+= -target ${TARGET_TRIPLE} 327.endif 328.endif 329 330WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE} 331WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP} 332 333.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" 334# 32 bit world 335LIB32TMP= ${OBJTREE}${.CURDIR}/lib32 336 337.if ${TARGET_ARCH} == "amd64" 338.if empty(TARGET_CPUTYPE) 339LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 340.else 341LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} 342.endif 343LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ 344 MACHINE_CPU="i686 mmx sse sse2" 345LIB32WMAKEFLAGS= \ 346 AS="${AS} --32" \ 347 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" 348 349.elif ${TARGET_ARCH} == "powerpc64" 350.if empty(TARGET_CPUTYPE) 351LIB32CPUFLAGS= -mcpu=powerpc 352.else 353LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} 354.endif 355LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc 356LIB32WMAKEFLAGS= \ 357 LD="${LD} -m elf32ppc_fbsd" 358.endif 359 360 361LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \ 362 -isystem ${LIB32TMP}/usr/include/ \ 363 -L${LIB32TMP}/usr/lib32 \ 364 -B${LIB32TMP}/usr/lib32 365.if ${XCC:M/*} 366LIB32FLAGS+= --sysroot=${WORLDTMP} 367.endif 368 369# Yes, the flags are redundant. 370LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ 371 _SHLIBDIRPREFIX=${LIB32TMP} \ 372 _LDSCRIPTROOT=${LIB32TMP} \ 373 VERSION="${VERSION}" \ 374 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 375 PATH=${TMPPATH} \ 376 LIBDIR=/usr/lib32 \ 377 SHLIBDIR=/usr/lib32 \ 378 COMPILER_TYPE=${WMAKE_COMPILER_TYPE} 379LIB32WMAKEFLAGS+= \ 380 CC="${XCC} ${LIB32FLAGS}" \ 381 CXX="${XCXX} ${LIB32FLAGS}" \ 382 DESTDIR=${LIB32TMP} \ 383 -DCOMPAT_32BIT \ 384 -DLIBRARIES_ONLY \ 385 -DNO_CPU_CFLAGS \ 386 -DNO_CTF \ 387 -DNO_LINT 388 389LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \ 390 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML 391LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \ 392 ${IMAKE_INSTALL} 393.endif 394 395IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*} 396IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ 397 ${IMAKE_INSTALL} ${IMAKE_MTREE} ${IMAKE_COMPILER_TYPE} 398.if empty(.MAKEFLAGS:M-n) 399IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ 400 LD_LIBRARY_PATH=${INSTALLTMP} \ 401 PATH_LOCALE=${INSTALLTMP}/locale 402IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh 403.else 404IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} 405.endif 406.if defined(DB_FROM_SRC) 407INSTALLFLAGS+= -N ${.CURDIR}/etc 408MTREEFLAGS+= -N ${.CURDIR}/etc 409.endif 410_INSTALL_DDIR= ${DESTDIR}/${DISTDIR} 411INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::} 412.if defined(NO_ROOT) 413METALOG?= ${DESTDIR}/${DISTDIR}/METALOG 414IMAKE+= -DNO_ROOT METALOG=${METALOG} 415INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR} 416MTREEFLAGS+= -W 417.endif 418.if defined(DB_FROM_SRC) || defined(NO_ROOT) 419IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}" 420IMAKE_MTREE= MTREE_CMD="nmtree ${MTREEFLAGS}" 421.endif 422 423# kernel stage 424KMAKEENV= ${WMAKEENV} 425KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} 426 427# 428# buildworld 429# 430# Attempt to rebuild the entire system, with reasonable chance of 431# success, regardless of how old your existing system is. 432# 433_worldtmp: 434.if ${.CURDIR:C/[^,]//g} != "" 435# The m4 build of sendmail files doesn't like it if ',' is used 436# anywhere in the path of it's files. 437 @echo 438 @echo "*** Error: path to source tree contains a comma ','" 439 @echo 440 false 441.endif 442 @echo 443 @echo "--------------------------------------------------------------" 444 @echo ">>> Rebuilding the temporary build tree" 445 @echo "--------------------------------------------------------------" 446.if !defined(NO_CLEAN) 447 rm -rf ${WORLDTMP} 448.if defined(LIB32TMP) 449 rm -rf ${LIB32TMP} 450.endif 451.else 452 rm -rf ${WORLDTMP}/legacy/usr/include 453# XXX - These three can depend on any header file. 454 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c 455 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c 456 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c 457.endif 458.for _dir in \ 459 lib usr legacy/bin legacy/usr 460 mkdir -p ${WORLDTMP}/${_dir} 461.endfor 462 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 463 -p ${WORLDTMP}/legacy/usr >/dev/null 464.if ${MK_GROFF} != "no" 465 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \ 466 -p ${WORLDTMP}/legacy/usr >/dev/null 467.endif 468 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 469 -p ${WORLDTMP}/usr >/dev/null 470 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 471 -p ${WORLDTMP}/usr/include >/dev/null 472 ln -sf ${.CURDIR}/sys ${WORLDTMP} 473.if ${MK_DEBUG_FILES} != "no" 474 # We could instead disable debug files for these build stages 475 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 476 -p ${WORLDTMP}/legacy/usr/lib >/dev/null 477 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 478 -p ${WORLDTMP}/usr/lib >/dev/null 479.endif 480.if ${MK_BIND_LIBS} != "no" 481 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \ 482 -p ${WORLDTMP}/usr/include >/dev/null 483.endif 484.for _mtree in ${LOCAL_MTREE} 485 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null 486.endfor 487_legacy: 488 @echo 489 @echo "--------------------------------------------------------------" 490 @echo ">>> stage 1.1: legacy release compatibility shims" 491 @echo "--------------------------------------------------------------" 492 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy 493_bootstrap-tools: 494 @echo 495 @echo "--------------------------------------------------------------" 496 @echo ">>> stage 1.2: bootstrap tools" 497 @echo "--------------------------------------------------------------" 498 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools 499_cleanobj: 500.if !defined(NO_CLEAN) 501 @echo 502 @echo "--------------------------------------------------------------" 503 @echo ">>> stage 2.1: cleaning up the object tree" 504 @echo "--------------------------------------------------------------" 505 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} 506.if defined(LIB32TMP) 507 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/} 508.endif 509.endif 510_obj: 511 @echo 512 @echo "--------------------------------------------------------------" 513 @echo ">>> stage 2.2: rebuilding the object tree" 514 @echo "--------------------------------------------------------------" 515 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj 516_build-tools: 517 @echo 518 @echo "--------------------------------------------------------------" 519 @echo ">>> stage 2.3: build tools" 520 @echo "--------------------------------------------------------------" 521 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools 522_cross-tools: 523 @echo 524 @echo "--------------------------------------------------------------" 525 @echo ">>> stage 3: cross tools" 526 @echo "--------------------------------------------------------------" 527 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools 528_includes: 529 @echo 530 @echo "--------------------------------------------------------------" 531 @echo ">>> stage 4.1: building includes" 532 @echo "--------------------------------------------------------------" 533 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes 534_libraries: 535 @echo 536 @echo "--------------------------------------------------------------" 537 @echo ">>> stage 4.2: building libraries" 538 @echo "--------------------------------------------------------------" 539 ${_+_}cd ${.CURDIR}; \ 540 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ 541 -DWITHOUT_MAN -DNO_PROFILE libraries 542_depend: 543 @echo 544 @echo "--------------------------------------------------------------" 545 @echo ">>> stage 4.3: make dependencies" 546 @echo "--------------------------------------------------------------" 547 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend 548everything: 549 @echo 550 @echo "--------------------------------------------------------------" 551 @echo ">>> stage 4.4: building everything" 552 @echo "--------------------------------------------------------------" 553 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all 554.if defined(LIB32TMP) 555build32: 556 @echo 557 @echo "--------------------------------------------------------------" 558 @echo ">>> stage 5.1: building 32 bit shim libraries" 559 @echo "--------------------------------------------------------------" 560 mkdir -p ${LIB32TMP}/usr/include 561 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 562 -p ${LIB32TMP}/usr >/dev/null 563 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 564 -p ${LIB32TMP}/usr/include >/dev/null 565.if ${MK_DEBUG_FILES} != "no" 566 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 567 -p ${LIB32TMP}/usr/lib >/dev/null 568.endif 569 mkdir -p ${WORLDTMP} 570 ln -sf ${.CURDIR}/sys ${WORLDTMP} 571.for _t in obj includes 572 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t} 573 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t} 574.if ${MK_CDDL} != "no" 575 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t} 576.endif 577 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t} 578.if ${MK_CRYPT} != "no" 579 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t} 580.endif 581.if ${MK_KERBEROS} != "no" 582 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t} 583.endif 584.endfor 585.for _dir in usr.bin/lex/lib 586 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj 587.endfor 588.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic 589 cd ${.CURDIR}/${_dir}; \ 590 WORLDTMP=${WORLDTMP} \ 591 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ 592 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \ 593 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \ 594 -DEARLY_BUILD build-tools 595.endfor 596 cd ${.CURDIR}; \ 597 ${LIB32WMAKE} -f Makefile.inc1 libraries 598.for _t in obj depend all 599 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \ 600 DIRPRFX=libexec/rtld-elf/ ${_t} 601 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \ 602 DIRPRFX=usr.bin/ldd ${_t} 603.endfor 604 605distribute32 install32: 606 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 607.if ${MK_CDDL} != "no" 608 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 609.endif 610 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 611.if ${MK_CRYPT} != "no" 612 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 613.endif 614.if ${MK_KERBEROS} != "no" 615 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 616.endif 617 cd ${.CURDIR}/libexec/rtld-elf; \ 618 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//} 619 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//} 620.endif 621 622WMAKE_TGTS= 623.if !defined(SUBDIR_OVERRIDE) 624WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools 625.endif 626WMAKE_TGTS+= _cleanobj _obj _build-tools 627.if !defined(SUBDIR_OVERRIDE) 628WMAKE_TGTS+= _cross-tools 629.endif 630WMAKE_TGTS+= _includes _libraries _depend everything 631.if defined(LIB32TMP) && ${MK_LIB32} != "no" 632WMAKE_TGTS+= build32 633.endif 634 635buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 636.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 637 638buildworld_prologue: 639 @echo "--------------------------------------------------------------" 640 @echo ">>> World build started on `LC_ALL=C date`" 641 @echo "--------------------------------------------------------------" 642 643buildworld_epilogue: 644 @echo 645 @echo "--------------------------------------------------------------" 646 @echo ">>> World build completed on `LC_ALL=C date`" 647 @echo "--------------------------------------------------------------" 648 649# 650# We need to have this as a target because the indirection between Makefile 651# and Makefile.inc1 causes the correct PATH to be used, rather than a 652# modification of the current environment's PATH. In addition, we need 653# to quote multiword values. 654# 655buildenvvars: 656 @echo ${WMAKEENV:Q} 657 658buildenv: 659 @echo Entering world for ${TARGET_ARCH}:${TARGET} 660 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true 661 662TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32} 663toolchain: ${TOOLCHAIN_TGTS} 664kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} 665 666# 667# installcheck 668# 669# Checks to be sure system is ready for installworld/installkernel. 670# 671installcheck: 672installcheck_UGID: 673 674# 675# Require DESTDIR to be set if installing for a different architecture or 676# using the user/group database in the source tree. 677# 678.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \ 679 defined(DB_FROM_SRC) 680.if !make(distributeworld) 681installcheck: installcheck_DESTDIR 682installcheck_DESTDIR: 683.if !defined(DESTDIR) || empty(DESTDIR) 684 @echo "ERROR: Please set DESTDIR!"; \ 685 false 686.endif 687.endif 688.endif 689 690.if !defined(DB_FROM_SRC) 691# 692# Check for missing UIDs/GIDs. 693# 694CHECK_UIDS= auditdistd 695CHECK_GIDS= audit 696.if ${MK_SENDMAIL} != "no" 697CHECK_UIDS+= smmsp 698CHECK_GIDS+= smmsp 699.endif 700.if ${MK_PF} != "no" 701CHECK_UIDS+= proxy 702CHECK_GIDS+= proxy authpf 703.endif 704installcheck_UGID: 705.for uid in ${CHECK_UIDS} 706 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 707 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 708 false; \ 709 fi 710.endfor 711.for gid in ${CHECK_GIDS} 712 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 713 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 714 false; \ 715 fi 716.endfor 717.endif 718 719# 720# Required install tools to be saved in a scratch dir for safety. 721# 722.if ${MK_INFO} != "no" 723_install-info= install-info 724.endif 725.if ${MK_ZONEINFO} != "no" 726_zoneinfo= zic tzsetup 727.endif 728 729.if exists(/usr/sbin/nmtree) 730_nmtree_itools= nmtree 731.endif 732 733ITOOLS= [ awk cap_mkdb cat chflags chmod chown \ 734 date echo egrep find grep id install ${_install-info} \ 735 ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \ 736 rm sed sh sysctl test true uname wc ${_zoneinfo} 737 738# 739# distributeworld 740# 741# Distributes everything compiled by a `buildworld'. 742# 743# installworld 744# 745# Installs everything compiled by a 'buildworld'. 746# 747 748# Non-base distributions produced by the base system 749EXTRA_DISTRIBUTIONS= doc 750.if ${MK_GAMES} != "no" 751EXTRA_DISTRIBUTIONS+= games 752.endif 753.if defined(LIB32TMP) && ${MK_LIB32} != "no" 754EXTRA_DISTRIBUTIONS+= lib32 755.endif 756 757MTREE_MAGIC?= mtree 2.0 758 759distributeworld installworld: installcheck installcheck_UGID 760 mkdir -p ${INSTALLTMP} 761 progs=$$(for prog in ${ITOOLS}; do \ 762 if progpath=`which $$prog`; then \ 763 echo $$progpath; \ 764 else \ 765 echo "Required tool $$prog not found in PATH." >&2; \ 766 exit 1; \ 767 fi; \ 768 done); \ 769 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \ 770 while read line; do \ 771 set -- $$line; \ 772 if [ "$$2 $$3" != "not found" ]; then \ 773 echo $$2; \ 774 else \ 775 echo "Required library $$1 not found." >&2; \ 776 exit 1; \ 777 fi; \ 778 done); \ 779 cp $$libs $$progs ${INSTALLTMP} 780 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale 781.if defined(NO_ROOT) 782 echo "#${MTREE_MAGIC}" > ${METALOG} 783.endif 784.if make(distributeworld) 785.for dist in ${EXTRA_DISTRIBUTIONS} 786 -mkdir ${DESTDIR}/${DISTDIR}/${dist} 787 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 788 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null 789 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 790 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 791 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 792 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null 793.if ${MK_DEBUG_FILES} != "no" 794 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 795 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null 796.endif 797.if defined(NO_ROOT) 798 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ 799 sed -e 's#^\./#./${dist}/#' >> ${METALOG} 800 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \ 801 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 802 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \ 803 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG} 804.endif 805.endfor 806 -mkdir ${DESTDIR}/${DISTDIR}/base 807 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 808 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \ 809 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \ 810 LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs 811.endif 812 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 813 ${IMAKEENV} rm -rf ${INSTALLTMP} 814.if make(distributeworld) 815.for dist in ${EXTRA_DISTRIBUTIONS} 816 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete 817.endfor 818.if defined(NO_ROOT) 819.for dist in base ${EXTRA_DISTRIBUTIONS} 820 @# For each file that exists in this dist, print the corresponding 821 @# line from the METALOG. This relies on the fact that 822 @# a line containing only the filename will sort immediatly before 823 @# the relevant mtree line. 824 cd ${DESTDIR}/${DISTDIR}; \ 825 find ./${dist} | sort -u ${METALOG} - | \ 826 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 827 ${DESTDIR}/${DISTDIR}/${dist}.meta 828.endfor 829.endif 830.endif 831 832packageworld: 833.for dist in base ${EXTRA_DISTRIBUTIONS} 834.if defined(NO_ROOT) 835 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 836 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \ 837 @${DESTDIR}/${DISTDIR}/${dist}.meta 838.else 839 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 840 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz . 841.endif 842.endfor 843 844# 845# reinstall 846# 847# If you have a build server, you can NFS mount the source and obj directories 848# and do a 'make reinstall' on the *client* to install new binaries from the 849# most recent server build. 850# 851reinstall: 852 @echo "--------------------------------------------------------------" 853 @echo ">>> Making hierarchy" 854 @echo "--------------------------------------------------------------" 855 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 856 LOCAL_MTREE=${LOCAL_MTREE} hierarchy 857 @echo 858 @echo "--------------------------------------------------------------" 859 @echo ">>> Installing everything" 860 @echo "--------------------------------------------------------------" 861 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 862.if defined(LIB32TMP) && ${MK_LIB32} != "no" 863 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 864.endif 865 866redistribute: 867 @echo "--------------------------------------------------------------" 868 @echo ">>> Distributing everything" 869 @echo "--------------------------------------------------------------" 870 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 871.if defined(LIB32TMP) && ${MK_LIB32} != "no" 872 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \ 873 DISTRIBUTION=lib32 874.endif 875 876distrib-dirs distribution: 877 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 878 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET} 879 880# 881# buildkernel and installkernel 882# 883# Which kernels to build and/or install is specified by setting 884# KERNCONF. If not defined a GENERIC kernel is built/installed. 885# Only the existing (depending TARGET) config files are used 886# for building kernels and only the first of these is designated 887# as the one being installed. 888# 889# Note that we have to use TARGET instead of TARGET_ARCH when 890# we're in kernel-land. Since only TARGET_ARCH is (expected) to 891# be set to cross-build, we have to make sure TARGET is set 892# properly. 893 894.if defined(KERNFAST) 895NO_KERNELCLEAN= t 896NO_KERNELCONFIG= t 897NO_KERNELDEPEND= t 898NO_KERNELOBJ= t 899# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 900.if !defined(KERNCONF) && ${KERNFAST} != "1" 901KERNCONF=${KERNFAST} 902.endif 903.endif 904.if ${TARGET_ARCH} == "powerpc64" 905KERNCONF?= GENERIC64 906.else 907KERNCONF?= GENERIC 908.endif 909INSTKERNNAME?= kernel 910 911KERNSRCDIR?= ${.CURDIR}/sys 912KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 913KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 914KERNCONFDIR?= ${KRNLCONFDIR} 915 916BUILDKERNELS= 917INSTALLKERNEL= 918.for _kernel in ${KERNCONF} 919.if exists(${KERNCONFDIR}/${_kernel}) 920BUILDKERNELS+= ${_kernel} 921.if empty(INSTALLKERNEL) 922INSTALLKERNEL= ${_kernel} 923.endif 924.endif 925.endfor 926 927# 928# buildkernel 929# 930# Builds all kernels defined by BUILDKERNELS. 931# 932buildkernel: 933.if empty(BUILDKERNELS) 934 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 935 false 936.endif 937 @echo 938.for _kernel in ${BUILDKERNELS} 939 @echo "--------------------------------------------------------------" 940 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 941 @echo "--------------------------------------------------------------" 942 @echo "===> ${_kernel}" 943 mkdir -p ${KRNLOBJDIR} 944.if !defined(NO_KERNELCONFIG) 945 @echo 946 @echo "--------------------------------------------------------------" 947 @echo ">>> stage 1: configuring the kernel" 948 @echo "--------------------------------------------------------------" 949 cd ${KRNLCONFDIR}; \ 950 PATH=${TMPPATH} \ 951 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 952 ${KERNCONFDIR}/${_kernel} 953.endif 954.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 955 @echo 956 @echo "--------------------------------------------------------------" 957 @echo ">>> stage 2.1: cleaning up the object tree" 958 @echo "--------------------------------------------------------------" 959 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 960.endif 961.if !defined(NO_KERNELOBJ) 962 @echo 963 @echo "--------------------------------------------------------------" 964 @echo ">>> stage 2.2: rebuilding the object tree" 965 @echo "--------------------------------------------------------------" 966 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 967.endif 968 @echo 969 @echo "--------------------------------------------------------------" 970 @echo ">>> stage 2.3: build tools" 971 @echo "--------------------------------------------------------------" 972 cd ${KRNLOBJDIR}/${_kernel}; \ 973 PATH=${BPATH}:${PATH} \ 974 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ 975 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \ 976 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile 977# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. 978.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) 979.for target in obj depend all 980 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ 981 PATH=${BPATH}:${PATH} \ 982 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ 983 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target} 984.endfor 985.endif 986.if !defined(NO_KERNELDEPEND) 987 @echo 988 @echo "--------------------------------------------------------------" 989 @echo ">>> stage 3.1: making dependencies" 990 @echo "--------------------------------------------------------------" 991 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ 992.endif 993 @echo 994 @echo "--------------------------------------------------------------" 995 @echo ">>> stage 3.2: building everything" 996 @echo "--------------------------------------------------------------" 997 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 998 @echo "--------------------------------------------------------------" 999 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 1000 @echo "--------------------------------------------------------------" 1001.endfor 1002 1003# 1004# installkernel, etc. 1005# 1006# Install the kernel defined by INSTALLKERNEL 1007# 1008installkernel installkernel.debug \ 1009reinstallkernel reinstallkernel.debug: installcheck 1010.if empty(INSTALLKERNEL) 1011 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1012 false 1013.endif 1014 @echo "--------------------------------------------------------------" 1015 @echo ">>> Installing kernel ${INSTALLKERNEL}" 1016 @echo "--------------------------------------------------------------" 1017 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1018 ${CROSSENV} PATH=${TMPPATH} \ 1019 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 1020 1021distributekernel distributekernel.debug: 1022.if empty(INSTALLKERNEL) 1023 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1024 false 1025.endif 1026 mkdir -p ${DESTDIR}/${DISTDIR} 1027.if defined(NO_ROOT) 1028 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta 1029.endif 1030 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1031 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \ 1032 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \ 1033 DESTDIR=${INSTALL_DDIR}/kernel \ 1034 ${.TARGET:S/distributekernel/install/} 1035.if defined(NO_ROOT) 1036 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \ 1037 ${DESTDIR}/${DISTDIR}/kernel.meta 1038.endif 1039.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 1040.if defined(NO_ROOT) 1041 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta 1042.endif 1043 cd ${KRNLOBJDIR}/${_kernel}; \ 1044 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \ 1045 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \ 1046 KERNEL=${INSTKERNNAME}.${_kernel} \ 1047 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \ 1048 ${.TARGET:S/distributekernel/install/} 1049 sed -e 's|^./kernel|.|' \ 1050 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \ 1051 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1052.endfor 1053 1054packagekernel: 1055.if defined(NO_ROOT) 1056 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1057 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \ 1058 @${DESTDIR}/${DISTDIR}/kernel.meta 1059.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 1060 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1061 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \ 1062 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1063.endfor 1064.else 1065 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1066 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz . 1067.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 1068 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1069 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz . 1070.endfor 1071.endif 1072 1073# 1074# doxygen 1075# 1076# Build the API documentation with doxygen 1077# 1078doxygen: 1079 @if [ ! -x `/usr/bin/which doxygen` ]; then \ 1080 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 1081 exit 1; \ 1082 fi 1083 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all 1084 1085# 1086# update 1087# 1088# Update the source tree(s), by running svn/svnup to update to the 1089# latest copy. 1090# 1091update: 1092.if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE) 1093 @echo "--------------------------------------------------------------" 1094 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported." 1095 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated" 1096 @echo "--------------------------------------------------------------" 1097 @exit 1 1098.endif 1099.if defined(SVN_UPDATE) 1100 @echo "--------------------------------------------------------------" 1101 @echo ">>> Updating ${.CURDIR} using Subversion" 1102 @echo "--------------------------------------------------------------" 1103 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS}) 1104.endif 1105 1106# 1107# ------------------------------------------------------------------------ 1108# 1109# From here onwards are utility targets used by the 'make world' and 1110# related targets. If your 'world' breaks, you may like to try to fix 1111# the problem and manually run the following targets to attempt to 1112# complete the build. Beware, this is *not* guaranteed to work, you 1113# need to have a pretty good grip on the current state of the system 1114# to attempt to manually finish it. If in doubt, 'make world' again. 1115# 1116 1117# 1118# legacy: Build compatibility shims for the next three targets 1119# 1120legacy: 1121.if ${BOOTSTRAPPING} < 700055 && ${BOOTSTRAPPING} != 0 1122 @echo "ERROR: Source upgrades from versions prior to 7.0 not supported."; \ 1123 false 1124.endif 1125.for _tool in tools/build 1126 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ 1127 cd ${.CURDIR}/${_tool}; \ 1128 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1129 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 1130 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1131 ${MAKE} DIRPRFX=${_tool}/ all; \ 1132 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1133.endfor 1134 1135# 1136# bootstrap-tools: Build tools needed for compatibility 1137# 1138.if ${MK_GAMES} != "no" 1139_strfile= games/fortune/strfile 1140.endif 1141 1142.if ${MK_CXX} != "no" 1143_gperf= gnu/usr.bin/gperf 1144.endif 1145 1146.if ${MK_GROFF} != "no" 1147_groff= gnu/usr.bin/groff 1148.endif 1149 1150.if ${BOOTSTRAPPING} < 800022 1151_ar= usr.bin/ar 1152.endif 1153 1154.if ${BOOTSTRAPPING} < 800013 1155_mklocale= usr.bin/mklocale 1156.endif 1157 1158.if ${BOOTSTRAPPING} < 900002 1159_sed= usr.bin/sed 1160.endif 1161 1162.if ${BOOTSTRAPPING} < 900006 1163_lex= usr.bin/lex 1164.endif 1165 1166.if ${BOOTSTRAPPING} < 1000002 1167_m4= usr.bin/m4 1168.endif 1169 1170.if ${BOOTSTRAPPING} < 1000013 1171_yacc= lib/liby \ 1172 usr.bin/yacc 1173.endif 1174 1175.if ${BOOTSTRAPPING} < 1000014 1176_crunch= usr.sbin/crunch 1177.endif 1178 1179.if ${BOOTSTRAPPING} < 1000026 1180_nmtree= lib/libnetbsd \ 1181 usr.sbin/nmtree 1182.endif 1183 1184.if ${BOOTSTRAPPING} < 1000027 1185_cat= bin/cat 1186.endif 1187 1188.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041 1189_awk= usr.bin/awk 1190.endif 1191 1192.if ${MK_BSNMP} != "no" && !exists(/usr/sbin/gensnmptree) 1193_gensnmptree= usr.sbin/bsnmpd/gensnmptree 1194.endif 1195 1196.if ${MK_CLANG} != "no" 1197_clang_tblgen= \ 1198 lib/clang/libllvmsupport \ 1199 lib/clang/libllvmtablegen \ 1200 usr.bin/clang/tblgen \ 1201 usr.bin/clang/clang-tblgen 1202.endif 1203 1204# dtrace tools are required for older bootstrap env and cross-build 1205.if ${MK_CDDL} != "no" && \ 1206 ((${BOOTSTRAPPING} < 1000034 && \ 1207 !(${BOOTSTRAPPING} >= 901505 && ${BOOTSTRAPPING} < 999999)) \ 1208 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH})) 1209_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \ 1210 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge 1211.endif 1212 1213# Default to building the BSDL DTC, but build the GPL one if users explicitly 1214# request it. 1215_dtc= usr.bin/dtc 1216.if ${MK_GPL_DTC} != "no" 1217_dtc= gnu/usr.bin/dtc 1218.endif 1219 1220.if ${MK_KERBEROS} != "no" 1221_kerberos5_bootstrap_tools= \ 1222 kerberos5/tools/make-roken \ 1223 kerberos5/lib/libroken \ 1224 kerberos5/lib/libvers \ 1225 kerberos5/tools/asn1_compile \ 1226 kerberos5/tools/slc \ 1227 usr.bin/compile_et 1228.endif 1229 1230# Please document (add comment) why something is in 'bootstrap-tools'. 1231# Try to bound the building of the bootstrap-tool to just the 1232# FreeBSD versions that need the tool built at this stage of the build. 1233bootstrap-tools: 1234.for _tool in \ 1235 ${_clang_tblgen} \ 1236 ${_kerberos5_bootstrap_tools} \ 1237 ${_dtrace_tools} \ 1238 ${_strfile} \ 1239 ${_gperf} \ 1240 ${_groff} \ 1241 ${_ar} \ 1242 ${_dtc} \ 1243 ${_awk} \ 1244 ${_cat} \ 1245 usr.bin/lorder \ 1246 usr.bin/makewhatis \ 1247 ${_mklocale} \ 1248 usr.bin/rpcgen \ 1249 ${_sed} \ 1250 ${_yacc} \ 1251 ${_m4} \ 1252 ${_lex} \ 1253 lib/libmd \ 1254 usr.bin/xinstall \ 1255 ${_gensnmptree} \ 1256 usr.sbin/config \ 1257 ${_crunch} \ 1258 ${_nmtree} 1259 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1260 cd ${.CURDIR}/${_tool}; \ 1261 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1262 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1263 ${MAKE} DIRPRFX=${_tool}/ all; \ 1264 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1265.endfor 1266 1267# 1268# build-tools: Build special purpose build tools 1269# 1270.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) 1271_aicasm= sys/modules/aic7xxx/aicasm 1272.endif 1273 1274.if !defined(NO_SHARE) 1275_share= share/syscons/scrnmaps 1276.endif 1277 1278.if ${MK_GCC} != "no" 1279_gcc_tools= gnu/usr.bin/cc/cc_tools 1280.endif 1281 1282.if ${MK_RESCUE} != "no" 1283_rescue= rescue/rescue 1284.endif 1285 1286build-tools: 1287.for _tool in \ 1288 bin/csh \ 1289 bin/sh \ 1290 ${_rescue} \ 1291 ${LOCAL_TOOL_DIRS} \ 1292 lib/ncurses/ncurses \ 1293 lib/ncurses/ncursesw \ 1294 ${_share} \ 1295 ${_aicasm} \ 1296 usr.bin/awk \ 1297 lib/libmagic \ 1298 usr.bin/mkesdb_static \ 1299 usr.bin/mkcsmapper_static 1300 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 1301 cd ${.CURDIR}/${_tool}; \ 1302 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1303 ${MAKE} DIRPRFX=${_tool}/ build-tools 1304.endfor 1305.for _tool in \ 1306 ${_gcc_tools} 1307 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ 1308 cd ${.CURDIR}/${_tool}; \ 1309 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1310 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1311 ${MAKE} DIRPRFX=${_tool}/ all 1312.endfor 1313 1314# 1315# cross-tools: Build cross-building tools 1316# 1317.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035 1318.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 1319_btxld= usr.sbin/btxld 1320.endif 1321.endif 1322.if ${TARGET_ARCH} != ${MACHINE_ARCH} 1323.if ${MK_RESCUE} != "no" || defined(RELEASEDIR) 1324_crunchide= usr.sbin/crunch/crunchide 1325.endif 1326.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR) 1327_kgzip= usr.sbin/kgzip 1328.endif 1329.endif 1330 1331.if ${XAS:M/*} == "" && ${MK_BINUTILS} != "no" 1332_binutils= gnu/usr.bin/binutils 1333.endif 1334 1335# If an full path to an external cross compiler is given, don't build 1336# a cross compiler. 1337.if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no" 1338.if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") 1339_clang= usr.bin/clang 1340_clang_libs= lib/clang 1341.endif 1342 1343.if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98") 1344_cc= gnu/usr.bin/cc 1345.endif 1346.endif 1347 1348cross-tools: 1349.for _tool in \ 1350 ${_clang_libs} \ 1351 ${_clang} \ 1352 ${_binutils} \ 1353 ${_cc} \ 1354 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ 1355 ${_btxld} \ 1356 ${_crunchide} \ 1357 ${_kgzip} 1358 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1359 cd ${.CURDIR}/${_tool}; \ 1360 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1361 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1362 ${MAKE} DIRPRFX=${_tool}/ all; \ 1363 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 1364.endfor 1365 1366# 1367# hierarchy - ensure that all the needed directories are present 1368# 1369hierarchy hier: 1370.if defined(NO_ROOT) 1371 cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} \ 1372 -DNO_ROOT METALOG=${METALOG} distrib-dirs 1373.else 1374 cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs 1375.endif 1376 1377# 1378# libraries - build all libraries, and install them under ${DESTDIR}. 1379# 1380# The list of libraries with dependents (${_prebuild_libs}) and their 1381# interdependencies (__L) are built automatically by the 1382# ${.CURDIR}/tools/make_libdeps.sh script. 1383# 1384libraries: 1385 cd ${.CURDIR}; \ 1386 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 1387 ${MAKE} -f Makefile.inc1 _startup_libs; \ 1388 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 1389 ${MAKE} -f Makefile.inc1 _generic_libs; 1390 1391# 1392# static libgcc.a prerequisite for shared libc 1393# 1394_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt 1395 1396# These dependencies are not automatically generated: 1397# 1398# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 1399# all shared libraries for ELF. 1400# 1401_startup_libs= gnu/lib/csu 1402.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 1403_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 1404.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}) 1405_startup_libs+= lib/csu/${MACHINE_ARCH} 1406.else 1407_startup_libs+= lib/csu/${MACHINE_CPUARCH} 1408.endif 1409_startup_libs+= gnu/lib/libgcc 1410_startup_libs+= lib/libcompiler_rt 1411_startup_libs+= lib/libc 1412.if ${MK_LIBCPLUSPLUS} != "no" 1413_startup_libs+= lib/libcxxrt 1414.endif 1415 1416gnu/lib/libgcc__L: lib/libc__L 1417.if ${MK_LIBCPLUSPLUS} != "no" 1418lib/libcxxrt__L: gnu/lib/libgcc__L 1419.endif 1420 1421_prebuild_libs= ${_kerberos5_lib_libasn1} \ 1422 ${_kerberos5_lib_libhdb} \ 1423 ${_kerberos5_lib_libheimbase} \ 1424 ${_kerberos5_lib_libheimntlm} \ 1425 ${_kerberos5_lib_libheimsqlite} \ 1426 ${_kerberos5_lib_libheimipcc} \ 1427 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 1428 ${_kerberos5_lib_libroken} \ 1429 ${_kerberos5_lib_libwind} \ 1430 ${_lib_atf_libatf_c} \ 1431 lib/libbz2 ${_libcom_err} lib/libcrypt \ 1432 lib/libelf lib/libexpat \ 1433 ${_lib_libgssapi} ${_lib_libipx} \ 1434 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \ 1435 lib/ncurses/ncurses lib/ncurses/ncursesw \ 1436 lib/libopie lib/libpam ${_lib_libthr} \ 1437 lib/libradius lib/libsbuf lib/libtacplus \ 1438 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ 1439 ${_cddl_lib_libzfs_core} \ 1440 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ 1441 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ 1442 ${_secure_lib_libssl} 1443 1444.if ${MK_ATF} != "no" 1445_lib_atf_libatf_c= lib/atf/libatf-c 1446.endif 1447 1448.if ${MK_LIBTHR} != "no" 1449_lib_libthr= lib/libthr 1450.endif 1451 1452.if ${MK_OFED} != "no" 1453_ofed_lib= contrib/ofed/usr.lib/ 1454.endif 1455 1456_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} 1457.for _DIR in ${LOCAL_LIB_DIRS} 1458.if exists(${.CURDIR}/${_DIR}/Makefile) 1459_generic_libs+= ${_DIR} 1460.endif 1461.endfor 1462 1463lib/libopie__L lib/libtacplus__L: lib/libmd__L 1464 1465.if ${MK_CDDL} != "no" 1466_cddl_lib_libumem= cddl/lib/libumem 1467_cddl_lib_libnvpair= cddl/lib/libnvpair 1468_cddl_lib_libzfs_core= cddl/lib/libzfs_core 1469_cddl_lib= cddl/lib 1470cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L 1471.endif 1472 1473.if ${MK_CRYPT} != "no" 1474.if ${MK_OPENSSL} != "no" 1475_secure_lib_libcrypto= secure/lib/libcrypto 1476_secure_lib_libssl= secure/lib/libssl 1477lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 1478.if ${MK_OPENSSH} != "no" 1479_secure_lib_libssh= secure/lib/libssh 1480secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 1481.if ${MK_KERBEROS_SUPPORT} != "no" 1482secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 1483 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 1484 lib/libmd__L kerberos5/lib/libroken__L 1485.endif 1486.endif 1487.endif 1488_secure_lib= secure/lib 1489.endif 1490 1491.if ${MK_KERBEROS} != "no" 1492kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L 1493kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1494 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ 1495 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L 1496kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ 1497 kerberos5/lib/libroken__L lib/libcom_err__L 1498kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1499 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L 1500kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1501 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ 1502 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ 1503 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L 1504kerberos5/lib/libroken__L: lib/libcrypt__L 1505kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L 1506kerberos5/lib/libheimbase__L: lib/libthr__L 1507kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L 1508kerberos5/lib/libheimsqlite__L: lib/libthr__L 1509.endif 1510 1511.if ${MK_GSSAPI} != "no" 1512_lib_libgssapi= lib/libgssapi 1513.endif 1514 1515.if ${MK_IPX} != "no" 1516_lib_libipx= lib/libipx 1517.endif 1518 1519.if ${MK_KERBEROS} != "no" 1520_kerberos5_lib= kerberos5/lib 1521_kerberos5_lib_libasn1= kerberos5/lib/libasn1 1522_kerberos5_lib_libhdb= kerberos5/lib/libhdb 1523_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase 1524_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 1525_kerberos5_lib_libhx509= kerberos5/lib/libhx509 1526_kerberos5_lib_libroken= kerberos5/lib/libroken 1527_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 1528_kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite 1529_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc 1530_kerberos5_lib_libwind= kerberos5/lib/libwind 1531_libcom_err= lib/libcom_err 1532.endif 1533 1534.if ${MK_NIS} != "no" 1535_lib_libypclnt= lib/libypclnt 1536.endif 1537 1538.if ${MK_OPENSSL} == "no" 1539lib/libradius__L: lib/libmd__L 1540.endif 1541 1542.for _lib in ${_prereq_libs} 1543${_lib}__PL: .PHONY 1544.if exists(${.CURDIR}/${_lib}) 1545 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1546 cd ${.CURDIR}/${_lib}; \ 1547 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1548 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1549 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \ 1550 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install 1551.endif 1552.endfor 1553 1554.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 1555${_lib}__L: .PHONY 1556.if exists(${.CURDIR}/${_lib}) 1557 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1558 cd ${.CURDIR}/${_lib}; \ 1559 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1560 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1561 ${MAKE} DIRPRFX=${_lib}/ all; \ 1562 ${MAKE} DIRPRFX=${_lib}/ install 1563.endif 1564.endfor 1565 1566# libpam is special: we need to build static PAM modules before 1567# static PAM library, and dynamic PAM library before dynamic PAM 1568# modules. 1569lib/libpam__L: .PHONY 1570 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ 1571 cd ${.CURDIR}/lib/libpam; \ 1572 ${MAKE} DIRPRFX=lib/libpam/ obj; \ 1573 ${MAKE} DIRPRFX=lib/libpam/ depend; \ 1574 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ 1575 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install 1576 1577_prereq_libs: ${_prereq_libs:S/$/__PL/} 1578_startup_libs: ${_startup_libs:S/$/__L/} 1579_prebuild_libs: ${_prebuild_libs:S/$/__L/} 1580_generic_libs: ${_generic_libs:S/$/__L/} 1581 1582.for __target in all clean cleandepend cleandir depend includes obj 1583.for entry in ${SUBDIR} 1584${entry}.${__target}__D: .PHONY 1585 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 1586 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ 1587 edir=${entry}.${MACHINE_ARCH}; \ 1588 cd ${.CURDIR}/$${edir}; \ 1589 else \ 1590 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ 1591 edir=${entry}; \ 1592 cd ${.CURDIR}/$${edir}; \ 1593 fi; \ 1594 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 1595.endfor 1596par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 1597.endfor 1598 1599.include <bsd.subdir.mk> 1600 1601.if make(check-old) || make(check-old-dirs) || \ 1602 make(check-old-files) || make(check-old-libs) || \ 1603 make(delete-old) || make(delete-old-dirs) || \ 1604 make(delete-old-files) || make(delete-old-libs) 1605 1606# 1607# check for / delete old files section 1608# 1609 1610.include "ObsoleteFiles.inc" 1611 1612OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 1613else you can not start such an application. Consult UPDATING for more \ 1614information regarding how to cope with the removal/revision bump of a \ 1615specific library." 1616 1617.if !defined(BATCH_DELETE_OLD_FILES) 1618RM_I=-i 1619.else 1620RM_I=-v 1621.endif 1622 1623delete-old-files: 1624 @echo ">>> Removing old files (only deletes safe to delete libs)" 1625# Ask for every old file if the user really wants to remove it. 1626# It's annoying, but better safe than sorry. 1627# NB: We cannot pass the list of OLD_FILES as a parameter because the 1628# argument list will get too long. Using .for/.endfor make "loops" will make 1629# the Makefile parser segfault. 1630 @exec 3<&0; \ 1631 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1632 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1633 while read file; do \ 1634 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1635 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1636 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1637 fi; \ 1638 done 1639# Remove catpages without corresponding manpages. 1640 @exec 3<&0; \ 1641 find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1642 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1643 while read catpage; do \ 1644 read manpage; \ 1645 if [ ! -e "$${manpage}" ]; then \ 1646 rm ${RM_I} $${catpage} <&3; \ 1647 fi; \ 1648 done 1649 @echo ">>> Old files removed" 1650 1651check-old-files: 1652 @echo ">>> Checking for old files" 1653 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1654 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1655 while read file; do \ 1656 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1657 echo "${DESTDIR}/$${file}"; \ 1658 fi; \ 1659 done 1660# Check for catpages without corresponding manpages. 1661 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1662 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1663 while read catpage; do \ 1664 read manpage; \ 1665 if [ ! -e "$${manpage}" ]; then \ 1666 echo $${catpage}; \ 1667 fi; \ 1668 done 1669 1670delete-old-libs: 1671 @echo ">>> Removing old libraries" 1672 @echo "${OLD_LIBS_MESSAGE}" | fmt 1673 @exec 3<&0; \ 1674 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1675 -V OLD_LIBS | xargs -n1 | \ 1676 while read file; do \ 1677 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1678 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1679 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1680 fi; \ 1681 done 1682 @echo ">>> Old libraries removed" 1683 1684check-old-libs: 1685 @echo ">>> Checking for old libraries" 1686 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1687 -V OLD_LIBS | xargs -n1 | \ 1688 while read file; do \ 1689 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1690 echo "${DESTDIR}/$${file}"; \ 1691 fi; \ 1692 done 1693 1694delete-old-dirs: 1695 @echo ">>> Removing old directories" 1696 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1697 -V OLD_DIRS | xargs -n1 | \ 1698 while read dir; do \ 1699 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1700 rmdir -v "${DESTDIR}/$${dir}" || true; \ 1701 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1702 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1703 fi; \ 1704 done 1705 @echo ">>> Old directories removed" 1706 1707check-old-dirs: 1708 @echo ">>> Checking for old directories" 1709 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1710 -V OLD_DIRS | xargs -n1 | \ 1711 while read dir; do \ 1712 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1713 echo "${DESTDIR}/$${dir}"; \ 1714 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1715 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1716 fi; \ 1717 done 1718 1719delete-old: delete-old-files delete-old-dirs 1720 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1721 1722check-old: check-old-files check-old-libs check-old-dirs 1723 @echo "To remove old files and directories run '${MAKE} delete-old'." 1724 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1725 1726.endif 1727 1728# 1729# showconfig - show build configuration. 1730# 1731showconfig: 1732 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort 1733 1734.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 1735DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 1736 1737.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 1738.if exists(${KERNCONFDIR}/${KERNCONF}) 1739FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 1740 ${KERNCONFDIR}/${KERNCONF} ; echo 1741.endif 1742.endif 1743 1744.endif 1745 1746.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 1747DTBOUTPUTPATH= ${.CURDIR} 1748.endif 1749 1750# 1751# Build 'standalone' Device Tree Blob 1752# 1753builddtb: 1754 @if [ "${FDT_DTS_FILE}" = "" ]; then \ 1755 echo "ERROR: FDT_DTS_FILE must be specified!"; \ 1756 exit 1; \ 1757 fi; \ 1758 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \ 1759 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \ 1760 exist!"; \ 1761 exit 1; \ 1762 fi; \ 1763 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \ 1764 echo "WARNING: DTB will be placed in the current working \ 1765 directory"; \ 1766 fi 1767 @PATH=${TMPPATH} \ 1768 dtc -O dtb -o \ 1769 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \ 1770 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} 1771 1772############### 1773 1774.if defined(XDEV) && defined(XDEV_ARCH) 1775 1776.if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH} 1777XDEV_CPUTYPE?=${CPUTYPE} 1778.else 1779XDEV_CPUTYPE?=${TARGET_CPUTYPE} 1780.endif 1781 1782NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ 1783 -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \ 1784 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \ 1785 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \ 1786 CPUTYPE=${XDEV_CPUTYPE} 1787 1788XDDIR=${XDEV_ARCH}-freebsd 1789XDTP=/usr/${XDDIR} 1790CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ 1791 INSTALL="sh ${.CURDIR}/tools/install.sh" 1792CDENV= ${CDBENV} \ 1793 _SHLIBDIRPREFIX=${XDDESTDIR} \ 1794 TOOLS_PREFIX=${XDDESTDIR} 1795CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \ 1796 -B${XDDESTDIR}/usr/lib 1797CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" \ 1798 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH} 1799 1800CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp 1801CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1802CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1803XDDESTDIR=${DESTDIR}${XDTP} 1804.if !defined(OSREL) 1805OSREL!= uname -r | sed -e 's/[-(].*//' 1806.endif 1807 1808.ORDER: xdev-build xdev-install 1809xdev: xdev-build xdev-install 1810 1811.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 1812xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 1813 1814_xb-worldtmp: 1815 mkdir -p ${CDTMP}/usr 1816 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1817 -p ${CDTMP}/usr >/dev/null 1818 1819_xb-bootstrap-tools: 1820.for _tool in \ 1821 ${_clang_tblgen} 1822 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1823 cd ${.CURDIR}/${_tool}; \ 1824 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 1825 ${CDMAKE} DIRPRFX=${_tool}/ depend; \ 1826 ${CDMAKE} DIRPRFX=${_tool}/ all; \ 1827 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install 1828.endfor 1829 1830_xb-build-tools: 1831 ${_+_}@cd ${.CURDIR}; \ 1832 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools 1833 1834_xb-cross-tools: 1835.for _tool in \ 1836 gnu/usr.bin/binutils \ 1837 gnu/usr.bin/cc \ 1838 usr.bin/ar \ 1839 ${_clang_libs} \ 1840 ${_clang} 1841 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ 1842 cd ${.CURDIR}/${_tool}; \ 1843 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 1844 ${CDMAKE} DIRPRFX=${_tool}/ depend; \ 1845 ${CDMAKE} DIRPRFX=${_tool}/ all 1846.endfor 1847 1848_xi-mtree: 1849 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 1850 mkdir -p ${XDDESTDIR} 1851 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 1852 -p ${XDDESTDIR} >/dev/null 1853 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1854 -p ${XDDESTDIR}/usr >/dev/null 1855 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1856 -p ${XDDESTDIR}/usr/include >/dev/null 1857 1858.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1859xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1860 1861_xi-cross-tools: 1862 @echo "_xi-cross-tools" 1863.for _tool in \ 1864 gnu/usr.bin/binutils \ 1865 gnu/usr.bin/cc \ 1866 usr.bin/ar \ 1867 ${_clang} 1868 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 1869 cd ${.CURDIR}/${_tool}; \ 1870 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 1871.endfor 1872 1873_xi-includes: 1874 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \ 1875 DESTDIR=${XDDESTDIR} 1876 1877_xi-libraries: 1878 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 1879 DESTDIR=${XDDESTDIR} 1880 1881_xi-links: 1882 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 1883 for i in *; do \ 1884 ln -sf ../../${XDTP}/usr/bin/$$i \ 1885 ../../../../usr/bin/${XDDIR}-$$i; \ 1886 ln -sf ../../${XDTP}/usr/bin/$$i \ 1887 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ 1888 done 1889.else 1890xdev xdev-build xdev-install: 1891 @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target" 1892.endif 1893 1894buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE 1895