-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
112 lines (94 loc) · 2.06 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
APP = vfs_rar
DEBUG ?= 0
OBJDIR = .objs
DEPDIR = .deps
UNRARDIR = unrar
CXX ?= g++
CXXFLAGS += -fPIC
CXXFLAGS += -Wall \
-Wno-parentheses \
-Wno-switch \
-Wno-sign-compare \
-Wno-unused-variable -Wno-unused-function \
-Wno-maybe-uninitialized
CXXFLAGS += -I. -I./unrar
CXXFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP
ifeq ($(DEBUG),1)
CXXFLAGS += -g -DDEBUG
endif
LDFLAGS = -pthread
ifeq ($(OS),Windows_NT)
LDFLAGS += -lpowrprof
endif
BIN = $(APP).so
UNRAR_OBJS = filestr.o recvol.o rs.o scantree.o qopen.o
UNRAR_OBJS += strlist.o \
strfn.o \
pathfn.o \
smallfn.o \
global.o \
file.o \
filefn.o \
filcreat.o \
archive.o \
arcread.o \
unicode.o \
system.o \
isnt.o \
crypt.o \
crc.o \
rawread.o \
encname.o \
resource.o \
match.o \
timefn.o \
rdwrfn.o \
consio.o \
options.o \
errhnd.o \
rarvm.o \
secpassword.o \
rijndael.o \
getbits.o \
sha1.o \
sha256.o \
blake2s.o \
hash.o \
extinfo.o \
extract.o \
volume.o \
list.o \
find.o \
unpack.o \
headers.o \
threadpool.o \
rs16.o \
cmddata.o \
ui.o
OBJS = $(UNRAR_OBJS) $(APP).o
vpath %.cpp $(UNRARDIR)
vpath %.hpp $(UNRARDIR)
.PHONY: all
all: $(BIN)
$(BIN): $(addprefix $(OBJDIR)/,$(OBJS))
$(CXX) -shared $(CXXFLAGS) -o $@ $^ $(CXX_LDFLAGS) $(LDFLAGS)
vpath %.o $(OBJDIR)
$(OBJDIR)/%.o: %.cpp | $(OBJDIR)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -c $< -o $@
$(OBJDIR):
-mkdir -p $@
vpath %.d $(DEPDIR)
$(DEPDIR)/%.d: %.cpp | $(DEPDIR)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -c -MM $< > $@
sed -i 's,\($*\)\.o[ :]*,\1.o $*.d: ,g' $@
$(DEPDIR):
-mkdir -p $@
-include $(addprefix $(DEPDIR)/,$(OBJS:.o=.d))
.PHONY: install uninstall clean
install: $(BIN)
-mkdir -p ~/.local/lib/deadbeef
-cp $(BIN) ~/.local/lib/deadbeef
uninstall:
-rm -rf ~/.local/lib/deadbeef/$(BIN)
clean:
-rm -rf $(BIN) $(OBJDIR) $(DEPDIR)