ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile
Revision: 5772
Committed: Sun Feb 3 21:46:21 2013 UTC (11 years, 3 months ago) by laffer1
File size: 15550 byte(s)
Log Message:
update meremaster instructions

File Contents

# Content
1 #
2 # $MidnightBSD: src/Makefile,v 1.13 2012/08/19 14:05:10 laffer1 Exp $
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, sparc64, ...) 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 BITGTS= files includes
106 BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
107 TGTS+= ${BITGTS}
108
109 .ORDER: buildworld installworld
110 .ORDER: buildworld distributeworld
111 .ORDER: buildworld buildkernel
112 .ORDER: buildkernel installkernel
113 .ORDER: buildkernel installkernel.debug
114 .ORDER: buildkernel reinstallkernel
115 .ORDER: buildkernel reinstallkernel.debug
116
117 PATH= /sbin:/bin:/usr/sbin:/usr/bin
118 MAKEOBJDIRPREFIX?= /usr/obj
119 _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
120 ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
121 -f /dev/null -V MAKEOBJDIRPREFIX dummy
122 .if !empty(_MAKEOBJDIRPREFIX)
123 .error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
124 (in make.conf(5)) or command-line variable.
125 .endif
126 MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
127 BINMAKE= \
128 `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
129 -m ${.CURDIR}/share/mk
130 _MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
131
132 # Guess machine architecture from machine type, and vice versa.
133 .if !defined(TARGET_ARCH) && defined(TARGET)
134 _TARGET_ARCH= ${TARGET}
135 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
136 ${TARGET_ARCH} != ${MACHINE_ARCH}
137 _TARGET= ${TARGET_ARCH}
138 .endif
139 .if defined(TARGET) && !defined(_TARGET)
140 _TARGET=${TARGET}
141 .endif
142 .if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
143 _TARGET_ARCH=${TARGET_ARCH}
144 .endif
145 # Otherwise, default to current machine type and architecture.
146 _TARGET?= ${MACHINE}
147 _TARGET_ARCH?= ${MACHINE_ARCH}
148
149 #
150 # Make sure we have an up-to-date make(1). Only world and buildworld
151 # should do this as those are the initial targets used for upgrades.
152 # The user can define ALWAYS_CHECK_MAKE to have this check performed
153 # for all targets.
154 #
155 .if defined(ALWAYS_CHECK_MAKE)
156 ${TGTS}: upgrade_checks
157 .else
158 buildworld: upgrade_checks
159 .endif
160
161 #
162 # This 'cleanworld' target is not included in TGTS, because it is not a
163 # recursive target. All of the work for it is done right here. It is
164 # expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
165 # created by bsd.obj.mk, except that we don't want to .include that file
166 # in this makefile.
167 #
168 # In the following, the first 'rm' in a series will usually remove all
169 # files and directories. If it does not, then there are probably some
170 # files with chflags set, so this unsets them and tries the 'rm' a
171 # second time. There are situations where this target will be cleaning
172 # some directories via more than one method, but that duplication is
173 # needed to correctly handle all the possible situations.
174 #
175 BW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
176 cleanworld:
177 .if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
178 .if exists(${BW_CANONICALOBJDIR}/)
179 -rm -rf ${BW_CANONICALOBJDIR}/*
180 -chflags -R 0 ${BW_CANONICALOBJDIR}
181 rm -rf ${BW_CANONICALOBJDIR}/*
182 .endif
183 # To be safe in this case, fall back to a 'make cleandir'
184 ${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
185 .else
186 -rm -rf ${.OBJDIR}/*
187 -chflags -R 0 ${.OBJDIR}
188 rm -rf ${.OBJDIR}/*
189 .endif
190
191 #
192 # Handle the user-driven targets, using the source relative mk files.
193 #
194
195 ${TGTS}:
196 ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
197
198 # Set a reasonable default
199 .MAIN: all
200
201 STARTTIME!= LC_ALL=C date
202 CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s
203 .if !empty(CHECK_TIME)
204 .error check your date/time: ${STARTTIME}
205 .endif
206
207 .if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
208 #
209 # world
210 #
211 # Attempt to rebuild and reinstall everything. This target is not to be
212 # used for upgrading an existing MidnightBSD system, because the kernel is
213 # not included. One can argue that this target doesn't build everything
214 # then.
215 #
216 world: upgrade_checks
217 @echo "--------------------------------------------------------------"
218 @echo ">>> make world started on ${STARTTIME}"
219 @echo "--------------------------------------------------------------"
220 .if target(pre-world)
221 @echo
222 @echo "--------------------------------------------------------------"
223 @echo ">>> Making 'pre-world' target"
224 @echo "--------------------------------------------------------------"
225 ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
226 .endif
227 ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
228 ${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
229 .if target(post-world)
230 @echo
231 @echo "--------------------------------------------------------------"
232 @echo ">>> Making 'post-world' target"
233 @echo "--------------------------------------------------------------"
234 ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
235 .endif
236 @echo
237 @echo "--------------------------------------------------------------"
238 @echo ">>> make world completed on `LC_ALL=C date`"
239 @echo " (started ${STARTTIME})"
240 @echo "--------------------------------------------------------------"
241 .else
242 world:
243 @echo "WARNING: make world will overwrite your existing MidnightBSD"
244 @echo "installation without also building and installing a new"
245 @echo "kernel. This can be dangerous. Please read the handbook,"
246 @echo "'Rebuilding world', for how to upgrade your system."
247 @echo "Define DESTDIR to where you want to install MidnightBSD,"
248 @echo "including /, to override this warning and proceed as usual."
249 @echo ""
250 @echo "Bailing out now..."
251 @false
252 .endif
253
254 #
255 # kernel
256 #
257 # Short hand for `make buildkernel installkernel'
258 #
259 kernel: buildkernel installkernel
260
261 #
262 # Perform a few tests to determine if the installed tools are adequate
263 # for building the world.
264 #
265 upgrade_checks:
266 @if ! (cd ${.CURDIR}/tools/build/make_check && \
267 PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
268 PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
269 then \
270 (cd ${.CURDIR} && ${MAKE} make); \
271 fi
272
273 #
274 # Upgrade make(1) to the current version using the installed
275 # headers, libraries and tools. Also, allow the location of
276 # the system bsdmake-like utility to be overridden.
277 #
278 MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \
279 DESTDIR= \
280 INSTALL="sh ${.CURDIR}/tools/install.sh"
281 MMAKE= ${MMAKEENV} ${MAKE} \
282 -D_UPGRADING \
283 -DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
284 -DNO_CPU_CFLAGS -DNO_WERROR
285
286 make: .PHONY
287 @echo
288 @echo "--------------------------------------------------------------"
289 @echo ">>> Building an up-to-date make(1)"
290 @echo "--------------------------------------------------------------"
291 ${_+_}@cd ${.CURDIR}/usr.bin/make; \
292 ${MMAKE} obj && \
293 ${MMAKE} depend && \
294 ${MMAKE} all && \
295 ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
296
297 tinderbox:
298 @cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe
299
300 toolchains:
301 @cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=toolchain universe
302
303 #
304 # universe
305 #
306 # Attempt to rebuild *everything* for all supported architectures,
307 # with a reasonable chance of success, regardless of how old your
308 # existing system is.
309 #
310 .if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
311 TARGETS?=amd64 i386 sparc64
312 .for target in ${TARGETS}
313 TARGET_ARCHES_${target}?= ${target}
314 .endfor
315
316 .if defined(UNIVERSE_TARGET)
317 MAKE_JUST_WORLDS= YES
318 .else
319 UNIVERSE_TARGET?= buildworld
320 .endif
321 KERNSRCDIR?= ${.CURDIR}/sys
322
323 targets:
324 @echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
325 .for target in ${TARGETS}
326 .for target_arch in ${TARGET_ARCHES_${target}}
327 @echo " ${target}/${target_arch}"
328 .endfor
329 .endfor
330
331 .if defined(DOING_TINDERBOX)
332 FAILFILE=${.CURDIR}/_.tinderbox.failed
333 MAKEFAIL=tee -a ${FAILFILE}
334 .else
335 MAKEFAIL=cat
336 .endif
337
338 universe: universe_prologue
339 universe_prologue:
340 @echo "--------------------------------------------------------------"
341 @echo ">>> make universe started on ${STARTTIME}"
342 @echo "--------------------------------------------------------------"
343 .if defined(DOING_TINDERBOX)
344 @rm -f ${FAILFILE}
345 .endif
346 .for target in ${TARGETS}
347 universe: universe_${target}
348 .ORDER: universe_prologue universe_${target} universe_epilogue
349 universe_${target}: universe_${target}_prologue
350 universe_${target}_prologue:
351 @echo ">> ${target} started on `LC_ALL=C date`"
352 .if !defined(MAKE_JUST_KERNELS)
353 .for target_arch in ${TARGET_ARCHES_${target}}
354 universe_${target}: universe_${target}_${target_arch}
355 universe_${target}_${target_arch}: universe_${target}_prologue
356 @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
357 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
358 ${MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
359 TARGET=${target} \
360 TARGET_ARCH=${target_arch} \
361 > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
362 (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
363 "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
364 ${MAKEFAIL}))
365 @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
366 .endfor
367 .endif
368 .if !defined(MAKE_JUST_WORLDS)
369 .if exists(${KERNSRCDIR}/${target}/conf/NOTES)
370 @(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
371 ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
372 (echo "${target} 'make LINT' failed," \
373 "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
374 .endif
375 @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
376 universe_kernels
377 .endif
378 @echo ">> ${target} completed on `LC_ALL=C date`"
379 .endfor
380 universe_kernels: universe_kernconfs
381 .if !defined(TARGET)
382 TARGET!= uname -m
383 .endif
384 KERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \
385 find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
386 ! -name DEFAULTS ! -name NOTES
387 universe_kernconfs:
388 .for kernel in ${KERNCONFS}
389 TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \
390 config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
391 grep -v WARNING: | cut -f 2
392 .if empty(TARGET_ARCH_${kernel})
393 .error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old."
394 .endif
395 universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
396 universe_kernconf_${TARGET}_${kernel}:
397 @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
398 ${MAKE} ${JFLAG} buildkernel \
399 TARGET=${TARGET} \
400 TARGET_ARCH=${TARGET_ARCH_${kernel}} \
401 KERNCONF=${kernel} \
402 > _.${TARGET}.${kernel} 2>&1 || \
403 (echo "${TARGET} ${kernel} kernel failed," \
404 "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
405 .endfor
406 universe: universe_epilogue
407 universe_epilogue:
408 @echo "--------------------------------------------------------------"
409 @echo ">>> make universe completed on `LC_ALL=C date`"
410 @echo " (started ${STARTTIME})"
411 @echo "--------------------------------------------------------------"
412 .if defined(DOING_TINDERBOX)
413 @if [ -e ${FAILFILE} ] ; then \
414 echo "Tinderbox failed:" ;\
415 cat ${FAILFILE} ;\
416 exit 1 ;\
417 fi
418 .endif
419 .endif

Properties

Name Value
cvs2svn:cvs-rev 1.14