[e3de500] | 1 | CFA = cfa |
---|
[4cfcf41] | 2 | DEPFLAGS = -MMD -MP |
---|
[0d10090] | 3 | CFLAGS = -O2 |
---|
| 4 | ifdef N |
---|
| 5 | CFLAGS += -DN=$(N) |
---|
| 6 | endif |
---|
[b276be5] | 7 | CXXFLAGS = $(CFLAGS) --std=c++14 |
---|
[309be81] | 8 | |
---|
[b276be5] | 9 | .PHONY: all clean distclean run-c run-cpp run-cfa run |
---|
[309be81] | 10 | |
---|
[b14dd03] | 11 | all: c-bench cpp-bench cfa-bench cpp-vbench |
---|
[309be81] | 12 | |
---|
[4cfcf41] | 13 | # rewrite object generation to auto-determine deps |
---|
| 14 | COMPILE.c = $(CC) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS) |
---|
| 15 | COMPILE.cpp = $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(CPPFLAGS) |
---|
| 16 | COMPILE.cfa = $(CFA) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS) |
---|
[309be81] | 17 | |
---|
[4cfcf41] | 18 | c-%.o : c-%.c |
---|
| 19 | c-%.o : c-%.c c-%.d |
---|
[122aecd] | 20 | $(COMPILE.c) $(OUTPUT_OPTION) -c $< |
---|
[309be81] | 21 | |
---|
[4cfcf41] | 22 | cpp-%.o : cpp-%.cpp |
---|
| 23 | cpp-%.o : cpp-%.cpp cpp-%.d |
---|
[122aecd] | 24 | $(COMPILE.cpp) $(OUTPUT_OPTION) -c $< |
---|
[4cfcf41] | 25 | |
---|
| 26 | cfa-%.o : cfa-%.c |
---|
| 27 | cfa-%.o : cfa-%.c cfa-%.d |
---|
[122aecd] | 28 | $(COMPILE.cfa) $(OUTPUT_OPTION) -c $< |
---|
[4cfcf41] | 29 | |
---|
[0d10090] | 30 | COBJS = c-stack.o c-pair.o c-print.o |
---|
[4cfcf41] | 31 | CPPOBJS = |
---|
[b276be5] | 32 | CPPVOBJS = cpp-vstack.o |
---|
[0d10090] | 33 | CFAOBJS = cfa-stack.o cfa-pair.o cfa-print.o |
---|
[4cfcf41] | 34 | |
---|
[3fb7f5e] | 35 | CFILES = c-bench.c bench.h $(COBJS:.o=.h) $(COBJS:.o=.c) |
---|
[c87cd93] | 36 | CPPFILES = cpp-bench.cpp bench.hpp cpp-stack.hpp cpp-pair.hpp cpp-print.hpp |
---|
[3fb7f5e] | 37 | CPPVFILES = cpp-vbench.cpp bench.hpp object.hpp $(CPPVOBJS:.o=.hpp) $(CPPVOBJS:.o=.cpp) cpp-vprint.hpp |
---|
[c87cd93] | 38 | CFAFILES = cfa-bench.c bench.h $(CFAOBJS:.o=.h) $(CFAOBJS:.o=.c) |
---|
[3fb7f5e] | 39 | |
---|
[4cfcf41] | 40 | c-bench: c-bench.c c-bench.d $(COBJS) |
---|
[122aecd] | 41 | $(COMPILE.c) -o $@ $< $(COBJS) $(LDFLAGS) |
---|
[4cfcf41] | 42 | |
---|
| 43 | cpp-bench: cpp-bench.cpp cpp-bench.d $(CPPOBJS) |
---|
[122aecd] | 44 | $(COMPILE.cpp) -o $@ $< $(CPPOBJS) $(LDFLAGS) |
---|
[4cfcf41] | 45 | |
---|
[b276be5] | 46 | cpp-vbench: cpp-vbench.cpp cpp-vbench.d $(CPPVOBJS) |
---|
| 47 | $(COMPILE.cpp) -o $@ $< $(CPPVOBJS) $(LDFLAGS) |
---|
| 48 | |
---|
[4cfcf41] | 49 | cfa-bench: cfa-bench.c cfa-bench.d $(CFAOBJS) |
---|
[122aecd] | 50 | $(COMPILE.cfa) -o $@ $< $(CFAOBJS) $(LDFLAGS) |
---|
[309be81] | 51 | |
---|
| 52 | clean: |
---|
[4cfcf41] | 53 | -rm $(COBJS) c-bench |
---|
| 54 | -rm $(CPPOBJS) cpp-bench |
---|
[b276be5] | 55 | -rm $(CPPVOBJS) cpp-vbench |
---|
[4cfcf41] | 56 | -rm $(CFAOBJS) cfa-bench |
---|
| 57 | |
---|
| 58 | distclean: clean |
---|
| 59 | -rm $(COBJS:.o=.d) c-bench.d |
---|
| 60 | -rm $(CPPOBJS:.o=.d) cpp-bench.d |
---|
[b276be5] | 61 | -rm $(CPPVOBJS:.o=.d) cpp-vbench.d |
---|
[4cfcf41] | 62 | -rm $(CFAOBJS:.o=.d) cfa-bench.d |
---|
| 63 | |
---|
[b276be5] | 64 | run-c: c-bench |
---|
[47535a0d] | 65 | @echo |
---|
[4cfcf41] | 66 | @echo '## C ##' |
---|
[47535a0d] | 67 | @/usr/bin/time -f 'max_memory:\t%M kilobytes' ./c-bench |
---|
[3fb7f5e] | 68 | @printf 'source_size:\t%8d lines\n' `cat $(CFILES) | wc -l` |
---|
[a381b46] | 69 | @printf 'redundant_type_annotations:%8d lines\n' `cat $(CFILES) | fgrep '/***/' -c` |
---|
[47535a0d] | 70 | @printf 'binary_size:\t%8d bytes\n' `stat -c %s c-bench` |
---|
[b276be5] | 71 | |
---|
| 72 | run-cfa: cfa-bench |
---|
[47535a0d] | 73 | @echo |
---|
[4cfcf41] | 74 | @echo '## Cforall ##' |
---|
[47535a0d] | 75 | @/usr/bin/time -f 'max_memory:\t %M kilobytes' ./cfa-bench |
---|
[3fb7f5e] | 76 | @printf 'source_size:\t%8d lines\n' `cat $(CFAFILES) | wc -l` |
---|
[a381b46] | 77 | @printf 'redundant_type_annotations:%8d lines\n' `cat $(CFAFILES) | fgrep '/***/' -c` |
---|
[47535a0d] | 78 | @printf 'binary_size:\t%8d bytes\n' `stat -c %s cfa-bench` |
---|
[b276be5] | 79 | |
---|
| 80 | run-cpp: cpp-bench |
---|
[47535a0d] | 81 | @echo |
---|
[b276be5] | 82 | @echo '## C++ ##' |
---|
[47535a0d] | 83 | @/usr/bin/time -f 'max_memory:\t %M kilobytes' ./cpp-bench |
---|
[3fb7f5e] | 84 | @printf 'source_size:\t%8d lines\n' `cat $(CPPFILES) | wc -l` |
---|
[a381b46] | 85 | @printf 'redundant_type_annotations:%8d lines\n' `cat $(CPPFILES) | fgrep '/***/' -c` |
---|
[47535a0d] | 86 | @printf 'binary_size:\t%8d bytes\n' `stat -c %s cpp-bench` |
---|
[b276be5] | 87 | |
---|
| 88 | run-cppv: cpp-vbench |
---|
[47535a0d] | 89 | @echo |
---|
[a381b46] | 90 | @echo '## C++obj ##' |
---|
[47535a0d] | 91 | @/usr/bin/time -f 'max_memory:\t%M kilobytes' ./cpp-vbench |
---|
[3fb7f5e] | 92 | @printf 'source_size:\t%8d lines\n' `cat $(CPPVFILES) | wc -l` |
---|
[a381b46] | 93 | @printf 'redundant_type_annotations:%8d lines\n' `cat $(CPPVFILES) | fgrep '/***/' -c` |
---|
[47535a0d] | 94 | @printf 'binary_size:\t%8d bytes\n' `stat -c %s cpp-vbench` |
---|
[b276be5] | 95 | |
---|
| 96 | run: run-c run-cfa run-cpp run-cppv |
---|
[4cfcf41] | 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 |
---|