ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
Revision: 7136
Committed: Fri Jul 24 22:31:33 2015 UTC (8 years, 9 months ago) by laffer1
File size: 50395 byte(s)
Log Message:
bump the bootstrap versions on some recently updated utilities.

File Contents

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

Properties

Name Value
svn:keywords MidnightBSD=%H