8 override DFLAGS ?= -release -inline -O -gc
9 LDFLAGS := -defaultlib=tango-$(GC) -debuglib=tango-$(GC)
10 LIBTANGO := ../lib/libtango-$(GC).a
14 P_DC = @printf ' DC %- 40s <- %s\n' '$@' '$(if \
15 $(subst 1,,$(words $^)),$< ... $(lastword $^),$<)';
16 P_PLOT = @printf ' PLOT %- 40s <- %s\n' '$@' '$(filter %.csv,$^)';
17 P_AWK = @printf ' AWK %- 40s <- %s\n' '$@' '$<';
18 P_RUN = @printf ' RUN $< $(args)\n';
19 P_MAKE = @printf ' MAKE $@\n';
20 P_RM = @printf ' RM $^\n';
21 P_LN = @printf ' LN %- 40s <- %s\n' '$@' '$<';
24 # create build directories if they don't already exist
25 ifneq ($(wildcard $O),$O)
26 dummy_mkdir := $(shell mkdir -p $O $O/bin $O/stats)
29 # don't use Gold with old DMDs
30 ifeq ($(subst dmd,,$(DC)),)
31 ifneq ($(strip $(shell ld --version | grep gold)),)
32 export LD_ := /usr/bin/ld.single
41 $(P_MAKE) $(MAKE) --no-print-directory micro-build dil-build GC=$@
48 micro-build: $(patsubst micro/%.d,$O/bin/%,$(wildcard micro/*.d))
51 $O/bin/%: $O/micro/%.o
52 $(P_DC) $(DC) $(LDFLAGS) -of$@ $^
55 micro-stats: $(patsubst micro/%.d,$O/stats/%.eps,$(wildcard micro/*.d))
57 # special command line arguments 'split' micro benchmark
58 $O/micro/split.c.csv $O/micro/split.a.csv: override args := micro/bible.txt
64 DIL_SRC = $(wildcard dil/src/*.d dil/src/cmd/*.d dil/src/util/*.d \
65 dil/src/dil/*.d dil/src/dil/*/*.d)
68 dil-nop-stats: $O/stats/dil-nop.eps
72 $O/bin/dil: override DFLAGS += -Idil/src
73 $O/bin/dil: $(patsubst %.d,$O/%.o,$(DIL_SRC)) $(LIBTANGO)
74 $(P_DC) $(DC) $(LDFLAGS) -L-lmpfr -L-lgmp -of$@ $^
76 $O/bin/dil-nop: $O/bin/dil
77 @$(P_LN) $(LN) -sf $(<F) $@
85 $(P_DC) $(DC) -c $(DFLAGS) -of$@ $^
87 .PRECIOUS: $O/stats/%.c.csv $O/stats/%.a.csv
88 $O/stats/%.c.csv $O/stats/%.a.csv: $O/bin/%
89 $(P_RUN) D_GC_STATS=1 ./$< $(args)
90 $P mv gc-collections.csv $O/stats/$*.c.csv
91 $P mv gc-mallocs.csv $O/stats/$*.a.csv
93 .PRECIOUS: $O/stats/%.h.csv
94 $O/stats/%.h.csv: $O/stats/%.a.csv hist.awk
95 $(P_AWK) awk -F, -f $(lastword $^) $< > $@
97 .PRECIOUS: $O/stats/%.tics
98 $O/stats/%.tics: $O/stats/%.h.csv tics.awk
99 $(P_AWK) awk -F, -f $(lastword $^) $< > $@
101 $O/stats/%.eps: $O/stats/%.c.csv $O/stats/%.a.csv $O/stats/%.h.csv \
102 $O/stats/%.tics plot.gpi
103 $(P_PLOT) sed "s|@@PRG@@|$(*F)|g; s|@@COL@@|$(GC)|g; \
104 s|@@INC@@|$(word 1,$^)|g; s|@@INA@@|$(word 2,$^)|g; \
105 s|@@INH@@|$(word 3,$^)|g; s|@@OUT@@|$@|g; \
106 s|@@TICS@@|$(shell cat $(word 4,$^))|g" $(word 5,$^) \
114 clean-all: clean-cdgc clean-basic
116 $(P_MAKE) $(MAKE) --no-print-directory clean GC=cdgc
118 $(P_MAKE) $(MAKE) --no-print-directory clean GC=basic