kernel - Refactor kbmux arrays
[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.
984263bc 11# installworld - Install everything built by "buildworld".
f71956f7
AL
12# installworld-force - Install everything built by "buildworld";
13# special case for old systems.
984263bc 14# world - buildworld + installworld.
fc7aca3e 15# buildkernel - Rebuild the kernel and the kernel-modules from scratch
f71956f7
AL
16# using build/bootstrap/cross tools from the last
17# buildworld.
18# nativekernel - Rebuild the kernel and the kernel-modules from scratch
19# using native tools.
20# quickkernel - Rebuild the kernel quickly (build or native), and do
21# not clean out the obj modules.
92c9dfec 22# realquickkernel - Like quickkernel, but skips depend too.
984263bc
MD
23# installkernel - Install the kernel and the kernel-modules.
24# reinstallkernel - Reinstall the kernel and the kernel-modules.
25# kernel - buildkernel + installkernel.
e79a303f
AL
26# preupgrade - Do certain upgrades (typically the addition of new
27# users and groups used by installed utilities) before
f71956f7 28# the installworld.
8db5e54f 29# upgrade - Upgrade the files in /etc and also setup the rest
f71956f7 30# of the system for DragonFly. ex. two compilers.
e79a303f
AL
31# rescue - Build and install the statically linked rescue tools.
32# initrd - Build the rescue tools and create the initrd image.
f71956f7 33# backupworld - Copy /bin /sbin /usr/bin /usr/sbin /usr/lib
2decc9b9 34# /usr/libexec to manual backup dir.
f71956f7
AL
35# restoreworld - Install binaries from manual backup dir to world.
36# restoreworld-auto - Install binaries from auto-backup dir to world;
2decc9b9
JM
37# installworld target makes backup to auto-backup dir.
38# backup-auto-clean - Delete backup from auto-backup dir.
39# backup-clean - Delete backup from manual backup dir.
984263bc 40#
114580ac 41# This makefile is simple by design. The DragonFly make automatically reads
f71956f7 42# /usr/share/mk/sys.mk unless the -m argument is specified on the
984263bc
MD
43# command line. By keeping this makefile simple, it doesn't matter too
44# much how different the installed mk files are from those in the source
45# tree. This makefile executes a child make process, forcing it to use
46# the mk files from the source tree which are supposed to DTRT.
47#
f71956f7 48# Most of the user-driven targets (as listed above) are implemented in
e79a303f 49# Makefile.inc1.
984263bc
MD
50#
51# For individuals wanting to build from the sources currently on their
52# system, the simple instructions are:
53#
54# 1. `cd /usr/src' (or to the directory containing your source tree).
55# 2. `make world'
56#
57# For individuals wanting to upgrade their sources (even if only a
58# delta of a few days):
59#
60# 1. `cd /usr/src' (or to the directory containing your source tree).
61# 2. `make buildworld'
dd7331fe
SW
62# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is X86_64_GENERIC).
63# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is X86_64_GENERIC).
30d6fede
SW
64# 5. `make installworld'
65# 6. `make upgrade'
66# 7. `reboot'
e79a303f 67# 8. `make initrd' (after making sure that the new world works well).
984263bc 68#
b2b3ffcd 69# If TARGET_ARCH=arch (e.g. x86_64) is specified you can
984263bc
MD
70# cross build world for other architectures using the buildworld target,
71# and once the world is built you can cross build a kernel using the
72# buildkernel target.
73#
f71956f7 74# For more information, see the build(7) manual page.
984263bc 75#
f71956f7 76
92c9dfec 77TGTS= all all-man buildkernel quickkernel realquickkernel nativekernel \
fc7aca3e 78 buildworld crossworld quickworld realquickworld checkdpadd clean \
5cccfb7b 79 cleandepend cleandir depend everything \
984263bc 80 hierarchy install installcheck installkernel \
e972a8ba 81 reinstallkernel installworld installworld-force \
f71956f7 82 libraries lint maninstall \
e972a8ba 83 manlint mk obj objlink regress rerelease tags \
e79a303f 84 backupworld restoreworld restoreworld-auto \
2decc9b9 85 backup-clean backup-auto-clean \
fd4528de 86 _obj _includes _libraries _depend _worldtmp \
9f8ba22c 87 _bootstrap-tools _build-tools _cross-tools
18cdb849 88TGTS+= mandiff # XXX temporary target
984263bc
MD
89
90BITGTS= files includes
91BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
92
93.ORDER: buildworld installworld
828e58f9
SS
94.ORDER: buildworld buildkernel
95.ORDER: buildworld nativekernel
96.ORDER: buildworld quickkernel
92c9dfec 97.ORDER: buildworld realquickkernel
828e58f9
SS
98.ORDER: buildkernel installkernel
99.ORDER: buildkernel reinstallkernel
100.ORDER: quickworld installworld
828e58f9
SS
101.ORDER: quickworld buildkernel
102.ORDER: quickworld nativekernel
103.ORDER: quickworld quickkernel
92c9dfec 104.ORDER: quickworld realquickkernel
828e58f9
SS
105.ORDER: quickkernel installkernel
106.ORDER: quickkernel reinstallkernel
92c9dfec
SW
107.ORDER: realquickkernel installkernel
108.ORDER: realquickkernel reinstallkernel
984263bc 109
ee48961f 110PATH= /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/pkg/bin
984263bc
MD
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#
8db5e54f 116${TGTS} ${BITGTS}:
984263bc
MD
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#
8db5e54f 130world:
984263bc 131 @echo "--------------------------------------------------------------"
24c1eacf 132 @echo ">>> make world started on ${STARTTIME}"
984263bc
MD
133 @echo "--------------------------------------------------------------"
134.if target(pre-world)
135 @echo
136 @echo "--------------------------------------------------------------"
24c1eacf 137 @echo ">>> starting pre-world target"
984263bc
MD
138 @echo "--------------------------------------------------------------"
139 @cd ${.CURDIR}; ${MAKE} pre-world
24c1eacf
JM
140 @echo "--------------------------------------------------------------"
141 @echo ">>> pre-world target complete"
142 @echo "--------------------------------------------------------------"
984263bc
MD
143.endif
144 @cd ${.CURDIR}; ${MAKE} buildworld
145 @cd ${.CURDIR}; ${MAKE} -B installworld
146.if target(post-world)
147 @echo
148 @echo "--------------------------------------------------------------"
24c1eacf 149 @echo ">>> starting post-world target"
984263bc
MD
150 @echo "--------------------------------------------------------------"
151 @cd ${.CURDIR}; ${MAKE} post-world
24c1eacf
JM
152 @echo "--------------------------------------------------------------"
153 @echo ">>> post-world target complete"
154 @echo "--------------------------------------------------------------"
984263bc
MD
155.endif
156 @echo
157 @echo "--------------------------------------------------------------"
24c1eacf 158 @printf ">>> make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n"
984263bc
MD
159 @echo "--------------------------------------------------------------"
160
161#
162# kernel
163#
164# Short hand for `make buildkernel installkernel'
165#
166kernel: buildkernel installkernel
167
984263bc
MD
168#
169# A simple test target used as part of the test to see if make supports
170# the -m argument. Also test that make will only evaluate a conditional
171# as far as is necessary to determine its value.
172#
173test:
174.if defined(notdef)
175.undef notdef
3da8e88f
JM
176.if defined(notdef) && ${notdef:tu}
177.endif
3da8e88f 178.endif
984263bc
MD
179
180#
181# Upgrade the installed make to the current version using the installed
182# headers, libraries and build tools. This is required on installed versions
183# prior to 2.2.5 in which the installed make doesn't support the -m argument.
184#
185make:
186 @echo
187 @echo "--------------------------------------------------------------"
188 @echo " Upgrading the installed make"
189 @echo "--------------------------------------------------------------"
190 @cd ${.CURDIR}/usr.bin/make; \
191 make obj && make depend && make all && make install
192
193#
30d8ccf3
SW
194# Handle the upgrade of /etc, post-installworld updating of static files
195# and removing obsolete files.
984263bc
MD
196#
197
f35282e3 198preupgrade:
ab64cf06 199 @cd ${.CURDIR}/etc; make -m ${.CURDIR}/share/mk preupgrade
f35282e3 200
30d8ccf3 201upgrade:
ab64cf06 202 @cd ${.CURDIR}/etc; make -m ${.CURDIR}/share/mk upgrade_etc
30d8ccf3 203.if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
e79a303f 204 @cd ${.CURDIR}/share/man; make makedb
30d8ccf3 205.endif
e79a303f
AL
206 @echo "--------------------------------------------------------------"
207 @echo "Now you can reboot into the new system! If the new system works as"
208 @echo "expected, consider updating the rescue tools and initrd image with:"
209 @echo " # cd ${.CURDIR}; make initrd"
210 @echo "NOTE: Do this only after verifying the new system works as expected!"
211 @echo ""
212 @echo "You also need to upgrade the 3rd-party packages with:"
213 @echo " # pkg update; pkg [-f] upgrade"
214 @echo "--------------------------------------------------------------"
215
216#
217# Build and install the statically linked rescue tools, and create the
218# initrd image.
219#
4cdf70c7 220rescue initrd quickrescue quickinitrd: .PHONY
e79a303f 221 (cd ${.CURDIR}/initrd; make ${.TARGET})