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