Home | History | Annotate | Line # | Download | only in src
Makefile revision 1.112
      1 #	$NetBSD: Makefile,v 1.112 2000/04/10 14:47:22 mrg 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 SRCTOP=.
     40 .include <bsd.crypto.mk>		# for configuration variables.
     41 
     42 .if defined(CRYPTOPATH)
     43 .sinclude "${CRYPTOPATH}/Makefile.frag"
     44 .endif
     45 
     46 MKOBJDIRS ?= no
     47 HAVE_GCC28!=	${CXX} --version | egrep "^(2\.8|egcs)" ; echo
     48 
     49 .if defined(NBUILDJOBS)
     50 _J= -j${NBUILDJOBS}
     51 .endif
     52 
     53 .if defined(DESTDIR)
     54 _M=-m ${DESTDIR}/usr/share/mk
     55 .endif
     56 
     57 # NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
     58 
     59 SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
     60 .if make(obj)
     61 SUBDIR+= distrib
     62 .endif
     63 
     64 includes-lib: includes-include includes-sys
     65 
     66 .if exists(games)
     67 SUBDIR+= games
     68 .endif
     69 
     70 SUBDIR+= gnu
     71 # This is needed for libstdc++ and gen-params.
     72 includes-gnu: includes-include includes-sys
     73 
     74 .if exists(regress)
     75 .ifmake !(install)
     76 SUBDIR+= regress
     77 .endif
     78 
     79 regression-tests:
     80 	@echo Running regression tests...
     81 	@(cd ${.CURDIR}/regress && ${MAKE} ${_M} regress)
     82 .endif
     83 
     84 buildmsg:
     85 	@echo -n "Build started at: "
     86 	@date
     87 
     88 beforeinstall:
     89 .ifndef NODISTRIBDIRS
     90 .ifndef DESTDIR
     91 	(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs)
     92 .else
     93 	(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
     94 .endif
     95 .endif
     96 
     97 afterinstall:
     98 .if ${MKMAN} != "no" && !defined(_BUILD)
     99 	${MAKE} ${_M} whatis.db
    100 .endif
    101 
    102 whatis.db:
    103 	(cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb)
    104 
    105 # wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
    106 # as the build will automatically remove/replace the non-pkg entries there.
    107 
    108 .if defined(BUILD_DONE)
    109 build:
    110 	@echo "Build installed into ${DESTDIR}"
    111 .else
    112 build: buildmsg beforeinstall
    113 .if defined(FORCE_DOMESTIC)
    114 	@echo '*** CAPUTE!'
    115 	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
    116 	@echo '    Please correct the problem and try again.'
    117 	@false
    118 .endif
    119 .if ${MKSHARE} != "no"
    120 	(cd ${.CURDIR}/share/mk && ${MAKE} install)
    121 .endif
    122 .if !defined(UPDATE) && !defined(NOCLEANDIR)
    123 	${MAKE} ${_M} cleandir
    124 .endif
    125 .if ${MKOBJDIRS} != "no"
    126 	${MAKE} obj
    127 .endif
    128 .if empty(HAVE_GCC28)
    129 .if defined(DESTDIR)
    130 	@echo "*** CAPUTE!"
    131 	@echo "    You attempted to compile the world without egcs.  You must"
    132 	@echo "    first install a native egcs compiler."
    133 	@false
    134 .else
    135 	(cd ${.CURDIR}/gnu/usr.bin/egcs && \
    136 	    ${MAKE} ${_M} ${_J} dependall MKMAN=no && \
    137 	    ${MAKE} ${_M} MKMAN=no install && ${MAKE} ${_M} cleandir)
    138 .endif
    139 .endif
    140 .if !defined(NOINCLUDES)
    141 	${MAKE} ${_M} includes
    142 .endif
    143 	(cd ${.CURDIR}/lib/csu && \
    144 	    ${MAKE} ${_M} ${_J} MKMAN=no dependall && \
    145 	    ${MAKE} ${_M} MKMAN=no install)
    146 	(cd ${.CURDIR}/lib && \
    147 	    ${MAKE} ${_M} ${_J} MKMAN=no MKINFO=no dependall && \
    148 	    ${MAKE} ${_M} MKMAN=no MKINFO=no install)
    149 	(cd ${.CURDIR}/gnu/lib && \
    150 	    ${MAKE} ${_M} ${_J} MKMAN=no MKINFO=no dependall && \
    151 	    ${MAKE} ${_M} MKMAN=no MKINFO=no install)
    152 .if target(cryptobuild)
    153 	${MAKE} ${_M} ${_J} cryptobuild
    154 .endif
    155 	${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install
    156 .if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
    157 	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build)
    158 .endif
    159 	${MAKE} ${_M} whatis.db
    160 	@echo -n "Build finished at: "
    161 	@date
    162 .endif
    163 
    164 release snapshot: build
    165 	(cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release)
    166 
    167 .include <bsd.subdir.mk>
    168