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