Makefile revision 69496
1#
2# $FreeBSD: head/Makefile 69496 2000-12-01 22:00:33Z jkh $
3#
4# The user-driven targets are:
5#
6# buildworld          - Rebuild *everything*, including glue to help do
7#                       upgrades.
8# installworld        - Install everything built by "buildworld".
9# world               - buildworld + installworld.
10# buildkernel         - Rebuild the kernel and the kernel-modules.
11# installkernel       - Install the kernel and the kernel-modules.
12# reinstallkernel     - Reinstall the kernel and the kernel-modules.
13# kernel		buildkernel + installkernel
14# update              - Convenient way to update your source tree (cvs).
15# upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
16# most                - Build user commands, no libraries or include files.
17# installmost         - Install user commands, no libraries or include files.
18# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
19# aout-to-elf-build   - Build everything required to upgrade a system from
20#                       a.out to elf format (see below).
21# aout-to-elf-install - Install everything built by aout-to-elf-build (see
22#                       below).
23# move-aout-libs      - Move the a.out libraries into an aout sub-directory
24#                       of each elf library sub-directory.
25#
26# This makefile is simple by design. The FreeBSD make automatically reads
27# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
28# command line. By keeping this makefile simple, it doesn't matter too
29# much how different the installed mk files are from those in the source
30# tree. This makefile executes a child make process, forcing it to use
31# the mk files from the source tree which are supposed to DTRT.
32#
33# The user-driven targets (as listed above) are implemented in Makefile.inc0
34# and the private targets are in Makefile.inc1. These are kept separate
35# to help the bootstrap build from aout to elf format.
36#
37# For novices wanting to build from current sources, the simple instructions
38# are:
39#
40# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
41# 2.  `cd /usr/src'  (or to the directory containing your source tree).
42# 3.  `make world'
43#
44# Be warned, this will update your installed system, except for configuration
45# files in the /etc directory and for the kernel. You have to do those manually.
46#
47# If at first you're a little nervous about having a `make world' update
48# your system, a `make buildworld' will build everything in the /usr/obj
49# tree without touching your installed system. To be of any further use
50# though, a `make installworld' is required.
51#
52# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
53# update the legacy support for aout. This includes all libraries, ld.so
54# and boot objects. This part of build should be regarded as
55# deprecated and you should _not_ expect to be able to do this past the
56# release of 4.0. You have exactly one major release to move entirely
57# to elf.
58#
59# ----------------------------------------------------------------------------
60#
61#           Upgrading an i386 system from a.out to elf format
62#
63#
64# The aout->elf transition build is performed by doing a `make upgrade' (or
65# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
66# by a `make aout-to-elf-install', depending on user preference.
67# You need to have at least 320 Mb of free space for the object tree.
68#
69# The upgrade process checks the installed release. If this is 3.0-CURRENT,
70# it is assumed that your kernel contains all the syscalls required by the
71# current sources.
72#
73# The upgrade procedure will stop and ask for confirmation to proceed
74# several times. On each occasion, you can type Ctrl-C to abort the
75# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
76# the confirmation steps.
77#
78# At the end of the upgrade procedure, /etc/objformat is created or
79# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
80#
81# ----------------------------------------------------------------------------
82#
83#
84# Define the user-driven targets. These are listed here in alphabetical
85# order, but that's not important.
86#
87TGTS=	afterdistribute all buildkernel buildworld checkdpadd clean \
88	cleandepend cleandir depend distribute distribworld everything \
89	hierarchy includes install installkernel kernel reinstallkernel \
90	installmost installworld libraries lint maninstall mk most obj \
91	objlink regress rerelease tags update
92
93PATH=	/sbin:/bin:/usr/sbin:/usr/bin
94MAKE=	PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
95
96#
97# Handle the user-driven targets, using the source relative mk files.
98#
99${TGTS}: upgrade_checks
100	@cd ${.CURDIR}; \
101		${MAKE} ${.TARGET}
102
103# Set a reasonable default
104.MAIN:	all
105
106#
107# world
108#
109# Attempt to rebuild and reinstall *everything*, with reasonable chance of
110# success, regardless of how old your existing system is.
111#
112world: upgrade_checks
113	@echo "--------------------------------------------------------------"
114	@echo ">>> ${OBJFORMAT} make world started on `LC_TIME=C date`"
115	@echo "--------------------------------------------------------------"
116.if target(pre-world)
117	@echo
118	@echo "--------------------------------------------------------------"
119	@echo ">>> Making 'pre-world' target"
120	@echo "--------------------------------------------------------------"
121	@cd ${.CURDIR}; ${MAKE} pre-world
122.endif
123	@cd ${.CURDIR}; ${MAKE} buildworld
124	@cd ${.CURDIR}; ${MAKE} -B installworld
125.if target(post-world)
126	@echo
127	@echo "--------------------------------------------------------------"
128	@echo ">>> Making 'post-world' target"
129	@echo "--------------------------------------------------------------"
130	@cd ${.CURDIR}; ${MAKE} post-world
131.endif
132	@echo
133	@echo "--------------------------------------------------------------"
134	@echo ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`"
135	@echo "--------------------------------------------------------------"
136
137#
138# Perform a few tests to determine if the installed tools are adequate
139# for building the world. These are for older systems (prior to 2.2.5).
140#
141# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
142# so the normal make world is capable of doing what is required to update
143# the system to current.
144#
145upgrade_checks:
146	@cd ${.CURDIR}; \
147		if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \
148			make make; \
149		fi
150
151#
152# A simple test target used as part of the test to see if make supports
153# the -m argument.
154#
155test:
156
157#
158# Upgrade the installed make to the current version using the installed
159# headers, libraries and build tools. This is required on installed versions
160# prior to 2.2.5 in which the installed make doesn't support the -m argument.
161#
162make:
163	@echo
164	@echo "--------------------------------------------------------------"
165	@echo " Upgrading the installed make"
166	@echo "--------------------------------------------------------------"
167	@cd ${.CURDIR}/usr.bin/make; \
168		make obj && make depend && make all && make install
169
170#
171# Define the upgrade targets. These are listed here in alphabetical
172# order, but that's not important.
173#
174UPGRADE=	aout-to-elf aout-to-elf-build aout-to-elf-install \
175		move-aout-libs
176
177#
178# Handle the upgrade targets, using the source relative mk files.
179#
180
181upgrade:	aout-to-elf
182
183${UPGRADE} : upgrade_checks
184	@cd ${.CURDIR}; \
185		${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
186