Makefile revision 116696
12061Sjkh#
250479Speter# $FreeBSD: head/Makefile 116696 2003-06-22 21:56:22Z ru $
32061Sjkh#
438666Sjb# The user-driven targets are:
532427Sjb#
6111131Sru# universe            - *Really* build *everything* (buildworld and
7111131Sru#                       all kernels on all architectures).
838666Sjb# buildworld          - Rebuild *everything*, including glue to help do
938666Sjb#                       upgrades.
1038666Sjb# installworld        - Install everything built by "buildworld".
1138666Sjb# world               - buildworld + installworld.
1264049Salex# buildkernel         - Rebuild the kernel and the kernel-modules.
1364049Salex# installkernel       - Install the kernel and the kernel-modules.
14116679Ssimokawa# installkernel.debug
1566071Smarkm# reinstallkernel     - Reinstall the kernel and the kernel-modules.
16116679Ssimokawa# reinstallkernel.debug
1773504Sobrien# kernel              - buildkernel + installkernel.
1838666Sjb# update              - Convenient way to update your source tree (cvs).
1938666Sjb# most                - Build user commands, no libraries or include files.
2038666Sjb# installmost         - Install user commands, no libraries or include files.
2132427Sjb#
2238666Sjb# This makefile is simple by design. The FreeBSD make automatically reads
23108451Sschweikh# the /usr/share/mk/sys.mk unless the -m argument is specified on the
2438666Sjb# command line. By keeping this makefile simple, it doesn't matter too
2538666Sjb# much how different the installed mk files are from those in the source
2638666Sjb# tree. This makefile executes a child make process, forcing it to use
2738666Sjb# the mk files from the source tree which are supposed to DTRT.
2817308Speter#
2991606Skeramida# The user-driven targets (as listed above) are implemented in Makefile.inc1.
3019175Sbde#
3196205Sjwd# If you want to build your system from source be sure that /usr/obj has
3296205Sjwd# at least 400MB of diskspace available.
3338042Sbde#
3496205Sjwd# For individuals wanting to build from the sources currently on their
3596205Sjwd# system, the simple instructions are:
3638042Sbde#
3796205Sjwd# 1.  `cd /usr/src'  (or to the directory containing your source tree).
3896205Sjwd# 2.  `make world'
3917308Speter#
4096205Sjwd# For individuals wanting to upgrade their sources (even if only a
4196205Sjwd# delta of a few days):
4217308Speter#
4396205Sjwd# 1.  `cd /usr/src'       (or to the directory containing your source tree).
4496205Sjwd# 2.  `make buildworld'
4596205Sjwd# 3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
4696205Sjwd# 4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
4796205Sjwd# 5.  `reboot'        (in single user mode: boot -s from the loader prompt).
4896205Sjwd# 6.  `mergemaster -p'
4996205Sjwd# 7.  `make installworld'
5096205Sjwd# 8.  `mergemaster'
5196205Sjwd# 9.  `reboot'
5296205Sjwd#
5396205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information.
5496205Sjwd#
5598775Sdillon# If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can
5698723Sdillon# cross build world for other architectures using the buildworld target,
5798723Sdillon# and once the world is built you can cross build a kernel using the
5898723Sdillon# buildkernel target.
5998723Sdillon#
6038666Sjb# Define the user-driven targets. These are listed here in alphabetical
6138666Sjb# order, but that's not important.
6217308Speter#
6395509SruTGTS=	all all-man buildkernel buildworld checkdpadd clean \
6495793Sru	cleandepend cleandir depend distribute distributeworld everything \
65116679Ssimokawa	hierarchy install installcheck installkernel installkernel.debug\
66116679Ssimokawa	reinstallkernel reinstallkernel.debug installmost installworld \
67116679Ssimokawa	libraries lint maninstall \
6895146Sgshapiro	mk most obj objlink regress rerelease tags update
692061Sjkh
7097769SruBITGTS=	files includes
7197252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
7297252Sru
7395730Sru.ORDER: buildworld installworld
7495793Sru.ORDER: buildworld distributeworld
75111617Sru.ORDER: buildworld buildkernel
7695730Sru.ORDER: buildkernel installkernel
77116679Ssimokawa.ORDER: buildkernel installkernel.debug
7895730Sru.ORDER: buildkernel reinstallkernel
79116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug
8095730Sru
81110035SruPATH=	/sbin:/bin:/usr/sbin:/usr/bin
82107516SruMAKEOBJDIRPREFIX?=	/usr/obj
83110035SruMAKEPATH=	${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
84110035Sru_MAKE=	PATH=${PATH} \
85110035Sru	`if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
86110035Sru	-m ${.CURDIR}/share/mk -f Makefile.inc1
8754324Smarcel
8817308Speter#
8938666Sjb# Handle the user-driven targets, using the source relative mk files.
9017308Speter#
9197252Sru${TGTS} ${BITGTS}: upgrade_checks
9238666Sjb	@cd ${.CURDIR}; \
93110035Sru		${_MAKE} ${.TARGET}
942302Spaul
9539206Sjkh# Set a reasonable default
9639206Sjkh.MAIN:	all
9739206Sjkh
9873349SruSTARTTIME!= LC_ALL=C date
9917308Speter#
10054324Smarcel# world
10154324Smarcel#
10254324Smarcel# Attempt to rebuild and reinstall *everything*, with reasonable chance of
10354324Smarcel# success, regardless of how old your existing system is.
10454324Smarcel#
10554324Smarcelworld: upgrade_checks
10654324Smarcel	@echo "--------------------------------------------------------------"
107103436Speter	@echo ">>> elf make world started on ${STARTTIME}"
10854324Smarcel	@echo "--------------------------------------------------------------"
10954324Smarcel.if target(pre-world)
11054324Smarcel	@echo
11154324Smarcel	@echo "--------------------------------------------------------------"
11254324Smarcel	@echo ">>> Making 'pre-world' target"
11354324Smarcel	@echo "--------------------------------------------------------------"
114110035Sru	@cd ${.CURDIR}; ${_MAKE} pre-world
11554324Smarcel.endif
116110035Sru	@cd ${.CURDIR}; ${_MAKE} buildworld
117110035Sru	@cd ${.CURDIR}; ${_MAKE} -B installworld
11854324Smarcel.if target(post-world)
11954324Smarcel	@echo
12054324Smarcel	@echo "--------------------------------------------------------------"
12154324Smarcel	@echo ">>> Making 'post-world' target"
12254324Smarcel	@echo "--------------------------------------------------------------"
123110035Sru	@cd ${.CURDIR}; ${_MAKE} post-world
12454324Smarcel.endif
12554324Smarcel	@echo
12654324Smarcel	@echo "--------------------------------------------------------------"
127103436Speter	@printf ">>> elf make world completed on `LC_ALL=C date`\n                       (started ${STARTTIME})\n"
12854324Smarcel	@echo "--------------------------------------------------------------"
12954324Smarcel
13054324Smarcel#
13195730Sru# kernel
13295730Sru#
13395730Sru# Short hand for `make buildkernel installkernel'
13495730Sru#
13595730Srukernel: buildkernel installkernel
13695730Sru
13795730Sru#
13838666Sjb# Perform a few tests to determine if the installed tools are adequate
139107374Sru# for building the world.
14017308Speter#
14155678Smarcelupgrade_checks:
142110035Sru	@if ! (cd ${.CURDIR}/tools/regression/usr.bin/make && \
143116696Sru	    PATH=${PATH} ${MAKE} >/dev/null 2>&1); \
144110035Sru	then \
145110035Sru	    (cd ${.CURDIR} && make make); \
146110035Sru	fi
1472061Sjkh
14817308Speter#
149107516Sru# Upgrade make(1) to the current version using the installed
150107374Sru# headers, libraries and tools.
15155678Smarcel#
152107516SruMMAKEENV=	MAKEOBJDIRPREFIX=${MAKEPATH} \
153107516Sru		DESTDIR= \
154107516Sru		INSTALL="sh ${.CURDIR}/tools/install.sh"
155107516SruMMAKE=		${MMAKEENV} make \
156107516Sru		-D_UPGRADING \
157107516Sru		-DNOMAN -DNOSHARED \
158107516Sru		-DNO_CPU_CFLAGS -DNO_WERROR
159107516Sru
16055678Smarcelmake:
16155678Smarcel	@echo
16255678Smarcel	@echo "--------------------------------------------------------------"
163116696Sru	@echo ">>> Building an up-to-date make(1)"
16455678Smarcel	@echo "--------------------------------------------------------------"
16555678Smarcel	@cd ${.CURDIR}/usr.bin/make; \
166107516Sru		${MMAKE} obj && \
167107516Sru		${MMAKE} depend && \
168107516Sru		${MMAKE} all && \
169107516Sru		${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
17055678Smarcel
17155678Smarcel#
172111131Sru# universe
173111131Sru#
174111131Sru# Attempt to rebuild *everything* for all supported architectures,
175111131Sru# with reasonable chance of success, regardless of how old your
176111131Sru# existing system is.
177111131Sru#
178111131Srui386_mach=	pc98
179103985Sphkuniverse:
180103985Sphk	@echo "--------------------------------------------------------------"
181103985Sphk	@echo ">>> make universe started on ${STARTTIME}"
182103985Sphk	@echo "--------------------------------------------------------------"
183111089Sphk.for arch in i386 sparc64 alpha ia64
184111131Sru.for mach in ${arch} ${${arch}_mach}
185111131Sru	@echo ">> ${mach} started on `LC_ALL=C date`"
186111131Sru	-cd ${.CURDIR} && ${MAKE} buildworld \
187111131Sru	    TARGET_ARCH=${arch} TARGET=${mach} \
188111131Sru	    __MAKE_CONF=/dev/null \
189111131Sru	    > _.${mach}.buildworld 2>&1
190111131Sru	@echo ">> ${mach} buildworld completed on `LC_ALL=C date`"
191111131Sru.if exists(${.CURDIR}/sys/${mach}/conf/NOTES)
192111131Sru	-cd ${.CURDIR}/sys/${mach}/conf && ${MAKE} LINT \
193111133Sru	    > ${.CURDIR}/_.${mach}.makeLINT 2>&1
194103985Sphk.endif
195111131Sru	cd ${.CURDIR} && ${MAKE} buildkernels TARGET_ARCH=${arch} TARGET=${mach}
196111131Sru	@echo ">> ${mach} completed on `LC_ALL=C date`"
197103985Sphk.endfor
198111131Sru.endfor
199103985Sphk	@echo "--------------------------------------------------------------"
200107884Simp	@printf ">>> make universe completed on `LC_ALL=C date`\n                      (started ${STARTTIME})\n"
201103985Sphk	@echo "--------------------------------------------------------------"
202103985Sphk
203111131SruKERNCONFS!=	cd ${.CURDIR}/sys/${TARGET}/conf && \
204111131Sru		find [A-Z]*[A-Z] -type f -maxdepth 0 ! -name NOTES
205103985Sphk
206103985Sphkbuildkernels:
207111131Sru.for kernel in ${KERNCONFS}
208111131Sru	-cd ${.CURDIR} && ${MAKE} buildkernel \
209111131Sru	    KERNCONF=${kernel} \
210111131Sru	    __MAKE_CONF=/dev/null \
211111131Sru	    > _.${TARGET}.${kernel} 2>&1
212103985Sphk.endfor
213