1include $(OOC_DEV_ROOT)/Makefile.config
2
3# Extra flags to GCC
4CCFLAGS = #-traditional-cpp
5
6# location of library directory
7LIB = $(OOC_DEV_ROOT)/lib
8
9# binary that produces the tested excutables
10TEST_DRIVER = oo2c
11
12# command to compile benchmarks
13COMPILE = $(OOC_DEV_ROOT)/bin/$(TEST_DRIVER) --config $(OOC_DEV_ROOT)/oo2crc-install.xml -r $(OOC_DEV_ROOT)/lib -r wd
14
15# command to generate assembley output from C
16CCC = gcc $(CCFLAGS) -O2 -S -I$(LIB)/src -I$(LIB)/obj -Iwd/obj
17CCC1 = gcc $(CCFLAGS) -O2 -S -I/usr/local/lib/oo2c/lib -I/usr/local/lib/oo2c/obj -Iwd1/obj
18
19# benchmarks to test for ASM output
20BENCHMARKS = FFT Sort Array
21
22test: compile
23	wd/bin/Benchmark --all --normalise
24
25compile: setup
26	$(COMPILE) --make Benchmark
27
28setup:
29	$(MKDIR) $(OOC_DEV_ROOT)/sym $(OOC_DEV_ROOT)/obj
30	cd $(OOC_DEV_ROOT) && $(OOC) --config $(OOC_DEV_ROOT)/oo2crc-install.xml -M $(OFLAGS) $(TEST_DRIVER)
31	rm -rf wd
32	mkdir wd wd/obj wd/sym wd/asm
33	ln -s ../src wd/src
34
35setup-ooc1:
36	rm -rf wd1
37	mkdir wd1 wd1/obj wd1/sym wd1/asm wd1/bin
38
39compile-ooc1: setup-ooc1
40	$(OOC) --optimize -Mv --cflags "-O2" Benchmark
41
42test-ooc1: compile-ooc1
43	wd1/bin/Benchmark --all --normalise
44
45# Attempt to find the differences in assembled output
46# This is a quick hack, but probably as good as it will get
47
48asm: compile
49	for i in $(BENCHMARKS); do \
50	  $(CCC) wd/obj/$$i.c -o wd/asm/$$i.s; \
51	  $(CCC) wd/src/$${i}C.c -o wd/asm/$${i}C.s; \
52          diff -yd wd/asm/$$i.s wd/asm/$${i}C.s > wd/asm/$$i.diff; \
53          true; \
54	done
55
56asm-ooc1: compile-ooc1
57	for i in $(BENCHMARKS); do \
58	  $(CCC1) wd1/obj/$$i.c -o wd1/asm/$$i.s; \
59	  $(CCC1) src/$${i}C.c -o wd1/asm/$${i}C.s; \
60          diff -yd wd1/asm/$$i.s wd1/asm/$${i}C.s > wd/asm/$$i.diff; \
61          true; \
62	done
63
64asm-diff: asm asm-ooc1
65	for i in $(BENCHMARKS); do \
66          diff -yd wd/asm/$$i.s wd1/asm/$$i.s > wd/asm/$$i.v2.diff; \
67          true; \
68	done
69
70clean:
71	rm -rf wd wd1
72