Imported the regression suite
[fw/sdcc] / support / regression / Makefile
1 # Starting at the bottom
2 # Set of source test suites
3 # Each source suite is processesd producing multiple device specific test suites.
4 # Each device specific test suite is compiled.
5 # Each device specific test suite is run, and the output recorded.
6 # The output from each device specific test suite derrived from a source
7 # test suite are collated.
8
9 .SILENT:
10
11 CASES_DIR = cases
12 RESULTS_DIR = results
13 TESTS_DIR = tests
14 PORTS_DIR = ports
15 SUBRESULTS_DIR = subresults
16
17 GENERATE_CASES = generate-cases.py
18
19 ALL_PORTS = $(notdir $(wildcard $(PORTS_DIR)/*))
20
21 test-ports:
22         for i in $(ALL_PORTS); do $(MAKE) inter-port-clean test-port PORT=$$i; done
23
24 ALL_TESTS = $(shell find $(TESTS_DIR) -name "*.c")
25
26 PORT_CASES_DIR = $(CASES_DIR)/$(PORT)
27 PORT_RESULTS_DIR = $(RESULTS_DIR)/$(PORT)
28 PORT_SUBRESULTS_DIR = $(SUBRESULTS_DIR)/$(PORT)
29 PORT_RESULTS = $(ALL_TESTS:$(TESTS_DIR)/%.c=$(PORT_RESULTS_DIR)/%.out)
30
31 # Defaults
32 SDCC = ../../bin/sdcc
33 SDCCFLAGS = -m$(PORT)
34 OBJEXT = .o
35 EXEEXT = .bin
36 DIREXT = 
37
38 ifdef PORT
39 include $(PORTS_DIR)/$(PORT)/spec.mk
40 endif
41
42 .PRECIOUS: $(PORT_CASES_DIR)/% %$(OBJEXT) %$(EXEEXT) %.dir
43
44 SDCCFLAGS += -Ifwk/include
45
46 $(PORT_CASES_DIR)/%$(DIREXT): $(TESTS_DIR)/%.c $(GENERATE_CASES)
47         rm -rf $(CASES_DIR)/tests
48         mkdir -p $(CASES_DIR)/tests
49         mkdir -p $@
50         python $(GENERATE_CASES) $< > /dev/null
51         cp $(CASES_DIR)/tests/*.c $@
52         touch $@
53
54 $(PORT_RESULTS_DIR)/%.out: $(PORT_CASES_DIR)/%$(DIREXT)
55         $(MAKE) iterations PORT=$(PORT) CASES=$<
56
57 port-results: port-dirs $(PORT_RESULTS)
58         echo Summary for \'$(PORT)\': `cat $(PORT_RESULTS) | python collate-results.py`
59
60 port-dirs:
61         mkdir -p $(PORT_CASES_DIR) $(PORT_RESULTS_DIR) $(PORT_SUBRESULTS_DIR)
62
63 test-port: port-results
64
65 SUB_CASES = $(wildcard $(CASES)/*.c)
66 SUB_RESULTS = $(SUB_CASES:$(PORT_CASES_DIR)/%.c=$(PORT_SUBRESULTS_DIR)/%.out)
67 RESULTS = $(CASES:$(CASES_DIR)/%$(DIREXT)=$(RESULTS_DIR)/%.out)
68
69 iterations: $(RESULTS)
70
71 $(RESULTS): $(SUB_RESULTS)
72         cat $(SUB_RESULTS) > $@
73
74 #$(PORT_CASES_DIR)/%.bin: $(PORT_CASES_DIR)/%.c
75
76 #$(PORT_CASES_DIR)/%.o: $(PORT_CASES_DIR)/%.c
77
78 clean:
79         rm -rf $(CASES_DIR) $(RESULTS_DIR) $(SUBRESULTS_DIR)
80
81 inter-port-clean:
82         rm -f  fwk/lib/*.o
83
84