diff options
author | Your Name <you@example.com> | 2022-02-22 11:55:42 -0500 |
---|---|---|
committer | Your Name <you@example.com> | 2022-02-22 11:55:42 -0500 |
commit | 2224cc3a999db3e582cfc140ec176818d3a50c68 (patch) | |
tree | e600098f90a82c0ce6896b9b1ec39d75d149a754 /src | |
parent | 2b6be2d144250dffb364d429c39a563e8430f14d (diff) | |
download | libbible-2224cc3a999db3e582cfc140ec176818d3a50c68.tar.gz libbible-2224cc3a999db3e582cfc140ec176818d3a50c68.tar.bz2 libbible-2224cc3a999db3e582cfc140ec176818d3a50c68.zip |
Added soname to library
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Makefile | 23 | ||||
-rw-r--r-- | src/test/Makefile | 6 |
2 files changed, 25 insertions, 4 deletions
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) diff --git a/src/test/Makefile b/src/test/Makefile index 1f8bc8b..422cc03 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -1,13 +1,11 @@ -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 +override LDFLAGS += -lcppunit ../lib/libbible.so SOURCES = $(wildcard *.cc) OBJECTS = $(SOURCES:.cc=.o) DEPS = $(OBJECTS:.o=.d) TEST = testLibbible $(TEST): $(OBJECTS) - $(CXX) $(OBJECTS) -o $@ $(LDFLAGS) + $(CXX) $^ -o $@ $(LDFLAGS) -include $(DEPS) |