aboutsummaryrefslogtreecommitdiff
path: root/tests/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Makefile')
-rw-r--r--tests/Makefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/Makefile b/tests/Makefile
new file mode 100644
index 0000000..2012107
--- /dev/null
+++ b/tests/Makefile
@@ -0,0 +1,34 @@
+TESTS :=
+
+ARCH ?= riscv64
+CROSS_COMPILE ?= $(ARCH)-unknown-elf-
+
+LLVM ?= 0
+COMPILER != [ "$(LLVM)" != "0" ] \
+ && echo clang --target="$(CROSS_COMPILE)" \
+ || echo $(CROSS_COMPILE)gcc
+
+OBFLAGS := -ffreestanding -nostdlib -std=c17 -g
+INCLUDEFLAGS := -I ../include -I.
+WARNFLAGS := -Wall -Wextra
+COMPILE := $(COMPILER) $(WARNFLAGS) $(INCLUDEFLAGS) $(OBFLAGS)
+
+GEN_INITRD := cpio -H newc -o >
+QEMU := qemu-system-$(ARCH) -machine virt -kernel ../kmi.bin \
+ -serial stdio \
+ -monitor none \
+ -nographic \
+ -no-reboot \
+ -initrd
+
+COMMON := build/printf.o ../kmi.bin ../include/kmi/syscalls.h
+
+include noop/source.mk
+include hello-world/source.mk
+
+.PHONY: check
+check: $(TESTS)
+
+build/printf.o: common/printf.c
+ mkdir -p build
+ $(COMPILE) -c common/printf.c -o build/printf.o