Makefile revision 96462
125164Speter#
225164Speter# $FreeBSD: head/Makefile 96462 2002-05-12 16:01:00Z ru $
325164Speter#
425164Speter# The user-driven targets are:
525164Speter#
625164Speter# buildworld          - Rebuild *everything*, including glue to help do
725164Speter#                       upgrades.
825164Speter# installworld        - Install everything built by "buildworld".
925164Speter# world               - buildworld + installworld.
1025164Speter# buildkernel         - Rebuild the kernel and the kernel-modules.
1125164Speter# installkernel       - Install the kernel and the kernel-modules.
1225164Speter# reinstallkernel     - Reinstall the kernel and the kernel-modules.
1325164Speter# kernel              - buildkernel + installkernel.
1425164Speter# update              - Convenient way to update your source tree (cvs).
1525164Speter# upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
1625164Speter# most                - Build user commands, no libraries or include files.
1725164Speter# installmost         - Install user commands, no libraries or include files.
1825164Speter# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
1925164Speter# aout-to-elf-build   - Build everything required to upgrade a system from
2025164Speter#                       a.out to elf format (see below).
2125164Speter# aout-to-elf-install - Install everything built by aout-to-elf-build (see
2225164Speter#                       below).
2325164Speter# move-aout-libs      - Move the a.out libraries into an aout sub-directory
2425164Speter#                       of each elf library sub-directory.
2540169Skato#
2625164Speter# This makefile is simple by design. The FreeBSD make automatically reads
2725164Speter# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
2825164Speter# command line. By keeping this makefile simple, it doesn't matter too
2930265Speter# much how different the installed mk files are from those in the source
3034197Stegge# tree. This makefile executes a child make process, forcing it to use
3138422Smsmith# the mk files from the source tree which are supposed to DTRT.
3225164Speter#
3331639Sfsmp# The user-driven targets (as listed above) are implemented in Makefile.inc1.
3431639Sfsmp#
3531639Sfsmp# If you want to build your system from source be sure that /usr/obj has
3631639Sfsmp# at least 400MB of diskspace available.
3731639Sfsmp#
3831639Sfsmp# For individuals wanting to build from the sources currently on their
3928743Sbde# system, the simple instructions are:
4025164Speter#
4128808Speter# 1.  `cd /usr/src'  (or to the directory containing your source tree).
4228808Speter# 2.  `make world'
4328808Speter#
4431639Sfsmp# For individuals wanting to upgrade their sources (even if only a
4531639Sfsmp# delta of a few days):
4631639Sfsmp#
4725164Speter# 1.  `cd /usr/src'       (or to the directory containing your source tree).
4828808Speter# 2.  `make buildworld'
4928808Speter# 3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
5028808Speter# 4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
5126812Speter# 5.  `reboot'        (in single user mode: boot -s from the loader prompt).
5226812Speter# 6.  `mergemaster -p'
5331639Sfsmp# 7.  `make installworld'
5431639Sfsmp# 8.  `mergemaster'
5531639Sfsmp# 9.  `reboot'
5631639Sfsmp#
5731689Stegge# See src/UPDATING `COMMON ITEMS' for more complete information.
5831689Stegge#
5931639Sfsmp# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
6031689Stegge# update the legacy support for aout. This includes all libraries, ld.so
6125164Speter# and boot objects. This part of build should be regarded as
6225164Speter# deprecated and you should _not_ expect to be able to do this past the
6325164Speter# release of 4.0. You have exactly one major release to move entirely
6425164Speter# to elf.
6525164Speter#
6627697Sfsmp# ----------------------------------------------------------------------------
6726812Speter#
6826896Stegge#           Upgrading an i386 system from a.out to elf format
6930112Sdyson#
7035077Speter#
7125164Speter# The aout->elf transition build is performed by doing a `make upgrade' (or
7225164Speter# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
7325164Speter# by a `make aout-to-elf-install', depending on user preference.
7425215Sfsmp# You need to have at least 320 Mb of free space for the object tree.
7527289Sfsmp#
7627289Sfsmp# The upgrade process checks the installed release. If this is 3.0-CURRENT,
7727289Sfsmp# it is assumed that your kernel contains all the syscalls required by the
7825215Sfsmp# current sources.
7925164Speter#
8028027Sfsmp# The upgrade procedure will stop and ask for confirmation to proceed
8128027Sfsmp# several times. On each occasion, you can type Ctrl-C to abort the
8228027Sfsmp# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
8328027Sfsmp# the confirmation steps.
8428027Sfsmp#
8528027Sfsmp# At the end of the upgrade procedure, /etc/objformat is created or
8627005Sfsmp# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
8727005Sfsmp#
8827005Sfsmp# ----------------------------------------------------------------------------
8925164Speter#
9040067Skato#
9140067Skato# Define the user-driven targets. These are listed here in alphabetical
9240067Skato# order, but that's not important.
9340067Skato#
9427005SfsmpTGTS=	all all-man buildkernel buildworld checkdpadd clean \
9527005Sfsmp	cleandepend cleandir depend distribute distributeworld everything \
9640067Skato	hierarchy includes incsinstall install installcheck installkernel \
9727005Sfsmp	reinstallkernel installmost installworld libraries lint maninstall \
9825164Speter	mk most obj objlink regress rerelease tags update
9927005Sfsmp
10027005Sfsmp.ORDER: buildworld installworld
10127005Sfsmp.ORDER: buildworld distributeworld
10227005Sfsmp.ORDER: buildkernel installkernel
10325164Speter.ORDER: buildkernel reinstallkernel
10426155Sfsmp
10526155SfsmpPATH=	/sbin:/bin:/usr/sbin:/usr/bin
10626155SfsmpMAKE=	PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
10726155Sfsmp
10827005Sfsmp#
10926155Sfsmp# Handle the user-driven targets, using the source relative mk files.
11026155Sfsmp#
11126155Sfsmp${TGTS}: upgrade_checks
11226155Sfsmp	@cd ${.CURDIR}; \
11326155Sfsmp		${MAKE} ${.TARGET}
11426155Sfsmp
11526155Sfsmp# Set a reasonable default
11626155Sfsmp.MAIN:	all
11726155Sfsmp
11826155SfsmpSTARTTIME!= LC_ALL=C date
11926155Sfsmp#
12026155Sfsmp# world
12126155Sfsmp#
12226155Sfsmp# Attempt to rebuild and reinstall *everything*, with reasonable chance of
12326155Sfsmp# success, regardless of how old your existing system is.
12426155Sfsmp#
12526155Sfsmpworld: upgrade_checks
12626155Sfsmp	@echo "--------------------------------------------------------------"
12726155Sfsmp	@echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
12826155Sfsmp	@echo "--------------------------------------------------------------"
12926155Sfsmp.if target(pre-world)
13026155Sfsmp	@echo
13126155Sfsmp	@echo "--------------------------------------------------------------"
13226155Sfsmp	@echo ">>> Making 'pre-world' target"
13326155Sfsmp	@echo "--------------------------------------------------------------"
13426155Sfsmp	@cd ${.CURDIR}; ${MAKE} pre-world
13526155Sfsmp.endif
13626155Sfsmp	@cd ${.CURDIR}; ${MAKE} buildworld
13726155Sfsmp	@cd ${.CURDIR}; ${MAKE} -B installworld
13826155Sfsmp.if target(post-world)
13926155Sfsmp	@echo
14026155Sfsmp	@echo "--------------------------------------------------------------"
14126155Sfsmp	@echo ">>> Making 'post-world' target"
14226155Sfsmp	@echo "--------------------------------------------------------------"
14326155Sfsmp	@cd ${.CURDIR}; ${MAKE} post-world
14426155Sfsmp.endif
14526155Sfsmp	@echo
14626155Sfsmp	@echo "--------------------------------------------------------------"
14726155Sfsmp	@printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n                        (started ${STARTTIME})\n"
14826155Sfsmp	@echo "--------------------------------------------------------------"
14926155Sfsmp
15026155Sfsmp#
15126155Sfsmp# kernel
15226155Sfsmp#
15326155Sfsmp# Short hand for `make buildkernel installkernel'
15426155Sfsmp#
15526155Sfsmpkernel: buildkernel installkernel
15626155Sfsmp
15726155Sfsmp#
15826155Sfsmp# Perform a few tests to determine if the installed tools are adequate
15926155Sfsmp# for building the world. These are for older systems (prior to 2.2.5).
16026155Sfsmp#
16126155Sfsmp# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
16226155Sfsmp# so the normal make world is capable of doing what is required to update
16326155Sfsmp# the system to current.
16426155Sfsmp#
16526155Sfsmpupgrade_checks:
16626155Sfsmp	@cd ${.CURDIR}; \
16726155Sfsmp		if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \
16826155Sfsmp			make make; \
16926155Sfsmp		fi
17026155Sfsmp	@cd ${.CURDIR}; \
17126155Sfsmp		if make -V .CURDIR:C/.// 2>&1 >/dev/null | \
17226155Sfsmp		    grep -q "Unknown modifier 'C'"; then \
17326155Sfsmp			make make; \
17426155Sfsmp		fi
17526155Sfsmp
17626155Sfsmp#
17726155Sfsmp# A simple test target used as part of the test to see if make supports
17826155Sfsmp# the -m argument.
17926155Sfsmp#
18026155Sfsmptest:
18126155Sfsmp
18226155Sfsmp#
18325164Speter# Upgrade the installed make to the current version using the installed
18425164Speter# headers, libraries and build tools. This is required on installed versions
18525164Speter# prior to 2.2.5 in which the installed make doesn't support the -m argument.
18625164Speter#
18725164Spetermake:
18825164Speter	@echo
18925164Speter	@echo "--------------------------------------------------------------"
19025164Speter	@echo " Upgrading the installed make"
19140169Skato	@echo "--------------------------------------------------------------"
19225164Speter	@cd ${.CURDIR}/usr.bin/make; \
19325164Speter		make obj && make depend && make all && make install
19425164Speter
19525164Speter#
19625164Speter# Define the upgrade targets. These are listed here in alphabetical
19725164Speter# order, but that's not important.
19825164Speter#
19925164SpeterUPGRADE=	aout-to-elf aout-to-elf-build aout-to-elf-install \
20025164Speter		move-aout-libs
20125164Speter
20225164Speter#
20325164Speter# Handle the upgrade targets, using the source relative mk files.
20425164Speter#
20525164Speter
20625164Speterupgrade:	aout-to-elf
20725164Speter
20825164Speter${UPGRADE} : upgrade_checks
20925164Speter	@cd ${.CURDIR}; \
21025164Speter		${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
21125164Speter