aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorYour Name <you@example.com>2020-11-05 15:50:11 -0500
committerYour Name <you@example.com>2020-11-05 15:50:11 -0500
commit2fe897e2cf750339a7e466aeafe64f45fb650f10 (patch)
treed27bbda7c1ef5368a90704843deea014e6c810de /Makefile
downloadlibbible-2fe897e2cf750339a7e466aeafe64f45fb650f10.tar.gz
libbible-2fe897e2cf750339a7e466aeafe64f45fb650f10.tar.bz2
libbible-2fe897e2cf750339a7e466aeafe64f45fb650f10.zip
Initial commit
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