Build with clang in kokoro
The VMs have all the dependencies for a clang build so we'll start with
that.
Change-Id: I2453fc8341b246a41f530141ea88a1c6ca797d67
diff --git a/Makefile b/Makefile
index d5ddb7d..99b2a17 100644
--- a/Makefile
+++ b/Makefile
@@ -3,13 +3,29 @@
ROOT_DIR :=
endif
+#
# Defaults.
+#
ARCH ?= aarch64
PLAT ?= qemu
DEBUG ?= 1
-CROSS_COMPILE ?= aarch64-linux-gnu-
NAME := hafnium
+# Toolchain
+CROSS_COMPILE ?= aarch64-linux-gnu-
+
+ifeq ($(CLANG),1)
+ CLANG := clang
+endif
+GCC ?= gcc
+
+ifdef CLANG
+ CC := $(CLANG) -target $(patsubst %-,%,$(CROSS_COMPILE))
+else
+ CC := $(CROSS_COMPILE)$(GCC)
+endif
+
+# Output
OUT := $(ROOT_DIR)out/$(ARCH)/$(PLAT)
all: $(OUT)/$(NAME).bin
@@ -34,12 +50,6 @@
GLOBAL_OFFSET_SRCS :=
$(foreach mod,$(MODULES),$(eval $(call include_module,$(mod))))
-ifeq ($(CLANG),1)
- CC := clang -target $(patsubst %-,%,$(CROSS_COMPILE))
-else
- CC := $(CROSS_COMPILE)gcc
-endif
-
#
# Rules to build C files.
#