Makefile revision 1.97
1# $NetBSD: Makefile,v 1.97 1999/05/27 21:03:31 christos 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# EXPORTABLE_SYSTEM, when set, ensures that non-exportable crypto code 29# is not compiled or installed. EXPORTABLE_SYSTEM is ignored if 30# the `domestic/crypto-us' subtree does not exist. 31# FORCE_DOMESTIC, when set, forces a descent into the domestic/crypto-us tree 32# when handling the `all', `includes', and `install' targets. This 33# flag is incompatible with the `build' target. It's generally a 34# bad idea to use FORCE_DOMESTIC unless the ramifications are well 35# understood, and should never be enabled by default. FORCE_DOMESTIC 36# is ignored if the `domestic/crypto-us' subtree does not exist. 37# 38# Targets: 39# build: builds a full release of netbsd in DESTDIR. 40# release: does a `make build,' and then tars up the DESTDIR files 41# into RELEASEDIR, in release(7) format. (See etc/Makefile for 42# more information on this.) 43# snapshot: a synonym for release. 44 45.include <bsd.own.mk> # for configuration variables. 46 47 48HAVE_GCC28!= ${CXX} --version | egrep "^(2\.8|egcs)" ; echo 49 50.if defined(NBUILDJOBS) 51_J= -j${NBUILDJOBS} 52.endif 53 54# NOTE THAT etc *DOES NOT* BELONG IN THE LIST BELOW 55 56SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share sys 57 58.if exists(games) 59SUBDIR+= games 60.endif 61 62SUBDIR+= gnu 63# This is needed for libstdc++ and gen-params. 64includes-gnu: includes-include includes-sys 65 66# Descend into the domestic/crypto-us tree if it exists AND 67# 1) the target is clean, cleandir, or obj, OR 68# 2) the the target is install or includes AND 69# NOT compiling only "exportable" code AND 70# doing it as part of installing a distribution, OR 71# 3) we Really Know what we're doing. (Really!) 72# 73# NOTE: due to the use of the make(foo) construct here, using the 74# clean, cleandir, and obj targets on the command line in conjunction 75# with any other target may produce unexpected results. 76 77.if exists(domestic) 78DOMESTIC=domestic 79.elif exists(crypto-us) 80DOMESTIC=crypto-us 81.endif 82 83.if defined(DOMESTIC) && \ 84 (make(clean) || make(cleandir) || make(obj) || \ 85 ((make(includes) || make(install)) && \ 86 !defined(EXPORTABLE_SYSTEM) && defined(_DISTRIB)) || \ 87 defined(FORCE_DOMESTIC)) 88SUBDIR+= ${DOMESTIC} 89.endif 90 91.if exists(regress) 92.ifmake !(install) 93SUBDIR+= regress 94.endif 95 96regression-tests: 97 @echo Running regression tests... 98 @(cd ${.CURDIR}/regress && ${MAKE} regress) 99.endif 100 101beforeinstall: 102.ifmake build 103 @echo -n "Build started at: " 104 @date 105.endif 106.ifndef DESTDIR 107 (cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs) 108.else 109 (cd ${.CURDIR}/etc && ${MAKE} distrib-dirs) 110.endif 111 112afterinstall: 113.if ${MKMAN} != "no" && !defined(_BUILD) 114 ${MAKE} whatis.db 115.endif 116 117whatis.db: 118 (cd ${.CURDIR}/share/man && ${MAKE} makedb) 119 120# wrt info/dir below: It's safe to move this over top of /usr/share/info/dir, 121# as the build will automatically remove/replace the non-pkg entries there. 122 123build: beforeinstall 124.if defined(FORCE_DOMESTIC) 125 @echo '*** CAPUTE!' 126 @echo ' The FORCE_DOMESTIC flag is not compatible with "make build".' 127 @echo ' Please correct the problem and try again.' 128 @false 129.endif 130.if ${MKSHARE} != "no" 131 (cd ${.CURDIR}/share/mk && ${MAKE} install) 132 (cd ${.CURDIR}/share/tmac && ${MAKE} && ${MAKE} install) 133.endif 134.if !defined(UPDATE) 135 ${MAKE} cleandir 136.endif 137.if empty(HAVE_GCC28) 138.if defined(DESTDIR) 139 @echo "*** CAPUTE!" 140 @echo " You attempted to compile the world without egcs. You must" 141 @echo " first install a native egcs compiler." 142 @false 143.else 144 (cd ${.CURDIR}/gnu/usr.bin/egcs && \ 145 ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \ 146 ${MAKE} MKMAN=no install && ${MAKE} cleandir) 147.endif 148.endif 149 ${MAKE} includes 150 (cd ${.CURDIR}/lib/csu && \ 151 ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \ 152 ${MAKE} MKMAN=no install) 153 (cd ${.CURDIR}/lib && \ 154 ${MAKE} depend && ${MAKE} ${_J} MKMAN=no && \ 155 ${MAKE} MKMAN=no install) 156 (cd ${.CURDIR}/gnu/lib && \ 157 ${MAKE} depend && ${MAKE} ${_J} MKMAN=no MKINFO=no && \ 158 ${MAKE} MKMAN=no MKINFO=no install) 159 ${MAKE} depend && ${MAKE} ${_J} && ${MAKE} _BUILD= install 160.if defined(DOMESTIC) && !defined(EXPORTABLE_SYSTEM) 161 (cd ${.CURDIR}/${DOMESTIC} && ${MAKE} ${_J} _SLAVE_BUILD= build) 162.endif 163 ${MAKE} whatis.db 164 @echo -n "Build finished at: " 165 @date 166 167release snapshot: build 168 (cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release) 169 170.include <bsd.subdir.mk> 171