ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
Revision: 9755
Committed: Sat Jan 20 20:39:41 2018 UTC (6 years, 3 months ago) by laffer1
File size: 55017 byte(s)
Log Message:
get rid of groff here

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

Properties

Name Value
svn:keywords MidnightBSD=%H