1# 2# $FreeBSD$ 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# -DNO_SHARE do not go into share subdir 8# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ} 9# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 10# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 11# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel 12# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel 13# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 14# -DNO_DOCUPDATE do not update doc in ${MAKE} update 15# -DNO_WWWUPDATE do not update www in ${MAKE} update 16# -DNO_CTF do not run the DTrace CTF conversion tools on built objects 17# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 18# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target 19# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools 20# list 21# TARGET="machine" to crossbuild world for a different machine type 22# TARGET_ARCH= may be required when a TARGET supports multiple endians 23# BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh) 24 25# 26# The intended user-driven targets are: 27# buildworld - rebuild *everything*, including glue to help do upgrades 28# installworld- install everything built by "buildworld" 29# doxygen - build API documentation of the kernel 30# update - convenient way to update your source tree (eg: cvsup/cvs) 31# 32# Standard targets (not defined here) are documented in the makefiles in 33# /usr/share/mk. These include: 34# obj depend all install clean cleandepend cleanobj 35 36# You are supposed to define both of these when calling Makefile.inc1 37# directly. However, some old scripts don't. Cope for the moment, but 38# issue a new warning for a transition period. 39.if defined(TARGET) && !defined(TARGET_ARCH) 40.warning "You must pass both TARGET and TARGET_ARCH to Makefile.inc1. Setting TARGET_ARCH=${TARGET}." 41TARGET_ARCH=${TARGET} 42.endif 43.if !defined(TARGET) || !defined(TARGET_ARCH) 44.error "Both TARGET and TARGET_ARCH must be defined." 45.endif 46 47.include <bsd.own.mk> 48.include <bsd.arch.inc.mk> 49.include <bsd.compiler.mk> 50 51# We must do share/info early so that installation of info `dir' 52# entries works correctly. Do it first since it is less likely to 53# grow dependencies on include and lib than vice versa. 54# 55# We must do lib/ and libexec/ before bin/, because if installworld 56# installs a new /bin/sh, the 'make' command will *immediately* 57# use that new version. And the new (dynamically-linked) /bin/sh 58# will expect to find appropriate libraries in /lib and /libexec. 59# 60SUBDIR= share/info lib libexec 61SUBDIR+=bin 62.if ${MK_GAMES} != "no" 63SUBDIR+=games 64.endif 65.if ${MK_CDDL} != "no" 66SUBDIR+=cddl 67.endif 68SUBDIR+=gnu include 69.if ${MK_KERBEROS} != "no" 70SUBDIR+=kerberos5 71.endif 72.if ${MK_RESCUE} != "no" 73SUBDIR+=rescue 74.endif 75SUBDIR+=sbin 76.if ${MK_CRYPT} != "no" 77SUBDIR+=secure 78.endif 79.if !defined(NO_SHARE) 80SUBDIR+=share 81.endif 82SUBDIR+=sys usr.bin usr.sbin 83.if ${MK_OFED} != "no" 84SUBDIR+=contrib/ofed 85.endif 86# 87# We must do etc/ last for install/distribute to work. 88# 89SUBDIR+=etc 90 91# These are last, since it is nice to at least get the base system 92# rebuilt before you do them. 93.for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS} 94.if exists(${.CURDIR}/${_DIR}/Makefile) 95SUBDIR+= ${_DIR} 96.endif 97.endfor 98 99.if defined(SUBDIR_OVERRIDE) 100SUBDIR= ${SUBDIR_OVERRIDE} 101.endif 102 103.if defined(NOCLEAN) 104NO_CLEAN= ${NOCLEAN} 105.endif 106.if defined(NO_CLEANDIR) 107CLEANDIR= clean cleandepend 108.else 109CLEANDIR= cleandir 110.endif 111 112LOCAL_TOOL_DIRS?= 113 114BUILDENV_SHELL?=/bin/sh 115 116CVS?= cvs 117CVSFLAGS?= -A -P -d -I! 118SVN?= svn 119SVNFLAGS?= -r HEAD 120SUP?= /usr/bin/csup 121SUPFLAGS?= -g -L 2 122.if defined(SUPHOST) 123SUPFLAGS+= -h ${SUPHOST} 124.endif 125 126MAKEOBJDIRPREFIX?= /usr/obj 127.if !defined(OSRELDATE) 128.if exists(/usr/include/osreldate.h) 129OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 130 /usr/include/osreldate.h 131.else 132OSRELDATE= 0 133.endif 134.endif 135 136.if !defined(VERSION) 137VERSION!= uname -srp 138VERSION+= ${OSRELDATE} 139.endif 140 141KNOWN_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 142.if ${TARGET} == ${TARGET_ARCH} 143_t= ${TARGET} 144.else 145_t= ${TARGET_ARCH}/${TARGET} 146.endif 147.for _t in ${_t} 148.if empty(KNOWN_ARCHES:M${_t}) 149.error Unknown target ${TARGET_ARCH}:${TARGET}. 150.endif 151.endfor 152 153.if ${TARGET} == ${MACHINE} 154TARGET_CPUTYPE?=${CPUTYPE} 155.else 156TARGET_CPUTYPE?= 157.endif 158 159.if !empty(TARGET_CPUTYPE) 160_TARGET_CPUTYPE=${TARGET_CPUTYPE} 161.else 162_TARGET_CPUTYPE=dummy 163.endif 164_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ 165 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE 166.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 167.error CPUTYPE global should be set with ?=. 168.endif 169.if make(buildworld) 170BUILD_ARCH!= uname -p 171.if ${MACHINE_ARCH} != ${BUILD_ARCH} 172.error To cross-build, set TARGET_ARCH. 173.endif 174.endif 175.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING) 176OBJTREE= ${MAKEOBJDIRPREFIX} 177.else 178OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} 179.endif 180WORLDTMP= ${OBJTREE}${.CURDIR}/tmp 181# /usr/games added for fortune which depend on strfile 182BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games 183XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games 184STRICTTMPPATH= ${BPATH}:${XPATH} 185TMPPATH= ${STRICTTMPPATH}:${PATH} 186 187# 188# Avoid running mktemp(1) unless actually needed. 189# It may not be functional, e.g., due to new ABI 190# when in the middle of installing over this system. 191# 192.if make(distributeworld) || make(installworld) 193INSTALLTMP!= /usr/bin/mktemp -d -u -t install 194.endif 195 196# 197# Building a world goes through the following stages 198# 199# 1. legacy stage [BMAKE] 200# This stage is responsible for creating compatibility 201# shims that are needed by the bootstrap-tools, 202# build-tools and cross-tools stages. 203# 1. bootstrap-tools stage [BMAKE] 204# This stage is responsible for creating programs that 205# are needed for backward compatibility reasons. They 206# are not built as cross-tools. 207# 2. build-tools stage [TMAKE] 208# This stage is responsible for creating the object 209# tree and building any tools that are needed during 210# the build process. 211# 3. cross-tools stage [XMAKE] 212# This stage is responsible for creating any tools that 213# are needed for cross-builds. A cross-compiler is one 214# of them. 215# 4. world stage [WMAKE] 216# This stage actually builds the world. 217# 5. install stage (optional) [IMAKE] 218# This stage installs a previously built world. 219# 220 221BOOTSTRAPPING?= 0 222 223# Common environment for world related stages 224CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ 225 MACHINE_ARCH=${TARGET_ARCH} \ 226 MACHINE=${TARGET} \ 227 CPUTYPE=${TARGET_CPUTYPE} 228.if ${MK_GROFF} != "no" 229CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 230 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 231 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 232.endif 233 234# bootstrap-tools stage 235BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 236 PATH=${BPATH}:${PATH} \ 237 WORLDTMP=${WORLDTMP} \ 238 VERSION="${VERSION}" \ 239 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ 240 COMPILER_TYPE=${COMPILER_TYPE} 241BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 242 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 243 DESTDIR= \ 244 BOOTSTRAPPING=${OSRELDATE} \ 245 SSP_CFLAGS= \ 246 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ 247 -DNO_PIC -DNO_PROFILE -DNO_SHARED \ 248 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD 249 250# build-tools stage 251TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 252 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 253 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 254 DESTDIR= \ 255 BOOTSTRAPPING=${OSRELDATE} \ 256 SSP_CFLAGS= \ 257 -DNO_LINT \ 258 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD 259 260# cross-tools stage 261XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ 262 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 263 -DWITHOUT_GDB 264 265# world stage 266WMAKEENV= ${CROSSENV} \ 267 _SHLIBDIRPREFIX=${WORLDTMP} \ 268 _LDSCRIPTROOT= \ 269 VERSION="${VERSION}" \ 270 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 271 PATH=${TMPPATH} 272.if ${MK_CDDL} == "no" 273WMAKEENV+= NO_CTF=1 274.endif 275.if ${CC:T:Mgcc} == "gcc" 276WMAKE_COMPILER_TYPE= gcc 277.elif ${CC:T:Mclang} == "clang" 278WMAKE_COMPILER_TYPE= clang 279.elif ${MK_CLANG_IS_CC} == "no" 280WMAKE_COMPILER_TYPE= gcc 281.else 282WMAKE_COMPILER_TYPE= clang 283.endif 284WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE} 285WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} 286 287.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" 288# 32 bit world 289LIB32TMP= ${OBJTREE}${.CURDIR}/lib32 290 291.if ${TARGET_ARCH} == "amd64" 292.if empty(TARGET_CPUTYPE) 293LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 294.else 295LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} 296.endif 297LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ 298 MACHINE_CPU="i686 mmx sse sse2" 299LIB32WMAKEFLAGS= \ 300 AS="${AS} --32" \ 301 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" 302 303.elif ${TARGET_ARCH} == "powerpc64" 304.if empty(TARGET_CPUTYPE) 305LIB32CPUFLAGS= -mcpu=powerpc 306.else 307LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} 308.endif 309LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc 310LIB32WMAKEFLAGS= \ 311 LD="${LD} -m elf32ppc_fbsd" 312.endif 313 314 315LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \ 316 -isystem ${LIB32TMP}/usr/include/ \ 317 -L${LIB32TMP}/usr/lib32 \ 318 -B${LIB32TMP}/usr/lib32 319 320# Yes, the flags are redundant. 321LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ 322 _SHLIBDIRPREFIX=${LIB32TMP} \ 323 _LDSCRIPTROOT=${LIB32TMP} \ 324 VERSION="${VERSION}" \ 325 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 326 PATH=${TMPPATH} \ 327 LIBDIR=/usr/lib32 \ 328 SHLIBDIR=/usr/lib32 \ 329 COMPILER_TYPE=${WMAKE_COMPILER_TYPE} 330LIB32WMAKEFLAGS+= \ 331 CC="${CC} ${LIB32FLAGS}" \ 332 CXX="${CXX} ${LIB32FLAGS}" \ 333 DESTDIR=${LIB32TMP} \ 334 -DCOMPAT_32BIT \ 335 -DNO_CPU_CFLAGS \ 336 -DNO_CTF \ 337 -DNO_LINT 338 339LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \ 340 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML 341LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS 342.endif 343 344# install stage 345IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*} 346IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 347.if empty(.MAKEFLAGS:M-n) 348IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ 349 LD_LIBRARY_PATH=${INSTALLTMP} \ 350 PATH_LOCALE=${INSTALLTMP}/locale 351IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh 352.else 353IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} 354.endif 355 356# kernel stage 357KMAKEENV= ${WMAKEENV} 358KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} 359 360# 361# buildworld 362# 363# Attempt to rebuild the entire system, with reasonable chance of 364# success, regardless of how old your existing system is. 365# 366_worldtmp: 367.if ${.CURDIR:C/[^,]//g} != "" 368# The m4 build of sendmail files doesn't like it if ',' is used 369# anywhere in the path of it's files. 370 @echo 371 @echo "*** Error: path to source tree contains a comma ','" 372 @echo 373 false 374.endif 375 @echo 376 @echo "--------------------------------------------------------------" 377 @echo ">>> Rebuilding the temporary build tree" 378 @echo "--------------------------------------------------------------" 379.if !defined(NO_CLEAN) 380 rm -rf ${WORLDTMP} 381.if defined(LIB32TMP) 382 rm -rf ${LIB32TMP} 383.endif 384.else 385 rm -rf ${WORLDTMP}/legacy/usr/include 386# XXX - These three can depend on any header file. 387 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c 388 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c 389 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c 390.endif 391.for _dir in \ 392 lib usr legacy/usr 393 mkdir -p ${WORLDTMP}/${_dir} 394.endfor 395 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 396 -p ${WORLDTMP}/legacy/usr >/dev/null 397.if ${MK_GROFF} != "no" 398 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \ 399 -p ${WORLDTMP}/legacy/usr >/dev/null 400.endif 401 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 402 -p ${WORLDTMP}/usr >/dev/null 403 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 404 -p ${WORLDTMP}/usr/include >/dev/null 405 ln -sf ${.CURDIR}/sys ${WORLDTMP} 406.if ${MK_BIND_LIBS} != "no" 407 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \ 408 -p ${WORLDTMP}/usr/include >/dev/null 409.endif 410_legacy: 411 @echo 412 @echo "--------------------------------------------------------------" 413 @echo ">>> stage 1.1: legacy release compatibility shims" 414 @echo "--------------------------------------------------------------" 415 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy 416_bootstrap-tools: 417 @echo 418 @echo "--------------------------------------------------------------" 419 @echo ">>> stage 1.2: bootstrap tools" 420 @echo "--------------------------------------------------------------" 421 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools 422_cleanobj: 423.if !defined(NO_CLEAN) 424 @echo 425 @echo "--------------------------------------------------------------" 426 @echo ">>> stage 2.1: cleaning up the object tree" 427 @echo "--------------------------------------------------------------" 428 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} 429.if defined(LIB32TMP) 430 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/} 431.endif 432.endif 433_obj: 434 @echo 435 @echo "--------------------------------------------------------------" 436 @echo ">>> stage 2.2: rebuilding the object tree" 437 @echo "--------------------------------------------------------------" 438 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj 439_build-tools: 440 @echo 441 @echo "--------------------------------------------------------------" 442 @echo ">>> stage 2.3: build tools" 443 @echo "--------------------------------------------------------------" 444 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools 445_cross-tools: 446 @echo 447 @echo "--------------------------------------------------------------" 448 @echo ">>> stage 3: cross tools" 449 @echo "--------------------------------------------------------------" 450 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools 451_includes: 452 @echo 453 @echo "--------------------------------------------------------------" 454 @echo ">>> stage 4.1: building includes" 455 @echo "--------------------------------------------------------------" 456 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes 457_libraries: 458 @echo 459 @echo "--------------------------------------------------------------" 460 @echo ">>> stage 4.2: building libraries" 461 @echo "--------------------------------------------------------------" 462 ${_+_}cd ${.CURDIR}; \ 463 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ 464 -DWITHOUT_MAN -DNO_PROFILE libraries 465_depend: 466 @echo 467 @echo "--------------------------------------------------------------" 468 @echo ">>> stage 4.3: make dependencies" 469 @echo "--------------------------------------------------------------" 470 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend 471everything: 472 @echo 473 @echo "--------------------------------------------------------------" 474 @echo ">>> stage 4.4: building everything" 475 @echo "--------------------------------------------------------------" 476 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all 477.if defined(LIB32TMP) 478build32: 479 @echo 480 @echo "--------------------------------------------------------------" 481 @echo ">>> stage 5.1: building 32 bit shim libraries" 482 @echo "--------------------------------------------------------------" 483 mkdir -p ${LIB32TMP}/usr/include 484 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 485 -p ${LIB32TMP}/usr >/dev/null 486 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 487 -p ${LIB32TMP}/usr/include >/dev/null 488 mkdir -p ${WORLDTMP} 489 ln -sf ${.CURDIR}/sys ${WORLDTMP} 490.for _t in obj includes 491 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t} 492 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t} 493.if ${MK_CDDL} != "no" 494 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t} 495.endif 496 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t} 497.if ${MK_CRYPT} != "no" 498 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t} 499.endif 500.if ${MK_KERBEROS} != "no" 501 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t} 502.endif 503.endfor 504.for _dir in usr.bin/lex/lib 505 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj 506.endfor 507.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic 508 cd ${.CURDIR}/${_dir}; \ 509 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \ 510 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \ 511 -DEARLY_BUILD build-tools 512.endfor 513 cd ${.CURDIR}; \ 514 ${LIB32WMAKE} -f Makefile.inc1 libraries 515.for _t in obj depend all 516 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \ 517 DIRPRFX=libexec/rtld-elf/ ${_t} 518 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \ 519 DIRPRFX=usr.bin/ldd ${_t} 520.endfor 521 522distribute32 install32: 523 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 524.if ${MK_CDDL} != "no" 525 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 526.endif 527 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 528.if ${MK_CRYPT} != "no" 529 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 530.endif 531.if ${MK_KERBEROS} != "no" 532 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 533.endif 534 cd ${.CURDIR}/libexec/rtld-elf; \ 535 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//} 536 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//} 537.endif 538 539WMAKE_TGTS= 540.if !defined(SUBDIR_OVERRIDE) 541WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools 542.endif 543WMAKE_TGTS+= _cleanobj _obj _build-tools 544.if !defined(SUBDIR_OVERRIDE) 545WMAKE_TGTS+= _cross-tools 546.endif 547WMAKE_TGTS+= _includes _libraries _depend everything 548.if defined(LIB32TMP) && ${MK_LIB32} != "no" 549WMAKE_TGTS+= build32 550.endif 551 552buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 553.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 554 555buildworld_prologue: 556 @echo "--------------------------------------------------------------" 557 @echo ">>> World build started on `LC_ALL=C date`" 558 @echo "--------------------------------------------------------------" 559 560buildworld_epilogue: 561 @echo 562 @echo "--------------------------------------------------------------" 563 @echo ">>> World build completed on `LC_ALL=C date`" 564 @echo "--------------------------------------------------------------" 565 566# 567# We need to have this as a target because the indirection between Makefile 568# and Makefile.inc1 causes the correct PATH to be used, rather than a 569# modification of the current environment's PATH. In addition, we need 570# to quote multiword values. 571# 572buildenvvars: 573 @echo ${WMAKEENV:Q} 574 575buildenv: 576 @echo Entering world for ${TARGET_ARCH}:${TARGET} 577 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true 578 579TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32} 580toolchain: ${TOOLCHAIN_TGTS} 581kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} 582 583# 584# installcheck 585# 586# Checks to be sure system is ready for installworld/installkernel. 587# 588installcheck: 589 590# 591# Require DESTDIR to be set if installing for a different architecture. 592# 593.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} 594.if !make(distributeworld) 595installcheck: installcheck_DESTDIR 596installcheck_DESTDIR: 597.if !defined(DESTDIR) || empty(DESTDIR) 598 @echo "ERROR: Please set DESTDIR!"; \ 599 false 600.endif 601.endif 602.endif 603 604# 605# Check for missing UIDs/GIDs. 606# 607CHECK_UIDS= 608CHECK_GIDS= audit 609.if ${MK_SENDMAIL} != "no" 610CHECK_UIDS+= smmsp 611CHECK_GIDS+= smmsp 612.endif 613.if ${MK_PF} != "no" 614CHECK_UIDS+= proxy 615CHECK_GIDS+= proxy authpf 616.endif 617installcheck: installcheck_UGID 618installcheck_UGID: 619.for uid in ${CHECK_UIDS} 620 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 621 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 622 false; \ 623 fi 624.endfor 625.for gid in ${CHECK_GIDS} 626 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 627 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 628 false; \ 629 fi 630.endfor 631 632# 633# Required install tools to be saved in a scratch dir for safety. 634# 635.if ${MK_INFO} != "no" 636_install-info= install-info 637.endif 638.if ${MK_ZONEINFO} != "no" 639_zoneinfo= zic tzsetup 640.endif 641 642ITOOLS= [ awk cap_mkdb cat chflags chmod chown \ 643 date echo egrep find grep ${_install-info} \ 644 ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ 645 test true uname wc ${_zoneinfo} 646 647# 648# distributeworld 649# 650# Distributes everything compiled by a `buildworld'. 651# 652# installworld 653# 654# Installs everything compiled by a 'buildworld'. 655# 656 657# Non-base distributions produced by the base system 658EXTRA_DISTRIBUTIONS= doc 659.if ${MK_GAMES} != "no" 660EXTRA_DISTRIBUTIONS+= games 661.endif 662.if defined(LIB32TMP) && ${MK_LIB32} != "no" 663EXTRA_DISTRIBUTIONS+= lib32 664.endif 665 666distributeworld installworld: installcheck 667 mkdir -p ${INSTALLTMP} 668 progs=$$(for prog in ${ITOOLS}; do \ 669 if progpath=`which $$prog`; then \ 670 echo $$progpath; \ 671 else \ 672 echo "Required tool $$prog not found in PATH." >&2; \ 673 exit 1; \ 674 fi; \ 675 done); \ 676 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \ 677 while read line; do \ 678 set -- $$line; \ 679 if [ "$$2 $$3" != "not found" ]; then \ 680 echo $$2; \ 681 else \ 682 echo "Required library $$1 not found." >&2; \ 683 exit 1; \ 684 fi; \ 685 done); \ 686 cp $$libs $$progs ${INSTALLTMP} 687 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale 688.if make(distributeworld) 689.for dist in ${EXTRA_DISTRIBUTIONS} 690 -mkdir ${DESTDIR}/${DISTDIR}/${dist} 691 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 692 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null 693 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 694 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 695 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 696 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null 697.endfor 698 -mkdir ${DESTDIR}/${DISTDIR}/base 699 ${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \ 700 DESTDIR=${DESTDIR}/${DISTDIR}/base 701.endif 702 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 703 ${IMAKEENV} rm -rf ${INSTALLTMP} 704.if make(distributeworld) 705.for dist in ${EXTRA_DISTRIBUTIONS} 706 find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete 707.endfor 708.endif 709 710packageworld: 711.for dist in base ${EXTRA_DISTRIBUTIONS} 712 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 713 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz . 714.endfor 715 716# 717# reinstall 718# 719# If you have a build server, you can NFS mount the source and obj directories 720# and do a 'make reinstall' on the *client* to install new binaries from the 721# most recent server build. 722# 723reinstall: 724 @echo "--------------------------------------------------------------" 725 @echo ">>> Making hierarchy" 726 @echo "--------------------------------------------------------------" 727 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy 728 @echo 729 @echo "--------------------------------------------------------------" 730 @echo ">>> Installing everything" 731 @echo "--------------------------------------------------------------" 732 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 733.if defined(LIB32TMP) && ${MK_LIB32} != "no" 734 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 735.endif 736 737redistribute: 738 @echo "--------------------------------------------------------------" 739 @echo ">>> Distributing everything" 740 @echo "--------------------------------------------------------------" 741 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 742.if defined(LIB32TMP) && ${MK_LIB32} != "no" 743 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \ 744 DISTRIBUTION=lib32 745.endif 746 747distrib-dirs distribution: 748 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET} 749 750# 751# buildkernel and installkernel 752# 753# Which kernels to build and/or install is specified by setting 754# KERNCONF. If not defined a GENERIC kernel is built/installed. 755# Only the existing (depending TARGET) config files are used 756# for building kernels and only the first of these is designated 757# as the one being installed. 758# 759# Note that we have to use TARGET instead of TARGET_ARCH when 760# we're in kernel-land. Since only TARGET_ARCH is (expected) to 761# be set to cross-build, we have to make sure TARGET is set 762# properly. 763 764.if defined(KERNFAST) 765NO_KERNELCLEAN= t 766NO_KERNELCONFIG= t 767NO_KERNELDEPEND= t 768NO_KERNELOBJ= t 769# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 770.if !defined(KERNCONF) && ${KERNFAST} != "1" 771KERNCONF=${KERNFAST} 772.endif 773.endif 774.if !defined(KERNCONF) && defined(KERNEL) 775KERNCONF= ${KERNEL} 776KERNWARN= 777.else 778.if ${TARGET_ARCH} == "powerpc64" 779KERNCONF?= GENERIC64 780.else 781KERNCONF?= GENERIC 782.endif 783.endif 784INSTKERNNAME?= kernel 785 786KERNSRCDIR?= ${.CURDIR}/sys 787KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 788KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 789KERNCONFDIR?= ${KRNLCONFDIR} 790 791BUILDKERNELS= 792INSTALLKERNEL= 793.for _kernel in ${KERNCONF} 794.if exists(${KERNCONFDIR}/${_kernel}) 795BUILDKERNELS+= ${_kernel} 796.if empty(INSTALLKERNEL) 797INSTALLKERNEL= ${_kernel} 798.endif 799.endif 800.endfor 801 802# 803# buildkernel 804# 805# Builds all kernels defined by BUILDKERNELS. 806# 807buildkernel: 808.if empty(BUILDKERNELS) 809 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 810 false 811.endif 812.if defined(KERNWARN) 813 @echo "--------------------------------------------------------------" 814 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" 815 @echo "--------------------------------------------------------------" 816 @sleep 3 817.endif 818 @echo 819.for _kernel in ${BUILDKERNELS} 820 @echo "--------------------------------------------------------------" 821 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 822 @echo "--------------------------------------------------------------" 823 @echo "===> ${_kernel}" 824 mkdir -p ${KRNLOBJDIR} 825.if !defined(NO_KERNELCONFIG) 826 @echo 827 @echo "--------------------------------------------------------------" 828 @echo ">>> stage 1: configuring the kernel" 829 @echo "--------------------------------------------------------------" 830 cd ${KRNLCONFDIR}; \ 831 PATH=${TMPPATH} \ 832 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 833 ${KERNCONFDIR}/${_kernel} 834.endif 835.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 836 @echo 837 @echo "--------------------------------------------------------------" 838 @echo ">>> stage 2.1: cleaning up the object tree" 839 @echo "--------------------------------------------------------------" 840 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 841.endif 842.if !defined(NO_KERNELOBJ) 843 @echo 844 @echo "--------------------------------------------------------------" 845 @echo ">>> stage 2.2: rebuilding the object tree" 846 @echo "--------------------------------------------------------------" 847 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 848.endif 849 @echo 850 @echo "--------------------------------------------------------------" 851 @echo ">>> stage 2.3: build tools" 852 @echo "--------------------------------------------------------------" 853 cd ${KRNLOBJDIR}/${_kernel}; \ 854 PATH=${BPATH}:${PATH} \ 855 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ 856 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \ 857 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile 858# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. 859.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) 860.for target in obj depend all 861 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ 862 PATH=${BPATH}:${PATH} \ 863 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ 864 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target} 865.endfor 866.endif 867.if !defined(NO_KERNELDEPEND) 868 @echo 869 @echo "--------------------------------------------------------------" 870 @echo ">>> stage 3.1: making dependencies" 871 @echo "--------------------------------------------------------------" 872 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ 873.endif 874 @echo 875 @echo "--------------------------------------------------------------" 876 @echo ">>> stage 3.2: building everything" 877 @echo "--------------------------------------------------------------" 878 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 879 @echo "--------------------------------------------------------------" 880 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 881 @echo "--------------------------------------------------------------" 882.endfor 883 884# 885# installkernel, etc. 886# 887# Install the kernel defined by INSTALLKERNEL 888# 889installkernel installkernel.debug \ 890reinstallkernel reinstallkernel.debug: installcheck 891.if empty(INSTALLKERNEL) 892 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 893 false 894.endif 895 @echo "--------------------------------------------------------------" 896 @echo ">>> Installing kernel ${INSTALLKERNEL}" 897 @echo "--------------------------------------------------------------" 898 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 899 ${CROSSENV} PATH=${TMPPATH} \ 900 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 901 902distributekernel distributekernel.debug: 903.if empty(INSTALLKERNEL) 904 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 905 false 906.endif 907 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 908 ${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \ 909 DESTDIR=${DESTDIR}/${DISTDIR}/kernel \ 910 ${.TARGET:S/distributekernel/install/} 911.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 912 cd ${KRNLOBJDIR}/${_kernel}; \ 913 ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 914 KERNEL=${INSTKERNNAME}.${_kernel} \ 915 DESTDIR=${DESTDIR}/${DISTDIR}/kernel.${_kernel} \ 916 ${.TARGET:S/distributekernel/install/} 917.endfor 918 919packagekernel: 920 cd ${DESTDIR}/${DISTDIR}/kernel; \ 921 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz . 922.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 923 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 924 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz . 925.endfor 926 927# 928# doxygen 929# 930# Build the API documentation with doxygen 931# 932doxygen: 933 @if [ ! -x `/usr/bin/which doxygen` ]; then \ 934 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 935 exit 1; \ 936 fi 937 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all 938 939# 940# update 941# 942# Update the source tree(s), by running cvsup/cvs/svn to update to the 943# latest copy. 944# 945update: 946.if defined(SUP_UPDATE) 947 @echo "--------------------------------------------------------------" 948 @echo ">>> Running ${SUP}" 949 @echo "--------------------------------------------------------------" 950.if defined(SUPFILE) 951 @${SUP} ${SUPFLAGS} ${SUPFILE} 952.endif 953.if defined(SUPFILE1) 954 @${SUP} ${SUPFLAGS} ${SUPFILE1} 955.endif 956.if defined(SUPFILE2) 957 @${SUP} ${SUPFLAGS} ${SUPFILE2} 958.endif 959.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) 960 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} 961.endif 962.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) 963 @${SUP} ${SUPFLAGS} ${DOCSUPFILE} 964.endif 965.if defined(WWWSUPFILE) && !defined(NO_WWWUPDATE) 966 @${SUP} ${SUPFLAGS} ${WWWSUPFILE} 967.endif 968.endif 969.if defined(CVS_UPDATE) 970 @cd ${.CURDIR} ; \ 971 if [ -d CVS ] ; then \ 972 echo "--------------------------------------------------------------" ; \ 973 echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \ 974 echo "--------------------------------------------------------------" ; \ 975 echo ${CVS} -R -q update ${CVSFLAGS} ; \ 976 ${CVS} -R -q update ${CVSFLAGS} ; \ 977 fi 978.endif 979.if defined(SVN_UPDATE) 980 @cd ${.CURDIR} ; \ 981 if [ -d .svn ] ; then \ 982 echo "--------------------------------------------------------------" ; \ 983 echo ">>> Updating ${.CURDIR} using Subversion" ; \ 984 echo "--------------------------------------------------------------" ; \ 985 echo ${SVN} update ${SVNFLAGS} ; \ 986 ${SVN} update ${SVNFLAGS} ; \ 987 fi 988.endif 989 990# 991# ------------------------------------------------------------------------ 992# 993# From here onwards are utility targets used by the 'make world' and 994# related targets. If your 'world' breaks, you may like to try to fix 995# the problem and manually run the following targets to attempt to 996# complete the build. Beware, this is *not* guaranteed to work, you 997# need to have a pretty good grip on the current state of the system 998# to attempt to manually finish it. If in doubt, 'make world' again. 999# 1000 1001# 1002# legacy: Build compatibility shims for the next three targets 1003# 1004legacy: 1005.if ${BOOTSTRAPPING} < 700055 && ${BOOTSTRAPPING} != 0 1006 @echo "ERROR: Source upgrades from versions prior to 7.0 not supported."; \ 1007 false 1008.endif 1009.for _tool in tools/build 1010 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ 1011 cd ${.CURDIR}/${_tool}; \ 1012 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1013 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 1014 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1015 ${MAKE} DIRPRFX=${_tool}/ all; \ 1016 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1017.endfor 1018 1019# 1020# bootstrap-tools: Build tools needed for compatibility 1021# 1022.if ${MK_GAMES} != "no" 1023_strfile= games/fortune/strfile 1024.endif 1025 1026.if ${MK_CXX} != "no" 1027_gperf= gnu/usr.bin/gperf 1028.endif 1029 1030.if ${MK_GROFF} != "no" 1031_groff= gnu/usr.bin/groff 1032.endif 1033 1034.if ${BOOTSTRAPPING} < 800022 1035_ar= usr.bin/ar 1036.endif 1037 1038.if ${BOOTSTRAPPING} < 800013 1039_mklocale= usr.bin/mklocale 1040.endif 1041 1042.if ${BOOTSTRAPPING} < 900002 1043_sed= usr.bin/sed 1044.endif 1045 1046.if ${BOOTSTRAPPING} < 900006 1047_lex= usr.bin/lex 1048.endif 1049 1050.if ${BOOTSTRAPPING} < 1000013 1051_yacc= usr.bin/yacc 1052.endif 1053 1054.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041 1055_awk= usr.bin/awk 1056.endif 1057 1058.if ${MK_BSNMP} != "no" && !exists(/usr/sbin/gensnmptree) 1059_gensnmptree= usr.sbin/bsnmpd/gensnmptree 1060.endif 1061 1062.if ${MK_CLANG} != "no" 1063_clang_tblgen= \ 1064 lib/clang/libllvmsupport \ 1065 lib/clang/libllvmtablegen \ 1066 usr.bin/clang/tblgen \ 1067 usr.bin/clang/clang-tblgen 1068.endif 1069 1070# dtrace tools are required for older bootstrap env and cross-build 1071.if ${MK_CDDL} != "no" && \ 1072 ((${BOOTSTRAPPING} < 800038 && \ 1073 !(${BOOTSTRAPPING} >= 700112 && ${BOOTSTRAPPING} < 799999)) \ 1074 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH})) 1075_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \ 1076 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge 1077.endif 1078 1079.if ${MK_FDT} != "no" 1080_dtc= gnu/usr.bin/dtc 1081.endif 1082 1083.if ${MK_KERBEROS} != "no" 1084_kerberos5_bootstrap_tools= \ 1085 kerberos5/tools/make-roken \ 1086 kerberos5/lib/libroken \ 1087 kerberos5/lib/libvers \ 1088 kerberos5/tools/asn1_compile \ 1089 kerberos5/tools/slc 1090.endif 1091 1092# Please document (add comment) why something is in 'bootstrap-tools'. 1093# Try to bound the building of the bootstrap-tool to just the 1094# FreeBSD versions that need the tool built at this stage of the build. 1095bootstrap-tools: 1096.for _tool in \ 1097 ${_clang_tblgen} \ 1098 ${_kerberos5_bootstrap_tools} \ 1099 ${_dtrace_tools} \ 1100 ${_strfile} \ 1101 ${_gperf} \ 1102 ${_groff} \ 1103 ${_ar} \ 1104 ${_dtc} \ 1105 ${_awk} \ 1106 usr.bin/lorder \ 1107 usr.bin/makewhatis \ 1108 ${_mklocale} \ 1109 usr.bin/rpcgen \ 1110 ${_sed} \ 1111 ${_yacc} \ 1112 ${_lex} \ 1113 usr.bin/xinstall \ 1114 ${_gensnmptree} \ 1115 usr.sbin/config 1116 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1117 cd ${.CURDIR}/${_tool}; \ 1118 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1119 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1120 ${MAKE} DIRPRFX=${_tool}/ all; \ 1121 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1122.endfor 1123 1124# 1125# build-tools: Build special purpose build tools 1126# 1127.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) 1128_aicasm= sys/modules/aic7xxx/aicasm 1129.endif 1130 1131.if !defined(NO_SHARE) 1132_share= share/syscons/scrnmaps 1133.endif 1134 1135.if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no" 1136_gcc_tools= gnu/usr.bin/cc/cc_tools 1137.endif 1138 1139.if ${MK_RESCUE} != "no" 1140_rescue= rescue/rescue 1141.endif 1142 1143build-tools: 1144.for _tool in \ 1145 bin/csh \ 1146 bin/sh \ 1147 ${_rescue} \ 1148 ${LOCAL_TOOL_DIRS} \ 1149 lib/ncurses/ncurses \ 1150 lib/ncurses/ncursesw \ 1151 ${_share} \ 1152 ${_aicasm} \ 1153 usr.bin/awk \ 1154 lib/libmagic \ 1155 usr.bin/mkesdb_static \ 1156 usr.bin/mkcsmapper_static 1157 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 1158 cd ${.CURDIR}/${_tool}; \ 1159 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1160 ${MAKE} DIRPRFX=${_tool}/ build-tools 1161.endfor 1162.for _tool in \ 1163 ${_gcc_tools} 1164 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ 1165 cd ${.CURDIR}/${_tool}; \ 1166 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1167 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1168 ${MAKE} DIRPRFX=${_tool}/ all 1169.endfor 1170 1171# 1172# cross-tools: Build cross-building tools 1173# 1174.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035 1175.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 1176_btxld= usr.sbin/btxld 1177.endif 1178.endif 1179.if ${TARGET_ARCH} != ${MACHINE_ARCH} 1180.if ${MK_RESCUE} != "no" || defined(RELEASEDIR) 1181_crunchide= usr.sbin/crunch/crunchide 1182.endif 1183.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR) 1184_kgzip= usr.sbin/kgzip 1185.endif 1186.endif 1187 1188.if ${MK_BINUTILS} != "no" 1189_binutils= gnu/usr.bin/binutils 1190.endif 1191 1192.if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") 1193_clang= usr.bin/clang 1194_clang_libs= lib/clang 1195.endif 1196 1197.if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no" 1198_cc= gnu/usr.bin/cc 1199.endif 1200 1201cross-tools: 1202.for _tool in \ 1203 ${_clang_libs} \ 1204 ${_clang} \ 1205 ${_binutils} \ 1206 ${_cc} \ 1207 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ 1208 ${_btxld} \ 1209 ${_crunchide} \ 1210 ${_kgzip} 1211 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1212 cd ${.CURDIR}/${_tool}; \ 1213 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1214 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1215 ${MAKE} DIRPRFX=${_tool}/ all; \ 1216 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 1217.endfor 1218 1219# 1220# hierarchy - ensure that all the needed directories are present 1221# 1222hierarchy hier: 1223 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 1224 1225# 1226# libraries - build all libraries, and install them under ${DESTDIR}. 1227# 1228# The list of libraries with dependents (${_prebuild_libs}) and their 1229# interdependencies (__L) are built automatically by the 1230# ${.CURDIR}/tools/make_libdeps.sh script. 1231# 1232libraries: 1233 cd ${.CURDIR}; \ 1234 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 1235 ${MAKE} -f Makefile.inc1 _startup_libs; \ 1236 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 1237 ${MAKE} -f Makefile.inc1 _generic_libs; 1238 1239# 1240# static libgcc.a prerequisite for shared libc 1241# 1242_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt 1243 1244# These dependencies are not automatically generated: 1245# 1246# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 1247# all shared libraries for ELF. 1248# 1249_startup_libs= gnu/lib/csu 1250.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 1251_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 1252.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}) 1253_startup_libs+= lib/csu/${MACHINE_ARCH} 1254.else 1255_startup_libs+= lib/csu/${MACHINE_CPUARCH} 1256.endif 1257_startup_libs+= gnu/lib/libgcc 1258_startup_libs+= lib/libcompiler_rt 1259_startup_libs+= lib/libc 1260.if ${MK_LIBCPLUSPLUS} != "no" 1261_startup_libs+= lib/libcxxrt 1262.endif 1263 1264gnu/lib/libgcc__L: lib/libc__L 1265.if ${MK_LIBCPLUSPLUS} != "no" 1266lib/libcxxrt__L: gnu/lib/libgcc__L 1267.endif 1268 1269_prebuild_libs= ${_kerberos5_lib_libasn1} \ 1270 ${_kerberos5_lib_libhdb} \ 1271 ${_kerberos5_lib_libheimbase} \ 1272 ${_kerberos5_lib_libheimntlm} \ 1273 ${_kerberos5_lib_libheimsqlite} \ 1274 ${_kerberos5_lib_libheimipcc} \ 1275 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 1276 ${_kerberos5_lib_libroken} \ 1277 ${_kerberos5_lib_libwind} \ 1278 lib/libbz2 ${_libcom_err} lib/libcrypt \ 1279 lib/libexpat \ 1280 ${_lib_libgssapi} ${_lib_libipx} \ 1281 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \ 1282 lib/ncurses/ncurses lib/ncurses/ncursesw \ 1283 lib/libopie lib/libpam ${_lib_libthr} \ 1284 lib/libradius lib/libsbuf lib/libtacplus \ 1285 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ 1286 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ 1287 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ 1288 ${_secure_lib_libssl} 1289 1290.if ${MK_LIBTHR} != "no" 1291_lib_libthr= lib/libthr 1292.endif 1293 1294.if ${MK_OFED} != "no" 1295_ofed_lib= contrib/ofed/usr.lib/ 1296.endif 1297 1298_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} 1299.for _DIR in ${LOCAL_LIB_DIRS} 1300.if exists(${.CURDIR}/${_DIR}/Makefile) 1301_generic_libs+= ${_DIR} 1302.endif 1303.endfor 1304 1305lib/libopie__L lib/libtacplus__L: lib/libmd__L 1306 1307.if ${MK_CDDL} != "no" 1308_cddl_lib_libumem= cddl/lib/libumem 1309_cddl_lib_libnvpair= cddl/lib/libnvpair 1310_cddl_lib= cddl/lib 1311.endif 1312 1313.if ${MK_CRYPT} != "no" 1314.if ${MK_OPENSSL} != "no" 1315_secure_lib_libcrypto= secure/lib/libcrypto 1316_secure_lib_libssl= secure/lib/libssl 1317lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 1318.if ${MK_OPENSSH} != "no" 1319_secure_lib_libssh= secure/lib/libssh 1320secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 1321.if ${MK_KERBEROS_SUPPORT} != "no" 1322secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 1323 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 1324 lib/libmd__L kerberos5/lib/libroken__L 1325.endif 1326.endif 1327.endif 1328_secure_lib= secure/lib 1329.endif 1330 1331.if ${MK_KERBEROS} != "no" 1332kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L 1333kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1334 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ 1335 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L 1336kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ 1337 kerberos5/lib/libroken__L lib/libcom_err__L 1338kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1339 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L 1340kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1341 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ 1342 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ 1343 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L 1344kerberos5/lib/libroken__L: lib/libcrypt__L 1345kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L 1346kerberos5/lib/libheimbase__L: lib/libthr__L 1347kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L 1348kerberos5/lib/libheimsqlite__L: lib/libthr__L 1349.endif 1350 1351.if ${MK_GSSAPI} != "no" 1352_lib_libgssapi= lib/libgssapi 1353.endif 1354 1355.if ${MK_IPX} != "no" 1356_lib_libipx= lib/libipx 1357.endif 1358 1359.if ${MK_KERBEROS} != "no" 1360_kerberos5_lib= kerberos5/lib 1361_kerberos5_lib_libasn1= kerberos5/lib/libasn1 1362_kerberos5_lib_libhdb= kerberos5/lib/libhdb 1363_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase 1364_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 1365_kerberos5_lib_libhx509= kerberos5/lib/libhx509 1366_kerberos5_lib_libroken= kerberos5/lib/libroken 1367_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 1368_kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite 1369_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc 1370_kerberos5_lib_libwind= kerberos5/lib/libwind 1371_libcom_err= lib/libcom_err 1372.endif 1373 1374.if ${MK_NIS} != "no" 1375_lib_libypclnt= lib/libypclnt 1376.endif 1377 1378.if ${MK_OPENSSL} == "no" 1379lib/libradius__L: lib/libmd__L 1380.endif 1381 1382.for _lib in ${_prereq_libs} 1383${_lib}__PL: .PHONY 1384.if exists(${.CURDIR}/${_lib}) 1385 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1386 cd ${.CURDIR}/${_lib}; \ 1387 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1388 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1389 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \ 1390 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install 1391.endif 1392.endfor 1393 1394.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 1395${_lib}__L: .PHONY 1396.if exists(${.CURDIR}/${_lib}) 1397 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1398 cd ${.CURDIR}/${_lib}; \ 1399 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1400 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1401 ${MAKE} DIRPRFX=${_lib}/ all; \ 1402 ${MAKE} DIRPRFX=${_lib}/ install 1403.endif 1404.endfor 1405 1406# libpam is special: we need to build static PAM modules before 1407# static PAM library, and dynamic PAM library before dynamic PAM 1408# modules. 1409lib/libpam__L: .PHONY 1410 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ 1411 cd ${.CURDIR}/lib/libpam; \ 1412 ${MAKE} DIRPRFX=lib/libpam/ obj; \ 1413 ${MAKE} DIRPRFX=lib/libpam/ depend; \ 1414 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ 1415 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install 1416 1417_prereq_libs: ${_prereq_libs:S/$/__PL/} 1418_startup_libs: ${_startup_libs:S/$/__L/} 1419_prebuild_libs: ${_prebuild_libs:S/$/__L/} 1420_generic_libs: ${_generic_libs:S/$/__L/} 1421 1422.for __target in all clean cleandepend cleandir depend includes obj 1423.for entry in ${SUBDIR} 1424${entry}.${__target}__D: .PHONY 1425 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 1426 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ 1427 edir=${entry}.${MACHINE_ARCH}; \ 1428 cd ${.CURDIR}/$${edir}; \ 1429 else \ 1430 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ 1431 edir=${entry}; \ 1432 cd ${.CURDIR}/$${edir}; \ 1433 fi; \ 1434 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 1435.endfor 1436par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 1437.endfor 1438 1439.include <bsd.subdir.mk> 1440 1441.if make(check-old) || make(check-old-dirs) || \ 1442 make(check-old-files) || make(check-old-libs) || \ 1443 make(delete-old) || make(delete-old-dirs) || \ 1444 make(delete-old-files) || make(delete-old-libs) 1445 1446# 1447# check for / delete old files section 1448# 1449 1450.include "ObsoleteFiles.inc" 1451 1452OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 1453else you can not start such an application. Consult UPDATING for more \ 1454information regarding how to cope with the removal/revision bump of a \ 1455specific library." 1456 1457.if !defined(BATCH_DELETE_OLD_FILES) 1458RM_I=-i 1459.else 1460RM_I=-v 1461.endif 1462 1463delete-old-files: 1464 @echo ">>> Removing old files (only deletes safe to delete libs)" 1465# Ask for every old file if the user really wants to remove it. 1466# It's annoying, but better safe than sorry. 1467# NB: We cannot pass the list of OLD_FILES as a parameter because the 1468# argument list will get too long. Using .for/.endfor make "loops" will make 1469# the Makefile parser segfault. 1470 @exec 3<&0; \ 1471 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1472 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1473 while read file; do \ 1474 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1475 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1476 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1477 fi; \ 1478 done 1479# Remove catpages without corresponding manpages. 1480 @exec 3<&0; \ 1481 find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1482 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1483 while read catpage; do \ 1484 read manpage; \ 1485 if [ ! -e "$${manpage}" ]; then \ 1486 rm ${RM_I} $${catpage} <&3; \ 1487 fi; \ 1488 done 1489 @echo ">>> Old files removed" 1490 1491check-old-files: 1492 @echo ">>> Checking for old files" 1493 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1494 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1495 while read file; do \ 1496 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1497 echo "${DESTDIR}/$${file}"; \ 1498 fi; \ 1499 done 1500# Check for catpages without corresponding manpages. 1501 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1502 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1503 while read catpage; do \ 1504 read manpage; \ 1505 if [ ! -e "$${manpage}" ]; then \ 1506 echo $${catpage}; \ 1507 fi; \ 1508 done 1509 1510delete-old-libs: 1511 @echo ">>> Removing old libraries" 1512 @echo "${OLD_LIBS_MESSAGE}" | fmt 1513 @exec 3<&0; \ 1514 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1515 -V OLD_LIBS | xargs -n1 | \ 1516 while read file; do \ 1517 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1518 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1519 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1520 fi; \ 1521 done 1522 @echo ">>> Old libraries removed" 1523 1524check-old-libs: 1525 @echo ">>> Checking for old libraries" 1526 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1527 -V OLD_LIBS | xargs -n1 | \ 1528 while read file; do \ 1529 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1530 echo "${DESTDIR}/$${file}"; \ 1531 fi; \ 1532 done 1533 1534delete-old-dirs: 1535 @echo ">>> Removing old directories" 1536 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1537 -V OLD_DIRS | xargs -n1 | \ 1538 while read dir; do \ 1539 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1540 rmdir -v "${DESTDIR}/$${dir}" || true; \ 1541 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1542 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1543 fi; \ 1544 done 1545 @echo ">>> Old directories removed" 1546 1547check-old-dirs: 1548 @echo ">>> Checking for old directories" 1549 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1550 -V OLD_DIRS | xargs -n1 | \ 1551 while read dir; do \ 1552 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1553 echo "${DESTDIR}/$${dir}"; \ 1554 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1555 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1556 fi; \ 1557 done 1558 1559delete-old: delete-old-files delete-old-dirs 1560 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1561 1562check-old: check-old-files check-old-libs check-old-dirs 1563 @echo "To remove old files and directories run '${MAKE} delete-old'." 1564 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1565 1566.endif 1567 1568# 1569# showconfig - show build configuration. 1570# 1571showconfig: 1572 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort 1573 1574.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 1575DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 1576 1577.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 1578.if exists(${KERNCONFDIR}/${KERNCONF}) 1579FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 1580 ${KERNCONFDIR}/${KERNCONF} ; echo 1581.endif 1582.endif 1583 1584.endif 1585 1586.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 1587DTBOUTPUTPATH= ${.CURDIR} 1588.endif 1589 1590# 1591# Build 'standalone' Device Tree Blob 1592# 1593builddtb: 1594 @if [ "${FDT_DTS_FILE}" = "" ]; then \ 1595 echo "ERROR: FDT_DTS_FILE must be specified!"; \ 1596 exit 1; \ 1597 fi; \ 1598 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \ 1599 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \ 1600 exist!"; \ 1601 exit 1; \ 1602 fi; \ 1603 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \ 1604 echo "WARNING: DTB will be placed in the current working \ 1605 directory"; \ 1606 fi 1607 @PATH=${TMPPATH} \ 1608 dtc -O dtb -o \ 1609 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \ 1610 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} 1611 1612############### 1613 1614.if defined(XDEV) && defined(XDEV_ARCH) 1615 1616.if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH} 1617XDEV_CPUTYPE?=${CPUTYPE} 1618.else 1619XDEV_CPUTYPE?=${TARGET_CPUTYPE} 1620.endif 1621 1622NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ 1623 -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \ 1624 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \ 1625 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \ 1626 CPUTYPE=${XDEV_CPUTYPE} 1627 1628XDDIR=${XDEV_ARCH}-freebsd 1629XDTP=/usr/${XDDIR} 1630CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} 1631CDENV= ${CDBENV} \ 1632 _SHLIBDIRPREFIX=${XDTP} \ 1633 TOOLS_PREFIX=${XDTP} 1634CD2ENV=${CDENV} \ 1635 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH} 1636 1637CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp 1638CDMAKE=${CDENV} ${MAKE} ${NOFUN} 1639CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1640XDDESTDIR=${DESTDIR}${XDTP} 1641.if !defined(OSREL) 1642OSREL!= uname -r | sed -e 's/[-(].*//' 1643.endif 1644 1645.ORDER: xdev-build xdev-install 1646xdev: xdev-build xdev-install 1647 1648.ORDER: _xb-build-tools _xb-cross-tools 1649xdev-build: _xb-build-tools _xb-cross-tools 1650 1651_xb-build-tools: 1652 ${_+_}@cd ${.CURDIR}; \ 1653 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools 1654 1655_xb-cross-tools: 1656.for _tool in \ 1657 gnu/usr.bin/binutils \ 1658 gnu/usr.bin/cc \ 1659 usr.bin/ar 1660 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ 1661 cd ${.CURDIR}/${_tool}; \ 1662 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 1663 ${CDMAKE} DIRPRFX=${_tool}/ depend; \ 1664 ${CDMAKE} DIRPRFX=${_tool}/ all 1665.endfor 1666 1667_xi-mtree: 1668 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 1669 mkdir -p ${XDDESTDIR} 1670 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 1671 -p ${XDDESTDIR} >/dev/null 1672 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1673 -p ${XDDESTDIR}/usr >/dev/null 1674 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1675 -p ${XDDESTDIR}/usr/include >/dev/null 1676 1677.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1678xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1679 1680_xi-cross-tools: 1681 @echo "_xi-cross-tools" 1682.for _tool in \ 1683 gnu/usr.bin/binutils \ 1684 gnu/usr.bin/cc \ 1685 usr.bin/ar 1686 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 1687 cd ${.CURDIR}/${_tool}; \ 1688 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 1689.endfor 1690 1691_xi-includes: 1692 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \ 1693 DESTDIR=${XDDESTDIR} 1694 1695_xi-libraries: 1696 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 1697 DESTDIR=${XDDESTDIR} 1698 1699_xi-links: 1700 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 1701 for i in *; do \ 1702 ln -sf ../../${XDTP}/usr/bin/$$i \ 1703 ../../../../usr/bin/${XDDIR}-$$i; \ 1704 ln -sf ../../${XDTP}/usr/bin/$$i \ 1705 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ 1706 done 1707.else 1708xdev xdev-buil xdev-install: 1709 @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target" 1710.endif 1711