Deleted Added
full compact
Makefile.inc1 (142077) Makefile.inc1 (142262)
1#
1#
2# $FreeBSD: head/Makefile.inc1 142077 2005-02-19 10:25:42Z ru $
2# $FreeBSD: head/Makefile.inc1 142262 2005-02-22 23:29:54Z ru $
3#
4# Make command line options:
5# -DNO_DYNAMICROOT do not link /bin and /sbin dynamically
6# -DNO_KERBEROS Do not build Heimdal (Kerberos 5)
7# -DNO_RESCUE do not build rescue binaries
8# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
9# -DNO_CLEAN do not clean at all
10# -DNO_CRYPT will prevent building of crypt versions
11# -DNO_MAN do not build the manual pages
12# -DNO_PROFILE do not build profiled libraries
13# -DNO_GAMES do not go into games subdir
14# -DNO_SHARE do not go into share subdir
15# -DNO_INFO do not make or install info files
16# -DNO_LIBC_R do not build libc_r.
17# -DNO_FORTRAN do not build g77 and related libraries.
18# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
19# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
20# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
21# -DNO_PORTSUPDATE do not update ports in ${MAKE} update
22# -DNO_DOCUPDATE do not update doc in ${MAKE} update
23# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
24# TARGET_ARCH="arch" to crossbuild world to a different arch
25
26#
27# The intended user-driven targets are:
28# buildworld - rebuild *everything*, including glue to help do upgrades
29# installworld- install everything built by "buildworld"
30# update - convenient way to update your source tree (eg: cvsup/cvs)
31#
32# Standard targets (not defined here) are documented in the makefiles in
33# /usr/share/mk. These include:
34# obj depend all install clean cleandepend cleanobj
35
36# We must do share/info early so that installation of info `dir'
37# entries works correctly. Do it first since it is less likely to
38# grow dependencies on include and lib than vice versa.
39#
40# We must do lib and libexec before bin, because if installworld
41# installs a new /bin/sh, the 'make' command will *immediately*
42# use that new version. And the new (dynamically-linked) /bin/sh
43# will expect to find appropriate libraries in /lib and /libexec.
44#
45# We must do etc last for install/distribute to work.
46#
47SUBDIR= share/info include lib libexec bin
48.if !defined(NO_GAMES)
49SUBDIR+=games
50.endif
51SUBDIR+=gnu
52.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
53SUBDIR+=kerberos5
54.endif
55.if !defined(NO_RESCUE)
56SUBDIR+=rescue
57.endif
58SUBDIR+=sbin
59.if !defined(NO_CRYPT)
60SUBDIR+=secure
61.endif
62.if !defined(NO_SHARE)
63SUBDIR+=share
64.endif
65SUBDIR+=sys usr.bin usr.sbin etc
66
67# These are last, since it is nice to at least get the base system
68# rebuilt before you do them.
69.for _DIR in ${LOCAL_DIRS}
70.if exists(${.CURDIR}/${_DIR}/Makefile)
71SUBDIR+= ${_DIR}
72.endif
73.endfor
74
75.if defined(SUBDIR_OVERRIDE)
76SUBDIR= ${SUBDIR_OVERRIDE}
77.endif
78
79.if defined(NO_CLEANDIR)
80CLEANDIR= clean cleandepend
81.else
82CLEANDIR= cleandir
83.endif
84
85CVS?= cvs
86CVSFLAGS?= -A -P -d -I!
87SUP?= /usr/local/bin/cvsup
88SUPFLAGS?= -g -L 2 -P -
89.if defined(SUPHOST)
90SUPFLAGS+= -h ${SUPHOST}
91.endif
92
93MAKEOBJDIRPREFIX?= /usr/obj
94.if !defined(OSRELDATE)
95.if exists(/usr/include/osreldate.h)
96OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
97 /usr/include/osreldate.h
98.else
99OSRELDATE= 0
100.endif
101.endif
102TARGET_ARCH?= ${MACHINE_ARCH}
103.if ${TARGET_ARCH} == ${MACHINE_ARCH}
104TARGET?= ${MACHINE}
105TARGET_CPUTYPE?=${CPUTYPE}
106.else
107TARGET?= ${TARGET_ARCH}
108TARGET_CPUTYPE?=
109.endif
110.if !empty(TARGET_CPUTYPE)
111_TARGET_CPUTYPE=${TARGET_CPUTYPE}
112.else
113_TARGET_CPUTYPE=dummy
114.endif
115_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
116 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
117.if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
118.error CPUTYPE global should be set with ?=.
119.endif
120.if make(buildworld)
121BUILD_ARCH!= sysctl -n hw.machine_arch
122.if ${MACHINE_ARCH} != ${BUILD_ARCH}
123.error To cross-build, set TARGET_ARCH.
124.endif
125.endif
126.if ${MACHINE} == ${TARGET}
127OBJTREE= ${MAKEOBJDIRPREFIX}
128.else
129OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
130.endif
131WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
132# /usr/games added for fortune which depend on strfile
133BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
134XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
135STRICTTMPPATH= ${BPATH}:${XPATH}
136TMPPATH= ${STRICTTMPPATH}:${PATH}
137
138INSTALLTMP!= /usr/bin/mktemp -d -u -t install
139
140#
141# Building a world goes through the following stages
142#
143# 1. legacy stage [BMAKE]
144# This stage is responsible for creating compatibility
145# shims that are needed by the bootstrap-tools,
146# build-tools and cross-tools stages.
147# 1. bootstrap-tools stage [BMAKE]
148# This stage is responsible for creating programs that
149# are needed for backward compatibility reasons. They
150# are not built as cross-tools.
151# 2. build-tools stage [TMAKE]
152# This stage is responsible for creating the object
153# tree and building any tools that are needed during
154# the build process.
155# 3. cross-tools stage [XMAKE]
156# This stage is responsible for creating any tools that
157# are needed for cross-builds. A cross-compiler is one
158# of them.
159# 4. world stage [WMAKE]
160# This stage actually builds the world.
161# 5. install stage (optional) [IMAKE]
162# This stage installs a previously built world.
163#
164
165BOOTSTRAPPING?= 0
166
167# Common environment for world related stages
168CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
169 MACHINE_ARCH=${TARGET_ARCH} \
170 MACHINE=${TARGET} \
171 CPUTYPE=${TARGET_CPUTYPE} \
172 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
173 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
174 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
175
176# bootstrap-tools stage
177BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
178 PATH=${BPATH}:${PATH} \
179 WORLDTMP=${WORLDTMP} \
180 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
181BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
182 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
183 DESTDIR= \
184 BOOTSTRAPPING=${OSRELDATE} \
185 -DNO_HTML -DNO_INFO -DNO_LINT -DNO_MAN -DNO_PIC -DNO_PROFILE \
186 -DNO_SHARED -DNO_CPU_CFLAGS -DNO_WARNS
187
188# build-tools stage
189TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
190 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
191 DESTDIR= \
192 BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS
193
194# cross-tools stage
195XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
196
197# world stage
198WMAKEENV= ${CROSSENV} \
199 _SHLIBDIRPREFIX=${WORLDTMP} \
200 INSTALL="sh ${.CURDIR}/tools/install.sh" \
201 PATH=${TMPPATH}
202WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
203
204.if ${MACHINE_ARCH} == "amd64"
205# 32 bit world
206LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
207
208LIB32PREFLAGS= -m32 -march=athlon-xp -msse2 -mfancy-math-387 -DCOMPAT_32BIT
209LIB32POSTFLAGS= -I${LIB32TMP}/usr/include \
210 -L${LIB32TMP}/usr/lib32 \
211 -B${LIB32TMP}/usr/lib32
212LIB32CC= ${LIB32PREFLAGS} \
213 ${LIB32POSTFLAGS}
214LIB32CXX= ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/c++/3.4 \
215 ${LIB32POSTFLAGS}
216LIB32OBJC= ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/objc \
217 ${LIB32POSTFLAGS}
218
219# Yes, the flags are redundant.
220LIB32MAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
221 _SHLIBDIRPREFIX=${LIB32TMP} \
222 MACHINE_ARCH=i386 \
223 INSTALL="sh ${.CURDIR}/tools/install.sh" \
224 PATH=${TMPPATH} \
225 CC="cc ${LIB32CC}" \
226 CXX="c++ ${LIB32CXX}" \
227 OBJC="cc ${LIB32OBJC}" \
228 LD="ld -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
229 AS="as --32" \
230 LIBDIR=/usr/lib32 \
231 SHLIBDIR=/usr/lib32
232
233LIB32MAKE= ${LIB32MAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
234 -DNO_BIND -DNO_MAN -DNO_INFO -DNO_HTML \
235 CC="cc ${LIB32CC}" \
236 CXX="c++ ${LIB32CXX}" \
237 OBJC="cc ${LIB32OBJC}" \
238 LD="ld -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
239 AS="as --32" \
240 LIBDIR=/usr/lib32 \
241 SHLIBDIR=/usr/lib32
242.endif
243
244# install stage
245.if empty(.MAKEFLAGS:M-n)
246IMAKEENV= ${CROSSENV} \
247 PATH=${STRICTTMPPATH}:${INSTALLTMP}
248.else
249IMAKEENV= ${CROSSENV} \
250 PATH=${TMPPATH}:${INSTALLTMP}
251.endif
252IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
253
254# kernel stage
255KMAKEENV= ${WMAKEENV}
256
257#
258# buildworld
259#
260# Attempt to rebuild the entire system, with reasonable chance of
261# success, regardless of how old your existing system is.
262#
263_worldtmp:
264.if ${.CURDIR:C/[^,]//g} != ""
265# The m4 build of sendmail files doesn't like it if ',' is used
266# anywhere in the path of it's files.
267 @echo
268 @echo "*** Error: path to source tree contains a comma ','"
269 @echo
270 false
271.endif
272 @echo
273 @echo "--------------------------------------------------------------"
274 @echo ">>> Rebuilding the temporary build tree"
275 @echo "--------------------------------------------------------------"
276.if !defined(NO_CLEAN)
277 rm -rf ${WORLDTMP}
278.else
279 rm -rf ${WORLDTMP}/legacy/usr/include
280 # XXX - These two can depend on any header file.
281 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
282 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
283.endif
284.for _dir in \
285 usr/bin usr/games usr/include/c++/3.4 usr/include/sys usr/lib \
286 usr/libexec usr/sbin usr/share/dict \
287 usr/share/groff_font/devX100 \
288 usr/share/groff_font/devX100-12 \
289 usr/share/groff_font/devX75 \
290 usr/share/groff_font/devX75-12 \
291 usr/share/groff_font/devascii \
292 usr/share/groff_font/devcp1047 \
293 usr/share/groff_font/devdvi \
294 usr/share/groff_font/devhtml \
295 usr/share/groff_font/devkoi8-r \
296 usr/share/groff_font/devlatin1 \
297 usr/share/groff_font/devlbp \
298 usr/share/groff_font/devlj4 \
299 usr/share/groff_font/devps \
300 usr/share/groff_font/devutf8 \
301 usr/share/tmac/mdoc usr/share/tmac/mm
302 mkdir -p ${WORLDTMP}/legacy/${_dir}
303.endfor
304.for _dir in \
305 lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
306 usr/libexec usr/sbin usr/share/misc \
307 usr/share/snmp/defs usr/share/snmp/mibs
308 mkdir -p ${WORLDTMP}/${_dir}
309.endfor
310 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
311 -p ${WORLDTMP}/usr/include >/dev/null
312 ln -sf ${.CURDIR}/sys ${WORLDTMP}
313.if defined(WITH_BIND_LIBS) && !defined(NO_BIND)
314 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
315 -p ${WORLDTMP}/usr/include >/dev/null
316.endif
317_legacy:
318 @echo
319 @echo "--------------------------------------------------------------"
320 @echo ">>> stage 1.1: legacy release compatibility shims"
321 @echo "--------------------------------------------------------------"
322 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
323_bootstrap-tools:
324 @echo
325 @echo "--------------------------------------------------------------"
326 @echo ">>> stage 1.2: bootstrap tools"
327 @echo "--------------------------------------------------------------"
328 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
329_cleanobj:
330.if !defined(NO_CLEAN)
331 @echo
332 @echo "--------------------------------------------------------------"
333 @echo ">>> stage 2.1: cleaning up the object tree"
334 @echo "--------------------------------------------------------------"
335 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
336.endif
337_obj:
338 @echo
339 @echo "--------------------------------------------------------------"
340 @echo ">>> stage 2.2: rebuilding the object tree"
341 @echo "--------------------------------------------------------------"
342 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
343_build-tools:
344 @echo
345 @echo "--------------------------------------------------------------"
346 @echo ">>> stage 2.3: build tools"
347 @echo "--------------------------------------------------------------"
348 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
349_cross-tools:
350 @echo
351 @echo "--------------------------------------------------------------"
352 @echo ">>> stage 3: cross tools"
353 @echo "--------------------------------------------------------------"
354 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
355_includes:
356 @echo
357 @echo "--------------------------------------------------------------"
358 @echo ">>> stage 4.1: building includes"
359 @echo "--------------------------------------------------------------"
360 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
361_libraries:
362 @echo
363 @echo "--------------------------------------------------------------"
364 @echo ">>> stage 4.2: building libraries"
365 @echo "--------------------------------------------------------------"
366 ${_+_}cd ${.CURDIR}; \
367 ${WMAKE} -DNO_FSCHG -DNO_HTML -DNO_INFO -DNO_LINT -DNO_MAN -DNO_PROFILE \
368 libraries
369_depend:
370 @echo
371 @echo "--------------------------------------------------------------"
372 @echo ">>> stage 4.3: make dependencies"
373 @echo "--------------------------------------------------------------"
374 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
375everything:
376 @echo
377 @echo "--------------------------------------------------------------"
378 @echo ">>> stage 4.4: building everything"
379 @echo "--------------------------------------------------------------"
380 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
381.if ${MACHINE_ARCH} == "amd64"
382build32:
383 @echo
384 @echo "--------------------------------------------------------------"
385 @echo ">>> stage 5.1: building 32 bit shim libraries"
386 @echo "--------------------------------------------------------------"
387.for _dir in \
388 lib lib32 usr/bin usr/include usr/lib32 usr/libdata/ldscripts \
389 usr/libexec usr/sbin usr/share/misc \
390 usr/share/snmp/defs usr/share/snmp/mibs
391 mkdir -p ${LIB32TMP}/${_dir}
392.endfor
393 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
394 -p ${LIB32TMP}/usr/include >/dev/null
395 ln -sf ${.CURDIR}/sys ${WORLDTMP}
396.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
397.for _t in obj depend all
398 cd ${.CURDIR}/kerberos5/tools; \
399 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} ${_t}
400.endfor
401.endif
402.for _t in obj includes
403 cd ${.CURDIR}/include; \
404 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
405 cd ${.CURDIR}/lib; \
406 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
407 cd ${.CURDIR}/gnu/lib; \
408 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
409.if !defined(NO_CRYPT)
410 cd ${.CURDIR}/secure/lib; \
411 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
412.endif
413.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
414 cd ${.CURDIR}/kerberos5/lib; \
415 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
416.endif
417.endfor
418.for _dir in usr.sbin/pcvt/keycap usr.bin/lex/lib
419 cd ${.CURDIR}/${_dir}; \
420 ${LIB32MAKE} DESTDIR=${LIB32TMP} obj
421.endfor
422.for _dir in lib/libncurses lib/libmagic
423 cd ${.CURDIR}/${_dir}; \
424 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} build-tools
425.endfor
426 cd ${.CURDIR}; \
427 ${LIB32MAKE} -f Makefile.inc1 DESTDIR=${LIB32TMP} libraries
428.for _t in obj depend all
429 cd ${.CURDIR}/libexec/rtld-elf; \
430 PROG=ld-elf32.so.1 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
431.endfor
432
433install32:
434 mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree
435 cd ${.CURDIR}/lib; ${LIB32MAKE} install
436 cd ${.CURDIR}/gnu/lib; ${LIB32MAKE} install
437.if !defined(NO_CRYPT)
438 cd ${.CURDIR}/secure/lib; ${LIB32MAKE} install
439.endif
440 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32MAKE} install
441.endif
442
443
444WMAKE_TGTS=
445.if !defined(SUBDIR_OVERRIDE)
446WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
447.endif
448WMAKE_TGTS+= _cleanobj _obj _build-tools
449.if !defined(SUBDIR_OVERRIDE)
450WMAKE_TGTS+= _cross-tools
451.endif
452WMAKE_TGTS+= _includes _libraries _depend everything
453.if ${MACHINE_ARCH} == "amd64" && defined(WITH_LIB32)
454WMAKE_TGTS+= build32
455.endif
456
457buildworld: ${WMAKE_TGTS}
458.ORDER: ${WMAKE_TGTS}
459
460TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything}
461toolchain: ${TOOLCHAIN_TGTS}
462kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
463
464#
465# Use this to add checks to installworld/installkernel targets.
466#
467SPECIAL_INSTALLCHECKS=
468
469#
470# installcheck
471#
472# Checks to be sure system is ready for installworld
473#
474CHECK_UIDS=
475CHECK_GIDS=
476.if !defined(NO_SENDMAIL)
477CHECK_UIDS+= smmsp
478CHECK_GIDS+= smmsp
479.endif
480.if !defined(NO_PF)
481CHECK_UIDS+= proxy
482CHECK_GIDS+= proxy authpf
483.endif
484installcheck: ${SPECIAL_INSTALLCHECKS}
485.for uid in ${CHECK_UIDS}
486 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
487 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
488 false; \
489 fi
490.endfor
491.for gid in ${CHECK_GIDS}
492 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
493 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
494 false; \
495 fi
496.endfor
497
498#
499# distributeworld
500#
501# Distributes everything compiled by a `buildworld'.
502#
503# installworld
504#
505# Installs everything compiled by a 'buildworld'.
506#
507distributeworld installworld: installcheck
508 mkdir -p ${INSTALLTMP}
509 for prog in [ awk cap_mkdb cat chflags chmod chown \
510 date echo egrep find grep \
511 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
512 test true uname wc zic; do \
513 cp `which $$prog` ${INSTALLTMP}; \
514 done
515 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
516 rm -rf ${INSTALLTMP}
517
518#
519# reinstall
520#
521# If you have a build server, you can NFS mount the source and obj directories
522# and do a 'make reinstall' on the *client* to install new binaries from the
523# most recent server build.
524#
525reinstall: ${SPECIAL_INSTALLCHECKS}
526 @echo "--------------------------------------------------------------"
527 @echo ">>> Making hierarchy"
528 @echo "--------------------------------------------------------------"
529 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
530 @echo
531 @echo "--------------------------------------------------------------"
532 @echo ">>> Installing everything"
533 @echo "--------------------------------------------------------------"
534 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
535.if ${MACHINE_ARCH} == "amd64" && defined(WITH_LIB32)
536 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
537.endif
538
539redistribute:
540 @echo "--------------------------------------------------------------"
541 @echo ">>> Distributing everything"
542 @echo "--------------------------------------------------------------"
543 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
544
545#
546# buildkernel and installkernel
547#
548# Which kernels to build and/or install is specified by setting
549# KERNCONF. If not defined a GENERIC kernel is built/installed.
550# Only the existing (depending TARGET) config files are used
551# for building kernels and only the first of these is designated
552# as the one being installed.
553#
554# Note that we have to use TARGET instead of TARGET_ARCH when
555# we're in kernel-land. Since only TARGET_ARCH is (expected) to
556# be set to cross-build, we have to make sure TARGET is set
557# properly.
558
559.if !defined(KERNCONF) && defined(KERNEL)
560KERNCONF= ${KERNEL}
561KERNWARN=
562.else
563KERNCONF?= GENERIC
564.endif
565INSTKERNNAME?= kernel
566
567KERNSRCDIR?= ${.CURDIR}/sys
568KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
569KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
570KERNCONFDIR?= ${KRNLCONFDIR}
571
572BUILDKERNELS=
573INSTALLKERNEL=
574.for _kernel in ${KERNCONF}
575.if exists(${KERNCONFDIR}/${_kernel})
576BUILDKERNELS+= ${_kernel}
577.if empty(INSTALLKERNEL)
578INSTALLKERNEL= ${_kernel}
579.endif
580.endif
581.endfor
582
583#
584# buildkernel
585#
586# Builds all kernels defined by BUILDKERNELS.
587#
588buildkernel:
589.if empty(BUILDKERNELS)
590 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
591 false
592.endif
593.if defined(KERNWARN)
594 @echo "--------------------------------------------------------------"
595 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
596 @echo "--------------------------------------------------------------"
597 @sleep 3
598.endif
599 @echo
600.for _kernel in ${BUILDKERNELS}
601 @echo "--------------------------------------------------------------"
602 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
603 @echo "--------------------------------------------------------------"
604 @echo "===> ${_kernel}"
605 mkdir -p ${KRNLOBJDIR}
606.if !defined(NO_KERNELCONFIG)
607 @echo
608 @echo "--------------------------------------------------------------"
609 @echo ">>> stage 1: configuring the kernel"
610 @echo "--------------------------------------------------------------"
611 cd ${KRNLCONFDIR}; \
612 PATH=${TMPPATH} \
613 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
614 ${KERNCONFDIR}/${_kernel}
615.endif
616.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
617 @echo
618 @echo "--------------------------------------------------------------"
619 @echo ">>> stage 2.1: cleaning up the object tree"
620 @echo "--------------------------------------------------------------"
621 cd ${KRNLOBJDIR}/${_kernel}; \
622 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
623.endif
624 @echo
625 @echo "--------------------------------------------------------------"
626 @echo ">>> stage 2.2: rebuilding the object tree"
627 @echo "--------------------------------------------------------------"
628 cd ${KRNLOBJDIR}/${_kernel}; \
629 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
630 @echo
631 @echo "--------------------------------------------------------------"
632 @echo ">>> stage 2.3: build tools"
633 @echo "--------------------------------------------------------------"
634 cd ${KRNLOBJDIR}/${_kernel}; \
635 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
636 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
637# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
638.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
639.for target in obj depend all
640 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
641 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
642 ${MAKE} -DNO_CPU_CFLAGS ${target}
643.endfor
644.endif
645.if !defined(NO_KERNELDEPEND)
646 @echo
647 @echo "--------------------------------------------------------------"
648 @echo ">>> stage 3.1: making dependencies"
649 @echo "--------------------------------------------------------------"
650 cd ${KRNLOBJDIR}/${_kernel}; \
651 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
652.endif
653 @echo
654 @echo "--------------------------------------------------------------"
655 @echo ">>> stage 3.2: building everything"
656 @echo "--------------------------------------------------------------"
657 cd ${KRNLOBJDIR}/${_kernel}; \
658 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
659 @echo "--------------------------------------------------------------"
660 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
661 @echo "--------------------------------------------------------------"
662.endfor
663
664#
665# installkernel, etc.
666#
667# Install the kernel defined by INSTALLKERNEL
668#
669installkernel installkernel.debug \
670reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS}
671.if empty(INSTALLKERNEL)
672 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
673 false
674.endif
675 @echo "--------------------------------------------------------------"
676 @echo ">>> Making hierarchy"
677 @echo "--------------------------------------------------------------"
678 cd ${.CURDIR}; \
679 ${CROSSENV} PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 hierarchy
680 @echo
681 @echo "--------------------------------------------------------------"
682 @echo ">>> Installing kernel"
683 @echo "--------------------------------------------------------------"
684 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
685 ${CROSSENV} PATH=${TMPPATH} \
686 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
687
688#
689# update
690#
691# Update the source tree, by running cvsup and/or running cvs to update to the
692# latest copy.
693#
694update:
695.if defined(SUP_UPDATE)
696 @echo "--------------------------------------------------------------"
697 @echo ">>> Running ${SUP}"
698 @echo "--------------------------------------------------------------"
699.if defined(SUPFILE)
700 @${SUP} ${SUPFLAGS} ${SUPFILE}
701.endif
702.if defined(SUPFILE1)
703 @${SUP} ${SUPFLAGS} ${SUPFILE1}
704.endif
705.if defined(SUPFILE2)
706 @${SUP} ${SUPFLAGS} ${SUPFILE2}
707.endif
708.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
709 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
710.endif
711.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
712 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
713.endif
714.endif
715.if defined(CVS_UPDATE)
716 @echo "--------------------------------------------------------------"
717 @echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT}
718 @echo "--------------------------------------------------------------"
719 cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS}
720.endif
721
722#
723# ------------------------------------------------------------------------
724#
725# From here onwards are utility targets used by the 'make world' and
726# related targets. If your 'world' breaks, you may like to try to fix
727# the problem and manually run the following targets to attempt to
728# complete the build. Beware, this is *not* guaranteed to work, you
729# need to have a pretty good grip on the current state of the system
730# to attempt to manually finish it. If in doubt, 'make world' again.
731#
732
733#
734# legacy: Build compatibility shims for the next three targets
735#
736legacy:
737.for _tool in tools/build
738 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
739 cd ${.CURDIR}/${_tool}; \
740 ${MAKE} DIRPRFX=${_tool}/ obj; \
741 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
742 ${MAKE} DIRPRFX=${_tool}/ depend; \
743 ${MAKE} DIRPRFX=${_tool}/ all; \
744 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
745.endfor
746
747#
748# bootstrap-tools: Build tools needed for compatibility
749#
750.if !defined(NO_GAMES)
751_strfile= games/fortune/strfile
752.endif
753
754.if !defined(NO_CXX)
755_gperf= gnu/usr.bin/gperf
756.if ${BOOTSTRAPPING} < 500113
757_groff= gnu/usr.bin/groff
758.else
759_groff= gnu/usr.bin/groff/tmac
760.endif
761.endif
762
3#
4# Make command line options:
5# -DNO_DYNAMICROOT do not link /bin and /sbin dynamically
6# -DNO_KERBEROS Do not build Heimdal (Kerberos 5)
7# -DNO_RESCUE do not build rescue binaries
8# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
9# -DNO_CLEAN do not clean at all
10# -DNO_CRYPT will prevent building of crypt versions
11# -DNO_MAN do not build the manual pages
12# -DNO_PROFILE do not build profiled libraries
13# -DNO_GAMES do not go into games subdir
14# -DNO_SHARE do not go into share subdir
15# -DNO_INFO do not make or install info files
16# -DNO_LIBC_R do not build libc_r.
17# -DNO_FORTRAN do not build g77 and related libraries.
18# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
19# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
20# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
21# -DNO_PORTSUPDATE do not update ports in ${MAKE} update
22# -DNO_DOCUPDATE do not update doc in ${MAKE} update
23# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
24# TARGET_ARCH="arch" to crossbuild world to a different arch
25
26#
27# The intended user-driven targets are:
28# buildworld - rebuild *everything*, including glue to help do upgrades
29# installworld- install everything built by "buildworld"
30# update - convenient way to update your source tree (eg: cvsup/cvs)
31#
32# Standard targets (not defined here) are documented in the makefiles in
33# /usr/share/mk. These include:
34# obj depend all install clean cleandepend cleanobj
35
36# We must do share/info early so that installation of info `dir'
37# entries works correctly. Do it first since it is less likely to
38# grow dependencies on include and lib than vice versa.
39#
40# We must do lib and libexec before bin, because if installworld
41# installs a new /bin/sh, the 'make' command will *immediately*
42# use that new version. And the new (dynamically-linked) /bin/sh
43# will expect to find appropriate libraries in /lib and /libexec.
44#
45# We must do etc last for install/distribute to work.
46#
47SUBDIR= share/info include lib libexec bin
48.if !defined(NO_GAMES)
49SUBDIR+=games
50.endif
51SUBDIR+=gnu
52.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
53SUBDIR+=kerberos5
54.endif
55.if !defined(NO_RESCUE)
56SUBDIR+=rescue
57.endif
58SUBDIR+=sbin
59.if !defined(NO_CRYPT)
60SUBDIR+=secure
61.endif
62.if !defined(NO_SHARE)
63SUBDIR+=share
64.endif
65SUBDIR+=sys usr.bin usr.sbin etc
66
67# These are last, since it is nice to at least get the base system
68# rebuilt before you do them.
69.for _DIR in ${LOCAL_DIRS}
70.if exists(${.CURDIR}/${_DIR}/Makefile)
71SUBDIR+= ${_DIR}
72.endif
73.endfor
74
75.if defined(SUBDIR_OVERRIDE)
76SUBDIR= ${SUBDIR_OVERRIDE}
77.endif
78
79.if defined(NO_CLEANDIR)
80CLEANDIR= clean cleandepend
81.else
82CLEANDIR= cleandir
83.endif
84
85CVS?= cvs
86CVSFLAGS?= -A -P -d -I!
87SUP?= /usr/local/bin/cvsup
88SUPFLAGS?= -g -L 2 -P -
89.if defined(SUPHOST)
90SUPFLAGS+= -h ${SUPHOST}
91.endif
92
93MAKEOBJDIRPREFIX?= /usr/obj
94.if !defined(OSRELDATE)
95.if exists(/usr/include/osreldate.h)
96OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
97 /usr/include/osreldate.h
98.else
99OSRELDATE= 0
100.endif
101.endif
102TARGET_ARCH?= ${MACHINE_ARCH}
103.if ${TARGET_ARCH} == ${MACHINE_ARCH}
104TARGET?= ${MACHINE}
105TARGET_CPUTYPE?=${CPUTYPE}
106.else
107TARGET?= ${TARGET_ARCH}
108TARGET_CPUTYPE?=
109.endif
110.if !empty(TARGET_CPUTYPE)
111_TARGET_CPUTYPE=${TARGET_CPUTYPE}
112.else
113_TARGET_CPUTYPE=dummy
114.endif
115_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
116 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
117.if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
118.error CPUTYPE global should be set with ?=.
119.endif
120.if make(buildworld)
121BUILD_ARCH!= sysctl -n hw.machine_arch
122.if ${MACHINE_ARCH} != ${BUILD_ARCH}
123.error To cross-build, set TARGET_ARCH.
124.endif
125.endif
126.if ${MACHINE} == ${TARGET}
127OBJTREE= ${MAKEOBJDIRPREFIX}
128.else
129OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
130.endif
131WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
132# /usr/games added for fortune which depend on strfile
133BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
134XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
135STRICTTMPPATH= ${BPATH}:${XPATH}
136TMPPATH= ${STRICTTMPPATH}:${PATH}
137
138INSTALLTMP!= /usr/bin/mktemp -d -u -t install
139
140#
141# Building a world goes through the following stages
142#
143# 1. legacy stage [BMAKE]
144# This stage is responsible for creating compatibility
145# shims that are needed by the bootstrap-tools,
146# build-tools and cross-tools stages.
147# 1. bootstrap-tools stage [BMAKE]
148# This stage is responsible for creating programs that
149# are needed for backward compatibility reasons. They
150# are not built as cross-tools.
151# 2. build-tools stage [TMAKE]
152# This stage is responsible for creating the object
153# tree and building any tools that are needed during
154# the build process.
155# 3. cross-tools stage [XMAKE]
156# This stage is responsible for creating any tools that
157# are needed for cross-builds. A cross-compiler is one
158# of them.
159# 4. world stage [WMAKE]
160# This stage actually builds the world.
161# 5. install stage (optional) [IMAKE]
162# This stage installs a previously built world.
163#
164
165BOOTSTRAPPING?= 0
166
167# Common environment for world related stages
168CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
169 MACHINE_ARCH=${TARGET_ARCH} \
170 MACHINE=${TARGET} \
171 CPUTYPE=${TARGET_CPUTYPE} \
172 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
173 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
174 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
175
176# bootstrap-tools stage
177BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
178 PATH=${BPATH}:${PATH} \
179 WORLDTMP=${WORLDTMP} \
180 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
181BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
182 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
183 DESTDIR= \
184 BOOTSTRAPPING=${OSRELDATE} \
185 -DNO_HTML -DNO_INFO -DNO_LINT -DNO_MAN -DNO_PIC -DNO_PROFILE \
186 -DNO_SHARED -DNO_CPU_CFLAGS -DNO_WARNS
187
188# build-tools stage
189TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
190 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
191 DESTDIR= \
192 BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS
193
194# cross-tools stage
195XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
196
197# world stage
198WMAKEENV= ${CROSSENV} \
199 _SHLIBDIRPREFIX=${WORLDTMP} \
200 INSTALL="sh ${.CURDIR}/tools/install.sh" \
201 PATH=${TMPPATH}
202WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
203
204.if ${MACHINE_ARCH} == "amd64"
205# 32 bit world
206LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
207
208LIB32PREFLAGS= -m32 -march=athlon-xp -msse2 -mfancy-math-387 -DCOMPAT_32BIT
209LIB32POSTFLAGS= -I${LIB32TMP}/usr/include \
210 -L${LIB32TMP}/usr/lib32 \
211 -B${LIB32TMP}/usr/lib32
212LIB32CC= ${LIB32PREFLAGS} \
213 ${LIB32POSTFLAGS}
214LIB32CXX= ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/c++/3.4 \
215 ${LIB32POSTFLAGS}
216LIB32OBJC= ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/objc \
217 ${LIB32POSTFLAGS}
218
219# Yes, the flags are redundant.
220LIB32MAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
221 _SHLIBDIRPREFIX=${LIB32TMP} \
222 MACHINE_ARCH=i386 \
223 INSTALL="sh ${.CURDIR}/tools/install.sh" \
224 PATH=${TMPPATH} \
225 CC="cc ${LIB32CC}" \
226 CXX="c++ ${LIB32CXX}" \
227 OBJC="cc ${LIB32OBJC}" \
228 LD="ld -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
229 AS="as --32" \
230 LIBDIR=/usr/lib32 \
231 SHLIBDIR=/usr/lib32
232
233LIB32MAKE= ${LIB32MAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
234 -DNO_BIND -DNO_MAN -DNO_INFO -DNO_HTML \
235 CC="cc ${LIB32CC}" \
236 CXX="c++ ${LIB32CXX}" \
237 OBJC="cc ${LIB32OBJC}" \
238 LD="ld -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
239 AS="as --32" \
240 LIBDIR=/usr/lib32 \
241 SHLIBDIR=/usr/lib32
242.endif
243
244# install stage
245.if empty(.MAKEFLAGS:M-n)
246IMAKEENV= ${CROSSENV} \
247 PATH=${STRICTTMPPATH}:${INSTALLTMP}
248.else
249IMAKEENV= ${CROSSENV} \
250 PATH=${TMPPATH}:${INSTALLTMP}
251.endif
252IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
253
254# kernel stage
255KMAKEENV= ${WMAKEENV}
256
257#
258# buildworld
259#
260# Attempt to rebuild the entire system, with reasonable chance of
261# success, regardless of how old your existing system is.
262#
263_worldtmp:
264.if ${.CURDIR:C/[^,]//g} != ""
265# The m4 build of sendmail files doesn't like it if ',' is used
266# anywhere in the path of it's files.
267 @echo
268 @echo "*** Error: path to source tree contains a comma ','"
269 @echo
270 false
271.endif
272 @echo
273 @echo "--------------------------------------------------------------"
274 @echo ">>> Rebuilding the temporary build tree"
275 @echo "--------------------------------------------------------------"
276.if !defined(NO_CLEAN)
277 rm -rf ${WORLDTMP}
278.else
279 rm -rf ${WORLDTMP}/legacy/usr/include
280 # XXX - These two can depend on any header file.
281 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
282 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
283.endif
284.for _dir in \
285 usr/bin usr/games usr/include/c++/3.4 usr/include/sys usr/lib \
286 usr/libexec usr/sbin usr/share/dict \
287 usr/share/groff_font/devX100 \
288 usr/share/groff_font/devX100-12 \
289 usr/share/groff_font/devX75 \
290 usr/share/groff_font/devX75-12 \
291 usr/share/groff_font/devascii \
292 usr/share/groff_font/devcp1047 \
293 usr/share/groff_font/devdvi \
294 usr/share/groff_font/devhtml \
295 usr/share/groff_font/devkoi8-r \
296 usr/share/groff_font/devlatin1 \
297 usr/share/groff_font/devlbp \
298 usr/share/groff_font/devlj4 \
299 usr/share/groff_font/devps \
300 usr/share/groff_font/devutf8 \
301 usr/share/tmac/mdoc usr/share/tmac/mm
302 mkdir -p ${WORLDTMP}/legacy/${_dir}
303.endfor
304.for _dir in \
305 lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
306 usr/libexec usr/sbin usr/share/misc \
307 usr/share/snmp/defs usr/share/snmp/mibs
308 mkdir -p ${WORLDTMP}/${_dir}
309.endfor
310 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
311 -p ${WORLDTMP}/usr/include >/dev/null
312 ln -sf ${.CURDIR}/sys ${WORLDTMP}
313.if defined(WITH_BIND_LIBS) && !defined(NO_BIND)
314 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
315 -p ${WORLDTMP}/usr/include >/dev/null
316.endif
317_legacy:
318 @echo
319 @echo "--------------------------------------------------------------"
320 @echo ">>> stage 1.1: legacy release compatibility shims"
321 @echo "--------------------------------------------------------------"
322 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
323_bootstrap-tools:
324 @echo
325 @echo "--------------------------------------------------------------"
326 @echo ">>> stage 1.2: bootstrap tools"
327 @echo "--------------------------------------------------------------"
328 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
329_cleanobj:
330.if !defined(NO_CLEAN)
331 @echo
332 @echo "--------------------------------------------------------------"
333 @echo ">>> stage 2.1: cleaning up the object tree"
334 @echo "--------------------------------------------------------------"
335 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
336.endif
337_obj:
338 @echo
339 @echo "--------------------------------------------------------------"
340 @echo ">>> stage 2.2: rebuilding the object tree"
341 @echo "--------------------------------------------------------------"
342 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
343_build-tools:
344 @echo
345 @echo "--------------------------------------------------------------"
346 @echo ">>> stage 2.3: build tools"
347 @echo "--------------------------------------------------------------"
348 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
349_cross-tools:
350 @echo
351 @echo "--------------------------------------------------------------"
352 @echo ">>> stage 3: cross tools"
353 @echo "--------------------------------------------------------------"
354 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
355_includes:
356 @echo
357 @echo "--------------------------------------------------------------"
358 @echo ">>> stage 4.1: building includes"
359 @echo "--------------------------------------------------------------"
360 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
361_libraries:
362 @echo
363 @echo "--------------------------------------------------------------"
364 @echo ">>> stage 4.2: building libraries"
365 @echo "--------------------------------------------------------------"
366 ${_+_}cd ${.CURDIR}; \
367 ${WMAKE} -DNO_FSCHG -DNO_HTML -DNO_INFO -DNO_LINT -DNO_MAN -DNO_PROFILE \
368 libraries
369_depend:
370 @echo
371 @echo "--------------------------------------------------------------"
372 @echo ">>> stage 4.3: make dependencies"
373 @echo "--------------------------------------------------------------"
374 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
375everything:
376 @echo
377 @echo "--------------------------------------------------------------"
378 @echo ">>> stage 4.4: building everything"
379 @echo "--------------------------------------------------------------"
380 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
381.if ${MACHINE_ARCH} == "amd64"
382build32:
383 @echo
384 @echo "--------------------------------------------------------------"
385 @echo ">>> stage 5.1: building 32 bit shim libraries"
386 @echo "--------------------------------------------------------------"
387.for _dir in \
388 lib lib32 usr/bin usr/include usr/lib32 usr/libdata/ldscripts \
389 usr/libexec usr/sbin usr/share/misc \
390 usr/share/snmp/defs usr/share/snmp/mibs
391 mkdir -p ${LIB32TMP}/${_dir}
392.endfor
393 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
394 -p ${LIB32TMP}/usr/include >/dev/null
395 ln -sf ${.CURDIR}/sys ${WORLDTMP}
396.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
397.for _t in obj depend all
398 cd ${.CURDIR}/kerberos5/tools; \
399 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} ${_t}
400.endfor
401.endif
402.for _t in obj includes
403 cd ${.CURDIR}/include; \
404 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
405 cd ${.CURDIR}/lib; \
406 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
407 cd ${.CURDIR}/gnu/lib; \
408 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
409.if !defined(NO_CRYPT)
410 cd ${.CURDIR}/secure/lib; \
411 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
412.endif
413.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
414 cd ${.CURDIR}/kerberos5/lib; \
415 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
416.endif
417.endfor
418.for _dir in usr.sbin/pcvt/keycap usr.bin/lex/lib
419 cd ${.CURDIR}/${_dir}; \
420 ${LIB32MAKE} DESTDIR=${LIB32TMP} obj
421.endfor
422.for _dir in lib/libncurses lib/libmagic
423 cd ${.CURDIR}/${_dir}; \
424 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} build-tools
425.endfor
426 cd ${.CURDIR}; \
427 ${LIB32MAKE} -f Makefile.inc1 DESTDIR=${LIB32TMP} libraries
428.for _t in obj depend all
429 cd ${.CURDIR}/libexec/rtld-elf; \
430 PROG=ld-elf32.so.1 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
431.endfor
432
433install32:
434 mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree
435 cd ${.CURDIR}/lib; ${LIB32MAKE} install
436 cd ${.CURDIR}/gnu/lib; ${LIB32MAKE} install
437.if !defined(NO_CRYPT)
438 cd ${.CURDIR}/secure/lib; ${LIB32MAKE} install
439.endif
440 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32MAKE} install
441.endif
442
443
444WMAKE_TGTS=
445.if !defined(SUBDIR_OVERRIDE)
446WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
447.endif
448WMAKE_TGTS+= _cleanobj _obj _build-tools
449.if !defined(SUBDIR_OVERRIDE)
450WMAKE_TGTS+= _cross-tools
451.endif
452WMAKE_TGTS+= _includes _libraries _depend everything
453.if ${MACHINE_ARCH} == "amd64" && defined(WITH_LIB32)
454WMAKE_TGTS+= build32
455.endif
456
457buildworld: ${WMAKE_TGTS}
458.ORDER: ${WMAKE_TGTS}
459
460TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything}
461toolchain: ${TOOLCHAIN_TGTS}
462kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
463
464#
465# Use this to add checks to installworld/installkernel targets.
466#
467SPECIAL_INSTALLCHECKS=
468
469#
470# installcheck
471#
472# Checks to be sure system is ready for installworld
473#
474CHECK_UIDS=
475CHECK_GIDS=
476.if !defined(NO_SENDMAIL)
477CHECK_UIDS+= smmsp
478CHECK_GIDS+= smmsp
479.endif
480.if !defined(NO_PF)
481CHECK_UIDS+= proxy
482CHECK_GIDS+= proxy authpf
483.endif
484installcheck: ${SPECIAL_INSTALLCHECKS}
485.for uid in ${CHECK_UIDS}
486 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
487 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
488 false; \
489 fi
490.endfor
491.for gid in ${CHECK_GIDS}
492 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
493 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
494 false; \
495 fi
496.endfor
497
498#
499# distributeworld
500#
501# Distributes everything compiled by a `buildworld'.
502#
503# installworld
504#
505# Installs everything compiled by a 'buildworld'.
506#
507distributeworld installworld: installcheck
508 mkdir -p ${INSTALLTMP}
509 for prog in [ awk cap_mkdb cat chflags chmod chown \
510 date echo egrep find grep \
511 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
512 test true uname wc zic; do \
513 cp `which $$prog` ${INSTALLTMP}; \
514 done
515 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
516 rm -rf ${INSTALLTMP}
517
518#
519# reinstall
520#
521# If you have a build server, you can NFS mount the source and obj directories
522# and do a 'make reinstall' on the *client* to install new binaries from the
523# most recent server build.
524#
525reinstall: ${SPECIAL_INSTALLCHECKS}
526 @echo "--------------------------------------------------------------"
527 @echo ">>> Making hierarchy"
528 @echo "--------------------------------------------------------------"
529 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
530 @echo
531 @echo "--------------------------------------------------------------"
532 @echo ">>> Installing everything"
533 @echo "--------------------------------------------------------------"
534 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
535.if ${MACHINE_ARCH} == "amd64" && defined(WITH_LIB32)
536 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
537.endif
538
539redistribute:
540 @echo "--------------------------------------------------------------"
541 @echo ">>> Distributing everything"
542 @echo "--------------------------------------------------------------"
543 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
544
545#
546# buildkernel and installkernel
547#
548# Which kernels to build and/or install is specified by setting
549# KERNCONF. If not defined a GENERIC kernel is built/installed.
550# Only the existing (depending TARGET) config files are used
551# for building kernels and only the first of these is designated
552# as the one being installed.
553#
554# Note that we have to use TARGET instead of TARGET_ARCH when
555# we're in kernel-land. Since only TARGET_ARCH is (expected) to
556# be set to cross-build, we have to make sure TARGET is set
557# properly.
558
559.if !defined(KERNCONF) && defined(KERNEL)
560KERNCONF= ${KERNEL}
561KERNWARN=
562.else
563KERNCONF?= GENERIC
564.endif
565INSTKERNNAME?= kernel
566
567KERNSRCDIR?= ${.CURDIR}/sys
568KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
569KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
570KERNCONFDIR?= ${KRNLCONFDIR}
571
572BUILDKERNELS=
573INSTALLKERNEL=
574.for _kernel in ${KERNCONF}
575.if exists(${KERNCONFDIR}/${_kernel})
576BUILDKERNELS+= ${_kernel}
577.if empty(INSTALLKERNEL)
578INSTALLKERNEL= ${_kernel}
579.endif
580.endif
581.endfor
582
583#
584# buildkernel
585#
586# Builds all kernels defined by BUILDKERNELS.
587#
588buildkernel:
589.if empty(BUILDKERNELS)
590 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
591 false
592.endif
593.if defined(KERNWARN)
594 @echo "--------------------------------------------------------------"
595 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
596 @echo "--------------------------------------------------------------"
597 @sleep 3
598.endif
599 @echo
600.for _kernel in ${BUILDKERNELS}
601 @echo "--------------------------------------------------------------"
602 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
603 @echo "--------------------------------------------------------------"
604 @echo "===> ${_kernel}"
605 mkdir -p ${KRNLOBJDIR}
606.if !defined(NO_KERNELCONFIG)
607 @echo
608 @echo "--------------------------------------------------------------"
609 @echo ">>> stage 1: configuring the kernel"
610 @echo "--------------------------------------------------------------"
611 cd ${KRNLCONFDIR}; \
612 PATH=${TMPPATH} \
613 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
614 ${KERNCONFDIR}/${_kernel}
615.endif
616.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
617 @echo
618 @echo "--------------------------------------------------------------"
619 @echo ">>> stage 2.1: cleaning up the object tree"
620 @echo "--------------------------------------------------------------"
621 cd ${KRNLOBJDIR}/${_kernel}; \
622 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
623.endif
624 @echo
625 @echo "--------------------------------------------------------------"
626 @echo ">>> stage 2.2: rebuilding the object tree"
627 @echo "--------------------------------------------------------------"
628 cd ${KRNLOBJDIR}/${_kernel}; \
629 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
630 @echo
631 @echo "--------------------------------------------------------------"
632 @echo ">>> stage 2.3: build tools"
633 @echo "--------------------------------------------------------------"
634 cd ${KRNLOBJDIR}/${_kernel}; \
635 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
636 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
637# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
638.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
639.for target in obj depend all
640 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
641 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
642 ${MAKE} -DNO_CPU_CFLAGS ${target}
643.endfor
644.endif
645.if !defined(NO_KERNELDEPEND)
646 @echo
647 @echo "--------------------------------------------------------------"
648 @echo ">>> stage 3.1: making dependencies"
649 @echo "--------------------------------------------------------------"
650 cd ${KRNLOBJDIR}/${_kernel}; \
651 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
652.endif
653 @echo
654 @echo "--------------------------------------------------------------"
655 @echo ">>> stage 3.2: building everything"
656 @echo "--------------------------------------------------------------"
657 cd ${KRNLOBJDIR}/${_kernel}; \
658 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
659 @echo "--------------------------------------------------------------"
660 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
661 @echo "--------------------------------------------------------------"
662.endfor
663
664#
665# installkernel, etc.
666#
667# Install the kernel defined by INSTALLKERNEL
668#
669installkernel installkernel.debug \
670reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS}
671.if empty(INSTALLKERNEL)
672 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
673 false
674.endif
675 @echo "--------------------------------------------------------------"
676 @echo ">>> Making hierarchy"
677 @echo "--------------------------------------------------------------"
678 cd ${.CURDIR}; \
679 ${CROSSENV} PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 hierarchy
680 @echo
681 @echo "--------------------------------------------------------------"
682 @echo ">>> Installing kernel"
683 @echo "--------------------------------------------------------------"
684 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
685 ${CROSSENV} PATH=${TMPPATH} \
686 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
687
688#
689# update
690#
691# Update the source tree, by running cvsup and/or running cvs to update to the
692# latest copy.
693#
694update:
695.if defined(SUP_UPDATE)
696 @echo "--------------------------------------------------------------"
697 @echo ">>> Running ${SUP}"
698 @echo "--------------------------------------------------------------"
699.if defined(SUPFILE)
700 @${SUP} ${SUPFLAGS} ${SUPFILE}
701.endif
702.if defined(SUPFILE1)
703 @${SUP} ${SUPFLAGS} ${SUPFILE1}
704.endif
705.if defined(SUPFILE2)
706 @${SUP} ${SUPFLAGS} ${SUPFILE2}
707.endif
708.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
709 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
710.endif
711.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
712 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
713.endif
714.endif
715.if defined(CVS_UPDATE)
716 @echo "--------------------------------------------------------------"
717 @echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT}
718 @echo "--------------------------------------------------------------"
719 cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS}
720.endif
721
722#
723# ------------------------------------------------------------------------
724#
725# From here onwards are utility targets used by the 'make world' and
726# related targets. If your 'world' breaks, you may like to try to fix
727# the problem and manually run the following targets to attempt to
728# complete the build. Beware, this is *not* guaranteed to work, you
729# need to have a pretty good grip on the current state of the system
730# to attempt to manually finish it. If in doubt, 'make world' again.
731#
732
733#
734# legacy: Build compatibility shims for the next three targets
735#
736legacy:
737.for _tool in tools/build
738 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
739 cd ${.CURDIR}/${_tool}; \
740 ${MAKE} DIRPRFX=${_tool}/ obj; \
741 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
742 ${MAKE} DIRPRFX=${_tool}/ depend; \
743 ${MAKE} DIRPRFX=${_tool}/ all; \
744 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
745.endfor
746
747#
748# bootstrap-tools: Build tools needed for compatibility
749#
750.if !defined(NO_GAMES)
751_strfile= games/fortune/strfile
752.endif
753
754.if !defined(NO_CXX)
755_gperf= gnu/usr.bin/gperf
756.if ${BOOTSTRAPPING} < 500113
757_groff= gnu/usr.bin/groff
758.else
759_groff= gnu/usr.bin/groff/tmac
760.endif
761.endif
762
763.if ${BOOTSTRAPPING} < 600015
764_cap_mkdb= usr.bin/cap_mkdb
765.endif
766
763.if ${BOOTSTRAPPING} < 502102
764_lex= usr.bin/lex
765.endif
766
767.if ${BOOTSTRAPPING} < 450005 || \
768 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034
769_uudecode= usr.bin/uudecode
770.endif
771
772.if ${BOOTSTRAPPING} < 430002 || \
773 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019
774_xargs= usr.bin/xargs
775.endif
776
777.if ${BOOTSTRAPPING} < 430002 || \
778 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018
779_yacc= usr.bin/yacc
780.endif
781
782.if !defined(NO_RESCUE) && \
783 ${BOOTSTRAPPING} < 600008
784_crunchgen= usr.sbin/crunch/crunchgen
785.endif
786
787.if ${BOOTSTRAPPING} < 502128
788_gensnmptree= usr.sbin/bsnmpd/gensnmptree
789.endif
790
791.if ${BOOTSTRAPPING} < 500019
792_kbdcontrol= usr.sbin/kbdcontrol
793.endif
794
795bootstrap-tools:
796.for _tool in \
797 ${_strfile} \
798 ${_gperf} \
799 ${_groff} \
800 gnu/usr.bin/texinfo \
767.if ${BOOTSTRAPPING} < 502102
768_lex= usr.bin/lex
769.endif
770
771.if ${BOOTSTRAPPING} < 450005 || \
772 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034
773_uudecode= usr.bin/uudecode
774.endif
775
776.if ${BOOTSTRAPPING} < 430002 || \
777 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019
778_xargs= usr.bin/xargs
779.endif
780
781.if ${BOOTSTRAPPING} < 430002 || \
782 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018
783_yacc= usr.bin/yacc
784.endif
785
786.if !defined(NO_RESCUE) && \
787 ${BOOTSTRAPPING} < 600008
788_crunchgen= usr.sbin/crunch/crunchgen
789.endif
790
791.if ${BOOTSTRAPPING} < 502128
792_gensnmptree= usr.sbin/bsnmpd/gensnmptree
793.endif
794
795.if ${BOOTSTRAPPING} < 500019
796_kbdcontrol= usr.sbin/kbdcontrol
797.endif
798
799bootstrap-tools:
800.for _tool in \
801 ${_strfile} \
802 ${_gperf} \
803 ${_groff} \
804 gnu/usr.bin/texinfo \
805 ${_cap_mkdb} \
801 usr.bin/colldef \
802 ${_lex} \
803 usr.bin/lorder \
804 usr.bin/makewhatis \
805 usr.bin/rpcgen \
806 ${_uudecode} \
807 ${_xargs} \
808 usr.bin/xinstall \
809 ${_yacc} \
810 usr.sbin/config \
811 ${_crunchgen} \
812 ${_gensnmptree} \
813 ${_kbdcontrol}
814 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
815 cd ${.CURDIR}/${_tool}; \
816 ${MAKE} DIRPRFX=${_tool}/ obj; \
817 ${MAKE} DIRPRFX=${_tool}/ depend; \
818 ${MAKE} DIRPRFX=${_tool}/ all; \
819 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
820.endfor
821
822#
823# build-tools: Build special purpose build tools
824#
825.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
826_aicasm= sys/modules/aic7xxx/aicasm
827.endif
828
829.if !defined(NO_SHARE)
830_share= share/syscons/scrnmaps
831.endif
832
833.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
834_kerberos5_tools= kerberos5/tools
835.endif
836
837.if !defined(NO_RESCUE)
838_rescue= rescue/rescue
839.endif
840
841build-tools:
842.for _tool in \
843 bin/csh \
844 bin/sh \
845 ${_rescue} \
846 lib/libncurses \
847 ${_share} \
848 ${_aicasm} \
849 usr.bin/awk \
850 lib/libmagic \
851 usr.sbin/sysinstall
852 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
853 cd ${.CURDIR}/${_tool}; \
854 ${MAKE} DIRPRFX=${_tool}/ obj; \
855 ${MAKE} DIRPRFX=${_tool}/ build-tools
856.endfor
857.for _tool in \
858 gnu/usr.bin/cc/cc_tools \
859 ${_kerberos5_tools}
860 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
861 cd ${.CURDIR}/${_tool}; \
862 ${MAKE} DIRPRFX=${_tool}/ obj; \
863 ${MAKE} DIRPRFX=${_tool}/ depend; \
864 ${MAKE} DIRPRFX=${_tool}/ all
865.endfor
866
867#
868# cross-tools: Build cross-building tools
869#
870.if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
871 ${BOOTSTRAPPING} < 500037
872_elf2aout= usr.bin/elf2aout
873.endif
874
875.if (${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386") && \
876 ${TARGET_ARCH} != ${MACHINE_ARCH}
877_btxld= usr.sbin/btxld
878.endif
879
880.if (!defined(NO_RESCUE) || \
881 defined(RELEASEDIR)) && \
882 (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101)
883_crunchide= usr.sbin/crunch/crunchide
884.endif
885
886.if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
887_elf2exe= usr.sbin/elf2exe
888.endif
889
890.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
891 defined(RELEASEDIR)
892_kgzip= usr.sbin/kgzip
893.endif
894
895cross-tools:
896.for _tool in \
897 gnu/usr.bin/binutils \
898 gnu/usr.bin/cc \
899 ${_elf2aout} \
900 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
901 ${_btxld} \
902 ${_crunchide} \
903 ${_elf2exe} \
904 ${_kgzip}
905 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
906 cd ${.CURDIR}/${_tool}; \
907 ${MAKE} DIRPRFX=${_tool}/ obj; \
908 ${MAKE} DIRPRFX=${_tool}/ depend; \
909 ${MAKE} DIRPRFX=${_tool}/ all; \
910 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
911.endfor
912
913#
914# hierarchy - ensure that all the needed directories are present
915#
916hierarchy:
917 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
918
919#
920# libraries - build all libraries, and install them under ${DESTDIR}.
921#
922# The list of libraries with dependents (${_prebuild_libs}) and their
923# interdependencies (__L) are built automatically by the
924# ${.CURDIR}/tools/make_libdeps.sh script.
925#
926libraries:
927 cd ${.CURDIR}; \
928 ${MAKE} -f Makefile.inc1 _startup_libs; \
929 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
930 ${MAKE} -f Makefile.inc1 _generic_libs;
931
932# These dependencies are not automatically generated:
933#
934# gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
935# shared libraries for ELF.
936#
937_startup_libs= gnu/lib/csu gnu/lib/libgcc
938.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
939_startup_libs+= lib/csu/${MACHINE_ARCH}-elf
940.else
941_startup_libs+= lib/csu/${MACHINE_ARCH}
942.endif
943
944_prebuild_libs=
945
946_generic_libs= gnu/lib
947
948.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
949_prebuild_libs+= kerberos5/lib/libasn1
950_prebuild_libs+= kerberos5/lib/libgssapi
951_prebuild_libs+= kerberos5/lib/libkrb5
952_prebuild_libs+= kerberos5/lib/libroken
953_generic_libs+= kerberos5/lib
954.endif
955
956_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
957 lib/libkvm lib/libmd \
958 lib/libncurses lib/libnetgraph lib/libopie lib/libpam \
959 lib/libradius \
960 lib/libsbuf lib/libtacplus lib/libutil \
961 lib/libz lib/msun
962
963lib/libopie__L lib/libtacplus__L: lib/libmd__L
964
965.if !defined(NO_BIND)
966.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64"
967_prebuild_libs+= lib/libc_r
968.else
969_prebuild_libs+= lib/libpthread
970.endif
971.endif
972
973_generic_libs+= lib
974
975.if !defined(NO_CRYPT)
976.if !defined(NO_OPENSSL)
977_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
978lib/libradius__L: secure/lib/libssl__L
979secure/lib/libssl__L: secure/lib/libcrypto__L
980.if !defined(NO_OPENSSH)
981_prebuild_libs+= secure/lib/libssh
982secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
983.if !defined(NO_KERBEROS)
984secure/lib/libssh__L: kerberos5/lib/libgssapi__L kerberos5/lib/libkrb5__L \
985 kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \
986 kerberos5/lib/libroken__L
987.endif
988.endif
989.endif
990_generic_libs+= secure/lib
991.endif
992
993.if defined(NO_CRYPT) || defined(NO_OPENSSL)
994lib/libradius__L: lib/libmd__L
995.endif
996
997.if !defined(NO_NIS)
998_prebuild_libs+= lib/libypclnt
999.endif
1000
1001_generic_libs+= usr.bin/lex/lib
1002
1003.if ${MACHINE_ARCH} == "i386"
1004_generic_libs+= usr.sbin/pcvt/keycap
1005.endif
1006
1007.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1008${_lib}__L: .PHONY
1009.if exists(${.CURDIR}/${_lib})
1010 ${_+_}@${ECHODIR} "===> ${_lib} (depend,all,install)"; \
1011 cd ${.CURDIR}/${_lib}; \
1012 ${MAKE} DIRPRFX=${_lib}/ depend; \
1013 ${MAKE} DIRPRFX=${_lib}/ all; \
1014 ${MAKE} DIRPRFX=${_lib}/ install
1015.endif
1016.endfor
1017
1018# libpam is special: we need to build static PAM modules before
1019# static PAM library, and dynamic PAM library before dynamic PAM
1020# modules.
1021lib/libpam__L: .PHONY
1022 ${_+_}@${ECHODIR} "===> lib/libpam (depend,all,install)"; \
1023 cd ${.CURDIR}/lib/libpam; \
1024 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1025 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1026 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1027
1028_startup_libs: ${_startup_libs:S/$/__L/}
1029_prebuild_libs: ${_prebuild_libs:S/$/__L/}
1030_generic_libs: ${_generic_libs:S/$/__L/}
1031
1032.for __target in all clean cleandepend cleandir depend includes obj
1033.for entry in ${SUBDIR}
1034${entry}.${__target}__D: .PHONY
1035 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1036 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1037 edir=${entry}.${MACHINE_ARCH}; \
1038 cd ${.CURDIR}/$${edir}; \
1039 else \
1040 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1041 edir=${entry}; \
1042 cd ${.CURDIR}/$${edir}; \
1043 fi; \
1044 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1045.endfor
1046par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1047.endfor
1048
1049.include <bsd.subdir.mk>
806 usr.bin/colldef \
807 ${_lex} \
808 usr.bin/lorder \
809 usr.bin/makewhatis \
810 usr.bin/rpcgen \
811 ${_uudecode} \
812 ${_xargs} \
813 usr.bin/xinstall \
814 ${_yacc} \
815 usr.sbin/config \
816 ${_crunchgen} \
817 ${_gensnmptree} \
818 ${_kbdcontrol}
819 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
820 cd ${.CURDIR}/${_tool}; \
821 ${MAKE} DIRPRFX=${_tool}/ obj; \
822 ${MAKE} DIRPRFX=${_tool}/ depend; \
823 ${MAKE} DIRPRFX=${_tool}/ all; \
824 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
825.endfor
826
827#
828# build-tools: Build special purpose build tools
829#
830.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
831_aicasm= sys/modules/aic7xxx/aicasm
832.endif
833
834.if !defined(NO_SHARE)
835_share= share/syscons/scrnmaps
836.endif
837
838.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
839_kerberos5_tools= kerberos5/tools
840.endif
841
842.if !defined(NO_RESCUE)
843_rescue= rescue/rescue
844.endif
845
846build-tools:
847.for _tool in \
848 bin/csh \
849 bin/sh \
850 ${_rescue} \
851 lib/libncurses \
852 ${_share} \
853 ${_aicasm} \
854 usr.bin/awk \
855 lib/libmagic \
856 usr.sbin/sysinstall
857 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
858 cd ${.CURDIR}/${_tool}; \
859 ${MAKE} DIRPRFX=${_tool}/ obj; \
860 ${MAKE} DIRPRFX=${_tool}/ build-tools
861.endfor
862.for _tool in \
863 gnu/usr.bin/cc/cc_tools \
864 ${_kerberos5_tools}
865 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
866 cd ${.CURDIR}/${_tool}; \
867 ${MAKE} DIRPRFX=${_tool}/ obj; \
868 ${MAKE} DIRPRFX=${_tool}/ depend; \
869 ${MAKE} DIRPRFX=${_tool}/ all
870.endfor
871
872#
873# cross-tools: Build cross-building tools
874#
875.if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
876 ${BOOTSTRAPPING} < 500037
877_elf2aout= usr.bin/elf2aout
878.endif
879
880.if (${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386") && \
881 ${TARGET_ARCH} != ${MACHINE_ARCH}
882_btxld= usr.sbin/btxld
883.endif
884
885.if (!defined(NO_RESCUE) || \
886 defined(RELEASEDIR)) && \
887 (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101)
888_crunchide= usr.sbin/crunch/crunchide
889.endif
890
891.if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
892_elf2exe= usr.sbin/elf2exe
893.endif
894
895.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
896 defined(RELEASEDIR)
897_kgzip= usr.sbin/kgzip
898.endif
899
900cross-tools:
901.for _tool in \
902 gnu/usr.bin/binutils \
903 gnu/usr.bin/cc \
904 ${_elf2aout} \
905 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
906 ${_btxld} \
907 ${_crunchide} \
908 ${_elf2exe} \
909 ${_kgzip}
910 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
911 cd ${.CURDIR}/${_tool}; \
912 ${MAKE} DIRPRFX=${_tool}/ obj; \
913 ${MAKE} DIRPRFX=${_tool}/ depend; \
914 ${MAKE} DIRPRFX=${_tool}/ all; \
915 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
916.endfor
917
918#
919# hierarchy - ensure that all the needed directories are present
920#
921hierarchy:
922 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
923
924#
925# libraries - build all libraries, and install them under ${DESTDIR}.
926#
927# The list of libraries with dependents (${_prebuild_libs}) and their
928# interdependencies (__L) are built automatically by the
929# ${.CURDIR}/tools/make_libdeps.sh script.
930#
931libraries:
932 cd ${.CURDIR}; \
933 ${MAKE} -f Makefile.inc1 _startup_libs; \
934 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
935 ${MAKE} -f Makefile.inc1 _generic_libs;
936
937# These dependencies are not automatically generated:
938#
939# gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
940# shared libraries for ELF.
941#
942_startup_libs= gnu/lib/csu gnu/lib/libgcc
943.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
944_startup_libs+= lib/csu/${MACHINE_ARCH}-elf
945.else
946_startup_libs+= lib/csu/${MACHINE_ARCH}
947.endif
948
949_prebuild_libs=
950
951_generic_libs= gnu/lib
952
953.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL)
954_prebuild_libs+= kerberos5/lib/libasn1
955_prebuild_libs+= kerberos5/lib/libgssapi
956_prebuild_libs+= kerberos5/lib/libkrb5
957_prebuild_libs+= kerberos5/lib/libroken
958_generic_libs+= kerberos5/lib
959.endif
960
961_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
962 lib/libkvm lib/libmd \
963 lib/libncurses lib/libnetgraph lib/libopie lib/libpam \
964 lib/libradius \
965 lib/libsbuf lib/libtacplus lib/libutil \
966 lib/libz lib/msun
967
968lib/libopie__L lib/libtacplus__L: lib/libmd__L
969
970.if !defined(NO_BIND)
971.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64"
972_prebuild_libs+= lib/libc_r
973.else
974_prebuild_libs+= lib/libpthread
975.endif
976.endif
977
978_generic_libs+= lib
979
980.if !defined(NO_CRYPT)
981.if !defined(NO_OPENSSL)
982_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
983lib/libradius__L: secure/lib/libssl__L
984secure/lib/libssl__L: secure/lib/libcrypto__L
985.if !defined(NO_OPENSSH)
986_prebuild_libs+= secure/lib/libssh
987secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
988.if !defined(NO_KERBEROS)
989secure/lib/libssh__L: kerberos5/lib/libgssapi__L kerberos5/lib/libkrb5__L \
990 kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \
991 kerberos5/lib/libroken__L
992.endif
993.endif
994.endif
995_generic_libs+= secure/lib
996.endif
997
998.if defined(NO_CRYPT) || defined(NO_OPENSSL)
999lib/libradius__L: lib/libmd__L
1000.endif
1001
1002.if !defined(NO_NIS)
1003_prebuild_libs+= lib/libypclnt
1004.endif
1005
1006_generic_libs+= usr.bin/lex/lib
1007
1008.if ${MACHINE_ARCH} == "i386"
1009_generic_libs+= usr.sbin/pcvt/keycap
1010.endif
1011
1012.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1013${_lib}__L: .PHONY
1014.if exists(${.CURDIR}/${_lib})
1015 ${_+_}@${ECHODIR} "===> ${_lib} (depend,all,install)"; \
1016 cd ${.CURDIR}/${_lib}; \
1017 ${MAKE} DIRPRFX=${_lib}/ depend; \
1018 ${MAKE} DIRPRFX=${_lib}/ all; \
1019 ${MAKE} DIRPRFX=${_lib}/ install
1020.endif
1021.endfor
1022
1023# libpam is special: we need to build static PAM modules before
1024# static PAM library, and dynamic PAM library before dynamic PAM
1025# modules.
1026lib/libpam__L: .PHONY
1027 ${_+_}@${ECHODIR} "===> lib/libpam (depend,all,install)"; \
1028 cd ${.CURDIR}/lib/libpam; \
1029 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1030 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1031 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1032
1033_startup_libs: ${_startup_libs:S/$/__L/}
1034_prebuild_libs: ${_prebuild_libs:S/$/__L/}
1035_generic_libs: ${_generic_libs:S/$/__L/}
1036
1037.for __target in all clean cleandepend cleandir depend includes obj
1038.for entry in ${SUBDIR}
1039${entry}.${__target}__D: .PHONY
1040 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1041 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1042 edir=${entry}.${MACHINE_ARCH}; \
1043 cd ${.CURDIR}/$${edir}; \
1044 else \
1045 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1046 edir=${entry}; \
1047 cd ${.CURDIR}/$${edir}; \
1048 fi; \
1049 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1050.endfor
1051par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1052.endfor
1053
1054.include <bsd.subdir.mk>