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