Makefile.inc1 revision 211572
1228753Smm# 2228753Smm# $FreeBSD: head/Makefile.inc1 211572 2010-08-21 15:39:06Z rpaulo $ 3228753Smm# 4228753Smm# Make command line options: 5228753Smm# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 6228753Smm# -DNO_CLEAN do not clean at all 7228753Smm# -DNO_SHARE do not go into share subdir 8228753Smm# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ} 9228753Smm# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 10228753Smm# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 11228753Smm# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel 12228753Smm# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel 13228753Smm# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 14228753Smm# -DNO_DOCUPDATE do not update doc in ${MAKE} update 15228753Smm# -DNO_CTF do not run the DTrace CTF conversion tools on built objects 16228753Smm# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 17228753Smm# TARGET="machine" to crossbuild world for a different machine type 18228753Smm# TARGET_ARCH= may be required when a TARGET supports multiple endians 19228753Smm 20228753Smm# 21228753Smm# The intended user-driven targets are: 22228753Smm# buildworld - rebuild *everything*, including glue to help do upgrades 23228753Smm# installworld- install everything built by "buildworld" 24228753Smm# doxygen - build API documentation of the kernel 25228753Smm# update - convenient way to update your source tree (eg: cvsup/cvs) 26228753Smm# 27248616Smm# Standard targets (not defined here) are documented in the makefiles in 28232153Smm# /usr/share/mk. These include: 29228753Smm# obj depend all install clean cleandepend cleanobj 30228753Smm 31228753Smm.include <bsd.own.mk> 32228753Smm 33228753Smm.include <bsd.arch.inc.mk> 34228753Smm 35228753Smm# We must do share/info early so that installation of info `dir' 36228753Smm# entries works correctly. Do it first since it is less likely to 37228753Smm# grow dependencies on include and lib than vice versa. 38228753Smm# 39228753Smm# We must do lib/ and libexec/ before bin/, because if installworld 40228753Smm# installs a new /bin/sh, the 'make' command will *immediately* 41228753Smm# use that new version. And the new (dynamically-linked) /bin/sh 42228753Smm# will expect to find appropriate libraries in /lib and /libexec. 43228753Smm# 44228753SmmSUBDIR= share/info lib libexec 45228753SmmSUBDIR+=bin 46228753Smm.if ${MK_GAMES} != "no" 47228753SmmSUBDIR+=games 48228753Smm.endif 49228753Smm.if ${MK_CDDL} != "no" 50228753SmmSUBDIR+=cddl 51228753Smm.else 52228753SmmNO_CTF=1 53228753Smm.endif 54228753SmmSUBDIR+=gnu include 55228753Smm.if ${MK_KERBEROS} != "no" 56228753SmmSUBDIR+=kerberos5 57228753Smm.endif 58228753Smm.if ${MK_RESCUE} != "no" 59228753SmmSUBDIR+=rescue 60228753Smm.endif 61228753SmmSUBDIR+=sbin 62232153Smm.if ${MK_CRYPT} != "no" 63228753SmmSUBDIR+=secure 64228753Smm.endif 65228753Smm.if !defined(NO_SHARE) 66228753SmmSUBDIR+=share 67228753Smm.endif 68228753SmmSUBDIR+=sys usr.bin usr.sbin 69228753Smm# 70228753Smm# We must do etc/ last for install/distribute to work. 71228753Smm# 72232153SmmSUBDIR+=etc 73228753Smm 74228753Smm# These are last, since it is nice to at least get the base system 75228753Smm# rebuilt before you do them. 76228753Smm.for _DIR in ${LOCAL_DIRS} 77228753Smm.if exists(${.CURDIR}/${_DIR}/Makefile) 78228753SmmSUBDIR+= ${_DIR} 79228753Smm.endif 80228753Smm.endfor 81228753Smm 82228753Smm.if defined(SUBDIR_OVERRIDE) 83232153SmmSUBDIR= ${SUBDIR_OVERRIDE} 84228753Smm.endif 85228753Smm 86228753Smm.if defined(NOCLEAN) 87228753SmmNO_CLEAN= ${NOCLEAN} 88228753Smm.endif 89228753Smm.if defined(NO_CLEANDIR) 90228753SmmCLEANDIR= clean cleandepend 91228753Smm.else 92228753SmmCLEANDIR= cleandir 93228753Smm.endif 94228753Smm 95228753SmmCVS?= cvs 96228753SmmCVSFLAGS?= -A -P -d -I! 97228753SmmSVN?= svn 98228753SmmSVNFLAGS?= -r HEAD 99228753SmmSUP?= /usr/bin/csup 100228753SmmSUPFLAGS?= -g -L 2 101228753Smm.if defined(SUPHOST) 102228753SmmSUPFLAGS+= -h ${SUPHOST} 103228753Smm.endif 104228753Smm 105232153SmmMAKEOBJDIRPREFIX?= /usr/obj 106232153Smm.if !defined(OSRELDATE) 107228753Smm.if exists(/usr/include/osreldate.h) 108228753SmmOSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 109228753Smm /usr/include/osreldate.h 110228753Smm.else 111228753SmmOSRELDATE= 0 112228753Smm.endif 113228753Smm.endif 114232153Smm 115228753Smm.if !defined(VERSION) 116228753SmmVERSION!= uname -srp 117228753SmmVERSION+= ${OSRELDATE} 118228753Smm.endif 119228753Smm 120228753Smm# Guess machine architecture from machine type, and vice versa. 121232153Smm.if !defined(TARGET_ARCH) && defined(TARGET) 122228753SmmTARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/} 123228753Smm.elif !defined(TARGET) && defined(TARGET_ARCH) && \ 124228753Smm ${TARGET_ARCH} != ${MACHINE_ARCH} 125228753SmmTARGET= ${TARGET_ARCH} 126228753Smm.endif 127228753Smm# Otherwise, default to current machine type and architecture. 128228753SmmTARGET?= ${MACHINE} 129228753SmmTARGET_ARCH?= ${MACHINE_ARCH} 130228753Smm 131228753SmmKNOWN_ARCHES?= amd64 arm i386 i386/pc98 ia64 mips powerpc powerpc64/powerpc sparc64 sparc64/sun4v 132228753Smm.if ${TARGET} == ${TARGET_ARCH} 133228753Smm_t= ${TARGET} 134228753Smm.else 135228753Smm_t= ${TARGET_ARCH}/${TARGET} 136228753Smm.endif 137228753Smm.for _t in ${_t} 138228753Smm.if empty(KNOWN_ARCHES:M${_t}) 139228753Smm.error Unknown target ${TARGET_ARCH}:${TARGET}. 140228753Smm.endif 141228753Smm.endfor 142228753Smm 143228777Smm.if ${TARGET} == ${MACHINE} 144228753SmmTARGET_CPUTYPE?=${CPUTYPE} 145228753Smm.else 146228753SmmTARGET_CPUTYPE?= 147228753Smm.endif 148232153Smm 149228753Smm.if !empty(TARGET_CPUTYPE) 150228753Smm_TARGET_CPUTYPE=${TARGET_CPUTYPE} 151228753Smm.else 152228753Smm_TARGET_CPUTYPE=dummy 153232153Smm.endif 154228753Smm_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ 155228753Smm -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE 156232153Smm.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 157228753Smm.error CPUTYPE global should be set with ?=. 158228753Smm.endif 159301047Sglebius.if make(buildworld) 160301047SglebiusBUILD_ARCH!= uname -p 161228753Smm.if ${MACHINE_ARCH} != ${BUILD_ARCH} 162228753Smm.error To cross-build, set TARGET_ARCH. 163232153Smm.endif 164228753Smm.endif 165228753Smm.if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING) 166228753SmmOBJTREE= ${MAKEOBJDIRPREFIX} 167228753Smm.else 168228753SmmOBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} 169228753Smm.endif 170228753SmmWORLDTMP= ${OBJTREE}${.CURDIR}/tmp 171228753Smm# /usr/games added for fortune which depend on strfile 172228753SmmBPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games 173228753SmmXPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games 174228753SmmSTRICTTMPPATH= ${BPATH}:${XPATH} 175228753SmmTMPPATH= ${STRICTTMPPATH}:${PATH} 176232153Smm 177228753Smm# 178228753Smm# Avoid running mktemp(1) unless actually needed. 179228753Smm# It may not be functional, e.g., due to new ABI 180248616Smm# when in the middle of installing over this system. 181248616Smm# 182248616Smm.if make(distributeworld) || make(installworld) 183248616SmmINSTALLTMP!= /usr/bin/mktemp -d -u -t install 184248616Smm.endif 185232153Smm 186228753Smm# 187228753Smm# Building a world goes through the following stages 188228753Smm# 189228753Smm# 1. legacy stage [BMAKE] 190248616Smm# This stage is responsible for creating compatibility 191248616Smm# shims that are needed by the bootstrap-tools, 192248616Smm# build-tools and cross-tools stages. 193248616Smm# 1. bootstrap-tools stage [BMAKE] 194248616Smm# This stage is responsible for creating programs that 195232153Smm# are needed for backward compatibility reasons. They 196228753Smm# are not built as cross-tools. 197228753Smm# 2. build-tools stage [TMAKE] 198228753Smm# This stage is responsible for creating the object 199232153Smm# tree and building any tools that are needed during 200228753Smm# the build process. 201228753Smm# 3. cross-tools stage [XMAKE] 202228753Smm# This stage is responsible for creating any tools that 203228753Smm# are needed for cross-builds. A cross-compiler is one 204228753Smm# of them. 205228753Smm# 4. world stage [WMAKE] 206228753Smm# This stage actually builds the world. 207228753Smm# 5. install stage (optional) [IMAKE] 208232153Smm# This stage installs a previously built world. 209228753Smm# 210228753Smm 211228753SmmBOOTSTRAPPING?= 0 212228753Smm 213228753Smm# Common environment for world related stages 214228753SmmCROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ 215232153Smm MACHINE_ARCH=${TARGET_ARCH} \ 216228753Smm MACHINE=${TARGET} \ 217228753Smm CPUTYPE=${TARGET_CPUTYPE} \ 218232153Smm GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 219228753Smm GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 220228753Smm GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 221232153Smm.if ${OSRELDATE} < 700044 222228753SmmCROSSENV+= AR=gnu-ar RANLIB=gnu-ranlib 223228753Smm.endif 224228753Smm 225232153Smm# bootstrap-tools stage 226228753SmmBMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 227232153Smm PATH=${BPATH}:${PATH} \ 228228753Smm WORLDTMP=${WORLDTMP} \ 229228753Smm VERSION="${VERSION}" \ 230228753Smm MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" 231228753SmmBMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 232228753Smm ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 233228753Smm DESTDIR= \ 234228753Smm BOOTSTRAPPING=${OSRELDATE} \ 235228753Smm SSP_CFLAGS= \ 236228753Smm -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ 237228753Smm -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \ 238228753Smm -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF 239228753Smm 240228753Smm# build-tools stage 241228753SmmTMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 242228753Smm ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 243228753Smm TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 244228753Smm DESTDIR= \ 245228753Smm SSP_CFLAGS= \ 246228753Smm BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS \ 247228753Smm -DNO_WARNS -DNO_CTF 248228753Smm 249228753Smm# cross-tools stage 250228753SmmXMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ 251228753Smm TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 252228753Smm -DWITHOUT_GDB 253228753Smm 254228753Smm# world stage 255232153SmmWMAKEENV= ${CROSSENV} \ 256228753Smm _SHLIBDIRPREFIX=${WORLDTMP} \ 257228753Smm VERSION="${VERSION}" \ 258228753Smm INSTALL="sh ${.CURDIR}/tools/install.sh" \ 259232153Smm PATH=${TMPPATH} 260228753Smm.if ${MK_CDDL} == "no" 261228753SmmWMAKEENV+= NO_CTF=1 262228753Smm.endif 263232153SmmWMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} 264232153Smm 265232153Smm.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" 266232153Smm# 32 bit world 267232153SmmLIB32TMP= ${OBJTREE}${.CURDIR}/lib32 268228753Smm 269228753Smm.if ${TARGET_ARCH} == "amd64" 270228753Smm.if empty(TARGET_CPUTYPE) 271228753SmmLIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 272232153Smm.else 273228753SmmLIB32CPUFLAGS= -march=${TARGET_CPUTYPE} 274228753Smm.endif 275228753SmmLIB32CPUFLAGS+= -mfancy-math-387 276228753SmmLIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ 277228753Smm MACHINE_CPU="i686 mmx sse sse2" \ 278228753Smm LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \ 279228753Smm AS="${AS} --32" 280228753Smm 281228753Smm.elif ${TARGET_ARCH} == "powerpc64" 282228753Smm.if empty(TARGET_CPUTYPE) 283228753SmmLIB32CPUFLAGS= -mcpu=powerpc 284228753Smm.else 285228753SmmLIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} 286228753Smm.endif 287228753SmmLIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc \ 288228753Smm LD="${LD} -m elf32ppc" 289228753Smm.endif 290232153Smm 291232153Smm 292228753SmmLIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \ 293228753Smm -isystem ${LIB32TMP}/usr/include/ \ 294228753Smm -L${LIB32TMP}/usr/lib32 \ 295228753Smm -B${LIB32TMP}/usr/lib32 296228753Smm 297228753Smm# Yes, the flags are redundant. 298228753SmmLIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ 299228753Smm _SHLIBDIRPREFIX=${LIB32TMP} \ 300228753Smm VERSION="${VERSION}" \ 301228753Smm INSTALL="sh ${.CURDIR}/tools/install.sh" \ 302228753Smm PATH=${TMPPATH} \ 303228753Smm CC="${CC} ${LIB32FLAGS}" \ 304228753Smm CXX="${CXX} ${LIB32FLAGS}" \ 305228753Smm OBJC="${OBJC} ${LIB32FLAGS}" \ 306228753Smm LIBDIR=/usr/lib32 \ 307228753Smm SHLIBDIR=/usr/lib32 308228753Smm 309228753SmmLIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \ 310228777Smm -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \ 311228753Smm -DWITHOUT_HTML -DNO_CTF DESTDIR=${LIB32TMP} 312228753SmmLIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS 313228753Smm.endif 314228753Smm 315228753Smm# install stage 316228753SmmIMAKEENV= ${CROSSENV} 317228753SmmIMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 318228753Smm.if empty(.MAKEFLAGS:M-n) 319228753SmmIMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ 320228753Smm LD_LIBRARY_PATH=${INSTALLTMP} \ 321228753Smm PATH_LOCALE=${INSTALLTMP}/locale 322228753SmmIMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh 323228753Smm.else 324228753SmmIMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} 325228753Smm.endif 326228753Smm 327228753Smm# kernel stage 328228753SmmKMAKEENV= ${WMAKEENV} 329228753SmmKMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} 330228753Smm 331228753Smm# 332228753Smm# buildworld 333228753Smm# 334228753Smm# Attempt to rebuild the entire system, with reasonable chance of 335228753Smm# success, regardless of how old your existing system is. 336228753Smm# 337228753Smm_worldtmp: 338228753Smm.if ${.CURDIR:C/[^,]//g} != "" 339228753Smm# The m4 build of sendmail files doesn't like it if ',' is used 340228753Smm# anywhere in the path of it's files. 341228753Smm @echo 342228753Smm @echo "*** Error: path to source tree contains a comma ','" 343228753Smm @echo 344228753Smm false 345228753Smm.endif 346228753Smm @echo 347228753Smm @echo "--------------------------------------------------------------" 348228753Smm @echo ">>> Rebuilding the temporary build tree" 349228753Smm @echo "--------------------------------------------------------------" 350228753Smm.if !defined(NO_CLEAN) 351228753Smm rm -rf ${WORLDTMP} 352228753Smm.if defined(LIB32TMP) 353228753Smm rm -rf ${LIB32TMP} 354228753Smm.endif 355228753Smm.else 356228753Smm rm -rf ${WORLDTMP}/legacy/usr/include 357228753Smm# XXX - These three can depend on any header file. 358228753Smm rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c 359228753Smm rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c 360228753Smm rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c 361228753Smm.endif 362228753Smm.for _dir in \ 363228753Smm lib usr legacy/usr 364228753Smm mkdir -p ${WORLDTMP}/${_dir} 365228753Smm.endfor 366228753Smm mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 367228753Smm -p ${WORLDTMP}/legacy/usr >/dev/null 368228753Smm mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 369228753Smm -p ${WORLDTMP}/usr >/dev/null 370228753Smm mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 371228753Smm -p ${WORLDTMP}/usr/include >/dev/null 372228753Smm ln -sf ${.CURDIR}/sys ${WORLDTMP} 373228753Smm.if ${MK_BIND_LIBS} != "no" 374228753Smm mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \ 375228753Smm -p ${WORLDTMP}/usr/include >/dev/null 376228753Smm.endif 377228753Smm_legacy: 378228753Smm @echo 379228753Smm @echo "--------------------------------------------------------------" 380228753Smm @echo ">>> stage 1.1: legacy release compatibility shims" 381228753Smm @echo "--------------------------------------------------------------" 382228753Smm ${_+_}cd ${.CURDIR}; ${BMAKE} legacy 383228753Smm_bootstrap-tools: 384228753Smm @echo 385228753Smm @echo "--------------------------------------------------------------" 386228753Smm @echo ">>> stage 1.2: bootstrap tools" 387228753Smm @echo "--------------------------------------------------------------" 388228753Smm ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools 389228753Smm_cleanobj: 390228753Smm.if !defined(NO_CLEAN) 391228753Smm @echo 392228753Smm @echo "--------------------------------------------------------------" 393228753Smm @echo ">>> stage 2.1: cleaning up the object tree" 394228753Smm @echo "--------------------------------------------------------------" 395228753Smm ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} 396228753Smm.if defined(LIB32TMP) 397228753Smm ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/} 398228753Smm.endif 399228753Smm.endif 400228753Smm_obj: 401228753Smm @echo 402228753Smm @echo "--------------------------------------------------------------" 403228753Smm @echo ">>> stage 2.2: rebuilding the object tree" 404228753Smm @echo "--------------------------------------------------------------" 405228753Smm ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj 406228753Smm_build-tools: 407228753Smm @echo 408228753Smm @echo "--------------------------------------------------------------" 409228753Smm @echo ">>> stage 2.3: build tools" 410228753Smm @echo "--------------------------------------------------------------" 411228753Smm ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools 412228753Smm_cross-tools: 413228753Smm @echo 414228753Smm @echo "--------------------------------------------------------------" 415228753Smm @echo ">>> stage 3: cross tools" 416228753Smm @echo "--------------------------------------------------------------" 417228753Smm ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools 418_includes: 419 @echo 420 @echo "--------------------------------------------------------------" 421 @echo ">>> stage 4.1: building includes" 422 @echo "--------------------------------------------------------------" 423 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes 424_libraries: 425 @echo 426 @echo "--------------------------------------------------------------" 427 @echo ">>> stage 4.2: building libraries" 428 @echo "--------------------------------------------------------------" 429 ${_+_}cd ${.CURDIR}; \ 430 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ 431 -DWITHOUT_MAN -DWITHOUT_PROFILE libraries 432_depend: 433 @echo 434 @echo "--------------------------------------------------------------" 435 @echo ">>> stage 4.3: make dependencies" 436 @echo "--------------------------------------------------------------" 437 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend 438everything: 439 @echo 440 @echo "--------------------------------------------------------------" 441 @echo ">>> stage 4.4: building everything" 442 @echo "--------------------------------------------------------------" 443 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all 444.if defined(LIB32TMP) 445build32: 446 @echo 447 @echo "--------------------------------------------------------------" 448 @echo ">>> stage 5.1: building 32 bit shim libraries" 449 @echo "--------------------------------------------------------------" 450 mkdir -p ${LIB32TMP}/usr/lib32 451 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 452 -p ${LIB32TMP}/usr >/dev/null 453 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 454 -p ${LIB32TMP}/usr/include >/dev/null 455 mkdir -p ${WORLDTMP} 456 ln -sf ${.CURDIR}/sys ${WORLDTMP} 457.if ${MK_KERBEROS} != "no" 458.for _t in obj depend all 459 cd ${.CURDIR}/kerberos5/tools; \ 460 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \ 461 ${_t} 462.endfor 463.endif 464.for _t in obj includes 465 cd ${.CURDIR}/include; ${LIB32WMAKE} ${_t} 466 cd ${.CURDIR}/lib; ${LIB32WMAKE} ${_t} 467.if ${MK_CDDL} != "no" 468 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} ${_t} 469.endif 470 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} ${_t} 471.if ${MK_CRYPT} != "no" 472 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} ${_t} 473.endif 474.if ${MK_KERBEROS} != "no" 475 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} ${_t} 476.endif 477.endfor 478.for _dir in usr.bin/lex/lib 479 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} obj 480.endfor 481.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic 482 cd ${.CURDIR}/${_dir}; \ 483 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \ 484 build-tools 485.endfor 486 cd ${.CURDIR}; \ 487 ${LIB32WMAKE} -f Makefile.inc1 libraries 488.for _t in obj depend all 489 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} ${_t} 490 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} ${_t} 491.endfor 492 493distribute32 install32: 494.if make(distribute32) 495 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32 # XXX add to mtree 496 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32/dtrace # XXX add to mtree 497.else 498 mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree 499 mkdir -p ${DESTDIR}/usr/lib32/dtrace # XXX add to mtree 500.endif 501 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 502.if ${MK_CDDL} != "no" 503 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 504.endif 505 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 506.if ${MK_CRYPT} != "no" 507 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 508.endif 509.if ${MK_KERBEROS} != "no" 510 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 511.endif 512 cd ${.CURDIR}/libexec/rtld-elf; \ 513 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//} 514 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//} 515.endif 516 517WMAKE_TGTS= 518.if !defined(SUBDIR_OVERRIDE) 519WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools 520.endif 521WMAKE_TGTS+= _cleanobj _obj _build-tools 522.if !defined(SUBDIR_OVERRIDE) 523WMAKE_TGTS+= _cross-tools 524.endif 525WMAKE_TGTS+= _includes _libraries _depend everything 526.if defined(LIB32TMP) && ${MK_LIB32} != "no" 527WMAKE_TGTS+= build32 528.endif 529 530buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 531.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 532 533buildworld_prologue: 534 @echo "--------------------------------------------------------------" 535 @echo ">>> World build started on `LC_ALL=C date`" 536 @echo "--------------------------------------------------------------" 537 538buildworld_epilogue: 539 @echo 540 @echo "--------------------------------------------------------------" 541 @echo ">>> World build completed on `LC_ALL=C date`" 542 @echo "--------------------------------------------------------------" 543 544# 545# We need to have this as a target because the indirection between Makefile 546# and Makefile.inc1 causes the correct PATH to be used, rather than a 547# modification of the current environment's PATH. In addition, we need 548# to quote multiword values. 549# 550buildenvvars: 551 @echo ${WMAKEENV:Q} 552 553buildenv: 554 @echo Entering world for ${TARGET_ARCH}:${TARGET} 555 @cd ${.CURDIR} && env ${WMAKEENV} sh || true 556 557TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32} 558toolchain: ${TOOLCHAIN_TGTS} 559kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} 560 561# 562# installcheck 563# 564# Checks to be sure system is ready for installworld/installkernel. 565# 566installcheck: 567 568# 569# Require DESTDIR to be set if installing for a different architecture. 570# 571.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} 572.if !make(distributeworld) 573installcheck: installcheck_DESTDIR 574installcheck_DESTDIR: 575.if !defined(DESTDIR) || empty(DESTDIR) 576 @echo "ERROR: Please set DESTDIR!"; \ 577 false 578.endif 579.endif 580.endif 581 582# 583# Check for missing UIDs/GIDs. 584# 585CHECK_UIDS= 586CHECK_GIDS= audit 587.if ${MK_SENDMAIL} != "no" 588CHECK_UIDS+= smmsp 589CHECK_GIDS+= smmsp 590.endif 591.if ${MK_PF} != "no" 592CHECK_UIDS+= proxy 593CHECK_GIDS+= proxy authpf 594.endif 595installcheck: installcheck_UGID 596installcheck_UGID: 597.for uid in ${CHECK_UIDS} 598 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 599 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 600 false; \ 601 fi 602.endfor 603.for gid in ${CHECK_GIDS} 604 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 605 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 606 false; \ 607 fi 608.endfor 609 610# 611# Required install tools to be saved in a scratch dir for safety. 612# 613.if ${MK_INFO} != "no" 614_install-info= install-info 615.endif 616.if ${MK_ZONEINFO} != "no" 617_zoneinfo= zic tzsetup 618.endif 619 620ITOOLS= [ awk cap_mkdb cat chflags chmod chown \ 621 date echo egrep find grep ${_install-info} \ 622 ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ 623 test true uname wc ${_zoneinfo} 624 625# 626# distributeworld 627# 628# Distributes everything compiled by a `buildworld'. 629# 630# installworld 631# 632# Installs everything compiled by a 'buildworld'. 633# 634distributeworld installworld: installcheck 635 mkdir -p ${INSTALLTMP} 636 progs=$$(for prog in ${ITOOLS}; do \ 637 if progpath=`which $$prog`; then \ 638 echo $$progpath; \ 639 else \ 640 echo "Required tool $$prog not found in PATH." >&2; \ 641 exit 1; \ 642 fi; \ 643 done); \ 644 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \ 645 while read line; do \ 646 set -- $$line; \ 647 if [ "$$2 $$3" != "not found" ]; then \ 648 echo $$2; \ 649 else \ 650 echo "Required library $$1 not found." >&2; \ 651 exit 1; \ 652 fi; \ 653 done); \ 654 cp $$libs $$progs ${INSTALLTMP} 655 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale 656 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 657 ${IMAKEENV} rm -rf ${INSTALLTMP} 658 659# 660# reinstall 661# 662# If you have a build server, you can NFS mount the source and obj directories 663# and do a 'make reinstall' on the *client* to install new binaries from the 664# most recent server build. 665# 666reinstall: 667 @echo "--------------------------------------------------------------" 668 @echo ">>> Making hierarchy" 669 @echo "--------------------------------------------------------------" 670 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy 671 @echo 672 @echo "--------------------------------------------------------------" 673 @echo ">>> Installing everything" 674 @echo "--------------------------------------------------------------" 675 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 676.if defined(LIB32TMP) && ${MK_LIB32} != "no" 677 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 678.endif 679 680redistribute: 681 @echo "--------------------------------------------------------------" 682 @echo ">>> Distributing everything" 683 @echo "--------------------------------------------------------------" 684 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 685.if defined(LIB32TMP) && ${MK_LIB32} != "no" 686 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \ 687 DISTRIBUTION=lib32 688.endif 689 690distrib-dirs distribution: 691 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET} 692 693# 694# buildkernel and installkernel 695# 696# Which kernels to build and/or install is specified by setting 697# KERNCONF. If not defined a GENERIC kernel is built/installed. 698# Only the existing (depending TARGET) config files are used 699# for building kernels and only the first of these is designated 700# as the one being installed. 701# 702# Note that we have to use TARGET instead of TARGET_ARCH when 703# we're in kernel-land. Since only TARGET_ARCH is (expected) to 704# be set to cross-build, we have to make sure TARGET is set 705# properly. 706 707.if defined(KERNFAST) 708NO_KERNELCLEAN= t 709NO_KERNELCONFIG= t 710NO_KERNELDEPEND= t 711NO_KERNELOBJ= t 712# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 713.if !defined(KERNCONF) && ${KERNFAST} != "1" 714KERNCONF=${KERNFAST} 715.endif 716.endif 717.if !defined(KERNCONF) && defined(KERNEL) 718KERNCONF= ${KERNEL} 719KERNWARN= 720.else 721.if ${TARGET_ARCH} == "powerpc64" 722KERNCONF?= GENERIC64 723.else 724KERNCONF?= GENERIC 725.endif 726.endif 727INSTKERNNAME?= kernel 728 729KERNSRCDIR?= ${.CURDIR}/sys 730KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 731KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 732KERNCONFDIR?= ${KRNLCONFDIR} 733 734BUILDKERNELS= 735INSTALLKERNEL= 736.for _kernel in ${KERNCONF} 737.if exists(${KERNCONFDIR}/${_kernel}) 738BUILDKERNELS+= ${_kernel} 739.if empty(INSTALLKERNEL) 740INSTALLKERNEL= ${_kernel} 741.endif 742.endif 743.endfor 744 745# 746# buildkernel 747# 748# Builds all kernels defined by BUILDKERNELS. 749# 750buildkernel: 751.if empty(BUILDKERNELS) 752 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 753 false 754.endif 755.if defined(KERNWARN) 756 @echo "--------------------------------------------------------------" 757 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" 758 @echo "--------------------------------------------------------------" 759 @sleep 3 760.endif 761 @echo 762.for _kernel in ${BUILDKERNELS} 763 @echo "--------------------------------------------------------------" 764 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 765 @echo "--------------------------------------------------------------" 766 @echo "===> ${_kernel}" 767 mkdir -p ${KRNLOBJDIR} 768.if !defined(NO_KERNELCONFIG) 769 @echo 770 @echo "--------------------------------------------------------------" 771 @echo ">>> stage 1: configuring the kernel" 772 @echo "--------------------------------------------------------------" 773 cd ${KRNLCONFDIR}; \ 774 PATH=${TMPPATH} \ 775 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 776 ${KERNCONFDIR}/${_kernel} 777.endif 778.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 779 @echo 780 @echo "--------------------------------------------------------------" 781 @echo ">>> stage 2.1: cleaning up the object tree" 782 @echo "--------------------------------------------------------------" 783 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 784.endif 785.if !defined(NO_KERNELOBJ) 786 @echo 787 @echo "--------------------------------------------------------------" 788 @echo ">>> stage 2.2: rebuilding the object tree" 789 @echo "--------------------------------------------------------------" 790 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 791.endif 792 @echo 793 @echo "--------------------------------------------------------------" 794 @echo ">>> stage 2.3: build tools" 795 @echo "--------------------------------------------------------------" 796 cd ${KRNLOBJDIR}/${_kernel}; \ 797 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ 798 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS \ 799 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile 800# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. 801.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) 802.for target in obj depend all 803 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ 804 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ 805 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target} 806.endfor 807.endif 808.if !defined(NO_KERNELDEPEND) 809 @echo 810 @echo "--------------------------------------------------------------" 811 @echo ">>> stage 3.1: making dependencies" 812 @echo "--------------------------------------------------------------" 813 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ 814.endif 815 @echo 816 @echo "--------------------------------------------------------------" 817 @echo ">>> stage 3.2: building everything" 818 @echo "--------------------------------------------------------------" 819 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 820 @echo "--------------------------------------------------------------" 821 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 822 @echo "--------------------------------------------------------------" 823.endfor 824 825# 826# installkernel, etc. 827# 828# Install the kernel defined by INSTALLKERNEL 829# 830installkernel installkernel.debug \ 831reinstallkernel reinstallkernel.debug: installcheck 832.if empty(INSTALLKERNEL) 833 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 834 false 835.endif 836 @echo "--------------------------------------------------------------" 837 @echo ">>> Installing kernel" 838 @echo "--------------------------------------------------------------" 839 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 840 ${CROSSENV} PATH=${TMPPATH} \ 841 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 842 843# 844# doxygen 845# 846# Build the API documentation with doxygen 847# 848doxygen: 849 @if [ ! -x `/usr/bin/which doxygen` ]; then \ 850 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 851 exit 1; \ 852 fi 853 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all 854 855# 856# update 857# 858# Update the source tree, by running cvsup and/or running cvs to update to the 859# latest copy. 860# 861update: 862.if defined(SUP_UPDATE) 863 @echo "--------------------------------------------------------------" 864 @echo ">>> Running ${SUP}" 865 @echo "--------------------------------------------------------------" 866.if defined(SUPFILE) 867 @${SUP} ${SUPFLAGS} ${SUPFILE} 868.endif 869.if defined(SUPFILE1) 870 @${SUP} ${SUPFLAGS} ${SUPFILE1} 871.endif 872.if defined(SUPFILE2) 873 @${SUP} ${SUPFLAGS} ${SUPFILE2} 874.endif 875.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) 876 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} 877.endif 878.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) 879 @${SUP} ${SUPFLAGS} ${DOCSUPFILE} 880.endif 881.endif 882.if defined(CVS_UPDATE) 883 @cd ${.CURDIR} ; \ 884 if [ -d CVS ] ; then \ 885 echo "--------------------------------------------------------------" ; \ 886 echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \ 887 echo "--------------------------------------------------------------" ; \ 888 echo ${CVS} -R -q update ${CVSFLAGS} ; \ 889 ${CVS} -R -q update ${CVSFLAGS} ; \ 890 fi 891.endif 892.if defined(SVN_UPDATE) 893 @cd ${.CURDIR} ; \ 894 if [ -d .svn ] ; then \ 895 echo "--------------------------------------------------------------" ; \ 896 echo ">>> Updating ${.CURDIR} using Subversion" ; \ 897 echo "--------------------------------------------------------------" ; \ 898 echo ${SVN} update ${SVNFLAGS} ; \ 899 ${SVN} update ${SVNFLAGS} ; \ 900 fi 901.endif 902 903# 904# ------------------------------------------------------------------------ 905# 906# From here onwards are utility targets used by the 'make world' and 907# related targets. If your 'world' breaks, you may like to try to fix 908# the problem and manually run the following targets to attempt to 909# complete the build. Beware, this is *not* guaranteed to work, you 910# need to have a pretty good grip on the current state of the system 911# to attempt to manually finish it. If in doubt, 'make world' again. 912# 913 914# 915# legacy: Build compatibility shims for the next three targets 916# 917legacy: 918.if ${BOOTSTRAPPING} < 600034 && ${BOOTSTRAPPING} != 0 919 @echo "ERROR: Source upgrades from versions prior to 6.0 not supported."; \ 920 false 921.endif 922.for _tool in tools/build 923 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ 924 cd ${.CURDIR}/${_tool}; \ 925 ${MAKE} DIRPRFX=${_tool}/ obj; \ 926 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 927 ${MAKE} DIRPRFX=${_tool}/ depend; \ 928 ${MAKE} DIRPRFX=${_tool}/ all; \ 929 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 930.endfor 931 932# 933# bootstrap-tools: Build tools needed for compatibility 934# 935.if ${MK_GAMES} != "no" 936_strfile= games/fortune/strfile 937.endif 938 939.if ${MK_CXX} != "no" 940_gperf= gnu/usr.bin/gperf 941.if ${BOOTSTRAPPING} < 700004 942_groff= gnu/usr.bin/groff 943.else 944_groff= gnu/usr.bin/groff/tmac 945.endif 946.endif 947 948.if ${BOOTSTRAPPING} >= 700044 && ${BOOTSTRAPPING} < 800022 949_ar= usr.bin/ar 950.endif 951 952.if ${BOOTSTRAPPING} < 800013 953_mklocale= usr.bin/mklocale 954.endif 955 956.if ${BOOTSTRAPPING} < 900002 957_sed= usr.bin/sed 958.endif 959 960.if ${BOOTSTRAPPING} < 900006 961_lex= usr.bin/lex 962_yacc= usr.bin/yacc 963.endif 964 965.if ${BOOTSTRAPPING} < 700018 966_gensnmptree= usr.sbin/bsnmpd/gensnmptree 967.endif 968 969.if ${MK_RESCUE} != "no" && \ 970 ${BOOTSTRAPPING} < 700026 971_crunchgen= usr.sbin/crunch/crunchgen 972.endif 973 974# XXX: There is no way to specify bootstrap tools depending on MK-flags 975# with different per-architecture default values. Always build tblgen. 976_clang_tblgen= \ 977 lib/clang/libllvmsupport \ 978 lib/clang/libllvmsystem \ 979 usr.bin/clang/tblgen 980 981.if ${MK_CDDL} != "no" 982_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \ 983 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge 984.endif 985 986.if ${MK_FDT} != "no" 987_dtc= gnu/usr.bin/dtc 988.endif 989 990bootstrap-tools: 991.for _tool in \ 992 ${_clang_tblgen} \ 993 ${_dtrace_tools} \ 994 ${_strfile} \ 995 ${_gperf} \ 996 ${_groff} \ 997 ${_ar} \ 998 ${_dtc} \ 999 usr.bin/lorder \ 1000 usr.bin/makewhatis \ 1001 ${_mklocale} \ 1002 usr.bin/rpcgen \ 1003 ${_sed} \ 1004 ${_lex} \ 1005 ${_yacc} \ 1006 usr.bin/xinstall \ 1007 ${_gensnmptree} \ 1008 usr.sbin/config \ 1009 ${_crunchgen} 1010 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1011 cd ${.CURDIR}/${_tool}; \ 1012 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1013 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1014 ${MAKE} DIRPRFX=${_tool}/ all; \ 1015 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1016.endfor 1017 1018# 1019# build-tools: Build special purpose build tools 1020# 1021.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) 1022_aicasm= sys/modules/aic7xxx/aicasm 1023.endif 1024 1025.if !defined(NO_SHARE) 1026_share= share/syscons/scrnmaps 1027.endif 1028 1029.if ${MK_KERBEROS} != "no" 1030_kerberos5_tools= kerberos5/tools 1031.endif 1032 1033.if ${MK_RESCUE} != "no" 1034_rescue= rescue/rescue 1035.endif 1036 1037build-tools: 1038.for _tool in \ 1039 bin/csh \ 1040 bin/sh \ 1041 ${_rescue} \ 1042 lib/ncurses/ncurses \ 1043 lib/ncurses/ncursesw \ 1044 ${_share} \ 1045 ${_aicasm} \ 1046 usr.bin/awk \ 1047 lib/libmagic \ 1048 usr.sbin/sysinstall 1049 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 1050 cd ${.CURDIR}/${_tool}; \ 1051 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1052 ${MAKE} DIRPRFX=${_tool}/ build-tools 1053.endfor 1054.for _tool in \ 1055 gnu/usr.bin/cc/cc_tools \ 1056 ${_kerberos5_tools} 1057 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ 1058 cd ${.CURDIR}/${_tool}; \ 1059 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1060 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1061 ${MAKE} DIRPRFX=${_tool}/ all 1062.endfor 1063 1064# 1065# cross-tools: Build cross-building tools 1066# 1067.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035 1068.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 1069_btxld= usr.sbin/btxld 1070.endif 1071.endif 1072.if ${TARGET_ARCH} != ${MACHINE_ARCH} 1073.if ${MK_RESCUE} != "no" || defined(RELEASEDIR) 1074_crunchide= usr.sbin/crunch/crunchide 1075.endif 1076.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR) 1077_kgzip= usr.sbin/kgzip 1078.endif 1079.endif 1080 1081.if ${CC:T:Mclang} == "clang" 1082_clang= usr.bin/clang 1083_clang_libs= lib/clang 1084.endif 1085 1086cross-tools: 1087.for _tool in \ 1088 ${_clang_libs} \ 1089 ${_clang} \ 1090 gnu/usr.bin/binutils \ 1091 gnu/usr.bin/cc \ 1092 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ 1093 ${_btxld} \ 1094 ${_crunchide} \ 1095 ${_kgzip} 1096 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1097 cd ${.CURDIR}/${_tool}; \ 1098 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1099 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1100 ${MAKE} DIRPRFX=${_tool}/ all; \ 1101 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 1102.endfor 1103 1104# 1105# hierarchy - ensure that all the needed directories are present 1106# 1107hierarchy: 1108 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 1109 1110# 1111# libraries - build all libraries, and install them under ${DESTDIR}. 1112# 1113# The list of libraries with dependents (${_prebuild_libs}) and their 1114# interdependencies (__L) are built automatically by the 1115# ${.CURDIR}/tools/make_libdeps.sh script. 1116# 1117libraries: 1118 cd ${.CURDIR}; \ 1119 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 1120 ${MAKE} -f Makefile.inc1 _startup_libs; \ 1121 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 1122 ${MAKE} -f Makefile.inc1 _generic_libs; 1123 1124# 1125# static libgcc.a prerequisite for shared libc 1126# 1127_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc 1128 1129# These dependencies are not automatically generated: 1130# 1131# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 1132# all shared libraries for ELF. 1133# 1134_startup_libs= gnu/lib/csu 1135.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 1136_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 1137.elif exists(${.CURDIR}/lib/csu/${MACHINE_CPUARCH}-elf) 1138_startup_libs+= lib/csu/${MACHINE_CPUARCH}-elf 1139.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}) 1140_startup_libs+= lib/csu/${MACHINE_ARCH} 1141.else 1142_startup_libs+= lib/csu/${MACHINE_CPUARCH} 1143.endif 1144_startup_libs+= gnu/lib/libgcc 1145_startup_libs+= lib/libc 1146 1147gnu/lib/libgcc__L: lib/libc__L 1148 1149_prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libheimntlm} \ 1150 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 1151 ${_kerberos5_lib_libroken} \ 1152 lib/libbz2 lib/libcom_err lib/libcrypt lib/libelf \ 1153 lib/libexpat lib/libfetch \ 1154 ${_lib_libgssapi} ${_lib_libipx} \ 1155 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \ 1156 lib/ncurses/ncurses lib/ncurses/ncursesw \ 1157 lib/libopie lib/libpam ${_lib_libthr} \ 1158 lib/libradius lib/libsbuf lib/libtacplus \ 1159 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ 1160 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ 1161 ${_secure_lib_libssl} 1162 1163.if ${MK_LIBTHR} != "no" 1164_lib_libthr= lib/libthr 1165.endif 1166 1167_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib 1168 1169lib/libopie__L lib/libtacplus__L: lib/libmd__L 1170 1171.if ${MK_CDDL} != "no" 1172_cddl_lib= cddl/lib 1173.endif 1174 1175.if ${MK_CRYPT} != "no" 1176.if ${MK_OPENSSL} != "no" 1177_secure_lib_libcrypto= secure/lib/libcrypto 1178_secure_lib_libssl= secure/lib/libssl 1179lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 1180lib/libfetch__L: secure/lib/libcrypto__L secure/lib/libssl__L lib/libmd__L 1181.if ${MK_OPENSSH} != "no" 1182_secure_lib_libssh= secure/lib/libssh 1183secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 1184.if ${MK_KERBEROS_SUPPORT} != "no" 1185secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 1186 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 1187 lib/libmd__L kerberos5/lib/libroken__L 1188.endif 1189.endif 1190.endif 1191_secure_lib= secure/lib 1192.endif 1193 1194.if ${MK_GSSAPI} != "no" 1195_lib_libgssapi= lib/libgssapi 1196.endif 1197 1198.if ${MK_IPX} != "no" 1199_lib_libipx= lib/libipx 1200.endif 1201 1202.if ${MK_KERBEROS} != "no" 1203_kerberos5_lib= kerberos5/lib 1204_kerberos5_lib_libasn1= kerberos5/lib/libasn1 1205_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 1206_kerberos5_lib_libhx509= kerberos5/lib/libhx509 1207_kerberos5_lib_libroken= kerberos5/lib/libroken 1208_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 1209.endif 1210 1211.if ${MK_NIS} != "no" 1212_lib_libypclnt= lib/libypclnt 1213.endif 1214 1215.if ${MK_OPENSSL} == "no" 1216lib/libfetch__L lib/libradius__L: lib/libmd__L 1217.endif 1218 1219.for _lib in ${_prereq_libs} 1220${_lib}__PL: .PHONY 1221.if exists(${.CURDIR}/${_lib}) 1222 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1223 cd ${.CURDIR}/${_lib}; \ 1224 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1225 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1226 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \ 1227 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install 1228.endif 1229.endfor 1230 1231.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 1232${_lib}__L: .PHONY 1233.if exists(${.CURDIR}/${_lib}) 1234 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1235 cd ${.CURDIR}/${_lib}; \ 1236 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1237 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1238 ${MAKE} DIRPRFX=${_lib}/ all; \ 1239 ${MAKE} DIRPRFX=${_lib}/ install 1240.endif 1241.endfor 1242 1243# libpam is special: we need to build static PAM modules before 1244# static PAM library, and dynamic PAM library before dynamic PAM 1245# modules. 1246lib/libpam__L: .PHONY 1247 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ 1248 cd ${.CURDIR}/lib/libpam; \ 1249 ${MAKE} DIRPRFX=lib/libpam/ obj; \ 1250 ${MAKE} DIRPRFX=lib/libpam/ depend; \ 1251 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ 1252 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install 1253 1254_prereq_libs: ${_prereq_libs:S/$/__PL/} 1255_startup_libs: ${_startup_libs:S/$/__L/} 1256_prebuild_libs: ${_prebuild_libs:S/$/__L/} 1257_generic_libs: ${_generic_libs:S/$/__L/} 1258 1259.for __target in all clean cleandepend cleandir depend includes obj 1260.for entry in ${SUBDIR} 1261${entry}.${__target}__D: .PHONY 1262 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 1263 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ 1264 edir=${entry}.${MACHINE_ARCH}; \ 1265 cd ${.CURDIR}/$${edir}; \ 1266 else \ 1267 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ 1268 edir=${entry}; \ 1269 cd ${.CURDIR}/$${edir}; \ 1270 fi; \ 1271 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 1272.endfor 1273par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 1274.endfor 1275 1276.include <bsd.subdir.mk> 1277 1278.if make(check-old) || make(check-old-dirs) || \ 1279 make(check-old-files) || make(check-old-libs) || \ 1280 make(delete-old) || make(delete-old-dirs) || \ 1281 make(delete-old-files) || make(delete-old-libs) 1282 1283# 1284# check for / delete old files section 1285# 1286 1287.include "ObsoleteFiles.inc" 1288 1289OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 1290else you can not start such an application. Consult UPDATING for more \ 1291information regarding how to cope with the removal/revision bump of a \ 1292specific library." 1293 1294.if !defined(BATCH_DELETE_OLD_FILES) 1295RM_I=-i 1296.else 1297RM_I=-v 1298.endif 1299 1300delete-old-files: 1301 @echo ">>> Removing old files (only deletes safe to delete libs)" 1302# Ask for every old file if the user really wants to remove it. 1303# It's annoying, but better safe than sorry. 1304 @for file in ${OLD_FILES} ${OLD_FILES:Musr/share/*.gz:R}; do \ 1305 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1306 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1307 rm ${RM_I} "${DESTDIR}/$${file}"; \ 1308 fi; \ 1309 done 1310# Remove catpages without corresponding manpages. 1311 @exec 3<&0; \ 1312 find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1313 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1314 while read catpage; do \ 1315 read manpage; \ 1316 if [ ! -e "$${manpage}" ]; then \ 1317 rm ${RM_I} $${catpage} <&3 ; \ 1318 fi; \ 1319 done 1320 @echo ">>> Old files removed" 1321 1322check-old-files: 1323 @echo ">>> Checking for old files" 1324 @for file in ${OLD_FILES} ${OLD_FILES:Musr/share/*.gz:R}; do \ 1325 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1326 echo "${DESTDIR}/$${file}"; \ 1327 fi; \ 1328 done 1329# Check for catpages without corresponding manpages. 1330 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1331 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1332 while read catpage; do \ 1333 read manpage; \ 1334 if [ ! -e "$${manpage}" ]; then \ 1335 echo $${catpage} ; \ 1336 fi; \ 1337 done 1338 1339delete-old-libs: 1340 @echo ">>> Removing old libraries" 1341 @echo "${OLD_LIBS_MESSAGE}" | fmt 1342 @for file in ${OLD_LIBS}; do \ 1343 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1344 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1345 rm ${RM_I} "${DESTDIR}/$${file}"; \ 1346 fi; \ 1347 done 1348 @echo ">>> Old libraries removed" 1349 1350check-old-libs: 1351 @echo ">>> Checking for old libraries" 1352 @for file in ${OLD_LIBS}; do \ 1353 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1354 echo "${DESTDIR}/$${file}"; \ 1355 fi; \ 1356 done 1357 1358delete-old-dirs: 1359 @echo ">>> Removing old directories" 1360 @for dir in ${OLD_DIRS}; do \ 1361 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1362 rmdir -v "${DESTDIR}/$${dir}" || true; \ 1363 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1364 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1365 fi; \ 1366 done 1367 @echo ">>> Old directories removed" 1368 1369check-old-dirs: 1370 @echo ">>> Checking for old directories" 1371 @for dir in ${OLD_DIRS}; do \ 1372 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1373 echo "${DESTDIR}/$${dir}"; \ 1374 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1375 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1376 fi; \ 1377 done 1378 1379delete-old: delete-old-files delete-old-dirs 1380 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1381 1382check-old: check-old-files check-old-libs check-old-dirs 1383 @echo "To remove old files and directories run '${MAKE} delete-old'." 1384 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1385 1386.endif 1387 1388# 1389# showconfig - show build configuration. 1390# 1391showconfig: 1392 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort 1393 1394 1395############### 1396 1397.if defined(XDEV) && defined(XDEV_ARCH) 1398 1399NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ 1400 -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \ 1401 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS 1402 1403XDDIR=${XDEV}-freebsd 1404XDTP=/usr/${XDDIR} 1405CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ 1406 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} 1407CDENV= ${CDBENV} \ 1408 _SHLIBDIRPREFIX=${XDTP} \ 1409 TOOLS_PREFIX=${XDTP} 1410CD2ENV=${CDENV} \ 1411 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH} 1412 1413CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp 1414CDMAKE=${CDENV} ${MAKE} ${NOFUN} 1415CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1416XDDESTDIR=${DESTDIR}${XDTP} 1417.if !defined(OSREL) 1418OSREL!= uname -r | sed -e 's/[-(].*//' 1419.endif 1420 1421.ORDER: xdev-build xdev-install 1422xdev: xdev-build xdev-install 1423 1424.ORDER: _xb-build-tools _xb-cross-tools 1425xdev-build: _xb-build-tools _xb-cross-tools 1426 1427_xb-build-tools: 1428 ${_+_}cd ${.CURDIR}; \ 1429 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools 1430 1431_xb-cross-tools: 1432.for _tool in \ 1433 gnu/usr.bin/binutils \ 1434 gnu/usr.bin/cc 1435 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ 1436 cd ${.CURDIR}/${_tool}; \ 1437 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 1438 ${CDMAKE} DIRPRFX=${_tool}/ depend; \ 1439 ${CDMAKE} DIRPRFX=${_tool}/ all 1440.endfor 1441 1442_xi-mtree: 1443 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 1444 mkdir -p ${XDDESTDIR} 1445 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 1446 -p ${XDDESTDIR} >/dev/null 1447 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1448 -p ${XDDESTDIR}/usr >/dev/null 1449 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1450 -p ${XDDESTDIR}/usr/include >/dev/null 1451 1452.ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1453xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1454 1455_xi-cross-tools: 1456 @echo "_xi-cross-tools" 1457.for _tool in \ 1458 gnu/usr.bin/binutils \ 1459 gnu/usr.bin/cc 1460 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 1461 cd ${.CURDIR}/${_tool}; \ 1462 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 1463.endfor 1464 1465_xi-includes: 1466 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \ 1467 DESTDIR=${XDDESTDIR} 1468 1469_xi-libraries: 1470 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 1471 DESTDIR=${XDDESTDIR} 1472 1473_xi-links: 1474 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 1475 for i in *; do \ 1476 ln -sf ../../${XDTP}/usr/bin/$$i \ 1477 ../../../../usr/bin/${XDDIR}-$$i; \ 1478 ln -sf ../../${XDTP}/usr/bin/$$i \ 1479 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ 1480 done 1481.endif 1482 1483.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 1484DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 1485 1486.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 1487.if exists(${KERNCONFDIR}/${KERNCONF}) 1488FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 1489 ${KERNCONFDIR}/${KERNCONF} 1490.endif 1491.endif 1492 1493.endif 1494 1495.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 1496DTBOUTPUTPATH= ${.CURDIR} 1497.endif 1498 1499# 1500# Build 'standalone' Device Tree Blob 1501# 1502builddtb: 1503 @if [ "${FDT_DTS_FILE}" = "" ]; then \ 1504 echo "ERROR: FDT_DTS_FILE must be specified!"; \ 1505 exit 1; \ 1506 fi; \ 1507 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \ 1508 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \ 1509 exist!"; \ 1510 exit 1; \ 1511 fi; \ 1512 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \ 1513 echo "WARNING: DTB will be placed in the current working \ 1514 directory"; \ 1515 fi 1516 @PATH=${TMPPATH} \ 1517 dtc -O dtb -o \ 1518 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \ 1519 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} 1520