3# 4# Make command line options: 5# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 6# -DNO_CLEAN do not clean at all 7# -DDB_FROM_SRC use the user/group databases in src/etc instead of 8# the system database when installing. 9# -DNO_SHARE do not go into share subdir 10# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,OBJ} 11# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 12# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 13# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel 14# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 15# -DNO_ROOT install without using root privilege 16# -DNO_DOCUPDATE do not update doc in ${MAKE} update 17# -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects 18# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 19# LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list 20# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target 21# LOCAL_MTREE="list of mtree files" to process to allow local directories 22# to be created before files are installed 23# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools 24# list 25# METALOG="path to metadata log" to write permission and ownership 26# when NO_ROOT is set. (default: ${DESTDIR}/METALOG) 27# TARGET="machine" to crossbuild world for a different machine type 28# TARGET_ARCH= may be required when a TARGET supports multiple endians 29# BUILDENV_SHELL= shell to launch for the buildenv target (def:${SHELL}) 30# WORLD_FLAGS= additional flags to pass to make(1) during buildworld 31# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel 32# SUBDIR_OVERRIDE="list of dirs" to build rather than everything. 33# All libraries and includes, and some build tools will still build. 34 35# 36# The intended user-driven targets are: 37# buildworld - rebuild *everything*, including glue to help do upgrades 38# installworld- install everything built by "buildworld" 39# checkworld - run test suite on installed world 40# doxygen - build API documentation of the kernel 41# update - convenient way to update your source tree (eg: svn/svnup) 42# 43# Standard targets (not defined here) are documented in the makefiles in 44# /usr/share/mk. These include: 45# obj depend all install clean cleandepend cleanobj 46 47.if !defined(TARGET) || !defined(TARGET_ARCH) 48.error "Both TARGET and TARGET_ARCH must be defined." 49.endif 50 51LOCALBASE?= /usr/local 52 53# Cross toolchain changes must be in effect before bsd.compiler.mk 54# so that gets the right CC, and pass CROSS_TOOLCHAIN to submakes. 55.if defined(CROSS_TOOLCHAIN) 56.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk" 57CROSSENV+=CROSS_TOOLCHAIN="${CROSS_TOOLCHAIN}" 58.endif 59.include <bsd.compiler.mk> # don't depend on src.opts.mk doing it 60.include "share/mk/src.opts.mk" 61 62# We must do lib/ and libexec/ before bin/ in case of a mid-install error to 63# keep the users system reasonably usable. For static->dynamic root upgrades, 64# we don't want to install a dynamic binary without rtld and the needed 65# libraries. More commonly, for dynamic root, we don't want to install a 66# binary that requires a newer library version that hasn't been installed yet. 67# This ordering is not a guarantee though. The only guarantee of a working 68# system here would require fine-grained ordering of all components based 69# on their dependencies. 70SRCDIR?= ${.CURDIR} 71.if !empty(SUBDIR_OVERRIDE) 72SUBDIR= ${SUBDIR_OVERRIDE} 73.else 74SUBDIR= lib libexec 75.if !defined(NO_ROOT) && (make(installworld) || make(install)) 76# Ensure libraries are installed before progressing. 77SUBDIR+=.WAIT 78.endif 79SUBDIR+=bin 80.if ${MK_CDDL} != "no" 81SUBDIR+=cddl 82.endif 83SUBDIR+=gnu include 84.if ${MK_KERBEROS} != "no" 85SUBDIR+=kerberos5 86.endif 87.if ${MK_RESCUE} != "no" 88SUBDIR+=rescue 89.endif 90SUBDIR+=sbin 91.if ${MK_CRYPT} != "no" 92SUBDIR+=secure 93.endif 94.if !defined(NO_SHARE) 95SUBDIR+=share 96.endif 97SUBDIR+=sys usr.bin usr.sbin 98.if ${MK_TESTS} != "no" 99SUBDIR+= tests 100.endif 101.if ${MK_OFED} != "no" 102SUBDIR+=contrib/ofed 103.endif 104 105# Local directories are last, since it is nice to at least get the base 106# system rebuilt before you do them. 107.for _DIR in ${LOCAL_DIRS} 108.if exists(${.CURDIR}/${_DIR}/Makefile) 109SUBDIR+= ${_DIR} 110.endif 111.endfor 112# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR 113# of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and 114# LOCAL_LIB_DIRS=foo/lib to behave as expected. 115.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|} 116_REDUNDENT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*} 117.endfor 118.for _DIR in ${LOCAL_LIB_DIRS} 119.if empty(_REDUNDENT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile) 120SUBDIR+= ${_DIR} 121.else 122.warning ${_DIR} not added to SUBDIR list. See UPDATING 20141121. 123.endif 124.endfor 125 126# We must do etc/ last as it hooks into building the man whatis file 127# by calling 'makedb' in share/man. This is only relevant for 128# install/distribute so they build the whatis file after every manpage is 129# installed. 130.if make(installworld) || make(install) 131SUBDIR+=.WAIT 132.endif 133SUBDIR+=etc 134 135.endif # !empty(SUBDIR_OVERRIDE) 136 137.if defined(NOCLEAN) 138.warning NOCLEAN option is deprecated. Use NO_CLEAN instead. 139NO_CLEAN= ${NOCLEAN} 140.endif 141.if defined(NO_CLEANDIR) 142CLEANDIR= clean cleandepend 143.else 144CLEANDIR= cleandir 145.endif 146 147LOCAL_TOOL_DIRS?= 148PACKAGEDIR?= ${DESTDIR}/${DISTDIR} 149 150.if empty(SHELL:M*csh*) 151BUILDENV_SHELL?=${SHELL} 152.else 153BUILDENV_SHELL?=/bin/sh 154.endif 155 156.if !defined(SVN) || empty(SVN) 157. for _P in /usr/bin /usr/local/bin 158. for _S in svn svnlite 159. if exists(${_P}/${_S}) 160SVN= ${_P}/${_S} 161. endif 162. endfor 163. endfor 164.endif 165SVNFLAGS?= -r HEAD 166 167MAKEOBJDIRPREFIX?= /usr/obj 168.if !defined(OSRELDATE) 169.if exists(/usr/include/osreldate.h) 170OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 171 /usr/include/osreldate.h 172.else 173OSRELDATE= 0 174.endif 175.export OSRELDATE 176.endif 177 178# Set VERSION for CTFMERGE to use via the default CTFFLAGS=-L VERSION. 179.if !defined(VERSION) 180REVISION!= MK_AUTO_OBJ=no ${MAKE} -C ${SRCDIR}/release -V REVISION 181BRANCH!= MK_AUTO_OBJ=no ${MAKE} -C ${SRCDIR}/release -V BRANCH 182SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 183 ${SRCDIR}/sys/sys/param.h 184VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE} 185.export VERSION 186.endif 187 188KNOWN_ARCHES?= aarch64/arm64 \ 189 amd64 \ 190 arm \ 191 armeb/arm \ 192 armv6/arm \ 193 armv6hf/arm \ 194 i386 \ 195 i386/pc98 \ 196 mips \ 197 mipsel/mips \ 198 mips64el/mips \ 199 mips64/mips \ 200 mipsn32el/mips \ 201 mipsn32/mips \ 202 powerpc \ 203 powerpc64/powerpc \ 204 riscv64/riscv \ 205 sparc64 206 207.if ${TARGET} == ${TARGET_ARCH} 208_t= ${TARGET} 209.else 210_t= ${TARGET_ARCH}/${TARGET} 211.endif 212.for _t in ${_t} 213.if empty(KNOWN_ARCHES:M${_t}) 214.error Unknown target ${TARGET_ARCH}:${TARGET}. 215.endif 216.endfor 217 218.if ${TARGET} == ${MACHINE} 219TARGET_CPUTYPE?=${CPUTYPE} 220.else 221TARGET_CPUTYPE?= 222.endif 223 224.if !empty(TARGET_CPUTYPE) 225_TARGET_CPUTYPE=${TARGET_CPUTYPE} 226.else 227_TARGET_CPUTYPE=dummy 228.endif 229_CPUTYPE!= MK_AUTO_OBJ=no MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ 230 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE 231.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 232.error CPUTYPE global should be set with ?=. 233.endif 234.if make(buildworld) 235BUILD_ARCH!= uname -p 236.if ${MACHINE_ARCH} != ${BUILD_ARCH} 237.error To cross-build, set TARGET_ARCH. 238.endif 239.endif 240.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING) 241OBJTREE= ${MAKEOBJDIRPREFIX} 242.else 243OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} 244.endif 245WORLDTMP= ${OBJTREE}${.CURDIR}/tmp 246BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/bin 247XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin 248STRICTTMPPATH= ${BPATH}:${XPATH} 249TMPPATH= ${STRICTTMPPATH}:${PATH} 250 251# 252# Avoid running mktemp(1) unless actually needed. 253# It may not be functional, e.g., due to new ABI 254# when in the middle of installing over this system. 255# 256.if make(distributeworld) || make(installworld) 257INSTALLTMP!= /usr/bin/mktemp -d -u -t install 258.endif 259 260# 261# Building a world goes through the following stages 262# 263# 1. legacy stage [BMAKE] 264# This stage is responsible for creating compatibility 265# shims that are needed by the bootstrap-tools, 266# build-tools and cross-tools stages. These are generally 267# APIs that tools from one of those three stages need to 268# build that aren't present on the host. 269# 1. bootstrap-tools stage [BMAKE] 270# This stage is responsible for creating programs that 271# are needed for backward compatibility reasons. They 272# are not built as cross-tools. 273# 2. build-tools stage [TMAKE] 274# This stage is responsible for creating the object 275# tree and building any tools that are needed during 276# the build process. Some programs are listed during 277# this phase because they build binaries to generate 278# files needed to build these programs. This stage also 279# builds the 'build-tools' target rather than 'all'. 280# 3. cross-tools stage [XMAKE] 281# This stage is responsible for creating any tools that 282# are needed for building the system. A cross-compiler is one 283# of them. This differs from build tools in two ways: 284# 1. the 'all' target is built rather than 'build-tools' 285# 2. these tools are installed into TMPPATH for stage 4. 286# 4. world stage [WMAKE] 287# This stage actually builds the world. 288# 5. install stage (optional) [IMAKE] 289# This stage installs a previously built world. 290# 291 292BOOTSTRAPPING?= 0 293 294# Common environment for world related stages 295CROSSENV+= MAKEOBJDIRPREFIX=${OBJTREE} \ 296 MACHINE_ARCH=${TARGET_ARCH} \ 297 MACHINE=${TARGET} \ 298 CPUTYPE=${TARGET_CPUTYPE}
| 3# 4# Make command line options: 5# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 6# -DNO_CLEAN do not clean at all 7# -DDB_FROM_SRC use the user/group databases in src/etc instead of 8# the system database when installing. 9# -DNO_SHARE do not go into share subdir 10# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,OBJ} 11# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 12# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 13# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel 14# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 15# -DNO_ROOT install without using root privilege 16# -DNO_DOCUPDATE do not update doc in ${MAKE} update 17# -DWITHOUT_CTF do not run the DTrace CTF conversion tools on built objects 18# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 19# LOCAL_ITOOLS="list of tools" to add additional tools to the ITOOLS list 20# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target 21# LOCAL_MTREE="list of mtree files" to process to allow local directories 22# to be created before files are installed 23# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools 24# list 25# METALOG="path to metadata log" to write permission and ownership 26# when NO_ROOT is set. (default: ${DESTDIR}/METALOG) 27# TARGET="machine" to crossbuild world for a different machine type 28# TARGET_ARCH= may be required when a TARGET supports multiple endians 29# BUILDENV_SHELL= shell to launch for the buildenv target (def:${SHELL}) 30# WORLD_FLAGS= additional flags to pass to make(1) during buildworld 31# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel 32# SUBDIR_OVERRIDE="list of dirs" to build rather than everything. 33# All libraries and includes, and some build tools will still build. 34 35# 36# The intended user-driven targets are: 37# buildworld - rebuild *everything*, including glue to help do upgrades 38# installworld- install everything built by "buildworld" 39# checkworld - run test suite on installed world 40# doxygen - build API documentation of the kernel 41# update - convenient way to update your source tree (eg: svn/svnup) 42# 43# Standard targets (not defined here) are documented in the makefiles in 44# /usr/share/mk. These include: 45# obj depend all install clean cleandepend cleanobj 46 47.if !defined(TARGET) || !defined(TARGET_ARCH) 48.error "Both TARGET and TARGET_ARCH must be defined." 49.endif 50 51LOCALBASE?= /usr/local 52 53# Cross toolchain changes must be in effect before bsd.compiler.mk 54# so that gets the right CC, and pass CROSS_TOOLCHAIN to submakes. 55.if defined(CROSS_TOOLCHAIN) 56.include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk" 57CROSSENV+=CROSS_TOOLCHAIN="${CROSS_TOOLCHAIN}" 58.endif 59.include <bsd.compiler.mk> # don't depend on src.opts.mk doing it 60.include "share/mk/src.opts.mk" 61 62# We must do lib/ and libexec/ before bin/ in case of a mid-install error to 63# keep the users system reasonably usable. For static->dynamic root upgrades, 64# we don't want to install a dynamic binary without rtld and the needed 65# libraries. More commonly, for dynamic root, we don't want to install a 66# binary that requires a newer library version that hasn't been installed yet. 67# This ordering is not a guarantee though. The only guarantee of a working 68# system here would require fine-grained ordering of all components based 69# on their dependencies. 70SRCDIR?= ${.CURDIR} 71.if !empty(SUBDIR_OVERRIDE) 72SUBDIR= ${SUBDIR_OVERRIDE} 73.else 74SUBDIR= lib libexec 75.if !defined(NO_ROOT) && (make(installworld) || make(install)) 76# Ensure libraries are installed before progressing. 77SUBDIR+=.WAIT 78.endif 79SUBDIR+=bin 80.if ${MK_CDDL} != "no" 81SUBDIR+=cddl 82.endif 83SUBDIR+=gnu include 84.if ${MK_KERBEROS} != "no" 85SUBDIR+=kerberos5 86.endif 87.if ${MK_RESCUE} != "no" 88SUBDIR+=rescue 89.endif 90SUBDIR+=sbin 91.if ${MK_CRYPT} != "no" 92SUBDIR+=secure 93.endif 94.if !defined(NO_SHARE) 95SUBDIR+=share 96.endif 97SUBDIR+=sys usr.bin usr.sbin 98.if ${MK_TESTS} != "no" 99SUBDIR+= tests 100.endif 101.if ${MK_OFED} != "no" 102SUBDIR+=contrib/ofed 103.endif 104 105# Local directories are last, since it is nice to at least get the base 106# system rebuilt before you do them. 107.for _DIR in ${LOCAL_DIRS} 108.if exists(${.CURDIR}/${_DIR}/Makefile) 109SUBDIR+= ${_DIR} 110.endif 111.endfor 112# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR 113# of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and 114# LOCAL_LIB_DIRS=foo/lib to behave as expected. 115.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|} 116_REDUNDENT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*} 117.endfor 118.for _DIR in ${LOCAL_LIB_DIRS} 119.if empty(_REDUNDENT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile) 120SUBDIR+= ${_DIR} 121.else 122.warning ${_DIR} not added to SUBDIR list. See UPDATING 20141121. 123.endif 124.endfor 125 126# We must do etc/ last as it hooks into building the man whatis file 127# by calling 'makedb' in share/man. This is only relevant for 128# install/distribute so they build the whatis file after every manpage is 129# installed. 130.if make(installworld) || make(install) 131SUBDIR+=.WAIT 132.endif 133SUBDIR+=etc 134 135.endif # !empty(SUBDIR_OVERRIDE) 136 137.if defined(NOCLEAN) 138.warning NOCLEAN option is deprecated. Use NO_CLEAN instead. 139NO_CLEAN= ${NOCLEAN} 140.endif 141.if defined(NO_CLEANDIR) 142CLEANDIR= clean cleandepend 143.else 144CLEANDIR= cleandir 145.endif 146 147LOCAL_TOOL_DIRS?= 148PACKAGEDIR?= ${DESTDIR}/${DISTDIR} 149 150.if empty(SHELL:M*csh*) 151BUILDENV_SHELL?=${SHELL} 152.else 153BUILDENV_SHELL?=/bin/sh 154.endif 155 156.if !defined(SVN) || empty(SVN) 157. for _P in /usr/bin /usr/local/bin 158. for _S in svn svnlite 159. if exists(${_P}/${_S}) 160SVN= ${_P}/${_S} 161. endif 162. endfor 163. endfor 164.endif 165SVNFLAGS?= -r HEAD 166 167MAKEOBJDIRPREFIX?= /usr/obj 168.if !defined(OSRELDATE) 169.if exists(/usr/include/osreldate.h) 170OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 171 /usr/include/osreldate.h 172.else 173OSRELDATE= 0 174.endif 175.export OSRELDATE 176.endif 177 178# Set VERSION for CTFMERGE to use via the default CTFFLAGS=-L VERSION. 179.if !defined(VERSION) 180REVISION!= MK_AUTO_OBJ=no ${MAKE} -C ${SRCDIR}/release -V REVISION 181BRANCH!= MK_AUTO_OBJ=no ${MAKE} -C ${SRCDIR}/release -V BRANCH 182SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 183 ${SRCDIR}/sys/sys/param.h 184VERSION= FreeBSD ${REVISION}-${BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDATE} 185.export VERSION 186.endif 187 188KNOWN_ARCHES?= aarch64/arm64 \ 189 amd64 \ 190 arm \ 191 armeb/arm \ 192 armv6/arm \ 193 armv6hf/arm \ 194 i386 \ 195 i386/pc98 \ 196 mips \ 197 mipsel/mips \ 198 mips64el/mips \ 199 mips64/mips \ 200 mipsn32el/mips \ 201 mipsn32/mips \ 202 powerpc \ 203 powerpc64/powerpc \ 204 riscv64/riscv \ 205 sparc64 206 207.if ${TARGET} == ${TARGET_ARCH} 208_t= ${TARGET} 209.else 210_t= ${TARGET_ARCH}/${TARGET} 211.endif 212.for _t in ${_t} 213.if empty(KNOWN_ARCHES:M${_t}) 214.error Unknown target ${TARGET_ARCH}:${TARGET}. 215.endif 216.endfor 217 218.if ${TARGET} == ${MACHINE} 219TARGET_CPUTYPE?=${CPUTYPE} 220.else 221TARGET_CPUTYPE?= 222.endif 223 224.if !empty(TARGET_CPUTYPE) 225_TARGET_CPUTYPE=${TARGET_CPUTYPE} 226.else 227_TARGET_CPUTYPE=dummy 228.endif 229_CPUTYPE!= MK_AUTO_OBJ=no MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ 230 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE 231.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 232.error CPUTYPE global should be set with ?=. 233.endif 234.if make(buildworld) 235BUILD_ARCH!= uname -p 236.if ${MACHINE_ARCH} != ${BUILD_ARCH} 237.error To cross-build, set TARGET_ARCH. 238.endif 239.endif 240.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING) 241OBJTREE= ${MAKEOBJDIRPREFIX} 242.else 243OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} 244.endif 245WORLDTMP= ${OBJTREE}${.CURDIR}/tmp 246BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/bin 247XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin 248STRICTTMPPATH= ${BPATH}:${XPATH} 249TMPPATH= ${STRICTTMPPATH}:${PATH} 250 251# 252# Avoid running mktemp(1) unless actually needed. 253# It may not be functional, e.g., due to new ABI 254# when in the middle of installing over this system. 255# 256.if make(distributeworld) || make(installworld) 257INSTALLTMP!= /usr/bin/mktemp -d -u -t install 258.endif 259 260# 261# Building a world goes through the following stages 262# 263# 1. legacy stage [BMAKE] 264# This stage is responsible for creating compatibility 265# shims that are needed by the bootstrap-tools, 266# build-tools and cross-tools stages. These are generally 267# APIs that tools from one of those three stages need to 268# build that aren't present on the host. 269# 1. bootstrap-tools stage [BMAKE] 270# This stage is responsible for creating programs that 271# are needed for backward compatibility reasons. They 272# are not built as cross-tools. 273# 2. build-tools stage [TMAKE] 274# This stage is responsible for creating the object 275# tree and building any tools that are needed during 276# the build process. Some programs are listed during 277# this phase because they build binaries to generate 278# files needed to build these programs. This stage also 279# builds the 'build-tools' target rather than 'all'. 280# 3. cross-tools stage [XMAKE] 281# This stage is responsible for creating any tools that 282# are needed for building the system. A cross-compiler is one 283# of them. This differs from build tools in two ways: 284# 1. the 'all' target is built rather than 'build-tools' 285# 2. these tools are installed into TMPPATH for stage 4. 286# 4. world stage [WMAKE] 287# This stage actually builds the world. 288# 5. install stage (optional) [IMAKE] 289# This stage installs a previously built world. 290# 291 292BOOTSTRAPPING?= 0 293 294# Common environment for world related stages 295CROSSENV+= MAKEOBJDIRPREFIX=${OBJTREE} \ 296 MACHINE_ARCH=${TARGET_ARCH} \ 297 MACHINE=${TARGET} \ 298 CPUTYPE=${TARGET_CPUTYPE}
|
299.if ${MK_GROFF} != "no" 300CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 301 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 302 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 303.endif 304.if defined(TARGET_CFLAGS) 305CROSSENV+= ${TARGET_CFLAGS} 306.endif 307 308# bootstrap-tools stage 309BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 310 PATH=${BPATH}:${PATH} \ 311 WORLDTMP=${WORLDTMP} \ 312 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" 313# need to keep this in sync with targets/pseudo/bootstrap-tools/Makefile 314BSARGS= DESTDIR= \ 315 BOOTSTRAPPING=${OSRELDATE} \ 316 SSP_CFLAGS= \ 317 MK_HTML=no NO_LINT=yes MK_MAN=no \ 318 -DNO_PIC MK_PROFILE=no -DNO_SHARED \ 319 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 320 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ 321 MK_LLDB=no MK_TESTS=no \ 322 MK_INCLUDES=yes 323 324BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 325 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 326 ${BSARGS} 327 328# build-tools stage 329TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 330 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 331 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 332 DESTDIR= \ 333 BOOTSTRAPPING=${OSRELDATE} \ 334 SSP_CFLAGS= \ 335 -DNO_LINT \ 336 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 337 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ 338 MK_LLDB=no MK_TESTS=no 339 340# cross-tools stage 341XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ 342 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 343 MK_GDB=no MK_TESTS=no 344 345# kernel-tools stage 346KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 347 PATH=${BPATH}:${PATH} \ 348 WORLDTMP=${WORLDTMP} 349KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \ 350 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 351 DESTDIR= \ 352 BOOTSTRAPPING=${OSRELDATE} \ 353 SSP_CFLAGS= \ 354 MK_HTML=no -DNO_LINT MK_MAN=no \ 355 -DNO_PIC MK_PROFILE=no -DNO_SHARED \ 356 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no 357 358# world stage 359WMAKEENV= ${CROSSENV} \ 360 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 361 PATH=${TMPPATH} 362 363# make hierarchy 364HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q} 365.if defined(NO_ROOT) 366HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT 367.endif 368 369.if defined(CROSS_TOOLCHAIN_PREFIX) 370CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 371CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 372.endif 373 374# If we do not have a bootstrap binutils (because the in-tree one does not 375# support the target architecture), provide a default cross-binutils prefix. 376# This allows aarch64 builds, for example, to automatically use the 377# aarch64-binutils port or package. 378.if !make(showconfig) 379.if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \ 380 !defined(CROSS_BINUTILS_PREFIX) 381CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/ 382.if !exists(${CROSS_BINUTILS_PREFIX}) 383.error In-tree binutils does not support the ${TARGET_ARCH} architecture. Install the ${TARGET_ARCH}-binutils port or package or set CROSS_BINUTILS_PREFIX. 384.endif 385.endif 386.endif 387 388XCOMPILERS= CC CXX CPP 389.for COMPILER in ${XCOMPILERS} 390.if defined(CROSS_COMPILER_PREFIX) 391X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}} 392.else 393X${COMPILER}?= ${${COMPILER}} 394.endif 395.endfor 396XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS 397.for BINUTIL in ${XBINUTILS} 398.if defined(CROSS_BINUTILS_PREFIX) && \ 399 exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}}) 400X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}} 401.else 402X${BINUTIL}?= ${${BINUTIL}} 403.endif 404.endfor 405CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \ 406 CPP="${XCPP} ${XCFLAGS}" \ 407 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ 408 OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \ 409 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \ 410 SIZE="${XSIZE}" 411 412.if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX}) 413# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a 414# directory, but the compiler will look in the right place for its 415# tools so we don't need to tell it where to look. 416BFLAGS+= -B${CROSS_BINUTILS_PREFIX} 417.endif 418 419# External compiler needs sysroot and target flags. 420.if ${XCC:N${CCACHE_BIN}:M/*} || ${MK_CROSS_COMPILER} == "no" 421.if !defined(CROSS_BINUTILS_PREFIX) || !exists(${CROSS_BINUTILS_PREFIX}) 422BFLAGS+= -B${WORLDTMP}/usr/bin 423.endif 424.if ${TARGET} == "arm" 425.if ${TARGET_ARCH:M*hf*} != "" 426TARGET_ABI= gnueabihf 427.else 428TARGET_ABI= gnueabi 429.endif 430.endif 431.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc 432# GCC requires -isystem and -L when using a cross-compiler. 433XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib 434# Force using libc++ for external GCC. 435XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \ 436 -nostdinc++ -L${WORLDTMP}/../lib/libc++ 437.else 438TARGET_ABI?= unknown 439TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 440XCFLAGS+= -target ${TARGET_TRIPLE} 441.endif 442XCFLAGS+= --sysroot=${WORLDTMP} 443.else 444.endif # ${XCC:M/*} || ${MK_CROSS_COMPILER} == "no" 445 446.if !empty(BFLAGS) 447XCFLAGS+= ${BFLAGS} 448.endif 449 450.if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \ 451 ${TARGET_ARCH} == "powerpc64") 452LIBCOMPAT= 32 453.include "Makefile.libcompat" 454.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH} == "armv6" 455LIBCOMPAT= SOFT 456.include "Makefile.libcompat" 457.endif 458 459WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP} 460 461IMAKEENV= ${CROSSENV} 462IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ 463 ${IMAKE_INSTALL} ${IMAKE_MTREE} 464.if empty(.MAKEFLAGS:M-n) 465IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ 466 LD_LIBRARY_PATH=${INSTALLTMP} \ 467 PATH_LOCALE=${INSTALLTMP}/locale 468IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh 469.else 470IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} 471.endif 472.if defined(DB_FROM_SRC) 473INSTALLFLAGS+= -N ${.CURDIR}/etc 474MTREEFLAGS+= -N ${.CURDIR}/etc 475.endif 476_INSTALL_DDIR= ${DESTDIR}/${DISTDIR} 477INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::} 478.if defined(NO_ROOT) 479METALOG?= ${DESTDIR}/${DISTDIR}/METALOG 480IMAKE+= -DNO_ROOT METALOG=${METALOG} 481INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR} 482MTREEFLAGS+= -W 483.endif 484.if defined(DB_FROM_SRC) || defined(NO_ROOT) 485IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}" 486IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}" 487.endif 488 489# kernel stage 490KMAKEENV= ${WMAKEENV} 491KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} 492 493# 494# buildworld 495# 496# Attempt to rebuild the entire system, with reasonable chance of 497# success, regardless of how old your existing system is. 498# 499_worldtmp: .PHONY 500.if ${.CURDIR:C/[^,]//g} != "" 501# The m4 build of sendmail files doesn't like it if ',' is used 502# anywhere in the path of it's files. 503 @echo 504 @echo "*** Error: path to source tree contains a comma ','" 505 @echo 506 false 507.endif 508 @echo 509 @echo "--------------------------------------------------------------" 510 @echo ">>> Rebuilding the temporary build tree" 511 @echo "--------------------------------------------------------------" 512.if !defined(NO_CLEAN) 513 rm -rf ${WORLDTMP} 514.if defined(LIBCOMPAT) 515 rm -rf ${LIBCOMPATTMP} 516.endif 517.else 518 rm -rf ${WORLDTMP}/legacy/usr/include 519# XXX - These can depend on any header file. 520 rm -f ${OBJTREE}${.CURDIR}/lib/libsysdecode/ioctl.c 521 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c 522.endif 523.for _dir in \ 524 lib lib/casper usr legacy/bin legacy/usr 525 mkdir -p ${WORLDTMP}/${_dir} 526.endfor 527 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 528 -p ${WORLDTMP}/legacy/usr >/dev/null 529.if ${MK_GROFF} != "no" 530 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \ 531 -p ${WORLDTMP}/legacy/usr >/dev/null 532.endif 533 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 534 -p ${WORLDTMP}/usr >/dev/null 535 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 536 -p ${WORLDTMP}/usr/include >/dev/null 537 ln -sf ${.CURDIR}/sys ${WORLDTMP} 538.if ${MK_DEBUG_FILES} != "no" 539 # We could instead disable debug files for these build stages 540 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 541 -p ${WORLDTMP}/legacy/usr/lib >/dev/null 542 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 543 -p ${WORLDTMP}/usr/lib >/dev/null 544.endif 545.if defined(LIBCOMPAT) 546 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 547 -p ${WORLDTMP}/usr >/dev/null 548.if ${MK_DEBUG_FILES} != "no" 549 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 550 -p ${WORLDTMP}/legacy/usr/lib/debug/usr >/dev/null 551 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 552 -p ${WORLDTMP}/usr/lib/debug/usr >/dev/null 553.endif 554.endif 555.if ${MK_TESTS} != "no" 556 mkdir -p ${WORLDTMP}${TESTSBASE} 557 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 558 -p ${WORLDTMP}${TESTSBASE} >/dev/null 559.if ${MK_DEBUG_FILES} != "no" 560 mkdir -p ${WORLDTMP}/usr/lib/debug/${TESTSBASE} 561 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 562 -p ${WORLDTMP}/usr/lib/debug/${TESTSBASE} >/dev/null 563.endif 564.endif 565.for _mtree in ${LOCAL_MTREE} 566 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null 567.endfor 568_legacy: 569 @echo 570 @echo "--------------------------------------------------------------" 571 @echo ">>> stage 1.1: legacy release compatibility shims" 572 @echo "--------------------------------------------------------------" 573 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy 574_bootstrap-tools: 575 @echo 576 @echo "--------------------------------------------------------------" 577 @echo ">>> stage 1.2: bootstrap tools" 578 @echo "--------------------------------------------------------------" 579 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools 580_cleanobj: 581.if !defined(NO_CLEAN) 582 @echo 583 @echo "--------------------------------------------------------------" 584 @echo ">>> stage 2.1: cleaning up the object tree" 585 @echo "--------------------------------------------------------------" 586 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR} 587.if defined(LIBCOMPAT) 588 ${_+_}cd ${.CURDIR}; ${LIBCOMPATWMAKE} -f Makefile.inc1 ${CLEANDIR} 589.endif 590.endif 591_obj: 592 @echo 593 @echo "--------------------------------------------------------------" 594 @echo ">>> stage 2.2: rebuilding the object tree" 595 @echo "--------------------------------------------------------------" 596 ${_+_}cd ${.CURDIR}; ${WMAKE} obj 597_build-tools: 598 @echo 599 @echo "--------------------------------------------------------------" 600 @echo ">>> stage 2.3: build tools" 601 @echo "--------------------------------------------------------------" 602 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools 603_cross-tools: 604 @echo 605 @echo "--------------------------------------------------------------" 606 @echo ">>> stage 3: cross tools" 607 @echo "--------------------------------------------------------------" 608 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools 609 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools 610_includes: 611 @echo 612 @echo "--------------------------------------------------------------" 613 @echo ">>> stage 4.1: building includes" 614 @echo "--------------------------------------------------------------" 615# Special handling for SUBDIR_OVERRIDE in buildworld as they most likely need 616# headers from default SUBDIR. Do SUBDIR_OVERRIDE includes last. 617 ${_+_}cd ${.CURDIR}; ${WMAKE} SUBDIR_OVERRIDE= SHARED=symlinks \ 618 MK_INCLUDES=yes includes 619.if !empty(SUBDIR_OVERRIDE) && make(buildworld) 620 ${_+_}cd ${.CURDIR}; ${WMAKE} MK_INCLUDES=yes SHARED=symlinks includes 621.endif 622_libraries: 623 @echo 624 @echo "--------------------------------------------------------------" 625 @echo ">>> stage 4.2: building libraries" 626 @echo "--------------------------------------------------------------" 627 ${_+_}cd ${.CURDIR}; \ 628 ${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \ 629 MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries 630everything: 631 @echo 632 @echo "--------------------------------------------------------------" 633 @echo ">>> stage 4.3: building everything" 634 @echo "--------------------------------------------------------------" 635 ${_+_}cd ${.CURDIR}; _PARALLEL_SUBDIR_OK=1 ${WMAKE} all 636 637WMAKE_TGTS= 638WMAKE_TGTS+= _worldtmp _legacy 639.if empty(SUBDIR_OVERRIDE) 640WMAKE_TGTS+= _bootstrap-tools 641.endif 642WMAKE_TGTS+= _cleanobj _obj _build-tools _cross-tools 643WMAKE_TGTS+= _includes _libraries 644WMAKE_TGTS+= everything 645.if defined(LIBCOMPAT) && empty(SUBDIR_OVERRIDE) 646WMAKE_TGTS+= build${libcompat} 647.endif 648 649buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 650.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 651 652buildworld_prologue: .PHONY 653 @echo "--------------------------------------------------------------" 654 @echo ">>> World build started on `LC_ALL=C date`" 655 @echo "--------------------------------------------------------------" 656 657buildworld_epilogue: .PHONY 658 @echo 659 @echo "--------------------------------------------------------------" 660 @echo ">>> World build completed on `LC_ALL=C date`" 661 @echo "--------------------------------------------------------------" 662 663# 664# We need to have this as a target because the indirection between Makefile 665# and Makefile.inc1 causes the correct PATH to be used, rather than a 666# modification of the current environment's PATH. In addition, we need 667# to quote multiword values. 668# 669buildenvvars: .PHONY 670 @echo ${WMAKEENV:Q} ${.MAKE.EXPORTED:@v@$v=\"${$v}\"@} 671 672.if ${.TARGETS:Mbuildenv} 673.if ${.MAKEFLAGS:M-j} 674.error The buildenv target is incompatible with -j 675.endif 676.endif 677BUILDENV_DIR?= ${.CURDIR} 678buildenv: .PHONY 679 @echo Entering world for ${TARGET_ARCH}:${TARGET} 680.if ${BUILDENV_SHELL:M*zsh*} 681 @echo For ZSH you must run: export CPUTYPE=${TARGET_CPUTYPE} 682.endif 683 @cd ${BUILDENV_DIR} && env ${WMAKEENV} BUILDENV=1 ${BUILDENV_SHELL} \ 684 || true 685 686TOOLCHAIN_TGTS= ${WMAKE_TGTS:Neverything:Nbuild${libcompat}} 687toolchain: ${TOOLCHAIN_TGTS} 688kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} 689 690# 691# installcheck 692# 693# Checks to be sure system is ready for installworld/installkernel. 694# 695installcheck: _installcheck_world _installcheck_kernel 696_installcheck_world: 697_installcheck_kernel: 698 699# 700# Require DESTDIR to be set if installing for a different architecture or 701# using the user/group database in the source tree. 702# 703.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \ 704 defined(DB_FROM_SRC) 705.if !make(distributeworld) 706_installcheck_world: __installcheck_DESTDIR 707_installcheck_kernel: __installcheck_DESTDIR 708__installcheck_DESTDIR: 709.if !defined(DESTDIR) || empty(DESTDIR) 710 @echo "ERROR: Please set DESTDIR!"; \ 711 false 712.endif 713.endif 714.endif 715 716.if !defined(DB_FROM_SRC) 717# 718# Check for missing UIDs/GIDs. 719# 720CHECK_UIDS= auditdistd 721CHECK_GIDS= audit 722.if ${MK_SENDMAIL} != "no" 723CHECK_UIDS+= smmsp 724CHECK_GIDS+= smmsp 725.endif 726.if ${MK_PF} != "no" 727CHECK_UIDS+= proxy 728CHECK_GIDS+= proxy authpf 729.endif 730.if ${MK_UNBOUND} != "no" 731CHECK_UIDS+= unbound 732CHECK_GIDS+= unbound 733.endif 734_installcheck_world: __installcheck_UGID 735__installcheck_UGID: 736.for uid in ${CHECK_UIDS} 737 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 738 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 739 false; \ 740 fi 741.endfor 742.for gid in ${CHECK_GIDS} 743 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 744 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 745 false; \ 746 fi 747.endfor 748.endif 749 750# 751# Required install tools to be saved in a scratch dir for safety. 752# 753.if ${MK_ZONEINFO} != "no" 754_zoneinfo= zic tzsetup 755.endif 756 757ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \ 758 date echo egrep find grep id install ${_install-info} \ 759 ln make mkdir mtree mv pwd_mkdb \ 760 rm sed services_mkdb sh strip sysctl test true uname wc ${_zoneinfo} \ 761 ${LOCAL_ITOOLS} 762 763# Needed for share/man 764.if ${MK_MAN} != "no" 765ITOOLS+=makewhatis 766.endif 767 768# 769# distributeworld 770# 771# Distributes everything compiled by a `buildworld'. 772# 773# installworld 774# 775# Installs everything compiled by a 'buildworld'. 776# 777 778# Non-base distributions produced by the base system 779EXTRA_DISTRIBUTIONS= doc 780.if defined(LIBCOMPAT) 781EXTRA_DISTRIBUTIONS+= lib${libcompat} 782.endif 783.if ${MK_TESTS} != "no" 784EXTRA_DISTRIBUTIONS+= tests 785.endif 786 787DEBUG_DISTRIBUTIONS= 788.if ${MK_DEBUG_FILES} != "no" 789DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,:S,tests,,} 790.endif 791 792MTREE_MAGIC?= mtree 2.0 793 794distributeworld installworld: _installcheck_world 795 mkdir -p ${INSTALLTMP} 796 progs=$$(for prog in ${ITOOLS}; do \ 797 if progpath=`which $$prog`; then \ 798 echo $$progpath; \ 799 else \ 800 echo "Required tool $$prog not found in PATH." >&2; \ 801 exit 1; \ 802 fi; \ 803 done); \ 804 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \ 805 while read line; do \ 806 set -- $$line; \ 807 if [ "$$2 $$3" != "not found" ]; then \ 808 echo $$2; \ 809 else \ 810 echo "Required library $$1 not found." >&2; \ 811 exit 1; \ 812 fi; \ 813 done); \ 814 cp $$libs $$progs ${INSTALLTMP} 815 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale 816.if defined(NO_ROOT) 817 -mkdir -p ${METALOG:H} 818 echo "#${MTREE_MAGIC}" > ${METALOG} 819.endif 820.if make(distributeworld) 821.for dist in ${EXTRA_DISTRIBUTIONS} 822 -mkdir ${DESTDIR}/${DISTDIR}/${dist} 823 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 824 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null 825 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 826 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 827 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 828 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null 829.if ${MK_DEBUG_FILES} != "no" 830 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 831 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null 832.endif 833.if defined(LIBCOMPAT) 834 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 835 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 836.if ${MK_DEBUG_FILES} != "no" 837 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 838 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/usr >/dev/null 839.endif 840.endif 841.if ${MK_TESTS} != "no" && ${dist} == "tests" 842 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} 843 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 844 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null 845.if ${MK_DEBUG_FILES} != "no" 846 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 847 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/${TESTSBASE} >/dev/null 848.endif 849.endif 850.if defined(NO_ROOT) 851 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ 852 sed -e 's#^\./#./${dist}/#' >> ${METALOG} 853 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \ 854 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 855 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \ 856 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG} 857.if defined(LIBCOMPAT) 858 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \ 859 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 860.endif 861.endif 862.endfor 863 -mkdir ${DESTDIR}/${DISTDIR}/base 864 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 865 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \ 866 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \ 867 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs 868.endif 869 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 870 ${IMAKEENV} rm -rf ${INSTALLTMP} 871.if make(distributeworld) 872.for dist in ${EXTRA_DISTRIBUTIONS} 873 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete 874.endfor 875.if defined(NO_ROOT) 876.for dist in base ${EXTRA_DISTRIBUTIONS} 877 @# For each file that exists in this dist, print the corresponding 878 @# line from the METALOG. This relies on the fact that 879 @# a line containing only the filename will sort immediatly before 880 @# the relevant mtree line. 881 cd ${DESTDIR}/${DISTDIR}; \ 882 find ./${dist} | sort -u ${METALOG} - | \ 883 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 884 ${DESTDIR}/${DISTDIR}/${dist}.meta 885.endfor 886.for dist in ${DEBUG_DISTRIBUTIONS} 887 @# For each file that exists in this dist, print the corresponding 888 @# line from the METALOG. This relies on the fact that 889 @# a line containing only the filename will sort immediatly before 890 @# the relevant mtree line. 891 cd ${DESTDIR}/${DISTDIR}; \ 892 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \ 893 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 894 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta 895.endfor 896.endif 897.endif 898 899packageworld: 900.for dist in base ${EXTRA_DISTRIBUTIONS} 901.if defined(NO_ROOT) 902 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 903 tar cvf - --exclude usr/lib/debug \ 904 @${DESTDIR}/${DISTDIR}/${dist}.meta | \ 905 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz 906.else 907 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 908 tar cvf - --exclude usr/lib/debug . | \ 909 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz 910.endif 911.endfor 912 913.for dist in ${DEBUG_DISTRIBUTIONS} 914. if defined(NO_ROOT) 915 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 916 tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \ 917 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz 918. else 919 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 920 tar cvLf - usr/lib/debug | \ 921 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz 922. endif 923.endfor 924 925# 926# reinstall 927# 928# If you have a build server, you can NFS mount the source and obj directories 929# and do a 'make reinstall' on the *client* to install new binaries from the 930# most recent server build. 931# 932reinstall: .MAKE .PHONY 933 @echo "--------------------------------------------------------------" 934 @echo ">>> Making hierarchy" 935 @echo "--------------------------------------------------------------" 936 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 937 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy 938 @echo 939 @echo "--------------------------------------------------------------" 940 @echo ">>> Installing everything" 941 @echo "--------------------------------------------------------------" 942 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 943.if defined(LIBCOMPAT) 944 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install${libcompat} 945.endif 946 947redistribute: .MAKE .PHONY 948 @echo "--------------------------------------------------------------" 949 @echo ">>> Distributing everything" 950 @echo "--------------------------------------------------------------" 951 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 952.if defined(LIBCOMPAT) 953 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute${libcompat} \ 954 DISTRIBUTION=lib${libcompat} 955.endif 956 957distrib-dirs distribution: .MAKE .PHONY 958 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 959 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET} 960.if make(distribution) 961 ${_+_}cd ${.CURDIR}; ${CROSSENV} PATH=${TMPPATH} \ 962 ${MAKE} -f Makefile.inc1 ${IMAKE_INSTALL} \ 963 METALOG=${METALOG} MK_TESTS=no installconfig 964.endif 965 966# 967# buildkernel and installkernel 968# 969# Which kernels to build and/or install is specified by setting 970# KERNCONF. If not defined a GENERIC kernel is built/installed. 971# Only the existing (depending TARGET) config files are used 972# for building kernels and only the first of these is designated 973# as the one being installed. 974# 975# Note that we have to use TARGET instead of TARGET_ARCH when 976# we're in kernel-land. Since only TARGET_ARCH is (expected) to 977# be set to cross-build, we have to make sure TARGET is set 978# properly. 979 980.if defined(KERNFAST) 981NO_KERNELCLEAN= t 982NO_KERNELCONFIG= t 983NO_KERNELOBJ= t 984# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 985.if !defined(KERNCONF) && ${KERNFAST} != "1" 986KERNCONF=${KERNFAST} 987.endif 988.endif 989.if ${TARGET_ARCH} == "powerpc64" 990KERNCONF?= GENERIC64 991.else 992KERNCONF?= GENERIC 993.endif 994INSTKERNNAME?= kernel 995 996KERNSRCDIR?= ${.CURDIR}/sys 997KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 998KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 999KERNCONFDIR?= ${KRNLCONFDIR} 1000 1001BUILDKERNELS= 1002INSTALLKERNEL= 1003.if defined(NO_INSTALLKERNEL) 1004# All of the BUILDKERNELS loops start at index 1. 1005BUILDKERNELS+= dummy 1006.endif 1007.for _kernel in ${KERNCONF} 1008.if exists(${KERNCONFDIR}/${_kernel}) 1009BUILDKERNELS+= ${_kernel} 1010.if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL) 1011INSTALLKERNEL= ${_kernel} 1012.endif 1013.endif 1014.endfor 1015 1016${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY 1017 1018# 1019# buildkernel 1020# 1021# Builds all kernels defined by BUILDKERNELS. 1022# 1023buildkernel: .MAKE .PHONY 1024.if empty(BUILDKERNELS:Ndummy) 1025 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 1026 false 1027.endif 1028 @echo 1029.for _kernel in ${BUILDKERNELS:Ndummy} 1030 @echo "--------------------------------------------------------------" 1031 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 1032 @echo "--------------------------------------------------------------" 1033 @echo "===> ${_kernel}" 1034 mkdir -p ${KRNLOBJDIR} 1035.if !defined(NO_KERNELCONFIG) 1036 @echo 1037 @echo "--------------------------------------------------------------" 1038 @echo ">>> stage 1: configuring the kernel" 1039 @echo "--------------------------------------------------------------" 1040 cd ${KRNLCONFDIR}; \ 1041 PATH=${TMPPATH} \ 1042 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 1043 -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}' 1044.endif 1045.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 1046 @echo 1047 @echo "--------------------------------------------------------------" 1048 @echo ">>> stage 2.1: cleaning up the object tree" 1049 @echo "--------------------------------------------------------------" 1050 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 1051.endif 1052.if !defined(NO_KERNELOBJ) 1053 @echo 1054 @echo "--------------------------------------------------------------" 1055 @echo ">>> stage 2.2: rebuilding the object tree" 1056 @echo "--------------------------------------------------------------" 1057 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 1058.endif 1059 @echo 1060 @echo "--------------------------------------------------------------" 1061 @echo ">>> stage 2.3: build tools" 1062 @echo "--------------------------------------------------------------" 1063 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools 1064 @echo 1065 @echo "--------------------------------------------------------------" 1066 @echo ">>> stage 3.1: building everything" 1067 @echo "--------------------------------------------------------------" 1068 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 1069 @echo "--------------------------------------------------------------" 1070 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 1071 @echo "--------------------------------------------------------------" 1072.endfor 1073 1074# 1075# installkernel, etc. 1076# 1077# Install the kernel defined by INSTALLKERNEL 1078# 1079installkernel installkernel.debug \ 1080reinstallkernel reinstallkernel.debug: _installcheck_kernel 1081.if !defined(NO_INSTALLKERNEL) 1082.if empty(INSTALLKERNEL) 1083 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1084 false 1085.endif 1086 @echo "--------------------------------------------------------------" 1087 @echo ">>> Installing kernel ${INSTALLKERNEL}" 1088 @echo "--------------------------------------------------------------" 1089 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1090 ${CROSSENV} PATH=${TMPPATH} \ 1091 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 1092.endif 1093.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS) 1094.for _kernel in ${BUILDKERNELS:[2..-1]} 1095 @echo "--------------------------------------------------------------" 1096 @echo ">>> Installing kernel ${_kernel}" 1097 @echo "--------------------------------------------------------------" 1098 cd ${KRNLOBJDIR}/${_kernel}; \ 1099 ${CROSSENV} PATH=${TMPPATH} \ 1100 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME}.${_kernel} ${.TARGET:S/kernel//} 1101.endfor 1102.endif 1103 1104distributekernel distributekernel.debug: 1105.if !defined(NO_INSTALLKERNEL) 1106.if empty(INSTALLKERNEL) 1107 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1108 false 1109.endif 1110 mkdir -p ${DESTDIR}/${DISTDIR} 1111.if defined(NO_ROOT) 1112 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta 1113.endif 1114 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1115 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \ 1116 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \ 1117 DESTDIR=${INSTALL_DDIR}/kernel \ 1118 ${.TARGET:S/distributekernel/install/} 1119.if defined(NO_ROOT) 1120 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \ 1121 ${DESTDIR}/${DISTDIR}/kernel.meta 1122.endif 1123.endif 1124.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS) 1125.for _kernel in ${BUILDKERNELS:[2..-1]} 1126.if defined(NO_ROOT) 1127 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta 1128.endif 1129 cd ${KRNLOBJDIR}/${_kernel}; \ 1130 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \ 1131 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \ 1132 KERNEL=${INSTKERNNAME}.${_kernel} \ 1133 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \ 1134 ${.TARGET:S/distributekernel/install/} 1135.if defined(NO_ROOT) 1136 sed -e 's|^./kernel|.|' \ 1137 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \ 1138 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1139.endif 1140.endfor 1141.endif 1142 1143packagekernel: 1144.if defined(NO_ROOT) 1145.if !defined(NO_INSTALLKERNEL) 1146 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1147 tar cvf - --exclude '*.debug' \ 1148 @${DESTDIR}/${DISTDIR}/kernel.meta | \ 1149 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz 1150.endif 1151 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1152 tar cvf - --include '*/*/*.debug' \ 1153 @${DESTDIR}/${DISTDIR}/kernel.meta | \ 1154 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz 1155.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS) 1156.for _kernel in ${BUILDKERNELS:[2..-1]} 1157 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1158 tar cvf - --exclude '*.debug' \ 1159 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ 1160 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz 1161 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1162 tar cvf - --include '*/*/*.debug' \ 1163 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ 1164 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz 1165.endfor 1166.endif 1167.else 1168.if !defined(NO_INSTALLKERNEL) 1169 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1170 tar cvf - --exclude '*.debug' . | \ 1171 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz 1172.endif 1173 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1174 tar cvf - --include '*/*/*.debug' $$(eval find .) | \ 1175 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz 1176.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS) 1177.for _kernel in ${BUILDKERNELS:[2..-1]} 1178 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1179 tar cvf - --exclude '*.debug' . | \ 1180 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz 1181 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1182 tar cvf - --include '*/*/*.debug' $$(eval find .) | \ 1183 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz 1184.endfor 1185.endif 1186.endif 1187 1188# 1189# 1190# checkworld 1191# 1192# Run test suite on installed world. 1193# 1194checkworld: .PHONY 1195 @if [ ! -x ${LOCALBASE}/bin/kyua ]; then \ 1196 echo "You need kyua (devel/kyua) to run the test suite." | /usr/bin/fmt; \ 1197 exit 1; \ 1198 fi 1199 ${_+_}${LOCALBASE}/bin/kyua test -k ${TESTSBASE}/Kyuafile 1200 1201# 1202# 1203# doxygen 1204# 1205# Build the API documentation with doxygen 1206# 1207doxygen: .PHONY 1208 @if [ ! -x ${LOCALBASE}/bin/doxygen ]; then \ 1209 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 1210 exit 1; \ 1211 fi 1212 ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys; ${MAKE} obj all 1213 1214# 1215# update 1216# 1217# Update the source tree(s), by running svn/svnup to update to the 1218# latest copy. 1219# 1220update: 1221.if defined(SVN_UPDATE) 1222 @echo "--------------------------------------------------------------" 1223 @echo ">>> Updating ${.CURDIR} using Subversion" 1224 @echo "--------------------------------------------------------------" 1225 @(cd ${.CURDIR}; ${SVN} update ${SVNFLAGS}) 1226.endif 1227 1228# 1229# ------------------------------------------------------------------------ 1230# 1231# From here onwards are utility targets used by the 'make world' and 1232# related targets. If your 'world' breaks, you may like to try to fix 1233# the problem and manually run the following targets to attempt to 1234# complete the build. Beware, this is *not* guaranteed to work, you 1235# need to have a pretty good grip on the current state of the system 1236# to attempt to manually finish it. If in doubt, 'make world' again. 1237# 1238 1239# 1240# legacy: Build compatibility shims for the next three targets. This is a 1241# minimal set of tools and shims necessary to compensate for older systems 1242# which don't have the APIs required by the targets built in bootstrap-tools, 1243# build-tools or cross-tools. 1244# 1245 1246# ELF Tool Chain libraries are needed for ELF tools and dtrace tools. 1247# r296685 fix cross-endian objcopy 1248.if ${BOOTSTRAPPING} < 1100102 1249_elftoolchain_libs= lib/libelf lib/libdwarf 1250.endif 1251 1252legacy: 1253.if ${BOOTSTRAPPING} < 800107 && ${BOOTSTRAPPING} != 0 1254 @echo "ERROR: Source upgrades from versions prior to 8.0 are not supported."; \ 1255 false 1256.endif 1257.for _tool in tools/build ${_elftoolchain_libs} 1258 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,all,install)"; \ 1259 cd ${.CURDIR}/${_tool}; \ 1260 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1261 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 1262 ${MAKE} DIRPRFX=${_tool}/ all; \ 1263 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1264.endfor 1265 1266# 1267# bootstrap-tools: Build tools needed for compatibility. These are binaries that 1268# are built to build other binaries in the system. However, the focus of these 1269# binaries is usually quite narrow. Bootstrap tools use the host's compiler and 1270# libraries, augmented by -legacy. 1271# 1272_bt= _bootstrap-tools 1273 1274.if ${MK_GAMES} != "no" 1275_strfile= usr.bin/fortune/strfile 1276.endif 1277 1278.if ${MK_GCC} != "no" && ${MK_CXX} != "no" 1279_gperf= gnu/usr.bin/gperf 1280.endif 1281 1282.if ${MK_GROFF} != "no" 1283_groff= gnu/usr.bin/groff \ 1284 usr.bin/soelim 1285.endif 1286 1287.if ${MK_VT} != "no" 1288_vtfontcvt= usr.bin/vtfontcvt 1289.endif 1290 1291.if ${BOOTSTRAPPING} < 900002 1292_sed= usr.bin/sed 1293.endif 1294 1295.if ${BOOTSTRAPPING} < 1000033 1296_libopenbsd= lib/libopenbsd 1297_m4= usr.bin/m4 1298_lex= usr.bin/lex 1299 1300${_bt}-usr.bin/m4: ${_bt}-lib/libopenbsd 1301${_bt}-usr.bin/lex: ${_bt}-usr.bin/m4 1302.endif 1303 1304.if ${BOOTSTRAPPING} < 1000026 1305_nmtree= lib/libnetbsd \ 1306 usr.sbin/nmtree 1307 1308${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd 1309.endif 1310 1311.if ${BOOTSTRAPPING} < 1000027 1312_cat= bin/cat 1313.endif 1314 1315# r264059 support for status= 1316.if ${BOOTSTRAPPING} < 1100017 1317_dd= bin/dd 1318.endif 1319 1320# r277259 crunchide: Correct 64-bit section header offset 1321# r281674 crunchide: always include both 32- and 64-bit ELF support 1322# r285986 crunchen: use STRIPBIN rather than STRIP 1323.if ${BOOTSTRAPPING} < 1100078 1324_crunch= usr.sbin/crunch 1325.endif 1326 1327.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041 1328_awk= usr.bin/awk 1329.endif 1330 1331# r296926 -P keymap search path 1332.if ${BOOTSTRAPPING} < 1100103 1333_kbdcontrol= usr.sbin/kbdcontrol 1334.endif 1335 1336_yacc= lib/liby \ 1337 usr.bin/yacc 1338 1339${_bt}-usr.bin/yacc: ${_bt}-lib/liby 1340 1341.if ${MK_BSNMP} != "no" 1342_gensnmptree= usr.sbin/bsnmpd/gensnmptree 1343.endif 1344 1345# We need to build tblgen when we're building clang either as 1346# the bootstrap compiler, or as the part of the normal build. 1347.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" 1348_clang_tblgen= \ 1349 lib/clang/libllvmsupport \ 1350 lib/clang/libllvmtablegen \ 1351 usr.bin/clang/llvm-tblgen \ 1352 usr.bin/clang/clang-tblgen 1353 1354${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport 1355${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport 1356.endif 1357 1358# Default to building the GPL DTC, but build the BSDL one if users explicitly 1359# request it. 1360_dtc= usr.bin/dtc 1361.if ${MK_GPL_DTC} != "no" 1362_dtc= gnu/usr.bin/dtc 1363.endif 1364 1365.if ${MK_KERBEROS} != "no" 1366_kerberos5_bootstrap_tools= \ 1367 kerberos5/tools/make-roken \ 1368 kerberos5/lib/libroken \ 1369 kerberos5/lib/libvers \ 1370 kerberos5/tools/asn1_compile \ 1371 kerberos5/tools/slc \ 1372 usr.bin/compile_et 1373 1374.ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} 1375.endif 1376 1377# r283777 makewhatis(1) replaced with mandoc version which builds a database. 1378.if ${MK_MANDOCDB} != "no" && ${BOOTSTRAPPING} < 1100075 1379_libopenbsd?= lib/libopenbsd 1380_makewhatis= lib/libsqlite3 \ 1381 usr.bin/mandoc 1382${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd ${_bt}-lib/libsqlite3 1383.endif 1384 1385bootstrap-tools: .PHONY 1386 1387# Please document (add comment) why something is in 'bootstrap-tools'. 1388# Try to bound the building of the bootstrap-tool to just the 1389# FreeBSD versions that need the tool built at this stage of the build. 1390.for _tool in \ 1391 ${_clang_tblgen} \ 1392 ${_kerberos5_bootstrap_tools} \ 1393 ${_strfile} \ 1394 ${_gperf} \ 1395 ${_groff} \ 1396 ${_dtc} \ 1397 ${_awk} \ 1398 ${_cat} \ 1399 ${_dd} \ 1400 ${_kbdcontrol} \ 1401 usr.bin/lorder \ 1402 ${_libopenbsd} \ 1403 ${_makewhatis} \ 1404 usr.bin/rpcgen \ 1405 ${_sed} \ 1406 ${_yacc} \ 1407 ${_m4} \ 1408 ${_lex} \ 1409 usr.bin/xinstall \ 1410 ${_gensnmptree} \ 1411 usr.sbin/config \ 1412 ${_crunch} \ 1413 ${_nmtree} \ 1414 ${_vtfontcvt} \ 1415 usr.bin/localedef 1416${_bt}-${_tool}: .PHONY .MAKE 1417 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 1418 cd ${.CURDIR}/${_tool}; \ 1419 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1420 ${MAKE} DIRPRFX=${_tool}/ all; \ 1421 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1422 1423bootstrap-tools: ${_bt}-${_tool} 1424.endfor 1425 1426# 1427# build-tools: Build special purpose build tools 1428# 1429.if !defined(NO_SHARE) 1430_share= share/syscons/scrnmaps 1431.endif 1432 1433.if ${MK_GCC} != "no" 1434_gcc_tools= gnu/usr.bin/cc/cc_tools 1435.endif 1436 1437.if ${MK_RESCUE} != "no" 1438# rescue includes programs that have build-tools targets 1439_rescue=rescue/rescue 1440.endif 1441 1442.for _tool in \ 1443 bin/csh \ 1444 bin/sh \ 1445 ${LOCAL_TOOL_DIRS} \ 1446 lib/ncurses/ncurses \ 1447 lib/ncurses/ncursesw \ 1448 ${_rescue} \ 1449 ${_share} \ 1450 usr.bin/awk \ 1451 lib/libmagic \ 1452 usr.bin/mkesdb_static \ 1453 usr.bin/mkcsmapper_static \ 1454 usr.bin/vi/catalog 1455build-tools_${_tool}: .PHONY 1456 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 1457 cd ${.CURDIR}/${_tool}; \ 1458 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1459 ${MAKE} DIRPRFX=${_tool}/ build-tools 1460build-tools: build-tools_${_tool} 1461.endfor 1462.for _tool in \ 1463 ${_gcc_tools} 1464build-tools_${_tool}: .PHONY 1465 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all)"; \ 1466 cd ${.CURDIR}/${_tool}; \ 1467 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1468 ${MAKE} DIRPRFX=${_tool}/ all 1469build-tools: build-tools_${_tool} 1470.endfor 1471 1472# 1473# kernel-tools: Build kernel-building tools 1474# 1475kernel-tools: 1476 mkdir -p ${MAKEOBJDIRPREFIX}/usr 1477 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1478 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null 1479 1480# 1481# cross-tools: All the tools needed to build the rest of the system after 1482# we get done with the earlier stages. It is the last set of tools needed 1483# to begin building the target binaries. 1484# 1485.if ${TARGET_ARCH} != ${MACHINE_ARCH} 1486.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 1487_btxld= usr.sbin/btxld 1488.endif 1489.endif 1490 1491# Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures 1492# resulting from missing bug fixes or ELF Toolchain updates. 1493.if ${MK_CDDL} != "no" 1494_dtrace_tools= cddl/lib/libctf cddl/usr.bin/ctfconvert \ 1495 cddl/usr.bin/ctfmerge 1496.endif 1497 1498# If we're given an XAS, don't build binutils. 1499.if ${XAS:M/*} == "" 1500.if ${MK_BINUTILS_BOOTSTRAP} != "no" 1501_binutils= gnu/usr.bin/binutils 1502.endif 1503.if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" 1504_elftctools= lib/libelftc \ 1505 lib/libpe \ 1506 usr.bin/elfcopy \ 1507 usr.bin/nm \ 1508 usr.bin/size \ 1509 usr.bin/strings 1510# These are not required by the build, but can be useful for developers who 1511# cross-build on a FreeBSD 10 host: 1512_elftctools+= usr.bin/addr2line 1513.endif 1514.elif ${TARGET_ARCH} != ${MACHINE_ARCH} && ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" 1515# If cross-building with an external binutils we still need to build strip for 1516# the target (for at least crunchide). 1517_elftctools= lib/libelftc \ 1518 lib/libpe \ 1519 usr.bin/elfcopy 1520.endif 1521 1522# If an full path to an external cross compiler is given, don't build 1523# a cross compiler. 1524.if ${XCC:N${CCACHE_BIN}:M/*} == "" && ${MK_CROSS_COMPILER} != "no" 1525.if ${MK_CLANG_BOOTSTRAP} != "no" 1526_clang= usr.bin/clang 1527_clang_libs= lib/clang 1528.endif 1529.if ${MK_GCC_BOOTSTRAP} != "no" 1530_cc= gnu/usr.bin/cc 1531.endif 1532.endif 1533.if ${MK_USB} != "no" 1534_usb_tools= sys/boot/usb/tools 1535.endif 1536 1537cross-tools: .MAKE .PHONY 1538.for _tool in \ 1539 ${_clang_libs} \ 1540 ${_clang} \ 1541 ${_binutils} \ 1542 ${_elftctools} \ 1543 ${_dtrace_tools} \ 1544 ${_cc} \ 1545 ${_btxld} \ 1546 ${_crunchide} \ 1547 ${_usb_tools} 1548 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 1549 cd ${.CURDIR}/${_tool}; \ 1550 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1551 ${MAKE} DIRPRFX=${_tool}/ all; \ 1552 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 1553.endfor 1554 1555NXBDESTDIR= ${OBJTREE}/nxb-bin 1556NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \ 1557 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 1558 PATH=${PATH}:${OBJTREE}/gperf_for_gcc/usr/bin 1559NXBMAKE= ${NXBENV} ${MAKE} \ 1560 LLVM_TBLGEN=${NXBDESTDIR}/usr/bin/llvm-tblgen \ 1561 CLANG_TBLGEN=${NXBDESTDIR}/usr/bin/clang-tblgen \ 1562 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \ 1563 MK_GDB=no MK_TESTS=no \ 1564 SSP_CFLAGS= \ 1565 MK_HTML=no NO_LINT=yes MK_MAN=no \ 1566 -DNO_PIC MK_PROFILE=no -DNO_SHARED \ 1567 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 1568 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ 1569 MK_LLDB=no MK_DEBUG_FILES=no 1570 1571# native-xtools is the current target for qemu-user cross builds of ports 1572# via poudriere and the imgact_binmisc kernel module. 1573# For non-clang enabled targets that are still using the in tree gcc 1574# we must build a gperf binary for one instance of its Makefiles. On 1575# clang-enabled systems, the gperf binary is obsolete. 1576native-xtools: .PHONY 1577.if ${MK_GCC_BOOTSTRAP} != "no" 1578 mkdir -p ${OBJTREE}/gperf_for_gcc/usr/bin 1579 ${_+_}@${ECHODIR} "===> ${_gperf} (obj,all,install)"; \ 1580 cd ${.CURDIR}/${_gperf}; \ 1581 ${NXBMAKE} DIRPRFX=${_gperf}/ obj; \ 1582 ${NXBMAKE} DIRPRFX=${_gperf}/ all; \ 1583 ${NXBMAKE} DIRPRFX=${_gperf}/ DESTDIR=${OBJTREE}/gperf_for_gcc install 1584.endif 1585 mkdir -p ${NXBDESTDIR}/bin ${NXBDESTDIR}/sbin ${NXBDESTDIR}/usr 1586 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1587 -p ${NXBDESTDIR}/usr >/dev/null 1588 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1589 -p ${NXBDESTDIR}/usr/include >/dev/null 1590.if ${MK_DEBUG_FILES} != "no" 1591 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 1592 -p ${NXBDESTDIR}/usr/lib >/dev/null 1593.endif 1594.for _tool in \ 1595 bin/cat \ 1596 bin/chmod \ 1597 bin/cp \ 1598 bin/csh \ 1599 bin/echo \ 1600 bin/expr \ 1601 bin/hostname \ 1602 bin/ln \ 1603 bin/ls \ 1604 bin/mkdir \ 1605 bin/mv \ 1606 bin/ps \ 1607 bin/realpath \ 1608 bin/rm \ 1609 bin/rmdir \ 1610 bin/sh \ 1611 bin/sleep \ 1612 ${_clang_tblgen} \ 1613 usr.bin/ar \ 1614 ${_binutils} \ 1615 ${_elftctools} \ 1616 ${_cc} \ 1617 ${_gcc_tools} \ 1618 ${_clang_libs} \ 1619 ${_clang} \ 1620 sbin/md5 \ 1621 sbin/sysctl \ 1622 gnu/usr.bin/diff \ 1623 usr.bin/awk \ 1624 usr.bin/basename \ 1625 usr.bin/bmake \ 1626 usr.bin/bzip2 \ 1627 usr.bin/cmp \ 1628 usr.bin/dirname \ 1629 usr.bin/env \ 1630 usr.bin/fetch \ 1631 usr.bin/find \ 1632 usr.bin/grep \ 1633 usr.bin/gzip \ 1634 usr.bin/id \ 1635 usr.bin/lex \ 1636 usr.bin/lorder \ 1637 usr.bin/mktemp \ 1638 usr.bin/mt \ 1639 usr.bin/patch \ 1640 usr.bin/sed \ 1641 usr.bin/sort \ 1642 usr.bin/tar \ 1643 usr.bin/touch \ 1644 usr.bin/tr \ 1645 usr.bin/true \ 1646 usr.bin/uniq \ 1647 usr.bin/unzip \ 1648 usr.bin/xargs \ 1649 usr.bin/xinstall \ 1650 usr.bin/xz \ 1651 usr.bin/yacc \ 1652 usr.sbin/chown 1653 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 1654 cd ${.CURDIR}/${_tool}; \ 1655 ${NXBMAKE} DIRPRFX=${_tool}/ obj; \ 1656 ${NXBMAKE} DIRPRFX=${_tool}/ all; \ 1657 ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${NXBDESTDIR} install 1658.endfor 1659 1660# 1661# hierarchy - ensure that all the needed directories are present 1662# 1663hierarchy hier: .MAKE .PHONY 1664 ${_+_}cd ${.CURDIR}/etc; ${HMAKE} distrib-dirs 1665 1666# 1667# libraries - build all libraries, and install them under ${DESTDIR}. 1668# 1669# The list of libraries with dependents (${_prebuild_libs}) and their 1670# interdependencies (__L) are built automatically by the 1671# ${.CURDIR}/tools/make_libdeps.sh script. 1672# 1673libraries: .MAKE .PHONY 1674 ${_+_}cd ${.CURDIR}; \ 1675 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 1676 ${MAKE} -f Makefile.inc1 _startup_libs; \ 1677 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 1678 ${MAKE} -f Makefile.inc1 _generic_libs 1679 1680# 1681# static libgcc.a prerequisite for shared libc 1682# 1683_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt 1684 1685# These dependencies are not automatically generated: 1686# 1687# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 1688# all shared libraries for ELF. 1689# 1690_startup_libs= gnu/lib/csu 1691_startup_libs+= lib/csu 1692_startup_libs+= gnu/lib/libgcc 1693_startup_libs+= lib/libcompiler_rt 1694_startup_libs+= lib/libc 1695_startup_libs+= lib/libc_nonshared 1696.if ${MK_LIBCPLUSPLUS} != "no" 1697_startup_libs+= lib/libcxxrt 1698.endif 1699 1700gnu/lib/libgcc__L: lib/libc__L 1701gnu/lib/libgcc__L: lib/libc_nonshared__L 1702.if ${MK_LIBCPLUSPLUS} != "no" 1703lib/libcxxrt__L: gnu/lib/libgcc__L 1704.endif 1705 1706_prebuild_libs= ${_kerberos5_lib_libasn1} \ 1707 ${_kerberos5_lib_libhdb} \ 1708 ${_kerberos5_lib_libheimbase} \ 1709 ${_kerberos5_lib_libheimntlm} \ 1710 ${_libsqlite3} \ 1711 ${_kerberos5_lib_libheimipcc} \ 1712 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 1713 ${_kerberos5_lib_libroken} \ 1714 ${_kerberos5_lib_libwind} \ 1715 lib/libbz2 ${_libcom_err} lib/libcrypt \ 1716 lib/libelf lib/libexpat \ 1717 lib/libfigpar \ 1718 ${_lib_libgssapi} \ 1719 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ 1720 ${_lib_casper} \ 1721 lib/ncurses/ncurses lib/ncurses/ncursesw \ 1722 lib/libopie lib/libpam/libpam ${_lib_libthr} \ 1723 ${_lib_libradius} lib/libsbuf lib/libtacplus \ 1724 lib/libgeom \ 1725 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ 1726 ${_cddl_lib_libuutil} \ 1727 ${_cddl_lib_libavl} \ 1728 ${_cddl_lib_libzfs_core} \ 1729 ${_cddl_lib_libctf} \ 1730 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \ 1731 ${_secure_lib_libcrypto} ${_lib_libldns} \ 1732 ${_secure_lib_libssh} ${_secure_lib_libssl} \ 1733 gnu/lib/libdialog 1734 1735.if ${MK_GNUCXX} != "no" 1736_prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++ 1737gnu/lib/libstdc++__L: lib/msun__L 1738gnu/lib/libsupc++__L: gnu/lib/libstdc++__L 1739.endif 1740 1741.if ${MK_LIBCPLUSPLUS} != "no" 1742_prebuild_libs+= lib/libc++ 1743.endif 1744 1745lib/libgeom__L: lib/libexpat__L 1746lib/libkvm__L: lib/libelf__L 1747 1748.if ${MK_LIBTHR} != "no" 1749_lib_libthr= lib/libthr 1750.endif 1751 1752.if ${MK_RADIUS_SUPPORT} != "no" 1753_lib_libradius= lib/libradius 1754.endif 1755 1756.if ${MK_OFED} != "no" 1757_ofed_lib= contrib/ofed/usr.lib 1758_prebuild_libs+= contrib/ofed/usr.lib/libosmcomp 1759_prebuild_libs+= contrib/ofed/usr.lib/libopensm 1760_prebuild_libs+= contrib/ofed/usr.lib/libibcommon 1761_prebuild_libs+= contrib/ofed/usr.lib/libibverbs 1762_prebuild_libs+= contrib/ofed/usr.lib/libibumad 1763 1764contrib/ofed/usr.lib/libopensm__L: lib/libthr__L 1765contrib/ofed/usr.lib/libosmcomp__L: lib/libthr__L 1766contrib/ofed/usr.lib/libibumad__L: contrib/ofed/usr.lib/libibcommon__L 1767.endif 1768 1769.if ${MK_CASPER} != "no" 1770_lib_casper= lib/libcasper 1771.endif 1772 1773lib/libpjdlog__L: lib/libutil__L 1774lib/libcasper__L: lib/libnv__L 1775lib/liblzma__L: lib/libthr__L 1776 1777_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} 1778.for _DIR in ${LOCAL_LIB_DIRS} 1779.if exists(${.CURDIR}/${_DIR}/Makefile) && empty(_generic_libs:M${_DIR}) 1780_generic_libs+= ${_DIR} 1781.endif 1782.endfor 1783 1784lib/libopie__L lib/libtacplus__L: lib/libmd__L 1785 1786.if ${MK_CDDL} != "no" 1787_cddl_lib_libumem= cddl/lib/libumem 1788_cddl_lib_libnvpair= cddl/lib/libnvpair 1789_cddl_lib_libavl= cddl/lib/libavl 1790_cddl_lib_libuutil= cddl/lib/libuutil 1791_cddl_lib_libzfs_core= cddl/lib/libzfs_core 1792_cddl_lib_libctf= cddl/lib/libctf 1793_cddl_lib= cddl/lib 1794cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L 1795cddl/lib/libzfs__L: lib/libgeom__L 1796cddl/lib/libctf__L: lib/libz__L 1797.endif 1798# cddl/lib/libdtrace requires lib/libproc and lib/librtld_db; it's only built 1799# on select architectures though (see cddl/lib/Makefile) 1800.if ${MACHINE_CPUARCH} != "sparc64" 1801_prebuild_libs+= lib/libproc lib/librtld_db 1802.endif 1803 1804.if ${MK_CRYPT} != "no" 1805.if ${MK_OPENSSL} != "no" 1806_secure_lib_libcrypto= secure/lib/libcrypto 1807_secure_lib_libssl= secure/lib/libssl 1808lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 1809.if ${MK_LDNS} != "no" 1810_lib_libldns= lib/libldns 1811lib/libldns__L: secure/lib/libcrypto__L 1812.endif 1813.if ${MK_OPENSSH} != "no" 1814_secure_lib_libssh= secure/lib/libssh 1815secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 1816.if ${MK_LDNS} != "no" 1817secure/lib/libssh__L: lib/libldns__L 1818.endif 1819.if ${MK_KERBEROS_SUPPORT} != "no" 1820secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 1821 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 1822 lib/libmd__L kerberos5/lib/libroken__L 1823.endif 1824.endif 1825.endif 1826_secure_lib= secure/lib 1827.endif 1828 1829.if ${MK_KERBEROS} != "no" 1830kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L 1831kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1832 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ 1833 kerberos5/lib/libwind__L lib/libsqlite3__L 1834kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ 1835 kerberos5/lib/libroken__L lib/libcom_err__L 1836kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1837 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L 1838kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1839 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ 1840 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ 1841 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L 1842kerberos5/lib/libroken__L: lib/libcrypt__L 1843kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L 1844kerberos5/lib/libheimbase__L: lib/libthr__L 1845kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L 1846.endif 1847 1848lib/libsqlite3__L: lib/libthr__L 1849 1850.if ${MK_GSSAPI} != "no" 1851_lib_libgssapi= lib/libgssapi 1852.endif 1853 1854.if ${MK_KERBEROS} != "no" 1855_kerberos5_lib= kerberos5/lib 1856_kerberos5_lib_libasn1= kerberos5/lib/libasn1 1857_kerberos5_lib_libhdb= kerberos5/lib/libhdb 1858_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase 1859_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 1860_kerberos5_lib_libhx509= kerberos5/lib/libhx509 1861_kerberos5_lib_libroken= kerberos5/lib/libroken 1862_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 1863_libsqlite3= lib/libsqlite3 1864_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc 1865_kerberos5_lib_libwind= kerberos5/lib/libwind 1866_libcom_err= lib/libcom_err 1867.endif 1868 1869.if ${MK_NIS} != "no" 1870_lib_libypclnt= lib/libypclnt 1871.endif 1872 1873.if ${MK_OPENSSL} == "no" 1874lib/libradius__L: lib/libmd__L 1875.endif 1876 1877lib/libproc__L: \ 1878 ${_cddl_lib_libctf:D${_cddl_lib_libctf}__L} lib/libelf__L lib/librtld_db__L lib/libutil__L 1879.if ${MK_CXX} != "no" 1880.if ${MK_LIBCPLUSPLUS} != "no" 1881lib/libproc__L: lib/libcxxrt__L 1882.else # This implies MK_GNUCXX != "no"; see lib/libproc 1883lib/libproc__L: gnu/lib/libsupc++__L 1884.endif 1885.endif 1886 1887gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L 1888 1889.for _lib in ${_prereq_libs} 1890${_lib}__PL: .PHONY .MAKE 1891.if exists(${.CURDIR}/${_lib}) 1892 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 1893 cd ${.CURDIR}/${_lib}; \ 1894 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; \ 1895 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \ 1896 DIRPRFX=${_lib}/ all; \ 1897 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \ 1898 DIRPRFX=${_lib}/ install 1899.endif 1900.endfor 1901 1902.for _lib in ${_startup_libs} ${_prebuild_libs} ${_generic_libs} 1903${_lib}__L: .PHONY .MAKE 1904.if exists(${.CURDIR}/${_lib}) 1905 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 1906 cd ${.CURDIR}/${_lib}; \ 1907 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; \ 1908 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all; \ 1909 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install 1910.endif 1911.endfor 1912 1913_prereq_libs: ${_prereq_libs:S/$/__PL/} 1914_startup_libs: ${_startup_libs:S/$/__L/} 1915_prebuild_libs: ${_prebuild_libs:S/$/__L/} 1916_generic_libs: ${_generic_libs:S/$/__L/} 1917 1918# Enable SUBDIR_PARALLEL when not calling 'make all', unless called from 1919# 'everything' with _PARALLEL_SUBDIR_OK set. This is because it is unlikely 1920# that running 'make all' from the top-level, especially with a SUBDIR_OVERRIDE 1921# or LOCAL_DIRS set, will have a reliable build if SUBDIRs are built in 1922# parallel. This is safe for the world stage of buildworld though since it has 1923# already built libraries in a proper order and installed includes into 1924# WORLDTMP. Special handling is done for SUBDIR ordering for 'install*' to 1925# avoid trashing a system if it crashes mid-install. 1926.if !make(all) || defined(_PARALLEL_SUBDIR_OK) 1927SUBDIR_PARALLEL= 1928.endif 1929 1930.include <bsd.subdir.mk> 1931 1932.if make(check-old) || make(check-old-dirs) || \ 1933 make(check-old-files) || make(check-old-libs) || \ 1934 make(delete-old) || make(delete-old-dirs) || \ 1935 make(delete-old-files) || make(delete-old-libs) 1936 1937# 1938# check for / delete old files section 1939# 1940 1941.include "ObsoleteFiles.inc" 1942 1943OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 1944else you can not start such an application. Consult UPDATING for more \ 1945information regarding how to cope with the removal/revision bump of a \ 1946specific library." 1947 1948.if !defined(BATCH_DELETE_OLD_FILES) 1949RM_I=-i 1950.else 1951RM_I=-v 1952.endif 1953 1954delete-old-files: 1955 @echo ">>> Removing old files (only deletes safe to delete libs)" 1956# Ask for every old file if the user really wants to remove it. 1957# It's annoying, but better safe than sorry. 1958# NB: We cannot pass the list of OLD_FILES as a parameter because the 1959# argument list will get too long. Using .for/.endfor make "loops" will make 1960# the Makefile parser segfault. 1961 @exec 3<&0; \ 1962 cd ${.CURDIR}; \ 1963 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1964 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1965 while read file; do \ 1966 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1967 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1968 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1969 fi; \ 1970 for ext in debug symbols; do \ 1971 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 1972 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 1973 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 1974 <&3; \ 1975 fi; \ 1976 done; \ 1977 done 1978# Remove catpages without corresponding manpages. 1979 @exec 3<&0; \ 1980 find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1981 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1982 while read catpage; do \ 1983 read manpage; \ 1984 if [ ! -e "$${manpage}" ]; then \ 1985 rm ${RM_I} $${catpage} <&3; \ 1986 fi; \ 1987 done 1988 @echo ">>> Old files removed" 1989 1990check-old-files: 1991 @echo ">>> Checking for old files" 1992 @cd ${.CURDIR}; \ 1993 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1994 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1995 while read file; do \ 1996 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1997 echo "${DESTDIR}/$${file}"; \ 1998 fi; \ 1999 for ext in debug symbols; do \ 2000 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2001 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 2002 fi; \ 2003 done; \ 2004 done 2005# Check for catpages without corresponding manpages. 2006 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 2007 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 2008 while read catpage; do \ 2009 read manpage; \ 2010 if [ ! -e "$${manpage}" ]; then \ 2011 echo $${catpage}; \ 2012 fi; \ 2013 done 2014 2015delete-old-libs: 2016 @echo ">>> Removing old libraries" 2017 @echo "${OLD_LIBS_MESSAGE}" | fmt 2018 @exec 3<&0; \ 2019 cd ${.CURDIR}; \ 2020 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2021 -V OLD_LIBS | xargs -n1 | \ 2022 while read file; do \ 2023 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 2024 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 2025 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 2026 fi; \ 2027 for ext in debug symbols; do \ 2028 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 2029 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2030 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 2031 <&3; \ 2032 fi; \ 2033 done; \ 2034 done 2035 @echo ">>> Old libraries removed" 2036 2037check-old-libs: 2038 @echo ">>> Checking for old libraries" 2039 @cd ${.CURDIR}; \ 2040 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2041 -V OLD_LIBS | xargs -n1 | \ 2042 while read file; do \ 2043 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 2044 echo "${DESTDIR}/$${file}"; \ 2045 fi; \ 2046 for ext in debug symbols; do \ 2047 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2048 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 2049 fi; \ 2050 done; \ 2051 done 2052 2053delete-old-dirs: 2054 @echo ">>> Removing old directories" 2055 @cd ${.CURDIR}; \ 2056 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2057 -V OLD_DIRS | xargs -n1 | sort -r | \ 2058 while read dir; do \ 2059 if [ -d "${DESTDIR}/$${dir}" ]; then \ 2060 rmdir -v "${DESTDIR}/$${dir}" || true; \ 2061 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 2062 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 2063 fi; \ 2064 done 2065 @echo ">>> Old directories removed" 2066 2067check-old-dirs: 2068 @echo ">>> Checking for old directories" 2069 @cd ${.CURDIR}; \ 2070 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2071 -V OLD_DIRS | xargs -n1 | \ 2072 while read dir; do \ 2073 if [ -d "${DESTDIR}/$${dir}" ]; then \ 2074 echo "${DESTDIR}/$${dir}"; \ 2075 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 2076 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 2077 fi; \ 2078 done 2079 2080delete-old: delete-old-files delete-old-dirs 2081 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 2082 2083check-old: check-old-files check-old-libs check-old-dirs 2084 @echo "To remove old files and directories run '${MAKE} delete-old'." 2085 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 2086 2087.endif 2088 2089# 2090# showconfig - show build configuration. 2091# 2092showconfig: 2093 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1; \ 2094 ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1) 2>&1 | grep ^MK_ | sort -u 2095 2096.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 2097DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 2098 2099.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 2100.if exists(${KERNCONFDIR}/${KERNCONF}) 2101FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 2102 '${KERNCONFDIR}/${KERNCONF}' ; echo 2103.endif 2104.endif 2105 2106.endif 2107 2108.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 2109DTBOUTPUTPATH= ${.CURDIR} 2110.endif 2111 2112# 2113# Build 'standalone' Device Tree Blob 2114# 2115builddtb: 2116 @PATH=${TMPPATH} MACHINE=${TARGET} \ 2117 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \ 2118 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH} 2119 2120############### 2121 2122# cleanworld 2123# In the following, the first 'rm' in a series will usually remove all 2124# files and directories. If it does not, then there are probably some 2125# files with file flags set, so this unsets them and tries the 'rm' a 2126# second time. There are situations where this target will be cleaning 2127# some directories via more than one method, but that duplication is 2128# needed to correctly handle all the possible situations. Removing all 2129# files without file flags set in the first 'rm' instance saves time, 2130# because 'chflags' will need to operate on fewer files afterwards. 2131# 2132# It is expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be 2133# created by bsd.obj.mk, except that we don't want to .include that file 2134# in this makefile. 2135# 2136BW_CANONICALOBJDIR:=${OBJTREE}${.CURDIR} 2137cleanworld: .PHONY 2138.if exists(${BW_CANONICALOBJDIR}/) 2139 -rm -rf ${BW_CANONICALOBJDIR}/* 2140 -chflags -R 0 ${BW_CANONICALOBJDIR} 2141 rm -rf ${BW_CANONICALOBJDIR}/* 2142.endif 2143.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} 2144 # To be safe in this case, fall back to a 'make cleandir' 2145 ${_+_}@cd ${.CURDIR}; ${MAKE} cleandir 2146.endif 2147 2148.if defined(TARGET) && defined(TARGET_ARCH) 2149 2150.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH} 2151XDEV_CPUTYPE?=${CPUTYPE} 2152.else 2153XDEV_CPUTYPE?=${TARGET_CPUTYPE} 2154.endif 2155 2156NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \ 2157 MK_MAN=no MK_NLS=no MK_PROFILE=no \ 2158 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \ 2159 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 2160 CPUTYPE=${XDEV_CPUTYPE} 2161 2162XDDIR=${TARGET_ARCH}-freebsd 2163XDTP?=/usr/${XDDIR} 2164.if ${XDTP:N/*} 2165.error XDTP variable should be an absolute path 2166.endif 2167 2168CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ 2169 INSTALL="sh ${.CURDIR}/tools/install.sh" 2170CDENV= ${CDBENV} \ 2171 TOOLS_PREFIX=${XDTP} 2172CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \ 2173 --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \ 2174 -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib 2175CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \ 2176 CPP="${CPP} ${CD2CFLAGS}" \ 2177 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} 2178 2179CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp 2180CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 2181CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN} 2182XDDESTDIR=${DESTDIR}/${XDTP} 2183.if !defined(OSREL) 2184OSREL!= uname -r | sed -e 's/[-(].*//' 2185.endif 2186 2187.ORDER: xdev-build xdev-install xdev-links 2188xdev: xdev-build xdev-install 2189 2190.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 2191xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 2192 2193_xb-worldtmp: .PHONY 2194 mkdir -p ${CDTMP}/usr 2195 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 2196 -p ${CDTMP}/usr >/dev/null 2197 2198_xb-bootstrap-tools: .PHONY 2199.for _tool in \ 2200 ${_clang_tblgen} \ 2201 ${_gperf} 2202 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 2203 cd ${.CURDIR}/${_tool}; \ 2204 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 2205 ${CDMAKE} DIRPRFX=${_tool}/ all; \ 2206 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install 2207.endfor 2208 2209_xb-build-tools: .PHONY 2210 ${_+_}@cd ${.CURDIR}; \ 2211 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools 2212 2213_xb-cross-tools: .PHONY 2214.for _tool in \ 2215 ${_binutils} \ 2216 ${_elftctools} \ 2217 usr.bin/ar \ 2218 ${_clang_libs} \ 2219 ${_clang} \ 2220 ${_cc} 2221 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,all)"; \ 2222 cd ${.CURDIR}/${_tool}; \ 2223 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 2224 ${CDMAKE} DIRPRFX=${_tool}/ all 2225.endfor 2226 2227_xi-mtree: .PHONY 2228 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 2229 mkdir -p ${XDDESTDIR} 2230 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 2231 -p ${XDDESTDIR} >/dev/null 2232 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 2233 -p ${XDDESTDIR}/usr >/dev/null 2234 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 2235 -p ${XDDESTDIR}/usr/include >/dev/null 2236.if defined(LIBCOMPAT) 2237 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 2238 -p ${XDDESTDIR}/usr >/dev/null 2239.endif 2240.if ${MK_TESTS} != "no" 2241 mkdir -p ${XDDESTDIR}${TESTSBASE} 2242 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 2243 -p ${XDDESTDIR}${TESTSBASE} >/dev/null 2244.endif 2245 2246.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries 2247xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries 2248 2249_xi-cross-tools: .PHONY 2250 @echo "_xi-cross-tools" 2251.for _tool in \ 2252 ${_binutils} \ 2253 ${_elftctools} \ 2254 usr.bin/ar \ 2255 ${_clang_libs} \ 2256 ${_clang} \ 2257 ${_cc} 2258 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 2259 cd ${.CURDIR}/${_tool}; \ 2260 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 2261.endfor 2262 2263_xi-includes: .PHONY 2264 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 includes \ 2265 DESTDIR=${XDDESTDIR} 2266 2267_xi-libraries: .PHONY 2268 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 2269 DESTDIR=${XDDESTDIR} 2270 2271xdev-links: .PHONY 2272 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 2273 mkdir -p ../../../../usr/bin; \ 2274 for i in *; do \ 2275 ln -sf ../../${XDTP}/usr/bin/$$i \ 2276 ../../../../usr/bin/${XDDIR}-$$i; \ 2277 ln -sf ../../${XDTP}/usr/bin/$$i \ 2278 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ 2279 done 2280.else 2281xdev xdev-build xdev-install xdev-links: 2282 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target" 2283.endif
| 303.if ${MK_GROFF} != "no" 304CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 305 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 306 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 307.endif 308.if defined(TARGET_CFLAGS) 309CROSSENV+= ${TARGET_CFLAGS} 310.endif 311 312# bootstrap-tools stage 313BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 314 PATH=${BPATH}:${PATH} \ 315 WORLDTMP=${WORLDTMP} \ 316 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" 317# need to keep this in sync with targets/pseudo/bootstrap-tools/Makefile 318BSARGS= DESTDIR= \ 319 BOOTSTRAPPING=${OSRELDATE} \ 320 SSP_CFLAGS= \ 321 MK_HTML=no NO_LINT=yes MK_MAN=no \ 322 -DNO_PIC MK_PROFILE=no -DNO_SHARED \ 323 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 324 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ 325 MK_LLDB=no MK_TESTS=no \ 326 MK_INCLUDES=yes 327 328BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 329 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 330 ${BSARGS} 331 332# build-tools stage 333TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 334 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 335 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 336 DESTDIR= \ 337 BOOTSTRAPPING=${OSRELDATE} \ 338 SSP_CFLAGS= \ 339 -DNO_LINT \ 340 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 341 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ 342 MK_LLDB=no MK_TESTS=no 343 344# cross-tools stage 345XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ 346 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 347 MK_GDB=no MK_TESTS=no 348 349# kernel-tools stage 350KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 351 PATH=${BPATH}:${PATH} \ 352 WORLDTMP=${WORLDTMP} 353KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \ 354 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 355 DESTDIR= \ 356 BOOTSTRAPPING=${OSRELDATE} \ 357 SSP_CFLAGS= \ 358 MK_HTML=no -DNO_LINT MK_MAN=no \ 359 -DNO_PIC MK_PROFILE=no -DNO_SHARED \ 360 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no 361 362# world stage 363WMAKEENV= ${CROSSENV} \ 364 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 365 PATH=${TMPPATH} 366 367# make hierarchy 368HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q} 369.if defined(NO_ROOT) 370HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT 371.endif 372 373.if defined(CROSS_TOOLCHAIN_PREFIX) 374CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 375CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 376.endif 377 378# If we do not have a bootstrap binutils (because the in-tree one does not 379# support the target architecture), provide a default cross-binutils prefix. 380# This allows aarch64 builds, for example, to automatically use the 381# aarch64-binutils port or package. 382.if !make(showconfig) 383.if !empty(BROKEN_OPTIONS:MBINUTILS_BOOTSTRAP) && \ 384 !defined(CROSS_BINUTILS_PREFIX) 385CROSS_BINUTILS_PREFIX=/usr/local/${TARGET_ARCH}-freebsd/bin/ 386.if !exists(${CROSS_BINUTILS_PREFIX}) 387.error In-tree binutils does not support the ${TARGET_ARCH} architecture. Install the ${TARGET_ARCH}-binutils port or package or set CROSS_BINUTILS_PREFIX. 388.endif 389.endif 390.endif 391 392XCOMPILERS= CC CXX CPP 393.for COMPILER in ${XCOMPILERS} 394.if defined(CROSS_COMPILER_PREFIX) 395X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}} 396.else 397X${COMPILER}?= ${${COMPILER}} 398.endif 399.endfor 400XBINUTILS= AS AR LD NM OBJCOPY OBJDUMP RANLIB SIZE STRINGS 401.for BINUTIL in ${XBINUTILS} 402.if defined(CROSS_BINUTILS_PREFIX) && \ 403 exists(${CROSS_BINUTILS_PREFIX}${${BINUTIL}}) 404X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}} 405.else 406X${BINUTIL}?= ${${BINUTIL}} 407.endif 408.endfor 409CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \ 410 CPP="${XCPP} ${XCFLAGS}" \ 411 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ 412 OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \ 413 RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \ 414 SIZE="${XSIZE}" 415 416.if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX}) 417# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a 418# directory, but the compiler will look in the right place for its 419# tools so we don't need to tell it where to look. 420BFLAGS+= -B${CROSS_BINUTILS_PREFIX} 421.endif 422 423# External compiler needs sysroot and target flags. 424.if ${XCC:N${CCACHE_BIN}:M/*} || ${MK_CROSS_COMPILER} == "no" 425.if !defined(CROSS_BINUTILS_PREFIX) || !exists(${CROSS_BINUTILS_PREFIX}) 426BFLAGS+= -B${WORLDTMP}/usr/bin 427.endif 428.if ${TARGET} == "arm" 429.if ${TARGET_ARCH:M*hf*} != "" 430TARGET_ABI= gnueabihf 431.else 432TARGET_ABI= gnueabi 433.endif 434.endif 435.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc 436# GCC requires -isystem and -L when using a cross-compiler. 437XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib 438# Force using libc++ for external GCC. 439XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \ 440 -nostdinc++ -L${WORLDTMP}/../lib/libc++ 441.else 442TARGET_ABI?= unknown 443TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 444XCFLAGS+= -target ${TARGET_TRIPLE} 445.endif 446XCFLAGS+= --sysroot=${WORLDTMP} 447.else 448.endif # ${XCC:M/*} || ${MK_CROSS_COMPILER} == "no" 449 450.if !empty(BFLAGS) 451XCFLAGS+= ${BFLAGS} 452.endif 453 454.if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \ 455 ${TARGET_ARCH} == "powerpc64") 456LIBCOMPAT= 32 457.include "Makefile.libcompat" 458.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH} == "armv6" 459LIBCOMPAT= SOFT 460.include "Makefile.libcompat" 461.endif 462 463WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP} 464 465IMAKEENV= ${CROSSENV} 466IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ 467 ${IMAKE_INSTALL} ${IMAKE_MTREE} 468.if empty(.MAKEFLAGS:M-n) 469IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ 470 LD_LIBRARY_PATH=${INSTALLTMP} \ 471 PATH_LOCALE=${INSTALLTMP}/locale 472IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh 473.else 474IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} 475.endif 476.if defined(DB_FROM_SRC) 477INSTALLFLAGS+= -N ${.CURDIR}/etc 478MTREEFLAGS+= -N ${.CURDIR}/etc 479.endif 480_INSTALL_DDIR= ${DESTDIR}/${DISTDIR} 481INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::} 482.if defined(NO_ROOT) 483METALOG?= ${DESTDIR}/${DISTDIR}/METALOG 484IMAKE+= -DNO_ROOT METALOG=${METALOG} 485INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR} 486MTREEFLAGS+= -W 487.endif 488.if defined(DB_FROM_SRC) || defined(NO_ROOT) 489IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}" 490IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}" 491.endif 492 493# kernel stage 494KMAKEENV= ${WMAKEENV} 495KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} 496 497# 498# buildworld 499# 500# Attempt to rebuild the entire system, with reasonable chance of 501# success, regardless of how old your existing system is. 502# 503_worldtmp: .PHONY 504.if ${.CURDIR:C/[^,]//g} != "" 505# The m4 build of sendmail files doesn't like it if ',' is used 506# anywhere in the path of it's files. 507 @echo 508 @echo "*** Error: path to source tree contains a comma ','" 509 @echo 510 false 511.endif 512 @echo 513 @echo "--------------------------------------------------------------" 514 @echo ">>> Rebuilding the temporary build tree" 515 @echo "--------------------------------------------------------------" 516.if !defined(NO_CLEAN) 517 rm -rf ${WORLDTMP} 518.if defined(LIBCOMPAT) 519 rm -rf ${LIBCOMPATTMP} 520.endif 521.else 522 rm -rf ${WORLDTMP}/legacy/usr/include 523# XXX - These can depend on any header file. 524 rm -f ${OBJTREE}${.CURDIR}/lib/libsysdecode/ioctl.c 525 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c 526.endif 527.for _dir in \ 528 lib lib/casper usr legacy/bin legacy/usr 529 mkdir -p ${WORLDTMP}/${_dir} 530.endfor 531 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 532 -p ${WORLDTMP}/legacy/usr >/dev/null 533.if ${MK_GROFF} != "no" 534 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \ 535 -p ${WORLDTMP}/legacy/usr >/dev/null 536.endif 537 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 538 -p ${WORLDTMP}/usr >/dev/null 539 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 540 -p ${WORLDTMP}/usr/include >/dev/null 541 ln -sf ${.CURDIR}/sys ${WORLDTMP} 542.if ${MK_DEBUG_FILES} != "no" 543 # We could instead disable debug files for these build stages 544 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 545 -p ${WORLDTMP}/legacy/usr/lib >/dev/null 546 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 547 -p ${WORLDTMP}/usr/lib >/dev/null 548.endif 549.if defined(LIBCOMPAT) 550 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 551 -p ${WORLDTMP}/usr >/dev/null 552.if ${MK_DEBUG_FILES} != "no" 553 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 554 -p ${WORLDTMP}/legacy/usr/lib/debug/usr >/dev/null 555 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 556 -p ${WORLDTMP}/usr/lib/debug/usr >/dev/null 557.endif 558.endif 559.if ${MK_TESTS} != "no" 560 mkdir -p ${WORLDTMP}${TESTSBASE} 561 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 562 -p ${WORLDTMP}${TESTSBASE} >/dev/null 563.if ${MK_DEBUG_FILES} != "no" 564 mkdir -p ${WORLDTMP}/usr/lib/debug/${TESTSBASE} 565 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 566 -p ${WORLDTMP}/usr/lib/debug/${TESTSBASE} >/dev/null 567.endif 568.endif 569.for _mtree in ${LOCAL_MTREE} 570 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null 571.endfor 572_legacy: 573 @echo 574 @echo "--------------------------------------------------------------" 575 @echo ">>> stage 1.1: legacy release compatibility shims" 576 @echo "--------------------------------------------------------------" 577 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy 578_bootstrap-tools: 579 @echo 580 @echo "--------------------------------------------------------------" 581 @echo ">>> stage 1.2: bootstrap tools" 582 @echo "--------------------------------------------------------------" 583 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools 584_cleanobj: 585.if !defined(NO_CLEAN) 586 @echo 587 @echo "--------------------------------------------------------------" 588 @echo ">>> stage 2.1: cleaning up the object tree" 589 @echo "--------------------------------------------------------------" 590 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR} 591.if defined(LIBCOMPAT) 592 ${_+_}cd ${.CURDIR}; ${LIBCOMPATWMAKE} -f Makefile.inc1 ${CLEANDIR} 593.endif 594.endif 595_obj: 596 @echo 597 @echo "--------------------------------------------------------------" 598 @echo ">>> stage 2.2: rebuilding the object tree" 599 @echo "--------------------------------------------------------------" 600 ${_+_}cd ${.CURDIR}; ${WMAKE} obj 601_build-tools: 602 @echo 603 @echo "--------------------------------------------------------------" 604 @echo ">>> stage 2.3: build tools" 605 @echo "--------------------------------------------------------------" 606 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools 607_cross-tools: 608 @echo 609 @echo "--------------------------------------------------------------" 610 @echo ">>> stage 3: cross tools" 611 @echo "--------------------------------------------------------------" 612 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools 613 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools 614_includes: 615 @echo 616 @echo "--------------------------------------------------------------" 617 @echo ">>> stage 4.1: building includes" 618 @echo "--------------------------------------------------------------" 619# Special handling for SUBDIR_OVERRIDE in buildworld as they most likely need 620# headers from default SUBDIR. Do SUBDIR_OVERRIDE includes last. 621 ${_+_}cd ${.CURDIR}; ${WMAKE} SUBDIR_OVERRIDE= SHARED=symlinks \ 622 MK_INCLUDES=yes includes 623.if !empty(SUBDIR_OVERRIDE) && make(buildworld) 624 ${_+_}cd ${.CURDIR}; ${WMAKE} MK_INCLUDES=yes SHARED=symlinks includes 625.endif 626_libraries: 627 @echo 628 @echo "--------------------------------------------------------------" 629 @echo ">>> stage 4.2: building libraries" 630 @echo "--------------------------------------------------------------" 631 ${_+_}cd ${.CURDIR}; \ 632 ${WMAKE} -DNO_FSCHG MK_HTML=no -DNO_LINT MK_MAN=no \ 633 MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries 634everything: 635 @echo 636 @echo "--------------------------------------------------------------" 637 @echo ">>> stage 4.3: building everything" 638 @echo "--------------------------------------------------------------" 639 ${_+_}cd ${.CURDIR}; _PARALLEL_SUBDIR_OK=1 ${WMAKE} all 640 641WMAKE_TGTS= 642WMAKE_TGTS+= _worldtmp _legacy 643.if empty(SUBDIR_OVERRIDE) 644WMAKE_TGTS+= _bootstrap-tools 645.endif 646WMAKE_TGTS+= _cleanobj _obj _build-tools _cross-tools 647WMAKE_TGTS+= _includes _libraries 648WMAKE_TGTS+= everything 649.if defined(LIBCOMPAT) && empty(SUBDIR_OVERRIDE) 650WMAKE_TGTS+= build${libcompat} 651.endif 652 653buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 654.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 655 656buildworld_prologue: .PHONY 657 @echo "--------------------------------------------------------------" 658 @echo ">>> World build started on `LC_ALL=C date`" 659 @echo "--------------------------------------------------------------" 660 661buildworld_epilogue: .PHONY 662 @echo 663 @echo "--------------------------------------------------------------" 664 @echo ">>> World build completed on `LC_ALL=C date`" 665 @echo "--------------------------------------------------------------" 666 667# 668# We need to have this as a target because the indirection between Makefile 669# and Makefile.inc1 causes the correct PATH to be used, rather than a 670# modification of the current environment's PATH. In addition, we need 671# to quote multiword values. 672# 673buildenvvars: .PHONY 674 @echo ${WMAKEENV:Q} ${.MAKE.EXPORTED:@v@$v=\"${$v}\"@} 675 676.if ${.TARGETS:Mbuildenv} 677.if ${.MAKEFLAGS:M-j} 678.error The buildenv target is incompatible with -j 679.endif 680.endif 681BUILDENV_DIR?= ${.CURDIR} 682buildenv: .PHONY 683 @echo Entering world for ${TARGET_ARCH}:${TARGET} 684.if ${BUILDENV_SHELL:M*zsh*} 685 @echo For ZSH you must run: export CPUTYPE=${TARGET_CPUTYPE} 686.endif 687 @cd ${BUILDENV_DIR} && env ${WMAKEENV} BUILDENV=1 ${BUILDENV_SHELL} \ 688 || true 689 690TOOLCHAIN_TGTS= ${WMAKE_TGTS:Neverything:Nbuild${libcompat}} 691toolchain: ${TOOLCHAIN_TGTS} 692kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} 693 694# 695# installcheck 696# 697# Checks to be sure system is ready for installworld/installkernel. 698# 699installcheck: _installcheck_world _installcheck_kernel 700_installcheck_world: 701_installcheck_kernel: 702 703# 704# Require DESTDIR to be set if installing for a different architecture or 705# using the user/group database in the source tree. 706# 707.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \ 708 defined(DB_FROM_SRC) 709.if !make(distributeworld) 710_installcheck_world: __installcheck_DESTDIR 711_installcheck_kernel: __installcheck_DESTDIR 712__installcheck_DESTDIR: 713.if !defined(DESTDIR) || empty(DESTDIR) 714 @echo "ERROR: Please set DESTDIR!"; \ 715 false 716.endif 717.endif 718.endif 719 720.if !defined(DB_FROM_SRC) 721# 722# Check for missing UIDs/GIDs. 723# 724CHECK_UIDS= auditdistd 725CHECK_GIDS= audit 726.if ${MK_SENDMAIL} != "no" 727CHECK_UIDS+= smmsp 728CHECK_GIDS+= smmsp 729.endif 730.if ${MK_PF} != "no" 731CHECK_UIDS+= proxy 732CHECK_GIDS+= proxy authpf 733.endif 734.if ${MK_UNBOUND} != "no" 735CHECK_UIDS+= unbound 736CHECK_GIDS+= unbound 737.endif 738_installcheck_world: __installcheck_UGID 739__installcheck_UGID: 740.for uid in ${CHECK_UIDS} 741 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 742 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 743 false; \ 744 fi 745.endfor 746.for gid in ${CHECK_GIDS} 747 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 748 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 749 false; \ 750 fi 751.endfor 752.endif 753 754# 755# Required install tools to be saved in a scratch dir for safety. 756# 757.if ${MK_ZONEINFO} != "no" 758_zoneinfo= zic tzsetup 759.endif 760 761ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \ 762 date echo egrep find grep id install ${_install-info} \ 763 ln make mkdir mtree mv pwd_mkdb \ 764 rm sed services_mkdb sh strip sysctl test true uname wc ${_zoneinfo} \ 765 ${LOCAL_ITOOLS} 766 767# Needed for share/man 768.if ${MK_MAN} != "no" 769ITOOLS+=makewhatis 770.endif 771 772# 773# distributeworld 774# 775# Distributes everything compiled by a `buildworld'. 776# 777# installworld 778# 779# Installs everything compiled by a 'buildworld'. 780# 781 782# Non-base distributions produced by the base system 783EXTRA_DISTRIBUTIONS= doc 784.if defined(LIBCOMPAT) 785EXTRA_DISTRIBUTIONS+= lib${libcompat} 786.endif 787.if ${MK_TESTS} != "no" 788EXTRA_DISTRIBUTIONS+= tests 789.endif 790 791DEBUG_DISTRIBUTIONS= 792.if ${MK_DEBUG_FILES} != "no" 793DEBUG_DISTRIBUTIONS+= base ${EXTRA_DISTRIBUTIONS:S,doc,,:S,tests,,} 794.endif 795 796MTREE_MAGIC?= mtree 2.0 797 798distributeworld installworld: _installcheck_world 799 mkdir -p ${INSTALLTMP} 800 progs=$$(for prog in ${ITOOLS}; do \ 801 if progpath=`which $$prog`; then \ 802 echo $$progpath; \ 803 else \ 804 echo "Required tool $$prog not found in PATH." >&2; \ 805 exit 1; \ 806 fi; \ 807 done); \ 808 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \ 809 while read line; do \ 810 set -- $$line; \ 811 if [ "$$2 $$3" != "not found" ]; then \ 812 echo $$2; \ 813 else \ 814 echo "Required library $$1 not found." >&2; \ 815 exit 1; \ 816 fi; \ 817 done); \ 818 cp $$libs $$progs ${INSTALLTMP} 819 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale 820.if defined(NO_ROOT) 821 -mkdir -p ${METALOG:H} 822 echo "#${MTREE_MAGIC}" > ${METALOG} 823.endif 824.if make(distributeworld) 825.for dist in ${EXTRA_DISTRIBUTIONS} 826 -mkdir ${DESTDIR}/${DISTDIR}/${dist} 827 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 828 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null 829 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 830 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 831 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 832 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null 833.if ${MK_DEBUG_FILES} != "no" 834 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 835 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null 836.endif 837.if defined(LIBCOMPAT) 838 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 839 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 840.if ${MK_DEBUG_FILES} != "no" 841 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 842 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/usr >/dev/null 843.endif 844.endif 845.if ${MK_TESTS} != "no" && ${dist} == "tests" 846 -mkdir -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} 847 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 848 -p ${DESTDIR}/${DISTDIR}/${dist}${TESTSBASE} >/dev/null 849.if ${MK_DEBUG_FILES} != "no" 850 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 851 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib/debug/${TESTSBASE} >/dev/null 852.endif 853.endif 854.if defined(NO_ROOT) 855 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ 856 sed -e 's#^\./#./${dist}/#' >> ${METALOG} 857 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \ 858 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 859 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \ 860 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG} 861.if defined(LIBCOMPAT) 862 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \ 863 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 864.endif 865.endif 866.endfor 867 -mkdir ${DESTDIR}/${DISTDIR}/base 868 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 869 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \ 870 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \ 871 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs 872.endif 873 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 874 ${IMAKEENV} rm -rf ${INSTALLTMP} 875.if make(distributeworld) 876.for dist in ${EXTRA_DISTRIBUTIONS} 877 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete 878.endfor 879.if defined(NO_ROOT) 880.for dist in base ${EXTRA_DISTRIBUTIONS} 881 @# For each file that exists in this dist, print the corresponding 882 @# line from the METALOG. This relies on the fact that 883 @# a line containing only the filename will sort immediatly before 884 @# the relevant mtree line. 885 cd ${DESTDIR}/${DISTDIR}; \ 886 find ./${dist} | sort -u ${METALOG} - | \ 887 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 888 ${DESTDIR}/${DISTDIR}/${dist}.meta 889.endfor 890.for dist in ${DEBUG_DISTRIBUTIONS} 891 @# For each file that exists in this dist, print the corresponding 892 @# line from the METALOG. This relies on the fact that 893 @# a line containing only the filename will sort immediatly before 894 @# the relevant mtree line. 895 cd ${DESTDIR}/${DISTDIR}; \ 896 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \ 897 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 898 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta 899.endfor 900.endif 901.endif 902 903packageworld: 904.for dist in base ${EXTRA_DISTRIBUTIONS} 905.if defined(NO_ROOT) 906 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 907 tar cvf - --exclude usr/lib/debug \ 908 @${DESTDIR}/${DISTDIR}/${dist}.meta | \ 909 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz 910.else 911 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 912 tar cvf - --exclude usr/lib/debug . | \ 913 ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz 914.endif 915.endfor 916 917.for dist in ${DEBUG_DISTRIBUTIONS} 918. if defined(NO_ROOT) 919 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 920 tar cvf - @${DESTDIR}/${DISTDIR}/${dist}.debug.meta | \ 921 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz 922. else 923 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 924 tar cvLf - usr/lib/debug | \ 925 ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz 926. endif 927.endfor 928 929# 930# reinstall 931# 932# If you have a build server, you can NFS mount the source and obj directories 933# and do a 'make reinstall' on the *client* to install new binaries from the 934# most recent server build. 935# 936reinstall: .MAKE .PHONY 937 @echo "--------------------------------------------------------------" 938 @echo ">>> Making hierarchy" 939 @echo "--------------------------------------------------------------" 940 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 941 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy 942 @echo 943 @echo "--------------------------------------------------------------" 944 @echo ">>> Installing everything" 945 @echo "--------------------------------------------------------------" 946 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 947.if defined(LIBCOMPAT) 948 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install${libcompat} 949.endif 950 951redistribute: .MAKE .PHONY 952 @echo "--------------------------------------------------------------" 953 @echo ">>> Distributing everything" 954 @echo "--------------------------------------------------------------" 955 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 956.if defined(LIBCOMPAT) 957 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute${libcompat} \ 958 DISTRIBUTION=lib${libcompat} 959.endif 960 961distrib-dirs distribution: .MAKE .PHONY 962 ${_+_}cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 963 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET} 964.if make(distribution) 965 ${_+_}cd ${.CURDIR}; ${CROSSENV} PATH=${TMPPATH} \ 966 ${MAKE} -f Makefile.inc1 ${IMAKE_INSTALL} \ 967 METALOG=${METALOG} MK_TESTS=no installconfig 968.endif 969 970# 971# buildkernel and installkernel 972# 973# Which kernels to build and/or install is specified by setting 974# KERNCONF. If not defined a GENERIC kernel is built/installed. 975# Only the existing (depending TARGET) config files are used 976# for building kernels and only the first of these is designated 977# as the one being installed. 978# 979# Note that we have to use TARGET instead of TARGET_ARCH when 980# we're in kernel-land. Since only TARGET_ARCH is (expected) to 981# be set to cross-build, we have to make sure TARGET is set 982# properly. 983 984.if defined(KERNFAST) 985NO_KERNELCLEAN= t 986NO_KERNELCONFIG= t 987NO_KERNELOBJ= t 988# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 989.if !defined(KERNCONF) && ${KERNFAST} != "1" 990KERNCONF=${KERNFAST} 991.endif 992.endif 993.if ${TARGET_ARCH} == "powerpc64" 994KERNCONF?= GENERIC64 995.else 996KERNCONF?= GENERIC 997.endif 998INSTKERNNAME?= kernel 999 1000KERNSRCDIR?= ${.CURDIR}/sys 1001KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 1002KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 1003KERNCONFDIR?= ${KRNLCONFDIR} 1004 1005BUILDKERNELS= 1006INSTALLKERNEL= 1007.if defined(NO_INSTALLKERNEL) 1008# All of the BUILDKERNELS loops start at index 1. 1009BUILDKERNELS+= dummy 1010.endif 1011.for _kernel in ${KERNCONF} 1012.if exists(${KERNCONFDIR}/${_kernel}) 1013BUILDKERNELS+= ${_kernel} 1014.if empty(INSTALLKERNEL) && !defined(NO_INSTALLKERNEL) 1015INSTALLKERNEL= ${_kernel} 1016.endif 1017.endif 1018.endfor 1019 1020${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY 1021 1022# 1023# buildkernel 1024# 1025# Builds all kernels defined by BUILDKERNELS. 1026# 1027buildkernel: .MAKE .PHONY 1028.if empty(BUILDKERNELS:Ndummy) 1029 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 1030 false 1031.endif 1032 @echo 1033.for _kernel in ${BUILDKERNELS:Ndummy} 1034 @echo "--------------------------------------------------------------" 1035 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 1036 @echo "--------------------------------------------------------------" 1037 @echo "===> ${_kernel}" 1038 mkdir -p ${KRNLOBJDIR} 1039.if !defined(NO_KERNELCONFIG) 1040 @echo 1041 @echo "--------------------------------------------------------------" 1042 @echo ">>> stage 1: configuring the kernel" 1043 @echo "--------------------------------------------------------------" 1044 cd ${KRNLCONFDIR}; \ 1045 PATH=${TMPPATH} \ 1046 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 1047 -I '${KERNCONFDIR}' '${KERNCONFDIR}/${_kernel}' 1048.endif 1049.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 1050 @echo 1051 @echo "--------------------------------------------------------------" 1052 @echo ">>> stage 2.1: cleaning up the object tree" 1053 @echo "--------------------------------------------------------------" 1054 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 1055.endif 1056.if !defined(NO_KERNELOBJ) 1057 @echo 1058 @echo "--------------------------------------------------------------" 1059 @echo ">>> stage 2.2: rebuilding the object tree" 1060 @echo "--------------------------------------------------------------" 1061 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 1062.endif 1063 @echo 1064 @echo "--------------------------------------------------------------" 1065 @echo ">>> stage 2.3: build tools" 1066 @echo "--------------------------------------------------------------" 1067 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools 1068 @echo 1069 @echo "--------------------------------------------------------------" 1070 @echo ">>> stage 3.1: building everything" 1071 @echo "--------------------------------------------------------------" 1072 ${_+_}cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 1073 @echo "--------------------------------------------------------------" 1074 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 1075 @echo "--------------------------------------------------------------" 1076.endfor 1077 1078# 1079# installkernel, etc. 1080# 1081# Install the kernel defined by INSTALLKERNEL 1082# 1083installkernel installkernel.debug \ 1084reinstallkernel reinstallkernel.debug: _installcheck_kernel 1085.if !defined(NO_INSTALLKERNEL) 1086.if empty(INSTALLKERNEL) 1087 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1088 false 1089.endif 1090 @echo "--------------------------------------------------------------" 1091 @echo ">>> Installing kernel ${INSTALLKERNEL}" 1092 @echo "--------------------------------------------------------------" 1093 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1094 ${CROSSENV} PATH=${TMPPATH} \ 1095 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 1096.endif 1097.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS) 1098.for _kernel in ${BUILDKERNELS:[2..-1]} 1099 @echo "--------------------------------------------------------------" 1100 @echo ">>> Installing kernel ${_kernel}" 1101 @echo "--------------------------------------------------------------" 1102 cd ${KRNLOBJDIR}/${_kernel}; \ 1103 ${CROSSENV} PATH=${TMPPATH} \ 1104 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME}.${_kernel} ${.TARGET:S/kernel//} 1105.endfor 1106.endif 1107 1108distributekernel distributekernel.debug: 1109.if !defined(NO_INSTALLKERNEL) 1110.if empty(INSTALLKERNEL) 1111 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1112 false 1113.endif 1114 mkdir -p ${DESTDIR}/${DISTDIR} 1115.if defined(NO_ROOT) 1116 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta 1117.endif 1118 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1119 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \ 1120 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \ 1121 DESTDIR=${INSTALL_DDIR}/kernel \ 1122 ${.TARGET:S/distributekernel/install/} 1123.if defined(NO_ROOT) 1124 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \ 1125 ${DESTDIR}/${DISTDIR}/kernel.meta 1126.endif 1127.endif 1128.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS) 1129.for _kernel in ${BUILDKERNELS:[2..-1]} 1130.if defined(NO_ROOT) 1131 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta 1132.endif 1133 cd ${KRNLOBJDIR}/${_kernel}; \ 1134 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \ 1135 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \ 1136 KERNEL=${INSTKERNNAME}.${_kernel} \ 1137 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \ 1138 ${.TARGET:S/distributekernel/install/} 1139.if defined(NO_ROOT) 1140 sed -e 's|^./kernel|.|' \ 1141 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \ 1142 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1143.endif 1144.endfor 1145.endif 1146 1147packagekernel: 1148.if defined(NO_ROOT) 1149.if !defined(NO_INSTALLKERNEL) 1150 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1151 tar cvf - --exclude '*.debug' \ 1152 @${DESTDIR}/${DISTDIR}/kernel.meta | \ 1153 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz 1154.endif 1155 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1156 tar cvf - --include '*/*/*.debug' \ 1157 @${DESTDIR}/${DISTDIR}/kernel.meta | \ 1158 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz 1159.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS) 1160.for _kernel in ${BUILDKERNELS:[2..-1]} 1161 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1162 tar cvf - --exclude '*.debug' \ 1163 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ 1164 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz 1165 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1166 tar cvf - --include '*/*/*.debug' \ 1167 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta | \ 1168 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz 1169.endfor 1170.endif 1171.else 1172.if !defined(NO_INSTALLKERNEL) 1173 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1174 tar cvf - --exclude '*.debug' . | \ 1175 ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz 1176.endif 1177 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1178 tar cvf - --include '*/*/*.debug' $$(eval find .) | \ 1179 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz 1180.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS) 1181.for _kernel in ${BUILDKERNELS:[2..-1]} 1182 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1183 tar cvf - --exclude '*.debug' . | \ 1184 ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz 1185 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1186 tar cvf - --include '*/*/*.debug' $$(eval find .) | \ 1187 ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz 1188.endfor 1189.endif 1190.endif 1191 1192# 1193# 1194# checkworld 1195# 1196# Run test suite on installed world. 1197# 1198checkworld: .PHONY 1199 @if [ ! -x ${LOCALBASE}/bin/kyua ]; then \ 1200 echo "You need kyua (devel/kyua) to run the test suite." | /usr/bin/fmt; \ 1201 exit 1; \ 1202 fi 1203 ${_+_}${LOCALBASE}/bin/kyua test -k ${TESTSBASE}/Kyuafile 1204 1205# 1206# 1207# doxygen 1208# 1209# Build the API documentation with doxygen 1210# 1211doxygen: .PHONY 1212 @if [ ! -x ${LOCALBASE}/bin/doxygen ]; then \ 1213 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 1214 exit 1; \ 1215 fi 1216 ${_+_}cd ${.CURDIR}/tools/kerneldoc/subsys; ${MAKE} obj all 1217 1218# 1219# update 1220# 1221# Update the source tree(s), by running svn/svnup to update to the 1222# latest copy. 1223# 1224update: 1225.if defined(SVN_UPDATE) 1226 @echo "--------------------------------------------------------------" 1227 @echo ">>> Updating ${.CURDIR} using Subversion" 1228 @echo "--------------------------------------------------------------" 1229 @(cd ${.CURDIR}; ${SVN} update ${SVNFLAGS}) 1230.endif 1231 1232# 1233# ------------------------------------------------------------------------ 1234# 1235# From here onwards are utility targets used by the 'make world' and 1236# related targets. If your 'world' breaks, you may like to try to fix 1237# the problem and manually run the following targets to attempt to 1238# complete the build. Beware, this is *not* guaranteed to work, you 1239# need to have a pretty good grip on the current state of the system 1240# to attempt to manually finish it. If in doubt, 'make world' again. 1241# 1242 1243# 1244# legacy: Build compatibility shims for the next three targets. This is a 1245# minimal set of tools and shims necessary to compensate for older systems 1246# which don't have the APIs required by the targets built in bootstrap-tools, 1247# build-tools or cross-tools. 1248# 1249 1250# ELF Tool Chain libraries are needed for ELF tools and dtrace tools. 1251# r296685 fix cross-endian objcopy 1252.if ${BOOTSTRAPPING} < 1100102 1253_elftoolchain_libs= lib/libelf lib/libdwarf 1254.endif 1255 1256legacy: 1257.if ${BOOTSTRAPPING} < 800107 && ${BOOTSTRAPPING} != 0 1258 @echo "ERROR: Source upgrades from versions prior to 8.0 are not supported."; \ 1259 false 1260.endif 1261.for _tool in tools/build ${_elftoolchain_libs} 1262 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,all,install)"; \ 1263 cd ${.CURDIR}/${_tool}; \ 1264 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1265 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 1266 ${MAKE} DIRPRFX=${_tool}/ all; \ 1267 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1268.endfor 1269 1270# 1271# bootstrap-tools: Build tools needed for compatibility. These are binaries that 1272# are built to build other binaries in the system. However, the focus of these 1273# binaries is usually quite narrow. Bootstrap tools use the host's compiler and 1274# libraries, augmented by -legacy. 1275# 1276_bt= _bootstrap-tools 1277 1278.if ${MK_GAMES} != "no" 1279_strfile= usr.bin/fortune/strfile 1280.endif 1281 1282.if ${MK_GCC} != "no" && ${MK_CXX} != "no" 1283_gperf= gnu/usr.bin/gperf 1284.endif 1285 1286.if ${MK_GROFF} != "no" 1287_groff= gnu/usr.bin/groff \ 1288 usr.bin/soelim 1289.endif 1290 1291.if ${MK_VT} != "no" 1292_vtfontcvt= usr.bin/vtfontcvt 1293.endif 1294 1295.if ${BOOTSTRAPPING} < 900002 1296_sed= usr.bin/sed 1297.endif 1298 1299.if ${BOOTSTRAPPING} < 1000033 1300_libopenbsd= lib/libopenbsd 1301_m4= usr.bin/m4 1302_lex= usr.bin/lex 1303 1304${_bt}-usr.bin/m4: ${_bt}-lib/libopenbsd 1305${_bt}-usr.bin/lex: ${_bt}-usr.bin/m4 1306.endif 1307 1308.if ${BOOTSTRAPPING} < 1000026 1309_nmtree= lib/libnetbsd \ 1310 usr.sbin/nmtree 1311 1312${_bt}-usr.sbin/nmtree: ${_bt}-lib/libnetbsd 1313.endif 1314 1315.if ${BOOTSTRAPPING} < 1000027 1316_cat= bin/cat 1317.endif 1318 1319# r264059 support for status= 1320.if ${BOOTSTRAPPING} < 1100017 1321_dd= bin/dd 1322.endif 1323 1324# r277259 crunchide: Correct 64-bit section header offset 1325# r281674 crunchide: always include both 32- and 64-bit ELF support 1326# r285986 crunchen: use STRIPBIN rather than STRIP 1327.if ${BOOTSTRAPPING} < 1100078 1328_crunch= usr.sbin/crunch 1329.endif 1330 1331.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041 1332_awk= usr.bin/awk 1333.endif 1334 1335# r296926 -P keymap search path 1336.if ${BOOTSTRAPPING} < 1100103 1337_kbdcontrol= usr.sbin/kbdcontrol 1338.endif 1339 1340_yacc= lib/liby \ 1341 usr.bin/yacc 1342 1343${_bt}-usr.bin/yacc: ${_bt}-lib/liby 1344 1345.if ${MK_BSNMP} != "no" 1346_gensnmptree= usr.sbin/bsnmpd/gensnmptree 1347.endif 1348 1349# We need to build tblgen when we're building clang either as 1350# the bootstrap compiler, or as the part of the normal build. 1351.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" 1352_clang_tblgen= \ 1353 lib/clang/libllvmsupport \ 1354 lib/clang/libllvmtablegen \ 1355 usr.bin/clang/llvm-tblgen \ 1356 usr.bin/clang/clang-tblgen 1357 1358${_bt}-usr.bin/clang/clang-tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport 1359${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport 1360.endif 1361 1362# Default to building the GPL DTC, but build the BSDL one if users explicitly 1363# request it. 1364_dtc= usr.bin/dtc 1365.if ${MK_GPL_DTC} != "no" 1366_dtc= gnu/usr.bin/dtc 1367.endif 1368 1369.if ${MK_KERBEROS} != "no" 1370_kerberos5_bootstrap_tools= \ 1371 kerberos5/tools/make-roken \ 1372 kerberos5/lib/libroken \ 1373 kerberos5/lib/libvers \ 1374 kerberos5/tools/asn1_compile \ 1375 kerberos5/tools/slc \ 1376 usr.bin/compile_et 1377 1378.ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} 1379.endif 1380 1381# r283777 makewhatis(1) replaced with mandoc version which builds a database. 1382.if ${MK_MANDOCDB} != "no" && ${BOOTSTRAPPING} < 1100075 1383_libopenbsd?= lib/libopenbsd 1384_makewhatis= lib/libsqlite3 \ 1385 usr.bin/mandoc 1386${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd ${_bt}-lib/libsqlite3 1387.endif 1388 1389bootstrap-tools: .PHONY 1390 1391# Please document (add comment) why something is in 'bootstrap-tools'. 1392# Try to bound the building of the bootstrap-tool to just the 1393# FreeBSD versions that need the tool built at this stage of the build. 1394.for _tool in \ 1395 ${_clang_tblgen} \ 1396 ${_kerberos5_bootstrap_tools} \ 1397 ${_strfile} \ 1398 ${_gperf} \ 1399 ${_groff} \ 1400 ${_dtc} \ 1401 ${_awk} \ 1402 ${_cat} \ 1403 ${_dd} \ 1404 ${_kbdcontrol} \ 1405 usr.bin/lorder \ 1406 ${_libopenbsd} \ 1407 ${_makewhatis} \ 1408 usr.bin/rpcgen \ 1409 ${_sed} \ 1410 ${_yacc} \ 1411 ${_m4} \ 1412 ${_lex} \ 1413 usr.bin/xinstall \ 1414 ${_gensnmptree} \ 1415 usr.sbin/config \ 1416 ${_crunch} \ 1417 ${_nmtree} \ 1418 ${_vtfontcvt} \ 1419 usr.bin/localedef 1420${_bt}-${_tool}: .PHONY .MAKE 1421 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 1422 cd ${.CURDIR}/${_tool}; \ 1423 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1424 ${MAKE} DIRPRFX=${_tool}/ all; \ 1425 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1426 1427bootstrap-tools: ${_bt}-${_tool} 1428.endfor 1429 1430# 1431# build-tools: Build special purpose build tools 1432# 1433.if !defined(NO_SHARE) 1434_share= share/syscons/scrnmaps 1435.endif 1436 1437.if ${MK_GCC} != "no" 1438_gcc_tools= gnu/usr.bin/cc/cc_tools 1439.endif 1440 1441.if ${MK_RESCUE} != "no" 1442# rescue includes programs that have build-tools targets 1443_rescue=rescue/rescue 1444.endif 1445 1446.for _tool in \ 1447 bin/csh \ 1448 bin/sh \ 1449 ${LOCAL_TOOL_DIRS} \ 1450 lib/ncurses/ncurses \ 1451 lib/ncurses/ncursesw \ 1452 ${_rescue} \ 1453 ${_share} \ 1454 usr.bin/awk \ 1455 lib/libmagic \ 1456 usr.bin/mkesdb_static \ 1457 usr.bin/mkcsmapper_static \ 1458 usr.bin/vi/catalog 1459build-tools_${_tool}: .PHONY 1460 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 1461 cd ${.CURDIR}/${_tool}; \ 1462 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1463 ${MAKE} DIRPRFX=${_tool}/ build-tools 1464build-tools: build-tools_${_tool} 1465.endfor 1466.for _tool in \ 1467 ${_gcc_tools} 1468build-tools_${_tool}: .PHONY 1469 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all)"; \ 1470 cd ${.CURDIR}/${_tool}; \ 1471 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1472 ${MAKE} DIRPRFX=${_tool}/ all 1473build-tools: build-tools_${_tool} 1474.endfor 1475 1476# 1477# kernel-tools: Build kernel-building tools 1478# 1479kernel-tools: 1480 mkdir -p ${MAKEOBJDIRPREFIX}/usr 1481 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1482 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null 1483 1484# 1485# cross-tools: All the tools needed to build the rest of the system after 1486# we get done with the earlier stages. It is the last set of tools needed 1487# to begin building the target binaries. 1488# 1489.if ${TARGET_ARCH} != ${MACHINE_ARCH} 1490.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 1491_btxld= usr.sbin/btxld 1492.endif 1493.endif 1494 1495# Rebuild ctfconvert and ctfmerge to avoid difficult-to-diagnose failures 1496# resulting from missing bug fixes or ELF Toolchain updates. 1497.if ${MK_CDDL} != "no" 1498_dtrace_tools= cddl/lib/libctf cddl/usr.bin/ctfconvert \ 1499 cddl/usr.bin/ctfmerge 1500.endif 1501 1502# If we're given an XAS, don't build binutils. 1503.if ${XAS:M/*} == "" 1504.if ${MK_BINUTILS_BOOTSTRAP} != "no" 1505_binutils= gnu/usr.bin/binutils 1506.endif 1507.if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" 1508_elftctools= lib/libelftc \ 1509 lib/libpe \ 1510 usr.bin/elfcopy \ 1511 usr.bin/nm \ 1512 usr.bin/size \ 1513 usr.bin/strings 1514# These are not required by the build, but can be useful for developers who 1515# cross-build on a FreeBSD 10 host: 1516_elftctools+= usr.bin/addr2line 1517.endif 1518.elif ${TARGET_ARCH} != ${MACHINE_ARCH} && ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" 1519# If cross-building with an external binutils we still need to build strip for 1520# the target (for at least crunchide). 1521_elftctools= lib/libelftc \ 1522 lib/libpe \ 1523 usr.bin/elfcopy 1524.endif 1525 1526# If an full path to an external cross compiler is given, don't build 1527# a cross compiler. 1528.if ${XCC:N${CCACHE_BIN}:M/*} == "" && ${MK_CROSS_COMPILER} != "no" 1529.if ${MK_CLANG_BOOTSTRAP} != "no" 1530_clang= usr.bin/clang 1531_clang_libs= lib/clang 1532.endif 1533.if ${MK_GCC_BOOTSTRAP} != "no" 1534_cc= gnu/usr.bin/cc 1535.endif 1536.endif 1537.if ${MK_USB} != "no" 1538_usb_tools= sys/boot/usb/tools 1539.endif 1540 1541cross-tools: .MAKE .PHONY 1542.for _tool in \ 1543 ${_clang_libs} \ 1544 ${_clang} \ 1545 ${_binutils} \ 1546 ${_elftctools} \ 1547 ${_dtrace_tools} \ 1548 ${_cc} \ 1549 ${_btxld} \ 1550 ${_crunchide} \ 1551 ${_usb_tools} 1552 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 1553 cd ${.CURDIR}/${_tool}; \ 1554 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1555 ${MAKE} DIRPRFX=${_tool}/ all; \ 1556 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 1557.endfor 1558 1559NXBDESTDIR= ${OBJTREE}/nxb-bin 1560NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \ 1561 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 1562 PATH=${PATH}:${OBJTREE}/gperf_for_gcc/usr/bin 1563NXBMAKE= ${NXBENV} ${MAKE} \ 1564 LLVM_TBLGEN=${NXBDESTDIR}/usr/bin/llvm-tblgen \ 1565 CLANG_TBLGEN=${NXBDESTDIR}/usr/bin/clang-tblgen \ 1566 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \ 1567 MK_GDB=no MK_TESTS=no \ 1568 SSP_CFLAGS= \ 1569 MK_HTML=no NO_LINT=yes MK_MAN=no \ 1570 -DNO_PIC MK_PROFILE=no -DNO_SHARED \ 1571 -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ 1572 MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ 1573 MK_LLDB=no MK_DEBUG_FILES=no 1574 1575# native-xtools is the current target for qemu-user cross builds of ports 1576# via poudriere and the imgact_binmisc kernel module. 1577# For non-clang enabled targets that are still using the in tree gcc 1578# we must build a gperf binary for one instance of its Makefiles. On 1579# clang-enabled systems, the gperf binary is obsolete. 1580native-xtools: .PHONY 1581.if ${MK_GCC_BOOTSTRAP} != "no" 1582 mkdir -p ${OBJTREE}/gperf_for_gcc/usr/bin 1583 ${_+_}@${ECHODIR} "===> ${_gperf} (obj,all,install)"; \ 1584 cd ${.CURDIR}/${_gperf}; \ 1585 ${NXBMAKE} DIRPRFX=${_gperf}/ obj; \ 1586 ${NXBMAKE} DIRPRFX=${_gperf}/ all; \ 1587 ${NXBMAKE} DIRPRFX=${_gperf}/ DESTDIR=${OBJTREE}/gperf_for_gcc install 1588.endif 1589 mkdir -p ${NXBDESTDIR}/bin ${NXBDESTDIR}/sbin ${NXBDESTDIR}/usr 1590 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1591 -p ${NXBDESTDIR}/usr >/dev/null 1592 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1593 -p ${NXBDESTDIR}/usr/include >/dev/null 1594.if ${MK_DEBUG_FILES} != "no" 1595 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ 1596 -p ${NXBDESTDIR}/usr/lib >/dev/null 1597.endif 1598.for _tool in \ 1599 bin/cat \ 1600 bin/chmod \ 1601 bin/cp \ 1602 bin/csh \ 1603 bin/echo \ 1604 bin/expr \ 1605 bin/hostname \ 1606 bin/ln \ 1607 bin/ls \ 1608 bin/mkdir \ 1609 bin/mv \ 1610 bin/ps \ 1611 bin/realpath \ 1612 bin/rm \ 1613 bin/rmdir \ 1614 bin/sh \ 1615 bin/sleep \ 1616 ${_clang_tblgen} \ 1617 usr.bin/ar \ 1618 ${_binutils} \ 1619 ${_elftctools} \ 1620 ${_cc} \ 1621 ${_gcc_tools} \ 1622 ${_clang_libs} \ 1623 ${_clang} \ 1624 sbin/md5 \ 1625 sbin/sysctl \ 1626 gnu/usr.bin/diff \ 1627 usr.bin/awk \ 1628 usr.bin/basename \ 1629 usr.bin/bmake \ 1630 usr.bin/bzip2 \ 1631 usr.bin/cmp \ 1632 usr.bin/dirname \ 1633 usr.bin/env \ 1634 usr.bin/fetch \ 1635 usr.bin/find \ 1636 usr.bin/grep \ 1637 usr.bin/gzip \ 1638 usr.bin/id \ 1639 usr.bin/lex \ 1640 usr.bin/lorder \ 1641 usr.bin/mktemp \ 1642 usr.bin/mt \ 1643 usr.bin/patch \ 1644 usr.bin/sed \ 1645 usr.bin/sort \ 1646 usr.bin/tar \ 1647 usr.bin/touch \ 1648 usr.bin/tr \ 1649 usr.bin/true \ 1650 usr.bin/uniq \ 1651 usr.bin/unzip \ 1652 usr.bin/xargs \ 1653 usr.bin/xinstall \ 1654 usr.bin/xz \ 1655 usr.bin/yacc \ 1656 usr.sbin/chown 1657 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 1658 cd ${.CURDIR}/${_tool}; \ 1659 ${NXBMAKE} DIRPRFX=${_tool}/ obj; \ 1660 ${NXBMAKE} DIRPRFX=${_tool}/ all; \ 1661 ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${NXBDESTDIR} install 1662.endfor 1663 1664# 1665# hierarchy - ensure that all the needed directories are present 1666# 1667hierarchy hier: .MAKE .PHONY 1668 ${_+_}cd ${.CURDIR}/etc; ${HMAKE} distrib-dirs 1669 1670# 1671# libraries - build all libraries, and install them under ${DESTDIR}. 1672# 1673# The list of libraries with dependents (${_prebuild_libs}) and their 1674# interdependencies (__L) are built automatically by the 1675# ${.CURDIR}/tools/make_libdeps.sh script. 1676# 1677libraries: .MAKE .PHONY 1678 ${_+_}cd ${.CURDIR}; \ 1679 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 1680 ${MAKE} -f Makefile.inc1 _startup_libs; \ 1681 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 1682 ${MAKE} -f Makefile.inc1 _generic_libs 1683 1684# 1685# static libgcc.a prerequisite for shared libc 1686# 1687_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt 1688 1689# These dependencies are not automatically generated: 1690# 1691# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 1692# all shared libraries for ELF. 1693# 1694_startup_libs= gnu/lib/csu 1695_startup_libs+= lib/csu 1696_startup_libs+= gnu/lib/libgcc 1697_startup_libs+= lib/libcompiler_rt 1698_startup_libs+= lib/libc 1699_startup_libs+= lib/libc_nonshared 1700.if ${MK_LIBCPLUSPLUS} != "no" 1701_startup_libs+= lib/libcxxrt 1702.endif 1703 1704gnu/lib/libgcc__L: lib/libc__L 1705gnu/lib/libgcc__L: lib/libc_nonshared__L 1706.if ${MK_LIBCPLUSPLUS} != "no" 1707lib/libcxxrt__L: gnu/lib/libgcc__L 1708.endif 1709 1710_prebuild_libs= ${_kerberos5_lib_libasn1} \ 1711 ${_kerberos5_lib_libhdb} \ 1712 ${_kerberos5_lib_libheimbase} \ 1713 ${_kerberos5_lib_libheimntlm} \ 1714 ${_libsqlite3} \ 1715 ${_kerberos5_lib_libheimipcc} \ 1716 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 1717 ${_kerberos5_lib_libroken} \ 1718 ${_kerberos5_lib_libwind} \ 1719 lib/libbz2 ${_libcom_err} lib/libcrypt \ 1720 lib/libelf lib/libexpat \ 1721 lib/libfigpar \ 1722 ${_lib_libgssapi} \ 1723 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \ 1724 ${_lib_casper} \ 1725 lib/ncurses/ncurses lib/ncurses/ncursesw \ 1726 lib/libopie lib/libpam/libpam ${_lib_libthr} \ 1727 ${_lib_libradius} lib/libsbuf lib/libtacplus \ 1728 lib/libgeom \ 1729 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ 1730 ${_cddl_lib_libuutil} \ 1731 ${_cddl_lib_libavl} \ 1732 ${_cddl_lib_libzfs_core} \ 1733 ${_cddl_lib_libctf} \ 1734 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \ 1735 ${_secure_lib_libcrypto} ${_lib_libldns} \ 1736 ${_secure_lib_libssh} ${_secure_lib_libssl} \ 1737 gnu/lib/libdialog 1738 1739.if ${MK_GNUCXX} != "no" 1740_prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++ 1741gnu/lib/libstdc++__L: lib/msun__L 1742gnu/lib/libsupc++__L: gnu/lib/libstdc++__L 1743.endif 1744 1745.if ${MK_LIBCPLUSPLUS} != "no" 1746_prebuild_libs+= lib/libc++ 1747.endif 1748 1749lib/libgeom__L: lib/libexpat__L 1750lib/libkvm__L: lib/libelf__L 1751 1752.if ${MK_LIBTHR} != "no" 1753_lib_libthr= lib/libthr 1754.endif 1755 1756.if ${MK_RADIUS_SUPPORT} != "no" 1757_lib_libradius= lib/libradius 1758.endif 1759 1760.if ${MK_OFED} != "no" 1761_ofed_lib= contrib/ofed/usr.lib 1762_prebuild_libs+= contrib/ofed/usr.lib/libosmcomp 1763_prebuild_libs+= contrib/ofed/usr.lib/libopensm 1764_prebuild_libs+= contrib/ofed/usr.lib/libibcommon 1765_prebuild_libs+= contrib/ofed/usr.lib/libibverbs 1766_prebuild_libs+= contrib/ofed/usr.lib/libibumad 1767 1768contrib/ofed/usr.lib/libopensm__L: lib/libthr__L 1769contrib/ofed/usr.lib/libosmcomp__L: lib/libthr__L 1770contrib/ofed/usr.lib/libibumad__L: contrib/ofed/usr.lib/libibcommon__L 1771.endif 1772 1773.if ${MK_CASPER} != "no" 1774_lib_casper= lib/libcasper 1775.endif 1776 1777lib/libpjdlog__L: lib/libutil__L 1778lib/libcasper__L: lib/libnv__L 1779lib/liblzma__L: lib/libthr__L 1780 1781_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} 1782.for _DIR in ${LOCAL_LIB_DIRS} 1783.if exists(${.CURDIR}/${_DIR}/Makefile) && empty(_generic_libs:M${_DIR}) 1784_generic_libs+= ${_DIR} 1785.endif 1786.endfor 1787 1788lib/libopie__L lib/libtacplus__L: lib/libmd__L 1789 1790.if ${MK_CDDL} != "no" 1791_cddl_lib_libumem= cddl/lib/libumem 1792_cddl_lib_libnvpair= cddl/lib/libnvpair 1793_cddl_lib_libavl= cddl/lib/libavl 1794_cddl_lib_libuutil= cddl/lib/libuutil 1795_cddl_lib_libzfs_core= cddl/lib/libzfs_core 1796_cddl_lib_libctf= cddl/lib/libctf 1797_cddl_lib= cddl/lib 1798cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L 1799cddl/lib/libzfs__L: lib/libgeom__L 1800cddl/lib/libctf__L: lib/libz__L 1801.endif 1802# cddl/lib/libdtrace requires lib/libproc and lib/librtld_db; it's only built 1803# on select architectures though (see cddl/lib/Makefile) 1804.if ${MACHINE_CPUARCH} != "sparc64" 1805_prebuild_libs+= lib/libproc lib/librtld_db 1806.endif 1807 1808.if ${MK_CRYPT} != "no" 1809.if ${MK_OPENSSL} != "no" 1810_secure_lib_libcrypto= secure/lib/libcrypto 1811_secure_lib_libssl= secure/lib/libssl 1812lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 1813.if ${MK_LDNS} != "no" 1814_lib_libldns= lib/libldns 1815lib/libldns__L: secure/lib/libcrypto__L 1816.endif 1817.if ${MK_OPENSSH} != "no" 1818_secure_lib_libssh= secure/lib/libssh 1819secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 1820.if ${MK_LDNS} != "no" 1821secure/lib/libssh__L: lib/libldns__L 1822.endif 1823.if ${MK_KERBEROS_SUPPORT} != "no" 1824secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 1825 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 1826 lib/libmd__L kerberos5/lib/libroken__L 1827.endif 1828.endif 1829.endif 1830_secure_lib= secure/lib 1831.endif 1832 1833.if ${MK_KERBEROS} != "no" 1834kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L 1835kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1836 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ 1837 kerberos5/lib/libwind__L lib/libsqlite3__L 1838kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ 1839 kerberos5/lib/libroken__L lib/libcom_err__L 1840kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1841 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L 1842kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1843 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ 1844 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ 1845 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L 1846kerberos5/lib/libroken__L: lib/libcrypt__L 1847kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L 1848kerberos5/lib/libheimbase__L: lib/libthr__L 1849kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L 1850.endif 1851 1852lib/libsqlite3__L: lib/libthr__L 1853 1854.if ${MK_GSSAPI} != "no" 1855_lib_libgssapi= lib/libgssapi 1856.endif 1857 1858.if ${MK_KERBEROS} != "no" 1859_kerberos5_lib= kerberos5/lib 1860_kerberos5_lib_libasn1= kerberos5/lib/libasn1 1861_kerberos5_lib_libhdb= kerberos5/lib/libhdb 1862_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase 1863_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 1864_kerberos5_lib_libhx509= kerberos5/lib/libhx509 1865_kerberos5_lib_libroken= kerberos5/lib/libroken 1866_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 1867_libsqlite3= lib/libsqlite3 1868_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc 1869_kerberos5_lib_libwind= kerberos5/lib/libwind 1870_libcom_err= lib/libcom_err 1871.endif 1872 1873.if ${MK_NIS} != "no" 1874_lib_libypclnt= lib/libypclnt 1875.endif 1876 1877.if ${MK_OPENSSL} == "no" 1878lib/libradius__L: lib/libmd__L 1879.endif 1880 1881lib/libproc__L: \ 1882 ${_cddl_lib_libctf:D${_cddl_lib_libctf}__L} lib/libelf__L lib/librtld_db__L lib/libutil__L 1883.if ${MK_CXX} != "no" 1884.if ${MK_LIBCPLUSPLUS} != "no" 1885lib/libproc__L: lib/libcxxrt__L 1886.else # This implies MK_GNUCXX != "no"; see lib/libproc 1887lib/libproc__L: gnu/lib/libsupc++__L 1888.endif 1889.endif 1890 1891gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L 1892 1893.for _lib in ${_prereq_libs} 1894${_lib}__PL: .PHONY .MAKE 1895.if exists(${.CURDIR}/${_lib}) 1896 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 1897 cd ${.CURDIR}/${_lib}; \ 1898 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; \ 1899 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \ 1900 DIRPRFX=${_lib}/ all; \ 1901 ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \ 1902 DIRPRFX=${_lib}/ install 1903.endif 1904.endfor 1905 1906.for _lib in ${_startup_libs} ${_prebuild_libs} ${_generic_libs} 1907${_lib}__L: .PHONY .MAKE 1908.if exists(${.CURDIR}/${_lib}) 1909 ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ 1910 cd ${.CURDIR}/${_lib}; \ 1911 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; \ 1912 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all; \ 1913 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install 1914.endif 1915.endfor 1916 1917_prereq_libs: ${_prereq_libs:S/$/__PL/} 1918_startup_libs: ${_startup_libs:S/$/__L/} 1919_prebuild_libs: ${_prebuild_libs:S/$/__L/} 1920_generic_libs: ${_generic_libs:S/$/__L/} 1921 1922# Enable SUBDIR_PARALLEL when not calling 'make all', unless called from 1923# 'everything' with _PARALLEL_SUBDIR_OK set. This is because it is unlikely 1924# that running 'make all' from the top-level, especially with a SUBDIR_OVERRIDE 1925# or LOCAL_DIRS set, will have a reliable build if SUBDIRs are built in 1926# parallel. This is safe for the world stage of buildworld though since it has 1927# already built libraries in a proper order and installed includes into 1928# WORLDTMP. Special handling is done for SUBDIR ordering for 'install*' to 1929# avoid trashing a system if it crashes mid-install. 1930.if !make(all) || defined(_PARALLEL_SUBDIR_OK) 1931SUBDIR_PARALLEL= 1932.endif 1933 1934.include <bsd.subdir.mk> 1935 1936.if make(check-old) || make(check-old-dirs) || \ 1937 make(check-old-files) || make(check-old-libs) || \ 1938 make(delete-old) || make(delete-old-dirs) || \ 1939 make(delete-old-files) || make(delete-old-libs) 1940 1941# 1942# check for / delete old files section 1943# 1944 1945.include "ObsoleteFiles.inc" 1946 1947OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 1948else you can not start such an application. Consult UPDATING for more \ 1949information regarding how to cope with the removal/revision bump of a \ 1950specific library." 1951 1952.if !defined(BATCH_DELETE_OLD_FILES) 1953RM_I=-i 1954.else 1955RM_I=-v 1956.endif 1957 1958delete-old-files: 1959 @echo ">>> Removing old files (only deletes safe to delete libs)" 1960# Ask for every old file if the user really wants to remove it. 1961# It's annoying, but better safe than sorry. 1962# NB: We cannot pass the list of OLD_FILES as a parameter because the 1963# argument list will get too long. Using .for/.endfor make "loops" will make 1964# the Makefile parser segfault. 1965 @exec 3<&0; \ 1966 cd ${.CURDIR}; \ 1967 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1968 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1969 while read file; do \ 1970 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1971 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1972 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1973 fi; \ 1974 for ext in debug symbols; do \ 1975 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 1976 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 1977 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 1978 <&3; \ 1979 fi; \ 1980 done; \ 1981 done 1982# Remove catpages without corresponding manpages. 1983 @exec 3<&0; \ 1984 find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1985 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1986 while read catpage; do \ 1987 read manpage; \ 1988 if [ ! -e "$${manpage}" ]; then \ 1989 rm ${RM_I} $${catpage} <&3; \ 1990 fi; \ 1991 done 1992 @echo ">>> Old files removed" 1993 1994check-old-files: 1995 @echo ">>> Checking for old files" 1996 @cd ${.CURDIR}; \ 1997 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1998 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1999 while read file; do \ 2000 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 2001 echo "${DESTDIR}/$${file}"; \ 2002 fi; \ 2003 for ext in debug symbols; do \ 2004 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2005 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 2006 fi; \ 2007 done; \ 2008 done 2009# Check for catpages without corresponding manpages. 2010 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 2011 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 2012 while read catpage; do \ 2013 read manpage; \ 2014 if [ ! -e "$${manpage}" ]; then \ 2015 echo $${catpage}; \ 2016 fi; \ 2017 done 2018 2019delete-old-libs: 2020 @echo ">>> Removing old libraries" 2021 @echo "${OLD_LIBS_MESSAGE}" | fmt 2022 @exec 3<&0; \ 2023 cd ${.CURDIR}; \ 2024 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2025 -V OLD_LIBS | xargs -n1 | \ 2026 while read file; do \ 2027 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 2028 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 2029 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 2030 fi; \ 2031 for ext in debug symbols; do \ 2032 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ 2033 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2034 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ 2035 <&3; \ 2036 fi; \ 2037 done; \ 2038 done 2039 @echo ">>> Old libraries removed" 2040 2041check-old-libs: 2042 @echo ">>> Checking for old libraries" 2043 @cd ${.CURDIR}; \ 2044 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2045 -V OLD_LIBS | xargs -n1 | \ 2046 while read file; do \ 2047 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 2048 echo "${DESTDIR}/$${file}"; \ 2049 fi; \ 2050 for ext in debug symbols; do \ 2051 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ 2052 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ 2053 fi; \ 2054 done; \ 2055 done 2056 2057delete-old-dirs: 2058 @echo ">>> Removing old directories" 2059 @cd ${.CURDIR}; \ 2060 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2061 -V OLD_DIRS | xargs -n1 | sort -r | \ 2062 while read dir; do \ 2063 if [ -d "${DESTDIR}/$${dir}" ]; then \ 2064 rmdir -v "${DESTDIR}/$${dir}" || true; \ 2065 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 2066 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 2067 fi; \ 2068 done 2069 @echo ">>> Old directories removed" 2070 2071check-old-dirs: 2072 @echo ">>> Checking for old directories" 2073 @cd ${.CURDIR}; \ 2074 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 2075 -V OLD_DIRS | xargs -n1 | \ 2076 while read dir; do \ 2077 if [ -d "${DESTDIR}/$${dir}" ]; then \ 2078 echo "${DESTDIR}/$${dir}"; \ 2079 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 2080 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 2081 fi; \ 2082 done 2083 2084delete-old: delete-old-files delete-old-dirs 2085 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 2086 2087check-old: check-old-files check-old-libs check-old-dirs 2088 @echo "To remove old files and directories run '${MAKE} delete-old'." 2089 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 2090 2091.endif 2092 2093# 2094# showconfig - show build configuration. 2095# 2096showconfig: 2097 @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1; \ 2098 ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1) 2>&1 | grep ^MK_ | sort -u 2099 2100.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 2101DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 2102 2103.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 2104.if exists(${KERNCONFDIR}/${KERNCONF}) 2105FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 2106 '${KERNCONFDIR}/${KERNCONF}' ; echo 2107.endif 2108.endif 2109 2110.endif 2111 2112.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 2113DTBOUTPUTPATH= ${.CURDIR} 2114.endif 2115 2116# 2117# Build 'standalone' Device Tree Blob 2118# 2119builddtb: 2120 @PATH=${TMPPATH} MACHINE=${TARGET} \ 2121 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \ 2122 "${FDT_DTS_FILE}" ${DTBOUTPUTPATH} 2123 2124############### 2125 2126# cleanworld 2127# In the following, the first 'rm' in a series will usually remove all 2128# files and directories. If it does not, then there are probably some 2129# files with file flags set, so this unsets them and tries the 'rm' a 2130# second time. There are situations where this target will be cleaning 2131# some directories via more than one method, but that duplication is 2132# needed to correctly handle all the possible situations. Removing all 2133# files without file flags set in the first 'rm' instance saves time, 2134# because 'chflags' will need to operate on fewer files afterwards. 2135# 2136# It is expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be 2137# created by bsd.obj.mk, except that we don't want to .include that file 2138# in this makefile. 2139# 2140BW_CANONICALOBJDIR:=${OBJTREE}${.CURDIR} 2141cleanworld: .PHONY 2142.if exists(${BW_CANONICALOBJDIR}/) 2143 -rm -rf ${BW_CANONICALOBJDIR}/* 2144 -chflags -R 0 ${BW_CANONICALOBJDIR} 2145 rm -rf ${BW_CANONICALOBJDIR}/* 2146.endif 2147.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} 2148 # To be safe in this case, fall back to a 'make cleandir' 2149 ${_+_}@cd ${.CURDIR}; ${MAKE} cleandir 2150.endif 2151 2152.if defined(TARGET) && defined(TARGET_ARCH) 2153 2154.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH} 2155XDEV_CPUTYPE?=${CPUTYPE} 2156.else 2157XDEV_CPUTYPE?=${TARGET_CPUTYPE} 2158.endif 2159 2160NOFUN=-DNO_FSCHG MK_HTML=no -DNO_LINT \ 2161 MK_MAN=no MK_NLS=no MK_PROFILE=no \ 2162 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no MK_WARNS=no \ 2163 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 2164 CPUTYPE=${XDEV_CPUTYPE} 2165 2166XDDIR=${TARGET_ARCH}-freebsd 2167XDTP?=/usr/${XDDIR} 2168.if ${XDTP:N/*} 2169.error XDTP variable should be an absolute path 2170.endif 2171 2172CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ 2173 INSTALL="sh ${.CURDIR}/tools/install.sh" 2174CDENV= ${CDBENV} \ 2175 TOOLS_PREFIX=${XDTP} 2176CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \ 2177 --sysroot=${XDDESTDIR}/ -B${XDDESTDIR}/usr/libexec \ 2178 -B${XDDESTDIR}/usr/bin -B${XDDESTDIR}/usr/lib 2179CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CXX="${CXX} ${CD2CFLAGS}" \ 2180 CPP="${CPP} ${CD2CFLAGS}" \ 2181 MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} 2182 2183CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp 2184CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 2185CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN} 2186XDDESTDIR=${DESTDIR}/${XDTP} 2187.if !defined(OSREL) 2188OSREL!= uname -r | sed -e 's/[-(].*//' 2189.endif 2190 2191.ORDER: xdev-build xdev-install xdev-links 2192xdev: xdev-build xdev-install 2193 2194.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 2195xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 2196 2197_xb-worldtmp: .PHONY 2198 mkdir -p ${CDTMP}/usr 2199 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 2200 -p ${CDTMP}/usr >/dev/null 2201 2202_xb-bootstrap-tools: .PHONY 2203.for _tool in \ 2204 ${_clang_tblgen} \ 2205 ${_gperf} 2206 ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ 2207 cd ${.CURDIR}/${_tool}; \ 2208 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 2209 ${CDMAKE} DIRPRFX=${_tool}/ all; \ 2210 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install 2211.endfor 2212 2213_xb-build-tools: .PHONY 2214 ${_+_}@cd ${.CURDIR}; \ 2215 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools 2216 2217_xb-cross-tools: .PHONY 2218.for _tool in \ 2219 ${_binutils} \ 2220 ${_elftctools} \ 2221 usr.bin/ar \ 2222 ${_clang_libs} \ 2223 ${_clang} \ 2224 ${_cc} 2225 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,all)"; \ 2226 cd ${.CURDIR}/${_tool}; \ 2227 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 2228 ${CDMAKE} DIRPRFX=${_tool}/ all 2229.endfor 2230 2231_xi-mtree: .PHONY 2232 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 2233 mkdir -p ${XDDESTDIR} 2234 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 2235 -p ${XDDESTDIR} >/dev/null 2236 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 2237 -p ${XDDESTDIR}/usr >/dev/null 2238 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 2239 -p ${XDDESTDIR}/usr/include >/dev/null 2240.if defined(LIBCOMPAT) 2241 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \ 2242 -p ${XDDESTDIR}/usr >/dev/null 2243.endif 2244.if ${MK_TESTS} != "no" 2245 mkdir -p ${XDDESTDIR}${TESTSBASE} 2246 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ 2247 -p ${XDDESTDIR}${TESTSBASE} >/dev/null 2248.endif 2249 2250.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries 2251xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries 2252 2253_xi-cross-tools: .PHONY 2254 @echo "_xi-cross-tools" 2255.for _tool in \ 2256 ${_binutils} \ 2257 ${_elftctools} \ 2258 usr.bin/ar \ 2259 ${_clang_libs} \ 2260 ${_clang} \ 2261 ${_cc} 2262 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 2263 cd ${.CURDIR}/${_tool}; \ 2264 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 2265.endfor 2266 2267_xi-includes: .PHONY 2268 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 includes \ 2269 DESTDIR=${XDDESTDIR} 2270 2271_xi-libraries: .PHONY 2272 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 2273 DESTDIR=${XDDESTDIR} 2274 2275xdev-links: .PHONY 2276 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 2277 mkdir -p ../../../../usr/bin; \ 2278 for i in *; do \ 2279 ln -sf ../../${XDTP}/usr/bin/$$i \ 2280 ../../../../usr/bin/${XDDIR}-$$i; \ 2281 ln -sf ../../${XDTP}/usr/bin/$$i \ 2282 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ 2283 done 2284.else 2285xdev xdev-build xdev-install xdev-links: 2286 @echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target" 2287.endif
|