+# Build directory
+B := build
+
# D compiler to use
DC := ldc
#LDFLAGS :=
# GC sources
-sources := \
+sources := $(addprefix rt/gc/cdgc/,\
+ iface.d \
+ alloc.d \
+ bits.d \
+ stats.d \
+ libc.d \
gc.d \
- gcalloc.d \
- gcbits.d \
- gcstats.d \
- gcx.d
+ )
# Default target
-all: cdgc.so
+all: $B/cdgc.so
# Make the GC shared object
-cdgc.so: $(sources:.d=.o)
+$B/cdgc.so: $(patsubst %.d,$B/%.o,$(sources))
# General pattern rules
#######################
-%.so: DCFLAGS += $(DC_SO_OPT)
+$B/%.so: DCFLAGS += $(DC_SO_OPT)
-%.so:
+$B/%.so:
$(if $V,,@echo ' $(LD) $@')
$(if $V,,@) $(LD) $(LDFLAGS) $(LD_SO_OPT) $(LD_OUTPUT_OPTION) $^
-%.o: %.d
+$B/%.o: %.d
$(if $V,,@echo ' $(DC) $@')
$(if $V,,@) $(DC) $(DCFLAGS) $(DC_OBJ_OPT) $(DC_OUTPUT_OPTION) $<
+clean:
+ $(if $V,,@echo ' $(RM) $B')
+ $(if $V,,@) $(RM) -r $B
+
+__dummy := $(shell mkdir -p $B)
+