94063d48eb584d54a3b1fc9936f241e08ac19063
[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/errors.py \
70         lib/http.py \
71         lib/jqueue.py \
72         lib/jstore.py \
73         lib/locking.py \
74         lib/logger.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/httperror.py \
96         lib/rapi/baserlib.py \
97         lib/rapi/connector.py \
98         lib/rapi/rlib1.py \
99         lib/rapi/rlib2.py
100
101
102 docsgml = \
103         doc/hooks.sgml \
104         doc/install.sgml \
105         doc/admin.sgml \
106         doc/rapi.sgml \
107         doc/iallocator.sgml
108
109 docrst = \
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
117 doc_DATA = \
118         $(patsubst %.rst,%.html,$(docrst)) \
119         $(patsubst %.sgml,%.html,$(docsgml)) \
120         $(patsubst %.sgml,%.pdf,$(docsgml))
121
122 dist_sbin_SCRIPTS = \
123         daemons/ganeti-noded \
124         daemons/ganeti-watcher \
125         daemons/ganeti-masterd \
126         daemons/ganeti-rapi \
127         scripts/gnt-backup \
128         scripts/gnt-cluster \
129         scripts/gnt-debug \
130         scripts/gnt-instance \
131         scripts/gnt-job \
132         scripts/gnt-node \
133         scripts/gnt-os
134
135 dist_tools_SCRIPTS = \
136         tools/burnin \
137         tools/cfgshell \
138         tools/cfgupgrade \
139         tools/lvmstrap
140
141 EXTRA_DIST = \
142         NEWS \
143         DEVNOTES \
144         autotools/docbook-wrapper \
145         devel/upload.in \
146         $(docrst) \
147         $(docsgml) \
148         doc/build-rapi-resources-doc \
149         doc/examples/ganeti.initd.in \
150         doc/examples/ganeti.cron.in \
151         doc/examples/dumb-allocator \
152         doc/locking.txt \
153         test/testutils.py \
154         test/mocks.py \
155         $(dist_TESTS) \
156         $(TEST_FILES) \
157         man/footer.sgml \
158         $(mansgml) \
159         qa/ganeti-qa.py \
160         qa/qa-sample.json \
161         qa/qa_cluster.py \
162         qa/qa_config.py \
163         qa/qa_daemon.py \
164         qa/qa_env.py \
165         qa/qa_error.py \
166         qa/qa_instance.py \
167         qa/qa_node.py \
168         qa/qa_os.py \
169         qa/qa_rapi.py \
170         qa/qa_tags.py \
171         qa/qa_utils.py
172
173 man_MANS = \
174         man/ganeti.7 \
175         man/ganeti-noded.8 \
176         man/ganeti-os-interface.7 \
177         man/ganeti-watcher.8 \
178         man/gnt-backup.8 \
179         man/gnt-cluster.8 \
180         man/gnt-instance.8 \
181         man/gnt-node.8 \
182         man/gnt-os.8
183
184 maninput = $(patsubst %.7,%.in,$(patsubst %.8,%.in,$(man_MANS)))
185 mansgml = $(patsubst %.in,%.sgml,$(maninput))
186
187 TEST_FILES = \
188         test/data/bdev-both.txt \
189         test/data/bdev-disk.txt \
190         test/data/bdev-net.txt \
191         test/data/proc_drbd8.txt
192
193 dist_TESTS = \
194         test/ganeti.config_unittest.py \
195         test/ganeti.hooks_unittest.py \
196         test/ganeti.utils_unittest.py \
197         test/ganeti.bdev_unittest.py \
198         test/ganeti.ssh_unittest.py \
199         test/ganeti.locking_unittest.py \
200         test/ganeti.serializer_unittest.py \
201         test/ganeti.workerpool_unittest.py \
202         test/ganeti.rapi.resources_unittest.py \
203         test/ganeti.http_unittest.py \
204         test/ganeti.constants_unittest.py
205
206 nodist_TESTS =
207
208 TESTS = $(dist_TESTS) $(nodist_TESTS)
209
210 TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir)
211
212
213 all-local: stamp-directories lib/_autoconf.py devel/upload \
214         doc/examples/ganeti.initd doc/examples/ganeti.cron
215
216 devel/upload: devel/upload.in stamp-directories $(REPLACE_VARS_SED)
217         sed -f $(REPLACE_VARS_SED) < $< > $@
218         chmod u+x $@
219
220 doc/examples/ganeti.%: doc/examples/ganeti.%.in stamp-directories \
221                 $(REPLACE_VARS_SED)
222         sed -f $(REPLACE_VARS_SED) < $< > $@
223
224 doc/%.in: doc/%.sgml stamp-directories $(REPLACE_VARS_SED)
225         sed -f $(REPLACE_VARS_SED) < $< > $@
226
227 man/%.in: man/%.sgml stamp-directories $(REPLACE_VARS_SED)
228         sed -f $(REPLACE_VARS_SED) < $< > $@
229
230 doc/%.pdf: doc/%.in $(DOCBOOK_WRAPPER)
231         $(DOCBOOK_WRAPPER) $< $@
232
233 doc/%.html: doc/%.in $(DOCBOOK_WRAPPER)
234         $(DOCBOOK_WRAPPER) $< $@
235
236 doc/%.html: doc/%.rst
237         $(RST2HTML) $< $@
238
239 doc/rapi.pdf doc/rapi.html: doc/rapi-resources.sgml
240
241 doc/rapi-resources.sgml: $(BUILD_RAPI_RESOURCE_DOC) lib/rapi/connector.py
242         PYTHONPATH=.:$(top_builddir) $(BUILD_RAPI_RESOURCE_DOC) > $@ || rm -f $@
243
244 man/%.7: man/%.in man/footer.sgml $(DOCBOOK_WRAPPER)
245         $(DOCBOOK_WRAPPER) $< $@
246
247 man/%.8: man/%.in man/footer.sgml $(DOCBOOK_WRAPPER)
248         $(DOCBOOK_WRAPPER) $< $@
249
250 man/footer.sgml $(TESTS): srclinks
251
252 $(TESTS) $(BUILD_RAPI_RESOURCE_DOC): ganeti lib/_autoconf.py
253
254 lib/_autoconf.py: Makefile stamp-directories
255         set -e; \
256         { echo '# This file is automatically generated, do not edit!'; \
257           echo '#'; \
258           echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
259           echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
260           echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
261           echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
262           echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
263           echo "VERSION_FULL = '$(VERSION_FULL)'"; \
264           echo "LOCALSTATEDIR = '$(localstatedir)'"; \
265           echo "SYSCONFDIR = '$(sysconfdir)'"; \
266           echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
267           echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
268           echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
269           echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
270           echo "XEN_INITRD = '$(XEN_INITRD)'"; \
271           echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
272           echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
273           echo "KVM_PATH = '$(KVM_PATH)'"; \
274         } > $@
275
276 $(REPLACE_VARS_SED): Makefile stamp-directories
277         set -e; \
278         { echo 's#@PREFIX@#$(prefix)#g'; \
279           echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
280           echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
281           echo 's#@SBINDIR@#$(sbindir)#g'; \
282           echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
283           echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
284           echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
285           echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
286           echo '/@INCLUDE_RAPI_RESOURCES@/ {'; \
287           echo '  r $(abs_top_builddir)/doc/rapi-resources.sgml'; \
288           echo '  d'; \
289           echo '}'; \
290         } > $@
291
292 # We need to create symlinks because "make distcheck" will not install Python
293 # files when building.
294 #.PHONY: srclinks
295 srclinks: stamp-directories
296         set -e; \
297         for i in man/footer.sgml $(pkgpython_PYTHON) $(hypervisor_PYTHON) $(rapi_PYTHON); do \
298                 if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
299                         $(LN_S) $(abs_top_srcdir)/$$i $$i; \
300                 fi; \
301         done
302
303 .PHONY: ganeti
304 ganeti:
305         cd $(top_builddir) && rm -f $@ && $(LN_S) lib $@
306
307 # a dist hook rule for catching revision control directories
308 distcheck-hook:
309         if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
310                 echo "Found revision control files in final archive" 1>&2 ; \
311                 exit 1; \
312         fi
313
314 install-exec-local:
315         @mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
316           "$(DESTDIR)${localstatedir}/log/ganeti" \
317           "$(DESTDIR)${localstatedir}/run/ganeti"
318
319 stamp-directories: Makefile
320         @mkdir_p@ $(DIRS)
321         touch $@
322
323 .PHONY: apidoc
324 apidoc:
325         test -e doc/api || mkdir doc/api
326         TMPDIR=`mktemp -d ./temp-epydoc.XXXXXX` && { \
327                 cp -r scripts daemons lib $$TMPDIR && \
328                 ( \
329                         cd $$TMPDIR && \
330                         mv lib ganeti && \
331                         epydoc --conf ../epydoc.conf \
332                 ) ; \
333                 rm -rf $$TMPDIR ; \
334         }
335
336 # vim: set noet :