ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
Revision: 6427
Committed: Sat Nov 30 23:59:44 2013 UTC (10 years, 5 months ago) by laffer1
File size: 50028 byte(s)
Log Message:
remove named from base

File Contents

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