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