Home | History | Annotate | Line # | Download | only in src
Makefile revision 1.136
      1  1.136   nathanw #	$NetBSD: Makefile,v 1.136 2001/10/12 21:05:08 nathanw Exp $
      2   1.95       cjs 
      3   1.95       cjs # This is the top-level makefile for building NetBSD. For an outline of
      4   1.95       cjs # how to build a snapshot or release, as well as other release engineering
      5   1.95       cjs # information, see http://www.netbsd.org/developers/releng/index.html
      6   1.95       cjs #
      7   1.95       cjs # Not everything you can set or do is documented in this makefile. In
      8   1.95       cjs # particular, you should review the files in /usr/share/mk (especially
      9   1.95       cjs # bsd.README) for general information on building programs and writing
     10   1.95       cjs # Makefiles within this structure, and see the comments in src/etc/Makefile
     11   1.95       cjs # for further information on installation and release set options.
     12   1.95       cjs #
     13   1.95       cjs # Variables listed below can be set on the make command line (highest
     14   1.95       cjs # priority), in /etc/mk.conf (middle priority), or in the environment
     15   1.95       cjs # (lowest priority).
     16   1.95       cjs #
     17   1.95       cjs # Variables:
     18  1.101  sommerfe #   DESTDIR is the target directory for installation of the compiled
     19  1.101  sommerfe #	software. It defaults to /. Note that programs are built against
     20  1.101  sommerfe #	libraries installed in DESTDIR.
     21   1.95       cjs #   MKMAN, if set to `no', will prevent building of manual pages.
     22  1.101  sommerfe #   MKOBJDIRS, if not set to `no', will build object directories at 
     23  1.101  sommerfe #	an appropriate point in a build.
     24   1.95       cjs #   MKSHARE, if set to `no', will prevent building and installing
     25   1.95       cjs #	anything in /usr/share.
     26  1.101  sommerfe #   NBUILDJOBS is the number of jobs to start in parallel during a
     27  1.127        tv #	`make build'. It defaults to 1.
     28  1.125       mrg #   UPDATE, if defined, will avoid a `make cleandir' at the start of
     29  1.125       mrg #     `make build', as well as having the effects listed in
     30  1.125       mrg #     /usr/share/mk/bsd.README.
     31  1.125       mrg #   NOCLEANDIR, if defined, will avoid a `make cleandir' at the start
     32  1.125       mrg #     of the `make build'.
     33  1.119    toddpw #   NOINCLUDES will avoid the `make includes' usually done by `make build'.
     34  1.125       mrg 
     35   1.95       cjs #
     36   1.95       cjs # Targets:
     37  1.110      jlam #   build: builds a full release of netbsd in DESTDIR. If BUILD_DONE is
     38  1.110      jlam #	set, this is an empty target.
     39   1.95       cjs #   release: does a `make build,' and then tars up the DESTDIR files
     40   1.95       cjs #	into RELEASEDIR, in release(7) format. (See etc/Makefile for
     41   1.95       cjs #	more information on this.)
     42   1.95       cjs #   snapshot: a synonym for release.
     43  1.123       mrg #
     44  1.123       mrg # Sub targets of `make build,' in order:
     45  1.123       mrg #   buildstartmsg: displays the start time of the build.
     46  1.131        tv #   do-make-tools: builds host toolchain.
     47  1.131        tv #   do-distrib-dirs: creates the distribution directories.
     48  1.123       mrg #   do-force-domestic: check's that FORCE_DOMESTIC isn't set (deprecated.)
     49  1.127        tv #   do-cleandir: cleans the tree.
     50  1.127        tv #   do-make-obj: creates object directories if required.
     51  1.123       mrg #   do-make-includes: install include files.
     52  1.123       mrg #   do-lib-csu: build & install startup object files.
     53  1.123       mrg #   do-lib: build & install system libraries.
     54  1.123       mrg #   do-gnu-lib: build & install gnu system libraries.
     55  1.123       mrg #   do-dependall: builds & install the entire system.
     56  1.123       mrg #   do-domestic: build & install the domestic tree (deprecated.)
     57  1.123       mrg #   do-whatisdb: build & install the `whatis.db' man database.
     58  1.123       mrg #   buildendmsg: displays the end time of the build.
     59   1.32       cgd 
     60  1.133        tv .include "${.CURDIR}/share/mk/bsd.own.mk"
     61    1.4       cgd 
     62  1.100  sommerfe MKOBJDIRS ?= no
     63   1.58        tv 
     64   1.76    bouyer .if defined(NBUILDJOBS)
     65   1.76    bouyer _J= -j${NBUILDJOBS}
     66   1.76    bouyer .endif
     67   1.76    bouyer 
     68    1.4       cgd # NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW
     69    1.2       cgd 
     70   1.52   mycroft SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys
     71  1.120     fredb .if make(cleandir) || make(obj)
     72  1.135     jwise SUBDIR+= distrib
     73  1.135     jwise .if ${USETOOLS} != "no"
     74  1.135     jwise SUBDIR+= tools
     75  1.135     jwise .endif
     76  1.114       sjg .ifdef MAKEOBJDIRPREFIX
     77  1.114       sjg SUBDIR+= etc
     78  1.114       sjg .endif
     79  1.109       cjs .endif
     80  1.105     assar 
     81  1.105     assar includes-lib: includes-include includes-sys
     82   1.36  explorer 
     83   1.36  explorer .if exists(games)
     84   1.36  explorer SUBDIR+= games
     85   1.36  explorer .endif
     86   1.36  explorer 
     87    1.8       cgd SUBDIR+= gnu
     88   1.52   mycroft # This is needed for libstdc++ and gen-params.
     89   1.52   mycroft includes-gnu: includes-include includes-sys
     90   1.21       cgd 
     91   1.13    brezak .if exists(regress)
     92    1.9       cgd .ifmake !(install)
     93    1.9       cgd SUBDIR+= regress
     94    1.9       cgd .endif
     95    1.9       cgd 
     96   1.10       cgd regression-tests:
     97   1.10       cgd 	@echo Running regression tests...
     98  1.112       mrg 	@(cd ${.CURDIR}/regress && ${MAKE} ${_M} regress)
     99   1.13    brezak .endif
    100   1.20       cgd 
    101  1.123       mrg buildstartmsg:
    102   1.45     perry 	@echo -n "Build started at: "
    103   1.45     perry 	@date
    104  1.108       erh 
    105  1.123       mrg buildendmsg:
    106  1.123       mrg 	@echo -n "Build finished at: "
    107  1.123       mrg 	@date
    108  1.123       mrg 
    109   1.15       cgd afterinstall:
    110   1.86     lukem .if ${MKMAN} != "no" && !defined(_BUILD)
    111  1.112       mrg 	${MAKE} ${_M} whatis.db
    112   1.81    scottr .endif
    113   1.81    scottr 
    114   1.81    scottr whatis.db:
    115  1.112       mrg 	(cd ${.CURDIR}/share/man && ${MAKE} ${_M} makedb)
    116   1.15       cgd 
    117   1.84        tv # wrt info/dir below:  It's safe to move this over top of /usr/share/info/dir,
    118   1.84        tv # as the build will automatically remove/replace the non-pkg entries there.
    119   1.84        tv 
    120  1.110      jlam .if defined(BUILD_DONE)
    121  1.110      jlam build:
    122  1.110      jlam 	@echo "Build installed into ${DESTDIR}"
    123  1.110      jlam .else
    124  1.124       mrg build:
    125  1.124       mrg 	@${MAKE} ${_M} buildstartmsg
    126  1.131        tv 	@${MAKE} ${_M} do-make-tools
    127  1.131        tv 	@${MAKE} ${_M} do-distrib-dirs
    128  1.124       mrg 	@${MAKE} ${_M} do-force-domestic
    129  1.124       mrg 	@${MAKE} ${_M} do-cleandir
    130  1.124       mrg 	@${MAKE} ${_M} do-make-obj
    131  1.124       mrg 	@${MAKE} ${_M} do-make-includes
    132  1.124       mrg 	@${MAKE} ${_M} do-lib-csu
    133  1.124       mrg 	@${MAKE} ${_M} do-lib
    134  1.124       mrg 	@${MAKE} ${_M} do-gnu-lib
    135  1.124       mrg 	@${MAKE} ${_M} do-dependall
    136  1.124       mrg 	@${MAKE} ${_M} do-domestic
    137  1.124       mrg 	@${MAKE} ${_M} do-whatisdb
    138  1.124       mrg 	@${MAKE} ${_M} buildendmsg
    139  1.123       mrg .endif
    140  1.123       mrg 
    141  1.131        tv do-make-tools:
    142  1.132     mason .if ${USETOOLS} != "no"
    143  1.131        tv .if ${MKOBJDIRS} != "no"
    144  1.131        tv 	cd ${.CURDIR}/tools && ${MAKE} ${_M} obj
    145  1.131        tv .endif
    146  1.131        tv 	cd ${.CURDIR}/tools && ${MAKE} ${_M} build
    147  1.132     mason .endif
    148  1.131        tv 
    149  1.131        tv do-distrib-dirs:
    150  1.131        tv .ifndef NODISTRIBDIRS
    151  1.131        tv .ifndef DESTDIR
    152  1.131        tv 	(cd ${.CURDIR}/etc && ${MAKE} ${_M} DESTDIR=/ distrib-dirs)
    153  1.131        tv .else
    154  1.131        tv 	(cd ${.CURDIR}/etc && ${MAKE} ${_M} DESTDIR=${DESTDIR} distrib-dirs)
    155  1.131        tv .endif
    156  1.131        tv .endif
    157  1.131        tv 
    158  1.123       mrg do-force-domestic:
    159   1.96    scottr .if defined(FORCE_DOMESTIC)
    160   1.96    scottr 	@echo '*** CAPUTE!'
    161   1.96    scottr 	@echo '    The FORCE_DOMESTIC flag is not compatible with "make build".'
    162   1.96    scottr 	@echo '    Please correct the problem and try again.'
    163   1.96    scottr 	@false
    164   1.96    scottr .endif
    165  1.123       mrg 
    166  1.123       mrg do-cleandir:
    167  1.112       mrg .if !defined(UPDATE) && !defined(NOCLEANDIR)
    168  1.117       mrg 	${MAKE} ${_J} ${_M} cleandir
    169   1.39  christos .endif
    170  1.123       mrg 
    171  1.123       mrg do-make-obj:
    172  1.103    simonb .if ${MKOBJDIRS} != "no"
    173  1.122  sommerfe 	${MAKE} ${_J} ${_M} obj
    174  1.127        tv .endif
    175  1.123       mrg 
    176  1.123       mrg do-make-includes:
    177  1.112       mrg .if !defined(NOINCLUDES)
    178  1.112       mrg 	${MAKE} ${_M} includes
    179   1.71   mycroft .endif
    180  1.123       mrg 
    181  1.123       mrg do-lib-csu:
    182   1.61   mycroft 	(cd ${.CURDIR}/lib/csu && \
    183  1.113       mrg 	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
    184  1.113       mrg 	    ${MAKE} ${_M} MKSHARE=no install)
    185  1.123       mrg 
    186  1.123       mrg do-lib:
    187   1.61   mycroft 	(cd ${.CURDIR}/lib && \
    188  1.113       mrg 	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
    189  1.113       mrg 	    ${MAKE} ${_M} MKSHARE=no install)
    190  1.123       mrg 
    191  1.123       mrg do-gnu-lib:
    192   1.61   mycroft 	(cd ${.CURDIR}/gnu/lib && \
    193  1.113       mrg 	    ${MAKE} ${_M} ${_J} MKSHARE=no dependall && \
    194  1.113       mrg 	    ${MAKE} ${_M} MKSHARE=no install)
    195  1.123       mrg 
    196  1.123       mrg do-dependall:
    197  1.112       mrg 	${MAKE} ${_M} ${_J} dependall && ${MAKE} ${_M} _BUILD= install
    198  1.123       mrg 
    199  1.123       mrg do-domestic:
    200   1.97  christos .if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM)
    201  1.112       mrg 	(cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_M} ${_J} _SLAVE_BUILD= build)
    202   1.49     lukem .endif
    203  1.123       mrg 
    204  1.123       mrg do-whatisdb:
    205  1.112       mrg 	${MAKE} ${_M} whatis.db
    206   1.87       cjs 
    207   1.87       cjs release snapshot: build
    208  1.112       mrg 	(cd ${.CURDIR}/etc && ${MAKE} ${_M} INSTALL_DONE=1 release)
    209  1.129        tv 
    210  1.129        tv # Speedup stubs for some subtrees that don't need to run these rules
    211  1.129        tv includes-bin includes-games includes-libexec includes-regress \
    212  1.129        tv includes-sbin includes-usr.sbin:
    213  1.136   nathanw 	@true
    214    1.1       cgd 
    215  1.130        tv .if !exists(${.CURDIR}/share/mk)
    216  1.130        tv .BEGIN:
    217  1.130        tv 	@echo 'BUILD ABORTED: share/mk does not exist, cannot run make.'
    218  1.130        tv 	@false
    219  1.130        tv .endif
    220  1.130        tv 
    221  1.133        tv .include "${.CURDIR}/share/mk/bsd.subdir.mk"
    222  1.130        tv 
    223  1.130        tv _M:=	-m ${.CURDIR}/share/mk
    224