Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 89b70f39

History | View | Annotate | Download (13 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_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
15
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
16
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
17
REPLACE_VARS_SED = autotools/replace_vars.sed
18

    
19
hypervisordir = $(pkgpythondir)/hypervisor
20
httpdir = $(pkgpythondir)/http
21
confddir = $(pkgpythondir)/confd
22
rapidir = $(pkgpythondir)/rapi
23
toolsdir = $(pkglibdir)/tools
24
docdir = $(datadir)/doc/$(PACKAGE)
25

    
26
DIRS = \
27
	autotools \
28
	daemons \
29
	devel \
30
	doc \
31
	doc/examples \
32
	doc/examples/hooks \
33
	lib \
34
	lib/build \
35
	lib/http \
36
	lib/hypervisor \
37
	lib/rapi \
38
	lib/confd \
39
	man \
40
	qa \
41
	scripts \
42
	test \
43
	test/data \
44
	tools
45

    
46
MAINTAINERCLEANFILES = \
47
	$(docpng) \
48
	$(maninput) \
49
	doc/install-quick.rst \
50
	doc/news.rst
51

    
52
maintainer-clean-local:
53
	rm -rf doc/api doc/html
54

    
55
CLEANFILES = \
56
	autotools/replace_vars.sed \
57
	daemons/daemon-util \
58
	daemons/ganeti-cleaner \
59
	devel/upload \
60
	doc/examples/bash_completion \
61
	doc/examples/ganeti.initd \
62
	doc/examples/ganeti.cron \
63
	doc/examples/gnt-config-backup \
64
	doc/examples/hooks/ipsec \
65
	lib/*.py[co] \
66
	lib/build/*.py[co] \
67
	lib/http/*.py[co] \
68
	lib/hypervisor/*.py[co] \
69
	lib/rapi/*.py[co] \
70
	$(man_MANS) \
71
	$(manhtml) \
72
	qa/*.py[co] \
73
	test/*.py[co] \
74
	stamp-directories \
75
	stamp-srclinks \
76
	$(nodist_pkgpython_PYTHON)
77

    
78
BUILT_SOURCES = \
79
	ganeti \
80
	stamp-srclinks \
81
	stamp-directories \
82
	lib/_autoconf.py
83

    
84
nodist_pkgpython_PYTHON = \
85
	lib/_autoconf.py
86

    
87
noinst_PYTHON = \
88
	lib/build/__init__.py
89

    
90
pkgpython_PYTHON = \
91
	lib/__init__.py \
92
	lib/asyncnotifier.py \
93
	lib/backend.py \
94
	lib/bdev.py \
95
	lib/bootstrap.py \
96
	lib/cli.py \
97
	lib/cmdlib.py \
98
	lib/config.py \
99
	lib/constants.py \
100
	lib/daemon.py \
101
	lib/errors.py \
102
	lib/jqueue.py \
103
	lib/jstore.py \
104
	lib/locking.py \
105
	lib/luxi.py \
106
	lib/mcpu.py \
107
	lib/objects.py \
108
	lib/opcodes.py \
109
	lib/rpc.py \
110
	lib/serializer.py \
111
	lib/ssconf.py \
112
	lib/ssh.py \
113
	lib/storage.py \
114
	lib/utils.py \
115
	lib/workerpool.py
116

    
117
hypervisor_PYTHON = \
118
	lib/hypervisor/__init__.py \
119
	lib/hypervisor/hv_base.py \
120
	lib/hypervisor/hv_chroot.py \
121
	lib/hypervisor/hv_fake.py \
122
	lib/hypervisor/hv_kvm.py \
123
	lib/hypervisor/hv_xen.py
124

    
125
rapi_PYTHON = \
126
	lib/rapi/__init__.py \
127
	lib/rapi/baserlib.py \
128
	lib/rapi/connector.py \
129
	lib/rapi/rlib2.py
130

    
131
http_PYTHON = \
132
	lib/http/__init__.py \
133
	lib/http/auth.py \
134
	lib/http/client.py \
135
	lib/http/server.py
136

    
137
confd_PYTHON = \
138
	lib/confd/__init__.py \
139
	lib/confd/client.py \
140
	lib/confd/server.py \
141
	lib/confd/querylib.py
142

    
143
docrst = \
144
	doc/admin.rst \
145
	doc/design-2.0.rst \
146
	doc/design-2.1.rst \
147
	doc/devnotes.rst \
148
	doc/glossary.rst \
149
	doc/hooks.rst \
150
	doc/iallocator.rst \
151
	doc/index.rst \
152
	doc/install-quick.rst \
153
	doc/install.rst \
154
	doc/locking.rst \
155
	doc/news.rst \
156
	doc/rapi.rst \
157
	doc/security.rst \
158
	doc/walkthrough.rst
159

    
160
doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac
161
	@test -n "$(SPHINX)" || \
162
	    { echo 'sphinx-build' not found during configure; exit 1; }
163
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
164
	    -d . \
165
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
166
	    -D release="$(PACKAGE_VERSION)" \
167
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
168
	rm -f doc/html/.buildinfo doc/html/objects.inv
169
	touch $@
170

    
171
doc/html: doc/html/.stamp
172

    
173
doc/news.rst: NEWS
174
	set -e; \
175
	{ echo '.. This file is automatically updated at build time from $<.'; \
176
	  echo '.. Do not edit.'; \
177
	  echo; \
178
	  cat $<; \
179
	} > $@
180

    
181
doc/install-quick.rst: INSTALL
182
	set -e; \
183
	{ echo '.. This file is automatically updated at build time from $<.'; \
184
	  echo '.. Do not edit.'; \
185
	  echo; \
186
	  cat $<; \
187
	} > $@
188

    
189
docdot = \
190
	doc/arch-2.0.dot \
191
	doc/design-2.1-lock-acquire.dot \
192
	doc/design-2.1-lock-release.dot
193

    
194
docpng = $(patsubst %.dot,%.png,$(docdot))
195

    
196
# Things to build but not to install (add it to EXTRA_DIST if it should be
197
# distributed)
198
noinst_DATA = \
199
	devel/upload \
200
	doc/html \
201
	doc/examples/bash_completion \
202
	doc/examples/ganeti.cron \
203
	doc/examples/ganeti.initd \
204
	doc/examples/gnt-config-backup \
205
	doc/examples/hooks/ipsec \
206
	$(manhtml)
207

    
208
gnt_scripts = \
209
	scripts/gnt-backup \
210
	scripts/gnt-cluster \
211
	scripts/gnt-debug \
212
	scripts/gnt-instance \
213
	scripts/gnt-job \
214
	scripts/gnt-node \
215
	scripts/gnt-os
216

    
217
dist_sbin_SCRIPTS = \
218
	daemons/ganeti-noded \
219
	daemons/ganeti-watcher \
220
	daemons/ganeti-masterd \
221
	daemons/ganeti-confd \
222
	daemons/ganeti-rapi \
223
	$(gnt_scripts)
224

    
225
nodist_sbin_SCRIPTS = \
226
	daemons/ganeti-cleaner
227

    
228
dist_tools_SCRIPTS = \
229
	tools/burnin \
230
	tools/cfgshell \
231
	tools/cfgupgrade \
232
	tools/lvmstrap
233

    
234
pkglib_SCRIPTS = \
235
	daemons/daemon-util
236

    
237
EXTRA_DIST = \
238
	NEWS \
239
	pylintrc \
240
	autotools/build-bash-completion \
241
	autotools/check-python-code \
242
	autotools/docbook-wrapper \
243
	$(RUN_IN_TEMPDIR) \
244
	daemons/daemon-util.in \
245
	daemons/ganeti-cleaner.in \
246
	devel/upload.in \
247
	$(docdot) \
248
	$(docpng) \
249
	$(docrst) \
250
	doc/conf.py \
251
	doc/html \
252
	doc/examples/ganeti.initd.in \
253
	doc/examples/ganeti.cron.in \
254
	doc/examples/gnt-config-backup.in \
255
	doc/examples/dumb-allocator \
256
	doc/examples/ganeti.default \
257
	doc/examples/ganeti.default-debug \
258
	doc/examples/hooks/ethers \
259
	doc/examples/hooks/ipsec.in \
260
	test/testutils.py \
261
	test/mocks.py \
262
	$(dist_TESTS) \
263
	$(TEST_FILES) \
264
	man/footer.sgml \
265
	$(mansgml) \
266
	$(maninput) \
267
	qa/ganeti-qa.py \
268
	qa/qa-sample.json \
269
	qa/qa_cluster.py \
270
	qa/qa_config.py \
271
	qa/qa_daemon.py \
272
	qa/qa_env.py \
273
	qa/qa_error.py \
274
	qa/qa_instance.py \
275
	qa/qa_node.py \
276
	qa/qa_os.py \
277
	qa/qa_rapi.py \
278
	qa/qa_tags.py \
279
	qa/qa_utils.py
280

    
281
man_MANS = \
282
	man/ganeti.7 \
283
	man/ganeti-cleaner.8 \
284
	man/ganeti-confd.8 \
285
	man/ganeti-masterd.8 \
286
	man/ganeti-noded.8 \
287
	man/ganeti-os-interface.7 \
288
	man/ganeti-rapi.8 \
289
	man/ganeti-watcher.8 \
290
	man/gnt-backup.8 \
291
	man/gnt-cluster.8 \
292
	man/gnt-debug.8 \
293
	man/gnt-instance.8 \
294
	man/gnt-job.8 \
295
	man/gnt-node.8 \
296
	man/gnt-os.8
297

    
298
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
299
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
300
maninput = \
301
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
302
	$(patsubst %.html,%.html.in,$(manhtml))
303

    
304
TEST_FILES = \
305
	test/data/bdev-both.txt \
306
	test/data/bdev-8.3-both.txt \
307
	test/data/bdev-disk.txt \
308
	test/data/bdev-net.txt \
309
	test/data/proc_drbd8.txt \
310
	test/data/proc_drbd80-emptyline.txt \
311
	test/data/proc_drbd83.txt
312

    
313
dist_TESTS = \
314
	test/ganeti.bdev_unittest.py \
315
	test/ganeti.cli_unittest.py \
316
	test/ganeti.cmdlib_unittest.py \
317
	test/ganeti.confd_client_unittest.py \
318
	test/ganeti.config_unittest.py \
319
	test/ganeti.constants_unittest.py \
320
	test/ganeti.hooks_unittest.py \
321
	test/ganeti.http_unittest.py \
322
	test/ganeti.locking_unittest.py \
323
	test/ganeti.mcpu_unittest.py \
324
	test/ganeti.objects_unittest.py \
325
	test/ganeti.rapi.resources_unittest.py \
326
	test/ganeti.serializer_unittest.py \
327
	test/ganeti.ssh_unittest.py \
328
	test/ganeti.utils_unittest.py \
329
	test/ganeti.workerpool_unittest.py \
330
	test/docs_unittest.py
331

    
332
nodist_TESTS =
333

    
334
TESTS = $(dist_TESTS) $(nodist_TESTS)
335

    
336
TESTS_ENVIRONMENT = \
337
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) \
338
	$(RUN_IN_TEMPDIR) $(PYTHON)
339

    
340
all_python_code = \
341
	$(dist_sbin_SCRIPTS) \
342
	$(dist_tools_SCRIPTS) \
343
	$(dist_TESTS) \
344
	$(pkgpython_PYTHON) \
345
	$(hypervisor_PYTHON) \
346
	$(rapi_PYTHON) \
347
	$(http_PYTHON) \
348
	$(confd_PYTHON) \
349
	$(noinst_PYTHON)
350

    
351
srclink_files = \
352
	man/footer.sgml \
353
	$(all_python_code)
354

    
355
check_python_code = \
356
	$(BUILD_BASH_COMPLETION) \
357
	$(all_python_code)
358

    
359
lint_python_code = \
360
	ganeti \
361
	$(dist_sbin_SCRIPTS) \
362
	$(dist_tools_SCRIPTS) \
363
	$(BUILD_BASH_COMPLETION)
364

    
365
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
366
	sed -f $(REPLACE_VARS_SED) < $< > $@
367
	chmod u+x $@
368

    
369
daemons/%: daemons/%.in \
370
		$(REPLACE_VARS_SED)
371
	sed -f $(REPLACE_VARS_SED) < $< > $@
372
	chmod +x $@
373

    
374
doc/examples/%: doc/examples/%.in \
375
		$(REPLACE_VARS_SED)
376
	sed -f $(REPLACE_VARS_SED) < $< > $@
377

    
378
doc/examples/hooks/%: doc/examples/hooks/%.in \
379
		$(REPLACE_VARS_SED)
380
	sed -f $(REPLACE_VARS_SED) < $< > $@
381

    
382
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
383
	lib/cli.py $(gnt_scripts) tools/burnin
384
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
385

    
386
doc/%.png: doc/%.dot
387
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
388
	$(DOT) -Tpng -o $@ $<
389

    
390
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
391
	@test -n "$(DOCBOOK2MAN)" || \
392
	  { echo 'docbook2man' not found during configure; exit 1; }
393
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
394

    
395
man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
396
	@test -n "$(DOCBOOK2HTML)" || \
397
	  { echo 'docbook2html' not found during configure; exit 1; }
398
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
399

    
400
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
401
	sed -f $(REPLACE_VARS_SED) < $< > $@
402

    
403
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
404
	sed -f $(REPLACE_VARS_SED) < $< > $@
405

    
406
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
407
	sed -f $(REPLACE_VARS_SED) < $< > $@
408

    
409
lib/_autoconf.py: Makefile stamp-directories
410
	set -e; \
411
	{ echo '# This file is automatically generated, do not edit!'; \
412
	  echo '#'; \
413
	  echo ''; \
414
	  echo '"""Build-time configuration for Ganeti.'; \
415
	  echo '';\
416
	  echo 'This file is autogenerated by the build process.'; \
417
	  echo 'For any changes you need to re-run ./configure (and'; \
418
	  echo 'not edit by hand).'; \
419
	  echo ''; \
420
	  echo '"""'; \
421
	  echo ''; \
422
	  echo '# pylint: disable-msg=C0301,C0324'; \
423
	  echo '# because this is autogenerated, we do not want'; \
424
	  echo '# style warnings' ; \
425
	  echo ''; \
426
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
427
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
428
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
429
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
430
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
431
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
432
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
433
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
434
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
435
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
436
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
437
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
438
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
439
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
440
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
441
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
442
	  echo "SOCAT_PATH = '$(SOCAT)'"; \
443
	  echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
444
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
445
	  echo "TOOLSDIR = '$(toolsdir)'"; \
446
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
447
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
448
	  echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
449
	} > $@
450

    
451
$(REPLACE_VARS_SED): Makefile
452
	set -e; \
453
	{ echo 's#@PREFIX@#$(prefix)#g'; \
454
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
455
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
456
	  echo 's#@BINDIR@#$(bindir)#g'; \
457
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
458
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
459
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
460
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
461
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
462
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
463
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
464
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
465
	} > $@
466

    
467
# We need to create symlinks because "make distcheck" will not install Python
468
# files when building.
469
stamp-srclinks: Makefile stamp-directories
470
	set -e; \
471
	for i in $(srclink_files); do \
472
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
473
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
474
		fi; \
475
	done
476
	touch $@
477

    
478
.PHONY: ganeti
479
ganeti:
480
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
481

    
482
check-local:
483
	$(CHECK_PYTHON_CODE) $(check_python_code)
484

    
485
.PHONY: lint
486
lint: ganeti
487
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
488
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
489

    
490
# a dist hook rule for catching revision control directories
491
distcheck-hook:
492
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
493
		echo "Found revision control files in final archive." 1>&2; \
494
		exit 1; \
495
	fi
496
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
497
		echo "Found Python byte code in final archive." 1>&2; \
498
		exit 1; \
499
	fi
500
	if find $(top_distdir) -name '*~' | grep .; then \
501
		echo "Found backup files in final archive." 1>&2; \
502
		exit 1; \
503
	fi
504

    
505
install-exec-local:
506
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
507
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
508
	  "$(DESTDIR)${localstatedir}/run/ganeti"
509

    
510
stamp-directories: Makefile
511
	@mkdir_p@ $(DIRS)
512
	touch $@
513

    
514
.PHONY: apidoc
515
apidoc: epydoc.conf $(RUN_IN_TEMPDIR)
516
	test -e doc/api || mkdir doc/api
517
	$(RUN_IN_TEMPDIR) epydoc -v \
518
		--conf $(CURDIR)/epydoc.conf \
519
		--output $(CURDIR)/doc/api
520

    
521
.PHONY: TAGS
522
TAGS:
523
	rm -f TAGS
524
	find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
525
	  -path 'daemons/ganeti-*' -o -path 'tools/*' | \
526
	  etags -
527

    
528
# vim: set noet :