-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
97 lines (74 loc) · 2.02 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
DEST=fuse-zip
prefix=/usr/local
exec_prefix=$(prefix)
bindir=$(exec_prefix)/bin
datarootdir=$(prefix)/share
docdir=$(datarootdir)/doc/$(DEST)
mandir=$(datarootdir)/man
man1dir=$(mandir)/man1
manext=.1
LIBS=-Llib -lfusezip $(shell pkg-config fuse --libs) $(shell pkg-config libzip --libs)
LIB=lib/libfusezip.a
CXXFLAGS=-g -O0 -Wall -Wextra
RELEASE_CXXFLAGS=-O2 -Wall -Wextra
FUSEFLAGS=$(shell pkg-config fuse --cflags)
ZIPFLAGS=$(shell pkg-config libzip --cflags)
SOURCES=main.cpp
OBJECTS=$(SOURCES:.cpp=.o)
MANSRC=fuse-zip.1
MAN=fuse-zip$(manext).gz
CLEANFILES=$(OBJECTS) $(MAN)
DOCFILES=README changelog
INSTALL=install
INSTALL_PROGRAM=$(INSTALL)
INSTALL_DATA=$(INSTALL) -m 644
all: $(DEST)
doc: $(MAN)
doc-clean: man-clean
$(DEST): $(OBJECTS) $(LIB)
$(CXX) $(OBJECTS) $(LDFLAGS) $(LIBS) \
-o $@
# main.cpp must be compiled separately with FUSEFLAGS
main.o: main.cpp
$(CXX) -c $(CXXFLAGS) $(FUSEFLAGS) $(ZIPFLAGS) $< \
-Ilib \
-o $@
$(LIB):
$(MAKE) -C lib
lib-clean:
$(MAKE) -C lib clean
distclean: clean doc-clean
rm -f $(DEST)
clean: lib-clean all-clean check-clean tarball-clean
all-clean:
rm -f $(CLEANFILES)
$(MAN): $(MANSRC)
gzip -c9 $< > $@
man-clean:
rm -f $(MANSRC).gz
install: all doc
mkdir -p "$(DESTDIR)$(bindir)/"
$(INSTALL_PROGRAM) "$(DEST)" "$(DESTDIR)$(bindir)/"
mkdir -p "$(DESTDIR)$(docdir)/"
$(INSTALL_DATA) $(DOCFILES) "$(DESTDIR)$(docdir)/"
mkdir -p "$(DESTDIR)$(man1dir)/"
$(INSTALL_DATA) $(MAN) "$(DESTDIR)$(man1dir)/"
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
uninstall:
rm "$(DESTDIR)$(bindir)/$(DEST)"
rm -r "$(DESTDIR)$(docdir)"
rm "$(DESTDIR)$(man1dir)/$(MAN)"
dist:
./makeArchives.sh
tarball-clean:
rm -f fuse-zip-*.tar.gz fuse-zip-tests-*.tar.gz
release:
$(MAKE) CXXFLAGS="$(RELEASE_CXXFLAGS)" all doc
check: $(DEST)
$(MAKE) -C tests
check-clean:
$(MAKE) -C tests clean
valgrind:
$(MAKE) -C tests valgrind
.PHONY: all release doc clean all-clean lib-clean doc-clean check-clean tarball-clean distclean install uninstall dist check valgrind $(LIB)