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