forked from pulp-platform/culsans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
86 lines (60 loc) · 1.98 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
include ../common.mk
include ../rtl.mk
TESTS_DIR = ./testlist
TESTLIST := $(dir $(wildcard $(TESTS_DIR)/*/.))
# Check that SW is aligned with the NB_CORES setting
SW_NBCORES_DEF = "\# define NB_CORES $(NB_CORES)"
.PHONY: nb_cores_sw
nb_cores_sw:
@if ! grep -q $(SW_NBCORES_DEF) ./sw/sys/crt.S; then \
sed -i 's/\# define NB_CORES [0-9]\+/\# define NB_CORES $(NB_CORES)/' ./sw/sys/crt.S; \
fi
.PHONY: nb_cores
nb_cores: nb_cores_sw nb_cores_rtl
# Compile the SW
COMMON_TEST_SW = ./sw
COMMON_TEST_SW_SRC = $(COMMON_TEST_SW)/src
COMMON_TEST_SW_INC = $(COMMON_TEST_SW)/include
# more folders might be added in the future
VPATH = $(COMMON_TEST_SW_SRC)
# more folders might be added in the future
SW_INCLUDES = $(foreach d, $(COMMON_TEST_SW_INC), -I$d)
# more folders might be added in the future
SW_SRCS += $(shell find $(COMMON_TEST_SW_SRC) -name *.c -exec basename {} \;)
OBJDIR = ./objs
OBJS = $(SW_SRCS:%.c=$(OBJDIR)/%.o)
objs:
mkdir -p $@
libs:
mkdir -p $@
$(OBJDIR)/%.o: %.c objs
$(RV_GCC) $(SW_INCLUDES) -Werror -falign-functions=32 -falign-jumps=32 -c $< -o $@
#
libs/libintegr.a: $(OBJS) libs
$(RV_AR) -rcs $@ $(OBJS)
sw : libs/libintegr.a nb_cores
for d in $(TESTLIST); do make -C $$d sw; done
sw_all : libs/libintegr.a nb_cores
for d in $(TESTLIST); do make -C $$d all; done
# Run the test(s)
TEST ?= all
# run all the tests
ifeq ($(TEST), all)
all: sw rtl
for d in $(TESTLIST); do make -C $$d all; done
# run a single test
else
all: sw rtl
if [ -d $(TESTS_DIR)/$(TEST) ]; then make -C $(TESTS_DIR)/$(TEST) all; else echo "$(TEST) doesn't exist"; false; fi
endif
# run failed or not-executed tests
rerun: sw rtl
for d in $(TESTLIST); do if [ -e $$d/$(TEST_REPORT) ] and [ -e $$d/$(VERIFICATION_REPORT) ]; then if grep -q FAIL $$d/$(TEST_REPORT) ; then make -C $$d all; fi; else make -C $$d all; fi; done
# Cleanup
clean_sw:
rm -rf objs
rm -rf libs
clean_tests:
for d in $(TESTLIST); do make -C $$d clean; done
clean: clean_sw clean_tests
.PHONY: all sw sw_all rerun clean clean_sw