forked from google/mount-zip
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (68 loc) · 2.13 KB
/
Makefile
File metadata and controls
85 lines (68 loc) · 2.13 KB
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
# Copyright 2021 Google LLC
# Copyright 2008-2021 Alexander Galanin <al@galanin.nnov.ru>
# http://galanin.nnov.ru/~al
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
DEST = mount-zip
PREFIX = $(DESTDIR)/usr
BINDIR = $(PREFIX)/bin
PKG_CONFIG ?= pkg-config
DEPS = fuse libzip icu-uc icu-i18n
LDFLAGS += -Llib -lmountzip
LDFLAGS += $(shell $(PKG_CONFIG) --libs $(DEPS))
CXXFLAGS += $(shell $(PKG_CONFIG) --cflags $(DEPS))
CXXFLAGS += -Wall -Wextra -Wno-sign-compare -Wno-missing-field-initializers -pedantic -std=c++20
ifeq ($(DEBUG), 1)
CXXFLAGS += -O0 -g
else
CXXFLAGS += -O2 -DNDEBUG
endif
LIB = lib/libmountzip.a
SOURCES = main.cc
OBJECTS = $(SOURCES:.cc=.o)
MAN = $(DEST).1
MANDIR = $(PREFIX)/share/man/man1
CLEANFILES = $(OBJECTS) $(DEST)
INSTALL = install
all: $(DEST)
doc: $(MAN)
man -l $(MAN)
$(DEST): $(OBJECTS) $(LIB)
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
main.o: main.cc
$(CXX) -Ilib -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
$(LIB):
$(MAKE) -C lib
lib-clean:
$(MAKE) -C lib clean
check-clean:
$(MAKE) -C tests clean
clean: lib-clean all-clean check-clean
all-clean:
rm -f $(CLEANFILES)
$(MAN): README.md
pandoc $< -s -t man -o $@
install: $(DEST)
$(INSTALL) -D "$(DEST)" "$(BINDIR)/$(DEST)"
$(INSTALL) -D -m 644 $(MAN) "$(MANDIR)/$(MAN)"
install-strip: $(DEST)
$(INSTALL) -D -s "$(DEST)" "$(BINDIR)/$(DEST)"
$(INSTALL) -D -m 644 $(MAN) "$(MANDIR)/$(MAN)"
uninstall:
rm "$(BINDIR)/$(DEST)" "$(MANDIR)/$(MAN)"
debug:
$(MAKE) DEBUG=1 all
check: debug
$(MAKE) -C tests
.PHONY: all doc debug clean all-clean lib-clean check-clean install uninstall check $(LIB)