Log the rpc call name in the RPC errors message
[ganeti-local] / Makefile.am
1 # Ganeti makefile
2 # - Indent with tabs only.
3 # - Keep files sorted; one line per file.
4 # - Directories in lib/ must have their own *dir variable (see hypervisor).
5 # - All directories must be listed DIRS.
6 # - Use autogen.sh to generate Makefile.in and configure script.
7
8 # Automake doesn't export these variables before version 1.10.
9 abs_top_builddir = @abs_top_builddir@
10 abs_top_srcdir = @abs_top_srcdir@
11
12 ACLOCAL_AMFLAGS = -I autotools
13 DOCBOOK_WRAPPER = $(top_srcdir)/autotools/docbook-wrapper
14 BUILD_RAPI_RESOURCE_DOC = $(top_srcdir)/doc/build-rapi-resources-doc
15 REPLACE_VARS_SED = autotools/replace_vars.sed
16
17 hypervisordir = $(pkgpythondir)/hypervisor
18 httpdir = $(pkgpythondir)/http
19 rapidir = $(pkgpythondir)/rapi
20 toolsdir = $(pkglibdir)/tools
21 docdir = $(datadir)/doc/$(PACKAGE)
22
23 DIRS = \
24         autotools \
25         daemons \
26         devel \
27         doc \
28         doc/examples \
29         lib \
30         lib/http \
31         lib/hypervisor \
32         lib/rapi \
33         man \
34         qa \
35         scripts \
36         test \
37         test/data \
38         tools
39
40 CLEANFILES = \
41         autotools/replace_vars.sed \
42         devel/upload \
43         doc/*.html \
44         doc/*.in \
45         doc/*.pdf \
46         $(patsubst %.dot,%.png,$(docdot)) \
47         doc/rapi-resources.sgml \
48         doc/examples/ganeti.initd \
49         doc/examples/ganeti.cron \
50         lib/*.py[co] \
51         lib/http/*.py[co] \
52         lib/hypervisor/*.py[co] \
53         lib/rapi/*.py[co] \
54         man/*.[78] \
55         man/*.in \
56         qa/*.py[co] \
57         test/*.py[co] \
58         stamp-directories \
59         $(nodist_pkgpython_PYTHON)
60
61 nodist_pkgpython_PYTHON = \
62         lib/_autoconf.py
63
64 pkgpython_PYTHON = \
65         lib/__init__.py \
66         lib/backend.py \
67         lib/bdev.py \
68         lib/bootstrap.py \
69         lib/cli.py \
70         lib/cmdlib.py \
71         lib/config.py \
72         lib/constants.py \
73         lib/daemon.py \
74         lib/errors.py \
75         lib/jqueue.py \
76         lib/jstore.py \
77         lib/locking.py \
78         lib/luxi.py \
79         lib/mcpu.py \
80         lib/objects.py \
81         lib/opcodes.py \
82         lib/rpc.py \
83         lib/serializer.py \
84         lib/ssconf.py \
85         lib/ssh.py \
86         lib/utils.py \
87         lib/workerpool.py
88
89 hypervisor_PYTHON = \
90         lib/hypervisor/__init__.py \
91         lib/hypervisor/hv_base.py \
92         lib/hypervisor/hv_fake.py \
93         lib/hypervisor/hv_kvm.py \
94         lib/hypervisor/hv_xen.py
95
96 rapi_PYTHON = \
97         lib/rapi/__init__.py \
98         lib/rapi/baserlib.py \
99         lib/rapi/connector.py \
100         lib/rapi/rlib1.py \
101         lib/rapi/rlib2.py
102
103 http_PYTHON = \
104         lib/http/__init__.py \
105         lib/http/auth.py \
106         lib/http/client.py \
107         lib/http/server.py
108
109
110 docsgml = \
111         doc/hooks.sgml \
112         doc/install.sgml \
113         doc/admin.sgml \
114         doc/rapi.sgml \
115         doc/iallocator.sgml
116
117 docrst = \
118         doc/design-2.0.rst \
119         doc/security.rst
120
121 docdot = \
122         doc/arch-2.0.dot
123
124 doc_DATA = \
125         $(patsubst %.rst,%.html,$(docrst)) \
126         $(patsubst %.sgml,%.html,$(docsgml)) \
127         $(patsubst %.sgml,%.pdf,$(docsgml))
128
129 dist_sbin_SCRIPTS = \
130         daemons/ganeti-noded \
131         daemons/ganeti-watcher \
132         daemons/ganeti-masterd \
133         daemons/ganeti-rapi \
134         scripts/gnt-backup \
135         scripts/gnt-cluster \
136         scripts/gnt-debug \
137         scripts/gnt-instance \
138         scripts/gnt-job \
139         scripts/gnt-node \
140         scripts/gnt-os
141
142 dist_tools_SCRIPTS = \
143         tools/burnin \
144         tools/cfgshell \
145         tools/cfgupgrade \
146         tools/lvmstrap
147
148 EXTRA_DIST = \
149         NEWS \
150         DEVNOTES \
151         autotools/docbook-wrapper \
152         devel/upload.in \
153         $(docrst) \
154         $(docdot) \
155         $(docsgml) \
156         doc/build-rapi-resources-doc \
157         doc/examples/ganeti.initd.in \
158         doc/examples/ganeti.cron.in \
159         doc/examples/dumb-allocator \
160         doc/locking.txt \
161         test/testutils.py \
162         test/mocks.py \
163         $(dist_TESTS) \
164         $(TEST_FILES) \
165         man/footer.sgml \
166         $(mansgml) \
167         qa/ganeti-qa.py \
168         qa/qa-sample.json \
169         qa/qa_cluster.py \
170         qa/qa_config.py \
171         qa/qa_daemon.py \
172         qa/qa_env.py \
173         qa/qa_error.py \
174         qa/qa_instance.py \
175         qa/qa_node.py \
176         qa/qa_os.py \
177         qa/qa_rapi.py \
178         qa/qa_tags.py \
179         qa/qa_utils.py
180
181 man_MANS = \
182         man/ganeti.7 \
183         man/ganeti-noded.8 \
184         man/ganeti-os-interface.7 \
185         man/ganeti-watcher.8 \
186         man/gnt-backup.8 \
187         man/gnt-cluster.8 \
188         man/gnt-instance.8 \
189         man/gnt-node.8 \
190         man/gnt-os.8
191
192 maninput = $(patsubst %.7,%.in,$(patsubst %.8,%.in,$(man_MANS)))
193 mansgml = $(patsubst %.in,%.sgml,$(maninput))
194
195 TEST_FILES = \
196         test/data/bdev-both.txt \
197         test/data/bdev-disk.txt \
198         test/data/bdev-net.txt \
199         test/data/proc_drbd8.txt
200
201 dist_TESTS = \
202         test/ganeti.bdev_unittest.py \
203         test/ganeti.cli_unittest.py \
204         test/ganeti.cmdlib_unittest.py \
205         test/ganeti.config_unittest.py \
206         test/ganeti.constants_unittest.py \
207         test/ganeti.hooks_unittest.py \
208         test/ganeti.http_unittest.py \
209         test/ganeti.locking_unittest.py \
210         test/ganeti.rapi.resources_unittest.py \
211         test/ganeti.serializer_unittest.py \
212         test/ganeti.ssh_unittest.py \
213         test/ganeti.utils_unittest.py \
214         test/ganeti.workerpool_unittest.py
215
216 nodist_TESTS =
217
218 TESTS = $(dist_TESTS) $(nodist_TESTS)
219
220 TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir)
221
222
223 all-local: stamp-directories lib/_autoconf.py devel/upload \
224         doc/examples/ganeti.initd doc/examples/ganeti.cron
225
226 devel/upload: devel/upload.in stamp-directories $(REPLACE_VARS_SED)
227         sed -f $(REPLACE_VARS_SED) < $< > $@
228         chmod u+x $@
229
230 doc/examples/ganeti.%: doc/examples/ganeti.%.in stamp-directories \
231                 $(REPLACE_VARS_SED)
232         sed -f $(REPLACE_VARS_SED) < $< > $@
233
234 doc/%.in: doc/%.sgml stamp-directories $(REPLACE_VARS_SED)
235         sed -f $(REPLACE_VARS_SED) < $< > $@
236
237 man/%.in: man/%.sgml stamp-directories $(REPLACE_VARS_SED)
238         sed -f $(REPLACE_VARS_SED) < $< > $@
239
240 doc/%.pdf: doc/%.in $(DOCBOOK_WRAPPER)
241         $(DOCBOOK_WRAPPER) "$(DOCBOOK2PDF)" $< $@
242
243 doc/%.html: doc/%.in $(DOCBOOK_WRAPPER)
244         $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $@
245
246 doc/%.html: doc/%.rst
247         $(RST2HTML) $< $@
248
249 doc/%.png: doc/%.dot
250         $(DOT) -Tpng -o $@ $<
251
252 doc/design-2.0.html: doc/design-2.0.rst doc/arch-2.0.png
253
254 doc/rapi.pdf doc/rapi.html doc/rapi.in: doc/rapi-resources.sgml
255
256 doc/rapi-resources.sgml: $(BUILD_RAPI_RESOURCE_DOC) lib/rapi/connector.py
257         PYTHONPATH=.:$(top_builddir) $(BUILD_RAPI_RESOURCE_DOC) > $@ || rm -f $@
258
259 man/%.7: man/%.in man/footer.sgml $(DOCBOOK_WRAPPER)
260         $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $@
261
262 man/%.8: man/%.in man/footer.sgml $(DOCBOOK_WRAPPER)
263         $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $@
264
265 man/footer.sgml $(TESTS): srclinks
266
267 $(TESTS) $(BUILD_RAPI_RESOURCE_DOC): ganeti lib/_autoconf.py
268
269 lib/_autoconf.py: Makefile stamp-directories
270         set -e; \
271         { echo '# This file is automatically generated, do not edit!'; \
272           echo '#'; \
273           echo ''; \
274           echo '"""Build-time configuration for Ganeti.'; \
275           echo '';\
276           echo 'This file is autogenerated by the build process.'; \
277           echo 'For any changes you need to re-run ./configure (and'; \
278           echo 'not edit by hand).'; \
279           echo ''; \
280           echo '"""'; \
281           echo ''; \
282           echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
283           echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
284           echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
285           echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
286           echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
287           echo "VERSION_FULL = '$(VERSION_FULL)'"; \
288           echo "LOCALSTATEDIR = '$(localstatedir)'"; \
289           echo "SYSCONFDIR = '$(sysconfdir)'"; \
290           echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
291           echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
292           echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
293           echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
294           echo "XEN_INITRD = '$(XEN_INITRD)'"; \
295           echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
296           echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
297           echo "KVM_PATH = '$(KVM_PATH)'"; \
298           echo "SOCAT_PATH = '$(SOCAT_PATH)'"; \
299         } > $@
300
301 $(REPLACE_VARS_SED): Makefile stamp-directories
302         set -e; \
303         { echo 's#@PREFIX@#$(prefix)#g'; \
304           echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
305           echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
306           echo 's#@SBINDIR@#$(sbindir)#g'; \
307           echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
308           echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
309           echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
310           echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
311           echo '/@INCLUDE_RAPI_RESOURCES@/ {'; \
312           echo '  r $(abs_top_builddir)/doc/rapi-resources.sgml'; \
313           echo '  d'; \
314           echo '}'; \
315         } > $@
316
317 # We need to create symlinks because "make distcheck" will not install Python
318 # files when building.
319 #.PHONY: srclinks
320 srclinks: stamp-directories
321         set -e; \
322         for i in man/footer.sgml $(pkgpython_PYTHON) $(hypervisor_PYTHON) \
323                         $(rapi_PYTHON) $(http_PYTHON); do \
324                 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
325                         $(LN_S) $(abs_top_srcdir)/$$i $$i; \
326                 fi; \
327         done
328
329 .PHONY: ganeti
330 ganeti:
331         cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
332
333 # a dist hook rule for catching revision control directories
334 distcheck-hook:
335         if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
336                 echo "Found revision control files in final archive" 1>&2 ; \
337                 exit 1; \
338         fi
339
340 install-exec-local:
341         @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
342           "$(DESTDIR)${localstatedir}/log/ganeti" \
343           "$(DESTDIR)${localstatedir}/run/ganeti"
344
345 stamp-directories: Makefile
346         @mkdir_p@ $(DIRS)
347         touch $@
348
349 .PHONY: apidoc
350 apidoc:
351         test -e doc/api || mkdir doc/api
352         TMPDIR=`mktemp -d ` && { \
353                 cp -r scripts daemons lib $$TMPDIR && \
354                 ( \
355                         CDIR=`pwd` && \
356                         cd $$TMPDIR && \
357                         mv lib ganeti && \
358                         epydoc -v --conf $$CDIR/epydoc.conf -o $$CDIR/doc/api \
359                 ) ; \
360                 rm -rf $$TMPDIR ; \
361         }
362
363 # vim: set noet :