X-Git-Url: https://git.llucax.com/software/dgc/dgcbench.git/blobdiff_plain/254a2ba31ffdfd67235959c657551e029df4fab5..ae114983db8b75954cdc27c2d97c72c2a9e720f9:/micro/Makefile diff --git a/micro/Makefile b/micro/Makefile index adef522..48b7308 100644 --- a/micro/Makefile +++ b/micro/Makefile @@ -7,29 +7,35 @@ DFLAGS += -release -inline -O DFLAGS += -defaultlib=tango-base-dmd-$(VERS) -debuglib=tango-base-dmd-$(VERS) \ -L-ltango-user-dmd-$(VERS) -BASE_DIR := build -BUILD_DIR := $(BASE_DIR)/$(VERS) +BUILD_DIR := $(VERS) BIN_DIR := $(BUILD_DIR)/bin +STAT_DIR := $(BUILD_DIR)/stat PLOT_DIR := $(BUILD_DIR)/plot +DIRS := $(BIN_DIR) $(STAT_DIR) $(PLOT_DIR) sources := $(wildcard *.d) programs := $(addprefix $(BIN_DIR)/,$(sources:.d=)) +stat_c := $(addprefix $(STAT_DIR)/,$(addsuffix .c.csv,$(sources:.d=))) +stat_a := $(addprefix $(STAT_DIR)/,$(addsuffix .a.csv,$(sources:.d=))) +stat_h := $(addprefix $(STAT_DIR)/,$(addsuffix .h.csv,$(sources:.d=))) +stat := $(stat_c) $(stat_a) $(stat_h) graphs_c := $(addprefix $(PLOT_DIR)/,$(addsuffix .c.eps,$(sources:.d=))) graphs := $(graphs_c) + ifndef V P = @ P_DC = @echo ' DC $@'; P_LD = @echo ' LD $@'; -P_CP = @echo ' CP $@'; P_PLOT = @echo ' PLOT $@'; P_MAKE = @echo ' MAKE $@'; -P_RUN = @echo ' RUN $<'; +P_RUN = @echo ' RUN $< $(arg1) $(arg2) $(arg3)'; +P_AWK = @echo ' AWK $@'; endif # create build directories if they don't already exist -ifneq ($(wildcard $(BIN_DIR) $(PLOT_DIR)),$(BIN_DIR) $(PLOT_DIR)) -dummy_mkdir := $(shell mkdir -p $(BIN_DIR) $(PLOT_DIR)) +ifneq ($(wildcard $(DIRS)),$(DIRS)) +dummy_mkdir := $(shell mkdir -p $(DIRS)) endif # don't use Gold with old DMDs @@ -50,32 +56,39 @@ build: $(programs) $(BIN_DIR)/%: $(BIN_DIR)/%.o $(P_LD) $(DC) $(DFLAGS) -of$@ $^ -.INTERMEDIATE: $(BIN_DIR)/%.o $(BIN_DIR)/%.o: %.d $(P_DC) $(DC) $(DFLAGS) -c -of$@ $< -.PHONY: plot -plot: $(graphs) +.PHONY: stat +stat: $(stat) -$(PLOT_DIR)/%.c.eps: $(PLOT_DIR)/%.c.csv plot-c.gpi - $(P_PLOT) \ - sed 's|@@PRG@@|$(*F)|g; s|@@COL@@|$(VERS)|g; s|@@IN@@|$<|g; s|@@OUT@@|$@|g' \ - $(word 2,$^) | $(GNUPLOT) +.PRECIOUS: $(STAT_DIR)/%.c.csv $(STAT_DIR)/%.a.csv +$(STAT_DIR)/%.c.csv $(STAT_DIR)/%.a.csv: $(BIN_DIR)/% + $(P_RUN) ./$< $(args) + $P mv gc-collections.csv $(STAT_DIR)/$*.c.csv + $P mv gc-mallocs.csv $(STAT_DIR)/$*.a.csv -.PRECIOUS: $(PLOT_DIR)/%.c.csv $(PLOT_DIR)/%.a.csv -$(PLOT_DIR)/%.c.csv $(PLOT_DIR)/%.a.csv: $(BIN_DIR)/% - $(P_RUN) ./$< - $P mv gc-collections.csv $(PLOT_DIR)/$*.c.csv - $P mv gc-mallocs.csv $(PLOT_DIR)/$*.a.csv +# special command line arguments for benchmarks +$(STAT_DIR)/split.c.csv $(STAT_DIR)/split.a.csv: override args := bible.txt -$(PLOT_DIR)/split.c.csv $(PLOT_DIR)/split.a.csv: $(BIN_DIR)/bible.txt +.PRECIOUS: $(STAT_DIR)/%.h.csv +$(STAT_DIR)/%.h.csv: $(STAT_DIR)/%.a.csv hist.awk + $(P_AWK) awk -F, -f $(lastword $^) $< > $@ -$(BIN_DIR)/bible.txt: bible.txt - $(P_CP) cp -l $< $@ +.PHONY: plot +plot: $(graphs) -.PHONY: dist-clean -dist-clean: - $(RM) -r $(BASE_DIR) +.PRECIOUS: $(PLOT_DIR)/%.tics +$(PLOT_DIR)/%.tics: $(STAT_DIR)/%.h.csv tics.awk + $(P_AWK) awk -F, -f $(lastword $^) $< > $@ + +$(PLOT_DIR)/%.c.eps: $(STAT_DIR)/%.c.csv $(STAT_DIR)/%.a.csv \ + $(STAT_DIR)/%.h.csv $(PLOT_DIR)/%.tics plot-c.gpi + $(P_PLOT) sed "s|@@PRG@@|$(*F)|g; s|@@COL@@|$(VERS)|g; \ + s|@@INC@@|$(word 1,$^)|g; s|@@INA@@|$(word 2,$^)|g; \ + s|@@INH@@|$(word 3,$^)|g; s|@@OUT@@|$@|g; \ + s|@@TICS@@|$(shell cat $(word 4,$^))|g" $(word 5,$^) \ + | $(GNUPLOT) .PHONY: clean clean: