gnt-instance info: fix nic display
[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_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
15 RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
16 CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
17 REPLACE_VARS_SED = autotools/replace_vars.sed
18
19 hypervisordir = $(pkgpythondir)/hypervisor
20 httpdir = $(pkgpythondir)/http
21 confddir = $(pkgpythondir)/confd
22 rapidir = $(pkgpythondir)/rapi
23 toolsdir = $(pkglibdir)/tools
24 docdir = $(datadir)/doc/$(PACKAGE)
25
26 DIRS = \
27         autotools \
28         daemons \
29         devel \
30         doc \
31         doc/examples \
32         doc/examples/hooks \
33         lib \
34         lib/build \
35         lib/http \
36         lib/hypervisor \
37         lib/rapi \
38         lib/confd \
39         man \
40         qa \
41         scripts \
42         test \
43         test/data \
44         tools
45
46 MAINTAINERCLEANFILES = \
47         $(docpng) \
48         $(maninput)
49
50 maintainer-clean-local:
51         -rm -rf doc/api doc/build doc/html
52
53 CLEANFILES = \
54         autotools/replace_vars.sed \
55         daemons/ganeti-cleaner \
56         devel/upload \
57         doc/news.rst \
58         doc/examples/bash_completion \
59         doc/examples/ganeti.initd \
60         doc/examples/ganeti.cron \
61         doc/examples/hooks/ipsec \
62         lib/*.py[co] \
63         lib/build/*.py[co] \
64         lib/http/*.py[co] \
65         lib/hypervisor/*.py[co] \
66         lib/rapi/*.py[co] \
67         $(man_MANS) \
68         $(manhtml) \
69         qa/*.py[co] \
70         test/*.py[co] \
71         stamp-directories \
72         $(nodist_pkgpython_PYTHON)
73
74 BUILT_SOURCES = \
75         ganeti \
76         srclinks \
77         doc/news.rst \
78         lib/_autoconf.py
79
80 nodist_pkgpython_PYTHON = \
81         lib/_autoconf.py
82
83 noinst_PYTHON = \
84         lib/build/__init__.py
85
86 pkgpython_PYTHON = \
87         lib/__init__.py \
88         lib/asyncnotifier.py \
89         lib/backend.py \
90         lib/bdev.py \
91         lib/bootstrap.py \
92         lib/cli.py \
93         lib/cmdlib.py \
94         lib/config.py \
95         lib/constants.py \
96         lib/daemon.py \
97         lib/errors.py \
98         lib/jqueue.py \
99         lib/jstore.py \
100         lib/locking.py \
101         lib/luxi.py \
102         lib/mcpu.py \
103         lib/objects.py \
104         lib/opcodes.py \
105         lib/rpc.py \
106         lib/serializer.py \
107         lib/ssconf.py \
108         lib/ssh.py \
109         lib/storage.py \
110         lib/utils.py \
111         lib/workerpool.py
112
113 hypervisor_PYTHON = \
114         lib/hypervisor/__init__.py \
115         lib/hypervisor/hv_base.py \
116         lib/hypervisor/hv_chroot.py \
117         lib/hypervisor/hv_fake.py \
118         lib/hypervisor/hv_kvm.py \
119         lib/hypervisor/hv_xen.py
120
121 rapi_PYTHON = \
122         lib/rapi/__init__.py \
123         lib/rapi/baserlib.py \
124         lib/rapi/connector.py \
125         lib/rapi/rlib2.py
126
127 http_PYTHON = \
128         lib/http/__init__.py \
129         lib/http/auth.py \
130         lib/http/client.py \
131         lib/http/server.py
132
133 confd_PYTHON = \
134         lib/confd/__init__.py \
135         lib/confd/client.py \
136         lib/confd/server.py \
137         lib/confd/querylib.py
138
139 docrst = \
140         doc/admin.rst \
141         doc/design-2.0.rst \
142         doc/design-2.1.rst \
143         doc/devnotes.rst \
144         doc/glossary.rst \
145         doc/hooks.rst \
146         doc/iallocator.rst \
147         doc/index.rst \
148         doc/install.rst \
149         doc/locking.rst \
150         doc/rapi.rst \
151         doc/security.rst
152
153 doc/html: $(docrst) doc/news.rst $(docpng) doc/conf.py configure.ac
154         @test -n "$(SPHINX)" || \
155             { echo 'sphinx-build' not found during configure; exit 1; }
156         mkdir -p doc/build/doctrees
157         PYTHONPATH=.:$(top_builddir) sphinx-build -q -b html \
158             -d doc/build/doctrees \
159             -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
160             -D release="$(PACKAGE_VERSION)" \
161             $(top_srcdir)/doc doc/html
162         touch "$@"
163
164 docdot = \
165         doc/arch-2.0.dot
166
167 docpng = $(patsubst %.dot,%.png,$(docdot))
168
169 noinst_DATA = $(manhtml) doc/html
170
171 gnt_scripts = \
172         scripts/gnt-backup \
173         scripts/gnt-cluster \
174         scripts/gnt-debug \
175         scripts/gnt-instance \
176         scripts/gnt-job \
177         scripts/gnt-node \
178         scripts/gnt-os
179
180 dist_sbin_SCRIPTS = \
181         daemons/ganeti-noded \
182         daemons/ganeti-watcher \
183         daemons/ganeti-masterd \
184         daemons/ganeti-confd \
185         daemons/ganeti-rapi \
186         $(gnt_scripts)
187
188 nodist_sbin_SCRIPTS = \
189         daemons/ganeti-cleaner
190
191 dist_tools_SCRIPTS = \
192         tools/burnin \
193         tools/cfgshell \
194         tools/cfgupgrade \
195         tools/lvmstrap
196
197 EXTRA_DIST = \
198         $(MAINTAINERCLEANFILES) \
199         NEWS \
200         pylintrc \
201         autotools/build-bash-completion \
202         autotools/check-python-code \
203         autotools/docbook-wrapper \
204         autotools/run-in-tempdir \
205         daemons/ganeti-cleaner.in \
206         devel/upload.in \
207         $(docdot) \
208         $(docrst) \
209         doc/conf.py \
210         doc/html \
211         doc/examples/ganeti.initd.in \
212         doc/examples/ganeti.cron.in \
213         doc/examples/dumb-allocator \
214         doc/examples/hooks/ethers \
215         doc/examples/hooks/ipsec.in \
216         test/testutils.py \
217         test/mocks.py \
218         $(dist_TESTS) \
219         $(TEST_FILES) \
220         man/footer.sgml \
221         $(mansgml) $(maninput) \
222         qa/ganeti-qa.py \
223         qa/qa-sample.json \
224         qa/qa_cluster.py \
225         qa/qa_config.py \
226         qa/qa_daemon.py \
227         qa/qa_env.py \
228         qa/qa_error.py \
229         qa/qa_instance.py \
230         qa/qa_node.py \
231         qa/qa_os.py \
232         qa/qa_rapi.py \
233         qa/qa_tags.py \
234         qa/qa_utils.py
235
236 man_MANS = \
237         man/ganeti.7 \
238         man/ganeti-masterd.8 \
239         man/ganeti-noded.8 \
240         man/ganeti-os-interface.7 \
241         man/ganeti-rapi.8 \
242         man/ganeti-watcher.8 \
243         man/gnt-backup.8 \
244         man/gnt-cluster.8 \
245         man/gnt-debug.8 \
246         man/gnt-instance.8 \
247         man/gnt-job.8 \
248         man/gnt-node.8 \
249         man/gnt-os.8
250
251 mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
252 manhtml = $(patsubst %.sgml,%.html,$(mansgml))
253 maninput = $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) $(patsubst %.html,%.html.in,$(manhtml))
254
255 TEST_FILES = \
256         test/data/bdev-both.txt \
257         test/data/bdev-8.3-both.txt \
258         test/data/bdev-disk.txt \
259         test/data/bdev-net.txt \
260         test/data/proc_drbd8.txt \
261         test/data/proc_drbd83.txt
262
263 dist_TESTS = \
264         test/ganeti.bdev_unittest.py \
265         test/ganeti.cli_unittest.py \
266         test/ganeti.cmdlib_unittest.py \
267         test/ganeti.config_unittest.py \
268         test/ganeti.constants_unittest.py \
269         test/ganeti.hooks_unittest.py \
270         test/ganeti.http_unittest.py \
271         test/ganeti.locking_unittest.py \
272         test/ganeti.objects_unittest.py \
273         test/ganeti.rapi.resources_unittest.py \
274         test/ganeti.serializer_unittest.py \
275         test/ganeti.ssh_unittest.py \
276         test/ganeti.utils_unittest.py \
277         test/ganeti.workerpool_unittest.py \
278         test/docs_unittest.py
279
280 nodist_TESTS =
281
282 TESTS = $(dist_TESTS) $(nodist_TESTS)
283
284 TESTS_ENVIRONMENT = \
285         PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) \
286         $(RUN_IN_TEMPDIR) $(PYTHON)
287
288 all_python_code = \
289         $(dist_sbin_SCRIPTS) \
290         $(dist_tools_SCRIPTS) \
291         $(dist_TESTS) \
292         $(pkgpython_PYTHON) \
293         $(hypervisor_PYTHON) \
294         $(rapi_PYTHON) \
295         $(http_PYTHON) \
296         $(confd_PYTHON) \
297         $(noinst_PYTHON)
298
299 srclink_files = \
300         man/footer.sgml \
301         $(all_python_code)
302
303 check_python_code = \
304         $(all_python_code)
305
306 all-local: stamp-directories devel/upload \
307         doc/examples/bash_completion \
308         doc/examples/ganeti.initd doc/examples/ganeti.cron \
309         doc/examples/hooks/ipsec
310
311 devel/upload: devel/upload.in stamp-directories $(REPLACE_VARS_SED)
312         sed -f $(REPLACE_VARS_SED) < $< > $@
313         chmod u+x $@
314
315 daemons/ganeti-cleaner: daemons/ganeti-cleaner.in stamp-directories \
316                 $(REPLACE_VARS_SED)
317         sed -f $(REPLACE_VARS_SED) < $< > $@
318         chmod +x $@
319
320 doc/news.rst: NEWS
321         set -e; \
322         { echo '.. This file is automatically updated at build time from $<.'; \
323           echo '.. Do not edit.'; \
324                 echo; \
325           cat $<; \
326         } > $@
327
328 doc/examples/%: doc/examples/%.in stamp-directories \
329                 $(REPLACE_VARS_SED)
330         sed -f $(REPLACE_VARS_SED) < $< > $@
331
332 doc/examples/hooks/%: doc/examples/hooks/%.in stamp-directories \
333                 $(REPLACE_VARS_SED)
334         sed -f $(REPLACE_VARS_SED) < $< > $@
335
336 doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
337         lib/cli.py $(gnt_scripts) tools/burnin
338         PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
339
340 doc/%.png: doc/%.dot
341         @test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
342         $(DOT) -Tpng -o $@ $<
343
344 man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
345         @test -n "$(DOCBOOK2MAN)" || { echo 'docbook2man' not found during configure; exit 1; }
346         $(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
347
348 man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
349         @test -n "$(DOCBOOK2HTML)" || { echo 'docbook2html' not found during configure; exit 1; }
350         $(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
351
352 man/%.7: man/%.7.in stamp-directories $(REPLACE_VARS_SED)
353         sed -f $(REPLACE_VARS_SED) < $< > $@
354
355 man/%.8: man/%.8.in stamp-directories $(REPLACE_VARS_SED)
356         sed -f $(REPLACE_VARS_SED) < $< > $@
357
358 man/%.html: man/%.html.in stamp-directories $(REPLACE_VARS_SED)
359         sed -f $(REPLACE_VARS_SED) < $< > $@
360
361 lib/_autoconf.py: Makefile stamp-directories
362         set -e; \
363         { echo '# This file is automatically generated, do not edit!'; \
364           echo '#'; \
365           echo ''; \
366           echo '"""Build-time configuration for Ganeti.'; \
367           echo '';\
368           echo 'This file is autogenerated by the build process.'; \
369           echo 'For any changes you need to re-run ./configure (and'; \
370           echo 'not edit by hand).'; \
371           echo ''; \
372           echo '"""'; \
373           echo ''; \
374           echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
375           echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
376           echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
377           echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
378           echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
379           echo "VERSION_FULL = '$(VERSION_FULL)'"; \
380           echo "LOCALSTATEDIR = '$(localstatedir)'"; \
381           echo "SYSCONFDIR = '$(sysconfdir)'"; \
382           echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
383           echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
384           echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
385           echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
386           echo "XEN_INITRD = '$(XEN_INITRD)'"; \
387           echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
388           echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
389           echo "KVM_PATH = '$(KVM_PATH)'"; \
390           echo "KVM_MIGRATION_PORT = '$(KVM_MIGRATION_PORT)'"; \
391           echo "SOCAT_PATH = '$(SOCAT_PATH)'"; \
392           echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
393           echo "TOOLSDIR = '$(toolsdir)'"; \
394           echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
395         } > $@
396
397 $(REPLACE_VARS_SED): Makefile stamp-directories
398         set -e; \
399         { echo 's#@PREFIX@#$(prefix)#g'; \
400           echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
401           echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
402           echo 's#@BINDIR@#$(bindir)#g'; \
403           echo 's#@SBINDIR@#$(sbindir)#g'; \
404           echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
405           echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
406           echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
407           echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
408           echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
409         } > $@
410
411 # We need to create symlinks because "make distcheck" will not install Python
412 # files when building.
413 srclinks: stamp-directories
414         set -e; \
415         for i in $(srclink_files); do \
416                 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
417                         $(LN_S) $(abs_top_srcdir)/$$i $$i; \
418                 fi; \
419         done
420
421 .PHONY: ganeti
422 ganeti:
423         cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
424
425 check-local:
426         $(CHECK_PYTHON_CODE) $(check_python_code)
427
428 # a dist hook rule for catching revision control directories
429 distcheck-hook:
430         if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
431                 echo "Found revision control files in final archive" 1>&2 ; \
432                 exit 1; \
433         fi
434
435 install-exec-local:
436         @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
437           "$(DESTDIR)${localstatedir}/log/ganeti" \
438           "$(DESTDIR)${localstatedir}/run/ganeti"
439
440 stamp-directories: Makefile
441         @mkdir_p@ $(DIRS)
442         touch $@
443
444 .PHONY: apidoc
445 apidoc: epydoc.conf $(RUN_IN_TEMPDIR)
446         test -e doc/api || mkdir doc/api
447         $(RUN_IN_TEMPDIR) epydoc -v \
448                 --conf $(CURDIR)/epydoc.conf \
449                 --output $(CURDIR)/doc/api
450
451 .PHONY: TAGS
452 TAGS:
453         rm -f TAGS
454         find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
455           -path 'daemons/ganeti-*' -o -path 'tools/*' | \
456           etags -
457
458 # vim: set noet :