Makefile revision 51361
1243791Sdim#
2243791Sdim# $FreeBSD: head/Makefile 51361 1999-09-18 08:27:55Z jb $
3243791Sdim#
4243791Sdim# The user-driven targets are:
5243791Sdim#
6243791Sdim# buildworld          - Rebuild *everything*, including glue to help do
7243791Sdim#                       upgrades.
8243791Sdim# installworld        - Install everything built by "buildworld".
9243791Sdim# world               - buildworld + installworld.
10243791Sdim# update              - Convenient way to update your source tree (cvs).
11243791Sdim# upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
12243791Sdim# most                - Build user commands, no libraries or include files.
13243791Sdim# installmost         - Install user commands, no libraries or include files.
14243791Sdim# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
15252723Sdim# aout-to-elf-build   - Build everything required to upgrade a system from
16243791Sdim#                       a.out to elf format (see below).
17252723Sdim# aout-to-elf-install - Install everything built by aout-to-elf-build (see
18243791Sdim#                       below).
19243791Sdim# move-aout-libs      - Move the a.out libraries into an aout sub-directory
20252723Sdim#                       of each elf library sub-directory.
21243791Sdim#
22243791Sdim# This makefile is simple by design. The FreeBSD make automatically reads
23243791Sdim# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
24243791Sdim# command line. By keeping this makefile simple, it doesn't matter too
25243791Sdim# much how different the installed mk files are from those in the source
26243791Sdim# tree. This makefile executes a child make process, forcing it to use
27243791Sdim# the mk files from the source tree which are supposed to DTRT.
28243791Sdim#
29243791Sdim# The user-driven targets (as listed above) are implemented in Makefile.inc0
30243791Sdim# and the private targets are in Makefile.inc1. These are kept separate
31243791Sdim# to help the bootstrap build from aout to elf format.
32243791Sdim#
33243791Sdim# For novices wanting to build from current sources, the simple instructions
34243791Sdim# are:
35243791Sdim#
36243791Sdim# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
37243791Sdim# 2.  `cd /usr/src'  (or to the directory containing your source tree).
38243791Sdim# 3.  `make world'
39243791Sdim#
40243791Sdim# Be warned, this will update your installed system, except for configuration
41243791Sdim# files in the /etc directory and for the kernel. You have to do those manually.
42243791Sdim#
43243791Sdim# If at first you're a little nervous about having a `make world' update
44243791Sdim# your system, a `make buildworld' will build everything in the /usr/obj
45243791Sdim# tree without touching your installed system. To be of any further use
46243791Sdim# though, a `make installworld' is required.
47243791Sdim#
48243791Sdim# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
49243791Sdim# update the legacy support for aout. This includes all libraries, ld.so
50243791Sdim# and boot objects. This part of build should be regarded as
51243791Sdim# deprecated and you should _not_ expect to be able to do this past the
52243791Sdim# release of 4.0. You have exactly one major release to move entirely
53243791Sdim# to elf.
54243791Sdim#
55243791Sdim# ----------------------------------------------------------------------------
56243791Sdim#
57243791Sdim#           Upgrading an i386 system from a.out to elf format
58243791Sdim#
59243791Sdim#
60243791Sdim# The aout->elf transition build is performed by doing a `make upgrade' (or
61243791Sdim# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
62243791Sdim# by a `make aout-to-elf-install', depending on user preference.
63243791Sdim# You need to have at least 320 Mb of free space for the object tree.
64243791Sdim#
65243791Sdim# The upgrade process checks the installed release. If this is 3.0-CURRENT,
66243791Sdim# it is assumed that your kernel contains all the syscalls required by the
67243791Sdim# current sources.
68243791Sdim#
69243791Sdim# The upgrade procedure will stop and ask for confirmation to proceed
70243791Sdim# several times. On each occasion, you can type Ctrl-C to abort the
71243791Sdim# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
72243791Sdim# the confirmation steps.
73243791Sdim#
74243791Sdim# At the end of the upgrade procedure, /etc/objformat is created or
75243791Sdim# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
76243791Sdim#
77243791Sdim# ----------------------------------------------------------------------------
78243791Sdim#
79243791Sdim#
80243791Sdim# Define the user-driven targets. These are listed here in alphabetical
81243791Sdim# order, but that's not important.
82243791Sdim#
83243791SdimTGTS =	afterdistribute all buildworld checkdpadd clean cleandepend cleandir \
84243791Sdim	depend distribute everything hierarchy includes install installmost \
85243791Sdim	installworld lint maninstall mk most obj objlink regress rerelease \
86243791Sdim	tags update world
87243791Sdim
88243791Sdim#
89243791Sdim# Handle the user-driven targets, using the source relative mk files.
90243791Sdim#
91243791Sdim${TGTS} : upgrade_checks
92243791Sdim	@cd ${.CURDIR}; \
93243791Sdim		${MAKE} -f Makefile.inc0 -m ${.CURDIR}/share/mk ${.TARGET}
94243791Sdim
95243791Sdim# Set a reasonable default
96243791Sdim.MAIN:	all
97243791Sdim
98243791Sdim#
99243791Sdim# Perform a few tests to determine if the installed tools are adequate
100243791Sdim# for building the world. These are for older systems (prior to 2.2.5).
101243791Sdim#
102243791Sdim# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
103243791Sdim# so the normal make world is capable of doing what is required to update
104243791Sdim# the system to current.
105243791Sdim#
106252723Sdimupgrade_checks :
107243791Sdim	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else ${MAKE} -f Makefile.upgrade make; fi;
108243791Sdim
109243791Sdim#
110243791Sdim# A simple test target used as part of the test to see if make supports
111243791Sdim# the -m argument.
112243791Sdim#
113243791Sdimtest	:
114243791Sdim
115243791Sdim#
116243791Sdim# Define the upgrade targets. These are listed here in alphabetical
117243791Sdim# order, but that's not important.
118243791Sdim#
119243791SdimUPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install \
120243791Sdim		move-aout-libs
121243791Sdim
122243791Sdim#
123243791Sdim# Handle the upgrade targets, using the source relative mk files.
124243791Sdim#
125243791Sdim
126243791Sdimupgrade:	aout-to-elf
127243791Sdim
128243791Sdim${UPGRADE} : upgrade_checks
129243791Sdim	@cd ${.CURDIR}; \
130243791Sdim		${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
131243791Sdim