blob: f497ff42d2a4959368f2ab9fed87c1e03792ee3c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
CC=g++
LIBS=sword minizip
CFLAGS=-c -Wall -fPIC -std=c++17
LDFLAGS=-lstdc++fs
SOURCES=libbible.cc mods.cc settings.cc
OBJECTS=$(SOURCES:.cc=.o)
LIBRARY=libbible.so
EXECUTABLE=bible
ifeq ($(PREFIX),)
PREFIX := /usr
endif
all: $(SOURCES) $(LIBRARY) $(EXECUTABLE)
install: $(LIBRARY) $(EXECUTABLE)
install -d $(DESTDIR)$(PREFIX)/lib/
install -m 644 $(LIBRARY) $(DESTDIR)$(PREFIX)/lib/
install -d $(DESTDIR)$(PREFIX)/include/
install -m 644 libbible.h $(DESTDIR)$(PREFIX)/include/
install -d $(DESTDIR)$(PREFIX)/bin/
install -m 755 bible $(DESTDIR)$(PREFIX)/bin/
test: $(OBJECTS) testLibbible.o
$(CC) $(OBJECTS) testLibbible.o -o $@ $(LDFLAGS) `pkg-config $(LIBS) --libs` -lcppunit
testLibbible.o: testLibbible.cc
$(CC) $(CFLAGS) testLibbible.cc -o $@
bible: $(OBJECTS) bible.o
$(CC) $(OBJECTS) bible.o -o $@ $(LDFLAGS) `pkg-config $(LIBS) --libs`
bible.o: bible.cc
$(CC) $(CFLAGS) bible.cc -o $@
$(LIBRARY): $(OBJECTS)
$(CC) $(OBJECTS) -shared -o $@ $(LDFLAGS) `pkg-config $(LIBS) --libs`
.cc.o:
$(CC) $(CFLAGS) $< -o $@ `pkg-config $(LIBS) --cflags`
clean:
rm -rf *.o $(LIBRARY) test bible
|