Makefile revision 126024
135137Sphk# 235137Sphk# $FreeBSD: head/Makefile 126024 2004-02-19 21:09:58Z gad $ 335137Sphk# 435137Sphk# The user-driven targets are: 535137Sphk# 635137Sphk# universe - *Really* build *everything* (buildworld and 735137Sphk# all kernels on all architectures). 835137Sphk# buildworld - Rebuild *everything*, including glue to help do 935137Sphk# upgrades. 1035137Sphk# installworld - Install everything built by "buildworld". 1135137Sphk# world - buildworld + installworld. 1235137Sphk# buildkernel - Rebuild the kernel and the kernel-modules. 1335137Sphk# installkernel - Install the kernel and the kernel-modules. 1435137Sphk# installkernel.debug 1535137Sphk# reinstallkernel - Reinstall the kernel and the kernel-modules. 1635137Sphk# reinstallkernel.debug 1735137Sphk# kernel - buildkernel + installkernel. 1835137Sphk# update - Convenient way to update your source tree (cvs). 1935137Sphk# 2035137Sphk# This makefile is simple by design. The FreeBSD make automatically reads 2135137Sphk# the /usr/share/mk/sys.mk unless the -m argument is specified on the 2235137Sphk# command line. By keeping this makefile simple, it doesn't matter too 2335137Sphk# much how different the installed mk files are from those in the source 2435137Sphk# tree. This makefile executes a child make process, forcing it to use 2535137Sphk# the mk files from the source tree which are supposed to DTRT. 2635137Sphk# 2735137Sphk# The user-driven targets (as listed above) are implemented in Makefile.inc1. 2835137Sphk# 2935137Sphk# If you want to build your system from source be sure that /usr/obj has 3061438Sasmodai# at least 400MB of diskspace available. 3135137Sphk# 3235137Sphk# For individuals wanting to build from the sources currently on their 3335137Sphk# system, the simple instructions are: 3435137Sphk# 3535137Sphk# 1. `cd /usr/src' (or to the directory containing your source tree). 3635137Sphk# 2. `make world' 3761438Sasmodai# 3861438Sasmodai# For individuals wanting to upgrade their sources (even if only a 3935137Sphk# delta of a few days): 4035137Sphk# 4135137Sphk# 1. `cd /usr/src' (or to the directory containing your source tree). 4235137Sphk# 2. `make buildworld' 4361438Sasmodai# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 4435137Sphk# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 4535137Sphk# 5. `reboot' (in single user mode: boot -s from the loader prompt). 4635137Sphk# 6. `mergemaster -p' 4735137Sphk# 7. `make installworld' 4835137Sphk# 8. `mergemaster' 4935137Sphk# 9. `reboot' 5035137Sphk# 5145114Sphk# See src/UPDATING `COMMON ITEMS' for more complete information. 5245114Sphk# 5345114Sphk# If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can 5445114Sphk# cross build world for other architectures using the buildworld target, 5545114Sphk# and once the world is built you can cross build a kernel using the 5645114Sphk# buildkernel target. 5745114Sphk# 5837669Scharnier# Define the user-driven targets. These are listed here in alphabetical 5937669Scharnier# order, but that's not important. 6050476Speter# 6137669Scharnier# Targets that begin with underscore are internal targets intended for 6235137Sphk# developer convenience only. They are intentionally not documented and 63103417Smike# completely subject to change without notice. 64103417Smike# 65103417SmikeTGTS= all all-man buildkernel buildworld checkdpadd clean \ 66103417Smike cleandepend cleandir depend distribute distributeworld everything \ 67103417Smike hierarchy install installcheck installkernel installkernel.debug\ 68103417Smike reinstallkernel reinstallkernel.debug installworld \ 69103417Smike libraries lint maninstall \ 70103417Smike obj objlink regress rerelease tags update \ 71103417Smike _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ 72103417Smike _build-tools _cross-tools _includes _libraries _depend 73103417Smike 7435734ScharnierBITGTS= files includes 7535734ScharnierBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 7635137SphkTGTS+= ${BITGTS} 7735137Sphk 7835137Sphk.ORDER: buildworld installworld 7935137Sphk.ORDER: buildworld distributeworld 8035734Scharnier.ORDER: buildworld buildkernel 8135137Sphk.ORDER: buildkernel installkernel 8235137Sphk.ORDER: buildkernel installkernel.debug 8335137Sphk.ORDER: buildkernel reinstallkernel 8435137Sphk.ORDER: buildkernel reinstallkernel.debug 8535137Sphk 8635137SphkPATH= /sbin:/bin:/usr/sbin:/usr/bin 8735137SphkMAKEOBJDIRPREFIX?= /usr/obj 8835137SphkMAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE} 8935137SphkBINMAKE= \ 9092883Simp `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \ 9135734Scharnier -m ${.CURDIR}/share/mk 92204966Suqs_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 93204966Suqs 9435137Sphk# 9535137Sphk# Make sure we have an up-to-date make(1). Only world and buildworld 9635137Sphk# should do this as those are the initial targets used for upgrades. 9735137Sphk# The user can define ALWAYS_CHECK_MAKE to have this check performed 9835137Sphk# for all targets. 99121540Speter# 10035137Sphk.if defined(ALWAYS_CHECK_MAKE) 10135137Sphk${TGTS}: upgrade_checks 10237669Scharnier.else 10335137Sphkbuildworld: upgrade_checks 10435137Sphk.endif 10535137Sphk 10635137Sphk# 10735137Sphk# This 'realclean' target is not included in TGTS, because it is not a 10835137Sphk# recursive target. All of the work for it is done right here. It is 10935137Sphk# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be 11035137Sphk# created by bsd.obj.mk, except that we don't want to .include that file 111204966Suqs# in this makefile. 112204966Suqs# 11335137Sphk# In the following, the first 'rm' in a series will usually remove all 11435137Sphk# files and directories. If it does not, then there are probably some 11535137Sphk# files with chflags set, so this unsets them and tries the 'rm' a 11635137Sphk# second time. There are situations where this target will be cleaning 11735137Sphk# some directories via more than one method, but that duplication is 118204966Suqs# needed to correctly handle all the possible situations. 11935137Sphk# 120204966SuqsBW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} 12135137Sphkrealclean: 12235137Sphk.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR} 12335137Sphk.if exists(${BW_CANONICALOBJDIR}/) 12435137Sphk -rm -rf ${BW_CANONICALOBJDIR}/* 12535137Sphk chflags -R 0 ${BW_CANONICALOBJDIR} 12635137Sphk rm -rf ${BW_CANONICALOBJDIR}/* 12735137Sphk.endif 12835137Sphk # To be safe in this case, fall back to a 'make cleandir' 12935137Sphk @cd ${.CURDIR}; ${_MAKE} cleandir 130204966Suqs.else 131204966Suqs -rm -rf ${.OBJDIR}/* 13235137Sphk chflags -R 0 ${.OBJDIR} 13335137Sphk rm -rf ${.OBJDIR}/* 13435137Sphk.endif 13538023Sbde 13635137Sphk# 13735137Sphk# Handle the user-driven targets, using the source relative mk files. 13835137Sphk# 13935137Sphk 14080203Skris${TGTS}: 14135137Sphk @cd ${.CURDIR}; \ 14235137Sphk ${_MAKE} ${.TARGET} 14335137Sphk 14435137Sphk# Set a reasonable default 14535137Sphk.MAIN: all 14635137Sphk 14735137SphkSTARTTIME!= LC_ALL=C date 14835137Sphk# 14935137Sphk# world 15035137Sphk# 15135137Sphk# Attempt to rebuild and reinstall *everything*, with reasonable chance of 15235137Sphk# success, regardless of how old your existing system is. 15335137Sphk# 15435137Sphkworld: upgrade_checks 15535137Sphk @echo "--------------------------------------------------------------" 15635137Sphk @echo ">>> make world started on ${STARTTIME}" 15735137Sphk @echo "--------------------------------------------------------------" 15835137Sphk.if target(pre-world) 15935137Sphk @echo 16035137Sphk @echo "--------------------------------------------------------------" 16135137Sphk @echo ">>> Making 'pre-world' target" 16235137Sphk @echo "--------------------------------------------------------------" 16337669Scharnier @cd ${.CURDIR}; ${_MAKE} pre-world 16435137Sphk.endif 16535137Sphk @cd ${.CURDIR}; ${_MAKE} buildworld 16635137Sphk @cd ${.CURDIR}; ${_MAKE} -B installworld 16735137Sphk.if target(post-world) 16835137Sphk @echo 16937669Scharnier @echo "--------------------------------------------------------------" 17035137Sphk @echo ">>> Making 'post-world' target" 17135137Sphk @echo "--------------------------------------------------------------" 17235137Sphk @cd ${.CURDIR}; ${_MAKE} post-world 17335137Sphk.endif 17435137Sphk @echo 17535137Sphk @echo "--------------------------------------------------------------" 17635137Sphk @echo ">>> make world completed on `LC_ALL=C date`" 17737669Scharnier @echo " (started ${STARTTIME})" 17835137Sphk @echo "--------------------------------------------------------------" 17935137Sphk 18035137Sphk# 18135137Sphk# kernel 18235137Sphk# 18335137Sphk# Short hand for `make buildkernel installkernel' 18435137Sphk# 18535137Sphkkernel: buildkernel installkernel 18637669Scharnier 18735137Sphk# 18835137Sphk# Perform a few tests to determine if the installed tools are adequate 18935137Sphk# for building the world. 19035137Sphk# 19135137Sphkupgrade_checks: 19235137Sphk @if ! (cd ${.CURDIR}/tools/regression/usr.bin/make && \ 19335137Sphk PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \ 194204966Suqs then \ 195204966Suqs (cd ${.CURDIR} && make make); \ 19635137Sphk fi 19735137Sphk 19835137Sphk# 19937669Scharnier# Upgrade make(1) to the current version using the installed 20035137Sphk# headers, libraries and tools. 20135137Sphk# 20235137SphkMMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \ 20335137Sphk DESTDIR= \ 20435137Sphk INSTALL="sh ${.CURDIR}/tools/install.sh" 20537669ScharnierMMAKE= ${MMAKEENV} make \ 20635137Sphk -D_UPGRADING \ 20735137Sphk -DNOMAN -DNOSHARED \ 20835137Sphk -DNO_CPU_CFLAGS -DNO_WERROR 20935137Sphk 21035137Sphkmake: .PHONY 21135137Sphk @echo 21235137Sphk @echo "--------------------------------------------------------------" 21337669Scharnier @echo ">>> Building an up-to-date make(1)" 21435137Sphk @echo "--------------------------------------------------------------" 21535137Sphk @cd ${.CURDIR}/usr.bin/make; \ 21635137Sphk ${MMAKE} obj && \ 21735137Sphk ${MMAKE} depend && \ 21835137Sphk ${MMAKE} all && \ 21937669Scharnier ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= 22035137Sphk 22135137Sphk# 22235137Sphk# universe 22335137Sphk# 22480203Skris# Attempt to rebuild *everything* for all supported architectures, 22535137Sphk# with reasonable chance of success, regardless of how old your 22635137Sphk# existing system is. 22735137Sphk# 22835137Sphki386_mach= pc98 22935137Sphkuniverse: 23037669Scharnier @echo "--------------------------------------------------------------" 23135137Sphk @echo ">>> make universe started on ${STARTTIME}" 23235137Sphk @echo "--------------------------------------------------------------" 23335137Sphk.for arch in i386 sparc64 alpha ia64 23435137Sphk.for mach in ${arch} ${${arch}_mach} 23535137Sphk @echo ">> ${mach} started on `LC_ALL=C date`" 23635137Sphk -cd ${.CURDIR} && ${MAKE} buildworld \ 23735137Sphk TARGET_ARCH=${arch} TARGET=${mach} \ 23835137Sphk __MAKE_CONF=/dev/null \ 23935137Sphk > _.${mach}.buildworld 2>&1 24035137Sphk @echo ">> ${mach} buildworld completed on `LC_ALL=C date`" 24135137Sphk.if exists(${.CURDIR}/sys/${mach}/conf/NOTES) 24235137Sphk -cd ${.CURDIR}/sys/${mach}/conf && ${MAKE} LINT \ 24335137Sphk > ${.CURDIR}/_.${mach}.makeLINT 2>&1 244204966Suqs.endif 24535137Sphk cd ${.CURDIR} && ${MAKE} buildkernels TARGET_ARCH=${arch} TARGET=${mach} 24635137Sphk @echo ">> ${mach} completed on `LC_ALL=C date`" 24735137Sphk.endfor 24874948Sphk.endfor 24945114Sphk @echo "--------------------------------------------------------------" 25045114Sphk @echo ">>> make universe completed on `LC_ALL=C date`" 25135137Sphk @echo " (started ${STARTTIME})" 25235137Sphk @echo "--------------------------------------------------------------" 25335137Sphk 25474948SphkKERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/conf && \ 25535137Sphk find [A-Z]*[A-Z] -type f -maxdepth 0 ! -name NOTES 25635137Sphk 25735137Sphkbuildkernels: 25835137Sphk.for kernel in ${KERNCONFS} 25935137Sphk -cd ${.CURDIR} && ${MAKE} buildkernel \ 26089583Sbillf KERNCONF=${kernel} \ 26135137Sphk __MAKE_CONF=/dev/null \ 26289583Sbillf > _.${TARGET}.${kernel} 2>&1 26335137Sphk.endfor 26435137Sphk