-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
57 lines (43 loc) · 1.47 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# TODO: include a makefile constants file
# Read the path to this makefile
remove_trailing_slash = $(if $(filter %/,$(1)),$(call remove_trailing_slash,$(patsubst %/,%,$(1))),$(1))
SANCTUM_DIR := $(call remove_trailing_slash, $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
BUILD_DIR := $(SANCTUM_DIR)/build
SCRIPTS_DIR := $(SANCTUM_DIR)/scripts
COMMON_DIR := $(SANCTUM_DIR)/common
CFLAGS := -march=rv64g -mabi=lp64 -nostdlib -nostartfiles -fno-common -std=gnu11 -static -fPIC -O0 -Wall
CFLAGS += -g
QEMU_FLAGS := -machine sanctum -m 2G -nographic
# Dependencies
# ------------
include $(SCRIPTS_DIR)/qemu.Makefrag
include $(SCRIPTS_DIR)/riscv-gnu-toolchain.Makefrag
#TODO: add linux here
# Project targets
# -----------------
#include $(SANCTUM_DIR)/secure_bootloader/secure_bootloader.Makefrag
include $(SANCTUM_DIR)/security_monitor/security_monitor.Makefrag
include $(SANCTUM_DIR)/hw_tests/hw_tests.Makefrag
# Top-level targets
# -----------------
.PHONY: all test clean clean-all
all: $(QEMU) test
test: hw_test
build-tests: make_elfs
clean:
-rm -rf $(BUILD_DIR)/secure_bootloader
-rm -rf $(BUILD_DIR)/security_monitor
-rm -rf $(BUILD_DIR)/hw_tests
clean-all:
-rm -rf $(BUILD_DIR)
# Generic helper targets
# ----------------------
# TODO: create *.in target - copy from SSITH
#????
#??? Import .h file in a Makefile ??
#??? Or create *h.in ?
#?????
# Debug target to help debug errors in the Makefile
# -------------------------------------------------
debug-% :
@echo $* = $($*)