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