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