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 EXEC_PREFIX ?= $(PREFIX) LIBDIR ?= $(EXEC_PREFIX)/lib BINDIR ?= $(EXEC_PREFIX)/bin INCLUDEDIR ?= $(PREFIX)/include $(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)$(LIBDIR) install -m 644 $(LIBRARY) $(DESTDIR)$(LIBDIR) install -d $(DESTDIR)$(INCLUDEDIR) install -m 644 src/lib/libbible.h $(DESTDIR)$(INCLUDEDIR) install -d $(DESTDIR)$(BINDIR) install -m 755 $(EXECUTABLE) $(DESTDIR)$(BINDIR) install -d $(DESTDIR)`pkg-config --variable=completionsdir bash-completion` install -m 644 bible.bash $(DESTDIR)`pkg-config --variable=completionsdir bash-completion`/$(EXECUTABLE) .PHONY: clean clean: $(RM) $(OBJECTS) $(DEPS) $(EXECUTABLE) $(LIBRARY) $(TEST) $(MAKE) -C src/test/ clean