1*0a6a1f1dSLionel Sambuc# $NetBSD: Makefile,v 1.316 2015/07/23 08:03:25 mrg Exp $ 29152e1c5SLionel Sambuc 39152e1c5SLionel Sambuc# 49152e1c5SLionel Sambuc# This is the top-level makefile for building NetBSD. For an outline of 59152e1c5SLionel Sambuc# how to build a snapshot or release, as well as other release engineering 69152e1c5SLionel Sambuc# information, see http://www.NetBSD.org/developers/releng/index.html 79152e1c5SLionel Sambuc# 89152e1c5SLionel Sambuc# Not everything you can set or do is documented in this makefile. In 99152e1c5SLionel Sambuc# particular, you should review the files in /usr/share/mk (especially 109152e1c5SLionel Sambuc# bsd.README) for general information on building programs and writing 119152e1c5SLionel Sambuc# Makefiles within this structure, and see the comments in src/etc/Makefile 129152e1c5SLionel Sambuc# for further information on installation and release set options. 139152e1c5SLionel Sambuc# 149152e1c5SLionel Sambuc# Variables listed below can be set on the make command line (highest 159152e1c5SLionel Sambuc# priority), in /etc/mk.conf (middle priority), or in the environment 169152e1c5SLionel Sambuc# (lowest priority). 179152e1c5SLionel Sambuc# 189152e1c5SLionel Sambuc# Variables: 199152e1c5SLionel Sambuc# DESTDIR is the target directory for installation of the compiled 209152e1c5SLionel Sambuc# software. It defaults to /. Note that programs are built against 219152e1c5SLionel Sambuc# libraries installed in DESTDIR. 229152e1c5SLionel Sambuc# MKMAN, if `no', will prevent building of manual pages. 239152e1c5SLionel Sambuc# MKOBJDIRS, if not `no', will build object directories at 249152e1c5SLionel Sambuc# an appropriate point in a build. 259152e1c5SLionel Sambuc# MKSHARE, if `no', will prevent building and installing 269152e1c5SLionel Sambuc# anything in /usr/share. 279152e1c5SLionel Sambuc# MKUPDATE, if not `no', will avoid a `make cleandir' at the start of 289152e1c5SLionel Sambuc# `make build', as well as having the effects listed in 299152e1c5SLionel Sambuc# /usr/share/mk/bsd.README. 309152e1c5SLionel Sambuc# NOCLEANDIR, if defined, will avoid a `make cleandir' at the start 319152e1c5SLionel Sambuc# of the `make build'. 329152e1c5SLionel Sambuc# NOINCLUDES will avoid the `make includes' usually done by `make build'. 339152e1c5SLionel Sambuc# 349152e1c5SLionel Sambuc# See mk.conf(5) for more details. 359152e1c5SLionel Sambuc# 369152e1c5SLionel Sambuc# 379152e1c5SLionel Sambuc# Targets: 389152e1c5SLionel Sambuc# build: 399152e1c5SLionel Sambuc# Builds a full release of NetBSD in DESTDIR, except for the 409152e1c5SLionel Sambuc# /etc configuration files. 419152e1c5SLionel Sambuc# If BUILD_DONE is set, this is an empty target. 429152e1c5SLionel Sambuc# distribution: 439152e1c5SLionel Sambuc# Builds a full release of NetBSD in DESTDIR, including the /etc 449152e1c5SLionel Sambuc# configuration files. 459152e1c5SLionel Sambuc# buildworld: 469152e1c5SLionel Sambuc# As per `make distribution', except that it ensures that DESTDIR 479152e1c5SLionel Sambuc# is not the root directory. 489152e1c5SLionel Sambuc# installworld: 499152e1c5SLionel Sambuc# Install the distribution from DESTDIR to INSTALLWORLDDIR (which 509152e1c5SLionel Sambuc# defaults to the root directory). Ensures that INSTALLWORLDDIR 519152e1c5SLionel Sambuc# is not the root directory if cross compiling. 529152e1c5SLionel Sambuc# release: 539152e1c5SLionel Sambuc# Does a `make distribution', and then tars up the DESTDIR files 549152e1c5SLionel Sambuc# into ${RELEASEDIR}/${RELEASEMACHINEDIR}, in release(7) format. 559152e1c5SLionel Sambuc# (See etc/Makefile for more information on this.) 569152e1c5SLionel Sambuc# regression-tests: 579152e1c5SLionel Sambuc# Runs the regression tests in "regress" on this host. 589152e1c5SLionel Sambuc# sets: 599152e1c5SLionel Sambuc# Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets 609152e1c5SLionel Sambuc# from ${DESTDIR} 619152e1c5SLionel Sambuc# sourcesets: 629152e1c5SLionel Sambuc# Populate ${RELEASEDIR}/source/sets from ${NETBSDSRCDIR} 639152e1c5SLionel Sambuc# syspkgs: 649152e1c5SLionel Sambuc# Populate ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs 659152e1c5SLionel Sambuc# from ${DESTDIR} 669152e1c5SLionel Sambuc# iso-image: 67*0a6a1f1dSLionel Sambuc# Create CD-ROM image in RELEASEDIR/images. 689152e1c5SLionel Sambuc# RELEASEDIR must already have been populated by `make release' 699152e1c5SLionel Sambuc# or equivalent. 709152e1c5SLionel Sambuc# iso-image-source: 71*0a6a1f1dSLionel Sambuc# Create CD-ROM image with source in RELEASEDIR/images. 729152e1c5SLionel Sambuc# RELEASEDIR must already have been populated by 739152e1c5SLionel Sambuc# `make release sourcesets' or equivalent. 749152e1c5SLionel Sambuc# live-image: 759152e1c5SLionel Sambuc# Create bootable live image for emulators or USB stick etc. 769152e1c5SLionel Sambuc# in RELEASEDIR/liveimage. 779152e1c5SLionel Sambuc# RELEASEDIR must already have been populated by `make release' 789152e1c5SLionel Sambuc# or equivalent. 799152e1c5SLionel Sambuc# install-image: 809152e1c5SLionel Sambuc# Create bootable installation image for USB stick etc. 819152e1c5SLionel Sambuc# in RELEASEDIR/installimage. 829152e1c5SLionel Sambuc# RELEASEDIR must already have been populated by `make release' 839152e1c5SLionel Sambuc# or equivalent. 849152e1c5SLionel Sambuc# 859152e1c5SLionel Sambuc# Targets invoked by `make build,' in order: 869152e1c5SLionel Sambuc# cleandir: cleans the tree. 879152e1c5SLionel Sambuc# do-top-obj: creates the top level object directory. 889152e1c5SLionel Sambuc# do-tools-obj: creates object directories for the host toolchain. 899152e1c5SLionel Sambuc# do-tools: builds host toolchain. 9084d9c625SLionel Sambuc# params: record the values of variables that might affect the 9184d9c625SLionel Sambuc# build. 929152e1c5SLionel Sambuc# obj: creates object directories. 939152e1c5SLionel Sambuc# do-distrib-dirs: creates the distribution directories. 949152e1c5SLionel Sambuc# includes: installs include files. 959152e1c5SLionel Sambuc# do-lib: builds and installs prerequisites from lib 969152e1c5SLionel Sambuc# if ${MKCOMPAT} != "no". 979152e1c5SLionel Sambuc# do-compat-lib: builds and installs prerequisites from compat/lib 989152e1c5SLionel Sambuc# if ${MKCOMPAT} != "no". 999152e1c5SLionel Sambuc# do-build: builds and installs the entire system. 1009152e1c5SLionel Sambuc# do-x11: builds and installs X11 if ${MKX11} != "no"; either 101*0a6a1f1dSLionel Sambuc# X11R7 from src/external/mit/xorg 1029152e1c5SLionel Sambuc# do-extsrc: builds and installs extsrc if ${MKEXTSRC} != "no". 1039152e1c5SLionel Sambuc# do-obsolete: installs the obsolete sets (for the postinstall-* targets). 1049152e1c5SLionel Sambuc# 1059152e1c5SLionel Sambuc 1069152e1c5SLionel Sambuc.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == "" 1079152e1c5SLionel Sambuc.MAKEFLAGS: -m ${.CURDIR}/share/mk 1089152e1c5SLionel Sambuc.endif 1099152e1c5SLionel Sambuc 1109152e1c5SLionel Sambuc# 1119152e1c5SLionel Sambuc# If _SRC_TOP_OBJ_ gets set here, we will end up with a directory that may 1129152e1c5SLionel Sambuc# not be the top level objdir, because "make obj" can happen in the *middle* 1139152e1c5SLionel Sambuc# of "make build" (long after <bsd.own.mk> is calculated it). So, pre-set 1149152e1c5SLionel Sambuc# _SRC_TOP_OBJ_ here so it will not be added to ${.MAKEOVERRIDES}. 1159152e1c5SLionel Sambuc# 1169152e1c5SLionel Sambuc_SRC_TOP_OBJ_= 1179865aeaaSBen Gras 118d824b54dSArun Thomas.include <bsd.own.mk> 119d824b54dSArun Thomas 1209152e1c5SLionel Sambuc# 1219152e1c5SLionel Sambuc# Sanity check: make sure that "make build" is not invoked simultaneously 1229152e1c5SLionel Sambuc# with a standard recursive target. 12315b5f4afSBen Gras# 124c8a0e2f4SThomas Veerman 1259152e1c5SLionel Sambuc.if make(build) || make(release) || make(snapshot) 1269152e1c5SLionel Sambuc.for targ in ${TARGETS:Nobj:Ncleandir} 1279152e1c5SLionel Sambuc.if make(${targ}) && !target(.BEGIN) 1289152e1c5SLionel Sambuc.BEGIN: 1299152e1c5SLionel Sambuc @echo 'BUILD ABORTED: "make build" and "make ${targ}" are mutually exclusive.' 1309152e1c5SLionel Sambuc @false 1319152e1c5SLionel Sambuc.endif 1329152e1c5SLionel Sambuc.endfor 1339152e1c5SLionel Sambuc.endif 134c8a0e2f4SThomas Veerman 1359152e1c5SLionel Sambuc# 1369152e1c5SLionel Sambuc# _SUBDIR is used to set SUBDIR, after removing directories that have 1379152e1c5SLionel Sambuc# BUILD_${dir}=no, or that have no ${dir}/Makefile. 1389152e1c5SLionel Sambuc# 139433d6423SLionel Sambuc_SUBDIR= tools lib include gnu external crypto/external bin games 14084d9c625SLionel Sambuc_SUBDIR+= libexec sbin usr.bin 14184d9c625SLionel Sambuc_SUBDIR+= usr.sbin share sys etc tests compat 14284d9c625SLionel Sambuc_SUBDIR+= .WAIT rescue .WAIT distrib regress 143cd34841dSBen Gras.if defined(__MINIX) 144cd34841dSBen Gras# the minix subdir depends on some other things (e.g. lib/) 145cd34841dSBen Gras_SUBDIR+= .WAIT minix 146cd34841dSBen Gras.endif # defined(__MINIX) 1474d09b840SBen Gras 1489152e1c5SLionel Sambuc.for dir in ${_SUBDIR} 1499152e1c5SLionel Sambuc.if "${dir}" == ".WAIT" \ 1509152e1c5SLionel Sambuc || (${BUILD_${dir}:Uyes} != "no" && exists(${dir}/Makefile)) 1519152e1c5SLionel SambucSUBDIR+= ${dir} 1529152e1c5SLionel Sambuc.endif 15329a24b06SBen Gras.endfor 154a5741a46SErik van der Kouwe 1559152e1c5SLionel Sambuc.if exists(regress) 1569152e1c5SLionel Sambucregression-tests: .PHONY .MAKE 1579152e1c5SLionel Sambuc @echo Running regression tests... 1589152e1c5SLionel Sambuc ${MAKEDIRTARGET} regress regress 1599152e1c5SLionel Sambuc.endif 160fd4b7f7aSBen Gras 1619152e1c5SLionel Sambuc.if ${MKUNPRIVED} != "no" 1629152e1c5SLionel SambucNOPOSTINSTALL= # defined 1639152e1c5SLionel Sambuc.endif 164b7061124SArun Thomas 1659152e1c5SLionel Sambucafterinstall: .PHONY .MAKE 1669152e1c5SLionel Sambuc.if ${MKMAN} != "no" 1679152e1c5SLionel Sambuc.if !defined(__MINIX) 1689152e1c5SLionel Sambuc ${MAKEDIRTARGET} share/man makedb 1699152e1c5SLionel Sambuc.else 170433d6423SLionel Sambuc ${MAKEDIRTARGET} minix/man makedb 1719152e1c5SLionel Sambuc.endif # !defined(__MINIX) 1729152e1c5SLionel Sambuc.endif 1739152e1c5SLionel Sambuc.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no") 1749152e1c5SLionel Sambuc ${MAKEDIRTARGET} gnu/usr.bin/texinfo/install-info infodir-meta 1759152e1c5SLionel Sambuc.endif 1769152e1c5SLionel Sambuc.if !defined(NOPOSTINSTALL) 1779152e1c5SLionel Sambuc ${MAKEDIRTARGET} . postinstall-check 1789152e1c5SLionel Sambuc.endif 1792fe8fb19SBen Gras 180*0a6a1f1dSLionel Sambuc_POSTINSTALL= ${.CURDIR}/usr.sbin/postinstall/postinstall \ 181*0a6a1f1dSLionel Sambuc -m ${MACHINE} -a ${MACHINE_ARCH} 1829152e1c5SLionel Sambuc_POSTINSTALL_ENV= \ 1839152e1c5SLionel Sambuc AWK=${TOOL_AWK:Q} \ 1849152e1c5SLionel Sambuc DB=${TOOL_DB:Q} \ 1859152e1c5SLionel Sambuc HOST_SH=${HOST_SH:Q} \ 1869152e1c5SLionel Sambuc MAKE=${MAKE:Q} \ 1879152e1c5SLionel Sambuc PWD_MKDB=${TOOL_PWD_MKDB:Q} \ 188*0a6a1f1dSLionel Sambuc SED=${TOOL_SED:Q} \ 1899152e1c5SLionel Sambuc STAT=${TOOL_STAT:Q} 1909152e1c5SLionel Sambuc 191*0a6a1f1dSLionel Sambuc.if ${MKX11} != "no" 192*0a6a1f1dSLionel Sambuc_POSTINSTALL_X11=-x ${X11SRCDIR:Q} 193*0a6a1f1dSLionel Sambuc.endif 194*0a6a1f1dSLionel Sambuc 1959152e1c5SLionel Sambucpostinstall-check: .PHONY 1969152e1c5SLionel Sambuc @echo " === Post installation checks ===" 197*0a6a1f1dSLionel Sambuc ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi 1989152e1c5SLionel Sambuc @echo " ================================" 1999152e1c5SLionel Sambuc 2009152e1c5SLionel Sambucpostinstall-fix: .NOTMAIN .PHONY 2019152e1c5SLionel Sambuc @echo " === Post installation fixes ===" 202*0a6a1f1dSLionel Sambuc ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix 2039152e1c5SLionel Sambuc @echo " ===============================" 2049152e1c5SLionel Sambuc 2059152e1c5SLionel Sambucpostinstall-fix-obsolete: .NOTMAIN .PHONY 2069152e1c5SLionel Sambuc @echo " === Removing obsolete files ===" 207*0a6a1f1dSLionel Sambuc ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete 208*0a6a1f1dSLionel Sambuc @echo " ===============================" 209*0a6a1f1dSLionel Sambuc 210*0a6a1f1dSLionel Sambucpostinstall-fix-obsolete_stand: .NOTMAIN .PHONY 211*0a6a1f1dSLionel Sambuc @echo " === Removing obsolete files ===" 212*0a6a1f1dSLionel Sambuc ${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand 2139152e1c5SLionel Sambuc @echo " ===============================" 2149152e1c5SLionel Sambuc 2159152e1c5SLionel Sambuc 2169152e1c5SLionel Sambuc# 2179152e1c5SLionel Sambuc# Targets (in order!) called by "make build". 2189152e1c5SLionel Sambuc# 2199152e1c5SLionel SambucBUILDTARGETS+= check-tools 2209152e1c5SLionel Sambuc.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR) 2219152e1c5SLionel SambucBUILDTARGETS+= cleandir 2229152e1c5SLionel Sambuc.endif 2239152e1c5SLionel Sambuc.if ${MKOBJDIRS} != "no" 2249152e1c5SLionel SambucBUILDTARGETS+= do-top-obj 2259152e1c5SLionel Sambuc.endif 2269152e1c5SLionel Sambuc.if ${USETOOLS} == "yes" # { 2279152e1c5SLionel Sambuc.if ${MKOBJDIRS} != "no" 2289152e1c5SLionel SambucBUILDTARGETS+= do-tools-obj 2299152e1c5SLionel Sambuc.endif 2309152e1c5SLionel SambucBUILDTARGETS+= do-tools 2319152e1c5SLionel Sambuc.endif # USETOOLS # } 23284d9c625SLionel SambucBUILDTARGETS+= params 2339152e1c5SLionel Sambuc.if ${MKOBJDIRS} != "no" 2349152e1c5SLionel SambucBUILDTARGETS+= obj 2359152e1c5SLionel Sambuc.endif 2369152e1c5SLionel SambucBUILDTARGETS+= clean_METALOG 2379152e1c5SLionel Sambuc.if !defined(NODISTRIBDIRS) 2389152e1c5SLionel SambucBUILDTARGETS+= do-distrib-dirs 2399152e1c5SLionel Sambuc.endif 2409152e1c5SLionel Sambuc.if !defined(NOINCLUDES) 2419152e1c5SLionel SambucBUILDTARGETS+= includes 2429152e1c5SLionel Sambuc.endif 2439152e1c5SLionel SambucBUILDTARGETS+= do-lib 2449152e1c5SLionel Sambuc.if !defined(__MINIX) 2459152e1c5SLionel Sambuc# LSC Not used in MINIX3 2469152e1c5SLionel SambucBUILDTARGETS+= do-compat-lib 2470181ec6bSLionel Sambuc.endif # !defined(__MINIX) 2489152e1c5SLionel Sambuc.if ${MKX11} != "no" 2499152e1c5SLionel SambucBUILDTARGETS+= do-x11 2509152e1c5SLionel Sambuc.endif 251*0a6a1f1dSLionel SambucBUILDTARGETS+= do-build 2529152e1c5SLionel Sambuc.if ${MKEXTSRC} != "no" 2539152e1c5SLionel SambucBUILDTARGETS+= do-extsrc 2549152e1c5SLionel Sambuc.endif 255fad76abeSBen Gras 256fad76abeSBen Gras.if defined(__MINIX) && ${MKSRC} == "yes" 257fad76abeSBen GrasBUILDTARGETS+= do-installsrc 258fad76abeSBen Gras.endif # defined(__MINIX) 259fad76abeSBen Gras 2609152e1c5SLionel SambucBUILDTARGETS+= do-obsolete 2619152e1c5SLionel Sambuc 2629152e1c5SLionel Sambuc# 2639152e1c5SLionel Sambuc# Enforce proper ordering of some rules. 2649152e1c5SLionel Sambuc# 2659152e1c5SLionel Sambuc 2669152e1c5SLionel Sambuc.ORDER: ${BUILDTARGETS} 2679152e1c5SLionel Sambucincludes-lib: .PHONY includes-include includes-sys 2689152e1c5SLionel Sambucincludes-gnu: .PHONY includes-lib 2699152e1c5SLionel Sambuc 2709152e1c5SLionel Sambuc# 27184d9c625SLionel Sambuc# Record the values of variables that might affect the build. 27284d9c625SLionel Sambuc# If no values have changed, avoid updating the timestamp 27384d9c625SLionel Sambuc# of the params file. 27484d9c625SLionel Sambuc# 27584d9c625SLionel Sambuc# This is referenced by _NETBSD_VERSION_DEPENDS in <bsd.own.mk>. 27684d9c625SLionel Sambuc# 27784d9c625SLionel Sambuc.include "${NETBSDSRCDIR}/etc/Makefile.params" 27884d9c625SLionel SambucCLEANDIRFILES+= params 27984d9c625SLionel Sambucparams: .EXEC 28084d9c625SLionel Sambuc ${_MKMSG_CREATE} params 28184d9c625SLionel Sambuc @${PRINT_PARAMS} >${.TARGET}.new 28284d9c625SLionel Sambuc @if cmp -s ${.TARGET}.new ${.TARGET} > /dev/null 2>&1; then \ 28384d9c625SLionel Sambuc : "params is unchanged" ; \ 28484d9c625SLionel Sambuc rm ${.TARGET}.new ; \ 28584d9c625SLionel Sambuc else \ 28684d9c625SLionel Sambuc : "params has changed or is new" ; \ 28784d9c625SLionel Sambuc mv ${.TARGET}.new ${.TARGET} ; \ 28884d9c625SLionel Sambuc fi 28984d9c625SLionel Sambuc 29084d9c625SLionel Sambuc# 29184d9c625SLionel Sambuc# Display current make(1) parameters 29284d9c625SLionel Sambuc# 29384d9c625SLionel Sambucshow-params: .PHONY .MAKE 29484d9c625SLionel Sambuc @${PRINT_PARAMS} 29584d9c625SLionel Sambuc 29684d9c625SLionel Sambuc# 2979152e1c5SLionel Sambuc# Build the system and install into DESTDIR. 2989152e1c5SLionel Sambuc# 2999152e1c5SLionel Sambuc 3009152e1c5SLionel SambucSTART_TIME!= date 3019152e1c5SLionel Sambuc 30253da2c99SLionel Sambuc.if defined(__MINIX) 30353da2c99SLionel Sambucworld: build .PHONY .MAKE 3040181ec6bSLionel Sambuc ${MAKEDIRTARGET} . etcfiles 30553da2c99SLionel Sambuc @echo "WARNING: " 30653da2c99SLionel Sambuc @echo "WARNING: The 'world' target is obsolete, please use 'build' instead." 30753da2c99SLionel Sambuc @echo "WARNING: " 30853da2c99SLionel Sambuc 3090181ec6bSLionel Sambucetcfiles: .PHONY .MAKE 3100181ec6bSLionel Sambuc ${MAKEDIRTARGET} etc install-etc-files-safe DESTDIR=${DESTDIR:U/} 3110181ec6bSLionel Sambuc 31253da2c99SLionel Sambucetcforce: .PHONY .MAKE 31353da2c99SLionel Sambuc ${MAKEDIRTARGET} etc install-etc-files DESTDIR=${DESTDIR:U/} 31453da2c99SLionel Sambuc 3150181ec6bSLionel Sambuc.endif # defined(__MINIX) 31653da2c99SLionel Sambuc 3179152e1c5SLionel Sambucbuild: .PHONY .MAKE 3189152e1c5SLionel Sambuc.if defined(BUILD_DONE) 3199152e1c5SLionel Sambuc @echo "Build already installed into ${DESTDIR}" 3209152e1c5SLionel Sambuc.else 3219152e1c5SLionel Sambuc @echo "Build started at: ${START_TIME}" 3229152e1c5SLionel Sambuc.for tgt in ${BUILDTARGETS} 3239152e1c5SLionel Sambuc ${MAKEDIRTARGET} . ${tgt} 32429a24b06SBen Gras.endfor 3259152e1c5SLionel Sambuc ${MAKEDIRTARGET} etc install-etc-release 32695840514SLionel Sambuc.if defined(__MINIX) 327d6bc6cb4SBen Gras ${MAKEDIRTARGET} etc install-etc-files-safe DESTDIR=${DESTDIR:U/} 32895840514SLionel Sambuc ${MAKEDIRTARGET} releasetools do-hdboot 32995840514SLionel Sambuc.endif # defined(__MINIX) 3309152e1c5SLionel Sambuc @echo "Build started at: ${START_TIME}" 3319152e1c5SLionel Sambuc @printf "Build finished at: " && date 3329152e1c5SLionel Sambuc.endif 33329a24b06SBen Gras 3349152e1c5SLionel Sambuc# 3359152e1c5SLionel Sambuc# Build a full distribution, but not a release (i.e. no sets into 3369152e1c5SLionel Sambuc# ${RELEASEDIR}). "buildworld" enforces a build to ${DESTDIR} != / 3379152e1c5SLionel Sambuc# 3389152e1c5SLionel Sambuc 3399152e1c5SLionel Sambucdistribution buildworld: .PHONY .MAKE 3409152e1c5SLionel Sambuc.if make(buildworld) && \ 3419152e1c5SLionel Sambuc (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/") 3429152e1c5SLionel Sambuc @echo "Won't make ${.TARGET} with DESTDIR=/" 3439152e1c5SLionel Sambuc @false 3449152e1c5SLionel Sambuc.endif 3459152e1c5SLionel Sambuc ${MAKEDIRTARGET} . build NOPOSTINSTALL=1 3469152e1c5SLionel Sambuc ${MAKEDIRTARGET} etc distribution INSTALL_DONE=1 347bb65c813SLionel Sambuc.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/" 3489152e1c5SLionel Sambuc ${MAKEDIRTARGET} . postinstall-fix-obsolete 349*0a6a1f1dSLionel Sambuc ${MAKEDIRTARGET} . postinstall-fix-obsolete_stand 3509152e1c5SLionel Sambuc ${MAKEDIRTARGET} distrib/sets checkflist 3519152e1c5SLionel Sambuc.endif 3529152e1c5SLionel Sambuc @echo "make ${.TARGET} started at: ${START_TIME}" 3539152e1c5SLionel Sambuc @printf "make ${.TARGET} finished at: " && date 3549152e1c5SLionel Sambuc 3559152e1c5SLionel Sambuc# 3569152e1c5SLionel Sambuc# Install the distribution from $DESTDIR to $INSTALLWORLDDIR (defaults to `/') 3579152e1c5SLionel Sambuc# If installing to /, ensures that the host's operating system is NetBSD and 3589152e1c5SLionel Sambuc# the host's `uname -m` == ${MACHINE}. 3599152e1c5SLionel Sambuc# 3609152e1c5SLionel Sambuc 3619152e1c5SLionel SambucHOST_UNAME_S!= uname -s 3629152e1c5SLionel Sambuc.if ${HOST_OSTYPE:C/\-.*//} != "Minix" 3639152e1c5SLionel SambucHOST_UNAME_M!= uname -m 3649152e1c5SLionel Sambuc.else 3659152e1c5SLionel SambucHOST_UNAME_M:= ${MACHINE} 3669152e1c5SLionel Sambuc.endif 3679152e1c5SLionel Sambuc 3689152e1c5SLionel Sambucinstallworld: .PHONY .MAKE 3699152e1c5SLionel Sambuc.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/") 3709152e1c5SLionel Sambuc @echo "Can't make ${.TARGET} to DESTDIR=/" 3719152e1c5SLionel Sambuc @false 3729152e1c5SLionel Sambuc.endif 3739152e1c5SLionel Sambuc.if !defined(INSTALLWORLDDIR) || \ 3749152e1c5SLionel Sambuc ${INSTALLWORLDDIR} == "" || ${INSTALLWORLDDIR} == "/" 37584d9c625SLionel Sambuc.if (${HOST_UNAME_S} != "NetBSD") && (${HOST_UNAME_S} != "Minix") 3769152e1c5SLionel Sambuc @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to Minix with INSTALLWORLDDIR=/" 3779152e1c5SLionel Sambuc @false 3789152e1c5SLionel Sambuc.endif 3799152e1c5SLionel Sambuc.if (${HOST_UNAME_M} != ${MACHINE}) 3809152e1c5SLionel Sambuc @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLWORLDDIR=/" 3819152e1c5SLionel Sambuc @false 3829152e1c5SLionel Sambuc.endif 3839152e1c5SLionel Sambuc.endif 3849152e1c5SLionel Sambuc ${MAKEDIRTARGET} distrib/sets installsets \ 3859152e1c5SLionel Sambuc INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS=${INSTALLSETS:Q} 3869152e1c5SLionel Sambuc ${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR} 3879152e1c5SLionel Sambuc @echo "make ${.TARGET} started at: ${START_TIME}" 3889152e1c5SLionel Sambuc @printf "make ${.TARGET} finished at: " && date 3899152e1c5SLionel Sambuc 3909152e1c5SLionel Sambuc# 3919152e1c5SLionel Sambuc# Install modules from $DESTDIR to $INSTALLMODULESDIR 3929152e1c5SLionel Sambuc# 3939152e1c5SLionel Sambucinstallmodules: .PHONY .MAKE 3949152e1c5SLionel Sambuc.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/") 3959152e1c5SLionel Sambuc @echo "Can't make ${.TARGET} to DESTDIR=/" 3969152e1c5SLionel Sambuc @false 3979152e1c5SLionel Sambuc.endif 3989152e1c5SLionel Sambuc.if !defined(INSTALLMODULESDIR) || \ 3999152e1c5SLionel Sambuc ${INSTALLMODULESDIR} == "" || ${INSTALLMODULESDIR} == "/" 4009152e1c5SLionel Sambuc.if (${HOST_UNAME_S} != "NetBSD") 4019152e1c5SLionel Sambuc @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_S} to NetBSD with INSTALLMODULESDIR=/" 4029152e1c5SLionel Sambuc @false 4039152e1c5SLionel Sambuc.endif 4049152e1c5SLionel Sambuc.if (${HOST_UNAME_M} != ${MACHINE}) 4059152e1c5SLionel Sambuc @echo "Won't cross-make ${.TARGET} from ${HOST_UNAME_M} to ${MACHINE} with INSTALLMODULESDIR=/" 4069152e1c5SLionel Sambuc @false 4079152e1c5SLionel Sambuc.endif 4089152e1c5SLionel Sambuc.endif 4099152e1c5SLionel Sambuc ${MAKEDIRTARGET} sys/modules install DESTDIR=${INSTALLMODULESDIR:U/} 4109152e1c5SLionel Sambuc @echo "make ${.TARGET} started at: ${START_TIME}" 4119152e1c5SLionel Sambuc @printf "make ${.TARGET} finished at: " && date 4129152e1c5SLionel Sambuc 4139152e1c5SLionel Sambuc# 4149152e1c5SLionel Sambuc# Create sets from $DESTDIR or $NETBSDSRCDIR into $RELEASEDIR 4159152e1c5SLionel Sambuc# 4169152e1c5SLionel Sambuc 4179152e1c5SLionel Sambuc.for tgt in sets sourcesets syspkgs 4189152e1c5SLionel Sambuc${tgt}: .PHONY .MAKE 4199152e1c5SLionel Sambuc ${MAKEDIRTARGET} distrib/sets ${tgt} 42029a24b06SBen Gras.endfor 42129a24b06SBen Gras 4229152e1c5SLionel Sambuc# 4239152e1c5SLionel Sambuc# Build a release or snapshot (implies "make distribution"). Note that 4249152e1c5SLionel Sambuc# in this case, the set lists will be checked before the tar files 4259152e1c5SLionel Sambuc# are made. 4269152e1c5SLionel Sambuc# 42729a24b06SBen Gras 4289152e1c5SLionel Sambucrelease snapshot: .PHONY .MAKE 4299152e1c5SLionel Sambuc ${MAKEDIRTARGET} . distribution 4309152e1c5SLionel Sambuc ${MAKEDIRTARGET} etc release DISTRIBUTION_DONE=1 4319152e1c5SLionel Sambuc @echo "make ${.TARGET} started at: ${START_TIME}" 4329152e1c5SLionel Sambuc @printf "make ${.TARGET} finished at: " && date 43329a24b06SBen Gras 4349152e1c5SLionel Sambuc# 4359152e1c5SLionel Sambuc# Create a CD-ROM image. 4369152e1c5SLionel Sambuc# 43729a24b06SBen Gras 4389152e1c5SLionel Sambuciso-image: .PHONY 4399152e1c5SLionel Sambuc ${MAKEDIRTARGET} distrib iso_image 4409152e1c5SLionel Sambuc ${MAKEDIRTARGET} etc iso-image 4419152e1c5SLionel Sambuc @echo "make ${.TARGET} started at: ${START_TIME}" 4429152e1c5SLionel Sambuc @printf "make ${.TARGET} finished at: " && date 4439152e1c5SLionel Sambuc 4449152e1c5SLionel Sambuciso-image-source: .PHONY 4459152e1c5SLionel Sambuc ${MAKEDIRTARGET} distrib iso_image CDSOURCE=true 4469152e1c5SLionel Sambuc ${MAKEDIRTARGET} etc iso-image 4479152e1c5SLionel Sambuc @echo "make ${.TARGET} started at: ${START_TIME}" 4489152e1c5SLionel Sambuc @printf "make ${.TARGET} finished at: " && date 4499152e1c5SLionel Sambuc 4509152e1c5SLionel Sambuc# 4519152e1c5SLionel Sambuc# Create bootable live images. 4529152e1c5SLionel Sambuc# 4539152e1c5SLionel Sambuc 4549152e1c5SLionel Sambuclive-image: .PHONY 4559152e1c5SLionel Sambuc ${MAKEDIRTARGET} etc live-image 4569152e1c5SLionel Sambuc @echo "make ${.TARGET} started at: ${START_TIME}" 4579152e1c5SLionel Sambuc @printf "make ${.TARGET} finished at: " && date 4589152e1c5SLionel Sambuc 4599152e1c5SLionel Sambuc# 4609152e1c5SLionel Sambuc# Create bootable installation images. 4619152e1c5SLionel Sambuc# 4629152e1c5SLionel Sambuc 4639152e1c5SLionel Sambucinstall-image: .PHONY 4649152e1c5SLionel Sambuc ${MAKEDIRTARGET} etc install-image 4659152e1c5SLionel Sambuc @echo "make ${.TARGET} started at: ${START_TIME}" 4669152e1c5SLionel Sambuc @printf "make ${.TARGET} finished at: " && date 4679152e1c5SLionel Sambuc 4689152e1c5SLionel Sambuc# 4699152e1c5SLionel Sambuc# Special components of the "make build" process. 4709152e1c5SLionel Sambuc# 4719152e1c5SLionel Sambuc 4729152e1c5SLionel Sambuccheck-tools: .PHONY 4739152e1c5SLionel Sambuc.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN) 4749152e1c5SLionel Sambuc @echo '*** WARNING: Building on MACHINE=${MACHINE} with missing toolchain.' 4759152e1c5SLionel Sambuc @echo '*** May result in a failed build or corrupt binaries!' 4769152e1c5SLionel Sambuc.elif defined(EXTERNAL_TOOLCHAIN) 4779152e1c5SLionel Sambuc @echo '*** Using external toolchain rooted at ${EXTERNAL_TOOLCHAIN}.' 4789152e1c5SLionel Sambuc.endif 4799152e1c5SLionel Sambuc.if defined(NBUILDJOBS) 4809152e1c5SLionel Sambuc @echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!' 4819152e1c5SLionel Sambuc.endif 4829152e1c5SLionel Sambuc 4839152e1c5SLionel Sambuc# Delete or sanitise a leftover METALOG from a previous build. 4849152e1c5SLionel Sambucclean_METALOG: .PHONY .MAKE 4859152e1c5SLionel Sambuc.if ${MKUPDATE} != "no" 4869152e1c5SLionel Sambuc ${MAKEDIRTARGET} distrib/sets clean_METALOG 4879152e1c5SLionel Sambuc.endif 4889152e1c5SLionel Sambuc 4899152e1c5SLionel Sambucdo-distrib-dirs: .PHONY .MAKE 4909152e1c5SLionel Sambuc.if !defined(DESTDIR) || ${DESTDIR} == "" 4919152e1c5SLionel Sambuc ${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/ 4929152e1c5SLionel Sambuc.else 4939152e1c5SLionel Sambuc ${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR} 4949152e1c5SLionel Sambuc.endif 4959152e1c5SLionel Sambuc 4969152e1c5SLionel Sambuc.for targ in cleandir obj includes 4979152e1c5SLionel Sambucdo-${targ}: .PHONY ${targ} 4989152e1c5SLionel Sambuc @true 4999152e1c5SLionel Sambuc.endfor 5009152e1c5SLionel Sambuc 50184d9c625SLionel Sambucdo-tools: .PHONY .MAKE 50284d9c625SLionel Sambuc ${MAKEDIRTARGET} tools build_install 5039152e1c5SLionel Sambuc 5049152e1c5SLionel Sambucdo-lib: .PHONY .MAKE 5059152e1c5SLionel Sambuc ${MAKEDIRTARGET} lib build_install 5069152e1c5SLionel Sambuc 5079152e1c5SLionel Sambucdo-compat-lib: .PHONY .MAKE 5089152e1c5SLionel Sambuc ${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../lib" 5099152e1c5SLionel Sambuc 5109152e1c5SLionel Sambucdo-top-obj: .PHONY .MAKE 5119152e1c5SLionel Sambuc ${MAKEDIRTARGET} . obj NOSUBDIR= 5129152e1c5SLionel Sambuc 5139152e1c5SLionel Sambucdo-tools-obj: .PHONY .MAKE 5149152e1c5SLionel Sambuc ${MAKEDIRTARGET} tools obj 5159152e1c5SLionel Sambuc 5169152e1c5SLionel Sambucdo-build: .PHONY .MAKE 5179152e1c5SLionel Sambuc.for targ in dependall install 5189152e1c5SLionel Sambuc ${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no 5199152e1c5SLionel Sambuc.endfor 5209152e1c5SLionel Sambuc 5219152e1c5SLionel Sambucdo-x11: .PHONY .MAKE 5229152e1c5SLionel Sambuc.if ${MKX11} != "no" 523*0a6a1f1dSLionel Sambuc ${MAKEDIRTARGET} external/mit/xorg/tools all 524*0a6a1f1dSLionel Sambuc ${MAKEDIRTARGET} external/mit/xorg/lib build_install 525*0a6a1f1dSLionel Sambuc.if ${MKCOMPATX11} != "no" 526*0a6a1f1dSLionel Sambuc ${MAKEDIRTARGET} compat build_install BOOTSTRAP_SUBDIRS="../../../external/mit/xorg/lib" 5279152e1c5SLionel Sambuc.endif 5289152e1c5SLionel Sambuc.else 5299152e1c5SLionel Sambuc @echo "MKX11 is not enabled" 5309152e1c5SLionel Sambuc @false 5319152e1c5SLionel Sambuc.endif 5329152e1c5SLionel Sambuc 5339152e1c5SLionel Sambucdo-extsrc: .PHONY .MAKE 5349152e1c5SLionel Sambuc.if ${MKEXTSRC} != "no" 5359152e1c5SLionel Sambuc ${MAKEDIRTARGET} extsrc build 5369152e1c5SLionel Sambuc.else 5379152e1c5SLionel Sambuc @echo "MKEXTSRC is not enabled" 5389152e1c5SLionel Sambuc @false 5399152e1c5SLionel Sambuc.endif 5409152e1c5SLionel Sambuc 5419152e1c5SLionel Sambucdo-obsolete: .PHONY .MAKE 5429152e1c5SLionel Sambuc ${MAKEDIRTARGET} etc install-obsolete-lists 5439152e1c5SLionel Sambuc 5449152e1c5SLionel Sambuc# 5459152e1c5SLionel Sambuc# Speedup stubs for some subtrees that don't need to run these rules. 5469152e1c5SLionel Sambuc# (Tells <bsd.subdir.mk> not to recurse for them.) 5479152e1c5SLionel Sambuc# 5489152e1c5SLionel Sambuc 5499152e1c5SLionel Sambuc.for dir in bin etc distrib games libexec regress sbin usr.bin usr.sbin tools 5509152e1c5SLionel Sambucincludes-${dir}: .PHONY 5519152e1c5SLionel Sambuc @true 5529152e1c5SLionel Sambuc.endfor 5539152e1c5SLionel Sambuc.for dir in etc distrib regress 5549152e1c5SLionel Sambucinstall-${dir}: .PHONY 5559152e1c5SLionel Sambuc @true 5569152e1c5SLionel Sambuc.endfor 5579152e1c5SLionel Sambuc 558fad76abeSBen Gras.if defined(__MINIX) 559fad76abeSBen GrasSRCTAR=src.tar.gz 560fad76abeSBen Grasdo-installsrc: 561fad76abeSBen Gras cd ${.CURDIR} && git ls-tree -r HEAD --name-only | tar czf ${.OBJDIR}/$(SRCTAR) -T - 562fad76abeSBen Gras ${INSTALL_FILE} ${.OBJDIR}/$(SRCTAR) ${DESTDIR}/usr/src/ 563fad76abeSBen Gras.endif # defined(__MINIX) 564fad76abeSBen Gras 5659152e1c5SLionel Sambuc# 5669152e1c5SLionel Sambuc# XXX this needs to change when distrib Makefiles are recursion compliant 5679152e1c5SLionel Sambuc# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first... 5689152e1c5SLionel Sambuc# 5699152e1c5SLionel Sambucdependall-distrib depend-distrib all-distrib: .PHONY 5709152e1c5SLionel Sambuc @true 5719152e1c5SLionel Sambuc 5729152e1c5SLionel Sambuc.include <bsd.obj.mk> 5739152e1c5SLionel Sambuc.include <bsd.kernobj.mk> 5749152e1c5SLionel Sambuc.include <bsd.subdir.mk> 575