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