nrelease - fix/improve livecd
[dragonfly.git] / Makefile
CommitLineData
984263bc
MD
1#
2# $FreeBSD: src/Makefile,v 1.234.2.19 2003/04/16 09:59:40 ru Exp $
3#
4# The user-driven targets are:
5#
e79a303f
AL
6# buildworld - Rebuild *everything* but the kernel, including glue to
7# help do upgrades.
f71956f7
AL
8# quickworld - Skip bootstrap, build and cross-build tool steps.
9# realquickworld - Skip above steps, plus depend.
10# crossworld - Just do the bootstrap, build, and cross-build steps.
a361ab31
MD
11#
12# buildportschroot - Build the chroot environment for buildports
13# buildports - Build dragonfly/base dports
14#
bc897c50
AL
15# installworld - Install everything built by "buildworld", and the
16# rescue tools and initrd image if they do not exist.
f71956f7
AL
17# installworld-force - Install everything built by "buildworld";
18# special case for old systems.
a361ab31
MD
19# installports - Install ports built via buildports.
20# cleanupports - umount all the special chroot mounts for buildports
21# and cleanup any dsynth mounts that might be left over.
22#
984263bc 23# world - buildworld + installworld.
fc7aca3e 24# buildkernel - Rebuild the kernel and the kernel-modules from scratch
f71956f7
AL
25# using build/bootstrap/cross tools from the last
26# buildworld.
27# nativekernel - Rebuild the kernel and the kernel-modules from scratch
28# using native tools.
29# quickkernel - Rebuild the kernel quickly (build or native), and do
30# not clean out the obj modules.
92c9dfec 31# realquickkernel - Like quickkernel, but skips depend too.
984263bc
MD
32# installkernel - Install the kernel and the kernel-modules.
33# reinstallkernel - Reinstall the kernel and the kernel-modules.
34# kernel - buildkernel + installkernel.
89e9c22c
AL
35# preinstall - Do certain operations (typically the addition of new
36# users and groups used by utilities to be installed)
37# before doing installworld.
8db5e54f 38# upgrade - Upgrade the files in /etc and also setup the rest
f71956f7 39# of the system for DragonFly. ex. two compilers.
1bd119d2 40# build-all - Runs buildworld and buildkernel both with -j hw.ncpu
a361ab31 41# Also runs buildportschroot and buildports
1bd119d2
DF
42# install-all - Runs installkernel, installworld and upgrade all with
43# -j 1
a361ab31 44#
bc897c50
AL
45# initrd - Install the statically linked rescue tools and the
46# initrd image built by "buildworld".
f71956f7 47# backupworld - Copy /bin /sbin /usr/bin /usr/sbin /usr/lib
2decc9b9 48# /usr/libexec to manual backup dir.
f71956f7
AL
49# restoreworld - Install binaries from manual backup dir to world.
50# restoreworld-auto - Install binaries from auto-backup dir to world;
2decc9b9
JM
51# installworld target makes backup to auto-backup dir.
52# backup-auto-clean - Delete backup from auto-backup dir.
53# backup-clean - Delete backup from manual backup dir.
984263bc 54#
114580ac 55# This makefile is simple by design. The DragonFly make automatically reads
f71956f7 56# /usr/share/mk/sys.mk unless the -m argument is specified on the
984263bc
MD
57# command line. By keeping this makefile simple, it doesn't matter too
58# much how different the installed mk files are from those in the source
59# tree. This makefile executes a child make process, forcing it to use
60# the mk files from the source tree which are supposed to DTRT.
61#
f71956f7 62# Most of the user-driven targets (as listed above) are implemented in
e79a303f 63# Makefile.inc1.
984263bc
MD
64#
65# For individuals wanting to build from the sources currently on their
66# system, the simple instructions are:
67#
68# 1. `cd /usr/src' (or to the directory containing your source tree).
69# 2. `make world'
70#
71# For individuals wanting to upgrade their sources (even if only a
72# delta of a few days):
73#
74# 1. `cd /usr/src' (or to the directory containing your source tree).
75# 2. `make buildworld'
9b724c0d
MD
76# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default X86_64_GENERIC).
77# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default X86_64_GENERIC).
30d6fede
SW
78# 5. `make installworld'
79# 6. `make upgrade'
80# 7. `reboot'
bc897c50 81# 8. `make initrd' (after making sure that the new world works well).
984263bc 82#
b2b3ffcd 83# If TARGET_ARCH=arch (e.g. x86_64) is specified you can
984263bc
MD
84# cross build world for other architectures using the buildworld target,
85# and once the world is built you can cross build a kernel using the
86# buildkernel target.
87#
f71956f7 88# For more information, see the build(7) manual page.
984263bc 89#
f71956f7 90
92c9dfec 91TGTS= all all-man buildkernel quickkernel realquickkernel nativekernel \
fc7aca3e 92 buildworld crossworld quickworld realquickworld checkdpadd clean \
5cccfb7b 93 cleandepend cleandir depend everything \
a361ab31 94 buildportschroot buildports installports mountports umountports \
984263bc 95 hierarchy install installcheck installkernel \
fae4aceb 96 reinstallkernel installworld installworld-force os-release initrd \
f71956f7 97 libraries lint maninstall \
e972a8ba 98 manlint mk obj objlink regress rerelease tags \
e79a303f 99 backupworld restoreworld restoreworld-auto \
d0bcca46 100 build-all install-all \
2decc9b9 101 backup-clean backup-auto-clean \
fd4528de 102 _obj _includes _libraries _depend _worldtmp \
9f8ba22c 103 _bootstrap-tools _build-tools _cross-tools
1419a4e1 104#TGTS+= mandiff # XXX temporary target
984263bc
MD
105
106BITGTS= files includes
107BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
108
109.ORDER: buildworld installworld
828e58f9
SS
110.ORDER: buildworld buildkernel
111.ORDER: buildworld nativekernel
112.ORDER: buildworld quickkernel
92c9dfec 113.ORDER: buildworld realquickkernel
828e58f9
SS
114.ORDER: buildkernel installkernel
115.ORDER: buildkernel reinstallkernel
116.ORDER: quickworld installworld
828e58f9
SS
117.ORDER: quickworld buildkernel
118.ORDER: quickworld nativekernel
119.ORDER: quickworld quickkernel
92c9dfec 120.ORDER: quickworld realquickkernel
828e58f9
SS
121.ORDER: quickkernel installkernel
122.ORDER: quickkernel reinstallkernel
92c9dfec
SW
123.ORDER: realquickkernel installkernel
124.ORDER: realquickkernel reinstallkernel
d0bcca46 125.ORDER: build-all install-all
984263bc 126
a361ab31 127_HOSTPATH= /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
83abeeca 128MAKE= PATH=${_HOSTPATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
984263bc
MD
129
130#
131# Handle the user-driven targets, using the source relative mk files.
132#
bc897c50 133${TGTS} ${BITGTS}: .PHONY
984263bc
MD
134 @cd ${.CURDIR}; \
135 ${MAKE} ${.TARGET}
136
982afa6b
AL
137# Fail with an error when no target is given.
138.MAIN: _guard
139
140_guard: .PHONY
141 @echo
142 @echo "Explicit target required. See build(7)."
143 @echo
144 @false
984263bc
MD
145
146STARTTIME!= LC_ALL=C date
982afa6b 147
984263bc
MD
148#
149# world
150#
151# Attempt to rebuild and reinstall *everything*, with reasonable chance of
152# success, regardless of how old your existing system is.
153#
8db5e54f 154world:
984263bc 155 @echo "--------------------------------------------------------------"
24c1eacf 156 @echo ">>> make world started on ${STARTTIME}"
984263bc
MD
157 @echo "--------------------------------------------------------------"
158.if target(pre-world)
159 @echo
160 @echo "--------------------------------------------------------------"
24c1eacf 161 @echo ">>> starting pre-world target"
984263bc
MD
162 @echo "--------------------------------------------------------------"
163 @cd ${.CURDIR}; ${MAKE} pre-world
24c1eacf
JM
164 @echo "--------------------------------------------------------------"
165 @echo ">>> pre-world target complete"
166 @echo "--------------------------------------------------------------"
984263bc
MD
167.endif
168 @cd ${.CURDIR}; ${MAKE} buildworld
169 @cd ${.CURDIR}; ${MAKE} -B installworld
170.if target(post-world)
171 @echo
172 @echo "--------------------------------------------------------------"
24c1eacf 173 @echo ">>> starting post-world target"
984263bc
MD
174 @echo "--------------------------------------------------------------"
175 @cd ${.CURDIR}; ${MAKE} post-world
24c1eacf
JM
176 @echo "--------------------------------------------------------------"
177 @echo ">>> post-world target complete"
178 @echo "--------------------------------------------------------------"
984263bc
MD
179.endif
180 @echo
181 @echo "--------------------------------------------------------------"
24c1eacf 182 @printf ">>> make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n"
984263bc
MD
183 @echo "--------------------------------------------------------------"
184
984263bc
MD
185# kernel
186#
187# Short hand for `make buildkernel installkernel'
188#
189kernel: buildkernel installkernel
190
984263bc
MD
191#
192# A simple test target used as part of the test to see if make supports
193# the -m argument. Also test that make will only evaluate a conditional
194# as far as is necessary to determine its value.
195#
196test:
197.if defined(notdef)
198.undef notdef
3da8e88f
JM
199.if defined(notdef) && ${notdef:tu}
200.endif
3da8e88f 201.endif
984263bc
MD
202
203#
204# Upgrade the installed make to the current version using the installed
205# headers, libraries and build tools. This is required on installed versions
206# prior to 2.2.5 in which the installed make doesn't support the -m argument.
207#
208make:
209 @echo
210 @echo "--------------------------------------------------------------"
211 @echo " Upgrading the installed make"
212 @echo "--------------------------------------------------------------"
213 @cd ${.CURDIR}/usr.bin/make; \
214 make obj && make depend && make all && make install
215
89e9c22c 216# Handle pre-installworld operations (e.g., creating of new users/groups).
984263bc 217#
89e9c22c
AL
218installworld: preinstall
219preinstall:
220 @cd ${.CURDIR}/etc; make -m ${.CURDIR}/share/mk preinstall
f35282e3 221
6d657f85
AL
222# Handle the upgrade of /etc, post-installworld updating of static files
223# and removing obsolete files.
224#
30d8ccf3 225upgrade:
ab64cf06 226 @cd ${.CURDIR}/etc; make -m ${.CURDIR}/share/mk upgrade_etc
30d8ccf3 227.if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
e79a303f 228 @cd ${.CURDIR}/share/man; make makedb
30d8ccf3 229.endif
e79a303f
AL
230 @echo "--------------------------------------------------------------"
231 @echo "Now you can reboot into the new system! If the new system works as"
232 @echo "expected, consider updating the rescue tools and initrd image with:"
233 @echo " # cd ${.CURDIR}; make initrd"
234 @echo "NOTE: Do this only after verifying the new system works as expected!"
235 @echo ""
236 @echo "You also need to upgrade the 3rd-party packages with:"
bc14b951 237 @echo " # pkg update; pkg upgrade [-f]"
e79a303f 238 @echo "--------------------------------------------------------------"