Merge with FreeBSD (RELENG_4) src/sys/dev/syscons/syscons.c,
[dragonfly.git] / Makefile
CommitLineData
984263bc
MD
1#
2# $FreeBSD: src/Makefile,v 1.234.2.19 2003/04/16 09:59:40 ru Exp $
e05c8c84 3# $DragonFly: src/Makefile,v 1.6 2004/04/02 06:21:36 dillon Exp $
984263bc
MD
4#
5# The user-driven targets are:
6#
7# buildworld - Rebuild *everything*, including glue to help do
8# upgrades.
1397f94a
MD
9# quickworld - Skip bootstrap, build and cross-build tool steps
10# realquickworld - Skip above steps, plus depend
11# crossworld - Just do the bootstrap, build, and cross-build steps
984263bc
MD
12# installworld - Install everything built by "buildworld".
13# world - buildworld + installworld.
14# buildkernel - Rebuild the kernel and the kernel-modules.
e05c8c84 15# nativekernel - Rebuild the kernel using native tools via config.
984263bc
MD
16# installkernel - Install the kernel and the kernel-modules.
17# reinstallkernel - Reinstall the kernel and the kernel-modules.
18# kernel - buildkernel + installkernel.
19# update - Convenient way to update your source tree (cvs).
20# upgrade - Upgrade a.out (2.2.x/3.0) system to the new ELF way
21# most - Build user commands, no libraries or include files.
22# installmost - Install user commands, no libraries or include files.
23# aout-to-elf - Upgrade an system from a.out to elf format (see below).
24# aout-to-elf-build - Build everything required to upgrade a system from
25# a.out to elf format (see below).
26# aout-to-elf-install - Install everything built by aout-to-elf-build (see
27# below).
28# move-aout-libs - Move the a.out libraries into an aout sub-directory
29# of each elf library sub-directory.
30#
31# This makefile is simple by design. The FreeBSD make automatically reads
32# the /usr/share/mk/sys.mk unless the -m argument is specified on the
33# command line. By keeping this makefile simple, it doesn't matter too
34# much how different the installed mk files are from those in the source
35# tree. This makefile executes a child make process, forcing it to use
36# the mk files from the source tree which are supposed to DTRT.
37#
38# The user-driven targets (as listed above) are implemented in Makefile.inc1.
39#
40# If you want to build your system from source be sure that /usr/obj has
41# at least 400MB of diskspace available.
42#
43# For individuals wanting to build from the sources currently on their
44# system, the simple instructions are:
45#
46# 1. `cd /usr/src' (or to the directory containing your source tree).
47# 2. `make world'
48#
49# For individuals wanting to upgrade their sources (even if only a
50# delta of a few days):
51#
52# 1. `cd /usr/src' (or to the directory containing your source tree).
53# 2. `make buildworld'
54# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
55# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
56# 5. `reboot' (in single user mode: boot -s from the loader prompt).
57# 6. `mergemaster -p'
58# 7. `make installworld'
59# 8. `mergemaster'
60# 9. `reboot'
61#
62# See src/UPDATING `COMMON ITEMS' for more complete information.
63#
984263bc
MD
64# If TARGET_ARCH=arch (e.g. alpha) is specified you can
65# cross build world for other architectures using the buildworld target,
66# and once the world is built you can cross build a kernel using the
67# buildkernel target.
68#
69# ----------------------------------------------------------------------------
70#
71# Upgrading an i386 system from a.out to elf format
72#
73#
74# The aout->elf transition build is performed by doing a `make upgrade' (or
75# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
76# by a `make aout-to-elf-install', depending on user preference.
77# You need to have at least 320 Mb of free space for the object tree.
78#
79# The upgrade process checks the installed release. If this is 3.0-CURRENT,
80# it is assumed that your kernel contains all the syscalls required by the
81# current sources.
82#
83# The upgrade procedure will stop and ask for confirmation to proceed
84# several times. On each occasion, you can type Ctrl-C to abort the
85# upgrade. Optionally, you can also start it with NOCONFIRM=yes and skip
86# the confirmation steps.
87#
984263bc
MD
88# ----------------------------------------------------------------------------
89#
90#
91# Define the user-driven targets. These are listed here in alphabetical
92# order, but that's not important.
93#
1397f94a
MD
94TGTS= all all-man buildkernel buildworld crossworld quickworld \
95 realquickworld checkdpadd clean \
984263bc
MD
96 cleandepend cleandir depend distribute distributeworld everything \
97 hierarchy install installcheck installkernel \
98 reinstallkernel installmost installworld libraries lint maninstall \
e05c8c84 99 mk most nativekernel obj objlink regress rerelease tags update
984263bc
MD
100
101BITGTS= files includes
102BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
103
104.ORDER: buildworld installworld
105.ORDER: buildworld distributeworld
106.ORDER: buildworld buildkernel
107.ORDER: buildkernel installkernel
108.ORDER: buildkernel reinstallkernel
109
110PATH= /sbin:/bin:/usr/sbin:/usr/bin
111MAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
112
113#
114# Handle the user-driven targets, using the source relative mk files.
115#
116${TGTS} ${BITGTS}: upgrade_checks
117 @cd ${.CURDIR}; \
118 ${MAKE} ${.TARGET}
119
120# Set a reasonable default
121.MAIN: all
122
123STARTTIME!= LC_ALL=C date
124#
125# world
126#
127# Attempt to rebuild and reinstall *everything*, with reasonable chance of
128# success, regardless of how old your existing system is.
129#
130world: upgrade_checks
131 @echo "--------------------------------------------------------------"
aa8d5dcb 132 @echo ">>> elf make world started on ${STARTTIME}"
984263bc
MD
133 @echo "--------------------------------------------------------------"
134.if target(pre-world)
135 @echo
136 @echo "--------------------------------------------------------------"
137 @echo ">>> Making 'pre-world' target"
138 @echo "--------------------------------------------------------------"
139 @cd ${.CURDIR}; ${MAKE} pre-world
140.endif
141 @cd ${.CURDIR}; ${MAKE} buildworld
142 @cd ${.CURDIR}; ${MAKE} -B installworld
143.if target(post-world)
144 @echo
145 @echo "--------------------------------------------------------------"
146 @echo ">>> Making 'post-world' target"
147 @echo "--------------------------------------------------------------"
148 @cd ${.CURDIR}; ${MAKE} post-world
149.endif
150 @echo
151 @echo "--------------------------------------------------------------"
aa8d5dcb 152 @printf ">>> elf make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n"
984263bc
MD
153 @echo "--------------------------------------------------------------"
154
155#
156# kernel
157#
158# Short hand for `make buildkernel installkernel'
159#
160kernel: buildkernel installkernel
161
162#
163# Perform a few tests to determine if the installed tools are adequate
164# for building the world. These are for older systems (prior to 2.2.5).
165#
166# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
167# so the normal make world is capable of doing what is required to update
168# the system to current.
169#
170upgrade_checks:
171 @cd ${.CURDIR}; \
172 if ! make -m ${.CURDIR}/share/mk -Dnotdef test >/dev/null 2>&1; then \
173 make make; \
174 fi
175 @cd ${.CURDIR}; \
176 if make -V .CURDIR:C/.// 2>&1 >/dev/null | \
177 grep -q "Unknown modifier 'C'"; then \
178 make make; \
179 fi
180
181#
182# A simple test target used as part of the test to see if make supports
183# the -m argument. Also test that make will only evaluate a conditional
184# as far as is necessary to determine its value.
185#
186test:
187.if defined(notdef)
188.undef notdef
189.if defined(notdef) && ${notdef:U}
190.endif
191.endif
192
193#
194# Upgrade the installed make to the current version using the installed
195# headers, libraries and build tools. This is required on installed versions
196# prior to 2.2.5 in which the installed make doesn't support the -m argument.
197#
198make:
199 @echo
200 @echo "--------------------------------------------------------------"
201 @echo " Upgrading the installed make"
202 @echo "--------------------------------------------------------------"
203 @cd ${.CURDIR}/usr.bin/make; \
204 make obj && make depend && make all && make install
205
206#
207# Define the upgrade targets. These are listed here in alphabetical
208# order, but that's not important.
209#
210UPGRADE= aout-to-elf aout-to-elf-build aout-to-elf-install \
211 move-aout-libs
212
213#
214# Handle the upgrade targets, using the source relative mk files.
215#
216
e50c8f0c
MD
217upgrade: upgrade_etc
218
219#
220# Handle post-installworld updating of static files (e.g. like /etc/rc)
221#
222upgrade_etc:
223 @cd ${.CURDIR}/etc; make upgrade_etc
984263bc
MD
224
225${UPGRADE} : upgrade_checks
226 @cd ${.CURDIR}; \
227 ${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}