+# Build directory
+B := build
+
# D compiler to use
DC := ldc
# GC sources
sources := \
- gc.d \
- gcalloc.d \
- gcbits.d \
- gcstats.d \
- gcx.d
+ gc/iface.d \
+ gc/alloc.d \
+ gc/bits.d \
+ gc/stats.d \
+ gc/libc.d \
+ gc/gc.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)
+