aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile39
1 files changed, 39 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..61957d7
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,39 @@
+CC=g++
+LIBS=sword
+CFLAGS=-c -Wall -fPIC
+LDFLAGS=
+SOURCES=libbible.cc mods.cc settings.cc
+OBJECTS=$(SOURCES:.cc=.o)
+LIBRARY=libbible.so
+ifeq ($(PREFIX),)
+ PREFIX := /usr
+endif
+
+all: $(SOURCES) $(LIBRARY)
+
+install: $(LIBRARY)
+ install -d $(DESTDIR)$(PREFIX)/lib/
+ install -m 644 $(LIBRARY) $(DESTDIR)$(PREFIX)/lib/
+ install -d $(DESTDIR)$(PREFIX)/include/
+ install -m 644 libbible.h $(DESTDIR)$(PREFIX)/include/
+
+test: $(OBJECTS) testLibbible.o
+ $(CC) $(LDFLAGS) $(OBJECTS) testLibbible.o -o $@ `pkg-config $(LIBS) --libs` -lcppunit
+
+testLibbible.o: testLibbible.cc
+ $(CC) $(CFLAGS) testLibbible.cc -o $@
+
+bible: $(OBJECTS) bible.o
+ $(CC) $(LDFLAGS) $(OBJECTS) bible.o -o $@ `pkg-config $(LIBS) --libs`
+
+bible.o: bible.cc
+ $(CC) $(CFLAGS) bible.cc -o $@
+
+$(LIBRARY): $(OBJECTS)
+ $(CC) $(LDFLAGS) $(OBJECTS) -shared -o $@ `pkg-config $(LIBS) --libs`
+
+.cc.o:
+ $(CC) $(CFLAGS) $< -o $@ `pkg-config $(LIBS) --cflags`
+
+clean:
+ rm -rf *.o $(LIBRARY) test bible