Build each project in a different output directory.
Change-Id: Ice870da3b051c528d9acadf1f0a66384da92be77
diff --git a/Makefile b/Makefile
index a872b0b..8ccd102 100644
--- a/Makefile
+++ b/Makefile
@@ -25,8 +25,8 @@
# Select the project to build.
PROJECT ?= reference
-OUT ?= out
-OUT_DIR = out
+OUT ?= out/$(PROJECT)
+OUT_DIR = out/$(PROJECT)
.PHONY: all
all: $(OUT_DIR)/build.ninja
diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md
index f61c4f6..caf3cb4 100644
--- a/docs/GettingStarted.md
+++ b/docs/GettingStarted.md
@@ -30,14 +30,17 @@
```
By default, the hypervisor is built with clang for a few target platforms along
-with tests.
+with tests. Each project in the `project` directory specifies a root
+configurations of the build. Adding a project is the preferred way to extend
+support to new platforms. The target project that is built is selected by the
+`PROJECT` make variable, the default project is 'reference'.
``` shell
-make
+make PROJECT=<project_name>
```
-The compiled image can be found under `out/`, for example the QEMU image is at
-at `out/qemu_aarch64_clang/hafnium.bin`.
+The compiled image can be found under `out/<project>`, for example the QEMU image is at
+at `out/reference/qemu_aarch64_clang/hafnium.bin`.
## Running on QEMU
@@ -45,7 +48,7 @@
used to run Hafnium on it:
``` shell
-qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -machine virtualization=true -kernel out/qemu_aarch64_clang/hafnium.bin
+qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -machine virtualization=true -kernel out/reference/qemu_aarch64_clang/hafnium.bin
```
Though it is admittedly not very useful because it doesn't have any virtual
@@ -56,7 +59,7 @@
which will then boot into the primary Linux VM:
``` shell
-qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -machine virtualization=true -kernel out/qemu_aarch64_clang/hafnium.bin -initrd initrd.img -append "rdinit=/sbin/init"
+qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -machine virtualization=true -kernel out/reference/qemu_aarch64_clang/hafnium.bin -initrd initrd.img -append "rdinit=/sbin/init"
```
## Running tests
diff --git a/kokoro/ubuntu/test.sh b/kokoro/ubuntu/test.sh
index be49777..5d796f8 100755
--- a/kokoro/ubuntu/test.sh
+++ b/kokoro/ubuntu/test.sh
@@ -27,7 +27,8 @@
set -x
TIMEOUT="timeout --foreground"
-OUT="out"
+PROJECT="${PROJECT:-reference}"
+OUT="out/${PROJECT}"
HFTEST="$TIMEOUT 30s ./test/hftest/hftest.py --out $OUT/qemu_aarch64_clang --log $OUT/kokoro_log"
# Add prebuilt libc++ to the path.