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,DEPEND,OBJ} 11# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 12# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 13# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel 14# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel 15# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 16# -DNO_ROOT install without using root privilege 17# -DNO_DOCUPDATE do not update doc in ${MAKE} update 18# -DNO_CTF do not run the DTrace CTF conversion tools on built objects 19# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR 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:/bin/sh) 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 33# 34# The intended user-driven targets are: 35# buildworld - rebuild *everything*, including glue to help do upgrades 36# installworld- install everything built by "buildworld" 37# doxygen - build API documentation of the kernel 38# update - convenient way to update your source tree (eg: svn/svnup) 39# 40# Standard targets (not defined here) are documented in the makefiles in 41# /usr/share/mk. These include: 42# obj depend all install clean cleandepend cleanobj 43 44.if !defined(TARGET) || !defined(TARGET_ARCH) 45.error "Both TARGET and TARGET_ARCH must be defined." 46.endif 47 48.include <bsd.own.mk> 49.include <bsd.arch.inc.mk> 50.include <bsd.compiler.mk> 51 52# We must do share/info early so that installation of info `dir' 53# entries works correctly. Do it first since it is less likely to 54# grow dependencies on include and lib than vice versa. 55# 56# We must do lib/ and libexec/ before bin/, because if installworld 57# installs a new /bin/sh, the 'make' command will *immediately* 58# use that new version. And the new (dynamically-linked) /bin/sh 59# will expect to find appropriate libraries in /lib and /libexec. 60# 61.if defined(SUBDIR_OVERRIDE) 62SUBDIR= ${SUBDIR_OVERRIDE} 63.else 64SUBDIR= share/info lib libexec 65SUBDIR+=bin 66.if ${MK_GAMES} != "no" 67SUBDIR+=games 68.endif 69.if ${MK_CDDL} != "no" 70SUBDIR+=cddl 71.endif 72SUBDIR+=gnu include 73.if ${MK_KERBEROS} != "no" 74SUBDIR+=kerberos5 75.endif 76.if ${MK_RESCUE} != "no" 77SUBDIR+=rescue 78.endif 79SUBDIR+=sbin 80.if ${MK_CRYPT} != "no" 81SUBDIR+=secure 82.endif 83.if !defined(NO_SHARE) 84SUBDIR+=share 85.endif 86SUBDIR+=sys usr.bin usr.sbin 87.if ${MK_OFED} != "no" 88SUBDIR+=contrib/ofed 89.endif 90# 91# We must do etc/ last for install/distribute to work. 92# 93SUBDIR+=etc 94 95# These are last, since it is nice to at least get the base system 96# rebuilt before you do them. 97.for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS} 98.if exists(${.CURDIR}/${_DIR}/Makefile) 99SUBDIR+= ${_DIR} 100.endif 101.endfor 102.endif 103 104.if defined(NOCLEAN) 105NO_CLEAN= ${NOCLEAN} 106.endif 107.if defined(NO_CLEANDIR) 108CLEANDIR= clean cleandepend 109.else 110CLEANDIR= cleandir 111.endif 112 113LOCAL_TOOL_DIRS?= 114 115BUILDENV_SHELL?=/bin/sh 116 117SVN?= /usr/local/bin/svn 118SVNFLAGS?= -r HEAD 119 120MAKEOBJDIRPREFIX?= /usr/obj 121.if !defined(OSRELDATE) 122.if exists(/usr/include/osreldate.h) 123OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 124 /usr/include/osreldate.h 125.else 126OSRELDATE= 0 127.endif 128.endif 129 130.if !defined(VERSION) 131VERSION!= uname -srp 132VERSION+= ${OSRELDATE} 133.endif 134 135KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6eb/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64 136.if ${TARGET} == ${TARGET_ARCH} 137_t= ${TARGET} 138.else 139_t= ${TARGET_ARCH}/${TARGET} 140.endif 141.for _t in ${_t} 142.if empty(KNOWN_ARCHES:M${_t}) 143.error Unknown target ${TARGET_ARCH}:${TARGET}. 144.endif 145.endfor 146 147.if ${TARGET} == ${MACHINE} 148TARGET_CPUTYPE?=${CPUTYPE} 149.else 150TARGET_CPUTYPE?= 151.endif 152 153.if !empty(TARGET_CPUTYPE) 154_TARGET_CPUTYPE=${TARGET_CPUTYPE} 155.else 156_TARGET_CPUTYPE=dummy 157.endif 158_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ 159 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE 160.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 161.error CPUTYPE global should be set with ?=. 162.endif 163.if make(buildworld) 164BUILD_ARCH!= uname -p 165.if ${MACHINE_ARCH} != ${BUILD_ARCH} 166.error To cross-build, set TARGET_ARCH. 167.endif 168.endif 169.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING) 170OBJTREE= ${MAKEOBJDIRPREFIX} 171.else 172OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} 173.endif 174WORLDTMP= ${OBJTREE}${.CURDIR}/tmp 175# /usr/games added for fortune which depend on strfile 176BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games:${WORLDTMP}/legacy/bin 177XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games 178STRICTTMPPATH= ${BPATH}:${XPATH} 179TMPPATH= ${STRICTTMPPATH}:${PATH} 180 181# 182# Avoid running mktemp(1) unless actually needed. 183# It may not be functional, e.g., due to new ABI 184# when in the middle of installing over this system. 185# 186.if make(distributeworld) || make(installworld) 187INSTALLTMP!= /usr/bin/mktemp -d -u -t install 188.endif 189 190# 191# Building a world goes through the following stages 192# 193# 1. legacy stage [BMAKE] 194# This stage is responsible for creating compatibility 195# shims that are needed by the bootstrap-tools, 196# build-tools and cross-tools stages. 197# 1. bootstrap-tools stage [BMAKE] 198# This stage is responsible for creating programs that 199# are needed for backward compatibility reasons. They 200# are not built as cross-tools. 201# 2. build-tools stage [TMAKE] 202# This stage is responsible for creating the object 203# tree and building any tools that are needed during 204# the build process. 205# 3. cross-tools stage [XMAKE] 206# This stage is responsible for creating any tools that 207# are needed for cross-builds. A cross-compiler is one 208# of them. 209# 4. world stage [WMAKE] 210# This stage actually builds the world. 211# 5. install stage (optional) [IMAKE] 212# This stage installs a previously built world. 213# 214 215BOOTSTRAPPING?= 0 216 217# Common environment for world related stages 218CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ 219 MACHINE_ARCH=${TARGET_ARCH} \ 220 MACHINE=${TARGET} \ 221 CPUTYPE=${TARGET_CPUTYPE} 222.if ${MK_GROFF} != "no" 223CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 224 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 225 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 226.endif 227 228# bootstrap-tools stage 229BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 230 PATH=${BPATH}:${PATH} \ 231 WORLDTMP=${WORLDTMP} \ 232 VERSION="${VERSION}" \ 233 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ 234 COMPILER_TYPE=${COMPILER_TYPE} 235BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 236 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 237 DESTDIR= \ 238 BOOTSTRAPPING=${OSRELDATE} \ 239 SSP_CFLAGS= \ 240 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ 241 -DNO_PIC -DNO_PROFILE -DNO_SHARED \ 242 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD 243 244# build-tools stage 245TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 246 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 247 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 248 DESTDIR= \ 249 BOOTSTRAPPING=${OSRELDATE} \ 250 SSP_CFLAGS= \ 251 -DNO_LINT \ 252 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD 253 254# cross-tools stage 255XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ 256 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 257 -DWITHOUT_GDB 258 259# world stage 260WMAKEENV= ${CROSSENV} \ 261 _SHLIBDIRPREFIX=${WORLDTMP} \ 262 _LDSCRIPTROOT= \ 263 VERSION="${VERSION}" \ 264 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 265 PATH=${TMPPATH} 266.if ${MK_CDDL} == "no" 267WMAKEENV+= NO_CTF=1 268.endif 269 270.if defined(CROSS_TOOLCHAIN_PREFIX) 271CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 272CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 273.endif 274XCOMPILERS= CC CXX CPP 275.for COMPILER in ${XCOMPILERS} 276.if defined(CROSS_COMPILER_PREFIX) 277X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}} 278.else 279X${COMPILER}?= ${${COMPILER}} 280.endif 281.endfor 282XBINUTILS= AS AR LD NM OBJDUMP RANLIB STRINGS 283.for BINUTIL in ${XBINUTILS} 284.if defined(CROSS_BINUTILS_PREFIX) 285X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}} 286.else 287X${BINUTIL}?= ${${BINUTIL}} 288.endif 289.endfor 290WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \ 291 CPP="${XCPP} ${XFLAGS}" \ 292 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ 293 OBJDUMP=${XOBJDUMP} RANLIB=${XRANLIB} STRINGS=${XSTRINGS} 294 295.if ${XCC:T:Mgcc} == "gcc" 296WMAKE_COMPILER_TYPE= gcc 297.elif ${XCC:T:Mclang} == "clang" 298WMAKE_COMPILER_TYPE= clang 299.elif ${MK_CLANG_IS_CC} == "no" 300WMAKE_COMPILER_TYPE= gcc 301.else 302WMAKE_COMPILER_TYPE= clang 303.endif 304IMAKE_COMPILER_TYPE= COMPILER_TYPE=${WMAKE_COMPILER_TYPE} 305 306.if ${XCC:M/*} 307XFLAGS= --sysroot=${WORLDTMP} 308.if defined(CROSS_BINUTILS_PREFIX) 309# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a 310# directory, but the compiler will look in the right place for it's 311# tools so we don't need to tell it where to look. 312.if exists(${CROSS_BINUTILS_PREFIX}) 313XFLAGS+= -B${CROSS_BINUTILS_PREFIX} 314.endif 315.else 316XFLAGS+= -B${WORLDTMP}/usr/bin 317.endif 318.if ${TARGET_ARCH} != ${MACHINE_ARCH} && ${WMAKE_COMPILER_TYPE} == "clang" 319.if (${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "armv6") && \ 320${MK_ARM_EABI} != "no" 321TARGET_ABI= gnueabi 322.else 323TARGET_ABI= unknown 324.endif 325TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.0 326XFLAGS+= -target ${TARGET_TRIPLE} 327.endif 328.endif 329 330WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE} 331WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP} 332 333.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" 334# 32 bit world 335LIB32TMP= ${OBJTREE}${.CURDIR}/lib32 336 337.if ${TARGET_ARCH} == "amd64" 338.if empty(TARGET_CPUTYPE) 339LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 340.else 341LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} 342.endif 343LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ 344 MACHINE_CPU="i686 mmx sse sse2" 345LIB32WMAKEFLAGS= \ 346 AS="${AS} --32" \ 347 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" 348 349.elif ${TARGET_ARCH} == "powerpc64" 350.if empty(TARGET_CPUTYPE) 351LIB32CPUFLAGS= -mcpu=powerpc 352.else 353LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} 354.endif 355LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc 356LIB32WMAKEFLAGS= \ 357 LD="${LD} -m elf32ppc_fbsd" 358.endif 359 360 361LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \ 362 -isystem ${LIB32TMP}/usr/include/ \ 363 -L${LIB32TMP}/usr/lib32 \ 364 -B${LIB32TMP}/usr/lib32 365.if ${XCC:M/*} 366LIB32FLAGS+= --sysroot=${WORLDTMP} 367.endif 368 369# Yes, the flags are redundant. 370LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ 371 _SHLIBDIRPREFIX=${LIB32TMP} \ 372 _LDSCRIPTROOT=${LIB32TMP} \ 373 VERSION="${VERSION}" \ 374 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 375 PATH=${TMPPATH} \ 376 LIBDIR=/usr/lib32 \ 377 SHLIBDIR=/usr/lib32 \ 378 COMPILER_TYPE=${WMAKE_COMPILER_TYPE} 379LIB32WMAKEFLAGS+= \ 380 CC="${XCC} ${LIB32FLAGS}" \ 381 CXX="${XCXX} ${LIB32FLAGS}" \ 382 DESTDIR=${LIB32TMP} \ 383 -DCOMPAT_32BIT \ 384 -DLIBRARIES_ONLY \ 385 -DNO_CPU_CFLAGS \ 386 -DNO_CTF \ 387 -DNO_LINT 388 389LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \ 390 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML 391LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \ 392 ${IMAKE_INSTALL} 393.endif 394 395IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*} 396IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ 397 ${IMAKE_INSTALL} ${IMAKE_MTREE} ${IMAKE_COMPILER_TYPE} 398.if empty(.MAKEFLAGS:M-n) 399IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ 400 LD_LIBRARY_PATH=${INSTALLTMP} \ 401 PATH_LOCALE=${INSTALLTMP}/locale 402IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh 403.else 404IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} 405.endif 406.if defined(DB_FROM_SRC) 407INSTALLFLAGS+= -N ${.CURDIR}/etc 408MTREEFLAGS+= -N ${.CURDIR}/etc 409.endif 410_INSTALL_DDIR= ${DESTDIR}/${DISTDIR} 411INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::} 412.if defined(NO_ROOT) 413METALOG?= ${DESTDIR}/${DISTDIR}/METALOG 414IMAKE+= -DNO_ROOT METALOG=${METALOG} 415INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR} 416MTREEFLAGS+= -W 417.endif 418.if defined(DB_FROM_SRC) || defined(NO_ROOT) 419IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}" 420IMAKE_MTREE= MTREE_CMD="nmtree ${MTREEFLAGS}" 421.endif 422 423# kernel stage 424KMAKEENV= ${WMAKEENV} 425KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} 426 427# 428# buildworld 429# 430# Attempt to rebuild the entire system, with reasonable chance of 431# success, regardless of how old your existing system is. 432# 433_worldtmp: 434.if ${.CURDIR:C/[^,]//g} != "" 435# The m4 build of sendmail files doesn't like it if ',' is used 436# anywhere in the path of it's files. 437 @echo 438 @echo "*** Error: path to source tree contains a comma ','" 439 @echo 440 false 441.endif 442 @echo 443 @echo "--------------------------------------------------------------" 444 @echo ">>> Rebuilding the temporary build tree" 445 @echo "--------------------------------------------------------------" 446.if !defined(NO_CLEAN) 447 rm -rf ${WORLDTMP} 448.if defined(LIB32TMP) 449 rm -rf ${LIB32TMP} 450.endif 451.else 452 rm -rf ${WORLDTMP}/legacy/usr/include 453# XXX - These three can depend on any header file. 454 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c 455 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c 456 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c 457.endif 458.for _dir in \ 459 lib usr legacy/bin legacy/usr 460 mkdir -p ${WORLDTMP}/${_dir} 461.endfor 462 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 463 -p ${WORLDTMP}/legacy/usr >/dev/null 464.if ${MK_GROFF} != "no" 465 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \ 466 -p ${WORLDTMP}/legacy/usr >/dev/null 467.endif 468 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 469 -p ${WORLDTMP}/usr >/dev/null 470 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 471 -p ${WORLDTMP}/usr/include >/dev/null 472 ln -sf ${.CURDIR}/sys ${WORLDTMP}
| 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,DEPEND,OBJ} 11# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 12# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 13# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel 14# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel 15# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 16# -DNO_ROOT install without using root privilege 17# -DNO_DOCUPDATE do not update doc in ${MAKE} update 18# -DNO_CTF do not run the DTrace CTF conversion tools on built objects 19# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR 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:/bin/sh) 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 33# 34# The intended user-driven targets are: 35# buildworld - rebuild *everything*, including glue to help do upgrades 36# installworld- install everything built by "buildworld" 37# doxygen - build API documentation of the kernel 38# update - convenient way to update your source tree (eg: svn/svnup) 39# 40# Standard targets (not defined here) are documented in the makefiles in 41# /usr/share/mk. These include: 42# obj depend all install clean cleandepend cleanobj 43 44.if !defined(TARGET) || !defined(TARGET_ARCH) 45.error "Both TARGET and TARGET_ARCH must be defined." 46.endif 47 48.include <bsd.own.mk> 49.include <bsd.arch.inc.mk> 50.include <bsd.compiler.mk> 51 52# We must do share/info early so that installation of info `dir' 53# entries works correctly. Do it first since it is less likely to 54# grow dependencies on include and lib than vice versa. 55# 56# We must do lib/ and libexec/ before bin/, because if installworld 57# installs a new /bin/sh, the 'make' command will *immediately* 58# use that new version. And the new (dynamically-linked) /bin/sh 59# will expect to find appropriate libraries in /lib and /libexec. 60# 61.if defined(SUBDIR_OVERRIDE) 62SUBDIR= ${SUBDIR_OVERRIDE} 63.else 64SUBDIR= share/info lib libexec 65SUBDIR+=bin 66.if ${MK_GAMES} != "no" 67SUBDIR+=games 68.endif 69.if ${MK_CDDL} != "no" 70SUBDIR+=cddl 71.endif 72SUBDIR+=gnu include 73.if ${MK_KERBEROS} != "no" 74SUBDIR+=kerberos5 75.endif 76.if ${MK_RESCUE} != "no" 77SUBDIR+=rescue 78.endif 79SUBDIR+=sbin 80.if ${MK_CRYPT} != "no" 81SUBDIR+=secure 82.endif 83.if !defined(NO_SHARE) 84SUBDIR+=share 85.endif 86SUBDIR+=sys usr.bin usr.sbin 87.if ${MK_OFED} != "no" 88SUBDIR+=contrib/ofed 89.endif 90# 91# We must do etc/ last for install/distribute to work. 92# 93SUBDIR+=etc 94 95# These are last, since it is nice to at least get the base system 96# rebuilt before you do them. 97.for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS} 98.if exists(${.CURDIR}/${_DIR}/Makefile) 99SUBDIR+= ${_DIR} 100.endif 101.endfor 102.endif 103 104.if defined(NOCLEAN) 105NO_CLEAN= ${NOCLEAN} 106.endif 107.if defined(NO_CLEANDIR) 108CLEANDIR= clean cleandepend 109.else 110CLEANDIR= cleandir 111.endif 112 113LOCAL_TOOL_DIRS?= 114 115BUILDENV_SHELL?=/bin/sh 116 117SVN?= /usr/local/bin/svn 118SVNFLAGS?= -r HEAD 119 120MAKEOBJDIRPREFIX?= /usr/obj 121.if !defined(OSRELDATE) 122.if exists(/usr/include/osreldate.h) 123OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 124 /usr/include/osreldate.h 125.else 126OSRELDATE= 0 127.endif 128.endif 129 130.if !defined(VERSION) 131VERSION!= uname -srp 132VERSION+= ${OSRELDATE} 133.endif 134 135KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6eb/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64 136.if ${TARGET} == ${TARGET_ARCH} 137_t= ${TARGET} 138.else 139_t= ${TARGET_ARCH}/${TARGET} 140.endif 141.for _t in ${_t} 142.if empty(KNOWN_ARCHES:M${_t}) 143.error Unknown target ${TARGET_ARCH}:${TARGET}. 144.endif 145.endfor 146 147.if ${TARGET} == ${MACHINE} 148TARGET_CPUTYPE?=${CPUTYPE} 149.else 150TARGET_CPUTYPE?= 151.endif 152 153.if !empty(TARGET_CPUTYPE) 154_TARGET_CPUTYPE=${TARGET_CPUTYPE} 155.else 156_TARGET_CPUTYPE=dummy 157.endif 158_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ 159 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE 160.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 161.error CPUTYPE global should be set with ?=. 162.endif 163.if make(buildworld) 164BUILD_ARCH!= uname -p 165.if ${MACHINE_ARCH} != ${BUILD_ARCH} 166.error To cross-build, set TARGET_ARCH. 167.endif 168.endif 169.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING) 170OBJTREE= ${MAKEOBJDIRPREFIX} 171.else 172OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} 173.endif 174WORLDTMP= ${OBJTREE}${.CURDIR}/tmp 175# /usr/games added for fortune which depend on strfile 176BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games:${WORLDTMP}/legacy/bin 177XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games 178STRICTTMPPATH= ${BPATH}:${XPATH} 179TMPPATH= ${STRICTTMPPATH}:${PATH} 180 181# 182# Avoid running mktemp(1) unless actually needed. 183# It may not be functional, e.g., due to new ABI 184# when in the middle of installing over this system. 185# 186.if make(distributeworld) || make(installworld) 187INSTALLTMP!= /usr/bin/mktemp -d -u -t install 188.endif 189 190# 191# Building a world goes through the following stages 192# 193# 1. legacy stage [BMAKE] 194# This stage is responsible for creating compatibility 195# shims that are needed by the bootstrap-tools, 196# build-tools and cross-tools stages. 197# 1. bootstrap-tools stage [BMAKE] 198# This stage is responsible for creating programs that 199# are needed for backward compatibility reasons. They 200# are not built as cross-tools. 201# 2. build-tools stage [TMAKE] 202# This stage is responsible for creating the object 203# tree and building any tools that are needed during 204# the build process. 205# 3. cross-tools stage [XMAKE] 206# This stage is responsible for creating any tools that 207# are needed for cross-builds. A cross-compiler is one 208# of them. 209# 4. world stage [WMAKE] 210# This stage actually builds the world. 211# 5. install stage (optional) [IMAKE] 212# This stage installs a previously built world. 213# 214 215BOOTSTRAPPING?= 0 216 217# Common environment for world related stages 218CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ 219 MACHINE_ARCH=${TARGET_ARCH} \ 220 MACHINE=${TARGET} \ 221 CPUTYPE=${TARGET_CPUTYPE} 222.if ${MK_GROFF} != "no" 223CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 224 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 225 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 226.endif 227 228# bootstrap-tools stage 229BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 230 PATH=${BPATH}:${PATH} \ 231 WORLDTMP=${WORLDTMP} \ 232 VERSION="${VERSION}" \ 233 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ 234 COMPILER_TYPE=${COMPILER_TYPE} 235BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 236 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 237 DESTDIR= \ 238 BOOTSTRAPPING=${OSRELDATE} \ 239 SSP_CFLAGS= \ 240 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ 241 -DNO_PIC -DNO_PROFILE -DNO_SHARED \ 242 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD 243 244# build-tools stage 245TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 246 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 247 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 248 DESTDIR= \ 249 BOOTSTRAPPING=${OSRELDATE} \ 250 SSP_CFLAGS= \ 251 -DNO_LINT \ 252 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD 253 254# cross-tools stage 255XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ 256 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 257 -DWITHOUT_GDB 258 259# world stage 260WMAKEENV= ${CROSSENV} \ 261 _SHLIBDIRPREFIX=${WORLDTMP} \ 262 _LDSCRIPTROOT= \ 263 VERSION="${VERSION}" \ 264 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 265 PATH=${TMPPATH} 266.if ${MK_CDDL} == "no" 267WMAKEENV+= NO_CTF=1 268.endif 269 270.if defined(CROSS_TOOLCHAIN_PREFIX) 271CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 272CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} 273.endif 274XCOMPILERS= CC CXX CPP 275.for COMPILER in ${XCOMPILERS} 276.if defined(CROSS_COMPILER_PREFIX) 277X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}} 278.else 279X${COMPILER}?= ${${COMPILER}} 280.endif 281.endfor 282XBINUTILS= AS AR LD NM OBJDUMP RANLIB STRINGS 283.for BINUTIL in ${XBINUTILS} 284.if defined(CROSS_BINUTILS_PREFIX) 285X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}} 286.else 287X${BINUTIL}?= ${${BINUTIL}} 288.endif 289.endfor 290WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \ 291 CPP="${XCPP} ${XFLAGS}" \ 292 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ 293 OBJDUMP=${XOBJDUMP} RANLIB=${XRANLIB} STRINGS=${XSTRINGS} 294 295.if ${XCC:T:Mgcc} == "gcc" 296WMAKE_COMPILER_TYPE= gcc 297.elif ${XCC:T:Mclang} == "clang" 298WMAKE_COMPILER_TYPE= clang 299.elif ${MK_CLANG_IS_CC} == "no" 300WMAKE_COMPILER_TYPE= gcc 301.else 302WMAKE_COMPILER_TYPE= clang 303.endif 304IMAKE_COMPILER_TYPE= COMPILER_TYPE=${WMAKE_COMPILER_TYPE} 305 306.if ${XCC:M/*} 307XFLAGS= --sysroot=${WORLDTMP} 308.if defined(CROSS_BINUTILS_PREFIX) 309# In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a 310# directory, but the compiler will look in the right place for it's 311# tools so we don't need to tell it where to look. 312.if exists(${CROSS_BINUTILS_PREFIX}) 313XFLAGS+= -B${CROSS_BINUTILS_PREFIX} 314.endif 315.else 316XFLAGS+= -B${WORLDTMP}/usr/bin 317.endif 318.if ${TARGET_ARCH} != ${MACHINE_ARCH} && ${WMAKE_COMPILER_TYPE} == "clang" 319.if (${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "armv6") && \ 320${MK_ARM_EABI} != "no" 321TARGET_ABI= gnueabi 322.else 323TARGET_ABI= unknown 324.endif 325TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.0 326XFLAGS+= -target ${TARGET_TRIPLE} 327.endif 328.endif 329 330WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE} 331WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP} 332 333.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" 334# 32 bit world 335LIB32TMP= ${OBJTREE}${.CURDIR}/lib32 336 337.if ${TARGET_ARCH} == "amd64" 338.if empty(TARGET_CPUTYPE) 339LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 340.else 341LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} 342.endif 343LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ 344 MACHINE_CPU="i686 mmx sse sse2" 345LIB32WMAKEFLAGS= \ 346 AS="${AS} --32" \ 347 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" 348 349.elif ${TARGET_ARCH} == "powerpc64" 350.if empty(TARGET_CPUTYPE) 351LIB32CPUFLAGS= -mcpu=powerpc 352.else 353LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} 354.endif 355LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc 356LIB32WMAKEFLAGS= \ 357 LD="${LD} -m elf32ppc_fbsd" 358.endif 359 360 361LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \ 362 -isystem ${LIB32TMP}/usr/include/ \ 363 -L${LIB32TMP}/usr/lib32 \ 364 -B${LIB32TMP}/usr/lib32 365.if ${XCC:M/*} 366LIB32FLAGS+= --sysroot=${WORLDTMP} 367.endif 368 369# Yes, the flags are redundant. 370LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ 371 _SHLIBDIRPREFIX=${LIB32TMP} \ 372 _LDSCRIPTROOT=${LIB32TMP} \ 373 VERSION="${VERSION}" \ 374 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 375 PATH=${TMPPATH} \ 376 LIBDIR=/usr/lib32 \ 377 SHLIBDIR=/usr/lib32 \ 378 COMPILER_TYPE=${WMAKE_COMPILER_TYPE} 379LIB32WMAKEFLAGS+= \ 380 CC="${XCC} ${LIB32FLAGS}" \ 381 CXX="${XCXX} ${LIB32FLAGS}" \ 382 DESTDIR=${LIB32TMP} \ 383 -DCOMPAT_32BIT \ 384 -DLIBRARIES_ONLY \ 385 -DNO_CPU_CFLAGS \ 386 -DNO_CTF \ 387 -DNO_LINT 388 389LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \ 390 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML 391LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \ 392 ${IMAKE_INSTALL} 393.endif 394 395IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*} 396IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ 397 ${IMAKE_INSTALL} ${IMAKE_MTREE} ${IMAKE_COMPILER_TYPE} 398.if empty(.MAKEFLAGS:M-n) 399IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ 400 LD_LIBRARY_PATH=${INSTALLTMP} \ 401 PATH_LOCALE=${INSTALLTMP}/locale 402IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh 403.else 404IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} 405.endif 406.if defined(DB_FROM_SRC) 407INSTALLFLAGS+= -N ${.CURDIR}/etc 408MTREEFLAGS+= -N ${.CURDIR}/etc 409.endif 410_INSTALL_DDIR= ${DESTDIR}/${DISTDIR} 411INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::} 412.if defined(NO_ROOT) 413METALOG?= ${DESTDIR}/${DISTDIR}/METALOG 414IMAKE+= -DNO_ROOT METALOG=${METALOG} 415INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR} 416MTREEFLAGS+= -W 417.endif 418.if defined(DB_FROM_SRC) || defined(NO_ROOT) 419IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}" 420IMAKE_MTREE= MTREE_CMD="nmtree ${MTREEFLAGS}" 421.endif 422 423# kernel stage 424KMAKEENV= ${WMAKEENV} 425KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} 426 427# 428# buildworld 429# 430# Attempt to rebuild the entire system, with reasonable chance of 431# success, regardless of how old your existing system is. 432# 433_worldtmp: 434.if ${.CURDIR:C/[^,]//g} != "" 435# The m4 build of sendmail files doesn't like it if ',' is used 436# anywhere in the path of it's files. 437 @echo 438 @echo "*** Error: path to source tree contains a comma ','" 439 @echo 440 false 441.endif 442 @echo 443 @echo "--------------------------------------------------------------" 444 @echo ">>> Rebuilding the temporary build tree" 445 @echo "--------------------------------------------------------------" 446.if !defined(NO_CLEAN) 447 rm -rf ${WORLDTMP} 448.if defined(LIB32TMP) 449 rm -rf ${LIB32TMP} 450.endif 451.else 452 rm -rf ${WORLDTMP}/legacy/usr/include 453# XXX - These three can depend on any header file. 454 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c 455 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c 456 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c 457.endif 458.for _dir in \ 459 lib usr legacy/bin legacy/usr 460 mkdir -p ${WORLDTMP}/${_dir} 461.endfor 462 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 463 -p ${WORLDTMP}/legacy/usr >/dev/null 464.if ${MK_GROFF} != "no" 465 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \ 466 -p ${WORLDTMP}/legacy/usr >/dev/null 467.endif 468 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 469 -p ${WORLDTMP}/usr >/dev/null 470 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 471 -p ${WORLDTMP}/usr/include >/dev/null 472 ln -sf ${.CURDIR}/sys ${WORLDTMP}
|
782.if defined(NO_ROOT) 783 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ 784 sed -e 's#^\./#./${dist}/#' >> ${METALOG} 785 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \ 786 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 787 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \ 788 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG} 789.endif 790.endfor 791 -mkdir ${DESTDIR}/${DISTDIR}/base 792 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 793 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \ 794 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \ 795 LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs 796.endif 797 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 798 ${IMAKEENV} rm -rf ${INSTALLTMP} 799.if make(distributeworld) 800.for dist in ${EXTRA_DISTRIBUTIONS} 801 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete 802.endfor 803.if defined(NO_ROOT) 804.for dist in base ${EXTRA_DISTRIBUTIONS} 805 @# For each file that exists in this dist, print the corresponding 806 @# line from the METALOG. This relies on the fact that 807 @# a line containing only the filename will sort immediatly before 808 @# the relevant mtree line. 809 cd ${DESTDIR}/${DISTDIR}; \ 810 find ./${dist} | sort -u ${METALOG} - | \ 811 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 812 ${DESTDIR}/${DISTDIR}/${dist}.meta 813.endfor 814.endif 815.endif 816 817packageworld: 818.for dist in base ${EXTRA_DISTRIBUTIONS} 819.if defined(NO_ROOT) 820 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 821 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \ 822 @${DESTDIR}/${DISTDIR}/${dist}.meta 823.else 824 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 825 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz . 826.endif 827.endfor 828 829# 830# reinstall 831# 832# If you have a build server, you can NFS mount the source and obj directories 833# and do a 'make reinstall' on the *client* to install new binaries from the 834# most recent server build. 835# 836reinstall: 837 @echo "--------------------------------------------------------------" 838 @echo ">>> Making hierarchy" 839 @echo "--------------------------------------------------------------" 840 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 841 LOCAL_MTREE=${LOCAL_MTREE} hierarchy 842 @echo 843 @echo "--------------------------------------------------------------" 844 @echo ">>> Installing everything" 845 @echo "--------------------------------------------------------------" 846 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 847.if defined(LIB32TMP) && ${MK_LIB32} != "no" 848 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 849.endif 850 851redistribute: 852 @echo "--------------------------------------------------------------" 853 @echo ">>> Distributing everything" 854 @echo "--------------------------------------------------------------" 855 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 856.if defined(LIB32TMP) && ${MK_LIB32} != "no" 857 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \ 858 DISTRIBUTION=lib32 859.endif 860 861distrib-dirs distribution: 862 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 863 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET} 864 865# 866# buildkernel and installkernel 867# 868# Which kernels to build and/or install is specified by setting 869# KERNCONF. If not defined a GENERIC kernel is built/installed. 870# Only the existing (depending TARGET) config files are used 871# for building kernels and only the first of these is designated 872# as the one being installed. 873# 874# Note that we have to use TARGET instead of TARGET_ARCH when 875# we're in kernel-land. Since only TARGET_ARCH is (expected) to 876# be set to cross-build, we have to make sure TARGET is set 877# properly. 878 879.if defined(KERNFAST) 880NO_KERNELCLEAN= t 881NO_KERNELCONFIG= t 882NO_KERNELDEPEND= t 883NO_KERNELOBJ= t 884# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 885.if !defined(KERNCONF) && ${KERNFAST} != "1" 886KERNCONF=${KERNFAST} 887.endif 888.endif 889.if ${TARGET_ARCH} == "powerpc64" 890KERNCONF?= GENERIC64 891.else 892KERNCONF?= GENERIC 893.endif 894INSTKERNNAME?= kernel 895 896KERNSRCDIR?= ${.CURDIR}/sys 897KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 898KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 899KERNCONFDIR?= ${KRNLCONFDIR} 900 901BUILDKERNELS= 902INSTALLKERNEL= 903.for _kernel in ${KERNCONF} 904.if exists(${KERNCONFDIR}/${_kernel}) 905BUILDKERNELS+= ${_kernel} 906.if empty(INSTALLKERNEL) 907INSTALLKERNEL= ${_kernel} 908.endif 909.endif 910.endfor 911 912# 913# buildkernel 914# 915# Builds all kernels defined by BUILDKERNELS. 916# 917buildkernel: 918.if empty(BUILDKERNELS) 919 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 920 false 921.endif 922 @echo 923.for _kernel in ${BUILDKERNELS} 924 @echo "--------------------------------------------------------------" 925 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 926 @echo "--------------------------------------------------------------" 927 @echo "===> ${_kernel}" 928 mkdir -p ${KRNLOBJDIR} 929.if !defined(NO_KERNELCONFIG) 930 @echo 931 @echo "--------------------------------------------------------------" 932 @echo ">>> stage 1: configuring the kernel" 933 @echo "--------------------------------------------------------------" 934 cd ${KRNLCONFDIR}; \ 935 PATH=${TMPPATH} \ 936 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 937 ${KERNCONFDIR}/${_kernel} 938.endif 939.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 940 @echo 941 @echo "--------------------------------------------------------------" 942 @echo ">>> stage 2.1: cleaning up the object tree" 943 @echo "--------------------------------------------------------------" 944 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 945.endif 946.if !defined(NO_KERNELOBJ) 947 @echo 948 @echo "--------------------------------------------------------------" 949 @echo ">>> stage 2.2: rebuilding the object tree" 950 @echo "--------------------------------------------------------------" 951 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 952.endif 953 @echo 954 @echo "--------------------------------------------------------------" 955 @echo ">>> stage 2.3: build tools" 956 @echo "--------------------------------------------------------------" 957 cd ${KRNLOBJDIR}/${_kernel}; \ 958 PATH=${BPATH}:${PATH} \ 959 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ 960 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \ 961 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile 962# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. 963.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) 964.for target in obj depend all 965 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ 966 PATH=${BPATH}:${PATH} \ 967 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ 968 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target} 969.endfor 970.endif 971.if !defined(NO_KERNELDEPEND) 972 @echo 973 @echo "--------------------------------------------------------------" 974 @echo ">>> stage 3.1: making dependencies" 975 @echo "--------------------------------------------------------------" 976 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ 977.endif 978 @echo 979 @echo "--------------------------------------------------------------" 980 @echo ">>> stage 3.2: building everything" 981 @echo "--------------------------------------------------------------" 982 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 983 @echo "--------------------------------------------------------------" 984 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 985 @echo "--------------------------------------------------------------" 986.endfor 987 988# 989# installkernel, etc. 990# 991# Install the kernel defined by INSTALLKERNEL 992# 993installkernel installkernel.debug \ 994reinstallkernel reinstallkernel.debug: installcheck 995.if empty(INSTALLKERNEL) 996 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 997 false 998.endif 999 @echo "--------------------------------------------------------------" 1000 @echo ">>> Installing kernel ${INSTALLKERNEL}" 1001 @echo "--------------------------------------------------------------" 1002 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1003 ${CROSSENV} PATH=${TMPPATH} \ 1004 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 1005 1006distributekernel distributekernel.debug: 1007.if empty(INSTALLKERNEL) 1008 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1009 false 1010.endif 1011 mkdir -p ${DESTDIR}/${DISTDIR} 1012.if defined(NO_ROOT) 1013 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta 1014.endif 1015 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1016 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \ 1017 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \ 1018 DESTDIR=${INSTALL_DDIR}/kernel \ 1019 ${.TARGET:S/distributekernel/install/} 1020.if defined(NO_ROOT) 1021 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \ 1022 ${DESTDIR}/${DISTDIR}/kernel.meta 1023.endif 1024.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 1025.if defined(NO_ROOT) 1026 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta 1027.endif 1028 cd ${KRNLOBJDIR}/${_kernel}; \ 1029 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \ 1030 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \ 1031 KERNEL=${INSTKERNNAME}.${_kernel} \ 1032 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \ 1033 ${.TARGET:S/distributekernel/install/} 1034 sed -e 's|^./kernel|.|' \ 1035 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \ 1036 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1037.endfor 1038 1039packagekernel: 1040.if defined(NO_ROOT) 1041 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1042 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \ 1043 @${DESTDIR}/${DISTDIR}/kernel.meta 1044.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 1045 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1046 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \ 1047 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1048.endfor 1049.else 1050 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1051 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz . 1052.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 1053 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1054 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz . 1055.endfor 1056.endif 1057 1058# 1059# doxygen 1060# 1061# Build the API documentation with doxygen 1062# 1063doxygen: 1064 @if [ ! -x `/usr/bin/which doxygen` ]; then \ 1065 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 1066 exit 1; \ 1067 fi 1068 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all 1069 1070# 1071# update 1072# 1073# Update the source tree(s), by running svn/svnup to update to the 1074# latest copy. 1075# 1076update: 1077.if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE) 1078 @echo "--------------------------------------------------------------" 1079 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported." 1080 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated" 1081 @echo "--------------------------------------------------------------" 1082 @exit 1 1083.endif 1084.if defined(SVN_UPDATE) 1085 @echo "--------------------------------------------------------------" 1086 @echo ">>> Updating ${.CURDIR} using Subversion" 1087 @echo "--------------------------------------------------------------" 1088 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS}) 1089.endif 1090 1091# 1092# ------------------------------------------------------------------------ 1093# 1094# From here onwards are utility targets used by the 'make world' and 1095# related targets. If your 'world' breaks, you may like to try to fix 1096# the problem and manually run the following targets to attempt to 1097# complete the build. Beware, this is *not* guaranteed to work, you 1098# need to have a pretty good grip on the current state of the system 1099# to attempt to manually finish it. If in doubt, 'make world' again. 1100# 1101 1102# 1103# legacy: Build compatibility shims for the next three targets 1104# 1105legacy: 1106.if ${BOOTSTRAPPING} < 700055 && ${BOOTSTRAPPING} != 0 1107 @echo "ERROR: Source upgrades from versions prior to 7.0 not supported."; \ 1108 false 1109.endif 1110.for _tool in tools/build 1111 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ 1112 cd ${.CURDIR}/${_tool}; \ 1113 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1114 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 1115 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1116 ${MAKE} DIRPRFX=${_tool}/ all; \ 1117 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1118.endfor 1119 1120# 1121# bootstrap-tools: Build tools needed for compatibility 1122# 1123.if ${MK_GAMES} != "no" 1124_strfile= games/fortune/strfile 1125.endif 1126 1127.if ${MK_CXX} != "no" 1128_gperf= gnu/usr.bin/gperf 1129.endif 1130 1131.if ${MK_GROFF} != "no" 1132_groff= gnu/usr.bin/groff 1133.endif 1134 1135.if ${BOOTSTRAPPING} < 800022 1136_ar= usr.bin/ar 1137.endif 1138 1139.if ${BOOTSTRAPPING} < 800013 1140_mklocale= usr.bin/mklocale 1141.endif 1142 1143.if ${BOOTSTRAPPING} < 900002 1144_sed= usr.bin/sed 1145.endif 1146 1147.if ${BOOTSTRAPPING} < 900006 1148_lex= usr.bin/lex 1149.endif 1150 1151.if ${BOOTSTRAPPING} < 1000002 1152_m4= usr.bin/m4 1153.endif 1154 1155.if ${BOOTSTRAPPING} < 1000013 1156_yacc= lib/liby \ 1157 usr.bin/yacc 1158.endif 1159 1160.if ${BOOTSTRAPPING} < 1000014 1161_crunch= usr.sbin/crunch 1162.endif 1163 1164.if ${BOOTSTRAPPING} < 1000026 1165_nmtree= lib/libnetbsd \ 1166 usr.sbin/nmtree 1167.endif 1168 1169.if ${BOOTSTRAPPING} < 1000027 1170_cat= bin/cat 1171.endif 1172 1173.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041 1174_awk= usr.bin/awk 1175.endif 1176 1177.if ${MK_BSNMP} != "no" && !exists(/usr/sbin/gensnmptree) 1178_gensnmptree= usr.sbin/bsnmpd/gensnmptree 1179.endif 1180 1181.if ${MK_CLANG} != "no" 1182_clang_tblgen= \ 1183 lib/clang/libllvmsupport \ 1184 lib/clang/libllvmtablegen \ 1185 usr.bin/clang/tblgen \ 1186 usr.bin/clang/clang-tblgen 1187.endif 1188 1189# dtrace tools are required for older bootstrap env and cross-build 1190.if ${MK_CDDL} != "no" && \ 1191 ((${BOOTSTRAPPING} < 800038 && \ 1192 !(${BOOTSTRAPPING} >= 700112 && ${BOOTSTRAPPING} < 799999)) \ 1193 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH})) 1194_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \ 1195 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge 1196.endif 1197 1198# Default to building the BSDL DTC, but build the GPL one if users explicitly 1199# request it. 1200_dtc= usr.bin/dtc 1201.if ${MK_GPL_DTC} != "no" 1202_dtc= gnu/usr.bin/dtc 1203.endif 1204 1205.if ${MK_KERBEROS} != "no" 1206_kerberos5_bootstrap_tools= \ 1207 kerberos5/tools/make-roken \ 1208 kerberos5/lib/libroken \ 1209 kerberos5/lib/libvers \ 1210 kerberos5/tools/asn1_compile \ 1211 kerberos5/tools/slc \ 1212 usr.bin/compile_et 1213.endif 1214 1215# Please document (add comment) why something is in 'bootstrap-tools'. 1216# Try to bound the building of the bootstrap-tool to just the 1217# FreeBSD versions that need the tool built at this stage of the build. 1218bootstrap-tools: 1219.for _tool in \ 1220 ${_clang_tblgen} \ 1221 ${_kerberos5_bootstrap_tools} \ 1222 ${_dtrace_tools} \ 1223 ${_strfile} \ 1224 ${_gperf} \ 1225 ${_groff} \ 1226 ${_ar} \ 1227 ${_dtc} \ 1228 ${_awk} \ 1229 ${_cat} \ 1230 usr.bin/lorder \ 1231 usr.bin/makewhatis \ 1232 ${_mklocale} \ 1233 usr.bin/rpcgen \ 1234 ${_sed} \ 1235 ${_yacc} \ 1236 ${_m4} \ 1237 ${_lex} \ 1238 lib/libmd \ 1239 usr.bin/xinstall \ 1240 ${_gensnmptree} \ 1241 usr.sbin/config \ 1242 ${_crunch} \ 1243 ${_nmtree} 1244 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1245 cd ${.CURDIR}/${_tool}; \ 1246 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1247 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1248 ${MAKE} DIRPRFX=${_tool}/ all; \ 1249 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1250.endfor 1251 1252# 1253# build-tools: Build special purpose build tools 1254# 1255.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) 1256_aicasm= sys/modules/aic7xxx/aicasm 1257.endif 1258 1259.if !defined(NO_SHARE) 1260_share= share/syscons/scrnmaps 1261.endif 1262 1263.if ${MK_GCC} != "no" 1264_gcc_tools= gnu/usr.bin/cc/cc_tools 1265.endif 1266 1267.if ${MK_RESCUE} != "no" 1268_rescue= rescue/rescue 1269.endif 1270 1271build-tools: 1272.for _tool in \ 1273 bin/csh \ 1274 bin/sh \ 1275 ${_rescue} \ 1276 ${LOCAL_TOOL_DIRS} \ 1277 lib/ncurses/ncurses \ 1278 lib/ncurses/ncursesw \ 1279 ${_share} \ 1280 ${_aicasm} \ 1281 usr.bin/awk \ 1282 lib/libmagic \ 1283 usr.bin/mkesdb_static \ 1284 usr.bin/mkcsmapper_static 1285 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 1286 cd ${.CURDIR}/${_tool}; \ 1287 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1288 ${MAKE} DIRPRFX=${_tool}/ build-tools 1289.endfor 1290.for _tool in \ 1291 ${_gcc_tools} 1292 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ 1293 cd ${.CURDIR}/${_tool}; \ 1294 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1295 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1296 ${MAKE} DIRPRFX=${_tool}/ all 1297.endfor 1298 1299# 1300# cross-tools: Build cross-building tools 1301# 1302.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035 1303.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 1304_btxld= usr.sbin/btxld 1305.endif 1306.endif 1307.if ${TARGET_ARCH} != ${MACHINE_ARCH} 1308.if ${MK_RESCUE} != "no" || defined(RELEASEDIR) 1309_crunchide= usr.sbin/crunch/crunchide 1310.endif 1311.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR) 1312_kgzip= usr.sbin/kgzip 1313.endif 1314.endif 1315 1316.if ${XAS:M/*} == "" && ${MK_BINUTILS} != "no" 1317_binutils= gnu/usr.bin/binutils 1318.endif 1319 1320# If an full path to an external cross compiler is given, don't build 1321# a cross compiler. 1322.if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no" 1323.if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") 1324_clang= usr.bin/clang 1325_clang_libs= lib/clang 1326.endif 1327 1328.if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98") 1329_cc= gnu/usr.bin/cc 1330.endif 1331.endif 1332 1333cross-tools: 1334.for _tool in \ 1335 ${_clang_libs} \ 1336 ${_clang} \ 1337 ${_binutils} \ 1338 ${_cc} \ 1339 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ 1340 ${_btxld} \ 1341 ${_crunchide} \ 1342 ${_kgzip} 1343 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1344 cd ${.CURDIR}/${_tool}; \ 1345 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1346 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1347 ${MAKE} DIRPRFX=${_tool}/ all; \ 1348 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 1349.endfor 1350 1351# 1352# hierarchy - ensure that all the needed directories are present 1353# 1354hierarchy hier: 1355.if defined(NO_ROOT) 1356 cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} \ 1357 -DNO_ROOT METALOG=${METALOG} distrib-dirs 1358.else 1359 cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs 1360.endif 1361 1362# 1363# libraries - build all libraries, and install them under ${DESTDIR}. 1364# 1365# The list of libraries with dependents (${_prebuild_libs}) and their 1366# interdependencies (__L) are built automatically by the 1367# ${.CURDIR}/tools/make_libdeps.sh script. 1368# 1369libraries: 1370 cd ${.CURDIR}; \ 1371 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 1372 ${MAKE} -f Makefile.inc1 _startup_libs; \ 1373 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 1374 ${MAKE} -f Makefile.inc1 _generic_libs; 1375 1376# 1377# static libgcc.a prerequisite for shared libc 1378# 1379_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt 1380 1381# These dependencies are not automatically generated: 1382# 1383# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 1384# all shared libraries for ELF. 1385# 1386_startup_libs= gnu/lib/csu 1387.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 1388_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 1389.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}) 1390_startup_libs+= lib/csu/${MACHINE_ARCH} 1391.else 1392_startup_libs+= lib/csu/${MACHINE_CPUARCH} 1393.endif 1394_startup_libs+= gnu/lib/libgcc 1395_startup_libs+= lib/libcompiler_rt 1396_startup_libs+= lib/libc 1397.if ${MK_LIBCPLUSPLUS} != "no" 1398_startup_libs+= lib/libcxxrt 1399.endif 1400 1401gnu/lib/libgcc__L: lib/libc__L 1402.if ${MK_LIBCPLUSPLUS} != "no" 1403lib/libcxxrt__L: gnu/lib/libgcc__L 1404.endif 1405 1406_prebuild_libs= ${_kerberos5_lib_libasn1} \ 1407 ${_kerberos5_lib_libhdb} \ 1408 ${_kerberos5_lib_libheimbase} \ 1409 ${_kerberos5_lib_libheimntlm} \ 1410 ${_kerberos5_lib_libheimsqlite} \ 1411 ${_kerberos5_lib_libheimipcc} \ 1412 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 1413 ${_kerberos5_lib_libroken} \ 1414 ${_kerberos5_lib_libwind} \ 1415 ${_lib_atf_libatf_c} \ 1416 lib/libbz2 ${_libcom_err} lib/libcrypt \ 1417 lib/libelf lib/libexpat \ 1418 ${_lib_libgssapi} ${_lib_libipx} \ 1419 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \ 1420 lib/ncurses/ncurses lib/ncurses/ncursesw \ 1421 lib/libopie lib/libpam ${_lib_libthr} \ 1422 lib/libradius lib/libsbuf lib/libtacplus \ 1423 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ 1424 ${_cddl_lib_libzfs_core} \ 1425 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ 1426 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ 1427 ${_secure_lib_libssl} 1428 1429.if ${MK_ATF} != "no" 1430_lib_atf_libatf_c= lib/atf/libatf-c 1431.endif 1432 1433.if ${MK_LIBTHR} != "no" 1434_lib_libthr= lib/libthr 1435.endif 1436 1437.if ${MK_OFED} != "no" 1438_ofed_lib= contrib/ofed/usr.lib/ 1439.endif 1440 1441_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} 1442.for _DIR in ${LOCAL_LIB_DIRS} 1443.if exists(${.CURDIR}/${_DIR}/Makefile) 1444_generic_libs+= ${_DIR} 1445.endif 1446.endfor 1447 1448lib/libopie__L lib/libtacplus__L: lib/libmd__L 1449 1450.if ${MK_CDDL} != "no" 1451_cddl_lib_libumem= cddl/lib/libumem 1452_cddl_lib_libnvpair= cddl/lib/libnvpair 1453_cddl_lib_libzfs_core= cddl/lib/libzfs_core 1454_cddl_lib= cddl/lib 1455cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L 1456.endif 1457 1458.if ${MK_CRYPT} != "no" 1459.if ${MK_OPENSSL} != "no" 1460_secure_lib_libcrypto= secure/lib/libcrypto 1461_secure_lib_libssl= secure/lib/libssl 1462lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 1463.if ${MK_OPENSSH} != "no" 1464_secure_lib_libssh= secure/lib/libssh 1465secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 1466.if ${MK_KERBEROS_SUPPORT} != "no" 1467secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 1468 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 1469 lib/libmd__L kerberos5/lib/libroken__L 1470.endif 1471.endif 1472.endif 1473_secure_lib= secure/lib 1474.endif 1475 1476.if ${MK_KERBEROS} != "no" 1477kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L 1478kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1479 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ 1480 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L 1481kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ 1482 kerberos5/lib/libroken__L lib/libcom_err__L 1483kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1484 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L 1485kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1486 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ 1487 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ 1488 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L 1489kerberos5/lib/libroken__L: lib/libcrypt__L 1490kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L 1491kerberos5/lib/libheimbase__L: lib/libthr__L 1492kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L 1493kerberos5/lib/libheimsqlite__L: lib/libthr__L 1494.endif 1495 1496.if ${MK_GSSAPI} != "no" 1497_lib_libgssapi= lib/libgssapi 1498.endif 1499 1500.if ${MK_IPX} != "no" 1501_lib_libipx= lib/libipx 1502.endif 1503 1504.if ${MK_KERBEROS} != "no" 1505_kerberos5_lib= kerberos5/lib 1506_kerberos5_lib_libasn1= kerberos5/lib/libasn1 1507_kerberos5_lib_libhdb= kerberos5/lib/libhdb 1508_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase 1509_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 1510_kerberos5_lib_libhx509= kerberos5/lib/libhx509 1511_kerberos5_lib_libroken= kerberos5/lib/libroken 1512_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 1513_kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite 1514_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc 1515_kerberos5_lib_libwind= kerberos5/lib/libwind 1516_libcom_err= lib/libcom_err 1517.endif 1518 1519.if ${MK_NIS} != "no" 1520_lib_libypclnt= lib/libypclnt 1521.endif 1522 1523.if ${MK_OPENSSL} == "no" 1524lib/libradius__L: lib/libmd__L 1525.endif 1526 1527.for _lib in ${_prereq_libs} 1528${_lib}__PL: .PHONY 1529.if exists(${.CURDIR}/${_lib}) 1530 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1531 cd ${.CURDIR}/${_lib}; \ 1532 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1533 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1534 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \ 1535 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install 1536.endif 1537.endfor 1538 1539.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 1540${_lib}__L: .PHONY 1541.if exists(${.CURDIR}/${_lib}) 1542 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1543 cd ${.CURDIR}/${_lib}; \ 1544 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1545 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1546 ${MAKE} DIRPRFX=${_lib}/ all; \ 1547 ${MAKE} DIRPRFX=${_lib}/ install 1548.endif 1549.endfor 1550 1551# libpam is special: we need to build static PAM modules before 1552# static PAM library, and dynamic PAM library before dynamic PAM 1553# modules. 1554lib/libpam__L: .PHONY 1555 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ 1556 cd ${.CURDIR}/lib/libpam; \ 1557 ${MAKE} DIRPRFX=lib/libpam/ obj; \ 1558 ${MAKE} DIRPRFX=lib/libpam/ depend; \ 1559 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ 1560 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install 1561 1562_prereq_libs: ${_prereq_libs:S/$/__PL/} 1563_startup_libs: ${_startup_libs:S/$/__L/} 1564_prebuild_libs: ${_prebuild_libs:S/$/__L/} 1565_generic_libs: ${_generic_libs:S/$/__L/} 1566 1567.for __target in all clean cleandepend cleandir depend includes obj 1568.for entry in ${SUBDIR} 1569${entry}.${__target}__D: .PHONY 1570 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 1571 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ 1572 edir=${entry}.${MACHINE_ARCH}; \ 1573 cd ${.CURDIR}/$${edir}; \ 1574 else \ 1575 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ 1576 edir=${entry}; \ 1577 cd ${.CURDIR}/$${edir}; \ 1578 fi; \ 1579 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 1580.endfor 1581par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 1582.endfor 1583 1584.include <bsd.subdir.mk> 1585 1586.if make(check-old) || make(check-old-dirs) || \ 1587 make(check-old-files) || make(check-old-libs) || \ 1588 make(delete-old) || make(delete-old-dirs) || \ 1589 make(delete-old-files) || make(delete-old-libs) 1590 1591# 1592# check for / delete old files section 1593# 1594 1595.include "ObsoleteFiles.inc" 1596 1597OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 1598else you can not start such an application. Consult UPDATING for more \ 1599information regarding how to cope with the removal/revision bump of a \ 1600specific library." 1601 1602.if !defined(BATCH_DELETE_OLD_FILES) 1603RM_I=-i 1604.else 1605RM_I=-v 1606.endif 1607 1608delete-old-files: 1609 @echo ">>> Removing old files (only deletes safe to delete libs)" 1610# Ask for every old file if the user really wants to remove it. 1611# It's annoying, but better safe than sorry. 1612# NB: We cannot pass the list of OLD_FILES as a parameter because the 1613# argument list will get too long. Using .for/.endfor make "loops" will make 1614# the Makefile parser segfault. 1615 @exec 3<&0; \ 1616 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1617 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1618 while read file; do \ 1619 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1620 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1621 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1622 fi; \ 1623 done 1624# Remove catpages without corresponding manpages. 1625 @exec 3<&0; \ 1626 find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1627 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1628 while read catpage; do \ 1629 read manpage; \ 1630 if [ ! -e "$${manpage}" ]; then \ 1631 rm ${RM_I} $${catpage} <&3; \ 1632 fi; \ 1633 done 1634 @echo ">>> Old files removed" 1635 1636check-old-files: 1637 @echo ">>> Checking for old files" 1638 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1639 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1640 while read file; do \ 1641 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1642 echo "${DESTDIR}/$${file}"; \ 1643 fi; \ 1644 done 1645# Check for catpages without corresponding manpages. 1646 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1647 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1648 while read catpage; do \ 1649 read manpage; \ 1650 if [ ! -e "$${manpage}" ]; then \ 1651 echo $${catpage}; \ 1652 fi; \ 1653 done 1654 1655delete-old-libs: 1656 @echo ">>> Removing old libraries" 1657 @echo "${OLD_LIBS_MESSAGE}" | fmt 1658 @exec 3<&0; \ 1659 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1660 -V OLD_LIBS | xargs -n1 | \ 1661 while read file; do \ 1662 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1663 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1664 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1665 fi; \ 1666 done 1667 @echo ">>> Old libraries removed" 1668 1669check-old-libs: 1670 @echo ">>> Checking for old libraries" 1671 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1672 -V OLD_LIBS | xargs -n1 | \ 1673 while read file; do \ 1674 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1675 echo "${DESTDIR}/$${file}"; \ 1676 fi; \ 1677 done 1678 1679delete-old-dirs: 1680 @echo ">>> Removing old directories" 1681 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1682 -V OLD_DIRS | xargs -n1 | \ 1683 while read dir; do \ 1684 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1685 rmdir -v "${DESTDIR}/$${dir}" || true; \ 1686 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1687 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1688 fi; \ 1689 done 1690 @echo ">>> Old directories removed" 1691 1692check-old-dirs: 1693 @echo ">>> Checking for old directories" 1694 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1695 -V OLD_DIRS | xargs -n1 | \ 1696 while read dir; do \ 1697 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1698 echo "${DESTDIR}/$${dir}"; \ 1699 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1700 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1701 fi; \ 1702 done 1703 1704delete-old: delete-old-files delete-old-dirs 1705 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1706 1707check-old: check-old-files check-old-libs check-old-dirs 1708 @echo "To remove old files and directories run '${MAKE} delete-old'." 1709 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1710 1711.endif 1712 1713# 1714# showconfig - show build configuration. 1715# 1716showconfig: 1717 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort 1718 1719.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 1720DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 1721 1722.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 1723.if exists(${KERNCONFDIR}/${KERNCONF}) 1724FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 1725 ${KERNCONFDIR}/${KERNCONF} ; echo 1726.endif 1727.endif 1728 1729.endif 1730 1731.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 1732DTBOUTPUTPATH= ${.CURDIR} 1733.endif 1734 1735# 1736# Build 'standalone' Device Tree Blob 1737# 1738builddtb: 1739 @if [ "${FDT_DTS_FILE}" = "" ]; then \ 1740 echo "ERROR: FDT_DTS_FILE must be specified!"; \ 1741 exit 1; \ 1742 fi; \ 1743 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \ 1744 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \ 1745 exist!"; \ 1746 exit 1; \ 1747 fi; \ 1748 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \ 1749 echo "WARNING: DTB will be placed in the current working \ 1750 directory"; \ 1751 fi 1752 @PATH=${TMPPATH} \ 1753 dtc -O dtb -o \ 1754 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \ 1755 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} 1756 1757############### 1758 1759.if defined(XDEV) && defined(XDEV_ARCH) 1760 1761.if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH} 1762XDEV_CPUTYPE?=${CPUTYPE} 1763.else 1764XDEV_CPUTYPE?=${TARGET_CPUTYPE} 1765.endif 1766 1767NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ 1768 -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \ 1769 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \ 1770 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \ 1771 CPUTYPE=${XDEV_CPUTYPE} 1772 1773XDDIR=${XDEV_ARCH}-freebsd 1774XDTP=/usr/${XDDIR} 1775CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ 1776 INSTALL="sh ${.CURDIR}/tools/install.sh" 1777CDENV= ${CDBENV} \ 1778 _SHLIBDIRPREFIX=${XDDESTDIR} \ 1779 TOOLS_PREFIX=${XDDESTDIR} 1780CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \ 1781 -B${XDDESTDIR}/usr/lib 1782CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" \ 1783 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH} 1784 1785CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp 1786CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1787CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1788XDDESTDIR=${DESTDIR}${XDTP} 1789.if !defined(OSREL) 1790OSREL!= uname -r | sed -e 's/[-(].*//' 1791.endif 1792 1793.ORDER: xdev-build xdev-install 1794xdev: xdev-build xdev-install 1795 1796.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 1797xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 1798 1799_xb-worldtmp: 1800 mkdir -p ${CDTMP}/usr 1801 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1802 -p ${CDTMP}/usr >/dev/null 1803 1804_xb-bootstrap-tools: 1805.for _tool in \ 1806 ${_clang_tblgen} 1807 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1808 cd ${.CURDIR}/${_tool}; \ 1809 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 1810 ${CDMAKE} DIRPRFX=${_tool}/ depend; \ 1811 ${CDMAKE} DIRPRFX=${_tool}/ all; \ 1812 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install 1813.endfor 1814 1815_xb-build-tools: 1816 ${_+_}@cd ${.CURDIR}; \ 1817 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools 1818 1819_xb-cross-tools: 1820.for _tool in \ 1821 gnu/usr.bin/binutils \ 1822 gnu/usr.bin/cc \ 1823 usr.bin/ar \ 1824 ${_clang_libs} \ 1825 ${_clang} 1826 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ 1827 cd ${.CURDIR}/${_tool}; \ 1828 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 1829 ${CDMAKE} DIRPRFX=${_tool}/ depend; \ 1830 ${CDMAKE} DIRPRFX=${_tool}/ all 1831.endfor 1832 1833_xi-mtree: 1834 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 1835 mkdir -p ${XDDESTDIR} 1836 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 1837 -p ${XDDESTDIR} >/dev/null 1838 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1839 -p ${XDDESTDIR}/usr >/dev/null 1840 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1841 -p ${XDDESTDIR}/usr/include >/dev/null 1842 1843.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1844xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1845 1846_xi-cross-tools: 1847 @echo "_xi-cross-tools" 1848.for _tool in \ 1849 gnu/usr.bin/binutils \ 1850 gnu/usr.bin/cc \ 1851 usr.bin/ar \ 1852 ${_clang} 1853 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 1854 cd ${.CURDIR}/${_tool}; \ 1855 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 1856.endfor 1857 1858_xi-includes: 1859 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \ 1860 DESTDIR=${XDDESTDIR} 1861 1862_xi-libraries: 1863 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 1864 DESTDIR=${XDDESTDIR} 1865 1866_xi-links: 1867 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 1868 for i in *; do \ 1869 ln -sf ../../${XDTP}/usr/bin/$$i \ 1870 ../../../../usr/bin/${XDDIR}-$$i; \ 1871 ln -sf ../../${XDTP}/usr/bin/$$i \ 1872 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ 1873 done 1874.else 1875xdev xdev-build xdev-install: 1876 @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target" 1877.endif
| 797.if defined(NO_ROOT) 798 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ 799 sed -e 's#^\./#./${dist}/#' >> ${METALOG} 800 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \ 801 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 802 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \ 803 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG} 804.endif 805.endfor 806 -mkdir ${DESTDIR}/${DISTDIR}/base 807 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 808 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \ 809 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \ 810 LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs 811.endif 812 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 813 ${IMAKEENV} rm -rf ${INSTALLTMP} 814.if make(distributeworld) 815.for dist in ${EXTRA_DISTRIBUTIONS} 816 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete 817.endfor 818.if defined(NO_ROOT) 819.for dist in base ${EXTRA_DISTRIBUTIONS} 820 @# For each file that exists in this dist, print the corresponding 821 @# line from the METALOG. This relies on the fact that 822 @# a line containing only the filename will sort immediatly before 823 @# the relevant mtree line. 824 cd ${DESTDIR}/${DISTDIR}; \ 825 find ./${dist} | sort -u ${METALOG} - | \ 826 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 827 ${DESTDIR}/${DISTDIR}/${dist}.meta 828.endfor 829.endif 830.endif 831 832packageworld: 833.for dist in base ${EXTRA_DISTRIBUTIONS} 834.if defined(NO_ROOT) 835 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 836 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \ 837 @${DESTDIR}/${DISTDIR}/${dist}.meta 838.else 839 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 840 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz . 841.endif 842.endfor 843 844# 845# reinstall 846# 847# If you have a build server, you can NFS mount the source and obj directories 848# and do a 'make reinstall' on the *client* to install new binaries from the 849# most recent server build. 850# 851reinstall: 852 @echo "--------------------------------------------------------------" 853 @echo ">>> Making hierarchy" 854 @echo "--------------------------------------------------------------" 855 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 856 LOCAL_MTREE=${LOCAL_MTREE} hierarchy 857 @echo 858 @echo "--------------------------------------------------------------" 859 @echo ">>> Installing everything" 860 @echo "--------------------------------------------------------------" 861 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 862.if defined(LIB32TMP) && ${MK_LIB32} != "no" 863 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 864.endif 865 866redistribute: 867 @echo "--------------------------------------------------------------" 868 @echo ">>> Distributing everything" 869 @echo "--------------------------------------------------------------" 870 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 871.if defined(LIB32TMP) && ${MK_LIB32} != "no" 872 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \ 873 DISTRIBUTION=lib32 874.endif 875 876distrib-dirs distribution: 877 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 878 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET} 879 880# 881# buildkernel and installkernel 882# 883# Which kernels to build and/or install is specified by setting 884# KERNCONF. If not defined a GENERIC kernel is built/installed. 885# Only the existing (depending TARGET) config files are used 886# for building kernels and only the first of these is designated 887# as the one being installed. 888# 889# Note that we have to use TARGET instead of TARGET_ARCH when 890# we're in kernel-land. Since only TARGET_ARCH is (expected) to 891# be set to cross-build, we have to make sure TARGET is set 892# properly. 893 894.if defined(KERNFAST) 895NO_KERNELCLEAN= t 896NO_KERNELCONFIG= t 897NO_KERNELDEPEND= t 898NO_KERNELOBJ= t 899# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 900.if !defined(KERNCONF) && ${KERNFAST} != "1" 901KERNCONF=${KERNFAST} 902.endif 903.endif 904.if ${TARGET_ARCH} == "powerpc64" 905KERNCONF?= GENERIC64 906.else 907KERNCONF?= GENERIC 908.endif 909INSTKERNNAME?= kernel 910 911KERNSRCDIR?= ${.CURDIR}/sys 912KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 913KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 914KERNCONFDIR?= ${KRNLCONFDIR} 915 916BUILDKERNELS= 917INSTALLKERNEL= 918.for _kernel in ${KERNCONF} 919.if exists(${KERNCONFDIR}/${_kernel}) 920BUILDKERNELS+= ${_kernel} 921.if empty(INSTALLKERNEL) 922INSTALLKERNEL= ${_kernel} 923.endif 924.endif 925.endfor 926 927# 928# buildkernel 929# 930# Builds all kernels defined by BUILDKERNELS. 931# 932buildkernel: 933.if empty(BUILDKERNELS) 934 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 935 false 936.endif 937 @echo 938.for _kernel in ${BUILDKERNELS} 939 @echo "--------------------------------------------------------------" 940 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 941 @echo "--------------------------------------------------------------" 942 @echo "===> ${_kernel}" 943 mkdir -p ${KRNLOBJDIR} 944.if !defined(NO_KERNELCONFIG) 945 @echo 946 @echo "--------------------------------------------------------------" 947 @echo ">>> stage 1: configuring the kernel" 948 @echo "--------------------------------------------------------------" 949 cd ${KRNLCONFDIR}; \ 950 PATH=${TMPPATH} \ 951 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 952 ${KERNCONFDIR}/${_kernel} 953.endif 954.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 955 @echo 956 @echo "--------------------------------------------------------------" 957 @echo ">>> stage 2.1: cleaning up the object tree" 958 @echo "--------------------------------------------------------------" 959 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 960.endif 961.if !defined(NO_KERNELOBJ) 962 @echo 963 @echo "--------------------------------------------------------------" 964 @echo ">>> stage 2.2: rebuilding the object tree" 965 @echo "--------------------------------------------------------------" 966 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 967.endif 968 @echo 969 @echo "--------------------------------------------------------------" 970 @echo ">>> stage 2.3: build tools" 971 @echo "--------------------------------------------------------------" 972 cd ${KRNLOBJDIR}/${_kernel}; \ 973 PATH=${BPATH}:${PATH} \ 974 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ 975 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \ 976 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile 977# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. 978.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) 979.for target in obj depend all 980 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ 981 PATH=${BPATH}:${PATH} \ 982 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ 983 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target} 984.endfor 985.endif 986.if !defined(NO_KERNELDEPEND) 987 @echo 988 @echo "--------------------------------------------------------------" 989 @echo ">>> stage 3.1: making dependencies" 990 @echo "--------------------------------------------------------------" 991 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ 992.endif 993 @echo 994 @echo "--------------------------------------------------------------" 995 @echo ">>> stage 3.2: building everything" 996 @echo "--------------------------------------------------------------" 997 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 998 @echo "--------------------------------------------------------------" 999 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 1000 @echo "--------------------------------------------------------------" 1001.endfor 1002 1003# 1004# installkernel, etc. 1005# 1006# Install the kernel defined by INSTALLKERNEL 1007# 1008installkernel installkernel.debug \ 1009reinstallkernel reinstallkernel.debug: installcheck 1010.if empty(INSTALLKERNEL) 1011 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1012 false 1013.endif 1014 @echo "--------------------------------------------------------------" 1015 @echo ">>> Installing kernel ${INSTALLKERNEL}" 1016 @echo "--------------------------------------------------------------" 1017 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1018 ${CROSSENV} PATH=${TMPPATH} \ 1019 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 1020 1021distributekernel distributekernel.debug: 1022.if empty(INSTALLKERNEL) 1023 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 1024 false 1025.endif 1026 mkdir -p ${DESTDIR}/${DISTDIR} 1027.if defined(NO_ROOT) 1028 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta 1029.endif 1030 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 1031 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \ 1032 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \ 1033 DESTDIR=${INSTALL_DDIR}/kernel \ 1034 ${.TARGET:S/distributekernel/install/} 1035.if defined(NO_ROOT) 1036 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \ 1037 ${DESTDIR}/${DISTDIR}/kernel.meta 1038.endif 1039.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 1040.if defined(NO_ROOT) 1041 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta 1042.endif 1043 cd ${KRNLOBJDIR}/${_kernel}; \ 1044 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \ 1045 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \ 1046 KERNEL=${INSTKERNNAME}.${_kernel} \ 1047 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \ 1048 ${.TARGET:S/distributekernel/install/} 1049 sed -e 's|^./kernel|.|' \ 1050 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \ 1051 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1052.endfor 1053 1054packagekernel: 1055.if defined(NO_ROOT) 1056 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1057 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \ 1058 @${DESTDIR}/${DISTDIR}/kernel.meta 1059.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 1060 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1061 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \ 1062 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta 1063.endfor 1064.else 1065 cd ${DESTDIR}/${DISTDIR}/kernel; \ 1066 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz . 1067.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 1068 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 1069 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz . 1070.endfor 1071.endif 1072 1073# 1074# doxygen 1075# 1076# Build the API documentation with doxygen 1077# 1078doxygen: 1079 @if [ ! -x `/usr/bin/which doxygen` ]; then \ 1080 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 1081 exit 1; \ 1082 fi 1083 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all 1084 1085# 1086# update 1087# 1088# Update the source tree(s), by running svn/svnup to update to the 1089# latest copy. 1090# 1091update: 1092.if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE) 1093 @echo "--------------------------------------------------------------" 1094 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported." 1095 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated" 1096 @echo "--------------------------------------------------------------" 1097 @exit 1 1098.endif 1099.if defined(SVN_UPDATE) 1100 @echo "--------------------------------------------------------------" 1101 @echo ">>> Updating ${.CURDIR} using Subversion" 1102 @echo "--------------------------------------------------------------" 1103 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS}) 1104.endif 1105 1106# 1107# ------------------------------------------------------------------------ 1108# 1109# From here onwards are utility targets used by the 'make world' and 1110# related targets. If your 'world' breaks, you may like to try to fix 1111# the problem and manually run the following targets to attempt to 1112# complete the build. Beware, this is *not* guaranteed to work, you 1113# need to have a pretty good grip on the current state of the system 1114# to attempt to manually finish it. If in doubt, 'make world' again. 1115# 1116 1117# 1118# legacy: Build compatibility shims for the next three targets 1119# 1120legacy: 1121.if ${BOOTSTRAPPING} < 700055 && ${BOOTSTRAPPING} != 0 1122 @echo "ERROR: Source upgrades from versions prior to 7.0 not supported."; \ 1123 false 1124.endif 1125.for _tool in tools/build 1126 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ 1127 cd ${.CURDIR}/${_tool}; \ 1128 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1129 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 1130 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1131 ${MAKE} DIRPRFX=${_tool}/ all; \ 1132 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1133.endfor 1134 1135# 1136# bootstrap-tools: Build tools needed for compatibility 1137# 1138.if ${MK_GAMES} != "no" 1139_strfile= games/fortune/strfile 1140.endif 1141 1142.if ${MK_CXX} != "no" 1143_gperf= gnu/usr.bin/gperf 1144.endif 1145 1146.if ${MK_GROFF} != "no" 1147_groff= gnu/usr.bin/groff 1148.endif 1149 1150.if ${BOOTSTRAPPING} < 800022 1151_ar= usr.bin/ar 1152.endif 1153 1154.if ${BOOTSTRAPPING} < 800013 1155_mklocale= usr.bin/mklocale 1156.endif 1157 1158.if ${BOOTSTRAPPING} < 900002 1159_sed= usr.bin/sed 1160.endif 1161 1162.if ${BOOTSTRAPPING} < 900006 1163_lex= usr.bin/lex 1164.endif 1165 1166.if ${BOOTSTRAPPING} < 1000002 1167_m4= usr.bin/m4 1168.endif 1169 1170.if ${BOOTSTRAPPING} < 1000013 1171_yacc= lib/liby \ 1172 usr.bin/yacc 1173.endif 1174 1175.if ${BOOTSTRAPPING} < 1000014 1176_crunch= usr.sbin/crunch 1177.endif 1178 1179.if ${BOOTSTRAPPING} < 1000026 1180_nmtree= lib/libnetbsd \ 1181 usr.sbin/nmtree 1182.endif 1183 1184.if ${BOOTSTRAPPING} < 1000027 1185_cat= bin/cat 1186.endif 1187 1188.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041 1189_awk= usr.bin/awk 1190.endif 1191 1192.if ${MK_BSNMP} != "no" && !exists(/usr/sbin/gensnmptree) 1193_gensnmptree= usr.sbin/bsnmpd/gensnmptree 1194.endif 1195 1196.if ${MK_CLANG} != "no" 1197_clang_tblgen= \ 1198 lib/clang/libllvmsupport \ 1199 lib/clang/libllvmtablegen \ 1200 usr.bin/clang/tblgen \ 1201 usr.bin/clang/clang-tblgen 1202.endif 1203 1204# dtrace tools are required for older bootstrap env and cross-build 1205.if ${MK_CDDL} != "no" && \ 1206 ((${BOOTSTRAPPING} < 800038 && \ 1207 !(${BOOTSTRAPPING} >= 700112 && ${BOOTSTRAPPING} < 799999)) \ 1208 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH})) 1209_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \ 1210 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge 1211.endif 1212 1213# Default to building the BSDL DTC, but build the GPL one if users explicitly 1214# request it. 1215_dtc= usr.bin/dtc 1216.if ${MK_GPL_DTC} != "no" 1217_dtc= gnu/usr.bin/dtc 1218.endif 1219 1220.if ${MK_KERBEROS} != "no" 1221_kerberos5_bootstrap_tools= \ 1222 kerberos5/tools/make-roken \ 1223 kerberos5/lib/libroken \ 1224 kerberos5/lib/libvers \ 1225 kerberos5/tools/asn1_compile \ 1226 kerberos5/tools/slc \ 1227 usr.bin/compile_et 1228.endif 1229 1230# Please document (add comment) why something is in 'bootstrap-tools'. 1231# Try to bound the building of the bootstrap-tool to just the 1232# FreeBSD versions that need the tool built at this stage of the build. 1233bootstrap-tools: 1234.for _tool in \ 1235 ${_clang_tblgen} \ 1236 ${_kerberos5_bootstrap_tools} \ 1237 ${_dtrace_tools} \ 1238 ${_strfile} \ 1239 ${_gperf} \ 1240 ${_groff} \ 1241 ${_ar} \ 1242 ${_dtc} \ 1243 ${_awk} \ 1244 ${_cat} \ 1245 usr.bin/lorder \ 1246 usr.bin/makewhatis \ 1247 ${_mklocale} \ 1248 usr.bin/rpcgen \ 1249 ${_sed} \ 1250 ${_yacc} \ 1251 ${_m4} \ 1252 ${_lex} \ 1253 lib/libmd \ 1254 usr.bin/xinstall \ 1255 ${_gensnmptree} \ 1256 usr.sbin/config \ 1257 ${_crunch} \ 1258 ${_nmtree} 1259 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1260 cd ${.CURDIR}/${_tool}; \ 1261 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1262 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1263 ${MAKE} DIRPRFX=${_tool}/ all; \ 1264 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1265.endfor 1266 1267# 1268# build-tools: Build special purpose build tools 1269# 1270.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) 1271_aicasm= sys/modules/aic7xxx/aicasm 1272.endif 1273 1274.if !defined(NO_SHARE) 1275_share= share/syscons/scrnmaps 1276.endif 1277 1278.if ${MK_GCC} != "no" 1279_gcc_tools= gnu/usr.bin/cc/cc_tools 1280.endif 1281 1282.if ${MK_RESCUE} != "no" 1283_rescue= rescue/rescue 1284.endif 1285 1286build-tools: 1287.for _tool in \ 1288 bin/csh \ 1289 bin/sh \ 1290 ${_rescue} \ 1291 ${LOCAL_TOOL_DIRS} \ 1292 lib/ncurses/ncurses \ 1293 lib/ncurses/ncursesw \ 1294 ${_share} \ 1295 ${_aicasm} \ 1296 usr.bin/awk \ 1297 lib/libmagic \ 1298 usr.bin/mkesdb_static \ 1299 usr.bin/mkcsmapper_static 1300 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 1301 cd ${.CURDIR}/${_tool}; \ 1302 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1303 ${MAKE} DIRPRFX=${_tool}/ build-tools 1304.endfor 1305.for _tool in \ 1306 ${_gcc_tools} 1307 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ 1308 cd ${.CURDIR}/${_tool}; \ 1309 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1310 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1311 ${MAKE} DIRPRFX=${_tool}/ all 1312.endfor 1313 1314# 1315# cross-tools: Build cross-building tools 1316# 1317.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035 1318.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 1319_btxld= usr.sbin/btxld 1320.endif 1321.endif 1322.if ${TARGET_ARCH} != ${MACHINE_ARCH} 1323.if ${MK_RESCUE} != "no" || defined(RELEASEDIR) 1324_crunchide= usr.sbin/crunch/crunchide 1325.endif 1326.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR) 1327_kgzip= usr.sbin/kgzip 1328.endif 1329.endif 1330 1331.if ${XAS:M/*} == "" && ${MK_BINUTILS} != "no" 1332_binutils= gnu/usr.bin/binutils 1333.endif 1334 1335# If an full path to an external cross compiler is given, don't build 1336# a cross compiler. 1337.if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no" 1338.if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") 1339_clang= usr.bin/clang 1340_clang_libs= lib/clang 1341.endif 1342 1343.if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98") 1344_cc= gnu/usr.bin/cc 1345.endif 1346.endif 1347 1348cross-tools: 1349.for _tool in \ 1350 ${_clang_libs} \ 1351 ${_clang} \ 1352 ${_binutils} \ 1353 ${_cc} \ 1354 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ 1355 ${_btxld} \ 1356 ${_crunchide} \ 1357 ${_kgzip} 1358 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1359 cd ${.CURDIR}/${_tool}; \ 1360 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1361 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1362 ${MAKE} DIRPRFX=${_tool}/ all; \ 1363 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 1364.endfor 1365 1366# 1367# hierarchy - ensure that all the needed directories are present 1368# 1369hierarchy hier: 1370.if defined(NO_ROOT) 1371 cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} \ 1372 -DNO_ROOT METALOG=${METALOG} distrib-dirs 1373.else 1374 cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs 1375.endif 1376 1377# 1378# libraries - build all libraries, and install them under ${DESTDIR}. 1379# 1380# The list of libraries with dependents (${_prebuild_libs}) and their 1381# interdependencies (__L) are built automatically by the 1382# ${.CURDIR}/tools/make_libdeps.sh script. 1383# 1384libraries: 1385 cd ${.CURDIR}; \ 1386 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 1387 ${MAKE} -f Makefile.inc1 _startup_libs; \ 1388 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 1389 ${MAKE} -f Makefile.inc1 _generic_libs; 1390 1391# 1392# static libgcc.a prerequisite for shared libc 1393# 1394_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt 1395 1396# These dependencies are not automatically generated: 1397# 1398# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 1399# all shared libraries for ELF. 1400# 1401_startup_libs= gnu/lib/csu 1402.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 1403_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 1404.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}) 1405_startup_libs+= lib/csu/${MACHINE_ARCH} 1406.else 1407_startup_libs+= lib/csu/${MACHINE_CPUARCH} 1408.endif 1409_startup_libs+= gnu/lib/libgcc 1410_startup_libs+= lib/libcompiler_rt 1411_startup_libs+= lib/libc 1412.if ${MK_LIBCPLUSPLUS} != "no" 1413_startup_libs+= lib/libcxxrt 1414.endif 1415 1416gnu/lib/libgcc__L: lib/libc__L 1417.if ${MK_LIBCPLUSPLUS} != "no" 1418lib/libcxxrt__L: gnu/lib/libgcc__L 1419.endif 1420 1421_prebuild_libs= ${_kerberos5_lib_libasn1} \ 1422 ${_kerberos5_lib_libhdb} \ 1423 ${_kerberos5_lib_libheimbase} \ 1424 ${_kerberos5_lib_libheimntlm} \ 1425 ${_kerberos5_lib_libheimsqlite} \ 1426 ${_kerberos5_lib_libheimipcc} \ 1427 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 1428 ${_kerberos5_lib_libroken} \ 1429 ${_kerberos5_lib_libwind} \ 1430 ${_lib_atf_libatf_c} \ 1431 lib/libbz2 ${_libcom_err} lib/libcrypt \ 1432 lib/libelf lib/libexpat \ 1433 ${_lib_libgssapi} ${_lib_libipx} \ 1434 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \ 1435 lib/ncurses/ncurses lib/ncurses/ncursesw \ 1436 lib/libopie lib/libpam ${_lib_libthr} \ 1437 lib/libradius lib/libsbuf lib/libtacplus \ 1438 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ 1439 ${_cddl_lib_libzfs_core} \ 1440 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ 1441 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ 1442 ${_secure_lib_libssl} 1443 1444.if ${MK_ATF} != "no" 1445_lib_atf_libatf_c= lib/atf/libatf-c 1446.endif 1447 1448.if ${MK_LIBTHR} != "no" 1449_lib_libthr= lib/libthr 1450.endif 1451 1452.if ${MK_OFED} != "no" 1453_ofed_lib= contrib/ofed/usr.lib/ 1454.endif 1455 1456_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} 1457.for _DIR in ${LOCAL_LIB_DIRS} 1458.if exists(${.CURDIR}/${_DIR}/Makefile) 1459_generic_libs+= ${_DIR} 1460.endif 1461.endfor 1462 1463lib/libopie__L lib/libtacplus__L: lib/libmd__L 1464 1465.if ${MK_CDDL} != "no" 1466_cddl_lib_libumem= cddl/lib/libumem 1467_cddl_lib_libnvpair= cddl/lib/libnvpair 1468_cddl_lib_libzfs_core= cddl/lib/libzfs_core 1469_cddl_lib= cddl/lib 1470cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L 1471.endif 1472 1473.if ${MK_CRYPT} != "no" 1474.if ${MK_OPENSSL} != "no" 1475_secure_lib_libcrypto= secure/lib/libcrypto 1476_secure_lib_libssl= secure/lib/libssl 1477lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 1478.if ${MK_OPENSSH} != "no" 1479_secure_lib_libssh= secure/lib/libssh 1480secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 1481.if ${MK_KERBEROS_SUPPORT} != "no" 1482secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 1483 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 1484 lib/libmd__L kerberos5/lib/libroken__L 1485.endif 1486.endif 1487.endif 1488_secure_lib= secure/lib 1489.endif 1490 1491.if ${MK_KERBEROS} != "no" 1492kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L 1493kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1494 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ 1495 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L 1496kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ 1497 kerberos5/lib/libroken__L lib/libcom_err__L 1498kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1499 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L 1500kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1501 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ 1502 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ 1503 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L 1504kerberos5/lib/libroken__L: lib/libcrypt__L 1505kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L 1506kerberos5/lib/libheimbase__L: lib/libthr__L 1507kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L 1508kerberos5/lib/libheimsqlite__L: lib/libthr__L 1509.endif 1510 1511.if ${MK_GSSAPI} != "no" 1512_lib_libgssapi= lib/libgssapi 1513.endif 1514 1515.if ${MK_IPX} != "no" 1516_lib_libipx= lib/libipx 1517.endif 1518 1519.if ${MK_KERBEROS} != "no" 1520_kerberos5_lib= kerberos5/lib 1521_kerberos5_lib_libasn1= kerberos5/lib/libasn1 1522_kerberos5_lib_libhdb= kerberos5/lib/libhdb 1523_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase 1524_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 1525_kerberos5_lib_libhx509= kerberos5/lib/libhx509 1526_kerberos5_lib_libroken= kerberos5/lib/libroken 1527_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 1528_kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite 1529_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc 1530_kerberos5_lib_libwind= kerberos5/lib/libwind 1531_libcom_err= lib/libcom_err 1532.endif 1533 1534.if ${MK_NIS} != "no" 1535_lib_libypclnt= lib/libypclnt 1536.endif 1537 1538.if ${MK_OPENSSL} == "no" 1539lib/libradius__L: lib/libmd__L 1540.endif 1541 1542.for _lib in ${_prereq_libs} 1543${_lib}__PL: .PHONY 1544.if exists(${.CURDIR}/${_lib}) 1545 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1546 cd ${.CURDIR}/${_lib}; \ 1547 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1548 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1549 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \ 1550 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install 1551.endif 1552.endfor 1553 1554.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 1555${_lib}__L: .PHONY 1556.if exists(${.CURDIR}/${_lib}) 1557 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1558 cd ${.CURDIR}/${_lib}; \ 1559 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1560 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1561 ${MAKE} DIRPRFX=${_lib}/ all; \ 1562 ${MAKE} DIRPRFX=${_lib}/ install 1563.endif 1564.endfor 1565 1566# libpam is special: we need to build static PAM modules before 1567# static PAM library, and dynamic PAM library before dynamic PAM 1568# modules. 1569lib/libpam__L: .PHONY 1570 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ 1571 cd ${.CURDIR}/lib/libpam; \ 1572 ${MAKE} DIRPRFX=lib/libpam/ obj; \ 1573 ${MAKE} DIRPRFX=lib/libpam/ depend; \ 1574 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ 1575 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install 1576 1577_prereq_libs: ${_prereq_libs:S/$/__PL/} 1578_startup_libs: ${_startup_libs:S/$/__L/} 1579_prebuild_libs: ${_prebuild_libs:S/$/__L/} 1580_generic_libs: ${_generic_libs:S/$/__L/} 1581 1582.for __target in all clean cleandepend cleandir depend includes obj 1583.for entry in ${SUBDIR} 1584${entry}.${__target}__D: .PHONY 1585 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 1586 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ 1587 edir=${entry}.${MACHINE_ARCH}; \ 1588 cd ${.CURDIR}/$${edir}; \ 1589 else \ 1590 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ 1591 edir=${entry}; \ 1592 cd ${.CURDIR}/$${edir}; \ 1593 fi; \ 1594 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 1595.endfor 1596par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 1597.endfor 1598 1599.include <bsd.subdir.mk> 1600 1601.if make(check-old) || make(check-old-dirs) || \ 1602 make(check-old-files) || make(check-old-libs) || \ 1603 make(delete-old) || make(delete-old-dirs) || \ 1604 make(delete-old-files) || make(delete-old-libs) 1605 1606# 1607# check for / delete old files section 1608# 1609 1610.include "ObsoleteFiles.inc" 1611 1612OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 1613else you can not start such an application. Consult UPDATING for more \ 1614information regarding how to cope with the removal/revision bump of a \ 1615specific library." 1616 1617.if !defined(BATCH_DELETE_OLD_FILES) 1618RM_I=-i 1619.else 1620RM_I=-v 1621.endif 1622 1623delete-old-files: 1624 @echo ">>> Removing old files (only deletes safe to delete libs)" 1625# Ask for every old file if the user really wants to remove it. 1626# It's annoying, but better safe than sorry. 1627# NB: We cannot pass the list of OLD_FILES as a parameter because the 1628# argument list will get too long. Using .for/.endfor make "loops" will make 1629# the Makefile parser segfault. 1630 @exec 3<&0; \ 1631 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1632 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1633 while read file; do \ 1634 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1635 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1636 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1637 fi; \ 1638 done 1639# Remove catpages without corresponding manpages. 1640 @exec 3<&0; \ 1641 find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1642 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1643 while read catpage; do \ 1644 read manpage; \ 1645 if [ ! -e "$${manpage}" ]; then \ 1646 rm ${RM_I} $${catpage} <&3; \ 1647 fi; \ 1648 done 1649 @echo ">>> Old files removed" 1650 1651check-old-files: 1652 @echo ">>> Checking for old files" 1653 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1654 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1655 while read file; do \ 1656 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1657 echo "${DESTDIR}/$${file}"; \ 1658 fi; \ 1659 done 1660# Check for catpages without corresponding manpages. 1661 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1662 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1663 while read catpage; do \ 1664 read manpage; \ 1665 if [ ! -e "$${manpage}" ]; then \ 1666 echo $${catpage}; \ 1667 fi; \ 1668 done 1669 1670delete-old-libs: 1671 @echo ">>> Removing old libraries" 1672 @echo "${OLD_LIBS_MESSAGE}" | fmt 1673 @exec 3<&0; \ 1674 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1675 -V OLD_LIBS | xargs -n1 | \ 1676 while read file; do \ 1677 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1678 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1679 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1680 fi; \ 1681 done 1682 @echo ">>> Old libraries removed" 1683 1684check-old-libs: 1685 @echo ">>> Checking for old libraries" 1686 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1687 -V OLD_LIBS | xargs -n1 | \ 1688 while read file; do \ 1689 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1690 echo "${DESTDIR}/$${file}"; \ 1691 fi; \ 1692 done 1693 1694delete-old-dirs: 1695 @echo ">>> Removing old directories" 1696 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1697 -V OLD_DIRS | xargs -n1 | \ 1698 while read dir; do \ 1699 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1700 rmdir -v "${DESTDIR}/$${dir}" || true; \ 1701 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1702 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1703 fi; \ 1704 done 1705 @echo ">>> Old directories removed" 1706 1707check-old-dirs: 1708 @echo ">>> Checking for old directories" 1709 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1710 -V OLD_DIRS | xargs -n1 | \ 1711 while read dir; do \ 1712 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1713 echo "${DESTDIR}/$${dir}"; \ 1714 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1715 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1716 fi; \ 1717 done 1718 1719delete-old: delete-old-files delete-old-dirs 1720 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1721 1722check-old: check-old-files check-old-libs check-old-dirs 1723 @echo "To remove old files and directories run '${MAKE} delete-old'." 1724 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1725 1726.endif 1727 1728# 1729# showconfig - show build configuration. 1730# 1731showconfig: 1732 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort 1733 1734.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 1735DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 1736 1737.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 1738.if exists(${KERNCONFDIR}/${KERNCONF}) 1739FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 1740 ${KERNCONFDIR}/${KERNCONF} ; echo 1741.endif 1742.endif 1743 1744.endif 1745 1746.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 1747DTBOUTPUTPATH= ${.CURDIR} 1748.endif 1749 1750# 1751# Build 'standalone' Device Tree Blob 1752# 1753builddtb: 1754 @if [ "${FDT_DTS_FILE}" = "" ]; then \ 1755 echo "ERROR: FDT_DTS_FILE must be specified!"; \ 1756 exit 1; \ 1757 fi; \ 1758 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \ 1759 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \ 1760 exist!"; \ 1761 exit 1; \ 1762 fi; \ 1763 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \ 1764 echo "WARNING: DTB will be placed in the current working \ 1765 directory"; \ 1766 fi 1767 @PATH=${TMPPATH} \ 1768 dtc -O dtb -o \ 1769 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \ 1770 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} 1771 1772############### 1773 1774.if defined(XDEV) && defined(XDEV_ARCH) 1775 1776.if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH} 1777XDEV_CPUTYPE?=${CPUTYPE} 1778.else 1779XDEV_CPUTYPE?=${TARGET_CPUTYPE} 1780.endif 1781 1782NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ 1783 -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \ 1784 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \ 1785 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \ 1786 CPUTYPE=${XDEV_CPUTYPE} 1787 1788XDDIR=${XDEV_ARCH}-freebsd 1789XDTP=/usr/${XDDIR} 1790CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ 1791 INSTALL="sh ${.CURDIR}/tools/install.sh" 1792CDENV= ${CDBENV} \ 1793 _SHLIBDIRPREFIX=${XDDESTDIR} \ 1794 TOOLS_PREFIX=${XDDESTDIR} 1795CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \ 1796 -B${XDDESTDIR}/usr/lib 1797CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" \ 1798 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH} 1799 1800CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp 1801CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1802CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1803XDDESTDIR=${DESTDIR}${XDTP} 1804.if !defined(OSREL) 1805OSREL!= uname -r | sed -e 's/[-(].*//' 1806.endif 1807 1808.ORDER: xdev-build xdev-install 1809xdev: xdev-build xdev-install 1810 1811.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 1812xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 1813 1814_xb-worldtmp: 1815 mkdir -p ${CDTMP}/usr 1816 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1817 -p ${CDTMP}/usr >/dev/null 1818 1819_xb-bootstrap-tools: 1820.for _tool in \ 1821 ${_clang_tblgen} 1822 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1823 cd ${.CURDIR}/${_tool}; \ 1824 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 1825 ${CDMAKE} DIRPRFX=${_tool}/ depend; \ 1826 ${CDMAKE} DIRPRFX=${_tool}/ all; \ 1827 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install 1828.endfor 1829 1830_xb-build-tools: 1831 ${_+_}@cd ${.CURDIR}; \ 1832 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools 1833 1834_xb-cross-tools: 1835.for _tool in \ 1836 gnu/usr.bin/binutils \ 1837 gnu/usr.bin/cc \ 1838 usr.bin/ar \ 1839 ${_clang_libs} \ 1840 ${_clang} 1841 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ 1842 cd ${.CURDIR}/${_tool}; \ 1843 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 1844 ${CDMAKE} DIRPRFX=${_tool}/ depend; \ 1845 ${CDMAKE} DIRPRFX=${_tool}/ all 1846.endfor 1847 1848_xi-mtree: 1849 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 1850 mkdir -p ${XDDESTDIR} 1851 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 1852 -p ${XDDESTDIR} >/dev/null 1853 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1854 -p ${XDDESTDIR}/usr >/dev/null 1855 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1856 -p ${XDDESTDIR}/usr/include >/dev/null 1857 1858.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1859xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1860 1861_xi-cross-tools: 1862 @echo "_xi-cross-tools" 1863.for _tool in \ 1864 gnu/usr.bin/binutils \ 1865 gnu/usr.bin/cc \ 1866 usr.bin/ar \ 1867 ${_clang} 1868 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 1869 cd ${.CURDIR}/${_tool}; \ 1870 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 1871.endfor 1872 1873_xi-includes: 1874 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \ 1875 DESTDIR=${XDDESTDIR} 1876 1877_xi-libraries: 1878 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 1879 DESTDIR=${XDDESTDIR} 1880 1881_xi-links: 1882 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 1883 for i in *; do \ 1884 ln -sf ../../${XDTP}/usr/bin/$$i \ 1885 ../../../../usr/bin/${XDDIR}-$$i; \ 1886 ln -sf ../../${XDTP}/usr/bin/$$i \ 1887 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ 1888 done 1889.else 1890xdev xdev-build xdev-install: 1891 @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target" 1892.endif
|