forked from dxafn/fuse-zip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
85 lines (63 loc) · 1.83 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
DEST=vmas-fs
LIBS=-Llib -Wl,-Bstatic -lvmasfs $(shell pkg-config libzip --libs) -Wl,-Bdynamic $(shell pkg-config fuse --libs)
LIB=lib/libvmasfs.a
CXXFLAGS=-g -O0 -Wall -Wextra
RELEASE_CXXFLAGS=-O2 -Wall -Wextra
RELEASE_LDFLAGS=-static-libgcc -static-libstdc++
FUSEFLAGS=$(shell pkg-config fuse --cflags)
ZIPFLAGS=$(shell pkg-config libzip --cflags)
SOURCES=main.cpp
OBJECTS=$(SOURCES:.cpp=.o)
MANSRC=vmas-fs.1
MAN=vmas-fs.1.gz
CLEANFILES=$(OBJECTS) $(MAN)
DOCFILES=README changelog
INSTALLPREFIX=/usr
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 test-clean tarball-clean
all-clean:
rm -f $(CLEANFILES)
$(MAN): $(MANSRC)
gzip -c9 $< > $@
man-clean:
rm -f $(MANSRC).gz
install: release
mkdir -p "$(INSTALLPREFIX)/bin"
install -m 755 -s "$(DEST)" "$(INSTALLPREFIX)/bin"
mkdir -p "$(INSTALLPREFIX)/share/doc/$(DEST)"
cp $(DOCFILES) "$(INSTALLPREFIX)/share/doc/$(DEST)"
mkdir -p "$(INSTALLPREFIX)/share/man/man1"
cp $(MAN) "$(INSTALLPREFIX)/share/man/man1"
uninstall:
rm "$(INSTALLPREFIX)/bin/$(DEST)"
rm -r "$(INSTALLPREFIX)/share/doc/$(DEST)"
rm "$(INSTALLPREFIX)/share/man/man1/$(MAN)"
tarball:
./makeArchives.sh
tarball-clean:
rm -f vmas-fs-*.tar.gz vmas-fs-tests-*.tar.gz
release:
make CXXFLAGS="$(RELEASE_CXXFLAGS)" LDFLAGS="$(RELEASE_LDFLAGS)" all doc
test: $(DEST)
make -C tests
test-clean:
make -C tests clean
valgrind:
make -C tests valgrind
.PHONY: all release doc clean all-clean lib-clean doc-clean test-clean tarball-clean distclean install uninstall tarball test valgrind $(LIB)