Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 6d81475c

History | View | Annotate | Download (9.1 kB)

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
httpdir = $(pkgpythondir)/http
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/http \
30
	lib/hypervisor \
31
	lib/rapi \
32
	man \
33
	qa \
34
	scripts \
35
	test \
36
	test/data \
37
	tools
38

    
39
MAINTAINERCLEANFILES = \
40
	$(dochtml) \
41
	$(patsubst %.dot,%.png,$(docdot)) \
42
	$(maninput)
43

    
44
CLEANFILES = \
45
	autotools/replace_vars.sed \
46
	devel/upload \
47
	doc/examples/bash_completion \
48
	doc/examples/ganeti.initd \
49
	doc/examples/ganeti.cron \
50
	lib/*.py[co] \
51
	lib/http/*.py[co] \
52
	lib/hypervisor/*.py[co] \
53
	lib/rapi/*.py[co] \
54
	$(man_MANS) \
55
	$(manhtml) \
56
	qa/*.py[co] \
57
	test/*.py[co] \
58
	stamp-directories \
59
	$(nodist_pkgpython_PYTHON)
60

    
61
nodist_pkgpython_PYTHON = \
62
	lib/_autoconf.py
63

    
64
pkgpython_PYTHON = \
65
	lib/__init__.py \
66
	lib/backend.py \
67
	lib/bdev.py \
68
	lib/bootstrap.py \
69
	lib/cli.py \
70
	lib/cmdlib.py \
71
	lib/config.py \
72
	lib/constants.py \
73
	lib/daemon.py \
74
	lib/errors.py \
75
	lib/jqueue.py \
76
	lib/jstore.py \
77
	lib/locking.py \
78
	lib/luxi.py \
79
	lib/mcpu.py \
80
	lib/objects.py \
81
	lib/opcodes.py \
82
	lib/rpc.py \
83
	lib/serializer.py \
84
	lib/ssconf.py \
85
	lib/ssh.py \
86
	lib/utils.py \
87
	lib/workerpool.py
88

    
89
hypervisor_PYTHON = \
90
	lib/hypervisor/__init__.py \
91
	lib/hypervisor/hv_base.py \
92
	lib/hypervisor/hv_fake.py \
93
	lib/hypervisor/hv_kvm.py \
94
	lib/hypervisor/hv_xen.py
95

    
96
rapi_PYTHON = \
97
	lib/rapi/__init__.py \
98
	lib/rapi/baserlib.py \
99
	lib/rapi/connector.py \
100
	lib/rapi/rlib2.py
101

    
102
http_PYTHON = \
103
	lib/http/__init__.py \
104
	lib/http/auth.py \
105
	lib/http/client.py \
106
	lib/http/server.py
107

    
108

    
109
docrst = \
110
	doc/admin.rst \
111
	doc/design-2.0.rst \
112
	doc/hooks.rst \
113
	doc/iallocator.rst \
114
	doc/install.rst \
115
	doc/rapi.rst \
116
	doc/security.rst
117

    
118
dochtml = $(patsubst %.rst,%.html,$(docrst))
119

    
120
docdot = \
121
	doc/arch-2.0.dot
122

    
123
doc_DATA = $(dochtml)
124

    
125
noinst_DATA = $(manhtml)
126

    
127
dist_sbin_SCRIPTS = \
128
	daemons/ganeti-noded \
129
	daemons/ganeti-watcher \
130
	daemons/ganeti-masterd \
131
	daemons/ganeti-rapi \
132
	scripts/gnt-backup \
133
	scripts/gnt-cluster \
134
	scripts/gnt-debug \
135
	scripts/gnt-instance \
136
	scripts/gnt-job \
137
	scripts/gnt-node \
138
	scripts/gnt-os
139

    
140
dist_tools_SCRIPTS = \
141
	tools/burnin \
142
	tools/cfgshell \
143
	tools/cfgupgrade \
144
	tools/lvmstrap
145

    
146
EXTRA_DIST = \
147
	$(MAINTAINERCLEANFILES) \
148
	NEWS \
149
	DEVNOTES \
150
	autotools/docbook-wrapper \
151
	devel/upload.in \
152
	$(docrst) \
153
	$(docdot) \
154
	doc/examples/bash_completion.in \
155
	doc/examples/ganeti.initd.in \
156
	doc/examples/ganeti.cron.in \
157
	doc/examples/dumb-allocator \
158
	doc/locking.txt \
159
	test/testutils.py \
160
	test/mocks.py \
161
	$(dist_TESTS) \
162
	$(TEST_FILES) \
163
	man/footer.sgml \
164
	$(mansgml) $(maninput) \
165
	qa/ganeti-qa.py \
166
	qa/qa-sample.json \
167
	qa/qa_cluster.py \
168
	qa/qa_config.py \
169
	qa/qa_daemon.py \
170
	qa/qa_env.py \
171
	qa/qa_error.py \
172
	qa/qa_instance.py \
173
	qa/qa_node.py \
174
	qa/qa_os.py \
175
	qa/qa_rapi.py \
176
	qa/qa_tags.py \
177
	qa/qa_utils.py
178

    
179
man_MANS = \
180
	man/ganeti.7 \
181
	man/ganeti-masterd.8 \
182
	man/ganeti-noded.8 \
183
	man/ganeti-os-interface.7 \
184
	man/ganeti-rapi.8 \
185
	man/ganeti-watcher.8 \
186
	man/gnt-backup.8 \
187
	man/gnt-cluster.8 \
188
	man/gnt-debug.8 \
189
	man/gnt-instance.8 \
190
	man/gnt-job.8 \
191
	man/gnt-node.8 \
192
	man/gnt-os.8
193

    
194
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
195
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
196
maninput = $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) $(patsubst %.html,%.html.in,$(manhtml))
197

    
198
TEST_FILES = \
199
	test/data/bdev-both.txt \
200
	test/data/bdev-disk.txt \
201
	test/data/bdev-net.txt \
202
	test/data/proc_drbd8.txt
203

    
204
dist_TESTS = \
205
	test/ganeti.bdev_unittest.py \
206
	test/ganeti.cli_unittest.py \
207
	test/ganeti.cmdlib_unittest.py \
208
	test/ganeti.config_unittest.py \
209
	test/ganeti.constants_unittest.py \
210
	test/ganeti.hooks_unittest.py \
211
	test/ganeti.http_unittest.py \
212
	test/ganeti.locking_unittest.py \
213
	test/ganeti.rapi.resources_unittest.py \
214
	test/ganeti.serializer_unittest.py \
215
	test/ganeti.ssh_unittest.py \
216
	test/ganeti.utils_unittest.py \
217
	test/ganeti.workerpool_unittest.py
218

    
219
nodist_TESTS =
220

    
221
TESTS = $(dist_TESTS) $(nodist_TESTS)
222

    
223
TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir)
224

    
225
all-local: stamp-directories lib/_autoconf.py devel/upload \
226
	doc/examples/bash_completion \
227
	doc/examples/ganeti.initd doc/examples/ganeti.cron
228

    
229
devel/upload: devel/upload.in stamp-directories $(REPLACE_VARS_SED)
230
	sed -f $(REPLACE_VARS_SED) < $< > $@
231
	chmod u+x $@
232

    
233
doc/examples/%: doc/examples/%.in stamp-directories \
234
		$(REPLACE_VARS_SED)
235
	sed -f $(REPLACE_VARS_SED) < $< > $@
236

    
237
doc/%.html: doc/%.rst
238
	@test -n "$(RST2HTML)" || { echo 'rst2html' not found during configure; exit 1; }
239
	$(RST2HTML) $< $@
240

    
241
doc/%.png: doc/%.dot
242
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
243
	$(DOT) -Tpng -o $@ $<
244

    
245
doc/design-2.0.html: doc/design-2.0.rst doc/arch-2.0.png
246

    
247
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
248
	@test -n "$(DOCBOOK2MAN)" || { echo 'docbook2html' not found during configure; exit 1; }
249
	TMPDIR=`mktemp -d` && { \
250
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $$TMPDIR/$(patsubst man/%.in,%,$@) ; \
251
	mv $$TMPDIR/$(patsubst man/%.in,%,$@) $@ ; \
252
	rm -rf "$$TMPDIR" ; \
253
	}
254

    
255
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
256
	@test -n "$(DOCBOOK2HTML)" || { echo 'docbook2html' not found during configure; exit 1; }
257
	TMPDIR=`mktemp -d` && { \
258
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $$TMPDIR/$(patsubst man/%.in,%,$@) ; \
259
	mv $$TMPDIR/$(patsubst man/%.in,%,$@) $@ ; \
260
	rm -rf "$$TMPDIR" ; \
261
	}
262

    
263
man/%.7: man/%.7.in stamp-directories $(REPLACE_VARS_SED)
264
	sed -f $(REPLACE_VARS_SED) < $< > $@
265

    
266
man/%.8: man/%.8.in stamp-directories $(REPLACE_VARS_SED)
267
	sed -f $(REPLACE_VARS_SED) < $< > $@
268

    
269
man/%.html: man/%.html.in stamp-directories $(REPLACE_VARS_SED)
270
	sed -f $(REPLACE_VARS_SED) < $< > $@
271

    
272
man/footer.sgml $(TESTS): srclinks
273

    
274
$(TESTS): ganeti lib/_autoconf.py
275

    
276
lib/_autoconf.py: Makefile stamp-directories
277
	set -e; \
278
	{ echo '# This file is automatically generated, do not edit!'; \
279
	  echo '#'; \
280
	  echo ''; \
281
	  echo '"""Build-time configuration for Ganeti.'; \
282
	  echo '';\
283
	  echo 'This file is autogenerated by the build process.'; \
284
	  echo 'For any changes you need to re-run ./configure (and'; \
285
	  echo 'not edit by hand).'; \
286
	  echo ''; \
287
	  echo '"""'; \
288
	  echo ''; \
289
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
290
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
291
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
292
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
293
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
294
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
295
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
296
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
297
	  echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
298
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
299
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
300
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
301
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
302
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
303
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
304
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
305
	  echo "KVM_MIGRATION_PORT = '$(KVM_MIGRATION_PORT)'"; \
306
	  echo "SOCAT_PATH = '$(SOCAT_PATH)'"; \
307
	} > $@
308

    
309
$(REPLACE_VARS_SED): Makefile stamp-directories
310
	set -e; \
311
	{ echo 's#@PREFIX@#$(prefix)#g'; \
312
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
313
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
314
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
315
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
316
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
317
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
318
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
319
	} > $@
320

    
321
# We need to create symlinks because "make distcheck" will not install Python
322
# files when building.
323
#.PHONY: srclinks
324
srclinks: stamp-directories
325
	set -e; \
326
	for i in man/footer.sgml $(pkgpython_PYTHON) $(hypervisor_PYTHON) \
327
			$(rapi_PYTHON) $(http_PYTHON); do \
328
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
329
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
330
		fi; \
331
	done
332

    
333
.PHONY: ganeti
334
ganeti:
335
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
336

    
337
# a dist hook rule for catching revision control directories
338
distcheck-hook:
339
	if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
340
		echo "Found revision control files in final archive" 1>&2 ; \
341
		exit 1; \
342
	fi
343

    
344
install-exec-local:
345
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
346
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
347
	  "$(DESTDIR)${localstatedir}/run/ganeti"
348

    
349
stamp-directories: Makefile
350
	@mkdir_p@ $(DIRS)
351
	touch $@
352

    
353
.PHONY: apidoc
354
apidoc:
355
	test -e doc/api || mkdir doc/api
356
	TMPDIR=`mktemp -d ` && { \
357
		cp -r scripts daemons lib $$TMPDIR && \
358
		( \
359
			CDIR=`pwd` && \
360
			cd $$TMPDIR && \
361
			mv lib ganeti && \
362
			epydoc -v --conf $$CDIR/epydoc.conf -o $$CDIR/doc/api \
363
		) ; \
364
		rm -rf $$TMPDIR ; \
365
	}
366

    
367
# vim: set noet :