]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.inc1
This commit was generated by cvs2svn to compensate for changes in r75406,
[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_PORTSUPDATE do not update ports in ${MAKE} update
21 #       -DNO_DOCUPDATE do not update doc in ${MAKE} update
22 #       LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
23 #       MACHINE_ARCH="machine arch" to crossbuild world to a different arch
24
25 #
26 # The intended user-driven targets are:
27 # buildworld  - rebuild *everything*, including glue to help do upgrades
28 # installworld- install everything built by "buildworld"
29 # update      - convenient way to update your source tree (eg: sup/cvs)
30 # most        - build user commands, no libraries or include files
31 # installmost - install user commands, no libraries or include files
32 #
33 # Standard targets (not defined here) are documented in the makefiles in
34 # /usr/share/mk.  These include:
35 #               obj depend all install clean cleandepend cleanobj
36
37 # Put initial settings here.
38 SUBDIR=
39
40 # We must do share/info early so that installation of info `dir'
41 # entries works correctly.  Do it first since it is less likely to
42 # grow dependencies on include and lib than vice versa.
43 .if exists(${.CURDIR}/share/info)
44 SUBDIR+= share/info
45 .endif
46
47 # We must do include and lib early so that the perl *.ph generation
48 # works correctly as it uses the header files installed by this.
49 .if exists(${.CURDIR}/include)
50 SUBDIR+= include
51 .endif
52 .if exists(${.CURDIR}/lib)
53 SUBDIR+= lib
54 .endif
55
56 .if exists(${.CURDIR}/bin)
57 SUBDIR+= bin
58 .endif
59 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
60 SUBDIR+= games
61 .endif
62 .if exists(${.CURDIR}/gnu)
63 SUBDIR+= gnu
64 .endif
65 .if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
66     !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS4)
67 SUBDIR+= kerberosIV
68 .endif
69 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
70     !defined(NOCRYPT) && !defined(NO_OPENSSL) && defined(MAKE_KERBEROS5)
71 SUBDIR+= kerberos5
72 .endif
73 .if exists(${.CURDIR}/libexec)
74 SUBDIR+= libexec
75 .endif
76 .if exists(${.CURDIR}/sbin)
77 SUBDIR+= sbin
78 .endif
79 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
80 SUBDIR+= share
81 .endif
82 .if exists(${.CURDIR}/sys)
83 SUBDIR+= sys
84 .endif
85 .if exists(${.CURDIR}/usr.bin)
86 SUBDIR+= usr.bin
87 .endif
88 .if exists(${.CURDIR}/usr.sbin)
89 SUBDIR+= usr.sbin
90 .endif
91 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
92 SUBDIR+= secure
93 .endif
94
95 # etc must be last for "distribute" to work
96 .if exists(${.CURDIR}/etc)
97 SUBDIR+= etc
98 .endif
99
100 # These are last, since it is nice to at least get the base system
101 # rebuilt before you do them.
102 .if defined(LOCAL_DIRS)
103 .for _DIR in ${LOCAL_DIRS}
104 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
105 SUBDIR+= ${_DIR}
106 .endif
107 .endfor
108 .endif
109
110 .if defined(NOCLEANDIR)
111 CLEANDIR=       clean cleandepend
112 .else
113 CLEANDIR=       cleandir
114 .endif
115
116 SUP?=           cvsup
117 SUPFLAGS?=      -g -L 2 -P -
118 .if defined(SUPHOST)
119 SUPFLAGS+=      -h ${SUPHOST}
120 .endif
121
122 MAKEOBJDIRPREFIX?=      /usr/obj
123 TARGET_ARCH?=   ${MACHINE_ARCH}
124 BUILD_ARCH!=    sysctl -n hw.machine_arch
125 .if ${BUILD_ARCH} == ${MACHINE_ARCH}
126 OBJTREE=        ${MAKEOBJDIRPREFIX}
127 .else
128 OBJTREE=        ${MAKEOBJDIRPREFIX}/${MACHINE_ARCH}
129 .endif
130 WORLDTMP=       ${OBJTREE}${.CURDIR}/${BUILD_ARCH}
131 # /usr/games added for fortune which depend on strfile
132 STRICTTMPPATH=  ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
133 TMPPATH=        ${STRICTTMPPATH}:${PATH}
134 OBJFORMAT_PATH?=        /usr/libexec
135
136 TMPDIR?=        /tmp
137 TMPPID!=        echo $$$$
138 INSTALLTMP=     ${TMPDIR}/install.${TMPPID}
139
140 #
141 # Building a world goes through the following stages
142 #
143 # 1. bootstrap-tool stage [BMAKE]
144 #       This stage is responsible for creating programs that
145 #       are needed for backward compatibility reasons. They
146 #       are not built as cross-tools.
147 # 2. build-tool stage [TMAKE]
148 #       This stage is responsible for creating the object
149 #       tree and building any tools that are needed during
150 #       the build process.
151 # 3. cross-tool stage [XMAKE]
152 #       This stage is responsible for creating any tools that
153 #       are needed for cross-builds. A cross-compiler is one
154 #       of them.
155 # 4. world stage [WMAKE]
156 #       This stage actually builds the world.
157 # 5. install stage (optional) [IMAKE]
158 #       This stage installs a previously built world.
159 #
160
161 # Common environment for bootstrap related stages
162 BOOTSTRAPENV=   MAKEOBJDIRPREFIX=${WORLDTMP} \
163                 DESTDIR=${WORLDTMP} \
164                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
165                 MACHINE_ARCH=${BUILD_ARCH} \
166                 TOOLS_PREFIX=${WORLDTMP} \
167                 PATH=${TMPPATH}
168
169 # Common environment for world related stages
170 CROSSENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
171                 COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
172                 LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib \
173                 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
174                 PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.6.0
175
176 # bootstrap-tool stage
177 BMAKEENV=       ${BOOTSTRAPENV}
178 BMAKE=          ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DNOHTML -DNOINFO \
179                         -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED
180
181 # build-tool stage
182 TMAKEENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
183                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
184                 PATH=${TMPPATH}
185 TMAKE=          ${TMAKEENV} ${MAKE} -f Makefile.inc1
186
187 # cross-tool stage
188 XMAKEENV=       ${BOOTSTRAPENV} \
189                 TARGET_ARCH=${MACHINE_ARCH}
190 XMAKE=          ${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNO_FORTRAN -DNO_GDB \
191                         -DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE \
192                         -DNOSHARED
193
194 # world stage
195 WMAKEENV=       ${CROSSENV} \
196                 DESTDIR=${WORLDTMP} \
197                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
198                 PATH=${TMPPATH}
199 WMAKE=          ${WMAKEENV} ${MAKE} -f Makefile.inc1
200
201 # install stage
202 IMAKEENV=       ${CROSSENV} \
203                 PATH=${STRICTTMPPATH}:${INSTALLTMP}
204 IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1
205
206 # kernel stage
207 KMAKEENV=       ${WMAKEENV} \
208                 OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:${OBJFORMAT_PATH}
209
210 USRDIRS=        usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
211                 usr/libexec/${OBJFORMAT} usr/sbin usr/share/misc
212
213 INCDIRS=        arpa g++/std objc protocols readline rpc rpcsvc openssl \
214                 security ss
215
216 #
217 # buildworld
218 #
219 # Attempt to rebuild the entire system, with reasonable chance of
220 # success, regardless of how old your existing system is.
221 #
222 buildworld:
223         @echo
224         @echo "--------------------------------------------------------------"
225         @echo ">>> Rebuilding the temporary build tree"
226         @echo "--------------------------------------------------------------"
227 .if !defined(NOCLEAN)
228         rm -rf ${WORLDTMP}
229 .else
230         for dir in bin games include lib sbin; do \
231                 rm -rf ${WORLDTMP}/usr/$$dir; \
232         done
233         # XXX - Work-around for broken cc/cc_tools/Makefile.
234         # This is beyond dirty...
235         rm -f ${OBJTREE}${.CURDIR}/gnu/usr.bin/cc/cc_tools/.depend
236 .endif
237 .for _dir in ${USRDIRS}
238         mkdir -p ${WORLDTMP}/${_dir}
239 .endfor
240 .for _dir in ${INCDIRS}
241         mkdir -p ${WORLDTMP}/usr/include/${_dir}
242 .endfor
243         ln -sf ${.CURDIR}/sys ${WORLDTMP}
244         @echo
245         @echo "--------------------------------------------------------------"
246         @echo ">>> stage 1: bootstrap tools"
247         @echo "--------------------------------------------------------------"
248         cd ${.CURDIR}; ${BMAKE} bootstrap-tools
249 .if !defined(NOCLEAN)
250         @echo
251         @echo "--------------------------------------------------------------"
252         @echo ">>> stage 2: cleaning up the object tree"
253         @echo "--------------------------------------------------------------"
254         cd ${.CURDIR}; ${TMAKE} ${CLEANDIR:S/^/par-/}
255 .endif
256         @echo
257         @echo "--------------------------------------------------------------"
258         @echo ">>> stage 2: rebuilding the object tree"
259         @echo "--------------------------------------------------------------"
260         cd ${.CURDIR}; ${TMAKE} par-obj
261         @echo
262         @echo "--------------------------------------------------------------"
263         @echo ">>> stage 2: build tools"
264         @echo "--------------------------------------------------------------"
265         cd ${.CURDIR}; ${TMAKE} build-tools
266         @echo
267         @echo "--------------------------------------------------------------"
268         @echo ">>> stage 3: cross tools"
269         @echo "--------------------------------------------------------------"
270         cd ${.CURDIR}; ${XMAKE} cross-tools
271         @echo
272         @echo "--------------------------------------------------------------"
273         @echo ">>> stage 4: populating ${WORLDTMP}/usr/include"
274         @echo "--------------------------------------------------------------"
275         cd ${.CURDIR}; ${WMAKE} SHARED=symlinks includes
276         @echo
277         @echo "--------------------------------------------------------------"
278         @echo ">>> stage 4: building libraries"
279         @echo "--------------------------------------------------------------"
280         cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries
281         @echo
282         @echo "--------------------------------------------------------------"
283         @echo ">>> stage 4: make dependencies"
284         @echo "--------------------------------------------------------------"
285         cd ${.CURDIR}; ${WMAKE} par-depend
286         @echo
287         @echo "--------------------------------------------------------------"
288         @echo ">>> stage 4: building everything.."
289         @echo "--------------------------------------------------------------"
290         cd ${.CURDIR}; ${WMAKE} all
291
292 everything:
293         @echo "--------------------------------------------------------------"
294         @echo ">>> Building everything.."
295         @echo "--------------------------------------------------------------"
296         cd ${.CURDIR}; ${WMAKE} all
297
298 #
299 # installworld
300 #
301 # Installs everything compiled by a 'buildworld'.
302 #
303 installworld:
304         mkdir -p ${INSTALLTMP}
305         for prog in [ awk cat chflags chmod chown date echo egrep find grep \
306             install ln make makewhatis mtree mv perl rm sed sh sysctl \
307             test true uname wc zic; do \
308                 cp `which $$prog` ${INSTALLTMP}; \
309         done
310         cd ${.CURDIR}; ${IMAKE} reinstall
311         rm -rf ${INSTALLTMP}
312
313 #
314 # reinstall
315 #
316 # If you have a build server, you can NFS mount the source and obj directories
317 # and do a 'make reinstall' on the *client* to install new binaries from the
318 # most recent server build.
319 #
320 reinstall:
321         @echo "--------------------------------------------------------------"
322         @echo ">>> Making hierarchy"
323         @echo "--------------------------------------------------------------"
324         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
325         @echo
326         @echo "--------------------------------------------------------------"
327         @echo ">>> Installing everything.."
328         @echo "--------------------------------------------------------------"
329         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
330 .if !defined(NOMAN)
331         @echo
332         @echo "--------------------------------------------------------------"
333         @echo ">>> Rebuilding man page indices"
334         @echo "--------------------------------------------------------------"
335         cd ${.CURDIR}/share/man; ${MAKE} makedb
336 .endif
337
338 #
339 # distribworld
340 #
341 # Front-end to distribute to make sure the search path contains
342 # the object directory. Needed for miniperl.
343 #
344 distribworld:
345         cd ${.CURDIR}; PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 distribute
346
347 #
348 # buildkernel and installkernel
349 #
350 # Which kernels to build and/or install is specified by setting
351 # KERNCONF. If not defined a GENERIC kernel is built/installed.
352 # Only the existing (depending MACHINE) config files are used
353 # for building kernels and only the first of these is designated
354 # as the one being installed.
355 #
356 # Note that we have to use MACHINE instead of MACHINE_ARCH when
357 # we're in kernel-land. Since only MACHINE_ARCH is (expected) to
358 # be set to cross-build, we have to make sure MACHINE is set
359 # properly.
360
361 .if !defined(KERNCONF) && defined(KERNEL)
362 KERNCONF=       ${KERNEL}
363 KERNWARN=       yes
364 .else
365 KERNCONF?=      GENERIC
366 .endif
367 INSTKERNNAME?=  kernel
368
369 # The only exotic MACHINE_ARCH/MACHINE combination valid at this
370 # time is i386/pc98. In all other cases set MACHINE equal to
371 # MACHINE_ARCH.
372 .if ${MACHINE_ARCH} != "i386" || ${MACHINE} != "pc98"
373 MACHINE=        ${MACHINE_ARCH}
374 .endif
375
376 KRNLSRCDIR=     ${.CURDIR}/sys
377 KRNLCONFDIR=    ${KRNLSRCDIR}/${MACHINE}/conf
378 KRNLOBJDIR=     ${OBJTREE}${KRNLSRCDIR}
379
380 BUILDKERNELS=
381 INSTALLKERNEL=
382 .for _kernel in ${KERNCONF}
383 .if exists(${KRNLCONFDIR}/${_kernel})
384 BUILDKERNELS+=  ${_kernel}
385 .if empty(INSTALLKERNEL)
386 INSTALLKERNEL= ${_kernel}
387 .endif
388 .endif
389 .endfor
390
391 #
392 # buildkernel
393 #
394 # Builds all kernels defined by BUILDKERNELS.
395 #
396 buildkernel:
397 .if empty(BUILDKERNELS)
398         @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})."
399         @false
400 .endif
401 .if defined(KERNWARN)
402         @echo "--------------------------------------------------------------"
403         @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
404         @echo "--------------------------------------------------------------"
405         @sleep 3
406 .endif
407         @echo
408 .for _kernel in ${BUILDKERNELS}
409         @echo "--------------------------------------------------------------"
410         @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
411         @echo "--------------------------------------------------------------"
412         @echo "===> ${_kernel}"
413         mkdir -p ${KRNLOBJDIR}
414 .if !defined(NO_KERNELCONFIG)
415         cd ${KRNLCONFDIR}; \
416                 PATH=${TMPPATH} \
417                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} ${_kernel}
418 .endif
419 .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
420         cd ${KRNLOBJDIR}/${_kernel}; \
421             ${KMAKEENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} clean
422 .endif
423         cd ${KRNLOBJDIR}/${_kernel}; \
424                 MAKESRCPATH=${KRNLSRCDIR}/dev/aic7xxx/aicasm \
425                     ${MAKE} -f ${KRNLSRCDIR}/dev/aic7xxx/aicasm/Makefile
426 .if !defined(NO_KERNELDEPEND)
427         cd ${KRNLOBJDIR}/${_kernel}; \
428             ${KMAKEENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} depend
429 .endif
430         cd ${KRNLOBJDIR}/${_kernel}; \
431             ${KMAKEENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} all
432         @echo "--------------------------------------------------------------"
433         @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
434         @echo "--------------------------------------------------------------"
435 .endfor
436
437 #
438 # installkernel
439 #
440 # Install the kernel defined by INSTALLKERNEL
441 #
442 installkernel:
443         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
444             ${CROSSENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} install
445 reinstallkernel:
446         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
447             ${CROSSENV} MACHINE=${MACHINE} ${MAKE} KERNEL=${INSTKERNNAME} reinstall
448
449 #
450 # kernel
451 #
452 # Short hand for `make buildkernel installkernel'
453 #
454 kernel: buildkernel installkernel
455
456 #
457 # update
458 #
459 # Update the source tree, by running sup and/or running cvs to update to the
460 # latest copy.
461 #
462 update:
463 .if defined(SUP_UPDATE)
464         @echo "--------------------------------------------------------------"
465         @echo ">>> Running ${SUP}"
466         @echo "--------------------------------------------------------------"
467 .if defined(SUPFILE)
468         @${SUP} ${SUPFLAGS} ${SUPFILE}
469 .endif
470 .if defined(SUPFILE1)
471         @${SUP} ${SUPFLAGS} ${SUPFILE1}
472 .endif
473 .if defined(SUPFILE2)
474         @${SUP} ${SUPFLAGS} ${SUPFILE2}
475 .endif
476 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
477         @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
478 .endif
479 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
480         @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
481 .endif
482 .endif
483 .if defined(CVS_UPDATE)
484         @echo "--------------------------------------------------------------"
485         @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
486         @echo "--------------------------------------------------------------"
487         cd ${.CURDIR}; cvs -q update -A -P -d
488 .endif
489
490 #
491 # most
492 #
493 # Build most of the user binaries on the existing system libs and includes.
494 #
495 most:
496         @echo "--------------------------------------------------------------"
497         @echo ">>> Building programs only"
498         @echo "--------------------------------------------------------------"
499         cd ${.CURDIR}/bin;              ${MAKE} all
500         cd ${.CURDIR}/sbin;             ${MAKE} all
501         cd ${.CURDIR}/libexec;          ${MAKE} all
502         cd ${.CURDIR}/usr.bin;          ${MAKE} all
503         cd ${.CURDIR}/usr.sbin;         ${MAKE} all
504         cd ${.CURDIR}/gnu/libexec;      ${MAKE} all
505         cd ${.CURDIR}/gnu/usr.bin;      ${MAKE} all
506         cd ${.CURDIR}/gnu/usr.sbin;     ${MAKE} all
507
508 #
509 # installmost
510 #
511 # Install the binaries built by the 'most' target.  This does not include
512 # libraries or include files.
513 #
514 installmost:
515         @echo "--------------------------------------------------------------"
516         @echo ">>> Installing programs only"
517         @echo "--------------------------------------------------------------"
518         cd ${.CURDIR}/bin;              ${MAKE} install
519         cd ${.CURDIR}/sbin;             ${MAKE} install
520         cd ${.CURDIR}/libexec;          ${MAKE} install
521         cd ${.CURDIR}/usr.bin;          ${MAKE} install
522         cd ${.CURDIR}/usr.sbin;         ${MAKE} install
523         cd ${.CURDIR}/gnu/libexec;      ${MAKE} install
524         cd ${.CURDIR}/gnu/usr.bin;      ${MAKE} install
525         cd ${.CURDIR}/gnu/usr.sbin;     ${MAKE} install
526
527 #
528 # ------------------------------------------------------------------------
529 #
530 # From here onwards are utility targets used by the 'make world' and
531 # related targets.  If your 'world' breaks, you may like to try to fix
532 # the problem and manually run the following targets to attempt to
533 # complete the build.  Beware, this is *not* guaranteed to work, you
534 # need to have a pretty good grip on the current state of the system
535 # to attempt to manually finish it.  If in doubt, 'make world' again.
536 #
537
538 #
539 # bootstrap-tools: Build tools needed for compatibility
540 #
541 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
542 _strfile=       games/fortune/strfile
543 .endif
544
545 bootstrap-tools:
546 .for _tool in ${_strfile} usr.bin/yacc usr.bin/colldef usr.sbin/config \
547     gnu/usr.bin/gperf gnu/usr.bin/texinfo
548         cd ${.CURDIR}/${_tool}; \
549                 ${MAKE} obj; \
550                 ${MAKE} depend; \
551                 ${MAKE} all; \
552                 ${MAKE} install
553 .endfor
554
555 #
556 # build-tools: Build special purpose build tools
557 #
558 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
559 _games= games/adventure games/hack games/phantasia
560 .endif
561
562 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
563 _share= share/syscons/scrnmaps
564 .endif
565
566 .if !defined(NO_FORTRAN)
567 _fortran= gnu/usr.bin/cc/f771
568 .endif
569
570 .if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
571     !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
572 _libroken4= kerberosIV/lib/libroken
573 .endif
574
575 .if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
576     !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
577 _libkrb5= kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl
578 .endif
579
580 build-tools:
581 .for _tool in bin/csh bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \
582     ${_libroken4} ${_libkrb5} lib/libncurses ${_share} usr.sbin/sysinstall
583         cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
584 .endfor
585
586 #
587 # cross-tools: Build cross-building tools
588 #
589 # WARNING: Because the bootstrap tools are expected to run on the
590 # build-machine, MACHINE_ARCH is *always* set to BUILD_ARCH when this
591 # target is being made. TARGET_ARCH is *always* set to reflect the
592 # target-machine (which you can set by specifying MACHINE_ARCH on
593 # make's command-line, get it?).
594 # The reason is simple: we build these tools not to be run on the
595 # architecture we're cross-building, but on the architecture we're
596 # currently building on (ie the host-machine) and we expect these
597 # tools to produce output for the architecture we're trying to
598 # cross-build.
599 #
600 .if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
601 _elf2exe=       usr.sbin/elf2exe
602 .endif
603
604 .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386"
605 _btxld= usr.sbin/btxld
606 .endif
607
608 .if !defined(NOPERL)
609 _perl=  gnu/usr.bin/perl/libperl gnu/usr.bin/perl/miniperl
610 .endif
611
612 cross-tools:
613 .for _tool in ${_btxld} ${_elf2exe} ${_perl} \
614     usr.bin/gensetdefs gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc
615         cd ${.CURDIR}/${_tool}; \
616                 ${MAKE} obj; \
617                 ${MAKE} depend; \
618                 ${MAKE} all; \
619                 ${MAKE} install
620 .endfor
621
622 #
623 # hierarchy - ensure that all the needed directories are present
624 #
625 hierarchy:
626         cd ${.CURDIR}/etc;              ${MAKE} distrib-dirs
627
628 #
629 # includes - possibly generate and install the include files.
630 #
631 includes:
632         cd ${.CURDIR}/include;                  ${MAKE} -B all install
633         cd ${.CURDIR}/gnu/include;              ${MAKE} install
634         cd ${.CURDIR}/gnu/lib/libmp;            ${MAKE} beforeinstall
635         cd ${.CURDIR}/gnu/lib/libobjc;          ${MAKE} beforeinstall
636         cd ${.CURDIR}/gnu/lib/libreadline/readline;     ${MAKE} beforeinstall
637         cd ${.CURDIR}/gnu/lib/libregex;         ${MAKE} beforeinstall
638         cd ${.CURDIR}/gnu/lib/libstdc++;        ${MAKE} beforeinstall
639         cd ${.CURDIR}/gnu/lib/libdialog;        ${MAKE} beforeinstall
640         cd ${.CURDIR}/gnu/lib/libgmp;           ${MAKE} beforeinstall
641         cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus;   ${MAKE} beforeinstall
642 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
643 .if exists(${.CURDIR}/secure/lib/libcrypto)
644         cd ${.CURDIR}/secure/lib/libcrypto;     ${MAKE} beforeinstall
645 .endif
646 .if exists(${.CURDIR}/secure/lib/libssl)
647         cd ${.CURDIR}/secure/lib/libssl;        ${MAKE} beforeinstall
648 .endif
649 .endif
650 .if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
651     defined(MAKE_KERBEROS4)
652         cd ${.CURDIR}/kerberosIV/lib/libacl;    ${MAKE} beforeinstall
653         cd ${.CURDIR}/kerberosIV/lib/libkadm;   ${MAKE} beforeinstall
654         cd ${.CURDIR}/kerberosIV/lib/libkafs;   ${MAKE} beforeinstall
655         cd ${.CURDIR}/kerberosIV/lib/libkdb;    ${MAKE} beforeinstall
656         cd ${.CURDIR}/kerberosIV/lib/libkrb;    ${MAKE} beforeinstall
657         cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
658 .else
659         cd ${.CURDIR}/lib/libtelnet;            ${MAKE} beforeinstall
660 .endif
661 .if exists(${.CURDIR}/kerberos5) && !defined(NOCRYPT) && \
662     defined(MAKE_KERBEROS5)
663         cd ${.CURDIR}/kerberos5/lib/libasn1;            ${MAKE} beforeinstall
664         cd ${.CURDIR}/kerberos5/lib/libhdb;             ${MAKE} beforeinstall
665         cd ${.CURDIR}/kerberos5/lib/libkadm5clnt;       ${MAKE} beforeinstall
666         cd ${.CURDIR}/kerberos5/lib/libkadm5srv;        ${MAKE} beforeinstall
667         cd ${.CURDIR}/kerberos5/lib/libkafs5;           ${MAKE} beforeinstall
668         cd ${.CURDIR}/kerberos5/lib/libkrb5;            ${MAKE} beforeinstall
669         cd ${.CURDIR}/kerberos5/lib/libsl;              ${MAKE} beforeinstall
670 .endif
671 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
672         cd ${.CURDIR}/lib/csu/${MACHINE_ARCH};  ${MAKE} beforeinstall
673 .endif
674         cd ${.CURDIR}/gnu/lib/csu;              ${MAKE} beforeinstall
675         cd ${.CURDIR}/lib/libalias;             ${MAKE} beforeinstall
676         cd ${.CURDIR}/lib/libatm;               ${MAKE} beforeinstall
677         cd ${.CURDIR}/lib/libdevstat;           ${MAKE} beforeinstall
678         cd ${.CURDIR}/lib/libc;                 ${MAKE} beforeinstall
679         cd ${.CURDIR}/lib/libcalendar;          ${MAKE} beforeinstall
680         cd ${.CURDIR}/lib/libcam;               ${MAKE} beforeinstall
681         cd ${.CURDIR}/lib/libdisk;              ${MAKE} beforeinstall
682         cd ${.CURDIR}/lib/libedit;              ${MAKE} beforeinstall
683         cd ${.CURDIR}/lib/libfetch;             ${MAKE} beforeinstall
684         cd ${.CURDIR}/lib/libftpio;             ${MAKE} beforeinstall
685         cd ${.CURDIR}/lib/libkvm;               ${MAKE} beforeinstall
686         cd ${.CURDIR}/lib/libmd;                ${MAKE} beforeinstall
687 .if !defined(WANT_CSRG_LIBM)
688         cd ${.CURDIR}/lib/msun;                 ${MAKE} beforeinstall
689 .endif
690         cd ${.CURDIR}/lib/libncp;               ${MAKE} beforeinstall
691         cd ${.CURDIR}/lib/libncurses;           ${MAKE} beforeinstall
692         cd ${.CURDIR}/lib/libnetgraph;          ${MAKE} beforeinstall
693         cd ${.CURDIR}/lib/libopie;              ${MAKE} beforeinstall
694         cd ${.CURDIR}/lib/libpam/libpam;        ${MAKE} beforeinstall
695         cd ${.CURDIR}/lib/libpcap;              ${MAKE} beforeinstall
696         cd ${.CURDIR}/lib/libradius;            ${MAKE} beforeinstall
697         cd ${.CURDIR}/lib/librpcsvc;            ${MAKE} beforeinstall
698         cd ${.CURDIR}/lib/libsbuf;              ${MAKE} beforeinstall
699         cd ${.CURDIR}/lib/libskey;              ${MAKE} beforeinstall
700         cd ${.CURDIR}/lib/libstand;             ${MAKE} beforeinstall
701         cd ${.CURDIR}/lib/libtacplus;           ${MAKE} beforeinstall
702         cd ${.CURDIR}/lib/libcom_err;           ${MAKE} beforeinstall
703         cd ${.CURDIR}/lib/libss;                ${MAKE} -B hdrs beforeinstall
704         cd ${.CURDIR}/lib/libutil;              ${MAKE} beforeinstall
705         cd ${.CURDIR}/lib/libvgl;               ${MAKE} beforeinstall
706         cd ${.CURDIR}/lib/libwrap;              ${MAKE} beforeinstall
707         cd ${.CURDIR}/lib/libz;                 ${MAKE} beforeinstall
708         cd ${.CURDIR}/usr.bin/lex;              ${MAKE} beforeinstall
709
710 #
711 # libraries - build all libraries, and install them under ${DESTDIR}.
712 #
713 # The following dependencies exist between the libraries:
714 #
715 # lib*: csu libgcc_pic
716 # libatm: libmd
717 # libcam: libsbuf
718 # libcrypt: libmd
719 # libdialog: libncurses
720 # libedit: libncurses
721 # libg++: libm
722 # libkrb: libcrypt
723 # libopie: libmd
724 # libpam: libcom_err libcrypt libcrypto libkrb libopie libradius \
725 #         libskey libtacplus libutil libz libssh
726 # libradius: libmd
727 # libreadline: libncurses
728 # libskey: libcrypt libmd
729 # libss: libcom_err
730 # libstc++: libm
731 # libtacplus: libmd
732 #
733 # Across directories this comes down to (rougly):
734 #
735 # gnu/lib: lib/libm lib/libncurses
736 # kerberosIV/lib kerberos5/lib: lib/libcrypt
737 # lib/libpam: secure/lib/libcrypto kerberosIV/lib/libkrb \
738 #             secure/lib/libssh lib/libz
739 # secure/lib: lib/libmd
740 #
741 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
742 _csu=   lib/csu/${MACHINE_ARCH}.pcc
743 .elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf"
744 _csu=   lib/csu/i386-elf
745 .else
746 _csu=   lib/csu/${MACHINE_ARCH}
747 .endif
748
749 .if !defined(NOSECURE) && !defined(NOCRYPT)
750 _secure_lib=    secure/lib
751 .endif
752
753 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
754 _kerberosIV_lib=        kerberosIV/lib
755 .endif
756
757 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS5)
758 _kerberos5_lib= kerberos5/lib
759 .endif
760
761 .if defined(WANT_CSRG_LIBM)
762 _libm=  lib/libm
763 .else
764 _libm=  lib/msun
765 .endif
766
767 .if ${MACHINE_ARCH} == "i386"
768 _libkeycap=     usr.sbin/pcvt/keycap
769 .endif
770
771 .if !defined(NOPERL)
772 _libperl=       gnu/usr.bin/perl/libperl
773 .endif
774
775 libraries:
776 .for _lib in ${_csu} gnu/lib/csu gnu/lib/libgcc lib/libmd lib/libcrypt \
777     ${_secure_lib} ${_kerberosIV_lib} \
778     ${_kerberos5_lib} lib/libcom_err ${_libm} lib/libncurses \
779     lib/libopie lib/libradius lib/libsbuf lib/libskey lib/libtacplus \
780     lib/libutil lib/libz lib gnu/lib ${_libperl} usr.bin/lex/lib ${_libkeycap}
781 .if exists(${.CURDIR}/${_lib})
782         cd ${.CURDIR}/${_lib}; \
783                 ${MAKE} depend; \
784                 ${MAKE} all; \
785                 ${MAKE} install
786 .endif
787 .endfor
788
789 .for __target in clean cleandepend cleandir depend obj
790 .for entry in ${SUBDIR}
791 ${entry}.${__target}__D: .PHONY
792         @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
793                 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
794                 edir=${entry}.${MACHINE_ARCH}; \
795                 cd ${.CURDIR}/$${edir}; \
796         else \
797                 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
798                 edir=${entry}; \
799                 cd ${.CURDIR}/$${edir}; \
800         fi; \
801         ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
802 .endfor
803 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
804 .endfor
805
806 .include <bsd.subdir.mk>