Makefile: Initial commit of a Makefile

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
diff --git a/.travis.yml b/.travis.yml
index f5aa880..1381ffc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -45,7 +45,7 @@
   - popd
 
 script:
-  - ./run_all_checks.sh
+  - make test
   # Run a QEMU instance of the HiFive1 app
   - PLATFORM=hifive1 cargo rrv32imac --example hello_world
   - timeout --foreground 10s qemu-system-riscv32 -M sifive_e -kernel ../tock/boards/hifive1/target/riscv32imac-unknown-none-elf/release/hifive1 -device loader,file=./target/riscv32imac-unknown-none-elf/tab/hifive1/hello_world/rv32imac.tbf,addr=0x20430000 -nographic | tee serial
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..213e36b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,57 @@
+# By default, let's print out some help
+.PHONY: usage
+usage:
+	@echo "$$(tput bold)Welcome to libtock-rs!$$(tput sgr0)"
+	@echo
+	@echo "First things first, if you haven't yet, check out Tocks's doc/Getting_Started."
+	@echo "After that read the README from libtock-rs"
+	@echo "You'll need to install a few requirements before we get going."
+	@echo
+	@echo "The next step is to choose a board to build Tock for. Mainline"
+	@echo "libtock-rs currently includes support for the following platforms:"
+	@echo " - hail"
+	@echo " - nrf52840"
+	@echo " - opentitan"
+	@echo " - hifive1"
+	@echo " - nrf52"
+	@echo
+	@echo "Run 'make <board>' to build libtock-rs for that board"
+	@echo "Run 'make test' to test any local changes you have made"
+
+.PHONY: examples
+examples:
+	PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples
+	PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples --features=alloc
+	PLATFORM=opentitan cargo build --release --target=riscv32imc-unknown-none-elf --examples
+
+.PHONY: test
+test:
+	PLATFORM=nrf52 cargo fmt --all -- --check
+	PLATFORM=nrf52 cargo clippy --workspace --all-targets
+	PLATFORM=nrf52 cargo test --workspace
+	make examples
+
+.PHONY: hail
+hail:
+	PLATFORM=hail cargo build --release --target=thumbv7em-none-eabi --examples
+
+.PHONY: nrf52840
+nrf52840:
+	PLATFORM=nrf52840 cargo build --release --target=thumbv7em-none-eabi --examples
+
+.PHONY: opentitan
+opentitan:
+	PLATFORM=opentitan cargo build --release --target=riscv32imc-unknown-none-elf --examples
+
+.PHONY: hifive1
+hifive1:
+	PLATFORM=hifive1 cargo build --release --target=riscv32imac-unknown-none-elf --examples
+
+.PHONY: nrf52
+nrf52:
+	PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples
+
+.PHONY: clean
+clean:
+	rm -rf target
+	rm Cargo.lock
diff --git a/build_examples.sh b/build_examples.sh
deleted file mode 100755
index 738523d..0000000
--- a/build_examples.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env bash
-
-set -eux
-
-PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples
-PLATFORM=nrf52 cargo build --release --target=thumbv7em-none-eabi --examples --features=alloc
-PLATFORM=hifive1 cargo build --release --target=riscv32imc-unknown-none-elf --examples # Important for testing: This target does not support atomics
diff --git a/run_all_checks.sh b/run_all_checks.sh
deleted file mode 100755
index 3dde5ff..0000000
--- a/run_all_checks.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env bash
-
-set -eux
-
-export PLATFORM=nrf52 # The specific platform doesn't matter for tests
-
-cargo fmt --all -- --check
-cargo clippy --workspace --all-targets
-cargo test --workspace
-./build_examples.sh