forked from NJU-ProjectN/riscv-tests-am
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
31 lines (22 loc) · 752 Bytes
/
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
.PHONY: all run clean $(ALL)
SUPPORTED_ISA = riscv64 riscv32
RISCV = $(word 1, $(subst -, ,$(ARCH)))
ifeq ($(filter $(SUPPORTED_ISA), $(RISCV)), )
$(error Expected $$ISA in {$(SUPPORTED_ISA)}, Got "$(RISCV)")
endif
ifeq ($(RISCV), riscv64)
RV_DIR = isa/rv64ui
else
RV_DIR = isa/rv32ui
endif
ALL = $(basename $(notdir $(shell find $(RV_DIR)/. -name "*.S" | grep -v fence_i.S)))
all: $(addprefix Makefile-, $(ALL))
@echo "" $(ALL)
$(ALL): %: Makefile-%
Makefile-%: $(RV_DIR)/%.S
@/bin/echo -e "NAME = $*\nSRCS = $<\nLIBS += klib\nINC_PATH += $(shell pwd)/env/p $(shell pwd)/isa/macros/scalar\ninclude $${AM_HOME}/Makefile" > $@
-@make -s -f $@ ARCH=$(ARCH) $(MAKECMDGOALS)
-@rm -f Makefile-$*
run: all
clean:
rm -rf Makefile-* build/