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