Makefile revision 38978
1193635Sedwin#
2193635Sedwin#	$Id: Makefile,v 1.215 1998/09/07 18:10:26 ache Exp $
3193635Sedwin#
4193635Sedwin# The user-driven targets are:
5193635Sedwin#
6193635Sedwin# buildworld          - Rebuild *everything*, including glue to help do
7193635Sedwin#                       upgrades.
8193635Sedwin# installworld        - Install everything built by "buildworld".
9193635Sedwin# world               - buildworld + installworld.
10193635Sedwin# update              - Convenient way to update your source tree (cvs).
11193635Sedwin# most                - Build user commands, no libraries or include files.
12193635Sedwin# installmost         - Install user commands, no libraries or include files.
13193635Sedwin# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
14193635Sedwin# aout-to-elf-build   - Build everything required to upgrade a system from
15193635Sedwin#                       a.out to elf format (see below).
16195652Sdwmalone# aout-to-elf-install - Install everything built by aout-to-elf-build (see
17195652Sdwmalone#                       below).
18195652Sdwmalone# move-aout-libs      - Move the a.out libraries into an aout sub-directory
19193635Sedwin#                       of each elf library sub-directory.
20259974Sdelphij#
21193635Sedwin# This makefile is simple by design. The FreeBSD make automatically reads
22239464Sdelphij# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
23239464Sdelphij# command line. By keeping this makefile simple, it doesn't matter too
24239464Sdelphij# much how different the installed mk files are from those in the source
25239464Sdelphij# tree. This makefile executes a child make process, forcing it to use
26193635Sedwin# the mk files from the source tree which are supposed to DTRT.
27193635Sedwin#
28193635Sedwin# The user-driven targets (as listed above) are implemented in Makefile.inc0
29193635Sedwin# and the private targets are in Makefile.inc1. These are kept separate
30195652Sdwmalone# to help the bootstrap build from aout to elf format.
31193635Sedwin#
32193635Sedwin# For novices wanting to build from current sources, the simple instructions
33239464Sdelphij# are:
34239464Sdelphij#
35239464Sdelphij# 1.  Ensure that your /usr/obj directory has at least 165 Mb of free space.
36193635Sedwin# 2.  `cd /usr/src'  (or to the directory containing your source tree).
37193635Sedwin# 3.  `make world'
38259974Sdelphij#
39193635Sedwin# Be warned, this will update your installed system, except for configuration
40259974Sdelphij# files in the /etc directory. You have to do those manually.
41259974Sdelphij#
42259974Sdelphij# If at first you're a little nervous about having a `make world' update
43259974Sdelphij# your system, a `make buildworld' will build everything in the /usr/obj
44259974Sdelphij# tree without touching your installed system. To be of any further use
45259974Sdelphij# though, a `make installworld' is required.
46285612Sdelphij#
47285612Sdelphij# The `make world' process always follows the installed object format.
48259974Sdelphij# This is set by creating /etc/objformat containing either OBJFORMAT=aout
49259974Sdelphij# or OBJFORMAT=elf. If this file does not exist, the object format defaults
50259974Sdelphij# to aout. This is expected to be changed to elf just prior to the release
51259974Sdelphij# or 3.0. If OBJFORMAT is set as an environment variable or in /etc/make.conf,
52259974Sdelphij# this overrides /etc/objformat.
53259974Sdelphij#
54259974Sdelphij# Unless -DNOAOUT is specified, a `make world' with OBJFORMAT=elf will
55259974Sdelphij# update the legacy support for aout. This includes all libraries, ld.so,
56259974Sdelphij# lkms and boot objects. This part of build should be regarded as
57259974Sdelphij# deprecated and you should _not_ expect to be able to do this past the
58193635Sedwin# release of 3.1. You have exactly one major release to move entirely
59193635Sedwin# to elf.
60193635Sedwin#
61193635Sedwin# ----------------------------------------------------------------------------
62193635Sedwin#
63193635Sedwin#           Upgrading an i386 system from a.out to elf format
64259974Sdelphij#
65259974Sdelphij#
66259974Sdelphij# The aout->elf transition build is performed by doing a `make aout-to-elf'
67259974Sdelphij# or a `make aout-to-elf-build' followed by a `make aout-to-elf-install'.
68259974Sdelphij# You need to have at least 320 Mb of free space for the object tree.
69193635Sedwin#
70193635Sedwin# The upgrade process checks the installed release. If this is 3.0-CURRENT,
71195652Sdwmalone# it is assumed that your kernel contains all the syscalls required by the
72195652Sdwmalone# current sources.
73195652Sdwmalone#
74195652Sdwmalone# For installed systems where `uname -r' reports something other than
75195652Sdwmalone# 3.0-CURRENT, the upgrade process expects to build a kernel using the
76195652Sdwmalone# kernel configuration file sys/i386/conf/GENERICupgrade. This file is
77193635Sedwin# defaulted to the GENERIC kernel configuration file on the assumption that
78195652Sdwmalone# it will be suitable for most systems. Before performing the upgrade,
79195652Sdwmalone# replace sys/i386/conf/GENERICupgrade with your own version if your
80# hardware requires a different configuration.
81#
82# The upgrade procedure will stop and ask for confirmation to proceed
83# several times. On each occasion, you can type Ctrl-C to abort the
84# upgrade.
85#
86# At the end of the upgrade procedure, /etc/objformat is created or
87# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
88#
89# ----------------------------------------------------------------------------
90#
91#
92# Define the user-driven targets. These are listed here in alphabetical
93# order, but that's not important.
94#
95TGTS =	afterdistribute all buildworld clean cleandepend cleanobj depend \
96	distribute everything includes installmost install installworld \
97	most obj rerelease update world
98
99#
100# Handle the user-driven targets, using the source relative mk files.
101#
102${TGTS} : upgrade_checks
103	@cd ${.CURDIR}; \
104		make -f Makefile.inc0 -m ${.CURDIR}/share/mk ${.TARGET}
105
106#
107# Perform a few tests to determine if the installed tools are adequate
108# for building the world. These are for older systems (prior to 2.2.5).
109#
110# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
111# so the normal make world is capable of doing what is required to update
112# the system to current.
113#
114upgrade_checks :
115	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else make -f Makefile.upgrade make; fi;
116
117#
118# A simple test target used as part of the test to see if make supports
119# the -m argument.
120#
121test	:
122
123#
124# Define the upgrade targets. These are listed here in alphabetical
125# order, but that's not important.
126#
127UPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install \
128		move-aout-libs
129
130#
131# Handle the upgrade targets, using the source relative mk files.
132#
133${UPGRADE} : upgrade_checks
134	@cd ${.CURDIR}; \
135		make -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
136