Home | History | Annotate | Line # | Download | only in src
Makefile revision 1.95.2.2
      1 #	$NetBSD: Makefile,v 1.95.2.2 2000/09/09 16:29:26 he Exp $
      2 
      3 # This is the top-level makefile for building NetBSD. For an outline of
      4 # how to build a snapshot or release, as well as other release engineering
      5 # information, see http://www.netbsd.org/developers/releng/index.html
      6 #
      7 # Not everything you can set or do is documented in this makefile. In
      8 # particular, you should review the files in /usr/share/mk (especially
      9 # bsd.README) for general information on building programs and writing
     10 # Makefiles within this structure, and see the comments in src/etc/Makefile
     11 # for further information on installation and release set options.
     12 #
     13 # Variables listed below can be set on the make command line (highest
     14 # priority), in /etc/mk.conf (middle priority), or in the environment
     15 # (lowest priority).
     16 #
     17 # Variables:
     18 #   NBUILDJOBS is the number of jobs to start in parallel during a
     19 #	'make build'. It defaults to 1.
     20 #   MKMAN, if set to `no', will prevent building of manual pages.
     21 #   MKSHARE, if set to `no', will prevent building and installing
     22 #	anything in /usr/share.
     23 #   UPDATE will avoid a `make cleandir' at the start of `make build',
     24 #	as well as having the effects listed in /usr/share/mk/bsd.README.
     25 #   DESTDIR is the target directory for installation of the compiled
     26 #	software. It defaults to /. Note that programs are built against
     27 #	libraries installed in DESTDIR.
     28 #
     29 # Targets:
     30 #   build: builds a full release of netbsd in DESTDIR.
     31 #   release: does a `make build,' and then tars up the DESTDIR files
     32 #	into RELEASEDIR, in release(7) format. (See etc/Makefile for
     33 #	more information on this.)
     34 #   snapshot: a synonym for release.
     35 
     36 .include <bsd.own.mk>			# for configuration variables.
     37 
     38 
     39 HAVE_GCC28!=	${CXX} --version | egrep "^(2\.8|egcs)" ; echo
     40 
     41 .if defined(NBUILDJOBS)
     42 _J= -j${NBUILDJOBS}
     43 .endif
     44 
     45 # NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
     46 
     47 SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
     48 
     49 .if make(cleandir) || make(obj)
     50 SUBDIR+= distrib
     51 .endif
     52 
     53 .if exists(games)
     54 SUBDIR+= games
     55 .endif
     56 
     57 SUBDIR+= gnu
     58 # This is needed for libstdc++ and gen-params.
     59 includes-gnu: includes-include includes-sys
     60 
     61 # Descend into the domestic tree if it exists AND
     62 #  1) the target is clean, cleandir, or obj, OR
     63 #  2) the the target is install or includes AND
     64 #    NOT compiling only "exportable" code AND
     65 #    doing it as part of installing a distribution.
     66 #
     67 # NOTE:  due to the use of the make(foo) construct here, using the
     68 # clean, cleandir, and obj targets on the command line in conjunction
     69 # with any other target may produce unexpected results.
     70 
     71 .if exists(domestic) && \
     72     (make(clean) || make(cleandir) || make(obj) || \
     73     ((make(includes) || make(install)) && \
     74     !defined(EXPORTABLE_SYSTEM) && defined(_DISTRIB)))
     75 SUBDIR+= domestic
     76 .endif
     77 
     78 .if exists(regress)
     79 .ifmake !(install)
     80 SUBDIR+= regress
     81 .endif
     82 
     83 regression-tests:
     84 	@echo Running regression tests...
     85 	@(cd ${.CURDIR}/regress && ${MAKE} regress)
     86 .endif
     87 
     88 beforeinstall:
     89 .ifmake build
     90 	@echo -n "Build started at: "
     91 	@date
     92 .endif
     93 .ifndef DESTDIR
     94 	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
     95 .else
     96 	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
     97 .endif
     98 
     99 afterinstall:
    100 .if ${MKMAN} != "no" && !defined(_BUILD)
    101 	${MAKE} whatis.db
    102 .endif
    103 
    104 whatis.db:
    105 	(cd ${.CURDIR}/share/man && ${MAKE} makedb)
    106 
    107 # wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
    108 # as the build will automatically remove/replace the non-pkg entries there.
    109 
    110 build: beforeinstall
    111 .if ${MKSHARE} != "no"
    112 	(cd ${.CURDIR}/share/mk && ${MAKE} install)
    113 	(cd ${.CURDIR}/share/tmac && ${MAKE} && ${MAKE} install)
    114 .endif
    115 .if !defined(UPDATE)
    116 	${MAKE} cleandir
    117 .endif
    118 .if empty(HAVE_GCC28)
    119 .if defined(DESTDIR)
    120 	@echo "*** CAPUTE!"
    121 	@echo "    You attempted to compile the world without egcs.  You must"
    122 	@echo "    first install a native egcs compiler."
    123 	@false
    124 .else
    125 	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
    126 	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
    127 	    ${MAKE} MKMAN=no install && ${MAKE} cleandir)
    128 .endif
    129 .endif
    130 	${MAKE} includes
    131 	(cd ${.CURDIR}/lib/csu && \
    132 	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
    133 	    ${MAKE} MKMAN=no install)
    134 	(cd ${.CURDIR}/lib && \
    135 	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \
    136 	    ${MAKE} MKMAN=no install)
    137 	(cd ${.CURDIR}/gnu/lib && \
    138 	    ${MAKE} depend && ${MAKE} ${_J} MKMAN=no MKINFO=no && \
    139 	    ${MAKE} MKMAN=no MKINFO=no install)
    140 	${MAKE} depend && ${MAKE} ${_J} && ${MAKE} _BUILD= install
    141 .if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
    142 	(cd ${.CURDIR}/domestic && ${MAKE} ${_J} _SLAVE_BUILD= build)
    143 .endif
    144 	${MAKE} whatis.db
    145 	@echo -n "Build finished at: "
    146 	@date
    147 
    148 release snapshot: build
    149 	(cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release)
    150 
    151 .include <bsd.subdir.mk>
    152