aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Makefile
blob: 80b7bb7d5f0aeeb0e242b9729919d5c0bb073ebe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
LIBS = sword minizip
override CXXFLAGS += -MMD -Wall -std=c++20 -fPIC `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.$(soname_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)