kernel/netgraph7: Fix some build issues.
[dragonfly.git] / Makefile
blob91cb68d8825472943a1b225b6a6d1811d313f39e
2 # $FreeBSD: src/Makefile,v 1.234.2.19 2003/04/16 09:59:40 ru Exp $
4 # The user-driven targets are:
6 # buildworld - Rebuild *everything* but the kernel, including glue to
7 # help do upgrades.
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.
11 # installworld - Install everything built by "buildworld".
12 # installworld-force - Install everything built by "buildworld";
13 # special case for old systems.
14 # world - buildworld + installworld.
15 # buildkernel - Rebuild the kernel and the kernel-modules from scratch
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.
22 # realquickkernel - Like quickkernel, but skips depend too.
23 # installkernel - Install the kernel and the kernel-modules.
24 # reinstallkernel - Reinstall the kernel and the kernel-modules.
25 # kernel - buildkernel + installkernel.
26 # preupgrade - Do certain upgrades (typically the addition of new
27 # users and groups used by installed utilities) before
28 # the installworld.
29 # upgrade - Upgrade the files in /etc and also setup the rest
30 # of the system for DragonFly. ex. two compilers.
31 # rescue - Build and install the statically linked rescue tools.
32 # initrd - Build the rescue tools and create the initrd image.
33 # backupworld - Copy /bin /sbin /usr/bin /usr/sbin /usr/lib
34 # /usr/libexec to manual backup dir.
35 # restoreworld - Install binaries from manual backup dir to world.
36 # restoreworld-auto - Install binaries from auto-backup dir to world;
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.
41 # This makefile is simple by design. The DragonFly make automatically reads
42 # /usr/share/mk/sys.mk unless the -m argument is specified on the
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.
48 # Most of the user-driven targets (as listed above) are implemented in
49 # Makefile.inc1.
51 # For individuals wanting to build from the sources currently on their
52 # system, the simple instructions are:
54 # 1. `cd /usr/src' (or to the directory containing your source tree).
55 # 2. `make world'
57 # For individuals wanting to upgrade their sources (even if only a
58 # delta of a few days):
60 # 1. `cd /usr/src' (or to the directory containing your source tree).
61 # 2. `make buildworld'
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).
64 # 5. `make installworld'
65 # 6. `make upgrade'
66 # 7. `reboot'
67 # 8. `make initrd' (after making sure that the new world works well).
69 # If TARGET_ARCH=arch (e.g. x86_64) is specified you can
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.
74 # For more information, see the build(7) manual page.
77 TGTS= all all-man buildkernel quickkernel realquickkernel nativekernel \
78 buildworld crossworld quickworld realquickworld checkdpadd clean \
79 cleandepend cleandir depend everything \
80 hierarchy install installcheck installkernel \
81 reinstallkernel installworld installworld-force \
82 libraries lint maninstall \
83 manlint mk obj objlink regress rerelease tags \
84 backupworld restoreworld restoreworld-auto \
85 backup-clean backup-auto-clean \
86 _obj _includes _libraries _depend _worldtmp \
87 _bootstrap-tools _build-tools _cross-tools
88 TGTS+= mandiff # XXX temporary target
90 BITGTS= files includes
91 BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
93 .ORDER: buildworld installworld
94 .ORDER: buildworld buildkernel
95 .ORDER: buildworld nativekernel
96 .ORDER: buildworld quickkernel
97 .ORDER: buildworld realquickkernel
98 .ORDER: buildkernel installkernel
99 .ORDER: buildkernel reinstallkernel
100 .ORDER: quickworld installworld
101 .ORDER: quickworld buildkernel
102 .ORDER: quickworld nativekernel
103 .ORDER: quickworld quickkernel
104 .ORDER: quickworld realquickkernel
105 .ORDER: quickkernel installkernel
106 .ORDER: quickkernel reinstallkernel
107 .ORDER: realquickkernel installkernel
108 .ORDER: realquickkernel reinstallkernel
110 PATH= /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/pkg/bin
111 MAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
114 # Handle the user-driven targets, using the source relative mk files.
116 ${TGTS} ${BITGTS}:
117 @cd ${.CURDIR}; \
118 ${MAKE} ${.TARGET}
120 # Set a reasonable default
121 .MAIN: all
123 STARTTIME!= LC_ALL=C date
125 # world
127 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
128 # success, regardless of how old your existing system is.
130 world:
131 @echo "--------------------------------------------------------------"
132 @echo ">>> make world started on ${STARTTIME}"
133 @echo "--------------------------------------------------------------"
134 .if target(pre-world)
135 @echo
136 @echo "--------------------------------------------------------------"
137 @echo ">>> starting pre-world target"
138 @echo "--------------------------------------------------------------"
139 @cd ${.CURDIR}; ${MAKE} pre-world
140 @echo "--------------------------------------------------------------"
141 @echo ">>> pre-world target complete"
142 @echo "--------------------------------------------------------------"
143 .endif
144 @cd ${.CURDIR}; ${MAKE} buildworld
145 @cd ${.CURDIR}; ${MAKE} -B installworld
146 .if target(post-world)
147 @echo
148 @echo "--------------------------------------------------------------"
149 @echo ">>> starting post-world target"
150 @echo "--------------------------------------------------------------"
151 @cd ${.CURDIR}; ${MAKE} post-world
152 @echo "--------------------------------------------------------------"
153 @echo ">>> post-world target complete"
154 @echo "--------------------------------------------------------------"
155 .endif
156 @echo
157 @echo "--------------------------------------------------------------"
158 @printf ">>> make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n"
159 @echo "--------------------------------------------------------------"
162 # kernel
164 # Short hand for `make buildkernel installkernel'
166 kernel: buildkernel installkernel
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.
173 test:
174 .if defined(notdef)
175 .undef notdef
176 .if defined(notdef) && ${notdef:tu}
177 .endif
178 .endif
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.
185 make:
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
194 # Handle the upgrade of /etc, post-installworld updating of static files
195 # and removing obsolete files.
198 preupgrade:
199 @cd ${.CURDIR}/etc; make -m ${.CURDIR}/share/mk preupgrade
201 upgrade:
202 @cd ${.CURDIR}/etc; make -m ${.CURDIR}/share/mk upgrade_etc
203 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
204 @cd ${.CURDIR}/share/man; make makedb
205 .endif
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 "--------------------------------------------------------------"
217 # Build and install the statically linked rescue tools, and create the
218 # initrd image.
220 rescue initrd quickrescue quickinitrd: .PHONY
221 (cd ${.CURDIR}/initrd; make ${.TARGET})