Home | History | Annotate | Line # | Download | only in src
Makefile revision 1.118
      1 #	$NetBSD: Makefile,v 1.118 2000/06/20 06:00:24 thorpej 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 #   DESTDIR is the target directory for installation of the compiled
     19 #	software. It defaults to /. Note that programs are built against
     20 #	libraries installed in DESTDIR.
     21 #   MKMAN, if set to `no', will prevent building of manual pages.
     22 #   MKOBJDIRS, if not set to `no', will build object directories at 
     23 #	an appropriate point in a build.
     24 #   MKSHARE, if set to `no', will prevent building and installing
     25 #	anything in /usr/share.
     26 #   NBUILDJOBS is the number of jobs to start in parallel during a
     27 #	'make build'. It defaults to 1.
     28 #   UPDATE will avoid a `make cleandir' at the start of `make build',
     29 #	as well as having the effects listed in /usr/share/mk/bsd.README.
     30 #
     31 # Targets:
     32 #   build: builds a full release of netbsd in DESTDIR. If BUILD_DONE is
     33 #	set, this is an empty target.
     34 #   release: does a `make build,' and then tars up the DESTDIR files
     35 #	into RELEASEDIR, in release(7) format. (See etc/Makefile for
     36 #	more information on this.)
     37 #   snapshot: a synonym for release.
     38 
     39 .include <bsd.own.mk>
     40 
     41 MKOBJDIRS ?= no
     42 HAVE_EGCS!=	${CXX} --version | egrep "^(2\.[89]|egcs)" ; echo
     43 
     44 .if defined(NBUILDJOBS)
     45 _J= -j${NBUILDJOBS}
     46 .endif
     47 
     48 .if defined(DESTDIR)
     49 _M=-m ${DESTDIR}/usr/share/mk
     50 .endif
     51 
     52 # NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
     53 
     54 SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
     55 .if make(obj)
     56 SUBDIR+= distrib
     57 .ifdef MAKEOBJDIRPREFIX
     58 SUBDIR+= etc
     59 .endif
     60 .endif
     61 
     62 includes-lib: includes-include includes-sys
     63 
     64 .if exists(games)
     65 SUBDIR+= games
     66 .endif
     67 
     68 SUBDIR+= gnu
     69 # This is needed for libstdc++ and gen-params.
     70 includes-gnu: includes-include includes-sys
     71 
     72 .if exists(regress)
     73 .ifmake !(install)
     74 SUBDIR+= regress
     75 .endif
     76 
     77 regression-tests:
     78 	@echo Running regression tests...
     79 	@(cd ${.CURDIR}/regress && ${MAKE} ${_M} regress)
     80 .endif
     81 
     82 buildmsg:
     83 	@echo -n "Build started at: "
     84 	@date
     85 
     86 beforeinstall:
     87 .ifndef NODISTRIBDIRS
     88 .ifndef DESTDIR
     89 	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
     90 .else
     91 	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
     92 .endif
     93 .endif
     94 
     95 afterinstall:
     96 .if ${MKMAN} != "no" && !defined(_BUILD)
     97 	${MAKE} ${_M} whatis.db
     98 .endif
     99 
    100 whatis.db:
    101 	(cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb)
    102 
    103 # wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
    104 # as the build will automatically remove/replace the non-pkg entries there.
    105 
    106 .if defined(BUILD_DONE)
    107 build:
    108 	@echo "Build installed into ${DESTDIR}"
    109 .else
    110 build: buildmsg beforeinstall
    111 .if defined(FORCE_DOMESTIC)
    112 	@echo '*** CAPUTE!'
    113 	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
    114 	@echo '    Please correct the problem and try again.'
    115 	@false
    116 .endif
    117 .if ${MKSHARE} != "no"
    118 	(cd ${.CURDIR}/share/mk && ${MAKE} install)
    119 .endif
    120 .if !defined(UPDATE) && !defined(NOCLEANDIR)
    121 	${MAKE} ${_J} ${_M} cleandir
    122 .endif
    123 .if ${MKOBJDIRS} != "no"
    124 	${MAKE} ${_M} obj
    125 .endif
    126 .if empty(HAVE_EGCS)
    127 .if defined(DESTDIR)
    128 	@echo "*** CAPUTE!"
    129 	@echo "    You attempted to compile the world without egcs.  You must"
    130 	@echo "    first install a native egcs compiler."
    131 	@false
    132 .else
    133 	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
    134 	    ${MAKE} ${_M} ${_J} dependall MKMAN=no && \
    135 	    ${MAKE} ${_M} MKMAN=no install && ${MAKE} ${_M} cleandir)
    136 .endif
    137 .endif
    138 .if !defined(NOINCLUDES)
    139 	${MAKE} ${_M} includes
    140 .endif
    141 	(cd ${.CURDIR}/lib/csu && \
    142 	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
    143 	    ${MAKE} ${_M} MKSHARE=no install)
    144 	(cd ${.CURDIR}/lib && \
    145 	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
    146 	    ${MAKE} ${_M} MKSHARE=no install)
    147 	(cd ${.CURDIR}/gnu/lib && \
    148 	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
    149 	    ${MAKE} ${_M} MKSHARE=no install)
    150 	${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install
    151 .if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
    152 	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build)
    153 .endif
    154 	${MAKE} ${_M} whatis.db
    155 	@echo -n "Build finished at: "
    156 	@date
    157 .endif
    158 
    159 release snapshot: build
    160 	(cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release)
    161 
    162 .include <bsd.subdir.mk>
    163