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