/
Makefile.am
167 lines (128 loc) · 3.8 KB
/
Makefile.am
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
SPEC = $(PACKAGE_NAME).spec
TARFILE = $(PACKAGE_NAME)-$(VERSION).tar.gz
EXTRA_DIST = autogen.sh
AUTOMAKE_OPTIONS = foreign
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \
config.guess config.sub missing install-sh \
autoheader automake autoconf config.status \
config.log compile ltmain.sh test-driver
sheepdogsysconfdir = ${SHEEPDOGCONFDIR}
sheepdogsysconf_DATA =
SUBDIRS = lib dog sheep include script tools
if BUILD_SHEPHERD
SUBDIRS += shepherd
endif
if BUILD_SHEEPFS
SUBDIRS += sheepfs
endif
SUBDIRS += man
if BUILD_UNITTEST
SUBDIRS += tests/unit
endif
install-exec-local:
$(INSTALL) -d $(DESTDIR)/${localstatedir}/lib/sheepdog
uninstall-local:
rmdir $(DESTDIR)/${localstatedir}/lib/sheepdog || :;
dist-clean-local:
rm -f autoconf automake autoheader
clean-generic:
rm -rf $(SPEC) $(TARFILE) cscope*
find -name '*.orig' -or -name '*.rej' | xargs rm -f
find -name '*.gcno' -or -name '*.gcda' | xargs rm -f
cscope:
@echo create cscope.out
@find -name '*.[chS]' > cscope.files
@cscope -bq
$(SPEC): $(SPEC).in
rm -f $@-t $@
LC_ALL=C date="$(shell date "+%a %b %d %Y")" && \
sed \
-e "s#@version@#$(VERSION)#g" \
-e "s#@date@#$$date#g" \
$< > $@-t
chmod a-w,u+w $@-t
mv $@-t $@
RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \
--define "_specdir $(abs_builddir)" \
--define "_builddir $(abs_builddir)" \
--define "_srcrpmdir $(abs_builddir)" \
--define "_rpmdir $(abs_builddir)"
if BUILD_ZOOKEEPER
RPMBUILDOPTS += --define "_have_zookeeper 1"
endif
if BUILD_COROSYNC
RPMBUILDOPTS += --define "_have_corosync 1"
endif
if BUILD_SHEPHERD
RPMBUILDOPTS += --define "_have_shepherd 1"
endif
if BUILD_SHEEPFS
RPMBUILDOPTS += --define "_have_fuse 1"
endif
if BUILD_HTTP
RPMBUILDOPTS += --define "_have_http 1"
endif
if BUILD_NFS
RPMBUILDOPTS += --define "_have_nfs 1"
endif
if BUILD_DISKVNODES
RPMBUILDOPTS += --define "_have_diskvnodes 1"
endif
if BUILD_LTTNG_UST
RPMBUILDOPTS += --define "_have_lttng_ust 1"
endif
if BUILD_ACCELIO
RPMBUILDOPTS += --define "_have_accelio 1"
endif
if BUILD_TRACE
RPMBUILDOPTS += --define "_have_trace 1"
endif
$(TARFILE):
$(MAKE) dist
srpm: clean
$(MAKE) $(SPEC) $(TARFILE)
rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)
rpm: clean
$(MAKE) $(SPEC) $(TARFILE)
rpmbuild $(RPMBUILDOPTS) -ba $(SPEC)
deb:
fakeroot ./debian/rules clean
@if [ -d .git ]; then \
git log > debian/CHANGELOG; \
else \
echo "This package doesn't contain CHANGELOG because it is build from raw source archive." > debian/CHANGELOG; \
fi
rm -f debian/changelog
dch -v $(shell echo $(PACKAGE_VERSION) | sed s/_/+/ | sed s/_/./g)-1 \
--package sheepdog --create 'Local build'
fakeroot ./debian/rules binary
CGCC=cgcc
CGCC_CFLAGS=-Wbitwise -Wno-return-void $(ARCH) -fno-common
sparse: ARCH=$(shell sh script/checkarch.sh)
sparse:
$(MAKE) CC=$(CGCC) CFLAGS="$(CFLAGS) $(CGCC_CFLAGS)"
CHECK_STYLE=../script/checkpatch.pl -f --no-summary --terse
check-style:
@for dir in lib dog sheep include sheepfs; do \
make -C $$dir check-style CHECK_STYLE="$(CHECK_STYLE)"; \
done
check-unused:
@find -name '*.o' -exec nm -o {} \; | grep -v '^./lib' | grep ' U ' | \
awk '{print $$3;}' | sort -u > /tmp/sd_used
@find -name '*.o' -exec nm -o {} \; | grep -v '^./lib' | grep ' T ' | \
awk '{print $$3;}' > /tmp/sd_defined
@while read func;do if ! grep -Fq $$func /tmp/sd_used;then \
echo $$func; fi; done < /tmp/sd_defined
if BUILD_COVERAGE
coverage: clean check
@rm -rf coverage
@for dir in dog sheep tests/unit/dog tests/unit/sheep ; do\
$(MAKE) -C $$dir coverage; \
done
@lcov -a dog/dog.info -a sheep/sheep.info \
-a tests/unit/dog/dog.info -a tests/unit/sheep/sheep.info \
-o sheep.info && \
lcov -r sheep.info /usr/include/\* -o sheep.info && \
lcov -r sheep.info tests/unit/\* -o sheep.info && \
genhtml sheep.info -o coverage
endif