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