Makefile revision 42128
113685Swosch#
288930Sdwmalone#	$Id: Makefile,v 1.221 1998/10/17 15:25:26 bde Exp $
313685Swosch#
450477Speter# The user-driven targets are:
555398Sgrog#
613685Swosch# buildworld          - Rebuild *everything*, including glue to help do
713685Swosch#                       upgrades.
8166002Sdwmalone# installworld        - Install everything built by "buildworld".
9166002Sdwmalone# world               - buildworld + installworld.
10166002Sdwmalone# update              - Convenient way to update your source tree (cvs).
11166002Sdwmalone# most                - Build user commands, no libraries or include files.
1213685Swosch# installmost         - Install user commands, no libraries or include files.
1313685Swosch# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
1413685Swosch# aout-to-elf-build   - Build everything required to upgrade a system from
1555398Sgrog#                       a.out to elf format (see below).
16213875Sedwin# aout-to-elf-install - Install everything built by aout-to-elf-build (see
17213875Sedwin#                       below).
18212035Sedwin# move-aout-libs      - Move the a.out libraries into an aout sub-directory
19212035Sedwin#                       of each elf library sub-directory.
20212035Sedwin#
21212035Sedwin# This makefile is simple by design. The FreeBSD make automatically reads
22212035Sedwin# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
23212035Sedwin# command line. By keeping this makefile simple, it doesn't matter too
24212035Sedwin# much how different the installed mk files are from those in the source
25212035Sedwin# tree. This makefile executes a child make process, forcing it to use
26212035Sedwin# the mk files from the source tree which are supposed to DTRT.
27212035Sedwin#
28212035Sedwin# The user-driven targets (as listed above) are implemented in Makefile.inc0
29212035Sedwin# and the private targets are in Makefile.inc1. These are kept separate
30212035Sedwin# to help the bootstrap build from aout to elf format.
31212035Sedwin#
32212035Sedwin# For novices wanting to build from current sources, the simple instructions
33212035Sedwin# are:
34212035Sedwin#
35212035Sedwin# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
36212035Sedwin# 2.  `cd /usr/src'  (or to the directory containing your source tree).
37212035Sedwin# 3.  `make world'
38212035Sedwin#
39212035Sedwin# Be warned, this will update your installed system, except for configuration
40212035Sedwin# files in the /etc directory. You have to do those manually.
41212035Sedwin#
42212035Sedwin# If at first you're a little nervous about having a `make world' update
43212035Sedwin# your system, a `make buildworld' will build everything in the /usr/obj
44212035Sedwin# tree without touching your installed system. To be of any further use
45212035Sedwin# though, a `make installworld' is required.
46212035Sedwin#
47212035Sedwin# The `make world' process always follows the installed object format.
48212035Sedwin# This is set by creating /etc/objformat containing either OBJFORMAT=aout
49212035Sedwin# or OBJFORMAT=elf. If this file does not exist, the object format defaults
50212035Sedwin# to aout. This is expected to be changed to elf just prior to the release
51212035Sedwin# or 3.0. If OBJFORMAT is set as an environment variable or in /etc/make.conf,
52212035Sedwin# this overrides /etc/objformat.
53212035Sedwin#
54212035Sedwin# Unless -DNOAOUT is specified, a `make world' with OBJFORMAT=elf will
55212035Sedwin# update the legacy support for aout. This includes all libraries, ld.so
56212035Sedwin# and boot objects. This part of build should be regarded as
57212035Sedwin# deprecated and you should _not_ expect to be able to do this past the
58212035Sedwin# release of 3.1. You have exactly one major release to move entirely
59212035Sedwin# to elf.
60212035Sedwin#
61212035Sedwin# ----------------------------------------------------------------------------
62212035Sedwin#
63212035Sedwin#           Upgrading an i386 system from a.out to elf format
64212035Sedwin#
65212035Sedwin#
66212035Sedwin# The aout->elf transition build is performed by doing a `make aout-to-elf'
67212035Sedwin# or a `make aout-to-elf-build' followed by a `make aout-to-elf-install'.
68212035Sedwin# You need to have at least 320 Mb of free space for the object tree.
69212035Sedwin#
70212035Sedwin# The upgrade process checks the installed release. If this is 3.0-CURRENT,
71212035Sedwin# it is assumed that your kernel contains all the syscalls required by the
72212035Sedwin# current sources.
73212035Sedwin#
74212035Sedwin# For installed systems where `uname -r' reports something other than
75212035Sedwin# 3.0-CURRENT, the upgrade process expects to build a kernel using the
76212035Sedwin# kernel configuration file sys/i386/conf/GENERICupgrade. This file is
77212035Sedwin# defaulted to the GENERIC kernel configuration file on the assumption that
78212035Sedwin# it will be suitable for most systems. Before performing the upgrade,
79212035Sedwin# replace sys/i386/conf/GENERICupgrade with your own version if your
80212035Sedwin# hardware requires a different configuration.
81212035Sedwin#
82212035Sedwin# The upgrade procedure will stop and ask for confirmation to proceed
83212035Sedwin# several times. On each occasion, you can type Ctrl-C to abort the
84212035Sedwin# upgrade.
85212035Sedwin#
86212035Sedwin# At the end of the upgrade procedure, /etc/objformat is created or
87212035Sedwin# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
88212035Sedwin#
89212035Sedwin# ----------------------------------------------------------------------------
90212035Sedwin#
91212035Sedwin#
92212035Sedwin# Define the user-driven targets. These are listed here in alphabetical
93212035Sedwin# order, but that's not important.
94212035Sedwin#
95212035SedwinTGTS =	afterdistribute all buildworld checkdpadd clean cleandepend cleandir \
96212035Sedwin	depend distribute everything hierarchy includes install installmost \
97212035Sedwin	installworld lint maninstall mk most obj objlink regress rerelease \
98212035Sedwin	tags update world
99212035Sedwin
100212035Sedwin#
101212035Sedwin# Handle the user-driven targets, using the source relative mk files.
102212035Sedwin#
103212035Sedwin${TGTS} : upgrade_checks
104212035Sedwin	@cd ${.CURDIR}; \
105212035Sedwin		make -f Makefile.inc0 -m ${.CURDIR}/share/mk ${.TARGET}
106212035Sedwin
107212035Sedwin# Set a reasonable default
108212035Sedwin.MAIN:	all
109212035Sedwin
110212035Sedwin#
111212035Sedwin# Perform a few tests to determine if the installed tools are adequate
112212035Sedwin# for building the world. These are for older systems (prior to 2.2.5).
113212035Sedwin#
114212035Sedwin# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
115212035Sedwin# so the normal make world is capable of doing what is required to update
116212035Sedwin# the system to current.
117212035Sedwin#
118212035Sedwinupgrade_checks :
119212035Sedwin	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else make -f Makefile.upgrade make; fi;
120212035Sedwin
121212035Sedwin#
122212035Sedwin# A simple test target used as part of the test to see if make supports
123212035Sedwin# the -m argument.
124212035Sedwin#
125212035Sedwintest	:
126212035Sedwin
127212035Sedwin#
128212035Sedwin# Define the upgrade targets. These are listed here in alphabetical
129212035Sedwin# order, but that's not important.
130212035Sedwin#
131212035SedwinUPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install \
132212035Sedwin		move-aout-libs
133212035Sedwin
134212035Sedwin#
135212035Sedwin# Handle the upgrade targets, using the source relative mk files.
136212035Sedwin#
137212035Sedwin${UPGRADE} : upgrade_checks
138212035Sedwin	@cd ${.CURDIR}; \
139212035Sedwin		make -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
140212035Sedwin