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_CP = @echo ' CP $@';
31 P_PLOT = @echo ' PLOT $@';
32 P_MAKE = @echo ' MAKE $@';
33 P_RUN = @echo ' RUN $<';
34 P_AWK = @echo ' AWK $@';
37 # create build directories if they don't already exist
38 ifneq ($(wildcard $(DIRS)),$(DIRS))
39 dummy_mkdir := $(shell mkdir -p $(DIRS))
42 # don't use Gold with old DMDs
43 ifneq ($(shell ld --version | grep gold),)
44 export LD_ := /usr/bin/ld.single
52 $(P_MAKE) $(MAKE) --no-print-directory build VERS=$@
57 $(BIN_DIR)/%: $(BIN_DIR)/%.o
58 $(P_LD) $(DC) $(DFLAGS) -of$@ $^
61 $(P_DC) $(DC) $(DFLAGS) -c -of$@ $<
66 .PRECIOUS: $(STAT_DIR)/%.c.csv $(STAT_DIR)/%.a.csv
67 $(STAT_DIR)/%.c.csv $(STAT_DIR)/%.a.csv: $(BIN_DIR)/%
69 $P mv gc-collections.csv $(STAT_DIR)/$*.c.csv
70 $P mv gc-mallocs.csv $(STAT_DIR)/$*.a.csv
72 $(STAT_DIR)/split.c.csv $(STAT_DIR)/split.a.csv: $(BIN_DIR)/bible.txt
74 $(BIN_DIR)/bible.txt: bible.txt
77 .PRECIOUS: $(STAT_DIR)/%.h.csv
78 $(STAT_DIR)/%.h.csv: $(STAT_DIR)/%.a.csv
79 $(P_AWK) awk -F, 'BEGIN { print "Size,Count" } NR > 1 { a[$$3]++ } \
80 END { for (i in a) print i "," a[i] }' $< | sort > $@
85 $(PLOT_DIR)/%.c.eps: $(STAT_DIR)/%.c.csv plot-c.gpi
86 $(P_PLOT) sed "s|@@PRG@@|$(*F)|g; s|@@COL@@|$(VERS)|g; \
87 s|@@IN@@|$<|g; s|@@OUT@@|$@|g" $(lastword $^) \