summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 10 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 1b7cb9b8d6..ec0f95b595 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@ src := src
srck := $(top)/util/kconfig
obj ?= build
override obj := $(subst $(top)/,,$(abspath $(obj)))
+xcompile ?= $(obj)/xcompile
objutil ?= $(obj)/util
objk := $(objutil)/kconfig
absobj := $(abspath $(obj))
@@ -119,7 +120,7 @@ UNIT_TEST:=1
NOCOMPILE:=
endif
-.xcompile: util/xcompile/xcompile
+$(xcompile): util/xcompile/xcompile
rm -f $@
$< $(XGCCPATH) > $@.tmp
\mv -f $@.tmp $@ 2> /dev/null
@@ -146,15 +147,17 @@ ifneq ($(UNIT_TEST),1)
include $(DOTCONFIG)
endif
-# 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)))
+# The toolchain requires xcompile to determine the ARCH_SUPPORTED, so we can't
+# wait for make to generate the file.
+$(if $(wildcard $(xcompile)),, $(shell \
+ mkdir -p $(dir $(xcompile)) && \
+ util/xcompile/xcompile $(XGCCPATH) > $(xcompile) || rm -f $(xcompile)))
--include .xcompile
+include $(xcompile)
ifneq ($(XCOMPILE_COMPLETE),1)
-$(shell rm -f .xcompile)
-$(error .xcompile deleted because it's invalid. \
+$(shell rm -f $(xcompile))
+$(error $(xcompile) deleted because it's invalid. \
Restarting the build should fix that, or explain the problem)
endif