ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile
Revision: 9188
Committed: Mon Oct 17 13:01:53 2016 UTC (7 years, 6 months ago) by laffer1
File size: 16028 byte(s)
Log Message:
do not use upgrade checks with bmake

File Contents

# Content
1 #
2 # $MidnightBSD$
3 #
4 # The user-driven targets are:
5 #
6 # universe - *Really* build *everything* (buildworld and
7 # all kernels on all architectures).
8 # tinderbox - Same as universe, but presents a list of failed build
9 # targets and exits with an error if there were any.
10 # buildworld - Rebuild *everything*, including glue to help do
11 # upgrades.
12 # installworld - Install everything built by "buildworld".
13 # world - buildworld + installworld, no kernel.
14 # buildkernel - Rebuild the kernel and the kernel-modules.
15 # installkernel - Install the kernel and the kernel-modules.
16 # installkernel.debug
17 # reinstallkernel - Reinstall the kernel and the kernel-modules.
18 # reinstallkernel.debug
19 # kernel - buildkernel + installkernel.
20 # kernel-toolchain - Builds the subset of world necessary to build a kernel
21 # doxygen - Build API documentation of the kernel, needs doxygen.
22 # update - Convenient way to update your source tree (cvs).
23 # check-old - List obsolete directories/files/libraries.
24 # check-old-dirs - List obsolete directories.
25 # check-old-files - List obsolete files.
26 # check-old-libs - List obsolete libraries.
27 # delete-old - Delete obsolete directories/files/libraries.
28 # delete-old-dirs - Delete obsolete directories.
29 # delete-old-files - Delete obsolete files.
30 # delete-old-libs - Delete obsolete libraries.
31 # targets - Print a list of supported TARGET/TARGET_ARCH pairs
32 # for world and kernel targets.
33 # toolchains - Build a toolchain for all world and kernel targets.
34 #
35 # This makefile is simple by design. The MidnightBSD make automatically reads
36 # the /usr/share/mk/sys.mk unless the -m argument is specified on the
37 # command line. By keeping this makefile simple, it doesn't matter too
38 # much how different the installed mk files are from those in the source
39 # tree. This makefile executes a child make process, forcing it to use
40 # the mk files from the source tree which are supposed to DTRT.
41 #
42 # Most of the user-driven targets (as listed above) are implemented in
43 # Makefile.inc1. The exceptions are universe, tinderbox and targets.
44 #
45 # If you want to build your system from source be sure that /usr/obj has
46 # at least 1GB of diskspace available. A complete 'universe' build requires
47 # about 15GB of space.
48 #
49 # For individuals wanting to build from the sources currently on their
50 # system, the simple instructions are:
51 #
52 # 1. `cd /usr/src' (or to the directory containing your source tree).
53 # 2. Define `HISTORICAL_MAKE_WORLD' variable (see README).
54 # 3. `make world'
55 #
56 # For individuals wanting to upgrade their sources (even if only a
57 # delta of a few days):
58 #
59 # 1. `cd /usr/src' (or to the directory containing your source tree).
60 # 2. `make buildworld'
61 # 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
62 # 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
63 # [steps 3. & 4. can be combined by using the "kernel" target]
64 # 5. `reboot' (in single user mode: boot -s from the loader prompt).
65 # 6. `mergemaster -p'
66 # 7. `make installworld'
67 # 8. `make delete-old'
68 # 9. `mergemaster' (you may wish to use -i, along with -U or -F)
69 # 10. `reboot'
70 # 11. `make delete-old-libs' (in case no 3rd party program uses them anymore)
71 #
72 # See src/UPDATING `COMMON ITEMS' for more complete information.
73 #
74 # If TARGET=machine (e.g. amd64, ...) is specified you can
75 # cross build world for other machine types using the buildworld target,
76 # and once the world is built you can cross build a kernel using the
77 # buildkernel target.
78 #
79 # Define the user-driven targets. These are listed here in alphabetical
80 # order, but that's not important.
81 #
82 # Targets that begin with underscore are internal targets intended for
83 # developer convenience only. They are intentionally not documented and
84 # completely subject to change without notice.
85 #
86 # For more information, see the build(7) manual page.
87 #
88 TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
89 check-old check-old-dirs check-old-files check-old-libs \
90 checkdpadd clean cleandepend cleandir \
91 delete-old delete-old-dirs delete-old-files delete-old-libs \
92 depend distribute distributekernel distributekernel.debug \
93 distributeworld distrib-dirs distribution doxygen \
94 everything hierarchy install installcheck installkernel \
95 installkernel.debug packagekernel packageworld \
96 reinstallkernel reinstallkernel.debug \
97 installworld kernel-toolchain libraries lint maninstall \
98 obj objlink regress rerelease showconfig tags toolchain update \
99 _worldtmp _legacy _bootstrap-tools _cleanobj _obj \
100 _build-tools _cross-tools _includes _libraries _depend \
101 build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
102
103 TGTS+= ${SUBDIR_TARGETS}
104
105 # XXX: clang integrated-as doesn't grok .codeNN directives yet
106 CFLAGS.cdboot.S= ${CLANG_NO_IAS}
107 CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
108
109 BITGTS= files includes
110 BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
111 TGTS+= ${BITGTS}
112
113 .ORDER: buildworld installworld
114 .ORDER: buildworld distributeworld
115 .ORDER: buildworld buildkernel
116 .ORDER: buildkernel installkernel
117 .ORDER: buildkernel installkernel.debug
118 .ORDER: buildkernel reinstallkernel
119 .ORDER: buildkernel reinstallkernel.debug
120
121 PATH= /sbin:/bin:/usr/sbin:/usr/bin
122 MAKEOBJDIRPREFIX?= /usr/obj
123 _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
124 ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
125 -f /dev/null -V MAKEOBJDIRPREFIX dummy
126 .if !empty(_MAKEOBJDIRPREFIX)
127 .error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
128 (in make.conf(5)) or command-line variable.
129 .endif
130 MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
131 BINMAKE= \
132 `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
133 -m ${.CURDIR}/share/mk
134 _MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
135
136 # Guess machine architecture from machine type, and vice versa.
137 .if !defined(TARGET_ARCH) && defined(TARGET)
138 _TARGET_ARCH= ${TARGET}
139 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
140 ${TARGET_ARCH} != ${MACHINE_ARCH}
141 _TARGET= ${TARGET_ARCH}
142 .endif
143 .if defined(TARGET) && !defined(_TARGET)
144 _TARGET=${TARGET}
145 .endif
146 .if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
147 _TARGET_ARCH=${TARGET_ARCH}
148 .endif
149 # Otherwise, default to current machine type and architecture.
150 _TARGET?= ${MACHINE}
151 _TARGET_ARCH?= ${MACHINE_ARCH}
152
153 #
154 # Make sure we have an up-to-date make(1). Only world and buildworld
155 # should do this as those are the initial targets used for upgrades.
156 # The user can define ALWAYS_CHECK_MAKE to have this check performed
157 # for all targets.
158 #
159 .if defined(ALWAYS_CHECK_MAKE)
160 ${TGTS}: upgrade_checks
161 .else
162 buildworld: upgrade_checks
163 .endif
164
165 #
166 # This 'cleanworld' target is not included in TGTS, because it is not a
167 # recursive target. All of the work for it is done right here. It is
168 # expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
169 # created by bsd.obj.mk, except that we don't want to .include that file
170 # in this makefile.
171 #
172 # In the following, the first 'rm' in a series will usually remove all
173 # files and directories. If it does not, then there are probably some
174 # files with chflags set, so this unsets them and tries the 'rm' a
175 # second time. There are situations where this target will be cleaning
176 # some directories via more than one method, but that duplication is
177 # needed to correctly handle all the possible situations.
178 #
179 BW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
180 cleanworld:
181 .if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
182 .if exists(${BW_CANONICALOBJDIR}/)
183 -rm -rf ${BW_CANONICALOBJDIR}/*
184 -chflags -R 0 ${BW_CANONICALOBJDIR}
185 rm -rf ${BW_CANONICALOBJDIR}/*
186 .endif
187 # To be safe in this case, fall back to a 'make cleandir'
188 ${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
189 .else
190 -rm -rf ${.OBJDIR}/*
191 -chflags -R 0 ${.OBJDIR}
192 rm -rf ${.OBJDIR}/*
193 .endif
194
195 #
196 # Handle the user-driven targets, using the source relative mk files.
197 #
198
199 ${TGTS}:
200 ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
201
202 # The historic default "all" target creates files which may cause stale
203 # or (in the cross build case) unlinkable results. Fail with an error
204 # when no target is given. The users can explicitly specify "all"
205 # if they want the historic behavior.
206 .MAIN: _guard
207
208 _guard:
209 @echo
210 @echo "Explicit target required (use \"all\" for historic behavior)"
211 @echo
212 @false
213
214 STARTTIME!= LC_ALL=C date
215 CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
216 .if !empty(CHECK_TIME)
217 .error check your date/time: ${STARTTIME}
218 .endif
219
220 .if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
221 #
222 # world
223 #
224 # Attempt to rebuild and reinstall everything. This target is not to be
225 # used for upgrading an existing MidnightBSD system, because the kernel is
226 # not included. One can argue that this target doesn't build everything
227 # then.
228 #
229 world: upgrade_checks
230 @echo "--------------------------------------------------------------"
231 @echo ">>> make world started on ${STARTTIME}"
232 @echo "--------------------------------------------------------------"
233 .if target(pre-world)
234 @echo
235 @echo "--------------------------------------------------------------"
236 @echo ">>> Making 'pre-world' target"
237 @echo "--------------------------------------------------------------"
238 ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
239 .endif
240 ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
241 ${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
242 .if target(post-world)
243 @echo
244 @echo "--------------------------------------------------------------"
245 @echo ">>> Making 'post-world' target"
246 @echo "--------------------------------------------------------------"
247 ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
248 .endif
249 @echo
250 @echo "--------------------------------------------------------------"
251 @echo ">>> make world completed on `LC_ALL=C date`"
252 @echo " (started ${STARTTIME})"
253 @echo "--------------------------------------------------------------"
254 .else
255 world:
256 @echo "WARNING: make world will overwrite your existing MidnightBSD"
257 @echo "installation without also building and installing a new"
258 @echo "kernel. This can be dangerous. Please read the handbook,"
259 @echo "'Rebuilding world', for how to upgrade your system."
260 @echo "Define DESTDIR to where you want to install MidnightBSD,"
261 @echo "including /, to override this warning and proceed as usual."
262 @echo ""
263 @echo "Bailing out now..."
264 @false
265 .endif
266
267 #
268 # kernel
269 #
270 # Short hand for `make buildkernel installkernel'
271 #
272 kernel: buildkernel installkernel
273
274 #
275 # Perform a few tests to determine if the installed tools are adequate
276 # for building the world.
277 #
278 upgrade_checks:
279 .if !defined(.PARSEDIR)
280 @if ! (cd ${.CURDIR}/tools/build/make_check && \
281 PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
282 PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
283 then \
284 (cd ${.CURDIR} && ${MAKE} make); \
285 fi
286 .endif
287
288 #
289 # Upgrade make(1) to the current version using the installed
290 # headers, libraries and tools. Also, allow the location of
291 # the system bsdmake-like utility to be overridden.
292 #
293 MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \
294 DESTDIR= \
295 INSTALL="sh ${.CURDIR}/tools/install.sh"
296 MMAKE= ${MMAKEENV} ${MAKE} \
297 -D_UPGRADING \
298 -DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
299 -DNO_CPU_CFLAGS -DNO_WERROR
300
301 make: .PHONY
302 @echo
303 @echo "--------------------------------------------------------------"
304 @echo ">>> Building an up-to-date make(1)"
305 @echo "--------------------------------------------------------------"
306 ${_+_}@cd ${.CURDIR}/usr.bin/make; \
307 ${MMAKE} obj && \
308 ${MMAKE} depend && \
309 ${MMAKE} all && \
310 ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
311
312 tinderbox:
313 @cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe
314
315 toolchains:
316 @cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=toolchain universe
317
318 #
319 # universe
320 #
321 # Attempt to rebuild *everything* for all supported architectures,
322 # with a reasonable chance of success, regardless of how old your
323 # existing system is.
324 #
325 .if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
326 TARGETS?=amd64 i386
327 .for target in ${TARGETS}
328 TARGET_ARCHES_${target}?= ${target}
329 .endfor
330
331 .if defined(UNIVERSE_TARGET)
332 MAKE_JUST_WORLDS= YES
333 .else
334 UNIVERSE_TARGET?= buildworld
335 .endif
336 KERNSRCDIR?= ${.CURDIR}/sys
337
338 targets:
339 @echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
340 .for target in ${TARGETS}
341 .for target_arch in ${TARGET_ARCHES_${target}}
342 @echo " ${target}/${target_arch}"
343 .endfor
344 .endfor
345
346 .if defined(DOING_TINDERBOX)
347 FAILFILE=${.CURDIR}/_.tinderbox.failed
348 MAKEFAIL=tee -a ${FAILFILE}
349 .else
350 MAKEFAIL=cat
351 .endif
352
353 universe: universe_prologue upgrade_checks
354 universe_prologue:
355 @echo "--------------------------------------------------------------"
356 @echo ">>> make universe started on ${STARTTIME}"
357 @echo "--------------------------------------------------------------"
358 .if defined(DOING_TINDERBOX)
359 @rm -f ${FAILFILE}
360 .endif
361 .for target in ${TARGETS}
362 universe: universe_${target}
363 .ORDER: universe_prologue upgrade_checks universe_${target}_prologue universe_${target} universe_epilogue
364 universe_${target}: universe_${target}_prologue
365 universe_${target}_prologue:
366 @echo ">> ${target} started on `LC_ALL=C date`"
367 .if !defined(MAKE_JUST_KERNELS)
368 .for target_arch in ${TARGET_ARCHES_${target}}
369 universe_${target}: universe_${target}_${target_arch}
370 universe_${target}_${target_arch}: universe_${target}_prologue
371 @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
372 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
373 ${MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
374 TARGET=${target} \
375 TARGET_ARCH=${target_arch} \
376 > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
377 (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
378 "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
379 ${MAKEFAIL}))
380 @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
381 .endfor
382 .endif
383 .if !defined(MAKE_JUST_WORLDS)
384 .if exists(${KERNSRCDIR}/${target}/conf/NOTES)
385 @(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
386 ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
387 (echo "${target} 'make LINT' failed," \
388 "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
389 .endif
390 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
391 universe_kernels
392 .endif
393 @echo ">> ${target} completed on `LC_ALL=C date`"
394 .endfor
395 universe_kernels: universe_kernconfs
396 .if !defined(TARGET)
397 TARGET!= uname -m
398 .endif
399 KERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \
400 find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
401 ! -name DEFAULTS ! -name NOTES
402 universe_kernconfs:
403 .for kernel in ${KERNCONFS}
404 TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \
405 config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
406 grep -v WARNING: | cut -f 2
407 .if empty(TARGET_ARCH_${kernel})
408 .error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old."
409 .endif
410 universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
411 universe_kernconf_${TARGET}_${kernel}:
412 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
413 ${MAKE} ${JFLAG} buildkernel \
414 TARGET=${TARGET} \
415 TARGET_ARCH=${TARGET_ARCH_${kernel}} \
416 KERNCONF=${kernel} \
417 > _.${TARGET}.${kernel} 2>&1 || \
418 (echo "${TARGET} ${kernel} kernel failed," \
419 "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
420 .endfor
421 universe: universe_epilogue
422 universe_epilogue:
423 @echo "--------------------------------------------------------------"
424 @echo ">>> make universe completed on `LC_ALL=C date`"
425 @echo " (started ${STARTTIME})"
426 @echo "--------------------------------------------------------------"
427 .if defined(DOING_TINDERBOX)
428 @if [ -e ${FAILFILE} ] ; then \
429 echo "Tinderbox failed:" ;\
430 cat ${FAILFILE} ;\
431 exit 1 ;\
432 fi
433 .endif
434 .endif

Properties

Name Value
svn:keywords MidnightBSD=%H