9 override DFLAGS ?= -release -inline -O -gc
10 LDFLAGS := -defaultlib=tango-$(GC) -debuglib=tango-$(GC)
11 LIBTANGO := ../lib/libtango-$(GC).a
15 P_DC = @printf ' DC %- 40s <- %s\n' '$@' '$(if \
16 $(subst 1,,$(words $^)),$< ... $(lastword $^),$<)';
17 P_PLOT = @printf ' PLOT %- 40s <- %s\n' '$@' '$(notdir $(filter %.csv,$^))';
18 P_AWK = @printf ' AWK %- 40s <- %s\n' '$@' '$<';
19 P_RUN = @printf ' RUN $< $(args)\n';
20 P_MAKE = @printf ' MAKE $@\n';
21 P_RM = @printf ' RM $^\n';
22 P_LN = @printf ' LN %- 40s <- %s\n' '$@' '$<';
25 # create build directories if they don't already exist
26 dummy_mkdir := $(shell mkdir -p $O $O/bin $O/time $O/stats $O/pause)
29 ########################################################
30 # general rules that doesn't depend on the GC variable #
31 ########################################################
38 $(P_MAKE) $(MAKE) --no-print-directory micro-gc-build dil-gc-build GC=$@
41 .PHONY: clean-all clean-cdgc clean-basic
42 clean-all: clean-cdgc clean-basic
44 $(P_MAKE) $(MAKE) --no-print-directory clean GC=cdgc
46 $(P_MAKE) $(MAKE) --no-print-directory clean GC=basic
49 #########################################
50 # rules that depends on the GC variable #
51 #########################################
56 micro-src := $(wildcard micro/*.d)
58 .PHONY: micro-gc-build
59 micro-gc-build: $(patsubst micro/%.d,$O/bin/%,$(wildcard micro/*.d))
62 $O/bin/%: $O/micro/%.o $(LIBTANGO)
63 $(P_DC) $(DC) $(LDFLAGS) -of$@ $^
65 .PHONY: micro-gc-stats
66 micro-gc-stats: $(patsubst micro/%.d,$O/stats/%.eps,$(wildcard micro/*.d))
68 # special command line arguments for 'shootout_binarytrees' micro benchmark
69 $O/stats/shootout_binarytrees.c.csv $O/stats/shootout_binarytrees.a.csv: \
72 # special command line arguments for 'split' micro benchmark
73 $O/stats/split.c.csv $O/stats/split.a.csv: override args := micro/bible.txt 2
75 # special command line arguments for 'voronoi' micro benchmark
76 $O/stats/voronoi.c.csv $O/voronoi/split.a.csv: override args := -n 30000
82 DIL_SRC = $(wildcard dil/src/*.d dil/src/cmd/*.d dil/src/util/*.d \
83 dil/src/dil/*.d dil/src/dil/*/*.d)
86 dil-gc-build: $O/bin/dil
87 $O/bin/dil: override DFLAGS += -Idil/src
88 $O/bin/dil: $(patsubst %.d,$O/%.o,$(DIL_SRC)) $(LIBTANGO)
89 $(P_DC) $(DC) $(LDFLAGS) -L-lmpfr -L-lgmp -of$@ $^
97 $(P_DC) $(DC) -c $(DFLAGS) -of$@ $^
99 .PRECIOUS: $O/stats/%.c.csv $O/stats/%.a.csv
100 $O/stats/%.c.csv $O/stats/%.a.csv: $O/bin/%
101 $(P_RUN) D_GC_STATS=1 ./$< $(args)
102 $P mv gc-collections.csv $O/stats/$*.c.csv
103 $P mv gc-mallocs.csv $O/stats/$*.a.csv
105 .PRECIOUS: $O/stats/%.h.csv
106 $O/stats/%.h.csv: $O/stats/%.a.csv hist.awk
107 $(P_AWK) awk -F, -f $(lastword $^) $< > $@
109 .PRECIOUS: $O/stats/%.tics
110 $O/stats/%.tics: $O/stats/%.h.csv tics.awk
111 $(P_AWK) awk -F, -f $(lastword $^) $< > $@
113 $O/stats/%.eps: $O/stats/%.c.csv $O/stats/%.a.csv $O/stats/%.h.csv \
114 $O/stats/%.tics plot.gpi
115 $(P_PLOT) sed "s|@@PRG@@|$(*F)|g; s|@@COL@@|$(GC)|g; \
116 s|@@INC@@|$(word 1,$^)|g; s|@@INA@@|$(word 2,$^)|g; \
117 s|@@INH@@|$(word 3,$^)|g; s|@@OUT@@|$@|g; \
118 s|@@TICS@@|$(shell cat $(word 4,$^))|g" $(word 5,$^) \