commit 3e28e92b15b2eb8e8e1953fd2753c64131e8f0bd
parent d9724293af943b481c6411ec33cad55ae87a0f25
Author: Dominik Schmidt <das1993@hotmail.com>
Date: Mon, 22 Feb 2016 23:09:36 +0100
Add a Makefile
Diffstat:
Makefile | | | 30 | ++++++++++++++++++++++++++++++ |
1 file changed, 30 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
@@ -0,0 +1,30 @@
+DMD=dmd
+DFLAGS?=-O
+DebugFLAGS?=-g
+LIB=dfortune
+SOURCES=dfortune.d
+OBJECTS:=$(patsubst %.d,%.o,$(SOURCES))
+DOBJECTS:=$(patsubst %.o,%-debug.o,$(OBJECTS))
+
+all: static
+static: $(LIB).a $(LIB)-debug.a
+shared: $(LIB).so $(LIB)-debug.so
+
+$(LIB).so: $(OBJECTS)
+ $(DMD) $(DFLAGS) -shared $^ -of$@
+$(LIB).a: $(OBJECTS)
+ $(DMD) $(DFLAGS) -lib $^ -of$@
+
+$(LIB)-debug.a: $(DOBJECTS)
+ $(DMD) $(DebugFLAGS) -lib $^ -of$@
+$(LIB)-debug.so: $(DOBJECTS)
+ $(DMD) $(DebugFLAGS) -lib $^ -of$@
+
+%.o: %.d
+ $(DMD) $(DFLAGS) -c $^ -of$@
+%-debug.o: %.d
+ $(DMD) $(DebugFlags) -c $^ -of$@
+clean:
+ rm -f $(OBJECTS) $(DOBJECTS)
+distclean: clean
+ rm -f $(LIB){-debug,}.{so,a}