aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile28
1 files changed, 15 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index b7eba21..b08ed50 100644
--- a/Makefile
+++ b/Makefile
@@ -1,32 +1,33 @@
-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)
+export version = 1.0.1
+override CXXFLAGS += -MMD -Wall -std=c++20
+override LDFLAGS += -Lsrc/lib -lbible
+SOURCES = $(wildcard src/*.cc)
OBJECTS = $(SOURCES:.cc=.o)
DEPS = $(OBJECTS:.o=.d)
EXECUTABLE = bible
-LIBRARY = libbible.so
prefix ?= /usr
exec_prefix ?= $(prefix)
libdir ?= $(exec_prefix)/lib
bindir ?= $(exec_prefix)/bin
includedir ?= $(prefix)/include
-$(EXECUTABLE): $(OBJECTS)
+$(EXECUTABLE): $(OBJECTS) libbible
$(CXX) $(OBJECTS) -o $@ $(LDFLAGS)
-include $(DEPS)
-$(LIBRARY): $(OBJECTS)
- $(CXX) $(OBJECTS) -shared -o $@ $(LDFLAGS)
+.PHONY: libbible
+libbible:
+ $(MAKE) -C src/lib
.PHONY: test
-test: $(LIBRARY)
+test: libbible
$(MAKE) -C src/test/ test
-install: $(LIBRARY) $(EXECUTABLE)
+install: libbible $(EXECUTABLE)
install -d $(DESTDIR)$(libdir)
- install -m 644 $(LIBRARY) $(DESTDIR)$(libdir)
+ install -m 644 src/lib/libbible.so $(DESTDIR)$(libdir)/libbible.so.$(version)
+ install -m 644 src/lib/libbible.a $(DESTDIR)$(libdir)
install -d $(DESTDIR)$(includedir)
install -m 644 src/lib/libbible.h $(DESTDIR)$(includedir)
install -d $(DESTDIR)$(bindir)
@@ -36,5 +37,6 @@ install: $(LIBRARY) $(EXECUTABLE)
.PHONY: clean
clean:
- $(RM) $(OBJECTS) $(DEPS) $(EXECUTABLE) $(LIBRARY) $(TEST)
- $(MAKE) -C src/test/ clean
+ $(RM) $(OBJECTS) $(DEPS) $(EXECUTABLE)
+ $(MAKE) -C src/test clean
+ $(MAKE) -C src/lib clean