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