-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (34 loc) · 1.38 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
.PHONY: build clean logs
build-objs += simple
build-objs += good_write
build-objs += bad_no_bbm
build-objs += bad_bbm_missing_tlbi
build-objs += good_bbm
build-objs += bad_no_assoc_lock
build-objs += bad_unlocked_write
build: $(addprefix $(src)/,$(build-objs)) $(src)/compile_commands.json
CFLAGS += -I$(lib_includes)
CFLAGS += -I$(src)/
EXPECTEDDIR = expected
test_objs = $(patsubst %,$(src)/tests/%.o,$(build-objs))
test_expects = $(patsubst %,$(src)/$(EXPECTEDDIR)/%.log,$(build-objs))
test_logs = $(patsubst %,$(src)/tests/%.log,$(build-objs))
common_obj = $(src)/common.o
test_checks = $(patsubst %,check-%,$(build-objs))
checks: $(test_checks)
expected: $(test_expects)
logs: $(test_logs)
.PRECIOUS: $(common_obj) $(test_objs) $(test_logs)
$(src)/%: $(src)/tests/%.o $(common_obj) $(casemate_o)
$(call run_cmd,LD,$@,$(CC) $^ -o $@)
$(src)/tests/%.log: FORCE
$(call run_cmd,RUN,$(src)/$*,test -f $(src)/$* && ($(src)/$* -at 1> $@ 2>/dev/null || true))
check-%: $(src)/tests/%.log FORCE
$(call run_cmd,CHECK,$(src)/$*,$(src)/scripts/check_simulation.py $< $(src)/$(EXPECTEDDIR)/$*.log)
clean-%:
$(call run_clean,$(src)/$*,rm -f $(src)/$* $(src)/tests/$*.o $(src)/tests/$*.log)
clean_objs = $(patsubst %,clean-%,$(build-objs))
clean: $(clean_objs)
$(call run_clean,$(src)/common.o,rm -f $(common_obj))
clean-expected:
$(call run_clean,$(src)/$(EXPECTEDDIR),rm -f $(src)/$(EXPECTEDDIR)/*.log)