From 6d75a7a852fe046e3866858ff995447498904e95 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Tue, 9 May 2017 20:21:38 +0000 Subject: [PATCH] Support skipping 'make obj' tree-walk. This is part of a larger effort for WITH_AUTO_OBJ and a WORLDFAST option. Sponsored by: Dell EMC Isilon --- Makefile.inc1 | 35 +++++++++++++++++++++++------------ Makefile.libcompat | 4 ++-- share/man/man7/build.7 | 4 ++++ sys/conf/kern.post.mk | 2 +- sys/conf/kern.pre.mk | 8 ++++++++ 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 34e55d7448f5..ba3d07c2fac7 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -310,6 +310,13 @@ CLEANDIR= cleandir NO_CLEAN= t .endif .endif +.if defined(NO_OBJ) || ${MK_AUTO_OBJ} == "yes" +NO_OBJ= t +NO_KERNELOBJ= t +.endif +.if !defined(NO_OBJ) +_obj= obj +.endif LOCAL_TOOL_DIRS?= PACKAGEDIR?= ${DESTDIR}/${DISTDIR} @@ -828,7 +835,11 @@ WMAKE_TGTS+= _worldtmp _legacy .if empty(SUBDIR_OVERRIDE) WMAKE_TGTS+= _bootstrap-tools .endif -WMAKE_TGTS+= _cleanobj _obj _build-tools _cross-tools +WMAKE_TGTS+= _cleanobj +.if !defined(NO_OBJ) +WMAKE_TGTS+= _obj +.endif +WMAKE_TGTS+= _build-tools _cross-tools WMAKE_TGTS+= _compiler-metadata WMAKE_TGTS+= _includes _libraries WMAKE_TGTS+= everything @@ -1610,7 +1621,7 @@ legacy: .PHONY .for _tool in tools/build ${_elftoolchain_libs} ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,all,install)"; \ cd ${.CURDIR}/${_tool}; \ - ${MAKE} DIRPRFX=${_tool}/ obj; \ + if [ -z "${NO_OBJ}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ ${MAKE} DIRPRFX=${_tool}/ MK_INCLUDES=no all; \ ${MAKE} DIRPRFX=${_tool}/ MK_INCLUDES=no \ @@ -1766,7 +1777,7 @@ bootstrap-tools: .PHONY ${_bt}-${_tool}: .PHONY .MAKE ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ cd ${.CURDIR}/${_tool}; \ - ${MAKE} DIRPRFX=${_tool}/ obj; \ + if [ -z "${NO_OBJ}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ ${MAKE} DIRPRFX=${_tool}/ all; \ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install @@ -1805,7 +1816,7 @@ _rescue=rescue/rescue build-tools_${_tool}: .PHONY ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ cd ${.CURDIR}/${_tool}; \ - ${MAKE} DIRPRFX=${_tool}/ obj; \ + if [ -z "${NO_OBJ}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ ${MAKE} DIRPRFX=${_tool}/ build-tools build-tools: build-tools_${_tool} .endfor @@ -1814,7 +1825,7 @@ build-tools: build-tools_${_tool} build-tools_${_tool}: .PHONY ${_+_}@${ECHODIR} "===> ${_tool} (obj,all)"; \ cd ${.CURDIR}/${_tool}; \ - ${MAKE} DIRPRFX=${_tool}/ obj; \ + if [ -z "${NO_OBJ}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ ${MAKE} DIRPRFX=${_tool}/ all build-tools: build-tools_${_tool} .endfor @@ -1899,7 +1910,7 @@ cross-tools: .MAKE .PHONY ${_usb_tools} ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ cd ${.CURDIR}/${_tool}; \ - ${MAKE} DIRPRFX=${_tool}/ obj; \ + if [ -z "${NO_OBJ}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \ ${MAKE} DIRPRFX=${_tool}/ all; \ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install .endfor @@ -1931,7 +1942,7 @@ native-xtools: .PHONY mkdir -p ${OBJTREE}/gperf_for_gcc/usr/bin ${_+_}@${ECHODIR} "===> ${_gperf} (obj,all,install)"; \ cd ${.CURDIR}/${_gperf}; \ - ${NXBMAKE} DIRPRFX=${_gperf}/ obj; \ + if [ -z "${NO_OBJ}" ]; then ${NXBMAKE} DIRPRFX=${_gperf}/ obj; fi; \ ${NXBMAKE} DIRPRFX=${_gperf}/ all; \ ${NXBMAKE} DIRPRFX=${_gperf}/ DESTDIR=${OBJTREE}/gperf_for_gcc install .endif @@ -2007,7 +2018,7 @@ native-xtools: .PHONY usr.sbin/chown ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ cd ${.CURDIR}/${_tool}; \ - ${NXBMAKE} DIRPRFX=${_tool}/ obj; \ + if [ -z "${NO_OBJ}" ]; then ${NXBMAKE} DIRPRFX=${_tool}/ obj; fi; \ ${NXBMAKE} DIRPRFX=${_tool}/ all; \ ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${NXBDESTDIR} install .endfor @@ -2269,7 +2280,7 @@ ${_lib}__PL: .PHONY .MAKE .if exists(${.CURDIR}/${_lib}) ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ cd ${.CURDIR}/${_lib}; \ - ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; \ + if [ -z "${NO_OBJ}" ]; then ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; fi; \ ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \ DIRPRFX=${_lib}/ all; \ ${MAKE} MK_TESTS=no MK_PROFILE=no -DNO_PIC \ @@ -2282,7 +2293,7 @@ ${_lib}__L: .PHONY .MAKE .if exists(${.CURDIR}/${_lib}) ${_+_}@${ECHODIR} "===> ${_lib} (obj,all,install)"; \ cd ${.CURDIR}/${_lib}; \ - ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; \ + if [ -z "${NO_OBJ}" ]; then ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj; fi; \ ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all; \ ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install .endif @@ -2609,7 +2620,7 @@ _xb-bootstrap-tools: .PHONY ${_yacc} ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ cd ${.CURDIR}/${_tool}; \ - ${CDMAKE} DIRPRFX=${_tool}/ obj; \ + if [ -z "${NO_OBJ}" ]; then ${CDMAKE} DIRPRFX=${_tool}/ obj; fi; \ ${CDMAKE} DIRPRFX=${_tool}/ all; \ ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install .endfor @@ -2628,7 +2639,7 @@ _xb-cross-tools: .PHONY ${_gcc} ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,all)"; \ cd ${.CURDIR}/${_tool}; \ - ${CDMAKE} DIRPRFX=${_tool}/ obj; \ + if [ -z "${NO_OBJ}" ]; then ${CDMAKE} DIRPRFX=${_tool}/ obj; fi; \ ${CDMAKE} DIRPRFX=${_tool}/ all .endfor diff --git a/Makefile.libcompat b/Makefile.libcompat index e28639391df3..2e075ff098f6 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -163,7 +163,7 @@ build${libcompat}: .PHONY .endif mkdir -p ${WORLDTMP} ln -sf ${.CURDIR}/sys ${WORLDTMP} -.for _t in obj includes +.for _t in ${_obj} includes .for _dir in ${_LC_INCDIRS} ${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \ DIRPRFX=${_dir}/ ${_t} @@ -180,7 +180,7 @@ build${libcompat}: .PHONY ${_+_}cd ${.CURDIR}; \ ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries .if ${libcompat} == "32" -.for _t in obj all +.for _t in ${_obj} all ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIBCOMPATWMAKE} \ -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t} ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATWMAKE} \ diff --git a/share/man/man7/build.7 b/share/man/man7/build.7 index 31927f8ab987..540084189c1e 100644 --- a/share/man/man7/build.7 +++ b/share/man/man7/build.7 @@ -605,6 +605,10 @@ If set, the update process does not update the source of the documentation as part of the .Dq make update target. +.It Va NO_OBJ +If set, no object directories will be created. +This should only be used if object directories were created in a +previous build and no new directories are connected. .It Va NO_PORTSUPDATE If set, the update process does not update the Ports tree as part of the .Dq make update diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index aa6cc60202ec..6d0587ba12e5 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -35,7 +35,7 @@ KERN_DEBUGDIR?= ${DEBUGDIR} .MAIN: all .for target in all clean cleandepend cleandir clobber depend install \ - obj reinstall tags + ${_obj} reinstall tags ${target}: kernel-${target} .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules) ${target}: modules-${target} diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 95118dee0794..a443de7b71b8 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -24,6 +24,14 @@ _srcconf_included_: .MAKE.MODE+= curdirOk=yes .endif +.if defined(NO_OBJ) || ${MK_AUTO_OBJ} == "yes" +NO_OBJ= t +NO_MODULES_OBJ= t +.endif +.if !defined(NO_OBJ) +_obj= obj +.endif + # Can be overridden by makeoptions or /etc/make.conf KERNEL_KO?= kernel KERNEL?= kernel