~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

FreeBSD/NetBSD/Linux OS Cross Reference
ROOT/Makefile.inc1

Version: ~ [ 6-STABLE ] ~ [ 7-STABLE ] ~ [ 8-CURRENT ] ~ [ linux-2.6.22.4 ] ~ [ NETBSD-CURRENT ] ~ [ OPENBSD-CURRENT ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~