ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
Revision: 4656
Committed: Sun Feb 19 23:04:03 2012 UTC (12 years, 2 months ago) by laffer1
File size: 42007 byte(s)
Log Message:
fancy math is default

File Contents

# Content
1 #
2 # $FreeBSD: src/Makefile.inc1,v 1.499.2.7 2006/01/07 19:40:08 netchild Exp $
3 # $MidnightBSD: src/Makefile.inc1,v 1.36 2012/02/19 22:59:20 laffer1 Exp $
4 #
5 # Make command line options:
6 # -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
7 # -DNO_CLEAN do not clean at all
8 # -DNO_SHARE do not go into share subdir
9 # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
10 # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
11 # -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
12 # -DNO_PORTSUPDATE do not update ports in ${MAKE} update
13 # -DNO_DOCUPDATE do not update doc in ${MAKE} update
14 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
15 # LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools# list
16 # TARGET="machine" to crossbuild world for a different machine type
17
18 #
19 # The intended user-driven targets are:
20 # buildworld - rebuild *everything*, including glue to help do upgrades
21 # installworld- install everything built by "buildworld"
22 # doxygen - build API documentation of the kernel
23 # update - convenient way to update your source tree (eg: cvsup/cvs)
24 #
25 # Standard targets (not defined here) are documented in the makefiles in
26 # /usr/share/mk. These include:
27 # obj depend all install clean cleandepend cleanobj
28
29 # You are supposed to define both of these when calling Makefile.inc1
30 # directly. However, some old scripts don't. Cope for the moment, but
31 # issue a new warning for a transition period.
32 .if defined(TARGET) && !defined(TARGET_ARCH)
33 .warning "You must pass both TARGET and TARGET_ARCH to Makefile.inc1. Setting TARGET_ARCH=${TARGET}."
34 TARGET_ARCH=${TARGET}
35 .endif
36 .if !defined(TARGET) || !defined(TARGET_ARCH)
37 .error "Both TARGET and TARGET_ARCH must be defined."
38 .endif
39
40 .include <bsd.own.mk>
41
42 # We must do share/info early so that installation of info `dir'
43 # entries works correctly. Do it first since it is less likely to
44 # grow dependencies on include and lib than vice versa.
45 #
46 # We must do lib/ and libexec/ before bin/, because if installworld
47 # installs a new /bin/sh, the 'make' command will *immediately*
48 # use that new version. And the new (dynamically-linked) /bin/sh
49 # will expect to find appropriate libraries in /lib and /libexec.
50 #
51 SUBDIR= share/info lib libexec
52 SUBDIR+=bin
53 .if ${MK_APACHE} != "no"
54 SUBDIR+=apache
55 .endif
56 .if ${MK_GAMES} != "no"
57 SUBDIR+=games
58 .endif
59 .if ${MK_CDDL} != "no"
60 SUBDIR+=cddl
61 .endif
62 SUBDIR+=gnu include
63 .if ${MK_KERBEROS} != "no"
64 SUBDIR+=kerberos5
65 .endif
66 .if ${MK_RESCUE} != "no"
67 SUBDIR+=rescue
68 .endif
69 SUBDIR+=sbin
70 .if ${MK_CRYPT} != "no"
71 SUBDIR+=secure
72 .endif
73 .if !defined(NO_SHARE)
74 SUBDIR+=share
75 .endif
76 SUBDIR+=sys usr.bin usr.sbin
77 #
78 # We must do etc/ last for install/distribute to work.
79 #
80 SUBDIR+=etc
81
82 # These are last, since it is nice to at least get the base system
83 # rebuilt before you do them.
84 .for _DIR in ${LOCAL_DIRS}
85 .if exists(${.CURDIR}/${_DIR}/Makefile)
86 SUBDIR+= ${_DIR}
87 .endif
88 .endfor
89
90 .if defined(SUBDIR_OVERRIDE)
91 SUBDIR= ${SUBDIR_OVERRIDE}
92 .endif
93
94 .if defined(NOCLEAN)
95 NO_CLEAN= ${NOCLEAN}
96 .endif
97 .if defined(NO_CLEANDIR)
98 CLEANDIR= clean cleandepend
99 .else
100 CLEANDIR= cleandir
101 .endif
102
103 BUILDENV_SHELL?=/bin/sh
104 LOCAL_TOOL_DIRS?=
105
106 CVS?= cvs
107 CVSFLAGS?= -r . -P -d -I!
108 SUP?= /usr/local/bin/cvsup
109 SUPFLAGS?= -g -L 2
110 .if defined(SUPHOST)
111 SUPFLAGS+= -h ${SUPHOST}
112 .endif
113
114 MAKEOBJDIRPREFIX?= /usr/obj
115 .if !defined(OSRELDATE)
116 .if exists(/usr/include/osreldate.h)
117 OSRELDATE!= awk '/^\#define[[:space:]]*__MidnightBSD_version/ { print $$3 }' \
118 /usr/include/osreldate.h
119 .else
120 OSRELDATE= 0
121 .endif
122 .endif
123
124 # Guess machine architecture from machine type, and vice versa.
125 .if !defined(TARGET_ARCH) && defined(TARGET)
126 TARGET_ARCH= ${TARGET}
127 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
128 ${TARGET_ARCH} != ${MACHINE_ARCH}
129 TARGET= ${TARGET_ARCH}
130 .endif
131 # Otherwise, default to current machine type and architecture.
132 TARGET?= ${MACHINE}
133 TARGET_ARCH?= ${MACHINE_ARCH}
134
135 KNOWN_ARCHES?= amd64 i386 sparc64
136 .if ${TARGET} == ${TARGET_ARCH}
137 _t= ${TARGET}
138 .else
139 _t= ${TARGET_ARCH}/${TARGET}
140 .endif
141 .for _t in ${_t}
142 .if empty(KNOWN_ARCHES:M${_t})
143 .error Unknown target ${TARGET_ARCH}:${TARGET}.
144 .endif
145 .endfor
146
147 .if ${TARGET} == ${MACHINE}
148 TARGET_CPUTYPE?=${CPUTYPE}
149 .else
150 TARGET_CPUTYPE?=
151 .endif
152
153 .if !empty(TARGET_CPUTYPE)
154 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
155 .else
156 _TARGET_CPUTYPE=dummy
157 .endif
158 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
159 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
160 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
161 .error CPUTYPE global should be set with ?=.
162 .endif
163 .if make(buildworld)
164 BUILD_ARCH!= uname -p
165 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
166 .error To cross-build, set TARGET_ARCH.
167 .endif
168 .endif
169 .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
170 OBJTREE= ${MAKEOBJDIRPREFIX}
171 .else
172 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
173 .endif
174 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
175 # /usr/games added for fortune which depend on strfile
176 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
177 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
178 STRICTTMPPATH= ${BPATH}:${XPATH}
179 TMPPATH= ${STRICTTMPPATH}:${PATH}
180
181 #
182 # Avoid running mktemp(1) unless actually needed.
183 # It may not be functional, e.g., due to new ABI
184 # when in the middle of installing over this system.
185 #
186 .if make(distributeworld) || make(installworld)
187 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
188 .endif
189
190 #
191 # Building a world goes through the following stages
192 #
193 # 1. legacy stage [BMAKE]
194 # This stage is responsible for creating compatibility
195 # shims that are needed by the bootstrap-tools,
196 # build-tools and cross-tools stages.
197 # 1. bootstrap-tools stage [BMAKE]
198 # This stage is responsible for creating programs that
199 # are needed for backward compatibility reasons. They
200 # are not built as cross-tools.
201 # 2. build-tools stage [TMAKE]
202 # This stage is responsible for creating the object
203 # tree and building any tools that are needed during
204 # the build process.
205 # 3. cross-tools stage [XMAKE]
206 # This stage is responsible for creating any tools that
207 # are needed for cross-builds. A cross-compiler is one
208 # of them.
209 # 4. world stage [WMAKE]
210 # This stage actually builds the world.
211 # 5. install stage (optional) [IMAKE]
212 # This stage installs a previously built world.
213 #
214
215 BOOTSTRAPPING?= 0
216
217 # Common environment for world related stages
218 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
219 MACHINE_ARCH=${TARGET_ARCH} \
220 MACHINE=${TARGET} \
221 CPUTYPE=${TARGET_CPUTYPE} \
222 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
223 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
224 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
225
226 # bootstrap-tools stage
227 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
228 PATH=${BPATH}:${PATH} \
229 WORLDTMP=${WORLDTMP} \
230 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
231 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
232 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
233 DESTDIR= \
234 BOOTSTRAPPING=${OSRELDATE} \
235 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
236 -DWITHOUT_NLS -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
237 -DNO_CPU_CFLAGS -DNO_WARNS
238
239 # build-tools stage
240 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
241 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
242 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
243 DESTDIR= \
244 BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS
245
246 # cross-tools stage
247 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
248 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
249 -DWITHOUT_GDB
250
251 # world stage
252 WMAKEENV= ${CROSSENV} \
253 _SHLIBDIRPREFIX=${WORLDTMP} \
254 INSTALL="sh ${.CURDIR}/tools/install.sh" \
255 PATH=${TMPPATH}
256 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
257
258 .if ${TARGET_ARCH} == "amd64"
259 # 32 bit world
260 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
261
262 .if empty(TARGET_CPUTYPE)
263 LIB32CPUTYPE= k8
264 .else
265 LIB32CPUTYPE= ${TARGET_CPUTYPE}
266 .endif
267 LIB32FLAGS= -m32 -march=${LIB32CPUTYPE} -DCOMPAT_32BIT \
268 -iprefix ${LIB32TMP}/usr/ \
269 -L${LIB32TMP}/usr/lib32 \
270 -B${LIB32TMP}/usr/lib32
271
272 # Yes, the flags are redundant.
273 LIB32WMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
274 _SHLIBDIRPREFIX=${LIB32TMP} \
275 MACHINE=i386 \
276 MACHINE_ARCH=i386 \
277 INSTALL="sh ${.CURDIR}/tools/install.sh" \
278 PATH=${TMPPATH} \
279 CC="${CC} ${LIB32FLAGS}" \
280 CXX="${CXX} ${LIB32FLAGS}" \
281 OBJC="${OBJC} ${LIB32FLAGS}" \
282 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
283 AS="${AS} --32" \
284 LIBDIR=/usr/lib32 \
285 SHLIBDIR=/usr/lib32
286
287 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
288 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_INFO \
289 -DWITHOUT_HTML -DNO_LINT -ECC -ECXX -EAS -ELD \
290 -DESTDIR=${LIB32TMP}
291 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
292 .endif
293
294 # install stage
295 IMAKEENV= ${CROSSENV}
296 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
297 .if empty(.MAKEFLAGS:M-n)
298 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
299 LD_LIBRARY_PATH=${INSTALLTMP} \
300 PATH_LOCALE=${INSTALLTMP}/locale
301 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
302 .else
303 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
304 .endif
305
306 # kernel stage
307 KMAKEENV= ${WMAKEENV}
308 KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
309
310 #
311 # buildworld
312 #
313 # Attempt to rebuild the entire system, with reasonable chance of
314 # success, regardless of how old your existing system is.
315 #
316 _worldtmp:
317 .if ${.CURDIR:C/[^,]//g} != ""
318 # The m4 build of sendmail files doesn't like it if ',' is used
319 # anywhere in the path of it's files.
320 @echo
321 @echo "*** Error: path to source tree contains a comma ','"
322 @echo
323 false
324 .endif
325 @echo
326 @echo "--------------------------------------------------------------"
327 @echo ">>> Rebuilding the temporary build tree"
328 @echo "--------------------------------------------------------------"
329 .if !defined(NO_CLEAN)
330 rm -rf ${WORLDTMP}
331 .if ${TARGET_ARCH} == "amd64"
332 rm -rf ${LIB32TMP}
333 .endif
334 .else
335 rm -rf ${WORLDTMP}/legacy/usr/include
336 # XXX - These two can depend on any header file.
337 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
338 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
339 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
340 .endif
341 .for _dir in \
342 lib usr legacy/usr
343 mkdir -p ${WORLDTMP}/${_dir}
344 .endfor
345 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
346 -p ${WORLDTMP}/legacy/usr >/dev/null
347 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
348 -p ${WORLDTMP}/usr >/dev/null
349 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
350 -p ${WORLDTMP}/usr/include >/dev/null
351 ln -sf ${.CURDIR}/sys ${WORLDTMP}
352 .if ${MK_BIND_LIBS} != "no"
353 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
354 -p ${WORLDTMP}/usr/include >/dev/null
355 .endif
356 _legacy:
357 @echo
358 @echo "--------------------------------------------------------------"
359 @echo ">>> stage 1.1: legacy release compatibility shims"
360 @echo "--------------------------------------------------------------"
361 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
362 _bootstrap-tools:
363 @echo
364 @echo "--------------------------------------------------------------"
365 @echo ">>> stage 1.2: bootstrap tools"
366 @echo "--------------------------------------------------------------"
367 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
368 _cleanobj:
369 .if !defined(NO_CLEAN)
370 @echo
371 @echo "--------------------------------------------------------------"
372 @echo ">>> stage 2.1: cleaning up the object tree"
373 @echo "--------------------------------------------------------------"
374 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
375 .if ${TARGET_ARCH} == "amd64"
376 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
377 .endif
378 .endif
379 _obj:
380 @echo
381 @echo "--------------------------------------------------------------"
382 @echo ">>> stage 2.2: rebuilding the object tree"
383 @echo "--------------------------------------------------------------"
384 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
385 _build-tools:
386 @echo
387 @echo "--------------------------------------------------------------"
388 @echo ">>> stage 2.3: build tools"
389 @echo "--------------------------------------------------------------"
390 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
391 _cross-tools:
392 @echo
393 @echo "--------------------------------------------------------------"
394 @echo ">>> stage 3: cross tools"
395 @echo "--------------------------------------------------------------"
396 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
397 _includes:
398 @echo
399 @echo "--------------------------------------------------------------"
400 @echo ">>> stage 4.1: building includes"
401 @echo "--------------------------------------------------------------"
402 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
403 _libraries:
404 @echo
405 @echo "--------------------------------------------------------------"
406 @echo ">>> stage 4.2: building libraries"
407 @echo "--------------------------------------------------------------"
408 ${_+_}cd ${.CURDIR}; \
409 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
410 -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE libraries
411 _depend:
412 @echo
413 @echo "--------------------------------------------------------------"
414 @echo ">>> stage 4.3: make dependencies"
415 @echo "--------------------------------------------------------------"
416 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
417 everything:
418 @echo
419 @echo "--------------------------------------------------------------"
420 @echo ">>> stage 4.4: building everything"
421 @echo "--------------------------------------------------------------"
422 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
423 .if ${TARGET_ARCH} == "amd64"
424 build32:
425 @echo
426 @echo "--------------------------------------------------------------"
427 @echo ">>> stage 5.1: building 32 bit shim libraries"
428 @echo "--------------------------------------------------------------"
429 mkdir -p ${LIB32TMP}/usr/include
430 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
431 -p ${LIB32TMP}/usr >/dev/null
432 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
433 -p ${LIB32TMP}/usr/include >/dev/null
434 mkdir -p ${WORLDTMP}
435 ln -sf ${.CURDIR}/sys ${WORLDTMP}
436 .if ${MK_KERBEROS} != "no"
437 .for _t in obj depend all
438 cd ${.CURDIR}/kerberos5/tools; \
439 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= ${_t}
440 .endfor
441 .endif
442 .for _t in obj includes
443 cd ${.CURDIR}/include; ${LIB32WMAKE} ${_t}
444 cd ${.CURDIR}/lib; ${LIB32WMAKE} ${_t}
445 .if ${MK_APACHE} != "no"
446 cd ${.CURDIR}/apache/lib; ${LIB32WMAKE} ${_t}
447 .endif
448 .if ${MK_CDDL} != "no"
449 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
450 .endif
451 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
452 .if ${MK_CRYPT} != "no"
453 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
454 .endif
455 .if ${MK_KERBEROS} != "no"
456 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
457 .endif
458 .endfor
459 .for _dir in usr.bin/lex/lib
460 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
461 .endfor
462 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
463 cd ${.CURDIR}/${_dir}; \
464 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
465 DIRPRFX=${_dir}/ build-tools
466 .endfor
467 cd ${.CURDIR}; \
468 ${LIB32WMAKE} -f Makefile.inc1 libraries
469 .for _t in obj depend all
470 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
471 DIRPRFX=libexec/rtld-elf/ ${_t}
472 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
473 DIRPRFX=usr.bin/ldd ${_t}
474 .endfor
475
476 distribute32 install32:
477 .if make(distribute32)
478 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32 # XXX add to mtree
479 .else
480 mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree
481 .endif
482 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
483 .if ${MK_CDDL} != "no"
484 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
485 .endif
486 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
487 .if ${MK_CRYPT} != "no"
488 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
489 .endif
490 .if ${MK_KERBEROS} != "no"
491 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
492 .endif
493 cd ${.CURDIR}/libexec/rtld-elf; \
494 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
495 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
496 .endif
497
498 WMAKE_TGTS=
499 .if !defined(SUBDIR_OVERRIDE)
500 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
501 .endif
502 WMAKE_TGTS+= _cleanobj _obj _build-tools
503 .if !defined(SUBDIR_OVERRIDE)
504 WMAKE_TGTS+= _cross-tools
505 .endif
506 WMAKE_TGTS+= _includes _libraries _depend everything
507 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
508 WMAKE_TGTS+= build32
509 .endif
510
511 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
512 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
513
514 buildworld_prologue:
515 @echo "--------------------------------------------------------------"
516 @echo ">>> World build started on `LC_ALL=C date`"
517 @echo "--------------------------------------------------------------"
518
519 buildworld_epilogue:
520 @echo
521 @echo "--------------------------------------------------------------"
522 @echo ">>> World build completed on `LC_ALL=C date`"
523 @echo "--------------------------------------------------------------"
524
525 #
526 # We need to have this as a target because the indirection between Makefile
527 # and Makefile.inc1 causes the correct PATH to be used, rather than a
528 # modification of the current environment's PATH. In addition, we need
529 # to quote multiword values.
530 #
531 buildenvvars:
532 @echo ${WMAKEENV:Q}
533
534 buildenv:
535 @echo Entering world for ${TARGET_ARCH}:${TARGET}
536 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
537
538 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
539 toolchain: ${TOOLCHAIN_TGTS}
540 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
541
542 #
543 # installcheck
544 #
545 # Checks to be sure system is ready for installworld/installkernel.
546 #
547 installcheck:
548
549 #
550 # Require DESTDIR to be set if installing for a different architecture.
551 #
552 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
553 .if !make(distributeworld)
554 installcheck: installcheck_DESTDIR
555 installcheck_DESTDIR:
556 .if !defined(DESTDIR) || empty(DESTDIR)
557 @echo "ERROR: Please set DESTDIR!"; \
558 false
559 .endif
560 .endif
561 .endif
562
563 #
564 # Check for missing UIDs/GIDs.
565 #
566 CHECK_UIDS=
567 CHECK_GIDS= audit
568 .if ${MK_SENDMAIL} != "no"
569 CHECK_UIDS+= smmsp
570 CHECK_GIDS+= smmsp
571 .endif
572 .if ${MK_PF} != "no"
573 CHECK_UIDS+= proxy
574 CHECK_GIDS+= proxy authpf
575 .endif
576 installcheck: installcheck_UGID
577 installcheck_UGID:
578 .for uid in ${CHECK_UIDS}
579 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
580 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
581 false; \
582 fi
583 .endfor
584 .for gid in ${CHECK_GIDS}
585 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
586 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
587 false; \
588 fi
589 .endfor
590
591 #
592 # Required install tools to be saved in a scratch dir for safety.
593 #
594 .if ${MK_INFO} != "no"
595 _install-info= install-info
596 .endif
597 .if ${MK_ZONEINFO} != "no"
598 _zoneinfo= zic tzsetup
599 .endif
600
601 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
602 date echo egrep find grep ${_install-info} \
603 ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
604 test true uname wc ${_zoneinfo}
605
606 #
607 # distributeworld
608 #
609 # Distributes everything compiled by a `buildworld'.
610 #
611 # installworld
612 #
613 # Installs everything compiled by a 'buildworld'.
614 #
615
616 # Non-base distributions produced by the base system
617 EXTRA_DISTRIBUTIONS= doc games
618 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
619 EXTRA_DISTRIBUTIONS+= lib32
620 .endif
621
622 distributeworld installworld: installcheck
623 mkdir -p ${INSTALLTMP}
624 progs=$$(for prog in ${ITOOLS}; do \
625 if progpath=`which $$prog`; then \
626 echo $$progpath; \
627 else \
628 echo "Required tool $$prog not found in PATH." >&2; \
629 exit 1; \
630 fi; \
631 done); \
632 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
633 while read line; do \
634 set -- $$line; \
635 if [ "$$2 $$3" != "not found" ]; then \
636 echo $$2; \
637 else \
638 echo "Required library $$1 not found." >&2; \
639 exit 1; \
640 fi; \
641 done); \
642 cp $$libs $$progs ${INSTALLTMP}
643 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
644 .if make(distributeworld)
645 .for dist in ${EXTRA_DISTRIBUTIONS}
646 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
647 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
648 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
649 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
650 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
651 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
652 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
653 .endfor
654 -mkdir ${DESTDIR}/${DISTDIR}/base
655 ${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \
656 DESTDIR=${DESTDIR}/${DISTDIR}/base
657 .endif
658 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
659 ${IMAKEENV} rm -rf ${INSTALLTMP}
660 .if make(distributeworld)
661 .for dist in ${EXTRA_DISTRIBUTIONS}
662 find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
663 .endfor
664 .endif
665
666 packageworld:
667 .for dist in base ${EXTRA_DISTRIBUTIONS}
668 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
669 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz .
670 .endfor
671
672 #
673 # reinstall
674 #
675 # If you have a build server, you can NFS mount the source and obj directories
676 # and do a 'make reinstall' on the *client* to install new binaries from the
677 # most recent server build.
678 #
679 reinstall:
680 @echo "--------------------------------------------------------------"
681 @echo ">>> Making hierarchy"
682 @echo "--------------------------------------------------------------"
683 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
684 @echo
685 @echo "--------------------------------------------------------------"
686 @echo ">>> Installing everything"
687 @echo "--------------------------------------------------------------"
688 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
689 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
690 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
691 .endif
692
693 redistribute:
694 @echo "--------------------------------------------------------------"
695 @echo ">>> Distributing everything"
696 @echo "--------------------------------------------------------------"
697 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
698 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
699 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
700 DISTRIBUTION=lib32
701 .endif
702
703 distrib-dirs distribution:
704 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
705
706 #
707 # buildkernel and installkernel
708 #
709 # Which kernels to build and/or install is specified by setting
710 # KERNCONF. If not defined a GENERIC kernel is built/installed.
711 # Only the existing (depending TARGET) config files are used
712 # for building kernels and only the first of these is designated
713 # as the one being installed.
714 #
715 # Note that we have to use TARGET instead of TARGET_ARCH when
716 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
717 # be set to cross-build, we have to make sure TARGET is set
718 # properly.
719
720 .if defined(KERNFAST)
721 NO_KERNELCLEAN= t
722 NO_KERNELCONFIG= t
723 NO_KERNELDEPEND= t
724 NO_KERNELOBJ= t
725 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
726 .if !defined(KERNCONF) && ${KERNFAST} != "1"
727 KERNCONF=${KERNFAST}
728 .endif
729 .endif
730 .if !defined(KERNCONF) && defined(KERNEL)
731 KERNCONF= ${KERNEL}
732 KERNWARN=
733 .else
734 KERNCONF?= GENERIC
735 .endif
736 INSTKERNNAME?= kernel
737
738 KERNSRCDIR?= ${.CURDIR}/sys
739 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
740 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
741 KERNCONFDIR?= ${KRNLCONFDIR}
742
743 BUILDKERNELS=
744 INSTALLKERNEL=
745 .for _kernel in ${KERNCONF}
746 .if exists(${KERNCONFDIR}/${_kernel})
747 BUILDKERNELS+= ${_kernel}
748 .if empty(INSTALLKERNEL)
749 INSTALLKERNEL= ${_kernel}
750 .endif
751 .endif
752 .endfor
753
754 #
755 # buildkernel
756 #
757 # Builds all kernels defined by BUILDKERNELS.
758 #
759 buildkernel:
760 .if empty(BUILDKERNELS)
761 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
762 false
763 .endif
764 .if defined(KERNWARN)
765 @echo "--------------------------------------------------------------"
766 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
767 @echo "--------------------------------------------------------------"
768 @sleep 3
769 .endif
770 @echo
771 .for _kernel in ${BUILDKERNELS}
772 @echo "--------------------------------------------------------------"
773 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
774 @echo "--------------------------------------------------------------"
775 @echo "===> ${_kernel}"
776 mkdir -p ${KRNLOBJDIR}
777 .if !defined(NO_KERNELCONFIG)
778 @echo
779 @echo "--------------------------------------------------------------"
780 @echo ">>> stage 1: configuring the kernel"
781 @echo "--------------------------------------------------------------"
782 cd ${KRNLCONFDIR}; \
783 PATH=${TMPPATH} \
784 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
785 ${KERNCONFDIR}/${_kernel}
786 .endif
787 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
788 @echo
789 @echo "--------------------------------------------------------------"
790 @echo ">>> stage 2.1: cleaning up the object tree"
791 @echo "--------------------------------------------------------------"
792 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
793 .endif
794 .if !defined(NO_KERNELOBJ)
795 @echo
796 @echo "--------------------------------------------------------------"
797 @echo ">>> stage 2.2: rebuilding the object tree"
798 @echo "--------------------------------------------------------------"
799 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
800 .endif
801 @echo
802 @echo "--------------------------------------------------------------"
803 @echo ">>> stage 2.3: build tools"
804 @echo "--------------------------------------------------------------"
805 cd ${KRNLOBJDIR}/${_kernel}; \
806 PATH=${BPATH}:${PATH} \
807 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
808 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \
809 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
810 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
811 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
812 .for target in obj depend all
813 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
814 PATH=${BPATH}:${PATH} \
815 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
816 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target}
817 .endfor
818 .endif
819 .if !defined(NO_KERNELDEPEND)
820 @echo
821 @echo "--------------------------------------------------------------"
822 @echo ">>> stage 3.1: making dependencies"
823 @echo "--------------------------------------------------------------"
824 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
825 .endif
826 @echo
827 @echo "--------------------------------------------------------------"
828 @echo ">>> stage 3.2: building everything"
829 @echo "--------------------------------------------------------------"
830 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
831 @echo "--------------------------------------------------------------"
832 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
833 @echo "--------------------------------------------------------------"
834 .endfor
835
836 #
837 # installkernel, etc.
838 #
839 # Install the kernel defined by INSTALLKERNEL
840 #
841 installkernel installkernel.debug \
842 reinstallkernel reinstallkernel.debug: installcheck
843 .if empty(INSTALLKERNEL)
844 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
845 false
846 .endif
847 @echo "--------------------------------------------------------------"
848 @echo ">>> Installing kernel ${INSTALLKERNEL}"
849 @echo "--------------------------------------------------------------"
850 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
851 ${CROSSENV} PATH=${TMPPATH} \
852 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
853
854 distributekernel distributekernel.debug:
855 .if empty(INSTALLKERNEL)
856 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
857 false
858 .endif
859 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
860 ${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
861 DESTDIR=${DESTDIR}/${DISTDIR}/kernel \
862 ${.TARGET:S/distributekernel/install/}
863
864 packagekernel:
865 ${_+_}cd ${DESTDIR}/${DISTDIR}/kernel; \
866 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
867
868 #
869 # doxygen
870 #
871 # Build the API documentation with doxygen
872 #
873 doxygen:
874 @if [ ! -x `/usr/bin/which doxygen` ]; then \
875 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
876 exit 1; \
877 fi
878 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
879
880 #
881 # update
882 #
883 # Update the source tree, by running cvsup and/or running cvs to update to the
884 # latest copy.
885 #
886 update:
887 .if defined(SUP_UPDATE)
888 @echo "--------------------------------------------------------------"
889 @echo ">>> Running ${SUP}"
890 @echo "--------------------------------------------------------------"
891 .if defined(SUPFILE)
892 @${SUP} ${SUPFLAGS} ${SUPFILE}
893 .endif
894 .if defined(SUPFILE1)
895 @${SUP} ${SUPFLAGS} ${SUPFILE1}
896 .endif
897 .if defined(SUPFILE2)
898 @${SUP} ${SUPFLAGS} ${SUPFILE2}
899 .endif
900 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
901 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
902 .endif
903 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
904 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
905 .endif
906 .endif
907 .if defined(CVS_UPDATE)
908 @echo "--------------------------------------------------------------"
909 @echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT}
910 @echo "--------------------------------------------------------------"
911 cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS}
912 .endif
913
914 #
915 # ------------------------------------------------------------------------
916 #
917 # From here onwards are utility targets used by the 'make world' and
918 # related targets. If your 'world' breaks, you may like to try to fix
919 # the problem and manually run the following targets to attempt to
920 # complete the build. Beware, this is *not* guaranteed to work, you
921 # need to have a pretty good grip on the current state of the system
922 # to attempt to manually finish it. If in doubt, 'make world' again.
923 #
924
925 #
926 # legacy: Build compatibility shims for the next three targets
927 #
928 legacy:
929 .for _tool in tools/build
930 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
931 cd ${.CURDIR}/${_tool}; \
932 ${MAKE} DIRPRFX=${_tool}/ obj; \
933 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
934 ${MAKE} DIRPRFX=${_tool}/ depend; \
935 ${MAKE} DIRPRFX=${_tool}/ all; \
936 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
937 .endfor
938
939 #
940 # bootstrap-tools: Build tools needed for compatibility
941 #
942 .if ${MK_GAMES} != "no"
943 _strfile= games/fortune/strfile
944 .endif
945
946 .if ${MK_CXX} != "no"
947 _gperf= gnu/usr.bin/gperf
948 .if ${BOOTSTRAPPING} < 700004
949 _groff= gnu/usr.bin/groff
950 .else
951 _groff= gnu/usr.bin/groff/tmac
952 .endif
953 .endif
954
955 .if ${BOOTSTRAPPING} < 700018
956 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
957 .endif
958
959 .if ${MK_RESCUE} != "no" && \
960 ${BOOTSTRAPPING} < 700026
961 _crunchgen= usr.sbin/crunch/crunchgen
962 .endif
963
964 bootstrap-tools:
965 .for _tool in \
966 ${_strfile} \
967 ${_gperf} \
968 ${_groff} \
969 usr.bin/lorder \
970 usr.bin/makewhatis \
971 usr.bin/rpcgen \
972 usr.bin/xinstall \
973 ${_gensnmptree} \
974 usr.sbin/config \
975 ${_crunchgen}
976 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
977 cd ${.CURDIR}/${_tool}; \
978 ${MAKE} DIRPRFX=${_tool}/ obj; \
979 ${MAKE} DIRPRFX=${_tool}/ depend; \
980 ${MAKE} DIRPRFX=${_tool}/ all; \
981 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
982 .endfor
983
984 #
985 # build-tools: Build special purpose build tools
986 #
987 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
988 _aicasm= sys/modules/aic7xxx/aicasm
989 .endif
990
991 .if !defined(NO_SHARE)
992 _share= share/syscons/scrnmaps
993 .endif
994
995 .if ${MK_KERBEROS} != "no"
996 _kerberos5_tools= kerberos5/tools
997 .endif
998
999 .if ${MK_RESCUE} != "no"
1000 _rescue= rescue/rescue
1001 .endif
1002
1003 build-tools:
1004 .for _tool in \
1005 bin/csh \
1006 bin/sh \
1007 ${_rescue} \
1008 ${LOCAL_TOOL_DIRS} \
1009 lib/ncurses/ncurses \
1010 lib/ncurses/ncursesw \
1011 ${_share} \
1012 ${_aicasm} \
1013 usr.bin/awk \
1014 lib/libmagic \
1015 usr.sbin/sysinstall
1016 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1017 cd ${.CURDIR}/${_tool}; \
1018 ${MAKE} DIRPRFX=${_tool}/ obj; \
1019 ${MAKE} DIRPRFX=${_tool}/ build-tools
1020 .endfor
1021 .for _tool in \
1022 gnu/usr.bin/cc/cc_tools \
1023 ${_kerberos5_tools}
1024 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1025 cd ${.CURDIR}/${_tool}; \
1026 ${MAKE} DIRPRFX=${_tool}/ obj; \
1027 ${MAKE} DIRPRFX=${_tool}/ depend; \
1028 ${MAKE} DIRPRFX=${_tool}/ all
1029 .endfor
1030
1031 #
1032 # cross-tools: Build cross-building tools
1033 #
1034 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1035 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1036 _btxld= usr.sbin/btxld
1037 .endif
1038 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1039 _crunchide= usr.sbin/crunch/crunchide
1040 .endif
1041 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1042 _kgzip= usr.sbin/kgzip
1043 .endif
1044 .endif
1045
1046 cross-tools:
1047 .for _tool in \
1048 gnu/usr.bin/binutils \
1049 gnu/usr.bin/cc \
1050 usr.bin/sed \
1051 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1052 ${_btxld} \
1053 ${_crunchide} \
1054 ${_kgzip}
1055 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1056 cd ${.CURDIR}/${_tool}; \
1057 ${MAKE} DIRPRFX=${_tool}/ obj; \
1058 ${MAKE} DIRPRFX=${_tool}/ depend; \
1059 ${MAKE} DIRPRFX=${_tool}/ all; \
1060 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1061 .endfor
1062
1063 #
1064 # hierarchy - ensure that all the needed directories are present
1065 #
1066 hierarchy:
1067 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
1068
1069 #
1070 # libraries - build all libraries, and install them under ${DESTDIR}.
1071 #
1072 # The list of libraries with dependents (${_prebuild_libs}) and their
1073 # interdependencies (__L) are built automatically by the
1074 # ${.CURDIR}/tools/make_libdeps.sh script.
1075 #
1076 libraries:
1077 cd ${.CURDIR}; \
1078 ${MAKE} -f Makefile.inc1 _prereq_libs; \
1079 ${MAKE} -f Makefile.inc1 _startup_libs; \
1080 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
1081 ${MAKE} -f Makefile.inc1 _generic_libs;
1082
1083 #
1084 # static libgcc.a prerequisite for shared libc
1085 #
1086 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc
1087
1088 # These dependencies are not automatically generated:
1089 #
1090 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1091 # all shared libraries for ELF.
1092 #
1093 _startup_libs= gnu/lib/csu
1094 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1095 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1096 .else
1097 _startup_libs+= lib/csu/${MACHINE_ARCH}
1098 .endif
1099 _startup_libs+= gnu/lib/libgcc
1100 _startup_libs+= lib/libc
1101
1102 gnu/lib/libgcc__L: lib/libc__L
1103
1104 _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libkrb5} \
1105 ${_kerberos5_lib_libroken} \
1106 lib/libbz2 lib/libcom_err lib/libcrypt \
1107 lib/libexpat \
1108 ${_lib_libgssapi} ${_lib_libipx} \
1109 lib/libkiconv lib/libkvm lib/libmd \
1110 lib/ncurses/ncurses lib/ncurses/ncursesw \
1111 lib/libopie lib/libpam ${_default_thread_lib} \
1112 lib/libradius lib/libsbuf lib/libtacplus lib/libutil \
1113 ${_lib_libypclnt} lib/libz lib/msun \
1114 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1115 ${_secure_lib_libssl} lib/libsqlite3 lib/liblzma \
1116 lib/libarchive lib/libfetch lib/libmagic
1117
1118 .if ${MK_LIBTHR} != "no" && ${MK_LIBKSE} != "no"
1119 _default_thread_lib= lib/${DEFAULT_THREAD_LIB}
1120 .elif ${MK_LIBTHR} != "no"
1121 _default_thread_lib= lib/libthr
1122 .elif ${MK_LIBKSE} != "no"
1123 _default_thread_lib= lib/libkse
1124 .endif
1125
1126 _generic_libs= ${_apache_lib} ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib
1127
1128 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1129
1130 .if ${MK_APACHE} != "no"
1131 _apache_lib= apache/lib
1132 .endif
1133
1134 .if ${MK_CDDL} != "no"
1135 _cddl_lib= cddl/lib
1136 .endif
1137
1138 .if ${MK_CRYPT} != "no"
1139 .if ${MK_OPENSSL} != "no"
1140 _secure_lib_libcrypto= secure/lib/libcrypto
1141 _secure_lib_libssl= secure/lib/libssl
1142 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1143 .if ${MK_OPENSSH} != "no"
1144 _secure_lib_libssh= secure/lib/libssh
1145 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1146 .if ${MK_KERBEROS} != "no"
1147 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1148 kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \
1149 kerberos5/lib/libroken__L
1150 .endif
1151 .endif
1152 .endif
1153 _secure_lib= secure/lib
1154 .endif
1155
1156 .if ${MK_IPX} != "no"
1157 _lib_libipx= lib/libipx
1158 .endif
1159
1160 .if ${MK_KERBEROS} != "no"
1161 _kerberos5_lib= kerberos5/lib
1162 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1163 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1164 _kerberos5_lib_libroken= kerberos5/lib/libroken
1165 _lib_libgssapi= lib/libgssapi
1166 .endif
1167
1168 .if ${MK_NIS} != "no"
1169 _lib_libypclnt= lib/libypclnt
1170 .endif
1171
1172 .if ${MK_OPENSSL} == "no"
1173 lib/libradius__L: lib/libmd__L
1174 .endif
1175
1176 .for _lib in ${_prereq_libs}
1177 ${_lib}__PL: .PHONY
1178 .if exists(${.CURDIR}/${_lib})
1179 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1180 cd ${.CURDIR}/${_lib}; \
1181 ${MAKE} DIRPRFX=${_lib}/ obj; \
1182 ${MAKE} DIRPRFX=${_lib}/ depend; \
1183 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1184 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1185 .endif
1186 .endfor
1187
1188 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1189 ${_lib}__L: .PHONY
1190 .if exists(${.CURDIR}/${_lib})
1191 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1192 cd ${.CURDIR}/${_lib}; \
1193 ${MAKE} DIRPRFX=${_lib}/ obj; \
1194 ${MAKE} DIRPRFX=${_lib}/ depend; \
1195 ${MAKE} DIRPRFX=${_lib}/ all; \
1196 ${MAKE} DIRPRFX=${_lib}/ install
1197 .endif
1198 .endfor
1199
1200 # libpam is special: we need to build static PAM modules before
1201 # static PAM library, and dynamic PAM library before dynamic PAM
1202 # modules.
1203 lib/libpam__L: .PHONY
1204 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1205 cd ${.CURDIR}/lib/libpam; \
1206 ${MAKE} DIRPRFX=lib/libpam/ obj; \
1207 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1208 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1209 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1210
1211 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1212 _startup_libs: ${_startup_libs:S/$/__L/}
1213 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1214 _generic_libs: ${_generic_libs:S/$/__L/}
1215
1216 .for __target in all clean cleandepend cleandir depend includes obj
1217 .for entry in ${SUBDIR}
1218 ${entry}.${__target}__D: .PHONY
1219 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1220 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1221 edir=${entry}.${MACHINE_ARCH}; \
1222 cd ${.CURDIR}/$${edir}; \
1223 else \
1224 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1225 edir=${entry}; \
1226 cd ${.CURDIR}/$${edir}; \
1227 fi; \
1228 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1229 .endfor
1230 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1231 .endfor
1232
1233 .include <bsd.subdir.mk>
1234
1235 .if make(check-old) || make(check-old-dirs) || \
1236 make(check-old-files) || make(check-old-libs) || \
1237 make(delete-old) || make(delete-old-dirs) || \
1238 make(delete-old-files) || make(delete-old-libs)
1239
1240 #
1241 # check for / delete old files section
1242 #
1243
1244 .include "ObsoleteFiles.inc"
1245
1246 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1247 else you can not start such an application. Consult UPDATING for more \
1248 information regarding how to cope with the removal/revision bump of a \
1249 specific library."
1250
1251 .if !defined(BATCH_DELETE_OLD_FILES)
1252 RM_I=-i
1253 .else
1254 RM_I=-v
1255 .endif
1256
1257 delete-old-files:
1258 @echo ">>> Removing old files (only deletes safe to delete libs)"
1259 # Ask for every old file if the user really wants to remove it.
1260 # It's annoying, but better safe than sorry.
1261 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1262 # argument list will get too long. Using .for/.endfor make "loops" will make
1263 # the Makefile parser segfault.
1264 @exec 3<&0; \
1265 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1266 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1267 while read file; do \
1268 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1269 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1270 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1271 fi; \
1272 done
1273 # Remove catpages without corresponding manpages.
1274 @exec 3<&0; \
1275 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1276 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1277 while read catpage; do \
1278 read manpage; \
1279 if [ ! -e "$${manpage}" ]; then \
1280 rm ${RM_I} $${catpage} <&3; \
1281 fi; \
1282 done
1283 @echo ">>> Old files removed"
1284
1285 check-old-files:
1286 @echo ">>> Checking for old files"
1287 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1288 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1289 while read file; do \
1290 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1291 echo "${DESTDIR}/$${file}"; \
1292 fi; \
1293 done
1294 # Check for catpages without corresponding manpages.
1295 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1296 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1297 while read catpage; do \
1298 read manpage; \
1299 if [ ! -e "$${manpage}" ]; then \
1300 echo $${catpage}; \
1301 fi; \
1302 done
1303
1304 delete-old-libs:
1305 @echo ">>> Removing old libraries"
1306 @echo "${OLD_LIBS_MESSAGE}" | fmt
1307 @exec 3<&0; \
1308 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1309 -V OLD_LIBS | xargs -n1 | \
1310 while read file; do \
1311 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1312 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1313 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1314 fi; \
1315 done
1316 @echo ">>> Old libraries removed"
1317
1318 check-old-libs:
1319 @echo ">>> Checking for old libraries"
1320 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1321 -V OLD_LIBS | xargs -n1 | \
1322 while read file; do \
1323 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1324 echo "${DESTDIR}/$${file}"; \
1325 fi; \
1326 done
1327
1328 delete-old-dirs:
1329 @echo ">>> Removing old directories"
1330 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1331 -V OLD_DIRS | xargs -n1 | \
1332 while read dir; do \
1333 if [ -d "${DESTDIR}/$${dir}" ]; then \
1334 rmdir -v "${DESTDIR}/$${dir}" || true; \
1335 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1336 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1337 fi; \
1338 done
1339 @echo ">>> Old directories removed"
1340
1341 check-old-dirs:
1342 @echo ">>> Checking for old directories"
1343 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1344 -V OLD_DIRS | xargs -n1 | \
1345 while read dir; do \
1346 if [ -d "${DESTDIR}/$${dir}" ]; then \
1347 echo "${DESTDIR}/$${dir}"; \
1348 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1349 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1350 fi; \
1351 done
1352
1353 delete-old: delete-old-files delete-old-dirs
1354 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1355
1356 check-old: check-old-files check-old-libs check-old-dirs
1357 @echo "To remove old files and directories run '${MAKE} delete-old'."
1358 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1359
1360 .endif
1361
1362 #
1363 # showconfig - show build configuration.
1364 #
1365 showconfig:
1366 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort

Properties

Name Value
cvs2svn:cvs-rev 1.37