Makefile (1046B)
1 DMD ?= dmd 2 DEBUG ?= -g 3 RELEASE ?= -release 4 DFLAGS ?= -O 5 INCLUDES = src 6 SRC := $(wildcard src/*.d ) 7 TARGET = dpuzzle 8 LIBS = 9 10 _DFLAGS := $(addprefix -I, $(INCLUDES)) $(addprefix -L-l, $(LIBS)) $(DFLAGS) 11 12 .PHONY: all shared static clean distclean 13 14 all: shared static 15 shared: lib$(TARGET)-debug.so lib$(TARGET).so 16 static: lib$(TARGET)-debug.a lib$(TARGET).a 17 18 lib$(TARGET).a: $(patsubst %.d,%.o,$(SRC)) 19 $(DMD) $(_DFLAGS) $(RELEASE) -lib -of$@ $^ 20 lib$(TARGET)-debug.a: $(patsubst %.d, %-debug.o,$(SRC)) 21 $(DMD) $(_DFLAGS) $(DEBUG) -lib -of$@ $^ 22 lib$(TARGET).so: $(patsubst %.d, %.o, $(SRC)) 23 $(DMD) $(_DFLAGS) $(RELEASE) -shared -of$@ $^ 24 lib$(TARGET)-debug.so: $(patsubst %.d, %-debug.o, $(SRC)) 25 $(DMD) $(_DFLAGS) $(DEBUG) -shared -of$@ $^ 26 27 %.o:%.d 28 $(DMD) $(_DFLAGS) $(RELEASE) -c -of$@ $< 29 %-debug.o:%.d 30 $(DMD) $(_DFLAGS) $(DEBUG) -c -of$@ $< 31 32 33 .PHONY: clean distclean doc install 34 35 clean: 36 rm -f $(patsubst %.d, %.o, $(SRC)) $(patsubst %.d,%-debug.o,$(SRC)) 37 38 distclean: clean 39 rm -f lib$(TARGET){,-debug}.{so,a} 40 41 doc: $(SRC) 42 dmd -D -Dddoc $^ -c 43