forked from jbd/httpfs2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
100 lines (68 loc) · 2.9 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
MAIN_CFLAGS := -g -Os -Wall $(shell pkg-config fuse --cflags)
MAIN_CPPFLAGS := -Wall -Wno-unused-function -Wconversion -Wtype-limits -DUSE_AUTH -D_XOPEN_SOURCE=700 -D_ISOC99_SOURCE
THR_CPPFLAGS := -DUSE_THREAD
THR_LDFLAGS := -lpthread
MAIN_LDFLAGS := $(shell pkg-config fuse --libs | sed -e s/-lrt// -e s/-ldl// -e s/-pthread// -e "s/ / /g")
variants := -mt
intermediates =
ifeq ($(shell pkg-config --atleast-version 2.10 gnutls ; echo $$?), 0)
variants += -ssl -ssl-mt
CERT_STORE := /etc/ssl/certs/ca-certificates.crt
SSL_CPPFLAGS := -DUSE_SSL $(shell pkg-config gnutls --cflags) -DCERT_STORE=\"$(CERT_STORE)\"
SSL_LDFLAGS := $(shell pkg-config gnutls --libs)
endif
binbase = httpfs2
binaries = $(addsuffix $(binsuffix),$(binbase))
manpages = $(addsuffix .1,$(binaries))
intermediates += $(addsuffix .xml,$(manpages))
targets = $(binaries) $(manpages)
full:
$(MAKE) all $(addprefix all,$(variants))
all: $(targets)
httpfs2$(binsuffix): httpfs2.c
$(CC) $(MAIN_CPPFLAGS) $(CPPFLAGS) $(MAIN_CFLAGS) $(CFLAGS) httpfs2.c $(MAIN_LDFLAGS) $(LDFLAGS) -o $@
httpfs2%.1: httpfs2.1
ln -sf httpfs2.1 $@
clean: clean-recursive-full
clean-recursive:
rm -f $(targets) $(intermediates)
%-full:
$(MAKE) $* $(addprefix $*,$(variants))
%.1: %.1.txt
a2x -f manpage $<
%-ssl: $*
$(MAKE) CPPFLAGS='$(CPPFLAGS) $(SSL_CPPFLAGS)' LDFLAGS='$(LDFLAGS) $(SSL_LDFLAGS)' binsuffix=-ssl$(binsuffix) $*
%-mt: $*
$(MAKE) CPPFLAGS='$(CPPFLAGS) $(THR_CPPFLAGS)' LDFLAGS='$(LDFLAGS) $(THR_LDFLAGS)' binsuffix=-mt$(binsuffix) $*
%-lstr: $*
$(MAKE) CPPFLAGS='$(CPPFLAGS) -DNEED_STRNDUP -U_XOPEN_SOURCE -D_XOPEN_SOURCE=500' binsuffix=-lstr$(binsuffix) $*
%-rst: $*
$(MAKE) CPPFLAGS='$(CPPFLAGS) -DRETRY_ON_RESET' binsuffix=-rst$(binsuffix) $*
# Rules to automatically make a Debian package
package = $(shell dpkg-parsechangelog | grep ^Source: | sed -e s,'^Source: ',,)
version = $(shell dpkg-parsechangelog | grep ^Version: | sed -e s,'^Version: ',, -e 's,-.*,,')
revision = $(shell dpkg-parsechangelog | grep ^Version: | sed -e -e 's,.*-,,')
architecture = $(shell dpkg --print-architecture)
tar_dir = $(package)-$(version)
tar_gz = $(tar_dir).tar.gz
pkg_deb_dir = pkgdeb
unpack_dir = $(pkg_deb_dir)/$(tar_dir)
orig_tar_gz = $(pkg_deb_dir)/$(package)_$(version).orig.tar.gz
pkg_deb_src = $(pkg_deb_dir)/$(package)_$(version)-$(revision)_source.changes
pkg_deb_bin = $(pkg_deb_dir)/$(package)_$(version)-$(revision)_$(architecture).changes
deb_pkg_key = CB8C5858
debclean:
rm -rf $(pkg_deb_dir)
deb: debsrc debbin
debbin: $(unpack_dir)
cd $(unpack_dir) && dpkg-buildpackage -b -k$(deb_pkg_key)
debsrc: $(unpack_dir)
cd $(unpack_dir) && dpkg-buildpackage -S -k$(deb_pkg_key)
$(unpack_dir): $(orig_tar_gz)
tar -zxf $(orig_tar_gz) -C $(pkg_deb_dir)
$(pkg_deb_dir):
mkdir $(pkg_deb_dir)
$(pkg_deb_dir)/$(tar_gz): $(pkg_deb_dir)
hg archive -t tgz $(pkg_deb_dir)/$(tar_gz)
$(orig_tar_gz): $(pkg_deb_dir)/$(tar_gz)
ln -s $(tar_gz) $(orig_tar_gz)