ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
Revision: 9758
Committed: Sat Jan 20 20:51:14 2018 UTC (6 years, 3 months ago) by laffer1
File size: 54740 byte(s)
Log Message:
 switch to mandoc

File Contents

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

Properties

Name Value
svn:keywords MidnightBSD=%H