summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2019-07-11 10:44:21 -0600
committerHung-Te Lin <hungte@chromium.org>2020-12-23 03:40:35 +0000
commit81ff33cffc103c184e002ccefe939efe2958a421 (patch)
tree6cf71c4c383734ff15021e0b2aa12e9be1709985 /Makefile
parentdeba7deda69c14e8a9c428d28cb352e70fbbe36d (diff)
Makefile: Add $(xcompile) to specify where to write xcompile
This file was being written to the root src directory. It is the only file being written to src during a normal build, while all others are being written to $(obj). I added a new variable to allow specifying the xcompile path. This allows generating a single file if building multiple boards. I also moved the default location into $(obj) so we don't pollute the src directory by default. I also cleaned up the generation of xcompile by removing the unnecessary eval and NOCOMPILE check. I also left .xcompile in distclean so it cleans up stale files. Since .xcompile is written into $(obj), `make clean` will now remove it. The tegra Makefiles are outside of the normal build process, so I just updated those Makefiles to point to the default xcompile location of a normal build. The what-jenkins-does target had to be updated to support these special targets. We generate an xcompile specifically for these targets and pass it into the Makefile. Ideally we should get these targets added to the main build. BUG=b:112267918 TEST=ran `emerge-grunt coreboot` and `make what-jenkins-does` Signed-off-by: Raul E Rangel <rrangel@chromium.org> Change-Id: Ia83f234447b977efa824751c9674154b77d606b0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/28101 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
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