############################################################################### .ONESHELL: ############################################################################### ATT = $(EXE:=.att) CAC = $(EXE:=.cache) CAL = $(EXE:=.cal) DAT = $(EXE:=.dat) EXE = $(basename $(SRC)) GB = $(basename $(shell grep -l 'benchmark.h' $(SRC))) LOG = $(EXE:=.log) $(EXE:=.log2) OLD = $(DAT:=.old) SRC = $(wildcard *.cc) ############################################################################### CXXFLAGS = -g -O3 -std=c++23 -Wall ############################################################################### all: $(EXE) clean: -rm -fv $(ATT) $(CAC) $(CAL) $(DAT) $(EXE) $(LOG) $(OLD) {cache,call}grind.out.* {vg,}core.* gmon.out perf.data* *~ ############################################################################### %.att: % objdump -Cd $< > $@ %.cal: % -valgrind --branch-sim=yes --cache-sim=yes --callgrind-out-file=$@ --collect-jumps=yes --demangle=yes --dump-instr=yes --dump-line=yes --instr-atstart=yes --toggle-collect=f --toggle-collect=main --tool=callgrind --cache-sim=yes -- ./$< %.cla: %.cal callgrind_annotate --auto=yes $< %.cga: %.log cg_annotate --auto=yes $< %.dat: % makefile perf record --call-graph=dwarf --freq=max -g -o $@ -- ./$< %.kcg: %.log2 kcachegrind $< %.log: % makefile valgrind --cachegrind-out-file=$@ --tool=cachegrind ./$< %.log2: % makefile valgrind --branch-sim=yes --cacheuse=yes --callgrind-out-file=$@ --cache-sim=yes --collect-jumps=yes --demangle=yes --dump-instr=yes --instr-atstart=yes -q --tool=callgrind --trace-jump=yes ./$< %.perf: %.dat perf report -d $* -i $< %.qcg: %.log2 qcachegrind $< ############################################################################### %-etal: CXXFLAGS += -fopt-info $(GB): LDFLAGS += -lbenchmark %2: CXXFLAGS += -fno-inline ############################################################################### .PHONY: all clean .PRECIOUS: $(DAT) $(LOG) .NOEXPORT: ###############################################################################