ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
Revision: 7138
Committed: Fri Jul 24 22:40:44 2015 UTC (8 years, 10 months ago) by laffer1
File size: 50303 byte(s)
Log Message:
CVS updating is gone

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

Properties

Name Value
svn:keywords MidnightBSD=%H