Makefile revision 39784
1255726Sgibbs#
2255046Sgibbs#	$Id: Makefile,v 1.219 1998/09/28 20:39:23 jb Exp $
3255046Sgibbs#
4255046Sgibbs# The user-driven targets are:
5255046Sgibbs#
6255046Sgibbs# buildworld          - Rebuild *everything*, including glue to help do
7255046Sgibbs#                       upgrades.
8255046Sgibbs# installworld        - Install everything built by "buildworld".
9255046Sgibbs# world               - buildworld + installworld.
10255046Sgibbs# update              - Convenient way to update your source tree (cvs).
11255046Sgibbs# most                - Build user commands, no libraries or include files.
12255046Sgibbs# installmost         - Install user commands, no libraries or include files.
13255046Sgibbs# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
14255046Sgibbs# aout-to-elf-build   - Build everything required to upgrade a system from
15255046Sgibbs#                       a.out to elf format (see below).
16255046Sgibbs# aout-to-elf-install - Install everything built by aout-to-elf-build (see
17255046Sgibbs#                       below).
18255046Sgibbs# move-aout-libs      - Move the a.out libraries into an aout sub-directory
19255046Sgibbs#                       of each elf library sub-directory.
20255046Sgibbs#
21255046Sgibbs# This makefile is simple by design. The FreeBSD make automatically reads
22255046Sgibbs# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
23255046Sgibbs# command line. By keeping this makefile simple, it doesn't matter too
24255046Sgibbs# much how different the installed mk files are from those in the source
25255046Sgibbs# tree. This makefile executes a child make process, forcing it to use
26255046Sgibbs# the mk files from the source tree which are supposed to DTRT.
27255046Sgibbs#
28255046Sgibbs# The user-driven targets (as listed above) are implemented in Makefile.inc0
29255046Sgibbs# and the private targets are in Makefile.inc1. These are kept separate
30255046Sgibbs# to help the bootstrap build from aout to elf format.
31255046Sgibbs#
32255046Sgibbs# For novices wanting to build from current sources, the simple instructions
33255046Sgibbs# are:
34255046Sgibbs#
35255046Sgibbs# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
36255046Sgibbs# 2.  `cd /usr/src'  (or to the directory containing your source tree).
37255046Sgibbs# 3.  `make world'
38255046Sgibbs#
39255046Sgibbs# Be warned, this will update your installed system, except for configuration
40255046Sgibbs# files in the /etc directory. You have to do those manually.
41255046Sgibbs#
42255046Sgibbs# If at first you're a little nervous about having a `make world' update
43255046Sgibbs# your system, a `make buildworld' will build everything in the /usr/obj
44255046Sgibbs# tree without touching your installed system. To be of any further use
45255046Sgibbs# though, a `make installworld' is required.
46255046Sgibbs#
47255046Sgibbs# The `make world' process always follows the installed object format.
48263007Sroyger# This is set by creating /etc/objformat containing either OBJFORMAT=aout
49255046Sgibbs# or OBJFORMAT=elf. If this file does not exist, the object format defaults
50255046Sgibbs# to aout. This is expected to be changed to elf just prior to the release
51255046Sgibbs# or 3.0. If OBJFORMAT is set as an environment variable or in /etc/make.conf,
52255046Sgibbs# this overrides /etc/objformat.
53255046Sgibbs#
54255046Sgibbs# Unless -DNOAOUT is specified, a `make world' with OBJFORMAT=elf will
55255046Sgibbs# update the legacy support for aout. This includes all libraries, ld.so,
56298929Sroyger# lkms and boot objects. This part of build should be regarded as
57255046Sgibbs# deprecated and you should _not_ expect to be able to do this past the
58255046Sgibbs# release of 3.1. You have exactly one major release to move entirely
59255046Sgibbs# to elf.
60255046Sgibbs#
61255046Sgibbs# ----------------------------------------------------------------------------
62255726Sgibbs#
63278183Sbryanv#           Upgrading an i386 system from a.out to elf format
64255046Sgibbs#
65263008Sroyger#
66263008Sroyger# The aout->elf transition build is performed by doing a `make aout-to-elf'
67298929Sroyger# or a `make aout-to-elf-build' followed by a `make aout-to-elf-install'.
68298929Sroyger# You need to have at least 320 Mb of free space for the object tree.
69255046Sgibbs#
70255046Sgibbs# The upgrade process checks the installed release. If this is 3.0-CURRENT,
71255046Sgibbs# it is assumed that your kernel contains all the syscalls required by the
72255046Sgibbs# current sources.
73255046Sgibbs#
74255046Sgibbs# For installed systems where `uname -r' reports something other than
75255046Sgibbs# 3.0-CURRENT, the upgrade process expects to build a kernel using the
76255046Sgibbs# kernel configuration file sys/i386/conf/GENERICupgrade. This file is
77255046Sgibbs# defaulted to the GENERIC kernel configuration file on the assumption that
78255046Sgibbs# it will be suitable for most systems. Before performing the upgrade,
79255046Sgibbs# replace sys/i386/conf/GENERICupgrade with your own version if your
80255046Sgibbs# hardware requires a different configuration.
81299065Sroyger#
82299065Sroyger# The upgrade procedure will stop and ask for confirmation to proceed
83299065Sroyger# several times. On each occasion, you can type Ctrl-C to abort the
84299065Sroyger# upgrade.
85299065Sroyger#
86299065Sroyger# At the end of the upgrade procedure, /etc/objformat is created or
87255046Sgibbs# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
88255046Sgibbs#
89255046Sgibbs# ----------------------------------------------------------------------------
90255046Sgibbs#
91255046Sgibbs#
92255046Sgibbs# Define the user-driven targets. These are listed here in alphabetical
93255046Sgibbs# order, but that's not important.
94255046Sgibbs#
95255046SgibbsTGTS =	afterdistribute all buildworld clean cleandepend cleandir cleanobj \
96255046Sgibbs	depend distribute everything hierarchy includes installmost install \
97255046Sgibbs	installworld mk most obj rerelease update world
98255046Sgibbs
99255046Sgibbs#
100255046Sgibbs# Handle the user-driven targets, using the source relative mk files.
101255046Sgibbs#
102255046Sgibbs${TGTS} : upgrade_checks
103255046Sgibbs	@cd ${.CURDIR}; \
104255046Sgibbs		make -f Makefile.inc0 -m ${.CURDIR}/share/mk ${.TARGET}
105255046Sgibbs
106255046Sgibbs# Set a reasonable default
107255046Sgibbs.MAIN:	all
108255046Sgibbs
109255046Sgibbs#
110255046Sgibbs# Perform a few tests to determine if the installed tools are adequate
111255046Sgibbs# for building the world. These are for older systems (prior to 2.2.5).
112255046Sgibbs#
113255046Sgibbs# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
114255046Sgibbs# so the normal make world is capable of doing what is required to update
115255046Sgibbs# the system to current.
116255046Sgibbs#
117255046Sgibbsupgrade_checks :
118255046Sgibbs	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else make -f Makefile.upgrade make; fi;
119255046Sgibbs
120255046Sgibbs#
121255046Sgibbs# A simple test target used as part of the test to see if make supports
122255046Sgibbs# the -m argument.
123255046Sgibbs#
124255046Sgibbstest	:
125255046Sgibbs
126255046Sgibbs#
127255046Sgibbs# Define the upgrade targets. These are listed here in alphabetical
128255046Sgibbs# order, but that's not important.
129255046Sgibbs#
130255046SgibbsUPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install \
131255046Sgibbs		move-aout-libs
132255046Sgibbs
133255046Sgibbs#
134255046Sgibbs# Handle the upgrade targets, using the source relative mk files.
135255046Sgibbs#
136255046Sgibbs${UPGRADE} : upgrade_checks
137255046Sgibbs	@cd ${.CURDIR}; \
138255046Sgibbs		make -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
139255046Sgibbs