-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (41 loc) · 1.03 KB
/
Makefile
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
.PHONY: clean install
CXX?=g++
CFLAGS+=-Wall -g -O2 -fPIC -D_GNU_SOURCE --std=c++17
LDFLAGS+=-shared
ifneq ($(DDB_IPC_LOGLEVEL),)
CFLAGS+=-DDDB_IPC_LOGLEVEL=$(DDB_IPC_LOGLEVEL)
endif
export CXX CFLAGS
BUILDDIR=build
SRCDIR=src
SOCK=/tmp/ddb_socket
OUT=$(BUILDDIR)/ddb_ipc.so
SOURCES?=$(wildcard $(SRCDIR)/*.cpp)
TESTSOURCES?=$(wildcard $(TESTDIR)/*.cpp)
COMMON=
SUBOBJ=cpp-base64/base64.o
OBJ=$(patsubst $(SRCDIR)/%.cpp, $(BUILDDIR)/%.lo, $(SOURCES))
ifneq ($(SUBOBJ),)
OBJ+=$(addprefix submodules,/$(SUBOBJ))
endif
all: $(OUT)
install: $(OUT)
cp -t ~/.local/lib/deadbeef $(OUT)
$(BUILDDIR)/%.lo: $(SRCDIR)/%.cpp $(SRCDIR)/%.hpp $(COMMON)
$(CXX) $(CFLAGS) $< -c -o $@
$(BUILDDIR)/%.lo: submodules/%.o
cp $< $@
$(BUILDDIR)/%.lo: submodules/%.lo
cp $< $@
submodules/%.lo:
$(MAKE) -C $(dir $@) $(notdir $@)
submodules/%.o:
echo $(SUBOBJ) $@
$(MAKE) -C $(dir $@) $(notdir $@)
$(OUT): $(OBJ)
$(CXX) $(CFLAGS) $(LDFLAGS) $(OBJ) -o $@
$(BUILDDIR):
mkdir -p $(BUILDDIR)
clean:
rm $(BUILDDIR)/*.so $(BUILDDIR)/*.lo
rm -f $(SOCK)