From 2224cc3a999db3e582cfc140ec176818d3a50c68 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 22 Feb 2022 11:55:42 -0500 Subject: Added soname to library --- src/lib/Makefile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/lib/Makefile (limited to 'src/lib/Makefile') diff --git a/src/lib/Makefile b/src/lib/Makefile new file mode 100644 index 0000000..6b3b506 --- /dev/null +++ b/src/lib/Makefile @@ -0,0 +1,23 @@ +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 *.cc) +OBJECTS = $(SOURCES:.cc=.o) +DEPS = $(OBJECTS:.o=.d) +LIBRARY = libbible +SONAME = $(LIBRARY).so.$(word 1, $(subst ., , $(version))) +LIBRARY_STATIC = $(LIBRARY).a +LIBRARY_SHARED = $(LIBRARY).so + +.PHONY: all +all: $(LIBRARY_SHARED) $(LIBRARY_STATIC) + +$(LIBRARY_SHARED): $(OBJECTS) + $(CXX) $^ -shared -Wl,-soname,$(SONAME) -o $@ $(LDFLAGS) + +$(LIBRARY_STATIC): $(OBJECTS) + $(AR) rcs $@ $^ + +.PHONY: clean +clean: + $(RM) $(OBJECTS) $(DEPS) $(LIBRARY_SHARED) $(LIBRARY_STATIC) -- cgit v1.2.3