Makefile revision 39206
12061Sjkh#
239206Sjkh#	$Id: Makefile,v 1.217 1998/09/10 20:44:55 ache Exp $
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.
1038666Sjb# update              - Convenient way to update your source tree (cvs).
1138666Sjb# most                - Build user commands, no libraries or include files.
1238666Sjb# installmost         - Install user commands, no libraries or include files.
1338666Sjb# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
1438666Sjb# aout-to-elf-build   - Build everything required to upgrade a system from
1538666Sjb#                       a.out to elf format (see below).
1638666Sjb# aout-to-elf-install - Install everything built by aout-to-elf-build (see
1738666Sjb#                       below).
1838978Sjb# move-aout-libs      - Move the a.out libraries into an aout sub-directory
1938978Sjb#                       of each elf library sub-directory.
2032427Sjb#
2138666Sjb# This makefile is simple by design. The FreeBSD make automatically reads
2238666Sjb# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
2338666Sjb# command line. By keeping this makefile simple, it doesn't matter too
2438666Sjb# much how different the installed mk files are from those in the source
2538666Sjb# tree. This makefile executes a child make process, forcing it to use
2638666Sjb# the mk files from the source tree which are supposed to DTRT.
2717308Speter#
2838666Sjb# The user-driven targets (as listed above) are implemented in Makefile.inc0
2938666Sjb# and the private targets are in Makefile.inc1. These are kept separate
3038666Sjb# to help the bootstrap build from aout to elf format.
3119175Sbde#
3238666Sjb# For novices wanting to build from current sources, the simple instructions
3338666Sjb# are:
3438042Sbde#
3538666Sjb# 1.  Ensure that your /usr/obj directory has at least 165 Mb of free space.
3638666Sjb# 2.  `cd /usr/src'  (or to the directory containing your source tree).
3738666Sjb# 3.  `make world'
3838042Sbde#
3938666Sjb# Be warned, this will update your installed system, except for configuration
4038666Sjb# files in the /etc directory. You have to do those manually.
4117308Speter#
4238666Sjb# If at first you're a little nervous about having a `make world' update
4338666Sjb# your system, a `make buildworld' will build everything in the /usr/obj
4438666Sjb# tree without touching your installed system. To be of any further use
4538666Sjb# though, a `make installworld' is required.
4617308Speter#
4738666Sjb# The `make world' process always follows the installed object format.
4838666Sjb# This is set by creating /etc/objformat containing either OBJFORMAT=aout
4938666Sjb# or OBJFORMAT=elf. If this file does not exist, the object format defaults
5038666Sjb# to aout. This is expected to be changed to elf just prior to the release
5138666Sjb# or 3.0. If OBJFORMAT is set as an environment variable or in /etc/make.conf,
5238666Sjb# this overrides /etc/objformat.
5317308Speter#
5438666Sjb# Unless -DNOAOUT is specified, a `make world' with OBJFORMAT=elf will
5538666Sjb# update the legacy support for aout. This includes all libraries, ld.so,
5638666Sjb# lkms and boot objects. This part of build should be regarded as
5738666Sjb# deprecated and you should _not_ expect to be able to do this past the
5838666Sjb# release of 3.1. You have exactly one major release to move entirely
5938666Sjb# to elf.
6017308Speter#
6138666Sjb# ----------------------------------------------------------------------------
6217308Speter#
6338666Sjb#           Upgrading an i386 system from a.out to elf format
6417308Speter#
6527910Sasami#
6638666Sjb# The aout->elf transition build is performed by doing a `make aout-to-elf'
6738666Sjb# or a `make aout-to-elf-build' followed by a `make aout-to-elf-install'.
6838666Sjb# You need to have at least 320 Mb of free space for the object tree.
6927910Sasami#
7038666Sjb# The upgrade process checks the installed release. If this is 3.0-CURRENT,
7138666Sjb# it is assumed that your kernel contains all the syscalls required by the
7238666Sjb# current sources.
7327910Sasami#
7438666Sjb# For installed systems where `uname -r' reports something other than
7538666Sjb# 3.0-CURRENT, the upgrade process expects to build a kernel using the
7638666Sjb# kernel configuration file sys/i386/conf/GENERICupgrade. This file is
7738666Sjb# defaulted to the GENERIC kernel configuration file on the assumption that
7838666Sjb# it will be suitable for most systems. Before performing the upgrade,
7938666Sjb# replace sys/i386/conf/GENERICupgrade with your own version if your
8038666Sjb# hardware requires a different configuration.
8117308Speter#
8238666Sjb# The upgrade procedure will stop and ask for confirmation to proceed
8338666Sjb# several times. On each occasion, you can type Ctrl-C to abort the
8438666Sjb# upgrade.
8527910Sasami#
8638666Sjb# At the end of the upgrade procedure, /etc/objformat is created or
8738666Sjb# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
8827910Sasami#
8938666Sjb# ----------------------------------------------------------------------------
9027910Sasami#
9117308Speter#
9238666Sjb# Define the user-driven targets. These are listed here in alphabetical
9338666Sjb# order, but that's not important.
9417308Speter#
9538978SjbTGTS =	afterdistribute all buildworld clean cleandepend cleanobj depend \
9639055Sache	distribute everything hierarchy includes installmost install \
9739055Sache	installworld most obj rerelease update world
982061Sjkh
9917308Speter#
10038666Sjb# Handle the user-driven targets, using the source relative mk files.
10117308Speter#
10238666Sjb${TGTS} : upgrade_checks
10338666Sjb	@cd ${.CURDIR}; \
10438666Sjb		make -f Makefile.inc0 -m ${.CURDIR}/share/mk ${.TARGET}
1052302Spaul
10639206Sjkh# Set a reasonable default
10739206Sjkh.MAIN:	all
10839206Sjkh
10917308Speter#
11038666Sjb# Perform a few tests to determine if the installed tools are adequate
11138666Sjb# for building the world. These are for older systems (prior to 2.2.5).
11217308Speter#
11338666Sjb# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
11438666Sjb# so the normal make world is capable of doing what is required to update
11538666Sjb# the system to current.
11617308Speter#
11738666Sjbupgrade_checks :
11838666Sjb	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else make -f Makefile.upgrade make; fi;
1192061Sjkh
12017308Speter#
12138666Sjb# A simple test target used as part of the test to see if make supports
12238666Sjb# the -m argument.
12317308Speter#
12438666Sjbtest	:
1253626Swollman
12617308Speter#
12738666Sjb# Define the upgrade targets. These are listed here in alphabetical
12838666Sjb# order, but that's not important.
12917308Speter#
13038978SjbUPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install \
13138978Sjb		move-aout-libs
1323626Swollman
13317308Speter#
13438666Sjb# Handle the upgrade targets, using the source relative mk files.
13517308Speter#
13638666Sjb${UPGRADE} : upgrade_checks
13738666Sjb	@cd ${.CURDIR}; \
13838666Sjb		make -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
139