Makefile (718B)
1 DMD=dmd 2 DFLAGS?=-O 3 DebugFLAGS?=-g 4 LIB=dfortune 5 SOURCES=src/dfortune.d 6 OBJECTS:=$(patsubst %.d,%.o,$(SOURCES)) 7 DOBJECTS:=$(patsubst %.o,%-debug.o,$(OBJECTS)) 8 9 all: static 10 static: $(LIB).a $(LIB)-debug.a 11 shared: $(LIB).so $(LIB)-debug.so 12 13 $(LIB).so: $(OBJECTS) 14 $(DMD) $(DFLAGS) -shared $^ -of$@ 15 $(LIB).a: $(OBJECTS) 16 $(DMD) $(DFLAGS) -lib $^ -of$@ 17 18 $(LIB)-debug.a: $(DOBJECTS) 19 $(DMD) $(DebugFLAGS) -lib $^ -of$@ 20 $(LIB)-debug.so: $(DOBJECTS) 21 $(DMD) $(DebugFLAGS) -lib $^ -of$@ 22 23 %.o: %.d 24 $(DMD) $(DFLAGS) -c $^ -of$@ 25 %-debug.o: %.d 26 $(DMD) $(DebugFlags) -c $^ -of$@ 27 28 doc: $(SOURCES) 29 $(DMD) -o- -D -Dddoc $^ 30 31 .PHONY: clean distclean 32 clean: 33 rm -f $(OBJECTS) $(DOBJECTS) 34 distclean: clean 35 rm -f $(LIB){-debug,}.{so,a} 36