-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
75 lines (52 loc) · 1.87 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
#!/usr/bin/make -f
#
NAME = livebtfs
VERSION = 7.4
BINDIR = $(DESTDIR)/usr/local/bin
MANDIR = $(DESTDIR)/usr/local/man/man1
EXEC = $(NAME) $(NAME)stat
SRC = src
MAN = man
CC = g++
MODE= -O3 -s -Wextra -pedantic -Wall # ////////// RELEASE
#MODE= -g -Wall -D_DEBUG # ////////// DEBUG
#MODE= -pg # ////////// PROFILER --> view with : gprof $(NAME)
EDITOR = geany
DEFS = -DPACKAGE=\"$(NAME)\" -DVERSION=\"$(VERSION)\"
FUSE_CFLAGS = -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse
LIBTORRENT_CFLAGS = -DTORRENT_DISABLE_LOGGING -DTORRENT_USE_OPENSSL -DTORRENT_LINKING_SHARED -I/usr/include/libtorrent
CFLAGS += $(FUSE_CFLAGS) $(LIBTORRENT_CFLAGS)
FUSE_LIBS = -lfuse -lpthread
LIBTORRENT_LIBS = -ltorrent-rasterbar
LIBCURL_LIBS = -lcurl
CRYPTO_LIBS = -lcrypto
LIBS = $(FUSE_LIBS) $(LIBTORRENT_LIBS) $(LIBCURL_LIBS) $(CRYPTO_LIBS)
EUID := $(shell id -u -r)
##############################
.PHONY: all clean build install man edit cppcheck zip
% : $(SRC)/%.cc $(SRC)/%.h Makefile
$(CC) $(MODE) $(CFLAGS) $(DEFS) -o $@ $< $(LDFLAGS) $(LIBS)
build : $(EXEC) man
$(MAN)/$(NAME).1.gz : $(MAN)/$(NAME).1
gzip -c $(MAN)/$(NAME).1 > $(MAN)/$(NAME).1.gz
man : $(MAN)/$(NAME).1.gz
all : clean build install
clean:
-rm -f *~ $(SRC)/*~ $(MAN)/*~
-rm -f $(EXEC) $(MAN)/$(NAME).1.gz $(NAME)-cppcheck.xml
edit:
$(EDITOR) $(SRC)/* [Mm]akefile README.md &
cppcheck:
cppcheck --verbose --enable=all --enable=style --xml $(CFLAGS) $(DEFS) -D_DEBUG $(SRC)/*.cc 2> $(NAME)-cppcheck.xml
zip:
tar czfvp $(NAME)_v$(VERSION).tgz [Mm]akefile $(SRC)/ $(MAN)/ scripts/ README.md LICENSE --transform="s+^+$(NAME)_v$(VERSION)/+"
install : $(EXEC) man
ifneq ($(EUID),0)
@echo "Please run 'make install' as root user"
@exit 1
endif
chmod +x $(EXEC)
# Install binaire :
mkdir -p $(BINDIR) && cp -p $(EXEC) $(BINDIR)
# Install mapage :
mkdir -p $(MANDIR) && cp $(MAN)/$(NAME).1.gz $(MANDIR)/$(NAME).1.gz