ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Download File | Root Listing
root/midnightbsd-cvs/src/Makefile.inc1
Revision: 1.8
Committed: Tue Apr 29 00:23:55 2008 UTC (16 years ago) by laffer1
Branch: MAIN
Changes since 1.7: +12 -8 lines
Log Message:
We hacked this puppy up good. Add some obj targets.

File Contents

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