source: doc/generic_types/evaluation/Makefile @ 9a9a5c4

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since 9a9a5c4 was c87cd93, checked in by Aaron Moss <a3moss@…>, 5 years ago

Final version of the benchmark code

  • Property mode set to 100644
File size: 3.2 KB
Line 
1CFA = cfa
2DEPFLAGS = -MMD -MP
3CFLAGS = -O2
4ifdef N
5CFLAGS += -DN=$(N)
6endif
7CXXFLAGS = $(CFLAGS) --std=c++14
8
9.PHONY: all clean distclean run-c run-cpp run-cfa run
10
11all: c-bench cpp-bench cfa-bench cpp-vbench
12
13# rewrite object generation to auto-determine deps
14COMPILE.c = $(CC) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS)
15COMPILE.cpp = $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(CPPFLAGS)
16COMPILE.cfa = $(CFA) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS)
17
18c-%.o : c-%.c
19c-%.o : c-%.c c-%.d
20        $(COMPILE.c) $(OUTPUT_OPTION) -c $<
21
22cpp-%.o : cpp-%.cpp
23cpp-%.o : cpp-%.cpp cpp-%.d
24        $(COMPILE.cpp) $(OUTPUT_OPTION) -c $<
25
26cfa-%.o : cfa-%.c
27cfa-%.o : cfa-%.c cfa-%.d
28        $(COMPILE.cfa) $(OUTPUT_OPTION) -c $<
29
30COBJS = c-stack.o c-pair.o c-print.o
31CPPOBJS = 
32CPPVOBJS = cpp-vstack.o
33CFAOBJS = cfa-stack.o cfa-pair.o cfa-print.o
34
35CFILES = c-bench.c bench.h $(COBJS:.o=.h) $(COBJS:.o=.c)
36CPPFILES = cpp-bench.cpp bench.hpp cpp-stack.hpp cpp-pair.hpp cpp-print.hpp
37CPPVFILES = cpp-vbench.cpp bench.hpp object.hpp $(CPPVOBJS:.o=.hpp) $(CPPVOBJS:.o=.cpp) cpp-vprint.hpp
38CFAFILES = cfa-bench.c bench.h $(CFAOBJS:.o=.h) $(CFAOBJS:.o=.c)
39
40c-bench: c-bench.c c-bench.d $(COBJS)
41        $(COMPILE.c) -o $@ $< $(COBJS) $(LDFLAGS)
42
43cpp-bench: cpp-bench.cpp cpp-bench.d $(CPPOBJS)
44        $(COMPILE.cpp) -o $@ $< $(CPPOBJS) $(LDFLAGS)
45
46cpp-vbench: cpp-vbench.cpp cpp-vbench.d $(CPPVOBJS)
47        $(COMPILE.cpp) -o $@ $< $(CPPVOBJS) $(LDFLAGS)
48
49cfa-bench: cfa-bench.c cfa-bench.d $(CFAOBJS)
50        $(COMPILE.cfa) -o $@ $< $(CFAOBJS) $(LDFLAGS)
51
52clean:
53        -rm $(COBJS) c-bench
54        -rm $(CPPOBJS) cpp-bench
55        -rm $(CPPVOBJS) cpp-vbench
56        -rm $(CFAOBJS) cfa-bench
57
58distclean: clean
59        -rm $(COBJS:.o=.d) c-bench.d
60        -rm $(CPPOBJS:.o=.d) cpp-bench.d
61        -rm $(CPPVOBJS:.o=.d) cpp-vbench.d
62        -rm $(CFAOBJS:.o=.d) cfa-bench.d
63
64run-c: c-bench
65        @echo
66        @echo '## C ##'
67        @/usr/bin/time -f 'max_memory:\t%M kilobytes' ./c-bench
68        @printf 'source_size:\t%8d lines\n' `cat $(CFILES) | wc -l`
69        @printf 'redundant_type_annotations:%8d lines\n' `cat $(CFILES) | fgrep '/***/' -c`
70        @printf 'binary_size:\t%8d bytes\n' `stat -c %s c-bench`
71
72run-cfa: cfa-bench
73        @echo
74        @echo '## Cforall ##'
75        @/usr/bin/time -f 'max_memory:\t %M kilobytes' ./cfa-bench
76        @printf 'source_size:\t%8d lines\n' `cat $(CFAFILES) | wc -l`
77        @printf 'redundant_type_annotations:%8d lines\n' `cat $(CFAFILES) | fgrep '/***/' -c`
78        @printf 'binary_size:\t%8d bytes\n' `stat -c %s cfa-bench`
79
80run-cpp: cpp-bench
81        @echo
82        @echo '## C++ ##'
83        @/usr/bin/time -f 'max_memory:\t %M kilobytes' ./cpp-bench
84        @printf 'source_size:\t%8d lines\n' `cat $(CPPFILES) | wc -l`
85        @printf 'redundant_type_annotations:%8d lines\n' `cat $(CPPFILES) | fgrep '/***/' -c`
86        @printf 'binary_size:\t%8d bytes\n' `stat -c %s cpp-bench`
87
88run-cppv: cpp-vbench
89        @echo
90        @echo '## C++obj ##'
91        @/usr/bin/time -f 'max_memory:\t%M kilobytes' ./cpp-vbench
92        @printf 'source_size:\t%8d lines\n' `cat $(CPPVFILES) | wc -l`
93        @printf 'redundant_type_annotations:%8d lines\n' `cat $(CPPVFILES) | fgrep '/***/' -c`
94        @printf 'binary_size:\t%8d bytes\n' `stat -c %s cpp-vbench`
95
96run: run-c run-cfa run-cpp run-cppv
97
98# so make doesn't fail without dependency files
99%.d: ;
100
101# so make won't delete dependency files
102.PRECIOUS: %.d
103
104# include dependency files
105-include: $(COBJS:.o=.d)
106-include: $(CPPOBJS:.o=.d)
107-include: $(CFAOBJS:.o=.d)
108-include: c-bench.d
109-include: cpp-bench.d
110-include: cfa-bench.d
Note: See TracBrowser for help on using the repository browser.