Makefile.inc1 revision 113444
1135546Sdes# 2256257Sglebius# $FreeBSD: head/Makefile.inc1 113444 2003-04-13 16:26:31Z ru $ 3256257Sglebius# 437535Sdes# Make command line options: 537535Sdes# -DMAKE_KERBEROS5 to build Kerberos5 637535Sdes# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 737535Sdes# -DNOCLEAN do not clean at all 837535Sdes# -DNOCRYPT will prevent building of crypt versions 937535Sdes# -DNOMAN do not build the manual pages 1037535Sdes# -DNOPROFILE do not build profiled libraries 1137535Sdes# -DNOSECURE do not go into secure subdir 1237535Sdes# -DNOGAMES do not go into games subdir 1337535Sdes# -DNOSHARE do not go into share subdir 1437535Sdes# -DNOINFO do not make or install info files 1537535Sdes# -DNOLIBC_R do not build libc_r. 1637535Sdes# -DNO_FORTRAN do not build g77 and related libraries. 1737535Sdes# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 1837535Sdes# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 1937535Sdes# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel 2037535Sdes# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 2137535Sdes# -DNO_DOCUPDATE do not update doc in ${MAKE} update 2237535Sdes# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 2337535Sdes# TARGET_ARCH="arch" to crossbuild world to a different arch 2437535Sdes 2537535Sdes# 2637535Sdes# The intended user-driven targets are: 2750476Speter# buildworld - rebuild *everything*, including glue to help do upgrades 2837535Sdes# installworld- install everything built by "buildworld" 29256257Sglebius# update - convenient way to update your source tree (eg: sup/cvs) 3037535Sdes# most - build user commands, no libraries or include files 3137535Sdes# installmost - install user commands, no libraries or include files 3237535Sdes# 3360927Sdes# Standard targets (not defined here) are documented in the makefiles in 3460376Sdes# /usr/share/mk. These include: 3560376Sdes# obj depend all install clean cleandepend cleanobj 3663340Sdes 3739694Sdes# Put initial settings here. 3839694SdesSUBDIR= 3940975Sdes 4041989Sdes# We must do share/info early so that installation of info `dir' 4163340Sdes# entries works correctly. Do it first since it is less likely to 4239694Sdes# grow dependencies on include and lib than vice versa. 4339694Sdes.if exists(${.CURDIR}/share/info) 4440975SdesSUBDIR+= share/info 4541989Sdes.endif 4663340Sdes 4737535Sdes.if exists(${.CURDIR}/include) 4837535SdesSUBDIR+= include 4940975Sdes.endif 5041989Sdes.if exists(${.CURDIR}/lib) 5163340SdesSUBDIR+= lib 5237535Sdes.endif 5337535Sdes 5440975Sdes.if exists(${.CURDIR}/bin) 5541989SdesSUBDIR+= bin 5663340Sdes.endif 5737535Sdes.if exists(${.CURDIR}/games) && !defined(NOGAMES) 5859509SphantomSUBDIR+= games 5959509Sphantom.endif 6059509Sphantom.if exists(${.CURDIR}/gnu) 6159509SphantomSUBDIR+= gnu 6259509Sphantom.endif 6359509Sphantom.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \ 6437535Sdes !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5) 6584306SruSUBDIR+= kerberos5 6684306Sru.endif 6784306Sru.if exists(${.CURDIR}/libexec) 6860376SdesSUBDIR+= libexec 6975891Sarchie.endif 7060927Sdes.if exists(${.CURDIR}/sbin) 7175891SarchieSUBDIR+= sbin 7260376Sdes.endif 7375891Sarchie.if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE) 7439694SdesSUBDIR+= secure 7575891Sarchie.endif 7663340Sdes.if exists(${.CURDIR}/share) && !defined(NOSHARE) 7775891SarchieSUBDIR+= share 7839694Sdes.endif 7975891Sarchie.if exists(${.CURDIR}/sys) 8040975SdesSUBDIR+= sys 8175891Sarchie.endif 8241989Sdes.if exists(${.CURDIR}/usr.bin) 8375891SarchieSUBDIR+= usr.bin 8437535Sdes.endif 8575891Sarchie.if exists(${.CURDIR}/usr.sbin) 8663340SdesSUBDIR+= usr.sbin 8775891Sarchie.endif 8839694Sdes 8975891Sarchie# etc must be last for "distribute" to work 9040975Sdes.if exists(${.CURDIR}/etc) 9175891SarchieSUBDIR+= etc 9241989Sdes.endif 9375891Sarchie 9439694Sdes# These are last, since it is nice to at least get the base system 9575891Sarchie# rebuilt before you do them. 9663340Sdes.if defined(LOCAL_DIRS) 9775891Sarchie.for _DIR in ${LOCAL_DIRS} 9837535Sdes.if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile) 9975891SarchieSUBDIR+= ${_DIR} 10040975Sdes.endif 10175891Sarchie.endfor 10241989Sdes.endif 10375891Sarchie 10437535Sdes.if defined(SUBDIR_OVERRIDE) 10575891SarchieSUBDIR= ${SUBDIR_OVERRIDE} 10663340Sdes.endif 10775891Sarchie 10837535Sdes.if defined(NOCLEANDIR) 10975891SarchieCLEANDIR= clean cleandepend 11040975Sdes.else 11175891SarchieCLEANDIR= cleandir 11241989Sdes.endif 11375891Sarchie 11437535SdesCVS?= cvs 11575891SarchieSUP?= /usr/local/bin/cvsup 11663340SdesSUPFLAGS?= -g -L 2 -P - 11775891Sarchie.if defined(SUPHOST) 11837535SdesSUPFLAGS+= -h ${SUPHOST} 11975891Sarchie.endif 12040975Sdes 12175891SarchieMAKEOBJDIRPREFIX?= /usr/obj 12241989SdesOSRELDATE!= sysctl -n kern.osreldate 12375891SarchieTARGET_ARCH?= ${MACHINE_ARCH} 12437535Sdes.if ${TARGET_ARCH} == ${MACHINE_ARCH} 12537535SdesTARGET?= ${MACHINE} 12637535SdesTARGET_CPUTYPE?=${CPUTYPE} 12737535Sdes.else 12860376SdesTARGET?= ${TARGET_ARCH} 12960376SdesTARGET_CPUTYPE?= 13060376Sdes.endif 13160380Sdes.if !empty(TARGET_CPUTYPE) 13260380Sdes_TARGET_CPUTYPE=${TARGET_CPUTYPE} 13360376Sdes.else 13460376Sdes_TARGET_CPUTYPE=dummy 13560376Sdes.endif 13660376Sdes_CPUTYPE!= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \ 13767045Sdes CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE 13867045Sdes.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 13967045Sdes.error CPUTYPE global should be set with ?=. 14067045Sdes.endif 14167045Sdes.if make(buildworld) 14267045SdesBUILD_ARCH!= sysctl -n hw.machine_arch 14360376Sdes.if ${MACHINE_ARCH} != ${BUILD_ARCH} 14460376Sdes.error To cross-build, set TARGET_ARCH. 14567045Sdes.endif 14667045Sdes.endif 14760376Sdes.if ${MACHINE} == ${TARGET} 14860927SdesOBJTREE= ${MAKEOBJDIRPREFIX} 14960927Sdes.else 15060585SdesOBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET} 15160927Sdes.endif 15279315SruWORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH} 15360585Sdes# /usr/games added for fortune which depend on strfile 154119893SruBPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games 15560585SdesXPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games 15660585SdesSTRICTTMPPATH= ${BPATH}:${XPATH} 15760585SdesTMPPATH= ${STRICTTMPPATH}:${PATH} 15860585Sdes 15960585SdesINSTALLTMP!= /usr/bin/mktemp -d -u -t install 16060585Sdes 16160585Sdes# 16260585Sdes# Building a world goes through the following stages 16360585Sdes# 16460585Sdes# 1. legacy stage [BMAKE] 16560585Sdes# This stage is responsible for creating compatibility 16660585Sdes# shims that are needed by the bootstrap-tools, 16760585Sdes# build-tools and cross-tools stages. 16860585Sdes# 1. bootstrap-tools stage [BMAKE] 169186124Smurray# This stage is responsible for creating programs that 17060585Sdes# are needed for backward compatibility reasons. They 17160585Sdes# are not built as cross-tools. 17260585Sdes# 2. build-tools stage [TMAKE] 173186124Smurray# This stage is responsible for creating the object 174186124Smurray# tree and building any tools that are needed during 175186124Smurray# the build process. 176186124Smurray# 3. cross-tools stage [XMAKE] 177186124Smurray# This stage is responsible for creating any tools that 178186124Smurray# are needed for cross-builds. A cross-compiler is one 17960376Sdes# of them. 18060927Sdes# 4. world stage [WMAKE] 18160927Sdes# This stage actually builds the world. 18260376Sdes# 5. install stage (optional) [IMAKE] 18360376Sdes# This stage installs a previously built world. 18460376Sdes# 18560376Sdes 18663340SdesBOOTSTRAPPING?= 0 18763340Sdes 18839694Sdes# Common environment for world related stages 18939694SdesCROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ 19039694Sdes MACHINE_ARCH=${TARGET_ARCH} \ 19139694Sdes MACHINE=${TARGET} \ 19257686Ssheldonh CPUTYPE=${TARGET_CPUTYPE} \ 19357686Ssheldonh GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 19439694Sdes GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 19557686Ssheldonh GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 19663340Sdes 19763340Sdes# bootstrap-tools stage 19879315SruBMAKEENV= DESTDIR= \ 19963340Sdes INSTALL="sh ${.CURDIR}/tools/install.sh" \ 20063340Sdes PATH=${BPATH}:${PATH} \ 20163340Sdes WORLDTMP=${WORLDTMP} \ 20263340Sdes MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" 20379754SddBMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 20439694Sdes ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 20557686Ssheldonh BOOTSTRAPPING=${OSRELDATE} \ 20657686Ssheldonh -DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \ 20739694Sdes -DNO_CPU_CFLAGS -DNO_WARNS 20839694Sdes 20939694Sdes# build-tools stage 21040975SdesTMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 21140975Sdes ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 21275531Sdd BOOTSTRAPPING=${OSRELDATE} -DNO_CPU_CFLAGS -DNO_WARNS 21357686Ssheldonh 21479315Sru# cross-tools stage 21540975SdesXMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB 216119893Sru 21740975Sdes# world stage 21840975SdesWMAKEENV= ${CROSSENV} \ 21940975Sdes DESTDIR=${WORLDTMP} \ 22041869Sdes INSTALL="sh ${.CURDIR}/tools/install.sh" \ 22141869Sdes PATH=${TMPPATH} 22240975SdesWMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 22340975Sdes 22440975Sdes# install stage 22560585SdesIMAKEENV= ${CROSSENV} \ 22660585Sdes PATH=${STRICTTMPPATH}:${INSTALLTMP} 22760585SdesIMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 22860585Sdes 22960585Sdes# kernel stage 23060585SdesKMAKEENV= ${WMAKEENV} 23160585Sdes 23260585Sdes# 23360585Sdes# buildworld 23460585Sdes# 23541989Sdes# Attempt to rebuild the entire system, with reasonable chance of 23641989Sdes# success, regardless of how old your existing system is. 23757686Ssheldonh# 23857686Ssheldonh_worldtmp: 23979315Sru.if ${.CURDIR:C/[^,]//g} != "" 24057686Ssheldonh# The m4 build of sendmail files doesn't like it if ',' is used 24157686Ssheldonh# anywhere in the path of it's files. 24279315Sru @echo 24341989Sdes @echo "*** Error: path to source tree contains a comma ','" 244119893Sru @echo 24541989Sdes @false 24641989Sdes.endif 247176104Sdes @echo 24841989Sdes @echo "--------------------------------------------------------------" 24941989Sdes @echo ">>> Rebuilding the temporary build tree" 25041989Sdes @echo "--------------------------------------------------------------" 25141989Sdes.if !defined(NOCLEAN) 25241989Sdes rm -rf ${WORLDTMP} 25341989Sdes.else 25441989Sdes rm -rf ${WORLDTMP}/legacy/usr/include 25541989Sdes # XXX - These two can depend on any header file. 25641989Sdes rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c 25741989Sdes rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c 25841989Sdes.endif 25963340Sdes.for _dir in \ 26040975Sdes usr/bin usr/games usr/include/sys usr/lib \ 26140975Sdes usr/libexec usr/sbin usr/share/dict \ 26239694Sdes usr/share/groff_font/devX100 \ 26340975Sdes usr/share/groff_font/devX100-12 \ 26439694Sdes usr/share/groff_font/devX75 \ 26563340Sdes usr/share/groff_font/devX75-12 \ 26640975Sdes usr/share/groff_font/devascii \ 26740975Sdes usr/share/groff_font/devcp1047 \ 26837535Sdes usr/share/groff_font/devdvi \ 26940975Sdes usr/share/groff_font/devhtml \ 27039694Sdes usr/share/groff_font/devkoi8-r \ 27140975Sdes usr/share/groff_font/devlatin1 \ 27279315Sru usr/share/groff_font/devlbp \ 27340975Sdes usr/share/groff_font/devlj4 \ 27437535Sdes usr/share/groff_font/devps \ 27537535Sdes usr/share/groff_font/devutf8 \ 27663340Sdes usr/share/tmac/mdoc usr/share/tmac/mm 27737535Sdes mkdir -p ${WORLDTMP}/legacy/${_dir} 27837535Sdes.endfor 27937535Sdes.for _dir in \ 28037535Sdes usr/bin usr/lib/compat/aout usr/libdata/ldscripts usr/libexec usr/share/misc 28157686Ssheldonh mkdir -p ${WORLDTMP}/${_dir} 28257686Ssheldonh.endfor 28337535Sdes.for _dir in \ 28437535Sdes arpa dev fs g++/backward g++/bits g++/ext isc isofs libmilter \ 28563340Sdes objc openssl protocols readline rpc rpcsvc security ufs 28663340Sdes mkdir -p ${WORLDTMP}/usr/include/${_dir} 28737535Sdes.endfor 28837535Sdes ln -sf ${.CURDIR}/sys ${WORLDTMP} 28937535Sdes_legacy: 29037535Sdes @echo 29137535Sdes @echo "--------------------------------------------------------------" 29263340Sdes @echo ">>> stage 1: legacy release compatibility shims" 29337535Sdes @echo "--------------------------------------------------------------" 29437535Sdes cd ${.CURDIR}; ${BMAKE} legacy 29537535Sdes_bootstrap-tools: 29637535Sdes @echo 29757686Ssheldonh @echo "--------------------------------------------------------------" 29857686Ssheldonh @echo ">>> stage 1: bootstrap tools" 29937535Sdes @echo "--------------------------------------------------------------" 30063340Sdes cd ${.CURDIR}; ${BMAKE} bootstrap-tools 30163340Sdes_cleanobj: 30237535Sdes.if !defined(NOCLEAN) 30363340Sdes @echo 30437535Sdes @echo "--------------------------------------------------------------" 30537535Sdes @echo ">>> stage 2: cleaning up the object tree" 30637535Sdes @echo "--------------------------------------------------------------" 30779315Sru cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} 30857686Ssheldonh.endif 30957686Ssheldonh_obj: 31037535Sdes @echo 31137535Sdes @echo "--------------------------------------------------------------" 31237535Sdes @echo ">>> stage 2: rebuilding the object tree" 31337535Sdes @echo "--------------------------------------------------------------" 31437535Sdes cd ${.CURDIR}; ${WMAKE} par-obj 31563340Sdes_build-tools: 31637535Sdes @echo 31737535Sdes @echo "--------------------------------------------------------------" 31837535Sdes @echo ">>> stage 2: build tools" 31937535Sdes @echo "--------------------------------------------------------------" 32037535Sdes cd ${.CURDIR}; ${TMAKE} build-tools 32137535Sdes_cross-tools: 322226015Sdes @echo 323226015Sdes @echo "--------------------------------------------------------------" 324226015Sdes @echo ">>> stage 3: cross tools" 325226015Sdes @echo "--------------------------------------------------------------" 326226015Sdes cd ${.CURDIR}; ${XMAKE} cross-tools 32779315Sru_includes: 328226015Sdes @echo 329226015Sdes @echo "--------------------------------------------------------------" 330226015Sdes @echo ">>> stage 4: populating ${WORLDTMP}/usr/include" 331226015Sdes @echo "--------------------------------------------------------------" 332226015Sdes cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes 333226015Sdes_libraries: 334226015Sdes @echo 33537535Sdes @echo "--------------------------------------------------------------" 33655544Sdes @echo ">>> stage 4: building libraries" 33779315Sru @echo "--------------------------------------------------------------" 33874716Sdes cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries 339106656Sfenner_depend: 34071097Sru @echo 34155544Sdes @echo "--------------------------------------------------------------" 34255544Sdes @echo ">>> stage 4: make dependencies" 34379315Sru @echo "--------------------------------------------------------------" 34455544Sdes cd ${.CURDIR}; ${WMAKE} par-depend 34563340Sdeseverything: 34655544Sdes @echo 34755544Sdes @echo "--------------------------------------------------------------" 34855544Sdes @echo ">>> stage 4: building everything.." 34955544Sdes @echo "--------------------------------------------------------------" 35055544Sdes cd ${.CURDIR}; ${WMAKE} par-all 35137535Sdes 35237535Sdes 35370797SdesWMAKE_TGTS= 35470797Sdes.if !defined(SUBDIR_OVERRIDE) 35537535SdesWMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools 35637535Sdes.endif 35763340SdesWMAKE_TGTS+= _cleanobj _obj _build-tools 35837535Sdes.if !defined(SUBDIR_OVERRIDE) 35937535SdesWMAKE_TGTS+= _cross-tools 36037535Sdes.endif 36157686SsheldonhWMAKE_TGTS+= _includes _libraries _depend everything 362141851Sru 36377240Sdesbuildworld: ${WMAKE_TGTS} 36437535Sdes.ORDER: ${WMAKE_TGTS} 36555544Sdes 36679315Sru# 36755544Sdes# installcheck 36863340Sdes# 36955544Sdes# Checks to be sure system is ready for installworld 37055544Sdes# 37155544Sdesinstallcheck: 37255544Sdes.if !defined(NO_SENDMAIL) 37355544Sdes @if ! `grep -q '^smmsp:' /etc/passwd`; then \ 374186124Smurray echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \ 375186124Smurray false; \ 376186124Smurray fi 377186124Smurray @if ! `grep -q '^smmsp:' /etc/group`; then \ 378186124Smurray echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \ 379236105Sdes false; \ 380186124Smurray fi 381186124Smurray.endif 382186124Smurray.if ${TARGET_ARCH} == ${MACHINE_ARCH} && !defined(DISTDIR) && \ 383186124Smurray (!defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/") 384186124Smurray @echo "Checking to see if your booted kernel is fresh enough.." 385186124Smurray ${.OBJDIR}/bin/sh/sh -c \ 386186124Smurray 'echo "Testing installed kernel for new sigaction(2) syscall"' 387186124Smurray @echo "Seems ok.." 388186124Smurray.endif 389186124Smurray 39037535Sdes# 39137535Sdes# distributeworld 39237535Sdes# 39337535Sdes# Distributes everything compiled by a `buildworld'. 39437535Sdes# 39537535Sdes# installworld 396256257Sglebius# 397256257Sglebius# Installs everything compiled by a 'buildworld'. 398256257Sglebius# 399256257Sglebiusdistributeworld installworld: installcheck 400256257Sglebius mkdir -p ${INSTALLTMP} 401256257Sglebius for prog in [ awk cap_mkdb cat chflags chmod chown \ 402256257Sglebius date echo egrep find grep \ 403256257Sglebius ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ 404256257Sglebius test true uname wc zic; do \ 405256257Sglebius cp `which $$prog` ${INSTALLTMP}; \ 406256257Sglebius done 407256257Sglebius cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//} 408256257Sglebius rm -rf ${INSTALLTMP} 409256257Sglebius 410256257Sglebius# 411256257Sglebius# reinstall 412256257Sglebius# 413256257Sglebius# If you have a build server, you can NFS mount the source and obj directories 414256257Sglebius# and do a 'make reinstall' on the *client* to install new binaries from the 415256257Sglebius# most recent server build. 416256257Sglebius# 417256257Sglebiusreinstall: 418256257Sglebius @echo "--------------------------------------------------------------" 419256257Sglebius @echo ">>> Making hierarchy" 420256257Sglebius @echo "--------------------------------------------------------------" 421256257Sglebius cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy 422256257Sglebius @echo 423256257Sglebius @echo "--------------------------------------------------------------" 424256257Sglebius @echo ">>> Installing everything.." 425256257Sglebius @echo "--------------------------------------------------------------" 426256257Sglebius cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 427256257Sglebius.if !defined(NOMAN) && !defined(NO_MAKEDB_RUN) 428256257Sglebius @echo 429256257Sglebius @echo "--------------------------------------------------------------" 430256257Sglebius @echo ">>> Rebuilding man page indices" 431256257Sglebius @echo "--------------------------------------------------------------" 432256257Sglebius cd ${.CURDIR}/share/man; ${MAKE} makedb 433256257Sglebius.endif 434256257Sglebius 435256257Sglebiusredistribute: 436256257Sglebius @echo "--------------------------------------------------------------" 437256257Sglebius @echo ">>> Distributing everything.." 438256257Sglebius @echo "--------------------------------------------------------------" 439256257Sglebius cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 440256257Sglebius 441256257Sglebius# 442256257Sglebius# buildkernel and installkernel 443256257Sglebius# 444256257Sglebius# Which kernels to build and/or install is specified by setting 445256257Sglebius# KERNCONF. If not defined a GENERIC kernel is built/installed. 446256257Sglebius# Only the existing (depending TARGET) config files are used 447256257Sglebius# for building kernels and only the first of these is designated 448256257Sglebius# as the one being installed. 449256257Sglebius# 45077240Sdes# Note that we have to use TARGET instead of TARGET_ARCH when 45177240Sdes# we're in kernel-land. Since only TARGET_ARCH is (expected) to 45277240Sdes# be set to cross-build, we have to make sure TARGET is set 45379315Sru# properly. 45477240Sdes 45577240Sdes.if !defined(KERNCONF) && defined(KERNEL) 45677240SdesKERNCONF= ${KERNEL} 45777240SdesKERNWARN= yes 45877240Sdes.else 45977240SdesKERNCONF?= GENERIC 46077240Sdes.endif 46177240SdesINSTKERNNAME?= kernel 46277240Sdes 46377240SdesKRNLSRCDIR= ${.CURDIR}/sys 46477240SdesKRNLCONFDIR= ${KRNLSRCDIR}/${TARGET}/conf 46579315SruKRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR} 46677240SdesKERNCONFDIR?= ${KRNLCONFDIR} 46777240Sdes 46877240SdesBUILDKERNELS= 46979315SruINSTALLKERNEL= 47077240Sdes.for _kernel in ${KERNCONF} 47177240Sdes.if exists(${KERNCONFDIR}/${_kernel}) 472141846SruBUILDKERNELS+= ${_kernel} 47377240Sdes.if empty(INSTALLKERNEL) 47477240SdesINSTALLKERNEL= ${_kernel} 47537535Sdes.endif 47637535Sdes.endif 47737535Sdes.endfor 47879315Sru 47957686Ssheldonh# 48057686Ssheldonh# buildkernel 48137535Sdes# 48237535Sdes# Builds all kernels defined by BUILDKERNELS. 48337535Sdes# 48437535Sdesbuildkernel: 48579754Sdd.if empty(BUILDKERNELS) 48640975Sdes @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; 48740975Sdes @false 48840975Sdes.endif 48937535Sdes.if defined(KERNWARN) 49040975Sdes @echo "--------------------------------------------------------------" 49140975Sdes @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" 49260924Sdes @echo "--------------------------------------------------------------" 493119893Sru @sleep 3 49459509Sphantom.endif 49540975Sdes @echo 49679754Sdd.for _kernel in ${BUILDKERNELS} 49740975Sdes @echo "--------------------------------------------------------------" 49879754Sdd @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 49940975Sdes @echo "--------------------------------------------------------------" 50079754Sdd @echo "===> ${_kernel}" 50140975Sdes mkdir -p ${KRNLOBJDIR} 50279754Sdd.if !defined(NO_KERNELCONFIG) 50340975Sdes cd ${KRNLCONFDIR}; \ 50479754Sdd PATH=${TMPPATH} \ 50540975Sdes config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 50679754Sdd ${KERNCONFDIR}/${_kernel} 50740975Sdes.endif 50879754Sdd.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) 50940975Sdes cd ${KRNLOBJDIR}/${_kernel}; \ 51079754Sdd ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR} 51140975Sdes.endif 51279754Sdd cd ${KRNLOBJDIR}/${_kernel}; \ 51340975Sdes MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx/aicasm \ 51479754Sdd ${MAKE} -DNO_CPU_CFLAGS -f ${KRNLSRCDIR}/dev/aic7xxx/aicasm/Makefile 51540975Sdes cd ${KRNLOBJDIR}/${_kernel}; \ 51679754Sdd ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj 51740975Sdes# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. 51879754Sdd.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules) 51940975Sdes.for target in obj depend all 52079754Sdd cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \ 52140975Sdes MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ 52279754Sdd ${MAKE} -DNO_CPU_CFLAGS ${target} 52340975Sdes.endfor 52479754Sdd.endif 52540975Sdes.if !defined(NO_KERNELDEPEND) 52679754Sdd cd ${KRNLOBJDIR}/${_kernel}; \ 52740975Sdes ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ 52879754Sdd.endif 52940975Sdes cd ${KRNLOBJDIR}/${_kernel}; \ 53040975Sdes ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ 53140975Sdes @echo "--------------------------------------------------------------" 53240975Sdes @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 53340975Sdes @echo "--------------------------------------------------------------" 534131504Sru.endfor 53537535Sdes 536115225Sru# 537111816Sdes# installkernel 538111816Sdes# 539111816Sdes# Install the kernel defined by INSTALLKERNEL 54070274Sdes# 54170274Sdesinstallkernel reinstallkernel: 54267871Sdes.if empty(INSTALLKERNEL) 543226015Sdes @echo "ERROR: No kernel \"${KERNCONF}\" to install." 54469670Sdes @false 545226015Sdes.endif 546226015Sdes cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 547226015Sdes ${CROSSENV} PATH=${TMPPATH} \ 54867871Sdes ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//} 54967871Sdes 55067871Sdes# 55162966Sdes# update 55267045Sdes# 55367045Sdes# Update the source tree, by running sup and/or running cvs to update to the 55467045Sdes# latest copy. 55567045Sdes# 55667045Sdesupdate: 55763715Sdes.if defined(SUP_UPDATE) 55863715Sdes @echo "--------------------------------------------------------------" 55963715Sdes @echo ">>> Running ${SUP}" 56063715Sdes @echo "--------------------------------------------------------------" 56163715Sdes.if defined(SUPFILE) 56263715Sdes @${SUP} ${SUPFLAGS} ${SUPFILE} 56363715Sdes.endif 56463715Sdes.if defined(SUPFILE1) 56567028Sdes @${SUP} ${SUPFLAGS} ${SUPFILE1} 56665291Sdes.endif 56765291Sdes.if defined(SUPFILE2) 56865291Sdes @${SUP} ${SUPFLAGS} ${SUPFILE2} 56965291Sdes.endif 57073932Sdes.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) 57173932Sdes @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} 57273932Sdes.endif 57373932Sdes.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) 574256257Sglebius @${SUP} ${SUPFLAGS} ${DOCSUPFILE} 575256257Sglebius.endif 576256257Sglebius.endif 577256257Sglebius.if defined(CVS_UPDATE) 578256257Sglebius @echo "--------------------------------------------------------------" 579256257Sglebius @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT} 580256257Sglebius @echo "--------------------------------------------------------------" 581256257Sglebius cd ${.CURDIR}; ${CVS} -R -q update -A -P -d 582256257Sglebius.endif 58363013Sdes 58467028Sdes# 58567028Sdes# most 58663013Sdes# 58763013Sdes# Build most of the user binaries on the existing system libs and includes. 588203028Sdes# 589203028Sdesmost: 590203028Sdes @echo "--------------------------------------------------------------" 591203028Sdes @echo ">>> Building programs only" 592203028Sdes @echo "--------------------------------------------------------------" 59367028Sdes.for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin 594203028Sdes cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all 59563013Sdes.endfor 59667028Sdes 59767028Sdes# 59867028Sdes# installmost 59962966Sdes# 60067045Sdes# Install the binaries built by the 'most' target. This does not include 60167045Sdes# libraries or include files. 60267045Sdes# 60362966Sdesinstallmost: 60467028Sdes @echo "--------------------------------------------------------------" 60567045Sdes @echo ">>> Installing programs only" 60663715Sdes @echo "--------------------------------------------------------------" 60763715Sdes.for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin 60873932Sdes cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install 60973932Sdes.endfor 61073932Sdes 61173932Sdes# 61262966Sdes# ------------------------------------------------------------------------ 61363013Sdes# 61463715Sdes# From here onwards are utility targets used by the 'make world' and 61563715Sdes# related targets. If your 'world' breaks, you may like to try to fix 61663715Sdes# the problem and manually run the following targets to attempt to 61767028Sdes# complete the build. Beware, this is *not* guaranteed to work, you 61867045Sdes# need to have a pretty good grip on the current state of the system 61967045Sdes# to attempt to manually finish it. If in doubt, 'make world' again. 62067045Sdes# 621107372Sdes 622108317Sschweikh# 623107372Sdes# legacy: Build compatibility shims for the next three targets 624107372Sdes# 625108317Sschweikhlegacy: 62677261Sdes.for _tool in tools/build 62777261Sdes @${ECHODIR} "===> ${_tool}"; \ 62877261Sdes cd ${.CURDIR}/${_tool}; \ 62979315Sru ${MAKE} DIRPRFX=${_tool}/ obj; \ 630109701Sdes ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 631109701Sdes ${MAKE} DIRPRFX=${_tool}/ depend; \ 632109701Sdes ${MAKE} DIRPRFX=${_tool}/ all; \ 633109701Sdes ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 634109701Sdes.endfor 635109701Sdes 636109701Sdes# 637109701Sdes# bootstrap-tools: Build tools needed for compatibility 638174753Sdes# 639174753Sdes.if exists(${.CURDIR}/games) && !defined(NOGAMES) 640174753Sdes_strfile= games/fortune/strfile 641174753Sdes.endif 642174753Sdes 643174753Sdes.if ( ${BOOTSTRAPPING} < 450005 || \ 644174753Sdes ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034 )) 645174753Sdes_uudecode= usr.bin/uudecode 646256257Sglebius.endif 647256257Sglebius 648256257Sglebius.if ( ${BOOTSTRAPPING} < 430002 || \ 649256257Sglebius ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019 )) 650256257Sglebius_xargs= usr.bin/xargs 651256257Sglebius.endif 652256257Sglebius 653256257Sglebius.if ( ${BOOTSTRAPPING} < 430002 || \ 654256257Sglebius ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018 )) 655256257Sglebius_yacc= usr.bin/yacc 656256257Sglebius.endif 657256257Sglebius 658256257Sglebiusbootstrap-tools: 659256257Sglebius.for _tool in ${_strfile} usr.bin/colldef \ 660256257Sglebius usr.bin/makewhatis usr.bin/rpcgen ${_uudecode} \ 661256257Sglebius ${_xargs} usr.bin/xinstall ${_yacc} \ 662256257Sglebius usr.sbin/config usr.sbin/kbdcontrol \ 663256257Sglebius gnu/usr.bin/gperf gnu/usr.bin/groff gnu/usr.bin/texinfo 664256257Sglebius @${ECHODIR} "===> ${_tool}"; \ 665256257Sglebius cd ${.CURDIR}/${_tool}; \ 666256257Sglebius ${MAKE} DIRPRFX=${_tool}/ obj; \ 667256257Sglebius ${MAKE} DIRPRFX=${_tool}/ depend; \ 668256257Sglebius ${MAKE} DIRPRFX=${_tool}/ all; \ 669256257Sglebius ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 670256257Sglebius.endfor 67162966Sdes 672116169Strhodes# 673116169Strhodes# build-tools: Build special purpose build tools 674116169Strhodes# 675116169Strhodes.if defined(MODULES_WITH_WORLD) && exists(${KRNLSRCDIR}/modules) 676116169Strhodes_aicasm= sys/modules/aic7xxx/aicasm 677116169Strhodes.endif 678116169Strhodes 679116169Strhodes.if exists(${.CURDIR}/share) && !defined(NOSHARE) 680116169Strhodes_share= share/syscons/scrnmaps 681116169Strhodes.endif 682116169Strhodes 683116169Strhodes.if !defined(NO_FORTRAN) 684116169Strhodes_fortran= gnu/usr.bin/cc/f771 685116169Strhodes.endif 686116169Strhodes 687116169Strhodes.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \ 688116169Strhodes !defined(NOCRYPT) && defined(MAKE_KERBEROS5) 689116169Strhodes_libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \ 690116169Strhodes kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl 691116169Strhodes.endif 692116169Strhodes 693116169Strhodesbuild-tools: 694174753Sdes.for _tool in bin/csh bin/sh gnu/usr.bin/cc/cc_tools ${_fortran} \ 695174753Sdes ${_libkrb5} lib/libncurses ${_share} \ 696174753Sdes ${_aicasm} usr.bin/awk usr.bin/file usr.sbin/sysinstall 697174753Sdes @${ECHODIR} "===> ${_tool}"; \ 698174753Sdes cd ${.CURDIR}/${_tool}; \ 699174753Sdes ${MAKE} DIRPRFX=${_tool}/ obj; \ 700174753Sdes ${MAKE} DIRPRFX=${_tool}/ build-tools 701174753Sdes.endfor 702256257Sglebius 703256257Sglebius# 704256257Sglebius# cross-tools: Build cross-building tools 705256257Sglebius# 706256257Sglebius.if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH} 707256257Sglebius_elf2exe= usr.sbin/elf2exe 708256257Sglebius.endif 709256257Sglebius 710256257Sglebius.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} 711256257Sglebius_btxld= usr.sbin/btxld 712256257Sglebius.if defined(RELEASEDIR) 713256257Sglebius_kgzip= usr.sbin/kgzip 714256257Sglebius.endif 71537535Sdes.endif 71637535Sdes 71755544Sdes.if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \ 71870797Sdes ${BOOTSTRAPPING} < 500037 71937535Sdes_elf2aout= usr.bin/elf2aout 72070797Sdes.endif 72170797Sdes 72270797Sdes.if defined(RELEASEDIR) 72370797Sdes_crunchide= usr.sbin/crunch/crunchide 72470797Sdes.endif 72570797Sdes 72670797Sdes_xlint= usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint 72770797Sdes 72870797Sdescross-tools: 72970797Sdes.for _tool in ${_btxld} ${_elf2aout} ${_elf2exe} \ 73070797Sdes gnu/usr.bin/binutils ${_crunchide} \ 73170797Sdes gnu/usr.bin/cc ${_xlint} ${_kgzip} 73270797Sdes @${ECHODIR} "===> ${_tool}"; \ 73371107Sru cd ${.CURDIR}/${_tool}; \ 73470797Sdes ${MAKE} DIRPRFX=${_tool}/ obj; \ 73560311Ssheldonh ${MAKE} DIRPRFX=${_tool}/ depend; \ 73660311Ssheldonh ${MAKE} DIRPRFX=${_tool}/ all; \ 73760311Ssheldonh ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 73837535Sdes.endfor 73937535Sdes 74037535Sdes# 74137535Sdes# hierarchy - ensure that all the needed directories are present 74237535Sdes# 74360311Ssheldonhhierarchy: 74460311Ssheldonh cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 74560311Ssheldonh 74660311Ssheldonh# 74777240Sdes# libraries - build all libraries, and install them under ${DESTDIR}. 74877240Sdes# 74960311Ssheldonh# The list of libraries with dependents (${_prebuild_libs}) and their 750106656Sfenner# interdependencies (__L) are built automatically by the 75137535Sdes# ${.CURDIR}/tools/make_libdeps.sh script. 75277240Sdes# 75337535Sdeslibraries: 75477240Sdes cd ${.CURDIR}; \ 75577240Sdes ${MAKE} -f Makefile.inc1 _startup_libs; \ 75677240Sdes ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 75777240Sdes ${MAKE} -f Makefile.inc1 _generic_libs; 75877240Sdes 75977240Sdes# These dependencies are not automatically generated: 76077240Sdes# 76177240Sdes# gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all 76277240Sdes# shared libraries for ELF. 76377240Sdes# 76477240Sdes_startup_libs= gnu/lib/csu gnu/lib/libgcc 76577240Sdes.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 76637535Sdes_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 76737535Sdes.else 76837535Sdes_startup_libs+= lib/csu/${MACHINE_ARCH} 76937535Sdes.endif 77037535Sdes 77137535Sdes_prebuild_libs= 77269026Sru 77337535Sdes_generic_libs= gnu/lib 77437535Sdes 77537535Sdes.if !defined(NOCRYPT) && defined(MAKE_KERBEROS5) 776124963Sdes_prebuild_libs+= kerberos5/lib/libasn1 777203028Sdes_prebuild_libs+= kerberos5/lib/libgssapi 77840975Sdes_prebuild_libs+= kerberos5/lib/libkrb5 779203028Sdes_prebuild_libs+= kerberos5/lib/libroken 780203028Sdes_generic_libs+= kerberos5/lib 781203028Sdes.endif 782203028Sdes 783256257Sglebius_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libkvm lib/libmd \ 784256257Sglebius lib/libncurses lib/libopie lib/libpam lib/libradius \ 785203028Sdes lib/librpcsvc \ 78640975Sdes lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \ 78737535Sdes lib/libz lib/msun 78840975Sdes 789152941Stmclaughlib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L 79040975Sdeslib/libypclnt__L: lib/librpcsvc__L 79137535Sdes 79237535Sdes_generic_libs+= lib 79337535Sdes 794256257Sglebius.if !defined(NOCRYPT) && !defined(NOSECURE) 795256257Sglebius.if !defined(NO_OPENSSL) 796256257Sglebius_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl 79737535Sdes.if !defined(NO_OPENSSH) 79857686Ssheldonh_prebuild_libs+= secure/lib/libssh 79957686Ssheldonhsecure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L 80040975Sdes.endif 80140975Sdes.endif 80241989Sdes_generic_libs+= secure/lib 80359509Sphantom.endif 80440975Sdes 80540975Sdes_generic_libs+= usr.bin/lex/lib 806141851Sru 80739694Sdes.if ${MACHINE_ARCH} == "i386" 80839694Sdes_generic_libs+= usr.sbin/pcvt/keycap 80939694Sdes.endif 81057686Ssheldonh 81163013Sdes.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 81239694Sdes${_lib}__L: .PHONY 81363013Sdes.if exists(${.CURDIR}/${_lib}) 81463013Sdes @${ECHODIR} "===> ${_lib}"; \ 81540939Sdes cd ${.CURDIR}/${_lib}; \ 81640939Sdes ${MAKE} DIRPRFX=${_lib}/ depend; \ 81757686Ssheldonh ${MAKE} DIRPRFX=${_lib}/ all; \ 81857686Ssheldonh ${MAKE} DIRPRFX=${_lib}/ install 81940939Sdes.endif 82040939Sdes.endfor 82140939Sdes 82255544Sdes# libpam is special: we need to build static PAM modules before 82355544Sdes# static PAM library, and dynamic PAM library before dynamic PAM 82455544Sdes# modules. 825256257Sglebiuslib/libpam__L: .PHONY 826256257Sglebius @${ECHODIR} "===> lib/libpam"; \ 827256257Sglebius cd ${.CURDIR}/lib/libpam; \ 828256257Sglebius ${MAKE} DIRPRFX=lib/libpam/ depend; \ 82963340Sdes ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ 83063340Sdes ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install 83140939Sdes 83260924Sdes_startup_libs: ${_startup_libs:S/$/__L/} 83360924Sdes_prebuild_libs: ${_prebuild_libs:S/$/__L/} 83460924Sdes_generic_libs: ${_generic_libs:S/$/__L/} 835 836.for __target in all clean cleandepend cleandir depend includes obj 837.for entry in ${SUBDIR} 838${entry}.${__target}__D: .PHONY 839 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 840 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \ 841 edir=${entry}.${MACHINE_ARCH}; \ 842 cd ${.CURDIR}/$${edir}; \ 843 else \ 844 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ 845 edir=${entry}; \ 846 cd ${.CURDIR}/$${edir}; \ 847 fi; \ 848 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 849.endfor 850par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 851.endfor 852 853.include <bsd.subdir.mk> 854