]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.inc1
With CVS_UPDATE, use read-only repository mode by default.
[FreeBSD/FreeBSD.git] / Makefile.inc1
1 #
2 # $FreeBSD$
3 #
4 # Make command line options:
5 #       -DMAKE_KERBEROS4 to build KerberosIV
6 #       -DMAKE_KERBEROS5 to build Kerberos5
7 #       -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
8 #       -DNOCLEAN do not clean at all
9 #       -DNOCRYPT will prevent building of crypt versions
10 #       -DNOMAN do not build the manual pages
11 #       -DNOPROFILE do not build profiled libraries
12 #       -DNOSECURE do not go into secure subdir
13 #       -DNOGAMES do not go into games subdir
14 #       -DNOSHARE do not go into share subdir
15 #       -DNOINFO do not make or install info files
16 #       -DNOLIBC_R do not build libc_r.
17 #       -DNO_FORTRAN do not build g77 and related libraries.
18 #       -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
19 #       -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
20 #       -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
21 #       -DNO_PORTSUPDATE do not update ports in ${MAKE} update
22 #       -DNO_DOCUPDATE do not update doc in ${MAKE} update
23 #       LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
24 #       TARGET_ARCH="arch" to crossbuild world to a different arch
25
26 #
27 # The intended user-driven targets are:
28 # buildworld  - rebuild *everything*, including glue to help do upgrades
29 # installworld- install everything built by "buildworld"
30 # update      - convenient way to update your source tree (eg: sup/cvs)
31 # most        - build user commands, no libraries or include files
32 # installmost - install user commands, no libraries or include files
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 # Put initial settings here.
39 SUBDIR=
40
41 # We must do share/info early so that installation of info `dir'
42 # entries works correctly.  Do it first since it is less likely to
43 # grow dependencies on include and lib than vice versa.
44 .if exists(${.CURDIR}/share/info)
45 SUBDIR+= share/info
46 .endif
47
48 .if exists(${.CURDIR}/include)
49 SUBDIR+= include
50 .endif
51 .if exists(${.CURDIR}/lib)
52 SUBDIR+= lib
53 .endif
54
55 .if exists(${.CURDIR}/bin)
56 SUBDIR+= bin
57 .endif
58 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
59 SUBDIR+= games
60 .endif
61 .if exists(${.CURDIR}/gnu)
62 SUBDIR+= gnu
63 .endif
64 .if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
65     !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS4)
66 SUBDIR+= kerberosIV
67 .endif
68 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
69     !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5)
70 SUBDIR+= kerberos5
71 .endif
72 .if exists(${.CURDIR}/libexec)
73 SUBDIR+= libexec
74 .endif
75 .if exists(${.CURDIR}/sbin)
76 SUBDIR+= sbin
77 .endif
78 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
79 SUBDIR+= secure
80 .endif
81 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
82 SUBDIR+= share
83 .endif
84 .if exists(${.CURDIR}/sys)
85 SUBDIR+= sys
86 .endif
87 .if exists(${.CURDIR}/usr.bin)
88 SUBDIR+= usr.bin
89 .endif
90 .if exists(${.CURDIR}/usr.sbin)
91 SUBDIR+= usr.sbin
92 .endif
93
94 # etc must be last for "distribute" to work
95 .if exists(${.CURDIR}/etc)
96 SUBDIR+= etc
97 .endif
98
99 # These are last, since it is nice to at least get the base system
100 # rebuilt before you do them.
101 .if defined(LOCAL_DIRS)
102 .for _DIR in ${LOCAL_DIRS}
103 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
104 SUBDIR+= ${_DIR}
105 .endif
106 .endfor
107 .endif
108
109 .if defined(SUBDIR_OVERRIDE)
110 SUBDIR=         ${SUBDIR_OVERRIDE}
111 .endif
112
113 .if defined(NOCLEANDIR)
114 CLEANDIR=       clean cleandepend
115 .else
116 CLEANDIR=       cleandir
117 .endif
118
119 CVS?=           cvs
120 SUP?=           /usr/local/bin/cvsup
121 SUPFLAGS?=      -g -L 2 -P -
122 .if defined(SUPHOST)
123 SUPFLAGS+=      -h ${SUPHOST}
124 .endif
125
126 MAKEOBJDIRPREFIX?=      /usr/obj
127 OSRELDATE!=     sysctl -n kern.osreldate
128 TARGET_ARCH?=   ${MACHINE_ARCH}
129 .if ${TARGET_ARCH} == ${MACHINE_ARCH}
130 TARGET?=        ${MACHINE}
131 TARGET_CPUTYPE?=${CPUTYPE}
132 .else
133 TARGET?=        ${TARGET_ARCH}
134 TARGET_CPUTYPE?=
135 .endif
136 .if !empty(TARGET_CPUTYPE)
137 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
138 .else
139 _TARGET_CPUTYPE=dummy
140 .endif
141 _CPUTYPE!=      ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
142                 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
143 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
144 .error CPUTYPE global should be set with ?=.
145 .endif
146 .if make(buildworld)
147 BUILD_ARCH!=    sysctl -n hw.machine_arch
148 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
149 .error To cross-build, set TARGET_ARCH.
150 .endif
151 .endif
152 .if ${MACHINE} == ${TARGET}
153 OBJTREE=        ${MAKEOBJDIRPREFIX}
154 .else
155 OBJTREE=        ${MAKEOBJDIRPREFIX}/${TARGET}
156 .endif
157 WORLDTMP=       ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
158 # /usr/games added for fortune which depend on strfile
159 STRICTTMPPATH=  ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
160 TMPPATH=        ${STRICTTMPPATH}:${PATH}
161
162 INSTALLTMP!=    /usr/bin/mktemp -d -u -t install
163
164 #
165 # Building a world goes through the following stages
166 #
167 # 1. bootstrap-tool stage [BMAKE]
168 #       This stage is responsible for creating programs that
169 #       are needed for backward compatibility reasons. They
170 #       are not built as cross-tools.
171 # 2. build-tool stage [TMAKE]
172 #       This stage is responsible for creating the object
173 #       tree and building any tools that are needed during
174 #       the build process.
175 # 3. cross-tool stage [XMAKE]
176 #       This stage is responsible for creating any tools that
177 #       are needed for cross-builds. A cross-compiler is one
178 #       of them.
179 # 4. world stage [WMAKE]
180 #       This stage actually builds the world.
181 # 5. install stage (optional) [IMAKE]
182 #       This stage installs a previously built world.
183 #
184
185 # Common environment for world related stages
186 CROSSENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
187                 MACHINE_ARCH=${TARGET_ARCH} \
188                 MACHINE=${TARGET} \
189                 CPUTYPE=${TARGET_CPUTYPE} \
190                 GROFF_BIN_PATH=${WORLDTMP}/usr/bin \
191                 GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
192                 GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
193
194 # bootstrap-tool stage
195 BMAKEENV=       MAKEOBJDIRPREFIX=${WORLDTMP} \
196                 DESTDIR= \
197                 INSTALL="sh ${.CURDIR}/tools/install.sh"
198 BMAKE=          ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
199                 BOOTSTRAPPING=${OSRELDATE} \
200                 -DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
201                 -DNO_CPU_CFLAGS -DNO_WERROR
202
203 # build-tool stage
204 TMAKEENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
205                 DESTDIR= \
206                 INSTALL="sh ${.CURDIR}/tools/install.sh"
207 TMAKE=          ${TMAKEENV} ${MAKE} -f Makefile.inc1 \
208                 BOOTSTRAPPING=${OSRELDATE} -DNO_CPU_CFLAGS
209
210 # cross-tool stage
211 XMAKE=          TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
212
213 # world stage
214 WMAKEENV=       ${CROSSENV} \
215                 DESTDIR=${WORLDTMP} \
216                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
217                 PATH=${TMPPATH}
218 WMAKE=          ${WMAKEENV} ${MAKE} -f Makefile.inc1
219
220 # install stage
221 IMAKEENV=       ${CROSSENV} \
222                 PATH=${STRICTTMPPATH}:${INSTALLTMP}
223 IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
224
225 # kernel stage
226 KMAKEENV=       ${WMAKEENV}
227
228 USRDIRS=        usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
229                 usr/libexec usr/sbin usr/share/misc \
230                 usr/share/dict \
231                 usr/share/groff_font/devX100 \
232                 usr/share/groff_font/devX100-12 \
233                 usr/share/groff_font/devX75 \
234                 usr/share/groff_font/devX75-12 \
235                 usr/share/groff_font/devascii \
236                 usr/share/groff_font/devcp1047 \
237                 usr/share/groff_font/devdvi \
238                 usr/share/groff_font/devhtml \
239                 usr/share/groff_font/devkoi8-r \
240                 usr/share/groff_font/devlatin1 \
241                 usr/share/groff_font/devlbp \
242                 usr/share/groff_font/devlj4 \
243                 usr/share/groff_font/devps \
244                 usr/share/groff_font/devutf8 \
245                 usr/share/tmac/mdoc usr/share/tmac/mm
246
247 INCDIRS=        arpa dev fs g++/backward g++/bits g++/ext isc isofs libmilter \
248                 objc openssl protocols readline rpc rpcsvc security ufs
249
250 #
251 # buildworld
252 #
253 # Attempt to rebuild the entire system, with reasonable chance of
254 # success, regardless of how old your existing system is.
255 #
256 _worldtmp:
257 .if ${.CURDIR:C/[^,]//g} != ""
258 #       The m4 build of sendmail files doesn't like it if ',' is used
259 #       anywhere in the path of it's files.
260         @echo
261         @echo "*** Error: path to source tree contains a comma ','"
262         @echo
263         @false
264 .endif
265         @echo
266         @echo "--------------------------------------------------------------"
267         @echo ">>> Rebuilding the temporary build tree"
268         @echo "--------------------------------------------------------------"
269 .if !defined(NOCLEAN)
270         rm -rf ${WORLDTMP}
271 .else
272         # XXX - These two can depend on any header file.
273         rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
274         rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
275 .endif
276 .for _dir in ${USRDIRS}
277         mkdir -p ${WORLDTMP}/${_dir}
278 .endfor
279 .for _dir in ${INCDIRS}
280         mkdir -p ${WORLDTMP}/usr/include/${_dir}
281 .endfor
282         ln -sf ${.CURDIR}/sys ${WORLDTMP}
283 _bootstrap-tools:
284         @echo
285         @echo "--------------------------------------------------------------"
286         @echo ">>> stage 1: bootstrap tools"
287         @echo "--------------------------------------------------------------"
288         cd ${.CURDIR}; ${BMAKE} bootstrap-tools
289 _cleanobj:
290 .if !defined(NOCLEAN)
291         @echo
292         @echo "--------------------------------------------------------------"
293         @echo ">>> stage 2: cleaning up the object tree"
294         @echo "--------------------------------------------------------------"
295         cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
296 .endif
297 _obj:
298         @echo
299         @echo "--------------------------------------------------------------"
300         @echo ">>> stage 2: rebuilding the object tree"
301         @echo "--------------------------------------------------------------"
302         cd ${.CURDIR}; ${WMAKE} par-obj
303 _build-tools:
304         @echo
305         @echo "--------------------------------------------------------------"
306         @echo ">>> stage 2: build tools"
307         @echo "--------------------------------------------------------------"
308         cd ${.CURDIR}; ${TMAKE} build-tools
309 _cross-tools:
310         @echo
311         @echo "--------------------------------------------------------------"
312         @echo ">>> stage 3: cross tools"
313         @echo "--------------------------------------------------------------"
314         cd ${.CURDIR}; ${XMAKE} cross-tools
315 _includes:
316         @echo
317         @echo "--------------------------------------------------------------"
318         @echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
319         @echo "--------------------------------------------------------------"
320         cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
321 _libraries:
322         @echo
323         @echo "--------------------------------------------------------------"
324         @echo ">>> stage 4: building libraries"
325         @echo "--------------------------------------------------------------"
326         cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
327 _depend:
328         @echo
329         @echo "--------------------------------------------------------------"
330         @echo ">>> stage 4: make dependencies"
331         @echo "--------------------------------------------------------------"
332         cd ${.CURDIR}; ${WMAKE} par-depend
333 everything:
334         @echo
335         @echo "--------------------------------------------------------------"
336         @echo ">>> stage 4: building everything.."
337         @echo "--------------------------------------------------------------"
338         cd ${.CURDIR}; ${WMAKE} all
339
340
341 WMAKE_TGTS=
342 .if !defined(SUBDIR_OVERRIDE)
343 WMAKE_TGTS+=    _worldtmp _bootstrap-tools
344 .endif
345 WMAKE_TGTS+=    _cleanobj _obj _build-tools
346 .if !defined(SUBDIR_OVERRIDE)
347 WMAKE_TGTS+=    _cross-tools
348 .endif
349 WMAKE_TGTS+=    _includes _libraries _depend everything
350
351 buildworld: ${WMAKE_TGTS}
352 .ORDER: ${WMAKE_TGTS}
353
354 #
355 # installcheck
356 #
357 # Checks to be sure system is ready for installworld
358 #
359 installcheck:
360 .if !defined(NO_SENDMAIL)
361         @if ! `grep -q '^smmsp:' /etc/passwd`; then \
362                 echo "ERROR: Required smmsp user is missing, see /usr/src/UPDATING."; \
363                 false; \
364         fi
365         @if ! `grep -q '^smmsp:' /etc/group`; then \
366                 echo "ERROR: Required smmsp group is missing, see /usr/src/UPDATING."; \
367                 false; \
368         fi
369 .endif
370 .if ${TARGET_ARCH} == ${MACHINE_ARCH} && !defined(DISTDIR) && \
371     (!defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/")
372         @echo "Checking to see if your booted kernel is fresh enough.."
373         ${.OBJDIR}/bin/sh/sh -c \
374             'echo "Testing installed kernel for new sigaction(2) syscall"'
375         @echo "Seems ok.."
376 .endif
377
378 #
379 # distributeworld
380 #
381 # Distributes everything compiled by a `buildworld'.
382 #
383 # installworld
384 #
385 # Installs everything compiled by a 'buildworld'.
386 #
387 distributeworld installworld: installcheck
388         mkdir -p ${INSTALLTMP}
389         for prog in [ awk cap_mkdb cat chflags chmod chown \
390             date echo egrep find grep \
391             ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
392             test true uname wc zic; do \
393                 cp `which $$prog` ${INSTALLTMP}; \
394         done
395         cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
396         rm -rf ${INSTALLTMP}
397
398 #
399 # reinstall
400 #
401 # If you have a build server, you can NFS mount the source and obj directories
402 # and do a 'make reinstall' on the *client* to install new binaries from the
403 # most recent server build.
404 #
405 reinstall:
406         @echo "--------------------------------------------------------------"
407         @echo ">>> Making hierarchy"
408         @echo "--------------------------------------------------------------"
409         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
410         @echo
411         @echo "--------------------------------------------------------------"
412         @echo ">>> Installing everything.."
413         @echo "--------------------------------------------------------------"
414         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
415 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
416         @echo
417         @echo "--------------------------------------------------------------"
418         @echo ">>> Rebuilding man page indices"
419         @echo "--------------------------------------------------------------"
420         cd ${.CURDIR}/share/man; ${MAKE} makedb
421 .endif
422
423 redistribute:
424         @echo "--------------------------------------------------------------"
425         @echo ">>> Distributing everything.."
426         @echo "--------------------------------------------------------------"
427         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
428
429 #
430 # buildkernel and installkernel
431 #
432 # Which kernels to build and/or install is specified by setting
433 # KERNCONF. If not defined a GENERIC kernel is built/installed.
434 # Only the existing (depending TARGET) config files are used
435 # for building kernels and only the first of these is designated
436 # as the one being installed.
437 #
438 # Note that we have to use TARGET instead of TARGET_ARCH when
439 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
440 # be set to cross-build, we have to make sure TARGET is set
441 # properly.
442
443 .if !defined(KERNCONF) && defined(KERNEL)
444 KERNCONF=       ${KERNEL}
445 KERNWARN=       yes
446 .else
447 KERNCONF?=      GENERIC
448 .endif
449 INSTKERNNAME?=  kernel
450
451 KRNLSRCDIR=     ${.CURDIR}/sys
452 KRNLCONFDIR=    ${KRNLSRCDIR}/${TARGET}/conf
453 KRNLOBJDIR=     ${OBJTREE}${KRNLSRCDIR}
454 KERNCONFDIR?=   ${KRNLCONFDIR}
455
456 BUILDKERNELS=
457 INSTALLKERNEL=
458 .for _kernel in ${KERNCONF}
459 .if exists(${KERNCONFDIR}/${_kernel})
460 BUILDKERNELS+=  ${_kernel}
461 .if empty(INSTALLKERNEL)
462 INSTALLKERNEL= ${_kernel}
463 .endif
464 .endif
465 .endfor
466
467 #
468 # buildkernel
469 #
470 # Builds all kernels defined by BUILDKERNELS.
471 #
472 buildkernel:
473 .if empty(BUILDKERNELS)
474         @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
475         @false
476 .endif
477 .if defined(KERNWARN)
478         @echo "--------------------------------------------------------------"
479         @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
480         @echo "--------------------------------------------------------------"
481         @sleep 3
482 .endif
483         @echo
484 .for _kernel in ${BUILDKERNELS}
485         @echo "--------------------------------------------------------------"
486         @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
487         @echo "--------------------------------------------------------------"
488         @echo "===> ${_kernel}"
489         mkdir -p ${KRNLOBJDIR}
490 .if !defined(NO_KERNELCONFIG)
491         cd ${KRNLCONFDIR}; \
492                 PATH=${TMPPATH} \
493                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
494                         ${KERNCONFDIR}/${_kernel}
495 .endif
496 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
497         cd ${KRNLOBJDIR}/${_kernel}; \
498             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
499 .endif
500         cd ${KRNLOBJDIR}/${_kernel}; \
501             MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx/aicasm \
502             ${MAKE} -DNO_CPU_CFLAGS -f ${KRNLSRCDIR}/dev/aic7xxx/aicasm/Makefile
503         cd ${KRNLOBJDIR}/${_kernel}; \
504             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
505 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
506 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules)
507 .for target in obj depend all
508         cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
509             MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
510             ${MAKE} -DNO_CPU_CFLAGS ${target}
511 .endfor
512 .endif
513 .if !defined(NO_KERNELDEPEND)
514         cd ${KRNLOBJDIR}/${_kernel}; \
515             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
516 .endif
517         cd ${KRNLOBJDIR}/${_kernel}; \
518             ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
519         @echo "--------------------------------------------------------------"
520         @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
521         @echo "--------------------------------------------------------------"
522 .endfor
523
524 #
525 # installkernel
526 #
527 # Install the kernel defined by INSTALLKERNEL
528 #
529 installkernel reinstallkernel:
530 .if empty(INSTALLKERNEL)
531         @echo "ERROR: No kernel \"${KERNCONF}\" to install."
532         @false
533 .endif
534         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
535             ${CROSSENV} PATH=${TMPPATH} \
536             ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//}
537
538 #
539 # update
540 #
541 # Update the source tree, by running sup and/or running cvs to update to the
542 # latest copy.
543 #
544 update:
545 .if defined(SUP_UPDATE)
546         @echo "--------------------------------------------------------------"
547         @echo ">>> Running ${SUP}"
548         @echo "--------------------------------------------------------------"
549 .if defined(SUPFILE)
550         @${SUP} ${SUPFLAGS} ${SUPFILE}
551 .endif
552 .if defined(SUPFILE1)
553         @${SUP} ${SUPFLAGS} ${SUPFILE1}
554 .endif
555 .if defined(SUPFILE2)
556         @${SUP} ${SUPFLAGS} ${SUPFILE2}
557 .endif
558 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
559         @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
560 .endif
561 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
562         @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
563 .endif
564 .endif
565 .if defined(CVS_UPDATE)
566         @echo "--------------------------------------------------------------"
567         @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
568         @echo "--------------------------------------------------------------"
569         cd ${.CURDIR}; ${CVS} -R -q update -A -P -d
570 .endif
571
572 #
573 # most
574 #
575 # Build most of the user binaries on the existing system libs and includes.
576 #
577 most:
578         @echo "--------------------------------------------------------------"
579         @echo ">>> Building programs only"
580         @echo "--------------------------------------------------------------"
581 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
582         cd ${.CURDIR}/${_dir};          ${MAKE} DIRPRFX=${_dir}/ all
583 .endfor
584
585 #
586 # installmost
587 #
588 # Install the binaries built by the 'most' target.  This does not include
589 # libraries or include files.
590 #
591 installmost:
592         @echo "--------------------------------------------------------------"
593         @echo ">>> Installing programs only"
594         @echo "--------------------------------------------------------------"
595 .for _dir in bin sbin libexec usr.bin usr.sbin gnu/usr.bin gnu/usr.sbin
596         cd ${.CURDIR}/${_dir};          ${MAKE} DIRPRFX=${_dir}/ install
597 .endfor
598
599 #
600 # ------------------------------------------------------------------------
601 #
602 # From here onwards are utility targets used by the 'make world' and
603 # related targets.  If your 'world' breaks, you may like to try to fix
604 # the problem and manually run the following targets to attempt to
605 # complete the build.  Beware, this is *not* guaranteed to work, you
606 # need to have a pretty good grip on the current state of the system
607 # to attempt to manually finish it.  If in doubt, 'make world' again.
608 #
609
610 #
611 # bootstrap-tools: Build tools needed for compatibility
612 #
613 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
614 _strfile=       games/fortune/strfile
615 .endif
616
617 bootstrap-tools:
618 .for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef \
619     usr.bin/makewhatis usr.bin/rpcgen usr.bin/uudecode \
620     usr.bin/xargs usr.bin/xinstall \
621     usr.sbin/config usr.sbin/kbdcontrol \
622     gnu/usr.bin/gperf gnu/usr.bin/groff gnu/usr.bin/texinfo
623         ${ECHODIR} "===> ${_tool}"; \
624                 cd ${.CURDIR}/${_tool}; \
625                 ${MAKE} DIRPRFX=${_tool}/ obj; \
626                 ${MAKE} DIRPRFX=${_tool}/ depend; \
627                 ${MAKE} DIRPRFX=${_tool}/ all; \
628                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
629 .endfor
630
631 #
632 # build-tools: Build special purpose build tools
633 #
634 .if defined(MODULES_WITH_WORLD) && exists(${KRNLSRCDIR}/modules)
635 _aicasm= sys/modules/aic7xxx/aicasm
636 .endif
637
638 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
639 _share= share/syscons/scrnmaps
640 .endif
641
642 .if !defined(NO_FORTRAN)
643 _fortran= gnu/usr.bin/cc/f771
644 .endif
645
646 .if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
647     !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
648 _libroken4= kerberosIV/lib/libroken
649 .endif
650
651 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
652     !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
653 _libkrb5= kerberos5/lib/libroken kerberos5/lib/libvers \
654     kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
655 .endif
656
657 build-tools:
658 .for _tool in bin/csh bin/sh gnu/usr.bin/cc/cc_tools ${_fortran} \
659     ${_libroken4} ${_libkrb5} lib/libncurses ${_share} \
660     ${_aicasm} usr.bin/awk usr.bin/file usr.sbin/sysinstall
661         ${ECHODIR} "===> ${_tool}"; \
662                 cd ${.CURDIR}/${_tool}; \
663                 ${MAKE} DIRPRFX=${_tool}/ obj; \
664                 ${MAKE} DIRPRFX=${_tool}/ build-tools
665 .endfor
666
667 #
668 # cross-tools: Build cross-building tools
669 #
670 .if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
671 _elf2exe=       usr.sbin/elf2exe
672 .endif
673
674 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
675 _btxld= usr.sbin/btxld
676 .endif
677
678 .if ${TARGET_ARCH} == "sparc64"
679 _elf2aout=      usr.bin/elf2aout
680 .endif
681
682 _xlint= usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint
683
684 cross-tools:
685 .for _tool in ${_btxld} ${_elf2aout} ${_elf2exe} \
686     gnu/usr.bin/binutils usr.sbin/crunch/crunchide \
687     gnu/usr.bin/cc ${_xlint}
688         ${ECHODIR} "===> ${_tool}"; \
689                 cd ${.CURDIR}/${_tool}; \
690                 ${MAKE} DIRPRFX=${_tool}/ obj; \
691                 ${MAKE} DIRPRFX=${_tool}/ depend; \
692                 ${MAKE} DIRPRFX=${_tool}/ all; \
693                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
694 .endfor
695
696 #
697 # hierarchy - ensure that all the needed directories are present
698 #
699 hierarchy:
700         cd ${.CURDIR}/etc;              ${MAKE} distrib-dirs
701
702 #
703 # libraries - build all libraries, and install them under ${DESTDIR}.
704 #
705 # The list of libraries with dependents (${_prebuild_libs}) and their
706 # interdependencies (__L) are built automatically by the
707 # ${.CURDIR}/tools/make_libdeps.sh script.
708 #
709 libraries:
710         cd ${.CURDIR}; \
711             ${MAKE} -f Makefile.inc1 _startup_libs; \
712             ${MAKE} -f Makefile.inc1 _prebuild_libs; \
713             ${MAKE} -f Makefile.inc1 _generic_libs;
714
715 # These dependencies are not automatically generated:
716 #
717 # gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
718 # shared libraries for ELF.
719 #
720 _startup_libs=  gnu/lib/csu gnu/lib/libgcc
721 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
722 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
723 .else
724 _startup_libs+= lib/csu/${MACHINE_ARCH}
725 .endif
726
727 _prebuild_libs=
728
729 _generic_libs=  gnu/lib
730
731 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
732 _prebuild_libs+=        kerberos5/lib/libasn1
733 _prebuild_libs+=        kerberos5/lib/libgssapi
734 _prebuild_libs+=        kerberos5/lib/libkrb5
735 _prebuild_libs+=        kerberos5/lib/libroken
736 _generic_libs+= kerberos5/lib
737 .endif
738
739 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
740 _prebuild_libs+=        kerberosIV/lib/libkrb
741 kerberosIV/lib/libkrb__L: lib/libcrypt__L
742 _generic_libs+= kerberosIV/lib
743 .endif
744
745 _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libkvm lib/libmd \
746                 lib/libncurses lib/libopie lib/libpam lib/libradius \
747                 lib/librpcsvc \
748                 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
749                 lib/libz lib/msun
750
751 lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L
752 lib/libypclnt__L: lib/librpcsvc__L
753
754 _generic_libs+= lib
755
756 .if !defined(NOCRYPT) && !defined(NOSECURE)
757 .if !defined(NO_OPENSSL)
758 _prebuild_libs+=        secure/lib/libcrypto secure/lib/libssl
759 .if !defined(NO_OPENSSH)
760 _prebuild_libs+=        secure/lib/libssh
761 secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L
762 .endif
763 .endif
764 _generic_libs+= secure/lib
765 .endif
766
767 _generic_libs+= usr.bin/lex/lib
768
769 .if ${MACHINE_ARCH} == "i386"
770 _generic_libs+= usr.sbin/pcvt/keycap
771 .endif
772
773 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
774 ${_lib}__L: .PHONY
775 .if exists(${.CURDIR}/${_lib})
776         ${ECHODIR} "===> ${_lib}"; \
777                 cd ${.CURDIR}/${_lib}; \
778                 ${MAKE} DIRPRFX=${_lib}/ depend; \
779                 ${MAKE} DIRPRFX=${_lib}/ all; \
780                 ${MAKE} DIRPRFX=${_lib}/ install
781 .endif
782 .endfor
783
784 # libpam is special: we need to build static PAM modules before
785 # static PAM library, and dynamic PAM library before dynamic PAM
786 # modules.
787 lib/libpam__L: .PHONY
788         ${ECHODIR} "===> lib/libpam"; \
789                 cd ${.CURDIR}/lib/libpam; \
790                 ${MAKE} DIRPRFX=lib/libpam/ depend; \
791                 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
792                 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
793
794 _startup_libs: ${_startup_libs:S/$/__L/}
795 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
796 _generic_libs: ${_generic_libs:S/$/__L/}
797
798 .for __target in clean cleandepend cleandir depend includes obj
799 .for entry in ${SUBDIR}
800 ${entry}.${__target}__D: .PHONY
801         @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
802                 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
803                 edir=${entry}.${MACHINE_ARCH}; \
804                 cd ${.CURDIR}/$${edir}; \
805         else \
806                 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
807                 edir=${entry}; \
808                 cd ${.CURDIR}/$${edir}; \
809         fi; \
810         ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
811 .endfor
812 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
813 .endfor
814
815 .include <bsd.subdir.mk>