diff --git a/Makefile b/Makefile index 7801c47160..2c87feb7a7 100644 --- a/Makefile +++ b/Makefile @@ -30,16 +30,6 @@ ## SUCH DAMAGE. ## -# in addition to the dependency below, create the file if it doesn't exist -# to silence stupid warnings about a file that would be generated anyway. -$(if $(wildcard .xcompile),,$(eval $(shell util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile))) - -.xcompile: util/xcompile/xcompile - rm -f $@ - $< $(XGCCPATH) > $@.tmp - \mv -f $@.tmp $@ 2> /dev/null - rm -f $@.tmp - export top := $(CURDIR) export src := src export srck := $(top)/util/kconfig @@ -139,6 +129,16 @@ else include $(DOTCONFIG) +# in addition to the dependency below, create the file if it doesn't exist +# to silence stupid warnings about a file that would be generated anyway. +$(if $(wildcard .xcompile)$(NOCOMPILE),,$(eval $(shell util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile))) + +.xcompile: util/xcompile/xcompile + rm -f $@ + $< $(XGCCPATH) > $@.tmp + \mv -f $@.tmp $@ 2> /dev/null + rm -f $@.tmp + -include .xcompile ifneq ($(XCOMPILE_COMPLETE),1) diff --git a/Makefile.inc b/Makefile.inc index a477618176..9aec8a7a7e 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -13,7 +13,11 @@ ## GNU General Public License for more details. ## +ifneq ($(NOCOMPILE),1) GIT:=$(shell [ -e "$(top)/.git" ] && command -v git) +else +GIT:= +endif ####################################################################### # normalize Kconfig variables in a central place diff --git a/payloads/coreinfo/Makefile b/payloads/coreinfo/Makefile index 486c96cf1d..50659d3c0b 100644 --- a/payloads/coreinfo/Makefile +++ b/payloads/coreinfo/Makefile @@ -20,6 +20,7 @@ srck := $(src)/../../util/kconfig coreinfo_obj := $(src)/build objk := $(src)/build/util/kconfig +ifeq ($(filter %clean,$(MAKECMDGOALS)),) export KERNELVERSION := 0.1.0 export KCONFIG_AUTOHEADER := $(coreinfo_obj)/config.h export KCONFIG_AUTOCONFIG := $(coreinfo_obj)/auto.conf @@ -128,6 +129,12 @@ $(coreinfo_obj)/config.h: $(shell mkdir -p $(coreinfo_obj) $(objk)/lxdialog $(KCONFIG_SPLITCONFIG)) +include $(srck)/Makefile + +.PHONY: $(PHONY) prepare + +else + clean: rm -rf build/*.elf build/*.o .xcompile @@ -135,6 +142,5 @@ distclean: clean rm -rf build lpbuild rm -f .config* lp.config* -include $(srck)/Makefile - -.PHONY: $(PHONY) prepare clean distclean +.PHONY: clean distclean +endif diff --git a/payloads/libpayload/Makefile b/payloads/libpayload/Makefile index 00fb5374bb..34df485f30 100644 --- a/payloads/libpayload/Makefile +++ b/payloads/libpayload/Makefile @@ -81,14 +81,6 @@ DOXYGEN_OUTPUT_DIR := doxygen all: real-all -# in addition to the dependency below, create the file if it doesn't exist -# to silence stupid warnings about a file that would be generated anyway. -$(if $(wildcard .xcompile),,$(eval $(shell $(top)/../../util/xcompile/xcompile $(XGCCPATH) > .xcompile))) - -.xcompile: $(top)/../../util/xcompile/xcompile - $< $(XGCCPATH) > $@.tmp - \mv -f $@.tmp $@ 2> /dev/null - ifeq ($(INNER_SCANBUILD),y) CC:=$(CC_real) HOSTCC:=$(CC_real) --hostcc @@ -101,8 +93,6 @@ include $(srck)/Makefile include $(HAVE_DOTCONFIG) -include .xcompile - ARCHDIR-$(CONFIG_LP_ARCH_ARM) := arm ARCHDIR-$(CONFIG_LP_ARCH_ARM64) := arm64 ARCHDIR-$(CONFIG_LP_ARCH_MIPS) := mips @@ -138,7 +128,7 @@ ifeq ($(strip $(HAVE_DOTCONFIG)),) NOCOMPILE:=1 endif ifneq ($(MAKECMDGOALS),) -ifneq ($(filter %config distclean,$(MAKECMDGOALS)),) +ifneq ($(filter %config %clean,$(MAKECMDGOALS)),) NOCOMPILE:=1 endif endif @@ -149,6 +139,16 @@ real-all: config else +# in addition to the dependency below, create the file if it doesn't exist +# to silence stupid warnings about a file that would be generated anyway. +$(if $(wildcard .xcompile)$(NOCOMPILE),,$(eval $(shell $(top)/../../util/xcompile/xcompile $(XGCCPATH) > .xcompile))) + +.xcompile: $(top)/../../util/xcompile/xcompile + $< $(XGCCPATH) > $@.tmp + \mv -f $@.tmp $@ 2> /dev/null + +-include .xcompile + ifneq ($(INNER_SCANBUILD),y) ifeq ($(CONFIG_LP_COMPILER_LLVM_CLANG),y) CC:=clang -m32