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