aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYour Name <you@example.com>2022-02-18 20:35:38 -0500
committerYour Name <you@example.com>2022-02-18 20:35:38 -0500
commit55d58a16e2511741cc625e203205dec86144faf3 (patch)
tree311be7e5fbaf1bc8ece47dd4261af053f2da1c7c
parentaa9dabdeaead3c8b1b11f9d4f321265c439bfbfc (diff)
downloadlibbible-55d58a16e2511741cc625e203205dec86144faf3.tar.gz
libbible-55d58a16e2511741cc625e203205dec86144faf3.tar.bz2
libbible-55d58a16e2511741cc625e203205dec86144faf3.zip
Reorganized repository layout
-rw-r--r--Makefile58
-rw-r--r--src/bible.cc (renamed from bible.cc)2
-rw-r--r--src/lib/libbible.cc (renamed from libbible.cc)0
-rw-r--r--src/lib/libbible.h (renamed from libbible.h)0
-rw-r--r--src/lib/mods.cc (renamed from mods.cc)0
-rw-r--r--src/lib/settings.cc (renamed from settings.cc)0
-rw-r--r--src/test/Makefile20
-rw-r--r--src/test/modules/JPS.zip (renamed from modules/JPS.zip)bin1170889 -> 1170889 bytes
-rw-r--r--src/test/modules/KJV.zip (renamed from modules/KJV.zip)bin4061008 -> 4061008 bytes
-rw-r--r--src/test/testLibbible.cc (renamed from testLibbible.cc)0
-rw-r--r--src/utf8.h (renamed from utf8.h)0
-rw-r--r--src/utf8/checked.h (renamed from utf8/checked.h)0
-rw-r--r--src/utf8/core.h (renamed from utf8/core.h)0
-rw-r--r--src/utf8/unchecked.h (renamed from utf8/unchecked.h)0
14 files changed, 46 insertions, 34 deletions
diff --git a/Makefile b/Makefile
index 6b367f8..40d2712 100644
--- a/Makefile
+++ b/Makefile
@@ -1,44 +1,36 @@
-CC=g++
-LIBS=sword minizip
-CFLAGS=-c -Wall -fPIC -std=c++20
-LDLIBS=-lstdc++fs
-SOURCES=libbible.cc mods.cc settings.cc
-OBJECTS=$(SOURCES:.cc=.o)
-LIBRARY=libbible.so
-EXECUTABLE=bible
-ifeq ($(PREFIX),)
- PREFIX := /usr
-endif
+LIBS = sword minizip
+override CXXFLAGS += -MMD -Wall -fPIC -std=c++20 `pkg-config $(LIBS) --cflags`
+override LDFLAGS += -lstdc++fs `pkg-config $(LIBS) --libs`
+SOURCES = $(wildcard src/*.cc) $(wildcard src/lib/*.cc)
+OBJECTS = $(SOURCES:.cc=.o)
+DEPS = $(OBJECTS:.o=.d)
+EXECUTABLE = bible
+LIBRARY = libbible.so
+PREFIX := /usr
-all: $(SOURCES) $(LIBRARY) $(EXECUTABLE)
+$(EXECUTABLE): $(OBJECTS)
+ $(CXX) $(OBJECTS) -o $@ $(LDFLAGS)
+
+-include $(DEPS)
+
+$(LIBRARY): $(OBJECTS)
+ $(CXX) $(OBJECTS) -shared -o $@ $(LDFLAGS)
+
+.PHONY: test
+test: $(LIBRARY)
+ $(MAKE) -C src/test/ test
install: $(LIBRARY) $(EXECUTABLE)
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/
+ install -m 644 src/lib/libbible.h $(DESTDIR)$(PREFIX)/include/
install -d $(DESTDIR)$(PREFIX)/bin/
- install -m 755 bible $(DESTDIR)$(PREFIX)/bin/
+ install -m 755 $(EXECUTABLE) $(DESTDIR)$(PREFIX)/bin/
install -d $(DESTDIR)`pkg-config --variable=completionsdir bash-completion`
install -m 644 bible.bash $(DESTDIR)`pkg-config --variable=completionsdir bash-completion`/$(EXECUTABLE)
-test: $(OBJECTS) testLibbible.o
- $(CC) $(OBJECTS) testLibbible.o -o $@ $(LDFLAGS) `pkg-config $(LIBS) --libs` -lcppunit
-
-testLibbible.o: testLibbible.cc
- $(CC) $(CFLAGS) testLibbible.cc -o $@
-
-bible: $(OBJECTS) bible.o
- $(CC) $(OBJECTS) bible.o -o $@ $(LDFLAGS) `pkg-config $(LIBS) --libs` $(LDLIBS)
-
-bible.o: bible.cc
- $(CC) $(CFLAGS) bible.cc -o $@
-
-$(LIBRARY): $(OBJECTS)
- $(CC) $(OBJECTS) -shared -o $@ $(LDFLAGS) `pkg-config $(LIBS) --libs` $(LDLIBS)
-
-.cc.o:
- $(CC) $(CFLAGS) $< -o $@ `pkg-config $(LIBS) --cflags`
-
+.PHONY: clean
clean:
- rm -rf *.o $(LIBRARY) test bible
+ $(RM) $(OBJECTS) $(DEPS) $(EXECUTABLE) $(LIBRARY) $(TEST)
+ $(MAKE) -C src/test/ clean
diff --git a/bible.cc b/src/bible.cc
index fe2c828..a09c0c0 100644
--- a/bible.cc
+++ b/src/bible.cc
@@ -1,4 +1,4 @@
-#include "libbible.h"
+#include "lib/libbible.h"
#include <string>
#include <sstream>
#include <algorithm>
diff --git a/libbible.cc b/src/lib/libbible.cc
index c9acb7d..c9acb7d 100644
--- a/libbible.cc
+++ b/src/lib/libbible.cc
diff --git a/libbible.h b/src/lib/libbible.h
index f77dc8c..f77dc8c 100644
--- a/libbible.h
+++ b/src/lib/libbible.h
diff --git a/mods.cc b/src/lib/mods.cc
index ab54e48..ab54e48 100644
--- a/mods.cc
+++ b/src/lib/mods.cc
diff --git a/settings.cc b/src/lib/settings.cc
index 848e22f..848e22f 100644
--- a/settings.cc
+++ b/src/lib/settings.cc
diff --git a/src/test/Makefile b/src/test/Makefile
new file mode 100644
index 0000000..1f8bc8b
--- /dev/null
+++ b/src/test/Makefile
@@ -0,0 +1,20 @@
+LIBS = sword minizip
+override CXXFLAGS += -MMD -Wall -fPIC -std=c++20 `pkg-config $(LIBS) --cflags`
+override LDFLAGS += -lstdc++fs `pkg-config $(LIBS) --libs` -lcppunit ../../libbible.so
+SOURCES = $(wildcard *.cc)
+OBJECTS = $(SOURCES:.cc=.o)
+DEPS = $(OBJECTS:.o=.d)
+TEST = testLibbible
+
+$(TEST): $(OBJECTS)
+ $(CXX) $(OBJECTS) -o $@ $(LDFLAGS)
+
+-include $(DEPS)
+
+.PHONY: test
+test: $(TEST)
+ ./$(TEST)
+
+.PHONY: clean
+clean:
+ $(RM) $(OBJECTS) $(DEPS) $(TEST)
diff --git a/modules/JPS.zip b/src/test/modules/JPS.zip
index 4f09ff8..4f09ff8 100644
--- a/modules/JPS.zip
+++ b/src/test/modules/JPS.zip
Binary files differ
diff --git a/modules/KJV.zip b/src/test/modules/KJV.zip
index 27c161d..27c161d 100644
--- a/modules/KJV.zip
+++ b/src/test/modules/KJV.zip
Binary files differ
diff --git a/testLibbible.cc b/src/test/testLibbible.cc
index d3a265a..d3a265a 100644
--- a/testLibbible.cc
+++ b/src/test/testLibbible.cc
diff --git a/utf8.h b/src/utf8.h
index 4e44514..4e44514 100644
--- a/utf8.h
+++ b/src/utf8.h
diff --git a/utf8/checked.h b/src/utf8/checked.h
index 1331155..1331155 100644
--- a/utf8/checked.h
+++ b/src/utf8/checked.h
diff --git a/utf8/core.h b/src/utf8/core.h
index 693d388..693d388 100644
--- a/utf8/core.h
+++ b/src/utf8/core.h
diff --git a/utf8/unchecked.h b/src/utf8/unchecked.h
index cb24271..cb24271 100644
--- a/utf8/unchecked.h
+++ b/src/utf8/unchecked.h