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.
#
diff --git a/kokoro/ubuntu/continuous.sh b/kokoro/ubuntu/build.sh
similarity index 80%
rename from kokoro/ubuntu/continuous.sh
rename to kokoro/ubuntu/build.sh
index 1fd56f4..84718f2 100755
--- a/kokoro/ubuntu/continuous.sh
+++ b/kokoro/ubuntu/build.sh
@@ -6,4 +6,4 @@
set -x
cd git/hafnium
-make
+CLANG="clang-3.9" make
diff --git a/kokoro/ubuntu/continuous.cfg b/kokoro/ubuntu/continuous.cfg
index ca02e0c..c2554d0 100644
--- a/kokoro/ubuntu/continuous.cfg
+++ b/kokoro/ubuntu/continuous.cfg
@@ -1,4 +1,4 @@
# Format: //devtools/kokoro/config/proto/build.proto
# Location of the continuous bash script in Git.
-build_file: "hafnium/kokoro/ubuntu/continuous.sh"
+build_file: "hafnium/kokoro/ubuntu/build.sh"
diff --git a/kokoro/ubuntu/presubmit.cfg b/kokoro/ubuntu/presubmit.cfg
index fae31a9..7d60242 100644
--- a/kokoro/ubuntu/presubmit.cfg
+++ b/kokoro/ubuntu/presubmit.cfg
@@ -1,4 +1,4 @@
# Format: //devtools/kokoro/config/proto/build.proto
# Location of the presubmit bash script in Git.
-build_file: "hafnium/kokoro/ubuntu/presubmit.sh"
+build_file: "hafnium/kokoro/ubuntu/build.sh"
diff --git a/kokoro/ubuntu/presubmit.sh b/kokoro/ubuntu/presubmit.sh
deleted file mode 100755
index 1fd56f4..0000000
--- a/kokoro/ubuntu/presubmit.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-# Fail on any error.
-set -e
-# # Display commands being run.
-set -x
-
-cd git/hafnium
-make