6 DFLAGS += -release -inline -O
7 DFLAGS += -defaultlib=tango-base-dmd-$(VERS) -debuglib=tango-base-dmd-$(VERS) \
8 -L-ltango-user-dmd-$(VERS)
11 BIN_DIR := $(BUILD_DIR)/bin
12 STAT_DIR := $(BUILD_DIR)/stat
13 PLOT_DIR := $(BUILD_DIR)/plot
14 DIRS := $(BIN_DIR) $(STAT_DIR) $(PLOT_DIR)
16 sources := $(wildcard *.d)
17 programs := $(addprefix $(BIN_DIR)/,$(sources:.d=))
18 stat_c := $(addprefix $(STAT_DIR)/,$(addsuffix .c.csv,$(sources:.d=)))
19 stat_a := $(addprefix $(STAT_DIR)/,$(addsuffix .a.csv,$(sources:.d=)))
20 stat_h := $(addprefix $(STAT_DIR)/,$(addsuffix .h.csv,$(sources:.d=)))
21 stat := $(stat_c) $(stat_a) $(stat_h)
22 graphs_c := $(addprefix $(PLOT_DIR)/,$(addsuffix .c.eps,$(sources:.d=)))
28 P_DC = @echo ' DC $@';
29 P_LD = @echo ' LD $@';
30 P_PLOT = @echo ' PLOT $@';
31 P_MAKE = @echo ' MAKE $@';
32 P_RUN = @echo ' RUN $<';
33 P_AWK = @echo ' AWK $@';
36 # create build directories if they don't already exist
37 ifneq ($(wildcard $(DIRS)),$(DIRS))
38 dummy_mkdir := $(shell mkdir -p $(DIRS))
41 # don't use Gold with old DMDs
42 ifneq ($(shell ld --version | grep gold),)
43 export LD_ := /usr/bin/ld.single
51 $(P_MAKE) $(MAKE) --no-print-directory build VERS=$@
56 $(BIN_DIR)/%: $(BIN_DIR)/%.o
57 $(P_LD) $(DC) $(DFLAGS) -of$@ $^
60 $(P_DC) $(DC) $(DFLAGS) -c -of$@ $<
65 .PRECIOUS: $(STAT_DIR)/%.c.csv $(STAT_DIR)/%.a.csv
66 $(STAT_DIR)/%.c.csv $(STAT_DIR)/%.a.csv: $(BIN_DIR)/%
68 $P mv gc-collections.csv $(STAT_DIR)/$*.c.csv
69 $P mv gc-mallocs.csv $(STAT_DIR)/$*.a.csv
72 .PRECIOUS: $(STAT_DIR)/%.h.csv
73 $(STAT_DIR)/%.h.csv: $(STAT_DIR)/%.a.csv
74 $(P_AWK) awk -F, 'BEGIN { print "Size,Count" } NR > 1 { a[$$3]++ } \
75 END { for (i in a) print i "," a[i] }' $< | sort > $@
80 $(PLOT_DIR)/%.c.eps: $(STAT_DIR)/%.c.csv plot-c.gpi
81 $(P_PLOT) sed "s|@@PRG@@|$(*F)|g; s|@@COL@@|$(VERS)|g; \
82 s|@@IN@@|$<|g; s|@@OUT@@|$@|g" $(lastword $^) \