From: Leandro Lucarella Date: Thu, 27 Aug 2009 18:08:22 +0000 (-0300) Subject: Move Makefile to the top-level directory X-Git-Url: https://git.llucax.com/software/dgc/dgcbench.git/commitdiff_plain/205f85e112c3611d888e5d56edb6e4e5b64a71ae Move Makefile to the top-level directory This is to prepare the terrain to add real programs benchmarks, like Dil. --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..859f8bd --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +naive diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ca678cf --- /dev/null +++ b/Makefile @@ -0,0 +1,79 @@ + +VERS := naive +DC := dmd +DL := dmd +GNUPLOT := gnuplot +DFLAGS += -release -inline -O +DFLAGS += -defaultlib=tango-base-dmd-$(VERS) -debuglib=tango-base-dmd-$(VERS) \ + -L-ltango-user-dmd-$(VERS) + +O := $(VERS) + +micro_src := $(wildcard micro/*.d) + +ifndef V +P = @ +P_DC = @printf ' DC %- 40s <- %s\n' '$@' '$<'; +P_LD = @printf ' LD %- 40s <- %s\n' '$@' '$^'; +P_PLOT = @printf ' PLOT %- 40s <- %s\n' '$@' '$< ...'; +P_AWK = @printf ' AWK %- 40s <- %s\n' '$@' '$<'; +P_RUN = @printf ' RUN $< $(args)\n'; +P_MAKE = @printf ' MAKE $@\n'; +P_RM = @printf ' RM $^\n'; +endif + +# create build directories if they don't already exist +ifneq ($(wildcard $O),$O) +dummy_mkdir := $(shell mkdir -p $O) +endif + +# don't use Gold with old DMDs +ifneq ($(shell ld --version | grep gold),) +export LD_ := /usr/bin/ld.single +endif + +.PHONY: all +all: naive + +.PHONY: naive basic +naive basic: + $(P_MAKE) $(MAKE) --no-print-directory micro VERS=$@ + +$O/%: $O/%.o + $(P_LD) $(DC) $(DFLAGS) -of$@ $^ + +$O/%.o: %.d + $(P_DC) $(DC) $(DFLAGS) -c -of$@ $< + +.PRECIOUS: $O/%.c.csv $O/%.a.csv +$O/%.c.csv $O/%.a.csv: $O/% + $(P_RUN) ./$< $(args) + $P mv gc-collections.csv $O/$*.c.csv + $P mv gc-mallocs.csv $O/$*.a.csv + +# special command line arguments for benchmarks +$O/micro/split.c.csv $O/micro/split.a.csv: override args := micro/bible.txt + +.PRECIOUS: $O/%.h.csv +$O/%.h.csv: $O/%.a.csv hist.awk + $(P_AWK) awk -F, -f $(lastword $^) $< > $@ + +.PHONY: micro +micro: $(patsubst %.d,$O/%.eps,$(micro_src)) + +.PRECIOUS: $O/%.tics +$O/%.tics: $O/%.h.csv tics.awk + $(P_AWK) awk -F, -f $(lastword $^) $< > $@ + +$O/%.eps: $O/%.c.csv $O/%.a.csv \ + $O/%.h.csv $O/%.tics plot.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: $O/ + $(P_RM) $(RM) -r $^ + diff --git a/dmd.conf b/dmd.conf new file mode 100644 index 0000000..4fcf994 --- /dev/null +++ b/dmd.conf @@ -0,0 +1,4 @@ +[Environment] + +DFLAGS=-I%@P%/../dmd/include -L-L%@P%/../dmd/linux/lib -version=Tango + diff --git a/micro/hist.awk b/hist.awk similarity index 100% rename from micro/hist.awk rename to hist.awk diff --git a/micro/Makefile b/micro/Makefile deleted file mode 100644 index b234261..0000000 --- a/micro/Makefile +++ /dev/null @@ -1,96 +0,0 @@ - -VERS := naive -DC := dmd -DL := dmd -GNUPLOT := gnuplot -DFLAGS += -release -inline -O -DFLAGS += -defaultlib=tango-base-dmd-$(VERS) -debuglib=tango-base-dmd-$(VERS) \ - -L-ltango-user-dmd-$(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 .eps,$(sources:.d=))) -graphs := $(graphs_c) - - -ifndef V -P = @ -P_DC = @echo ' DC $@'; -P_LD = @echo ' LD $@'; -P_PLOT = @echo ' PLOT $@'; -P_MAKE = @echo ' MAKE $@'; -P_RUN = @echo ' RUN $< $(arg1) $(arg2) $(arg3)'; -P_AWK = @echo ' AWK $@'; -endif - -# create build directories if they don't already exist -ifneq ($(wildcard $(DIRS)),$(DIRS)) -dummy_mkdir := $(shell mkdir -p $(DIRS)) -endif - -# don't use Gold with old DMDs -ifneq ($(shell ld --version | grep gold),) -export LD_ := /usr/bin/ld.single -endif - -.PHONY: all -all: basic naive - -.PHONY: naive basic -naive basic: - $(P_MAKE) $(MAKE) --no-print-directory build VERS=$@ - -.PHONY: build -build: $(programs) - -$(BIN_DIR)/%: $(BIN_DIR)/%.o - $(P_LD) $(DC) $(DFLAGS) -of$@ $^ - -$(BIN_DIR)/%.o: %.d - $(P_DC) $(DC) $(DFLAGS) -c -of$@ $< - -.PHONY: stat -stat: $(stat) - -.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 - -# special command line arguments for benchmarks -$(STAT_DIR)/split.c.csv $(STAT_DIR)/split.a.csv: override args := bible.txt - -.PRECIOUS: $(STAT_DIR)/%.h.csv -$(STAT_DIR)/%.h.csv: $(STAT_DIR)/%.a.csv hist.awk - $(P_AWK) awk -F, -f $(lastword $^) $< > $@ - -.PHONY: plot -plot: $(graphs) - -.PRECIOUS: $(PLOT_DIR)/%.tics -$(PLOT_DIR)/%.tics: $(STAT_DIR)/%.h.csv tics.awk - $(P_AWK) awk -F, -f $(lastword $^) $< > $@ - -$(PLOT_DIR)/%.eps: $(STAT_DIR)/%.c.csv $(STAT_DIR)/%.a.csv \ - $(STAT_DIR)/%.h.csv $(PLOT_DIR)/%.tics plot.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: - $(RM) -r $(BUILD_DIR) - diff --git a/micro/dmd.conf b/micro/dmd.conf deleted file mode 100644 index 7b522e9..0000000 --- a/micro/dmd.conf +++ /dev/null @@ -1,4 +0,0 @@ -[Environment] - -DFLAGS=-I%@P%/../../dmd/include -L-L%@P%/../../dmd/linux/lib -version=Tango - diff --git a/micro/plot.gpi b/plot.gpi similarity index 100% rename from micro/plot.gpi rename to plot.gpi diff --git a/micro/tics.awk b/tics.awk similarity index 100% rename from micro/tics.awk rename to tics.awk