source: Deliverables/D2.3/8051/tests/benchs/Makefile @ 453

Last change on this file since 453 was 453, checked in by ayache, 9 years ago

Import of the Paris's sources.

File size: 1.3 KB
Line 
1.PHONY: clean all bench prepare
2
3SOURCES=$(wildcard *.c)
4BASENAMES=$(SOURCES:.c=)
5GCCEXES=$(SOURCES:.c=.gcc)
6GCCEXES=$(SOURCES:.c=.ogcc)
7ACCEXES=$(SOURCES:.c=.acc)
8EXES=$(GCCEXES) $(ACCEXES)
9RESULTS=$(SOURCES:.c=.result)
10
11GCC=gcc
12CFLAGS=-O0
13OFLAGS=-O2
14
15ACC=./acc.run
16TIME=./meantime.sh
17
18all: bench
19
20%.gcc: %.c
21        @ $(GCC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
22
23%.ogcc: %.c
24        @ $(GCC) $(CPPFLAGS) $(OFLAGS) -o $@ $<
25
26%.s: %.c
27        @ $(ACC) $<
28
29%.acc: %.s
30        @ $(GCC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
31
32%.acc-run: %.acc
33        @ $(TIME) -f %U ./$< > $@
34
35%.gcc-run: %.gcc
36        @ $(TIME) -f %U ./$< > $@
37
38%.ogcc-run: %.ogcc
39        @ $(TIME) -f %U ./$< > $@
40
41%.ratio1: %.acc-run %.gcc-run
42        @ echo "print round(`cat $*.acc-run` / `cat $*.gcc-run`, 2)" | python > $@
43
44%.ratio2: %.acc-run %.ogcc-run
45        @ echo "print round(`cat $*.acc-run` / `cat $*.ogcc-run`, 2)" | python > $@
46
47%.announce: 
48        @ echo Benchmarking "$*.c"...
49        @ echo "$*.c" > $@
50
51%.result: %.announce %.acc-run %.gcc-run %.ogcc-run %.ratio1 %.ratio2
52        @ cat $^ | tr '\n' '&' > $@
53
54prepare:
55        rm --force *.announce
56
57bench: prepare $(RESULTS)
58        @ echo '& acc & gcc -O0 & gcc -O2 & 1/2 & 1/3 \\'
59        @ for i in $(BASENAMES); do cat $$i.result; echo '\\'; done
60
61clean: 
62        rm --force $(EXES) $(RESULTS) \
63           *.gcc-run *.ogcc-run *.acc-run *.ratio* *.announce *.Clight *.ASM
Note: See TracBrowser for help on using the repository browser.