version 1.214, 2003/07/18 08:26:01 |
version 1.235, 2004/07/30 07:05:11 |
|
|
# |
# |
# This is the top-level makefile for building NetBSD. For an outline of |
# This is the top-level makefile for building NetBSD. For an outline of |
# how to build a snapshot or release, as well as other release engineering |
# how to build a snapshot or release, as well as other release engineering |
# information, see http://www.netbsd.org/developers/releng/index.html |
# information, see http://www.NetBSD.org/developers/releng/index.html |
# |
# |
# Not everything you can set or do is documented in this makefile. In |
# Not everything you can set or do is documented in this makefile. In |
# particular, you should review the files in /usr/share/mk (especially |
# particular, you should review the files in /usr/share/mk (especially |
|
|
# includes: installs include files. |
# includes: installs include files. |
# do-tools-compat: builds the "libnbcompat" library; needed for some |
# do-tools-compat: builds the "libnbcompat" library; needed for some |
# random host tool programs in the source tree. |
# random host tool programs in the source tree. |
# do-gnu-lib-libgcc: builds and installs prerequisites from gnu/lib/libgcc |
# do-gnu-lib-libgcc3: builds and installs prerequisites from gnu/lib/libgcc3 |
# do-lib-csu: builds and installs prerequisites from lib/csu. |
# do-lib-csu: builds and installs prerequisites from lib/csu. |
# do-lib-libc: builds and installs prerequisites from lib/libc. |
# do-lib-libc: builds and installs prerequisites from lib/libc. |
# do-lib: builds and installs prerequisites from lib. |
# do-lib: builds and installs prerequisites from lib. |
# do-gnu-lib: builds and installs prerequisites from gnu/lib. |
# do-gnu-lib: builds and installs prerequisites from gnu/lib. |
# do-ld.so: builds and installs prerequisites from libexec/ld.*_so. |
# do-ld.so: builds and installs prerequisites from libexec/ld.*_so. |
# do-build: builds and installs the entire system. |
# do-build: builds and installs the entire system. |
# do-obsolete: builds and installs the entire system. |
# do-x11: builds and installs X11R6 from src/x11 if ${MKX11} != "no" |
|
# do-obsolete: installs the obsolete sets (for the postinstall-* targets). |
# |
# |
|
|
.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == "" |
.if ${.MAKEFLAGS:M${.CURDIR}/share/mk} == "" |
|
|
.endfor |
.endfor |
|
|
.if exists(regress) |
.if exists(regress) |
regression-tests: |
regression-tests: .PHONY |
@echo Running regression tests... |
@echo Running regression tests... |
@(cd ${.CURDIR}/regress && ${MAKE} regress) |
${MAKEDIRTARGET} regress regress |
.endif |
.endif |
|
|
.if ${MKUNPRIVED} != "no" |
.if ${MKUNPRIVED} != "no" |
NOPOSTINSTALL= # defined |
NOPOSTINSTALL= # defined |
.endif |
.endif |
|
|
afterinstall: |
afterinstall: .PHONY |
.if ${MKMAN} != "no" |
.if ${MKMAN} != "no" |
(cd ${.CURDIR}/share/man && ${MAKE} makedb) |
${MAKEDIRTARGET} share/man makedb |
.endif |
.endif |
.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no") |
.if (${MKUNPRIVED} != "no" && ${MKINFO} != "no") |
(cd ${.CURDIR}/gnu/usr.bin/texinfo/install-info && ${MAKE} infodir-meta) |
${MAKEDIRTARGET} gnu/usr.bin/texinfo/install-info infodir-meta |
.endif |
.endif |
.if !defined(NOPOSTINSTALL) |
.if !defined(NOPOSTINSTALL) |
(cd ${.CURDIR} && ${MAKE} postinstall-check) |
${MAKEDIRTARGET} . postinstall-check |
.endif |
.endif |
|
|
postinstall-check: |
postinstall-check: .PHONY |
@echo " === Post installation checks ===" |
@echo " === Post installation checks ===" |
${HOST_SH} ${.CURDIR}/etc/postinstall -s ${.CURDIR} -d ${DESTDIR}/ check |
${HOST_SH} ${.CURDIR}/etc/postinstall -s ${.CURDIR} -d ${DESTDIR}/ check |
@echo " ================================" |
@echo " ================================" |
|
|
postinstall-fix: .NOTMAIN |
postinstall-fix: .NOTMAIN .PHONY |
@echo " === Post installation fixes ===" |
@echo " === Post installation fixes ===" |
${HOST_SH} ${.CURDIR}/etc/postinstall -s ${.CURDIR} -d ${DESTDIR}/ fix |
${HOST_SH} ${.CURDIR}/etc/postinstall -s ${.CURDIR} -d ${DESTDIR}/ fix |
@echo " ===============================" |
@echo " ===============================" |
|
|
postinstall-fix-obsolete: .NOTMAIN |
postinstall-fix-obsolete: .NOTMAIN .PHONY |
@echo " === Removing obsolete files ===" |
@echo " === Removing obsolete files ===" |
${HOST_SH} ${.CURDIR}/etc/postinstall -s ${.CURDIR} -d ${DESTDIR}/ fix obsolete |
${HOST_SH} ${.CURDIR}/etc/postinstall -s ${.CURDIR} -d ${DESTDIR}/ fix obsolete |
@echo " ===============================" |
@echo " ===============================" |
Line 160 postinstall-fix-obsolete: .NOTMAIN |
|
Line 161 postinstall-fix-obsolete: .NOTMAIN |
|
# |
# |
# Targets (in order!) called by "make build". |
# Targets (in order!) called by "make build". |
# |
# |
|
.if ${USE_TOOLS_TOOLCHAIN} == "no" |
|
LIBGCC_EXT=3 |
|
.else |
|
LIBGCC_EXT= |
|
.endif |
|
|
BUILDTARGETS+= check-tools |
BUILDTARGETS+= check-tools |
.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR) |
.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR) |
Line 178 BUILDTARGETS+= do-distrib-dirs |
|
Line 184 BUILDTARGETS+= do-distrib-dirs |
|
BUILDTARGETS+= includes |
BUILDTARGETS+= includes |
.endif |
.endif |
BUILDTARGETS+= do-tools-compat |
BUILDTARGETS+= do-tools-compat |
|
BUILDTARGETS+= do-lib-csu |
.if ${MKGCC} != "no" |
.if ${MKGCC} != "no" |
BUILDTARGETS+= do-gnu-lib-libgcc |
BUILDTARGETS+= do-gnu-lib-libgcc${LIBGCC_EXT} |
|
.endif |
|
BUILDTARGETS+= do-lib-libc |
|
BUILDTARGETS+= do-lib do-gnu-lib |
|
BUILDTARGETS+= do-ld.so |
|
BUILDTARGETS+= do-build |
|
.if ${MKX11} != "no" |
|
BUILDTARGETS+= do-x11 |
.endif |
.endif |
BUILDTARGETS+= do-lib-csu do-lib-libc do-lib do-gnu-lib do-ld.so do-build |
|
BUILDTARGETS+= do-obsolete |
BUILDTARGETS+= do-obsolete |
|
|
# |
# |
Line 189 BUILDTARGETS+= do-obsolete |
|
Line 202 BUILDTARGETS+= do-obsolete |
|
# |
# |
|
|
.ORDER: ${BUILDTARGETS} |
.ORDER: ${BUILDTARGETS} |
includes-lib: includes-include includes-sys |
includes-lib: .PHONY includes-include includes-sys |
includes-gnu: includes-lib |
includes-gnu: .PHONY includes-lib |
|
|
# |
# |
# Build the system and install into DESTDIR. |
# Build the system and install into DESTDIR. |
Line 198 includes-gnu: includes-lib |
|
Line 211 includes-gnu: includes-lib |
|
|
|
START_TIME!= date |
START_TIME!= date |
|
|
build: |
build: .PHONY |
.if defined(BUILD_DONE) |
.if defined(BUILD_DONE) |
@echo "Build already installed into ${DESTDIR}" |
@echo "Build already installed into ${DESTDIR}" |
.else |
.else |
@echo "Build started at: ${START_TIME}" |
@echo "Build started at: ${START_TIME}" |
.for tgt in ${BUILDTARGETS} |
.for tgt in ${BUILDTARGETS} |
@(cd ${.CURDIR} && ${MAKE} ${tgt}) |
${MAKEDIRTARGET} . ${tgt} |
.endfor |
.endfor |
|
${MAKEDIRTARGET} etc install-etc-release |
@echo "Build started at: ${START_TIME}" |
@echo "Build started at: ${START_TIME}" |
@printf "Build finished at: " && date |
@printf "Build finished at: " && date |
.endif |
.endif |
|
|
# ${RELEASEDIR}). "buildworld" enforces a build to ${DESTDIR} != / |
# ${RELEASEDIR}). "buildworld" enforces a build to ${DESTDIR} != / |
# |
# |
|
|
distribution buildworld: |
distribution buildworld: .PHONY |
.if make(buildworld) && \ |
.if make(buildworld) && \ |
(!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/") |
(!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/") |
@echo "Won't make ${.TARGET} with DESTDIR=/" |
@echo "Won't make ${.TARGET} with DESTDIR=/" |
@false |
@false |
.endif |
.endif |
(cd ${.CURDIR} && ${MAKE} NOPOSTINSTALL=1 build) |
${MAKEDIRTARGET} . build NOPOSTINSTALL=1 |
(cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 distribution) |
${MAKEDIRTARGET} etc distribution INSTALL_DONE=1 |
.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/" |
.if defined(DESTDIR) && ${DESTDIR} != "" && ${DESTDIR} != "/" |
${MAKE} postinstall-fix-obsolete |
${MAKEDIRTARGET} . postinstall-fix-obsolete |
(cd ${.CURDIR}/distrib/sets && ${MAKE} checkflist) |
${MAKEDIRTARGET} distrib/sets checkflist |
.endif |
.endif |
@echo "make ${.TARGET} started at: ${START_TIME}" |
@echo "make ${.TARGET} started at: ${START_TIME}" |
@printf "make ${.TARGET} finished at: " && date |
@printf "make ${.TARGET} finished at: " && date |
Line 239 distribution buildworld: |
|
Line 253 distribution buildworld: |
|
HOST_UNAME_S!= uname -s |
HOST_UNAME_S!= uname -s |
HOST_UNAME_M!= uname -m |
HOST_UNAME_M!= uname -m |
|
|
installworld: |
installworld: .PHONY |
.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/") |
.if (!defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/") |
@echo "Can't make ${.TARGET} to DESTDIR=/" |
@echo "Can't make ${.TARGET} to DESTDIR=/" |
@false |
@false |
|
|
@false |
@false |
.endif |
.endif |
.endif |
.endif |
(cd ${.CURDIR}/distrib/sets && \ |
${MAKEDIRTARGET} distrib/sets installsets \ |
${MAKE} INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS= installsets) |
INSTALLDIR=${INSTALLWORLDDIR:U/} INSTALLSETS= |
(cd ${.CURDIR} && \ |
${MAKEDIRTARGET} . postinstall-check DESTDIR=${INSTALLWORLDDIR} |
${MAKE} DESTDIR=${INSTALLWORLDDIR} postinstall-check) |
|
@echo "make ${.TARGET} started at: ${START_TIME}" |
@echo "make ${.TARGET} started at: ${START_TIME}" |
@printf "make ${.TARGET} finished at: " && date |
@printf "make ${.TARGET} finished at: " && date |
|
|
|
|
# |
# |
|
|
.for tgt in sets sourcesets |
.for tgt in sets sourcesets |
${tgt}: |
${tgt}: .PHONY |
(cd ${.CURDIR}/distrib/sets && ${MAKE} $@) |
${MAKEDIRTARGET} distrib/sets ${tgt} |
.endfor |
.endfor |
|
|
# |
# |
|
|
# are made. |
# are made. |
# |
# |
|
|
release snapshot: |
release snapshot: .PHONY |
(cd ${.CURDIR} && ${MAKE} NOPOSTINSTALL=1 build) |
${MAKEDIRTARGET} . build NOPOSTINSTALL=1 |
(cd ${.CURDIR}/etc && ${MAKE} INSTALL_DONE=1 release) |
${MAKEDIRTARGET} etc release INSTALL_DONE=1 |
@echo "make ${.TARGET} started at: ${START_TIME}" |
@echo "make ${.TARGET} started at: ${START_TIME}" |
@printf "make ${.TARGET} finished at: " && date |
@printf "make ${.TARGET} finished at: " && date |
|
|
Line 287 release snapshot: |
|
Line 300 release snapshot: |
|
# Special components of the "make build" process. |
# Special components of the "make build" process. |
# |
# |
|
|
check-tools: |
check-tools: .PHONY |
.if ${TOOLCHAIN_MISSING} == "yes" && !defined(EXTERNAL_TOOLCHAIN) |
.if ${TOOLCHAIN_MISSING} != "no" && !defined(EXTERNAL_TOOLCHAIN) |
@echo '*** WARNING: Building on MACHINE=${MACHINE} with missing toolchain.' |
@echo '*** WARNING: Building on MACHINE=${MACHINE} with missing toolchain.' |
@echo '*** May result in a failed build or corrupt binaries!' |
@echo '*** May result in a failed build or corrupt binaries!' |
.elif defined(EXTERNAL_TOOLCHAIN) |
.elif defined(EXTERNAL_TOOLCHAIN) |
|
|
@echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!' |
@echo '*** WARNING: NBUILDJOBS is obsolete; use -j directly instead!' |
.endif |
.endif |
|
|
do-distrib-dirs: |
do-distrib-dirs: .PHONY |
.if !defined(DESTDIR) || ${DESTDIR} == "" |
.if !defined(DESTDIR) || ${DESTDIR} == "" |
(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=/ distrib-dirs) |
${MAKEDIRTARGET} etc distrib-dirs DESTDIR=/ |
.else |
.else |
(cd ${.CURDIR}/etc && ${MAKE} DESTDIR=${DESTDIR} distrib-dirs) |
${MAKEDIRTARGET} etc distrib-dirs DESTDIR=${DESTDIR} |
.endif |
.endif |
|
|
.for targ in cleandir obj includes |
.for targ in cleandir obj includes |
do-${targ}: ${targ} |
do-${targ}: .PHONY ${targ} |
@true |
@true |
.endfor |
.endfor |
|
|
.for dir in tools tools/compat lib/csu gnu/lib/libgcc lib/libc lib gnu/lib |
.for dir in tools tools/compat lib/csu gnu/lib/libgcc${LIBGCC_EXT} lib/libc lib/libdes lib gnu/lib |
do-${dir:S/\//-/g}: |
do-${dir:S/\//-/g}: .PHONY |
.for targ in dependall install |
.for targ in dependall install |
(cd ${.CURDIR}/${dir} && ${MAKE} ${targ}) |
${MAKEDIRTARGET} ${dir} ${targ} |
.endfor |
.endfor |
.endfor |
.endfor |
|
|
do-ld.so: |
do-ld.so: .PHONY |
.for targ in dependall install |
.for targ in dependall install |
.if (${OBJECT_FMT} == "a.out") |
.if (${OBJECT_FMT} == "a.out") |
(cd ${.CURDIR}/libexec/ld.aout_so && ${MAKE} ${targ}) |
${MAKEDIRTARGET} libexec/ld.aout_so ${targ} |
.endif |
.endif |
.if (${OBJECT_FMT} == "ELF") |
.if (${OBJECT_FMT} == "ELF") |
(cd ${.CURDIR}/libexec/ld.elf_so && ${MAKE} ${targ}) |
${MAKEDIRTARGET} libexec/ld.elf_so ${targ} |
.endif |
.endif |
.endfor |
.endfor |
|
|
do-build: |
do-build: .PHONY |
.for targ in dependall install |
.for targ in dependall install |
(cd ${.CURDIR} && ${MAKE} ${targ} BUILD_tools=no BUILD_lib=no) |
${MAKEDIRTARGET} . ${targ} BUILD_tools=no BUILD_lib=no |
.endfor |
.endfor |
|
|
do-obsolete: |
do-x11: .PHONY |
(cd ${.CURDIR}/etc && ${MAKE} install-obsolete-lists) |
${MAKEDIRTARGET} x11 build |
|
|
|
do-obsolete: .PHONY |
|
${MAKEDIRTARGET} etc install-obsolete-lists |
|
|
# |
# |
# Speedup stubs for some subtrees that don't need to run these rules. |
# Speedup stubs for some subtrees that don't need to run these rules. |
|
|
# |
# |
|
|
.for dir in bin etc distrib games libexec regress sbin usr.sbin tools |
.for dir in bin etc distrib games libexec regress sbin usr.sbin tools |
includes-${dir}: |
includes-${dir}: .PHONY |
@true |
@true |
.endfor |
.endfor |
.for dir in etc distrib regress |
.for dir in etc distrib regress |
install-${dir}: |
install-${dir}: .PHONY |
@true |
@true |
.endfor |
.endfor |
|
|
|
|
# XXX this needs to change when distrib Makefiles are recursion compliant |
# XXX this needs to change when distrib Makefiles are recursion compliant |
# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first... |
# XXX many distrib subdirs need "cd etc && make snap_pre snap_kern" first... |
# |
# |
dependall-distrib depend-distrib all-distrib: |
dependall-distrib depend-distrib all-distrib: .PHONY |
@true |
@true |
|
|
.include <bsd.sys.mk> |
.include <bsd.sys.mk> |
Line 361 dependall-distrib depend-distrib all-dis |
|
Line 377 dependall-distrib depend-distrib all-dis |
|
.include <bsd.kernobj.mk> |
.include <bsd.kernobj.mk> |
.include <bsd.subdir.mk> |
.include <bsd.subdir.mk> |
|
|
build-docs: ${.CURDIR}/BUILDING |
build-docs: .PHONY ${.CURDIR}/BUILDING |
${.CURDIR}/BUILDING: doc/BUILDING.mdoc |
${.CURDIR}/BUILDING: doc/BUILDING.mdoc |
${TOOL_GROFF} -mdoc -Tascii -P-cbou $> >$@ |
${_MKMSG_CREATE} ${.TARGET} |
|
${TOOL_GROFF} -mdoc -Tascii -P-bou $> >$@ |
|
|
|
|
# |
# |
# Display current make(1) parameters |
# Display current make(1) parameters |
# |
# |
params: |
params: .PHONY |
.for var in BSDSRCDIR BSDOBJDIR BUILDID DESTDIR EXTERNAL_TOOLCHAIN \ |
${MAKEDIRTARGET} etc params |
KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \ |
|
MACHINE MACHINE_ARCH MAKECONF MAKEFLAGS \ |
|
MAKEOBJDIR MAKEOBJDIRPREFIX \ |
|
MKOBJDIRS MKUNPRIVED MKUPDATE \ |
|
RELEASEDIR TOOLCHAIN_MISSING TOOLDIR \ |
|
USETOOLS |
|
.if defined(${var}) |
|
@printf "%20s = '%-s'\n" ${var} ${${var}:Q} |
|
.else |
|
@printf "%20s = (undefined)\n" ${var} |
|
.endif |
|
.endfor |
|