Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 77220dd2

History | View | Annotate | Download (10 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
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
httpdir = $(pkgpythondir)/http
19
rapidir = $(pkgpythondir)/rapi
20
toolsdir = $(pkglibdir)/tools
21
docdir = $(datadir)/doc/$(PACKAGE)
22

    
23
DIRS = \
24
	autotools \
25
	daemons \
26
	devel \
27
	doc \
28
	doc/examples \
29
	doc/examples/hooks \
30
	lib \
31
	lib/http \
32
	lib/hypervisor \
33
	lib/rapi \
34
	man \
35
	qa \
36
	scripts \
37
	test \
38
	test/data \
39
	tools
40

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

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

    
65
nodist_pkgpython_PYTHON = \
66
	lib/_autoconf.py
67

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

    
93
hypervisor_PYTHON = \
94
	lib/hypervisor/__init__.py \
95
	lib/hypervisor/hv_base.py \
96
	lib/hypervisor/hv_fake.py \
97
	lib/hypervisor/hv_kvm.py \
98
	lib/hypervisor/hv_xen.py
99

    
100
rapi_PYTHON = \
101
	lib/rapi/__init__.py \
102
	lib/rapi/baserlib.py \
103
	lib/rapi/connector.py \
104
	lib/rapi/rlib2.py
105

    
106
http_PYTHON = \
107
	lib/http/__init__.py \
108
	lib/http/auth.py \
109
	lib/http/client.py \
110
	lib/http/server.py
111

    
112

    
113
docrst = \
114
	doc/admin.rst \
115
	doc/design-2.0.rst \
116
	doc/hooks.rst \
117
	doc/iallocator.rst \
118
	doc/install.rst \
119
	doc/rapi.rst \
120
	doc/security.rst
121

    
122
dochtml = $(patsubst %.rst,%.html,$(docrst))
123

    
124
docdot = \
125
	doc/arch-2.0.dot
126

    
127
doc_DATA = $(dochtml)
128

    
129
noinst_DATA = $(manhtml)
130

    
131
dist_sbin_SCRIPTS = \
132
	daemons/ganeti-noded \
133
	daemons/ganeti-watcher \
134
	daemons/ganeti-masterd \
135
	daemons/ganeti-rapi \
136
	scripts/gnt-backup \
137
	scripts/gnt-cluster \
138
	scripts/gnt-debug \
139
	scripts/gnt-instance \
140
	scripts/gnt-job \
141
	scripts/gnt-node \
142
	scripts/gnt-os
143

    
144
nodist_sbin_SCRIPTS = \
145
	daemons/ganeti-cleaner
146

    
147
dist_tools_SCRIPTS = \
148
	tools/burnin \
149
	tools/cfgshell \
150
	tools/cfgupgrade \
151
	tools/lvmstrap
152

    
153
EXTRA_DIST = \
154
	$(MAINTAINERCLEANFILES) \
155
	NEWS \
156
	DEVNOTES \
157
	pylintrc \
158
	autotools/docbook-wrapper \
159
	daemons/ganeti-cleaner.in \
160
	devel/upload.in \
161
	$(docrst) \
162
	$(docdot) \
163
	doc/build-rapi-resources-doc \
164
	doc/rapi-resources.gen \
165
	doc/examples/bash_completion.in \
166
	doc/examples/ganeti.initd.in \
167
	doc/examples/ganeti.cron.in \
168
	doc/examples/dumb-allocator \
169
	doc/examples/hooks/ethers \
170
	doc/locking.txt \
171
	test/testutils.py \
172
	test/mocks.py \
173
	$(dist_TESTS) \
174
	$(TEST_FILES) \
175
	man/footer.sgml \
176
	$(mansgml) $(maninput) \
177
	qa/ganeti-qa.py \
178
	qa/qa-sample.json \
179
	qa/qa_cluster.py \
180
	qa/qa_config.py \
181
	qa/qa_daemon.py \
182
	qa/qa_env.py \
183
	qa/qa_error.py \
184
	qa/qa_instance.py \
185
	qa/qa_node.py \
186
	qa/qa_os.py \
187
	qa/qa_rapi.py \
188
	qa/qa_tags.py \
189
	qa/qa_utils.py
190

    
191
man_MANS = \
192
	man/ganeti.7 \
193
	man/ganeti-cleaner.8 \
194
	man/ganeti-masterd.8 \
195
	man/ganeti-noded.8 \
196
	man/ganeti-os-interface.7 \
197
	man/ganeti-rapi.8 \
198
	man/ganeti-watcher.8 \
199
	man/gnt-backup.8 \
200
	man/gnt-cluster.8 \
201
	man/gnt-debug.8 \
202
	man/gnt-instance.8 \
203
	man/gnt-job.8 \
204
	man/gnt-node.8 \
205
	man/gnt-os.8
206

    
207
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
208
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
209
maninput = $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) $(patsubst %.html,%.html.in,$(manhtml))
210

    
211
TEST_FILES = \
212
	test/data/bdev-both.txt \
213
	test/data/bdev-8.3-both.txt \
214
	test/data/bdev-disk.txt \
215
	test/data/bdev-net.txt \
216
	test/data/proc_drbd8.txt \
217
	test/data/proc_drbd80-emptyline.txt \
218
	test/data/proc_drbd83.txt
219

    
220
dist_TESTS = \
221
	test/ganeti.bdev_unittest.py \
222
	test/ganeti.cli_unittest.py \
223
	test/ganeti.cmdlib_unittest.py \
224
	test/ganeti.config_unittest.py \
225
	test/ganeti.constants_unittest.py \
226
	test/ganeti.hooks_unittest.py \
227
	test/ganeti.http_unittest.py \
228
	test/ganeti.locking_unittest.py \
229
	test/ganeti.rapi.resources_unittest.py \
230
	test/ganeti.serializer_unittest.py \
231
	test/ganeti.ssh_unittest.py \
232
	test/ganeti.utils_unittest.py \
233
	test/ganeti.workerpool_unittest.py
234

    
235
nodist_TESTS =
236

    
237
TESTS = $(dist_TESTS) $(nodist_TESTS)
238

    
239
TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir) $(PYTHON)
240

    
241
RAPI_RESOURCES = $(wildcard lib/rapi/*.py)
242

    
243
all-local: stamp-directories lib/_autoconf.py devel/upload \
244
	doc/examples/bash_completion \
245
	doc/examples/ganeti.initd doc/examples/ganeti.cron
246

    
247
devel/upload: devel/upload.in stamp-directories $(REPLACE_VARS_SED)
248
	sed -f $(REPLACE_VARS_SED) < $< > $@
249
	chmod u+x $@
250

    
251
doc/examples/%: doc/examples/%.in stamp-directories \
252
		$(REPLACE_VARS_SED)
253
	sed -f $(REPLACE_VARS_SED) < $< > $@
254

    
255
daemons/ganeti-cleaner: daemons/ganeti-cleaner.in stamp-directories \
256
		$(REPLACE_VARS_SED)
257
	sed -f $(REPLACE_VARS_SED) < $< > $@
258
	chmod +x $@
259

    
260
doc/%.html: doc/%.rst
261
	@test -n "$(RST2HTML)" || { echo 'rst2html' not found during configure; exit 1; }
262
	$(RST2HTML) $< $@
263

    
264
doc/%.png: doc/%.dot
265
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
266
	$(DOT) -Tpng -o $@ $<
267

    
268
doc/design-2.0.html: doc/design-2.0.rst doc/arch-2.0.png
269

    
270
doc/rapi.html: doc/rapi-resources.gen
271

    
272
doc/rapi-resources.gen: $(BUILD_RAPI_RESOURCE_DOC) $(RAPI_RESOURCES)
273
	PYTHONPATH=.:$(top_builddir) $(BUILD_RAPI_RESOURCE_DOC) > $@ || \
274
	  rm -f $@
275

    
276
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
277
	@test -n "$(DOCBOOK2MAN)" || { echo 'docbook2html' not found during configure; exit 1; }
278
	TMPDIR=`mktemp -d` && { \
279
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $$TMPDIR/$(patsubst man/%.in,%,$@) ; \
280
	mv $$TMPDIR/$(patsubst man/%.in,%,$@) $@ ; \
281
	rm -rf "$$TMPDIR" ; \
282
	}
283

    
284
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
285
	@test -n "$(DOCBOOK2HTML)" || { echo 'docbook2html' not found during configure; exit 1; }
286
	TMPDIR=`mktemp -d` && { \
287
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $$TMPDIR/$(patsubst man/%.in,%,$@) ; \
288
	mv $$TMPDIR/$(patsubst man/%.in,%,$@) $@ ; \
289
	rm -rf "$$TMPDIR" ; \
290
	}
291

    
292
man/%.7: man/%.7.in stamp-directories $(REPLACE_VARS_SED)
293
	sed -f $(REPLACE_VARS_SED) < $< > $@
294

    
295
man/%.8: man/%.8.in stamp-directories $(REPLACE_VARS_SED)
296
	sed -f $(REPLACE_VARS_SED) < $< > $@
297

    
298
man/%.html: man/%.html.in stamp-directories $(REPLACE_VARS_SED)
299
	sed -f $(REPLACE_VARS_SED) < $< > $@
300

    
301
man/footer.sgml $(TESTS): srclinks
302

    
303
$(TESTS) $(BUILD_RAPI_RESOURCE_DOC): ganeti lib/_autoconf.py
304

    
305
lib/_autoconf.py: Makefile stamp-directories
306
	set -e; \
307
	{ echo '# This file is automatically generated, do not edit!'; \
308
	  echo '#'; \
309
	  echo ''; \
310
	  echo '"""Build-time configuration for Ganeti.'; \
311
	  echo '';\
312
	  echo 'This file is autogenerated by the build process.'; \
313
	  echo 'For any changes you need to re-run ./configure (and'; \
314
	  echo 'not edit by hand).'; \
315
	  echo ''; \
316
	  echo '"""'; \
317
	  echo ''; \
318
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
319
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
320
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
321
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
322
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
323
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
324
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
325
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
326
	  echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
327
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
328
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
329
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
330
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
331
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
332
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
333
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
334
	  echo "KVM_MIGRATION_PORT = '$(KVM_MIGRATION_PORT)'"; \
335
	  echo "SOCAT_PATH = '$(SOCAT_PATH)'"; \
336
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)" ; \
337
	} > $@
338

    
339
$(REPLACE_VARS_SED): Makefile stamp-directories
340
	set -e; \
341
	{ echo 's#@PREFIX@#$(prefix)#g'; \
342
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
343
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
344
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
345
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
346
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
347
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
348
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
349
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
350
	} > $@
351

    
352
# We need to create symlinks because "make distcheck" will not install Python
353
# files when building.
354
#.PHONY: srclinks
355
srclinks: stamp-directories
356
	set -e; \
357
	for i in man/footer.sgml $(pkgpython_PYTHON) $(hypervisor_PYTHON) \
358
			$(rapi_PYTHON) $(http_PYTHON); do \
359
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
360
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
361
		fi; \
362
	done
363

    
364
.PHONY: ganeti
365
ganeti:
366
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
367

    
368
# a dist hook rule for catching revision control directories
369
distcheck-hook:
370
	if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
371
		echo "Found revision control files in final archive" 1>&2 ; \
372
		exit 1; \
373
	fi
374

    
375
install-exec-local:
376
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
377
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
378
	  "$(DESTDIR)${localstatedir}/run/ganeti"
379

    
380
stamp-directories: Makefile
381
	@mkdir_p@ $(DIRS)
382
	touch $@
383

    
384
.PHONY: apidoc
385
apidoc:
386
	test -e doc/api || mkdir doc/api
387
	TMPDIR=`mktemp -d ` && { \
388
		cp -r scripts daemons lib $$TMPDIR && \
389
		( \
390
			CDIR=`pwd` && \
391
			cd $$TMPDIR && \
392
			mv lib ganeti && \
393
			epydoc -v --conf $$CDIR/epydoc.conf -o $$CDIR/doc/api \
394
		) ; \
395
		rm -rf $$TMPDIR ; \
396
	}
397

    
398
# vim: set noet :