Makefile revision 95793
12061Sjkh#
250479Speter# $FreeBSD: head/Makefile 95793 2002-04-30 11:50:01Z ru $
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#
3538666Sjb# For novices wanting to build from current sources, the simple instructions
3638666Sjb# are:
3738042Sbde#
3839726Sjb# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
3938666Sjb# 2.  `cd /usr/src'  (or to the directory containing your source tree).
4038666Sjb# 3.  `make world'
4138042Sbde#
4238666Sjb# Be warned, this will update your installed system, except for configuration
4349315Shoek# files in the /etc directory and for the kernel. You have to do those manually.
4417308Speter#
4538666Sjb# If at first you're a little nervous about having a `make world' update
4638666Sjb# your system, a `make buildworld' will build everything in the /usr/obj
4738666Sjb# tree without touching your installed system. To be of any further use
4838666Sjb# though, a `make installworld' is required.
4917308Speter#
5045108Sobrien# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
5142128Speter# update the legacy support for aout. This includes all libraries, ld.so
5242128Speter# and boot objects. This part of build should be regarded as
5338666Sjb# deprecated and you should _not_ expect to be able to do this past the
5451361Sjb# release of 4.0. You have exactly one major release to move entirely
5538666Sjb# to elf.
5617308Speter#
5738666Sjb# ----------------------------------------------------------------------------
5817308Speter#
5938666Sjb#           Upgrading an i386 system from a.out to elf format
6017308Speter#
6127910Sasami#
6243226Sjkh# The aout->elf transition build is performed by doing a `make upgrade' (or
6343226Sjkh# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
6443226Sjkh# by a `make aout-to-elf-install', depending on user preference.
6538666Sjb# You need to have at least 320 Mb of free space for the object tree.
6627910Sasami#
6738666Sjb# The upgrade process checks the installed release. If this is 3.0-CURRENT,
6838666Sjb# it is assumed that your kernel contains all the syscalls required by the
6938666Sjb# current sources.
7027910Sasami#
7138666Sjb# The upgrade procedure will stop and ask for confirmation to proceed
7238666Sjb# several times. On each occasion, you can type Ctrl-C to abort the
7343226Sjkh# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
7443226Sjkh# the confirmation steps.
7527910Sasami#
7638666Sjb# At the end of the upgrade procedure, /etc/objformat is created or
7738666Sjb# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
7827910Sasami#
7938666Sjb# ----------------------------------------------------------------------------
8027910Sasami#
8117308Speter#
8238666Sjb# Define the user-driven targets. These are listed here in alphabetical
8338666Sjb# order, but that's not important.
8417308Speter#
8595509SruTGTS=	all all-man buildkernel buildworld checkdpadd clean \
8695793Sru	cleandepend cleandir depend distribute distributeworld everything \
8795730Sru	hierarchy includes install installcheck installkernel \
8895306Sru	reinstallkernel installmost installworld libraries lint \
8995146Sgshapiro	mk most obj objlink regress rerelease tags update
902061Sjkh
9195730Sru.ORDER: buildworld installworld
9295793Sru.ORDER: buildworld distributeworld
9395730Sru.ORDER: buildkernel installkernel
9495730Sru.ORDER: buildkernel reinstallkernel
9595730Sru
9655026SmarcelPATH=	/sbin:/bin:/usr/sbin:/usr/bin
9755026SmarcelMAKE=	PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
9854324Smarcel
9917308Speter#
10038666Sjb# Handle the user-driven targets, using the source relative mk files.
10117308Speter#
10255678Smarcel${TGTS}: upgrade_checks
10338666Sjb	@cd ${.CURDIR}; \
10454324Smarcel		${MAKE} ${.TARGET}
1052302Spaul
10639206Sjkh# Set a reasonable default
10739206Sjkh.MAIN:	all
10839206Sjkh
10973349SruSTARTTIME!= LC_ALL=C date
11017308Speter#
11154324Smarcel# world
11254324Smarcel#
11354324Smarcel# Attempt to rebuild and reinstall *everything*, with reasonable chance of
11454324Smarcel# success, regardless of how old your existing system is.
11554324Smarcel#
11654324Smarcelworld: upgrade_checks
11754324Smarcel	@echo "--------------------------------------------------------------"
11869659Sobrien	@echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
11954324Smarcel	@echo "--------------------------------------------------------------"
12054324Smarcel.if target(pre-world)
12154324Smarcel	@echo
12254324Smarcel	@echo "--------------------------------------------------------------"
12354324Smarcel	@echo ">>> Making 'pre-world' target"
12454324Smarcel	@echo "--------------------------------------------------------------"
12554324Smarcel	@cd ${.CURDIR}; ${MAKE} pre-world
12654324Smarcel.endif
12754324Smarcel	@cd ${.CURDIR}; ${MAKE} buildworld
12854324Smarcel	@cd ${.CURDIR}; ${MAKE} -B installworld
12954324Smarcel.if target(post-world)
13054324Smarcel	@echo
13154324Smarcel	@echo "--------------------------------------------------------------"
13254324Smarcel	@echo ">>> Making 'post-world' target"
13354324Smarcel	@echo "--------------------------------------------------------------"
13454324Smarcel	@cd ${.CURDIR}; ${MAKE} post-world
13554324Smarcel.endif
13654324Smarcel	@echo
13754324Smarcel	@echo "--------------------------------------------------------------"
13873504Sobrien	@printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n                        (started ${STARTTIME})\n"
13954324Smarcel	@echo "--------------------------------------------------------------"
14054324Smarcel
14154324Smarcel#
14295730Sru# kernel
14395730Sru#
14495730Sru# Short hand for `make buildkernel installkernel'
14595730Sru#
14695730Srukernel: buildkernel installkernel
14795730Sru
14895730Sru#
14938666Sjb# Perform a few tests to determine if the installed tools are adequate
15038666Sjb# for building the world. These are for older systems (prior to 2.2.5).
15117308Speter#
15238666Sjb# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
15338666Sjb# so the normal make world is capable of doing what is required to update
15438666Sjb# the system to current.
15517308Speter#
15655678Smarcelupgrade_checks:
15755678Smarcel	@cd ${.CURDIR}; \
15855678Smarcel		if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \
15955678Smarcel			make make; \
16055678Smarcel		fi
16190395Sru	@cd ${.CURDIR}; \
16290395Sru		if make -V .CURDIR:C/.// 2>&1 >/dev/null | \
16390395Sru		    grep -q "Unknown modifier 'C'"; then \
16490395Sru			make make; \
16590395Sru		fi
1662061Sjkh
16717308Speter#
16838666Sjb# A simple test target used as part of the test to see if make supports
16938666Sjb# the -m argument.
17017308Speter#
17155678Smarceltest:
1723626Swollman
17317308Speter#
17455678Smarcel# Upgrade the installed make to the current version using the installed
17555678Smarcel# headers, libraries and build tools. This is required on installed versions
17655678Smarcel# prior to 2.2.5 in which the installed make doesn't support the -m argument.
17755678Smarcel#
17855678Smarcelmake:
17955678Smarcel	@echo
18055678Smarcel	@echo "--------------------------------------------------------------"
18155678Smarcel	@echo " Upgrading the installed make"
18255678Smarcel	@echo "--------------------------------------------------------------"
18355678Smarcel	@cd ${.CURDIR}/usr.bin/make; \
18455678Smarcel		make obj && make depend && make all && make install
18555678Smarcel
18655678Smarcel#
18738666Sjb# Define the upgrade targets. These are listed here in alphabetical
18838666Sjb# order, but that's not important.
18917308Speter#
19055678SmarcelUPGRADE=	aout-to-elf aout-to-elf-build aout-to-elf-install \
19138978Sjb		move-aout-libs
1923626Swollman
19317308Speter#
19438666Sjb# Handle the upgrade targets, using the source relative mk files.
19517308Speter#
19643226Sjkh
19743226Sjkhupgrade:	aout-to-elf
19843226Sjkh
19938666Sjb${UPGRADE} : upgrade_checks
20038666Sjb	@cd ${.CURDIR}; \
20144103Smsmith		${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
202