Makefile revision 38719
178344Sobrien#
278344Sobrien#	$Id: Makefile,v 1.211 1998/08/31 01:08:08 jb Exp $
398184Sgordon#
498184Sgordon# The user-driven targets are:
578344Sobrien#
678344Sobrien# buildworld          - Rebuild *everything*, including glue to help do
778344Sobrien#                       upgrades.
8128470Sdarrenr# installworld        - Install everything built by "buildworld".
9113959Smtm# world               - buildworld + installworld.
10136224Smtm# update              - Convenient way to update your source tree (cvs).
1178344Sobrien# most                - Build user commands, no libraries or include files.
1278344Sobrien# installmost         - Install user commands, no libraries or include files.
1378344Sobrien# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
1478344Sobrien# aout-to-elf-build   - Build everything required to upgrade a system from
1598184Sgordon#                       a.out to elf format (see below).
1698184Sgordon# aout-to-elf-install - Install everything built by aout-to-elf-build (see
17124618Smtm#                       below).
1898184Sgordon#
1978344Sobrien# This makefile is simple by design. The FreeBSD make automatically reads
2078344Sobrien# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
2178344Sobrien# command line. By keeping this makefile simple, it doesn't matter too
2278344Sobrien# much how different the installed mk files are from those in the source
2378344Sobrien# tree. This makefile executes a child make process, forcing it to use
2498184Sgordon# the mk files from the source tree which are supposed to DTRT.
2598184Sgordon#
2678344Sobrien# The user-driven targets (as listed above) are implemented in Makefile.inc0
2778344Sobrien# and the private targets are in Makefile.inc1. These are kept separate
2898184Sgordon# to help the bootstrap build from aout to elf format.
2978344Sobrien#
30124928Smux# For novices wanting to build from current sources, the simple instructions
31124928Smux# are:
32147511Sdd#
33124928Smux# 1.  Ensure that your /usr/obj directory has at least 165 Mb of free space.
34124928Smux# 2.  `cd /usr/src'  (or to the directory containing your source tree).
35124928Smux# 3.  `make world'
36124928Smux#
37124928Smux# Be warned, this will update your installed system, except for configuration
38124928Smux# files in the /etc directory. You have to do those manually.
3978344Sobrien#
4078344Sobrien# If at first you're a little nervous about having a `make world' update
4198184Sgordon# your system, a `make buildworld' will build everything in the /usr/obj
42124928Smux# tree without touching your installed system. To be of any further use
43104980Sschweikh# though, a `make installworld' is required.
44114271Smtm#
4598184Sgordon# The `make world' process always follows the installed object format.
46113959Smtm# This is set by creating /etc/objformat containing either OBJFORMAT=aout
4798184Sgordon# or OBJFORMAT=elf. If this file does not exist, the object format defaults
4898184Sgordon# to aout. This is expected to be changed to elf just prior to the release
4998184Sgordon# or 3.0. If OBJFORMAT is set as an environment variable or in /etc/make.conf,
5098184Sgordon# this overrides /etc/objformat.
51106333Sume#
52106333Sume# Unless -DNOAOUT is specified, a `make world' with OBJFORMAT=elf will
5398184Sgordon# update the legacy support for aout. This includes all libraries, ld.so,
5498184Sgordon# lkms and boot objects. This part of build should be regarded as
5598184Sgordon# deprecated and you should _not_ expect to be able to do this past the
5678344Sobrien# release of 3.1. You have exactly one major release to move entirely
5778344Sobrien# to elf.
5878344Sobrien#
5978344Sobrien# ----------------------------------------------------------------------------
6078344Sobrien#
6178344Sobrien#           Upgrading an i386 system from a.out to elf format
62147808Sjkim#
63124618Smtm#
64124618Smtm# The aout->elf transition build is performed by doing a `make aout-to-elf'
65124618Smtm# or a `make aout-to-elf-build' followed by a `make aout-to-elf-install'.
66124618Smtm# You need to have at least 320 Mb of free space for the object tree.
67124618Smtm#
68124618Smtm# The upgrade process checks the installed release. If this is 3.0-CURRENT,
69124618Smtm# it is assumed that your kernel contains all the syscalls required by the
70124618Smtm# current sources.
71124618Smtm#
72124618Smtm# For installed systems where `uname -r' reports something other than
73124618Smtm# 3.0-CURRENT, the upgrade process expects to build a kernel using the
74124618Smtm# kernel configuration file sys/i386/conf/GENERICupgrade. This file is
7578344Sobrien# defaulted to the GENERIC kernel configuration file on the assumption that
7678344Sobrien# it will be suitable for most systems. Before performing the upgrade,
7778344Sobrien# replace sys/i386/conf/GENERICupgrade with your own version if your
7878344Sobrien# hardware requires a different configuration.
79120515Smux#
80120515Smux# The upgrade procedure will stop and ask for confirmation to proceed
81124618Smtm# several times. On each occasion, you can type Ctrl-C to abort the
82124618Smtm# upgrade.
83124618Smtm#
84124618Smtm# At the end of the upgrade procedure, /etc/objformat is created or
85120515Smux# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
8678344Sobrien#
8778344Sobrien# ----------------------------------------------------------------------------
8878344Sobrien#
8978344Sobrien#
9078344Sobrien# Define the user-driven targets. These are listed here in alphabetical
9178344Sobrien# order, but that's not important.
92124618Smtm#
93124618SmtmTGTS =	all buildworld clean cleandepend cleanobj depend everything \
94124618Smtm	includes installmost install installworld most obj update world
95124618Smtm
96124618Smtm#
97124618Smtm# Handle the user-driven targets, using the source relative mk files.
98124618Smtm#
99124618Smtm${TGTS} : upgrade_checks
100124618Smtm	@cd ${.CURDIR}; \
101124618Smtm		make -f Makefile.inc0 -m ${.CURDIR}/share/mk ${.TARGET}
102124618Smtm
10398184Sgordon#
10478344Sobrien# Perform a few tests to determine if the installed tools are adequate
10578344Sobrien# for building the world. These are for older systems (prior to 2.2.5).
10698184Sgordon#
10798184Sgordon# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
108124618Smtm# so the normal make world is capable of doing what is required to update
109124928Smux# the system to current.
110124618Smtm#
111124618Smtmupgrade_checks :
11298184Sgordon	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else make -f Makefile.upgrade make; fi;
11398184Sgordon
11498184Sgordon#
11578344Sobrien# A simple test target used as part of the test to see if make supports
11678344Sobrien# the -m argument.
11798184Sgordon#
11878344Sobrientest	:
11978344Sobrien
12078344Sobrien#
121# Define the upgrade targets. These are listed here in alphabetical
122# order, but that's not important.
123#
124UPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install
125
126#
127# Handle the upgrade targets, using the source relative mk files.
128#
129${UPGRADE} : upgrade_checks
130	@cd ${.CURDIR}; \
131		make -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
132