ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Download File | Root Listing
root/midnightbsd-cvs/src/Makefile.inc1
Revision: 1.40
Committed: Sat Mar 10 04:16:12 2012 UTC (12 years, 1 month ago) by laffer1
Branch: MAIN
CVS Tags: HEAD
Changes since 1.39: +13 -15 lines
Log Message:
minor tweaks

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