Makefile revision 96205
12061Sjkh#
250479Speter# $FreeBSD: head/Makefile 96205 2002-05-08 01:55:08Z jwd $
32061Sjkh#
438666Sjb# The user-driven targets are:
532427Sjb#
638666Sjb# buildworld          - Rebuild *everything*, including glue to help do
738666Sjb#                       upgrades.
838666Sjb# installworld        - Install everything built by "buildworld".
938666Sjb# world               - buildworld + installworld.
1064049Salex# buildkernel         - Rebuild the kernel and the kernel-modules.
1164049Salex# installkernel       - Install the kernel and the kernel-modules.
1266071Smarkm# reinstallkernel     - Reinstall the kernel and the kernel-modules.
1373504Sobrien# kernel              - buildkernel + installkernel.
1438666Sjb# update              - Convenient way to update your source tree (cvs).
1544918Sjkh# upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
1638666Sjb# most                - Build user commands, no libraries or include files.
1738666Sjb# installmost         - Install user commands, no libraries or include files.
1838666Sjb# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
1938666Sjb# aout-to-elf-build   - Build everything required to upgrade a system from
2038666Sjb#                       a.out to elf format (see below).
2138666Sjb# aout-to-elf-install - Install everything built by aout-to-elf-build (see
2238666Sjb#                       below).
2338978Sjb# move-aout-libs      - Move the a.out libraries into an aout sub-directory
2438978Sjb#                       of each elf library sub-directory.
2532427Sjb#
2638666Sjb# This makefile is simple by design. The FreeBSD make automatically reads
2738666Sjb# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
2838666Sjb# command line. By keeping this makefile simple, it doesn't matter too
2938666Sjb# much how different the installed mk files are from those in the source
3038666Sjb# tree. This makefile executes a child make process, forcing it to use
3138666Sjb# the mk files from the source tree which are supposed to DTRT.
3217308Speter#
3391606Skeramida# The user-driven targets (as listed above) are implemented in Makefile.inc1.
3419175Sbde#
3596205Sjwd# If you want to build your system from source be sure that /usr/obj has
3696205Sjwd# at least 400MB of diskspace available.
3738042Sbde#
3896205Sjwd# For individuals wanting to build from the sources currently on their
3996205Sjwd# system, the simple instructions are:
4038042Sbde#
4196205Sjwd# 1.  `cd /usr/src'  (or to the directory containing your source tree).
4296205Sjwd# 2.  `make world'
4317308Speter#
4496205Sjwd# For individuals wanting to upgrade their sources (even if only a
4596205Sjwd# delta of a few days):
4617308Speter#
4796205Sjwd# 1.  `cd /usr/src'       (or to the directory containing your source tree).
4896205Sjwd# 2.  `make buildworld'
4996205Sjwd# 3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
5096205Sjwd# 4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
5196205Sjwd# 5.  `reboot'        (in single user mode: boot -s from the loader prompt).
5296205Sjwd# 6.  `mergemaster -p'
5396205Sjwd# 7.  `make installworld'
5496205Sjwd# 8.  `mergemaster'
5596205Sjwd# 9.  `reboot'
5696205Sjwd#
5796205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information.
5896205Sjwd#
5945108Sobrien# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
6042128Speter# update the legacy support for aout. This includes all libraries, ld.so
6142128Speter# and boot objects. This part of build should be regarded as
6238666Sjb# deprecated and you should _not_ expect to be able to do this past the
6351361Sjb# release of 4.0. You have exactly one major release to move entirely
6438666Sjb# to elf.
6517308Speter#
6638666Sjb# ----------------------------------------------------------------------------
6717308Speter#
6838666Sjb#           Upgrading an i386 system from a.out to elf format
6917308Speter#
7027910Sasami#
7143226Sjkh# The aout->elf transition build is performed by doing a `make upgrade' (or
7243226Sjkh# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
7343226Sjkh# by a `make aout-to-elf-install', depending on user preference.
7438666Sjb# You need to have at least 320 Mb of free space for the object tree.
7527910Sasami#
7638666Sjb# The upgrade process checks the installed release. If this is 3.0-CURRENT,
7738666Sjb# it is assumed that your kernel contains all the syscalls required by the
7838666Sjb# current sources.
7927910Sasami#
8038666Sjb# The upgrade procedure will stop and ask for confirmation to proceed
8138666Sjb# several times. On each occasion, you can type Ctrl-C to abort the
8243226Sjkh# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
8343226Sjkh# the confirmation steps.
8427910Sasami#
8538666Sjb# At the end of the upgrade procedure, /etc/objformat is created or
8638666Sjb# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
8727910Sasami#
8838666Sjb# ----------------------------------------------------------------------------
8927910Sasami#
9017308Speter#
9138666Sjb# Define the user-driven targets. These are listed here in alphabetical
9238666Sjb# order, but that's not important.
9317308Speter#
9495509SruTGTS=	all all-man buildkernel buildworld checkdpadd clean \
9595793Sru	cleandepend cleandir depend distribute distributeworld everything \
9695730Sru	hierarchy includes install installcheck installkernel \
9796164Sru	reinstallkernel installmost installworld libraries lint maninstall \
9895146Sgshapiro	mk most obj objlink regress rerelease tags update
992061Sjkh
10095730Sru.ORDER: buildworld installworld
10195793Sru.ORDER: buildworld distributeworld
10295730Sru.ORDER: buildkernel installkernel
10395730Sru.ORDER: buildkernel reinstallkernel
10495730Sru
10555026SmarcelPATH=	/sbin:/bin:/usr/sbin:/usr/bin
10655026SmarcelMAKE=	PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
10754324Smarcel
10817308Speter#
10938666Sjb# Handle the user-driven targets, using the source relative mk files.
11017308Speter#
11155678Smarcel${TGTS}: upgrade_checks
11238666Sjb	@cd ${.CURDIR}; \
11354324Smarcel		${MAKE} ${.TARGET}
1142302Spaul
11539206Sjkh# Set a reasonable default
11639206Sjkh.MAIN:	all
11739206Sjkh
11873349SruSTARTTIME!= LC_ALL=C date
11917308Speter#
12054324Smarcel# world
12154324Smarcel#
12254324Smarcel# Attempt to rebuild and reinstall *everything*, with reasonable chance of
12354324Smarcel# success, regardless of how old your existing system is.
12454324Smarcel#
12554324Smarcelworld: upgrade_checks
12654324Smarcel	@echo "--------------------------------------------------------------"
12769659Sobrien	@echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
12854324Smarcel	@echo "--------------------------------------------------------------"
12954324Smarcel.if target(pre-world)
13054324Smarcel	@echo
13154324Smarcel	@echo "--------------------------------------------------------------"
13254324Smarcel	@echo ">>> Making 'pre-world' target"
13354324Smarcel	@echo "--------------------------------------------------------------"
13454324Smarcel	@cd ${.CURDIR}; ${MAKE} pre-world
13554324Smarcel.endif
13654324Smarcel	@cd ${.CURDIR}; ${MAKE} buildworld
13754324Smarcel	@cd ${.CURDIR}; ${MAKE} -B installworld
13854324Smarcel.if target(post-world)
13954324Smarcel	@echo
14054324Smarcel	@echo "--------------------------------------------------------------"
14154324Smarcel	@echo ">>> Making 'post-world' target"
14254324Smarcel	@echo "--------------------------------------------------------------"
14354324Smarcel	@cd ${.CURDIR}; ${MAKE} post-world
14454324Smarcel.endif
14554324Smarcel	@echo
14654324Smarcel	@echo "--------------------------------------------------------------"
14773504Sobrien	@printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n                        (started ${STARTTIME})\n"
14854324Smarcel	@echo "--------------------------------------------------------------"
14954324Smarcel
15054324Smarcel#
15195730Sru# kernel
15295730Sru#
15395730Sru# Short hand for `make buildkernel installkernel'
15495730Sru#
15595730Srukernel: buildkernel installkernel
15695730Sru
15795730Sru#
15838666Sjb# Perform a few tests to determine if the installed tools are adequate
15938666Sjb# for building the world. These are for older systems (prior to 2.2.5).
16017308Speter#
16138666Sjb# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
16238666Sjb# so the normal make world is capable of doing what is required to update
16338666Sjb# the system to current.
16417308Speter#
16555678Smarcelupgrade_checks:
16655678Smarcel	@cd ${.CURDIR}; \
16755678Smarcel		if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \
16855678Smarcel			make make; \
16955678Smarcel		fi
17090395Sru	@cd ${.CURDIR}; \
17190395Sru		if make -V .CURDIR:C/.// 2>&1 >/dev/null | \
17290395Sru		    grep -q "Unknown modifier 'C'"; then \
17390395Sru			make make; \
17490395Sru		fi
1752061Sjkh
17617308Speter#
17738666Sjb# A simple test target used as part of the test to see if make supports
17838666Sjb# the -m argument.
17917308Speter#
18055678Smarceltest:
1813626Swollman
18217308Speter#
18355678Smarcel# Upgrade the installed make to the current version using the installed
18455678Smarcel# headers, libraries and build tools. This is required on installed versions
18555678Smarcel# prior to 2.2.5 in which the installed make doesn't support the -m argument.
18655678Smarcel#
18755678Smarcelmake:
18855678Smarcel	@echo
18955678Smarcel	@echo "--------------------------------------------------------------"
19055678Smarcel	@echo " Upgrading the installed make"
19155678Smarcel	@echo "--------------------------------------------------------------"
19255678Smarcel	@cd ${.CURDIR}/usr.bin/make; \
19355678Smarcel		make obj && make depend && make all && make install
19455678Smarcel
19555678Smarcel#
19638666Sjb# Define the upgrade targets. These are listed here in alphabetical
19738666Sjb# order, but that's not important.
19817308Speter#
19955678SmarcelUPGRADE=	aout-to-elf aout-to-elf-build aout-to-elf-install \
20038978Sjb		move-aout-libs
2013626Swollman
20217308Speter#
20338666Sjb# Handle the upgrade targets, using the source relative mk files.
20417308Speter#
20543226Sjkh
20643226Sjkhupgrade:	aout-to-elf
20743226Sjkh
20838666Sjb${UPGRADE} : upgrade_checks
20938666Sjb	@cd ${.CURDIR}; \
21044103Smsmith		${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
211