]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.inc1
This commit was generated by cvs2svn to compensate for changes in r48114,
[FreeBSD/FreeBSD.git] / Makefile.inc1
1 #
2 #       $Id: Makefile.inc1,v 1.77 1999/06/01 02:55:44 billf Exp $
3 #
4 # Make command line options:
5 #       -DCLOBBER will remove /usr/include
6 #       -DMAKE_KERBEROS4 to build KerberosIV
7 #       -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
8 #       -DNOCLEAN do not clean at all
9 #       -DNOTOOLS do not rebuild any tools first
10 #       -DNOCRYPT will prevent building of crypt versions
11 #       -DNOPROFILE do not build profiled libraries
12 #       -DNOSECURE do not go into secure subdir
13 #       -DNOGAMES do not go into games subdir
14 #       -DNOSHARE do not go into share subdir
15 #       -DNOINFO do not make or install info files
16 #       -DNOLIBC_R do not build libc_r.
17 #       -DNO_FORTRAN do not build g77 and related libraries.
18 #       LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
19
20 #
21 # The intended user-driven targets are:
22 # buildworld  - rebuild *everything*, including glue to help do upgrades
23 # installworld- install everything built by "buildworld"
24 # update      - convenient way to update your source tree (eg: sup/cvs)
25 # most        - build user commands, no libraries or include files
26 # installmost - install user commands, no libraries or include files
27 #
28 # Standard targets (not defined here) are documented in the makefiles in
29 # /usr/share/mk.  These include:
30 #               obj depend all install clean cleandepend cleanobj
31
32 # Put initial settings here.
33 SUBDIR=
34
35 # We must do share/info early so that installation of info `dir'
36 # entries works correctly.  Do it first since it is less likely to
37 # grow dependencies on include and lib than vice versa.
38 .if exists(${.CURDIR}/share/info)
39 SUBDIR+= share/info
40 .endif
41
42 # We must do include and lib early so that the perl *.ph generation
43 # works correctly as it uses the header files installed by this.
44 .if exists(${.CURDIR}/include)
45 SUBDIR+= include
46 .endif
47 .if exists(${.CURDIR}/lib)
48 SUBDIR+= lib
49 .endif
50
51 .if exists(${.CURDIR}/bin)
52 SUBDIR+= bin
53 .endif
54 .if exists(${.CURDIR}/games) && !defined(NOGAMES)
55 SUBDIR+= games
56 .endif
57 .if exists(${.CURDIR}/gnu)
58 SUBDIR+= gnu
59 .endif
60 .if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \
61     !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
62 SUBDIR+= kerberosIV
63 .endif
64 .if exists(${.CURDIR}/libexec)
65 SUBDIR+= libexec
66 .endif
67 .if exists(${.CURDIR}/sbin)
68 SUBDIR+= sbin
69 .endif
70 .if exists(${.CURDIR}/share) && !defined(NOSHARE)
71 SUBDIR+= share
72 .endif
73 .if exists(${.CURDIR}/sys)
74 SUBDIR+= sys
75 .endif
76 .if exists(${.CURDIR}/usr.bin)
77 SUBDIR+= usr.bin
78 .endif
79 .if exists(${.CURDIR}/usr.sbin)
80 SUBDIR+= usr.sbin
81 .endif
82 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE)
83 SUBDIR+= secure
84 .endif
85
86 # etc must be last for "distribute" to work
87 .if exists(${.CURDIR}/etc)
88 SUBDIR+= etc
89 .endif
90
91 # These are last, since it is nice to at least get the base system
92 # rebuilt before you do them.
93 .if defined(LOCAL_DIRS)
94 .for _DIR in ${LOCAL_DIRS}
95 .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile)
96 SUBDIR+= ${_DIR}
97 .endif
98 .endfor
99 .endif
100
101 OBJDIR=         obj
102
103 .if defined(NOCLEAN)
104 CLEANDIR=
105 .else
106 .if defined(NOCLEANDIR)
107 CLEANDIR=       clean cleandepend
108 .else
109 CLEANDIR=       cleandir
110 .endif
111 .endif
112
113 .if !defined(NOCLEAN)
114 _NODEPEND=      true
115 .endif
116 .if defined(_NODEPEND)
117 _DEPEND=        cleandepend
118 .else
119 _DEPEND=        depend
120 .endif
121
122 SUP?=           cvsup
123 SUPFLAGS?=      -g -L 2 -P -
124
125 #
126 # While building tools for bootstrapping, we don't need to waste time on
127 # shared or profiled libraries, shared linkage, or documentation, except
128 # when the tools won't get cleaned we must use the defaults for shared
129 # libraries and shared linkage (and this doesn't waste time).
130 # XXX actually, we do need to waste time building shared libraries.
131 #
132 .if defined(NOCLEAN)
133 MK_FLAGS=       -DWORLD -DNOINFO -DNOMAN         -DNOPROFILE
134 .else
135 MK_FLAGS=       -DWORLD -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED
136 .endif
137
138 #
139 # Define the location of the temporary installation directory. Note that
140 # MAKEOBJDIRPREFIX normally isn't defined so if the current directory is
141 # /usr/src, then the world temporary directory is /usr/obj/usr/src/tmp.
142 #
143 # During the transition from aout to elf format on i386, MAKEOBJDIRPREFIX
144 # is set by the parent makefile (Makefile.inc0) to be /usr/obj/${OBJFORMAT}
145 # in order to keep aout and elf format files apart.
146 #
147 .if defined(MAKEOBJDIRPREFIX)
148 WORLDTMP=       ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
149 .else
150 WORLDTMP=       /usr/obj${.CURDIR}/tmp
151 .endif
152
153 #
154 # Define the PATH to the build tools.
155 #
156 # If not building tools, the PATH always points to the installed binaries.
157 # The NOTOOLS option assumes that in installed tools are good enough and that
158 # the user's PATH will locate to appropriate tools. This option is required
159 # for a cross-compiled build environment.
160 #
161 # If building tools, then the PATH includes the world temporary directories
162 # so that the bootstrapped tools are used as soon as they are built. The
163 # strict path is for use after all tools are supposed to have been
164 # bootstrapped. It doesn't allow any of the installed tools to be used.
165 #
166 .if     defined(NOTOOLS)
167 # Default root of the tool tree
168 TOOLROOT?=      
169 # Choose the PATH relative to the root of the tool tree
170 PATH=           ${TOOLROOT}/sbin:${TOOLROOT}/bin:${TOOLROOT}/usr/sbin:${TOOLROOT}/usr/bin
171 .else
172 TOOLROOT=       ${WORLDTMP}
173 .endif
174 STRICTTMPPATH=  ${TOOLROOT}/sbin:${TOOLROOT}/usr/sbin:${TOOLROOT}/bin:${TOOLROOT}/usr/bin
175 TMPPATH=        ${STRICTTMPPATH}:${PATH}
176
177 # XXX COMPILER_PATH is needed for finding cc1, ld and as
178 # XXX GCC_EXEC_PREFIX is for *crt.o.  It is probably unnecessary now
179 #       that LIBRARY_PATH is set.  We still can't use -nostdlib, since gcc
180 #       wouldn't link *crt.o or libgcc if it were used.
181 # XXX LD_LIBRARY_PATH is for ld.so.  It is also used by ld, although we don't
182 #       want that - all compile-time library paths should be resolved by gcc.
183 #       It fails for set[ug]id executables (are any used?).
184 COMPILER_ENV=   BISON_SIMPLE=${TOOLROOT}/usr/share/misc/bison.simple \
185                 COMPILER_PATH=${TOOLROOT}/usr/libexec:${TOOLROOT}/usr/bin \
186                 GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \
187                 LD_LIBRARY_PATH=${TOOLROOT}${SHLIBDIR} \
188                 LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
189
190 BMAKEENV=       PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t \
191                 OBJFORMAT_PATH=${TOOLROOT}/usr/libexec:/usr/libexec
192 XMAKEENV=       PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
193                 PERL5LIB=${DESTDIR}/usr/libdata/perl/5.00503 \
194                 OBJFORMAT_PATH=${TOOLROOT}/usr/libexec \
195                 CFLAGS="-nostdinc ${CFLAGS}"    # XXX -nostdlib
196
197 # used to compile and install 'make' in temporary build tree
198 MAKETMP=        ${WORLDTMP}/make
199 IBMAKE= ${BMAKEENV} MAKEOBJDIR=${MAKETMP} ${MAKE} DESTDIR=${WORLDTMP}
200
201 .if     defined(NOTOOLS)
202 # bootstrap make
203 BMAKE=  ${BMAKEENV} ${MAKE} DESTDIR=${WORLDTMP}
204 # cross make used for compilation
205 XMAKE=  ${XMAKEENV} ${MAKE} DESTDIR=${WORLDTMP}
206 # cross make used for final installation
207 IXMAKE= ${XMAKEENV} ${MAKE}
208 .else
209 # bootstrap make
210 BMAKE=  ${BMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
211 # cross make used for compilation
212 XMAKE=  ${XMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP}
213 # cross make used for final installation
214 IXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make
215 .endif
216
217 #
218 # buildworld
219 #
220 # Attempt to rebuild the entire system, with reasonable chance of
221 # success, regardless of how old your existing system is.
222 #
223 buildworld: check-objformat
224 .if !defined(NOCLEAN)
225         @echo
226         @echo "--------------------------------------------------------------"
227         @echo ">>> Cleaning up the temporary ${OBJFORMAT} build tree"
228         @echo "--------------------------------------------------------------"
229         mkdir -p ${WORLDTMP}
230         -chflags -R noschg ${WORLDTMP}/
231         rm -rf ${WORLDTMP}
232 .endif
233 .if !defined(NOTOOLS)
234         @echo
235         @echo "--------------------------------------------------------------"
236         @echo ">>> Making make"
237         @echo "--------------------------------------------------------------"
238         mkdir -p ${WORLDTMP}/usr/bin ${MAKETMP}
239         ( \
240         cd ${.CURDIR}/usr.bin/make; \
241                 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
242                 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \
243                 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \
244                 ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \
245         )
246         @echo
247         @echo "--------------------------------------------------------------"
248         @echo ">>> Making mtree"
249         @echo "--------------------------------------------------------------"
250         mkdir -p ${WORLDTMP}/usr/sbin ${WORLDTMP}/mtree
251         ( \
252         cd ${.CURDIR}/usr.sbin/mtree; \
253                 MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \
254                 export MAKEOBJDIR=${WORLDTMP}/mtree; \
255                 ${BMAKE} ${MK_FLAGS} all; \
256                 ${BMAKE} ${MK_FLAGS} -B install clean \
257         )
258 .endif
259         @echo
260         @echo "--------------------------------------------------------------"
261         @echo ">>> Making hierarchy"
262         @echo "--------------------------------------------------------------"
263         mkdir -p ${WORLDTMP}
264         cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 hierarchy
265 .if !defined(NOCLEAN)
266         @echo
267         @echo "--------------------------------------------------------------"
268         @echo ">>> Cleaning up the ${OBJFORMAT} obj tree"
269         @echo "--------------------------------------------------------------"
270         cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
271 .endif
272         @echo
273         @echo "--------------------------------------------------------------"
274         @echo ">>> Rebuilding the ${OBJFORMAT} obj tree"
275         @echo "--------------------------------------------------------------"
276         cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 par-${OBJDIR}
277 .if !defined(NOTOOLS)
278         @echo
279         @echo "--------------------------------------------------------------"
280         @echo ">>> Rebuilding ${OBJFORMAT} bootstrap tools"
281         @echo "--------------------------------------------------------------"
282         cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 bootstrap
283         @echo
284         @echo "--------------------------------------------------------------"
285         @echo ">>> Rebuilding tools necessary to build the include files"
286         @echo "--------------------------------------------------------------"
287         cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 include-tools
288 .endif
289         @echo
290         @echo "--------------------------------------------------------------"
291         @echo ">>> Rebuilding ${DESTDIR}/usr/include"
292         @echo "--------------------------------------------------------------"
293         cd ${.CURDIR}; SHARED=copies ${BMAKE} -f Makefile.inc1 includes
294         @echo
295         @echo "--------------------------------------------------------------"
296         @echo ">>> Rebuilding bootstrap libraries"
297         @echo "--------------------------------------------------------------"
298         cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 bootstrap-libraries
299 .if !defined(NOTOOLS)
300         @echo
301         @echo "--------------------------------------------------------------"
302         @echo ">>> Rebuilding tools needed to build libraries"
303         @echo "--------------------------------------------------------------"
304         cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 lib-tools
305 .endif
306 .if !defined(NOTOOLS)
307         @echo
308         @echo "--------------------------------------------------------------"
309         @echo ">>> Rebuilding all other tools needed to build the ${OBJFORMAT} world"
310         @echo "--------------------------------------------------------------"
311         cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 build-tools
312 .endif
313 .if !defined(_NODEPEND)
314         @echo
315         @echo "--------------------------------------------------------------"
316         @echo ">>> Rebuilding dependencies"
317         @echo "--------------------------------------------------------------"
318         cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 par-depend
319 .endif
320         @echo
321         @echo "--------------------------------------------------------------"
322         @echo ">>> Building ${OBJFORMAT} libraries"
323         @echo "--------------------------------------------------------------"
324         cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN -f Makefile.inc1 libraries
325         @echo
326         @echo "--------------------------------------------------------------"
327         @echo ">>> Building everything.."
328         @echo "--------------------------------------------------------------"
329         cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 all
330
331 everything:
332         @echo "--------------------------------------------------------------"
333         @echo ">>> Building everything.."
334         @echo "--------------------------------------------------------------"
335         cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 all
336
337 #
338 # installworld
339 #
340 # Installs everything compiled by a 'buildworld'.
341 #
342 installworld:
343         cd ${.CURDIR}; ${IXMAKE} -f Makefile.inc1 reinstall
344
345 #
346 # reinstall
347 #
348 # If you have a build server, you can NFS mount the source and obj directories
349 # and do a 'make reinstall' on the *client* to install new binaries from the
350 # most recent server build.
351 #
352 reinstall:
353         @echo "--------------------------------------------------------------"
354         @echo ">>> Making hierarchy"
355         @echo "--------------------------------------------------------------"
356         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
357         @echo
358         @echo "--------------------------------------------------------------"
359         @echo ">>> Installing everything.."
360         @echo "--------------------------------------------------------------"
361         cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
362 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "aout" && !defined(DESTDIR)
363         @echo
364         @echo "--------------------------------------------------------------"
365         @echo ">>> Re-scanning the shared libraries.."
366         @echo "--------------------------------------------------------------"
367         -cd ${.CURDIR}; /sbin/ldconfig -R
368 .endif
369 .if !defined(NOMAN)
370         @echo
371         @echo "--------------------------------------------------------------"
372         @echo ">>> Rebuilding man page indices"
373         @echo "--------------------------------------------------------------"
374         cd ${.CURDIR}/share/man; ${MAKE} makedb
375 .endif
376
377 #
378 # update
379 #
380 # Update the source tree, by running sup and/or running cvs to update to the
381 # latest copy.
382 #
383 update:
384 .if defined(SUP_UPDATE)
385         @echo "--------------------------------------------------------------"
386         @echo ">>> Running ${SUP}"
387         @echo "--------------------------------------------------------------"
388         @${SUP} ${SUPFLAGS} ${SUPFILE}
389 .if defined(SUPFILE1)
390         @${SUP} ${SUPFLAGS} ${SUPFILE1}
391 .endif
392 .if defined(SUPFILE2)
393         @${SUP} ${SUPFLAGS} ${SUPFILE2}
394 .endif
395 .if defined(PORTSSUPFILE)
396         @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
397 .endif
398 .endif
399 .if defined(CVS_UPDATE)
400         @echo "--------------------------------------------------------------"
401         @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
402         @echo "--------------------------------------------------------------"
403         cd ${.CURDIR}; cvs -q update -P -d
404 .endif
405
406 #
407 # most
408 #
409 # Build most of the user binaries on the existing system libs and includes.
410 #
411 most:
412         @echo "--------------------------------------------------------------"
413         @echo ">>> Building programs only"
414         @echo "--------------------------------------------------------------"
415         cd ${.CURDIR}/bin;              ${MAKE} all
416         cd ${.CURDIR}/sbin;             ${MAKE} all
417         cd ${.CURDIR}/libexec;          ${MAKE} all
418         cd ${.CURDIR}/usr.bin;          ${MAKE} all
419         cd ${.CURDIR}/usr.sbin;         ${MAKE} all
420         cd ${.CURDIR}/gnu/libexec;      ${MAKE} all
421         cd ${.CURDIR}/gnu/usr.bin;      ${MAKE} all
422         cd ${.CURDIR}/gnu/usr.sbin;     ${MAKE} all
423 #.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
424 #       cd ${.CURDIR}/kerberosIV;       ${MAKE} most
425 #.endif
426 #.if !defined(NOSECURE) && !defined(NOCRYPT)
427 #       cd ${.CURDIR}/secure;           ${MAKE} most
428 #.endif
429
430 #
431 # installmost
432 #
433 # Install the binaries built by the 'most' target.  This does not include
434 # libraries or include files.
435 #
436 installmost:
437         @echo "--------------------------------------------------------------"
438         @echo ">>> Installing programs only"
439         @echo "--------------------------------------------------------------"
440         cd ${.CURDIR}/bin;              ${MAKE} install
441         cd ${.CURDIR}/sbin;             ${MAKE} install
442         cd ${.CURDIR}/libexec;          ${MAKE} install
443         cd ${.CURDIR}/usr.bin;          ${MAKE} install
444         cd ${.CURDIR}/usr.sbin;         ${MAKE} install
445         cd ${.CURDIR}/gnu/libexec;      ${MAKE} install
446         cd ${.CURDIR}/gnu/usr.bin;      ${MAKE} install
447         cd ${.CURDIR}/gnu/usr.sbin;     ${MAKE} install
448 #.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
449 #       cd ${.CURDIR}/kerberosIV;       ${MAKE} installmost
450 #.endif
451 #.if !defined(NOSECURE) && !defined(NOCRYPT)
452 #       cd ${.CURDIR}/secure;           ${MAKE} installmost
453 #.endif
454
455 #
456 # ------------------------------------------------------------------------
457 #
458 # From here onwards are utility targets used by the 'make world' and
459 # related targets.  If your 'world' breaks, you may like to try to fix
460 # the problem and manually run the following targets to attempt to
461 # complete the build.  Beware, this is *not* guaranteed to work, you
462 # need to have a pretty good grip on the current state of the system
463 # to attempt to manually finish it.  If in doubt, 'make world' again.
464 #
465
466 #
467 # hierarchy - ensure that all the needed directories are present
468 #
469 hierarchy:
470         cd ${.CURDIR}/etc;              ${MAKE} distrib-dirs
471
472 #
473 # bootstrap - [re]build tools needed to run the actual build, this includes
474 # tools needed by 'make depend', as some tools are needed to generate source
475 # for the dependency information to be gathered from.
476 #
477 bootstrap:
478         cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
479                 ${MAKE} ${MK_FLAGS} all; \
480                 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
481         cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
482                 ${MAKE} ${MK_FLAGS} all; \
483                 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
484         cd ${.CURDIR}/usr.bin/yacc; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
485                 ${MAKE} ${MK_FLAGS} all; \
486                 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
487         cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \
488                 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
489                 ${MAKE} ${MK_FLAGS} -DNOLIB all; \
490                 ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
491         cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR}
492         cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
493                 ${MAKE} ${MK_FLAGS} all; \
494                 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
495
496 #
497 # include-tools - generally the same as 'bootstrap', except that it's for
498 # things that are specifically needed to generate include files.
499 #
500 # XXX should be merged with bootstrap, it's not worth keeeping them separate.
501 # Well, maybe it is now.  We force 'cleandepend' here to avoid dependencies
502 # on cleaned away headers in ${WORLDTMP}.
503 #
504 include-tools:
505 .for d in usr.bin/compile_et usr.bin/rpcgen
506         cd ${.CURDIR}/$d; ${MAKE} cleandepend; \
507                 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
508                 ${MAKE} ${MK_FLAGS} all; \
509                 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
510 .endfor
511
512 #
513 # includes - possibly generate and install the include files.
514 #
515 includes:
516 .if defined(CLOBBER)
517         rm -rf ${DESTDIR}/usr/include/*
518         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
519                 -p ${DESTDIR}/usr/include
520 .endif
521         cd ${.CURDIR}/include;                  ${MAKE} -B all install
522         cd ${.CURDIR}/gnu/include;              ${MAKE} install
523         cd ${.CURDIR}/gnu/lib/libmp;            ${MAKE} beforeinstall
524         cd ${.CURDIR}/gnu/lib/libobjc;          ${MAKE} beforeinstall
525         cd ${.CURDIR}/gnu/lib/libreadline;      ${MAKE} beforeinstall
526         cd ${.CURDIR}/gnu/lib/libregex;         ${MAKE} beforeinstall
527         cd ${.CURDIR}/gnu/lib/libstdc++;        ${MAKE} beforeinstall
528         cd ${.CURDIR}/gnu/lib/libdialog;        ${MAKE} beforeinstall
529         cd ${.CURDIR}/gnu/lib/libgmp;           ${MAKE} beforeinstall
530         cd ${.CURDIR}/gnu/usr.bin/cc/cc1plus;   ${MAKE} beforeinstall
531 .if exists(${.CURDIR}/secure) && !defined(NOCRYPT)
532         cd ${.CURDIR}/secure/lib/libdes;        ${MAKE} beforeinstall
533 .endif
534 .if exists(${.CURDIR}/kerberosIV) && !defined(NOCRYPT) && \
535     defined(MAKE_KERBEROS4)
536         cd ${.CURDIR}/kerberosIV/lib/libacl;    ${MAKE} beforeinstall
537         cd ${.CURDIR}/kerberosIV/lib/libkadm;   ${MAKE} beforeinstall
538         cd ${.CURDIR}/kerberosIV/lib/libkafs;   ${MAKE} beforeinstall
539         cd ${.CURDIR}/kerberosIV/lib/libkdb;    ${MAKE} beforeinstall
540         cd ${.CURDIR}/kerberosIV/lib/libkrb;    ${MAKE} beforeinstall
541         cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall
542 .else
543         cd ${.CURDIR}/lib/libtelnet;            ${MAKE} beforeinstall
544 .endif
545 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
546         cd ${.CURDIR}/lib/csu/${MACHINE_ARCH};  ${MAKE} beforeinstall
547 .endif
548         cd ${.CURDIR}/lib/libalias;             ${MAKE} beforeinstall
549         cd ${.CURDIR}/lib/libatm;               ${MAKE} beforeinstall
550         cd ${.CURDIR}/lib/libdevstat;           ${MAKE} beforeinstall
551         cd ${.CURDIR}/lib/libc;                 ${MAKE} beforeinstall
552         cd ${.CURDIR}/lib/libcalendar;          ${MAKE} beforeinstall
553         cd ${.CURDIR}/lib/libcam;               ${MAKE} beforeinstall
554         cd ${.CURDIR}/lib/libcurses;            ${MAKE} beforeinstall
555         cd ${.CURDIR}/lib/libdisk;              ${MAKE} beforeinstall
556         cd ${.CURDIR}/lib/libedit;              ${MAKE} beforeinstall
557         cd ${.CURDIR}/lib/libftpio;             ${MAKE} beforeinstall
558         cd ${.CURDIR}/lib/libmd;                ${MAKE} beforeinstall
559         cd ${.CURDIR}/lib/libmytinfo;           ${MAKE} beforeinstall
560         cd ${.CURDIR}/lib/libncurses;           ${MAKE} beforeinstall
561 .if !defined(WANT_CSRG_LIBM)
562         cd ${.CURDIR}/lib/msun;                 ${MAKE} beforeinstall
563 .endif
564         cd ${.CURDIR}/lib/libopie;              ${MAKE} beforeinstall
565         cd ${.CURDIR}/lib/libpam/libpam;        ${MAKE} beforeinstall
566         cd ${.CURDIR}/lib/libpcap;              ${MAKE} beforeinstall
567         cd ${.CURDIR}/lib/libradius;            ${MAKE} beforeinstall
568         cd ${.CURDIR}/lib/librpcsvc;            ${MAKE} beforeinstall
569         cd ${.CURDIR}/lib/libskey;              ${MAKE} beforeinstall
570         cd ${.CURDIR}/lib/libstand;             ${MAKE} beforeinstall
571         cd ${.CURDIR}/lib/libtacplus;           ${MAKE} beforeinstall
572         cd ${.CURDIR}/lib/libtermcap;           ${MAKE} beforeinstall
573         cd ${.CURDIR}/lib/libcom_err;           ${MAKE} beforeinstall
574         cd ${.CURDIR}/lib/libss;                ${MAKE} -B hdrs beforeinstall
575         cd ${.CURDIR}/lib/libutil;              ${MAKE} beforeinstall
576         cd ${.CURDIR}/lib/libvgl;               ${MAKE} beforeinstall
577         cd ${.CURDIR}/lib/libwrap;              ${MAKE} beforeinstall
578         cd ${.CURDIR}/lib/libz;                 ${MAKE} beforeinstall
579         cd ${.CURDIR}/usr.bin/f2c;              ${MAKE} beforeinstall
580         cd ${.CURDIR}/usr.bin/lex;              ${MAKE} beforeinstall
581
582 #
583 # Declare tools if they are not required on all architectures.
584 #
585 .if ${MACHINE_ARCH} == "i386"
586 # aout tools:
587 _aout_ar        = usr.bin/ar
588 _aout_as        = gnu/usr.bin/as
589 _aout_ld        = gnu/usr.bin/ld
590 _aout_nm        = usr.bin/nm
591 _aout_ranlib    = usr.bin/ranlib
592 _aout_size      = usr.bin/size
593 _aout_strip     = usr.bin/strip
594 # boot block/loader tools:
595 _btxld          = usr.sbin/btxld
596 .endif
597
598 #
599 # lib-tools - build tools to compile and install the libraries.
600 #
601 # XXX gperf is required for cc
602 # XXX a new ld and tsort is required for cc
603 lib-tools:
604 .for d in                               \
605                 gnu/usr.bin/gperf       \
606                 ${_aout_ld}             \
607                 usr.bin/tsort           \
608                 ${_aout_as}             \
609                 gnu/usr.bin/bison       \
610                 gnu/usr.bin/cc          \
611                 gnu/lib/libgcc          \
612                 ${_aout_ar}             \
613                 usr.bin/env             \
614                 usr.bin/lex/lib         \
615                 usr.bin/mk_cmds         \
616                 ${_aout_nm}             \
617                 ${_aout_ranlib}         \
618                 ${_aout_strip}          \
619                 gnu/usr.bin/binutils    \
620                 usr.bin/uudecode        \
621                 usr.bin/objformat
622         cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
623                 ${MAKE} ${MK_FLAGS} all; \
624                 ${MAKE} ${MK_FLAGS} -B install; \
625                 ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR}
626 .endfor
627
628 #
629 # We have to know too much about ordering and subdirs in the lib trees:
630 #
631 # To satisfy shared library linkage when only the libraries being built
632 # are visible:
633 #
634 # csu must be built before all shared libaries for ELF.
635 # libcom_err must be built before libss.
636 # libcrypt must be built before libskey and libkrb.
637 # libdes must be built before libpam.
638 # libkrb must be built before libpam.
639 # libm must be built before libf2c and libstdc++.
640 # libmd must be built before libatm, libopie, libradius, libskey,
641 # libtacplus and libcrypt.
642 # libmytinfo must be built before libdialog and libncurses.
643 # libncurses must be built before libdialog.
644 # libradius must be built before libpam.
645 # libskey must be built before libpam.
646 # libtacplus must be built before libpam.
647 # libtermcap must be built before libcurses, libedit and libreadline.
648 #
649 # Some libraries are built conditionally and/or are in inconsistently
650 # named directories:
651 #
652 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}.pcc)
653 _csu=lib/csu/${MACHINE_ARCH}.pcc
654 .elif ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf"
655 _csu=lib/csu/i386-elf
656 .else
657 _csu=lib/csu/${MACHINE_ARCH}
658 .endif
659
660 .if !defined(NOSECURE) && !defined(NOCRYPT)
661 _libcrypt=      lib/libcrypt secure/lib/libcrypt
662 _secure_lib=    secure/lib
663 .else
664 _libcrypt=      lib/libcrypt
665 .endif
666
667 .if !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
668 _kerberosIV_lib=kerberosIV/lib
669 .endif
670
671 .if defined(WANT_CSRG_LIBM)
672 _libm=  lib/libm
673 .else
674 _libm=  lib/msun
675 .endif
676
677 .if !defined(NOPERL)
678 _libperl=               gnu/usr.bin/perl/libperl
679 .endif
680
681 #
682 # bootstrap-libraries - build just enough libraries for the bootstrap
683 # tools, and install them under ${WORLDTMP}.
684 #
685 # Build csu early so that some tools get linked to the new
686 # version (too late for the main tools, however).  Then build the
687 # necessary prerequisite libraries (libtermcap just needs to be before
688 # libcurses, and this only matters for the NOCLEAN case when NOPIC is
689 # not set).
690 #
691 # This is mostly wrong.  The build tools must run on the host system,
692 # so they should use host libraries.  We depend on the target being
693 # similar enough to the host for new target libraries to work on the
694 # host.
695 #
696 bootstrap-libraries:
697 .for _lib in ${_csu} lib/libtermcap \
698     gnu/lib/libregex gnu/lib/libreadline lib/libc \
699     lib/libcurses lib/libedit ${_libm} \
700     lib/libmd lib/libcrypt lib/libutil lib/libz usr.bin/lex/lib \
701     ${_libperl}
702 .if exists(${.CURDIR}/${_lib})
703         cd ${.CURDIR}/${_lib}; \
704                 ${MAKE} ${MK_FLAGS} ${_DEPEND}; \
705                 ${MAKE} ${MK_FLAGS} all; \
706                 ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
707 .endif
708 .endfor
709
710 #
711 # libraries - build all libraries, and install them under ${DESTDIR}.
712 #
713 # The ordering is not as special as for bootstrap-libraries.  Build
714 # the prerequisites first, then build almost everything else in
715 # alphabetical order.
716 #
717 libraries:
718 .for _lib in ${_csu} lib/libcom_err ${_libm} lib/libmd ${_libcrypt} \
719     lib/libmytinfo lib/libncurses lib/libtermcap \
720     lib/libradius lib/libskey lib/libtacplus \
721     ${_secure_lib} ${_kerberosIV_lib} \
722     gnu/lib ${_libperl} lib usr.bin/lex/lib \
723     usr.sbin/pcvt/keycap
724 .if exists(${.CURDIR}/${_lib})
725         cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install
726 .endif
727 .endfor
728
729 #
730 # Exclude unused tools from build-tools.
731 #
732 .if !defined(NOGAMES) && exists(${.CURDIR}/games)
733 _adventure=     games/adventure
734 _caesar=        games/caesar
735 _hack=          games/hack
736 _phantasia=     games/phantasia
737 _strfile=       games/fortune/strfile
738 .endif
739 .if !defined(NOPERL)
740 _perl=          gnu/usr.bin/perl/miniperl
741 .endif
742 .if !defined(NOSHARE) && exists(${.CURDIR}/share)
743 _scrnmaps=      share/syscons/scrnmaps
744 .endif
745 .if ${MACHINE_ARCH} == i386
746 _kldlinux=      sys/modules/linux
747 .endif
748 .if ${OBJFORMAT} == "aout"
749 _netboot=       sys/${MACHINE}/boot/netboot
750 .endif
751
752 BTMAKEFLAGS=    ${MK_FLAGS} -D_BUILD_TOOLS
753
754 #
755 # build-tools - build and install any other tools needed to complete the
756 # compile and install.
757 # ifdef stale
758 # bc and cpp are required to build groff.  Otherwise, the order here is
759 # mostly historical, i.e., bogus.
760 # chmod is used to build gcc's tmpmultilib[2] at obscure times.
761 # endif stale
762 # XXX uname is a bug - the target should not depend on the host.
763 #
764 build-tools:
765 .for d in                               \
766                 bin/cat                 \
767                 bin/chmod               \
768                 bin/cp                  \
769                 bin/date                \
770                 bin/dd                  \
771                 bin/echo                \
772                 bin/expr                \
773                 bin/hostname            \
774                 bin/ln                  \
775                 bin/ls                  \
776                 bin/mkdir               \
777                 bin/mv                  \
778                 bin/rm                  \
779                 bin/test                \
780                 ${_caesar}              \
781                 ${_strfile}             \
782                 gnu/usr.bin/awk         \
783                 gnu/usr.bin/bc          \
784                 gnu/usr.bin/grep        \
785                 gnu/usr.bin/groff       \
786                 gnu/usr.bin/gzip        \
787                 gnu/usr.bin/man/makewhatis      \
788                 gnu/usr.bin/patch       \
789                 ${_perl}                \
790                 gnu/usr.bin/sort        \
791                 gnu/usr.bin/texinfo     \
792                 usr.bin/basename        \
793                 usr.bin/cap_mkdb        \
794                 usr.bin/chflags         \
795                 usr.bin/cmp             \
796                 usr.bin/col             \
797                 usr.bin/colldef         \
798                 usr.bin/cpp             \
799                 usr.bin/expand          \
800                 usr.bin/file2c          \
801                 usr.bin/find            \
802                 usr.bin/gencat          \
803                 usr.bin/gensetdefs      \
804                 usr.bin/id              \
805                 usr.bin/join            \
806                 usr.bin/lorder          \
807                 usr.bin/m4              \
808                 usr.bin/mkdep           \
809                 usr.bin/mklocale        \
810                 usr.bin/paste           \
811                 usr.bin/printf          \
812                 usr.bin/sed             \
813                 ${_aout_size}           \
814                 usr.bin/soelim          \
815                 usr.bin/symorder        \
816                 usr.bin/touch           \
817                 usr.bin/tr              \
818                 usr.bin/true            \
819                 usr.bin/uname           \
820                 usr.bin/uuencode        \
821                 usr.bin/vgrind          \
822                 usr.bin/vi              \
823                 usr.bin/wc              \
824                 usr.bin/xargs           \
825                 usr.bin/yacc            \
826                 ${_btxld}               \
827                 usr.sbin/chown          \
828                 usr.sbin/mtree          \
829                 usr.sbin/zic            \
830                 bin/sh
831         cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} ${_DEPEND}; \
832                 ${MAKE} ${BTMAKEFLAGS} all; \
833                 ${MAKE} ${BTMAKEFLAGS} -B install ${CLEANDIR} ${OBJDIR}
834 .endfor
835 .if !defined(NOGAMES) && exists(${.CURDIR}/games)
836         cd ${DESTDIR}/usr/games; cp -p caesar strfile ${DESTDIR}/usr/bin
837 .endif
838 .for d in                               \
839                 bin/sh                  \
840                 ${_adventure}           \
841                 ${_hack}                \
842                 ${_phantasia}           \
843                 gnu/usr.bin/cc/cc_tools \
844                 lib/libmytinfo          \
845                 ${_linux}               \
846                 ${_kldlinux}            \
847                 ${_scrnmaps}            \
848                 ${_netboot}
849         cd ${.CURDIR}/$d; ${MAKE} ${BTMAKEFLAGS} build-tools
850 .endfor
851         cd ${.CURDIR}/usr.bin/tn3270/tools; ${MAKE} ${BTMAKEFLAGS} all
852
853 #
854 # Build aout versions of things that provide legacy support when all the
855 # rest of the world is elf.
856 #
857 legacy-build:
858 .if     ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "aout"
859         @echo
860         @echo "--------------------------------------------------------------"
861         @echo ">>> Making hierarchy"
862         @echo "--------------------------------------------------------------"
863         mkdir -p ${WORLDTMP}
864         cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 hierarchy
865         @echo
866         @echo "--------------------------------------------------------------"
867         @echo ">>> Rebuilding the ${OBJFORMAT} obj tree"
868         @echo "--------------------------------------------------------------"
869         cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 par-${OBJDIR}
870         @echo
871         @echo "--------------------------------------------------------------"
872         @echo ">>> Rebuilding ${DESTDIR}/usr/include"
873         @echo "--------------------------------------------------------------"
874         cd ${.CURDIR}; SHARED=copies ${XMAKE} -f Makefile.inc1 includes
875         @echo
876         @echo "--------------------------------------------------------------"
877         @echo ">>> Building legacy libraries"
878         @echo "--------------------------------------------------------------"
879         cd ${.CURDIR}; \
880                 ${XMAKE} -DNOINFO -DNOMAN -f Makefile.inc1 bootstrap-libraries
881         cd ${.CURDIR}; \
882                 ${XMAKE} -DNOINFO -DNOMAN -f Makefile.inc1 libraries
883         @echo
884         @echo "--------------------------------------------------------------"
885         @echo ">>> Building legacy rtld"
886         @echo "--------------------------------------------------------------"
887         cd ${.CURDIR}/libexec/rtld-aout; \
888                 ${XMAKE} -DNOMAN depend; ${XMAKE} -DNOMAN all;
889         @echo
890         @echo "--------------------------------------------------------------"
891         @echo ">>> Building legacy boot"
892         @echo "--------------------------------------------------------------"
893         cd ${.CURDIR}/sys/${MACHINE}/boot && \
894                 ${XMAKE} -DNOMAN -B obj depend; ${XMAKE} -DNOMAN all;
895 .endif
896
897 #
898 # Install aout versions of things that provide legacy support when all the
899 # rest of the world is elf.
900 #
901 legacy-install:
902 .if     ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "aout"
903         @echo
904         @echo "--------------------------------------------------------------"
905         @echo ">>> Installing legacy libraries"
906         @echo "--------------------------------------------------------------"
907         cd ${.CURDIR}/lib; ${MAKE} -B -DNOMAN -DNOINFO install
908         cd ${.CURDIR}/gnu/lib; ${MAKE} -B -DNOMAN -DNOINFO install
909         cd ${.CURDIR}/gnu/lib/libgcc; \
910                 ${MAKE} -B -DNOMAN -DNOINFO install
911         cd ${.CURDIR}/usr.bin/lex/lib; \
912                 ${MAKE} -B -DNOMAN -DNOINFO install
913         cd ${.CURDIR}/usr.sbin/pcvt/keycap; \
914                 ${MAKE} -B -DNOMAN -DNOINFO install
915 .if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE)
916         cd ${.CURDIR}/secure/lib; ${MAKE} -B -DNOMAN -DNOINFO install
917 .endif
918 .if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \
919     defined(MAKE_KERBEROS4)
920         cd ${.CURDIR}/kerberosIV/lib; ${MAKE} -B -DNOMAN -DNOINFO install
921 .endif
922         @echo
923         @echo "--------------------------------------------------------------"
924         @echo ">>> Installing legacy rtld"
925         @echo "--------------------------------------------------------------"
926         cd ${.CURDIR}/libexec/rtld-aout; ${MAKE} -DNOMAN install
927         @echo
928 .if ${MACHINE_ARCH} == "i386"
929         @echo "--------------------------------------------------------------"
930         @echo ">>> Installing legacy boot"
931         @echo "--------------------------------------------------------------"
932         cd ${.CURDIR}/sys/${MACHINE}/boot && ${MAKE} -DNOMAN install
933 .endif
934 .endif
935
936
937 # Get the object format that the tools see.
938 #
939 #
940 .if exists(/usr/bin/objformat)
941 __OBJFORMAT!=   objformat
942 .else
943 __OBJFORMAT=    ${OBJFORMAT}
944 .endif
945
946 #
947 # Check if the local /etc/make.conf or /etc/make.conf.local have attempted
948 # to override the OBJFORMAT without updating the environment for the tools
949 # to see.
950 #
951 check-objformat :
952 .if     ${__OBJFORMAT} != ${OBJFORMAT}
953         @/bin/sh -c "echo \"It looks like you set OBJFORMAT=${OBJFORMAT} in /etc/make.conf. Don't do that!\" "
954         @/bin/sh -c "echo \"If you want to override the installed object format, you must set OBJFORMAT\" "
955         @/bin/sh -c "echo \"in your environment.\" "
956         @exit 1
957 .endif
958 .if     !defined(REALLY_WANT_DEPRECIATED_AOUT) && ${OBJFORMAT} == "aout"
959         @echo "==== NOTICE: a.out buildworld is depreciated and disabled! ====="
960         @echo "Read: http://www.freebsd.org/~peter/elfday.html for information."
961         @echo "You need to complete a 'make aout-to-elf' to bring your system"
962         @echo "up to date with ELF tools.  This requires a fair amount of disk"
963         @echo "space to complete.  Alternatively, you can do a binary upgrade"
964         @echo "using the 3.0-RELEASE binaries from CD or ftp.freebsd.org in"
965         @echo "/pub/FreeBSD/3.0-RELEASE/bin/ to convert your userland to ELF."
966         @exit 1
967 .endif
968
969
970 .for __target in clean cleandepend cleandir depend obj
971 .for entry in ${SUBDIR}
972 ${entry}.${__target}__D: .PHONY
973         @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
974                 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
975                 edir=${entry}.${MACHINE_ARCH}; \
976                 cd ${.CURDIR}/$${edir}; \
977         else \
978                 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \
979                 edir=${entry}; \
980                 cd ${.CURDIR}/$${edir}; \
981         fi; \
982         ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
983 .endfor
984 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
985 .endfor
986
987 .include <bsd.subdir.mk>