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