X-Git-Url: https://git.llucax.com/software/dgc/dgcbench.git/blobdiff_plain/87dc0324ffd32c5a094ba2d1a42b10c6565470f3..3c6430d7b2a15133e467a3a4e04a3a8a012d09f3:/Makefile diff --git a/Makefile b/Makefile index 2ba5804..f32edb6 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,11 @@ GC := cdgc -O := build/$(GC) -DC := dmd -LD := dmd +B := build +O := $B/$(GC) +DC := ../dmd/src/dmd +LD := ../dmd/src/dmd LN := ln -GNUPLOT := gnuplot +TIME := /usr/bin/time override DFLAGS ?= -release -inline -O -gc LDFLAGS := -defaultlib=tango-$(GC) -debuglib=tango-$(GC) LIBTANGO := ../lib/libtango-$(GC).a @@ -13,7 +14,7 @@ ifndef V P = @ P_DC = @printf ' DC %- 40s <- %s\n' '$@' '$(if \ $(subst 1,,$(words $^)),$< ... $(lastword $^),$<)'; -P_PLOT = @printf ' PLOT %- 40s <- %s\n' '$@' '$(filter %.csv,$^)'; +P_PLOT = @printf ' PLOT %- 40s <- %s\n' '$@' '$(notdir $(filter %.csv,$^))'; P_AWK = @printf ' AWK %- 40s <- %s\n' '$@' '$<'; P_RUN = @printf ' RUN $< $(args)\n'; P_MAKE = @printf ' MAKE $@\n'; @@ -22,40 +23,84 @@ P_LN = @printf ' LN %- 40s <- %s\n' '$@' '$<'; endif # create build directories if they don't already exist -ifneq ($(wildcard $O),$O) -dummy_mkdir := $(shell mkdir -p $O $O/bin $O/stats) -endif +dummy_mkdir := $(shell mkdir -p $O $O/bin $O/time $O/stats) -# don't use Gold with old DMDs -ifeq ($(subst dmd,,$(DC)),) -ifneq ($(strip $(shell ld --version | grep gold)),) -export LD_ := /usr/bin/ld.single -endif -endif + +######################################################## +# general rules that doesn't depend on the GC variable # +######################################################## .PHONY: all -all: cdgc basic +all: basic cdgc + +.PHONY: micro-time +micro: micro-time + +.PHONY: dil +dil: + # TODO + +.PHONY: micro-time +micro-time: $B/time.eps $B/time.svg +$B/time.%: $(patsubst micro/%.d,$B/time-%.csv,$(wildcard micro/*.d)) \ + time-plot.tpl-gpi time-plot.sh templite.py + $(P_PLOT) ./time-plot.sh $* $@ $(filter %.csv,$^) + +.PRECIOUS: $B/time-%.csv +$B/time-%.csv: $B/basic/time/%.csv | basic cdgc + $P echo -n > $@ + $P for t in basic cdgc; do \ + (echo -n $$t,; ./stats.py < $B/$$t/time/$*.csv) >> $@; \ + echo " STATS `tail -n1 $@` >> $@"; \ + done .PHONY: cdgc basic cdgc basic: - $(P_MAKE) $(MAKE) --no-print-directory micro-build dil-build GC=$@ + $(P_MAKE) $(MAKE) --no-print-directory micro-gc-build dil-gc-build GC=$@ + + +.PHONY: clean-all clean-cdgc clean-basic +clean-all: clean-cdgc clean-basic +clean-cdgc: + $(P_MAKE) $(MAKE) --no-print-directory clean GC=cdgc +clean-basic: + $(P_MAKE) $(MAKE) --no-print-directory clean GC=basic +######################################### +# rules that depends on the GC variable # +######################################### + # micro ######## -.PHONY: micro-build -micro-build: $(patsubst micro/%.d,$O/bin/%,$(wildcard micro/*.d)) +micro-src := $(wildcard micro/*.d) + +.PHONY: micro-gc-build +micro-gc-build: $(patsubst micro/%.d,$O/bin/%,$(wildcard micro/*.d)) .PRECIOUS: $O/bin/% -$O/bin/%: $O/micro/%.o +$O/bin/%: $O/micro/%.o $(LIBTANGO) $(P_DC) $(DC) $(LDFLAGS) -of$@ $^ -.PHONY: micro-stats -micro-stats: $(patsubst micro/%.d,$O/stats/%.eps,$(wildcard micro/*.d)) +.PHONY: micro-gc-time +micro-gc-time: $(patsubst micro/%.d,$O/time/%.csv,$(wildcard micro/*.d)) + +.PHONY: micro-gc-stats +micro-gc-stats: $(patsubst micro/%.d,$O/stats/%.eps,$(wildcard micro/*.d)) + +# special command line arguments for 'shootout_binarytrees' micro benchmark +$O/time/shootout_binarytrees.csv $O/stats/shootout_binarytrees.c.csv \ + $O/stats/shootout_binarytrees.a.csv: \ + override args := 16 -# special command line arguments 'split' micro benchmark -$O/micro/split.c.csv $O/micro/split.a.csv: override args := micro/bible.txt +# special command line arguments for 'split' micro benchmark +$O/time/split.csv $O/stats/split.c.csv $O/stats/split.a.csv: \ + override args := micro/bible.txt 2 + +# special command line arguments for 'voronoi' micro benchmark +$O/time/voronoi.csv $O/stats/voronoi.c.csv $O/voronoi/split.a.csv: \ + override args := -n 30000 # dil @@ -64,17 +109,14 @@ $O/micro/split.c.csv $O/micro/split.a.csv: override args := micro/bible.txt DIL_SRC = $(wildcard dil/src/*.d dil/src/cmd/*.d dil/src/util/*.d \ dil/src/dil/*.d dil/src/dil/*/*.d) -.PHONY: dil-nop-stats -dil-nop-stats: $O/stats/dil-nop.eps - -.PHONY: dil-build -dil-build: $O/bin/dil +.PHONY: dil-gc-build +dil-gc-build: $O/bin/dil $O/bin/dil: override DFLAGS += -Idil/src $O/bin/dil: $(patsubst %.d,$O/%.o,$(DIL_SRC)) $(LIBTANGO) $(P_DC) $(DC) $(LDFLAGS) -L-lmpfr -L-lgmp -of$@ $^ -$O/bin/dil-nop: $O/bin/dil - @$(P_LN) $(LN) -sf $( $@ ($I)' + $P echo -n > $@ + $P for i in `seq $I`; do \ + echo -n " $$i"; \ + $(TIME) -f%e -a -o $@ ./$< $(args); \ + done; echo + .PRECIOUS: $O/stats/%.c.csv $O/stats/%.a.csv $O/stats/%.c.csv $O/stats/%.a.csv: $O/bin/% $(P_RUN) D_GC_STATS=1 ./$< $(args) @@ -110,10 +165,3 @@ $O/stats/%.eps: $O/stats/%.c.csv $O/stats/%.a.csv $O/stats/%.h.csv \ clean: $O/ $(P_RM) $(RM) -r $^ -.PHONY: clean-all -clean-all: clean-cdgc clean-basic -clean-cdgc: - $(P_MAKE) $(MAKE) --no-print-directory clean GC=cdgc -clean-basic: - $(P_MAKE) $(MAKE) --no-print-directory clean GC=basic -