Makefile.am 15.1 KB
Newer Older
1 2 3 4 5
# Ganeti makefile
# - Indent with tabs only.
# - Keep files sorted; one line per file.
# - Directories in lib/ must have their own *dir variable (see hypervisor).
# - All directories must be listed DIRS.
Michael Hanselmann's avatar
Michael Hanselmann committed
6
# - Use autogen.sh to generate Makefile.in and configure script.
7 8 9 10 11

# Automake doesn't export these variables before version 1.10.
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@

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
CHECK_MAN = $(top_srcdir)/autotools/check-man
18 19 20
REPLACE_VARS_SED = autotools/replace_vars.sed

hypervisordir = $(pkgpythondir)/hypervisor
21
httpdir = $(pkgpythondir)/http
Michael Hanselmann's avatar
Michael Hanselmann committed
22
masterddir = $(pkgpythondir)/masterd
Guido Trotter's avatar
Guido Trotter committed
23
confddir = $(pkgpythondir)/confd
24
rapidir = $(pkgpythondir)/rapi
25 26 27
toolsdir = $(pkglibdir)/tools
docdir = $(datadir)/doc/$(PACKAGE)

28 29 30
# Delete output file if an error occurred while building it
.DELETE_ON_ERROR:

31 32 33 34 35 36
DIRS = \
	autotools \
	daemons \
	devel \
	doc \
	doc/examples \
Guido Trotter's avatar
Guido Trotter committed
37
	doc/examples/hooks \
38
	lib \
39
	lib/build \
40
	lib/confd \
41
	lib/http \
42
	lib/hypervisor \
Michael Hanselmann's avatar
Michael Hanselmann committed
43
	lib/masterd \
44
	lib/rapi \
45 46 47 48 49 50 51
	man \
	qa \
	scripts \
	test \
	test/data \
	tools

Iustin Pop's avatar
Iustin Pop committed
52
MAINTAINERCLEANFILES = \
53
	$(docpng) \
54
	$(maninput) \
55
	doc/install-quick.rst \
56
	doc/news.rst
Iustin Pop's avatar
Iustin Pop committed
57

58
maintainer-clean-local:
59
	rm -rf doc/api doc/html doc/coverage
60

61
CLEANFILES = \
62
	$(addsuffix /*.py[co],$(DIRS)) \
63
	autotools/replace_vars.sed \
64
	daemons/daemon-util \
65
	daemons/ganeti-cleaner \
66
	devel/upload \
67
	doc/examples/bash_completion \
68 69
	doc/examples/ganeti.initd \
	doc/examples/ganeti.cron \
70
	doc/examples/gnt-config-backup \
Luca Bigliardi's avatar
Luca Bigliardi committed
71
	doc/examples/hooks/ipsec \
Iustin Pop's avatar
Iustin Pop committed
72 73
	$(man_MANS) \
	$(manhtml) \
74
	stamp-directories \
75
	stamp-srclinks \
76 77
	$(nodist_pkgpython_PYTHON)

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

84 85 86
nodist_pkgpython_PYTHON = \
	lib/_autoconf.py

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

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

hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
122
	lib/hypervisor/hv_chroot.py \
123
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
124
	lib/hypervisor/hv_kvm.py \
125 126
	lib/hypervisor/hv_xen.py

127 128
rapi_PYTHON = \
	lib/rapi/__init__.py \
129
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
130
	lib/rapi/client.py \
131
	lib/rapi/client_utils.py \
132 133
	lib/rapi/connector.py \
	lib/rapi/rlib2.py
134

135
http_PYTHON = \
136
	lib/http/__init__.py \
137
	lib/http/auth.py \
138 139
	lib/http/client.py \
	lib/http/server.py
140

Guido Trotter's avatar
Guido Trotter committed
141
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
142
	lib/confd/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
143
	lib/confd/client.py \
144 145
	lib/confd/querylib.py \
	lib/confd/server.py
146

Michael Hanselmann's avatar
Michael Hanselmann committed
147
masterd_PYTHON = \
148 149
	lib/masterd/__init__.py \
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
150

Michael Hanselmann's avatar
Michael Hanselmann committed
151
docrst = \
152
	doc/admin.rst \
153
	doc/design-2.0.rst \
154
	doc/design-2.1.rst \
155
	doc/design-2.2.rst \
156
	doc/design-cluster-merger.rst \
157
	doc/devnotes.rst \
158
	doc/glossary.rst \
159
	doc/hooks.rst \
160
	doc/iallocator.rst \
161
	doc/index.rst \
162
	doc/install-quick.rst \
163
	doc/install.rst \
164
	doc/locking.rst \
Iustin Pop's avatar
Iustin Pop committed
165
	doc/news.rst \
166
	doc/rapi.rst \
167
	doc/security.rst \
Iustin Pop's avatar
Iustin Pop committed
168
	doc/walkthrough.rst
Michael Hanselmann's avatar
Michael Hanselmann committed
169

170
doc/html/.stamp: $(docrst) $(docpng) doc/conf.py configure.ac
171 172
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
173
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
174
	    -d . \
175 176
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
177 178 179 180 181
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

doc/html: doc/html/.stamp
Iustin Pop's avatar
Iustin Pop committed
182

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

191 192 193 194 195 196 197 198
doc/install-quick.rst: INSTALL
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

199
docdot = \
200 201 202
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
203

204
docpng = $(patsubst %.dot,%.png,$(docdot))
205

206 207 208 209 210 211 212 213
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	devel/upload \
	doc/html \
	doc/examples/bash_completion \
	doc/examples/ganeti.cron \
	doc/examples/ganeti.initd \
214
	doc/examples/gnt-config-backup \
215 216
	doc/examples/hooks/ipsec \
	$(manhtml)
217

218
gnt_scripts = \
219 220 221 222 223 224 225 226
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

227 228 229 230 231 232 233 234
dist_sbin_SCRIPTS = \
	daemons/ganeti-noded \
	daemons/ganeti-watcher \
	daemons/ganeti-masterd \
	daemons/ganeti-confd \
	daemons/ganeti-rapi \
	$(gnt_scripts)

235 236 237
nodist_sbin_SCRIPTS = \
	daemons/ganeti-cleaner

238 239 240 241
dist_tools_SCRIPTS = \
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
242
	tools/cfgupgrade12 \
243
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
244 245
	tools/lvmstrap \
	tools/sanitize-config
246

247
pkglib_python_scripts = \
248 249
	daemons/import-export \
	tools/check-cert-expired
250

251
pkglib_SCRIPTS = \
252 253
	daemons/daemon-util \
	$(pkglib_python_scripts)
254

255 256
EXTRA_DIST = \
	NEWS \
Michael Hanselmann's avatar
Michael Hanselmann committed
257
	pylintrc \
258
	autotools/build-bash-completion \
259
	autotools/check-python-code \
260
	autotools/check-man \
261
	autotools/docbook-wrapper \
262
	autotools/gen-coverage \
263
	autotools/testrunner \
264
	$(RUN_IN_TEMPDIR) \
265
	daemons/daemon-util.in \
266
	daemons/ganeti-cleaner.in \
267
	$(pkglib_python_scripts) \
268
	devel/upload.in \
269
	$(docdot) \
270
	$(docpng) \
271 272 273
	$(docrst) \
	doc/conf.py \
	doc/html \
274 275
	doc/examples/ganeti.initd.in \
	doc/examples/ganeti.cron.in \
276
	doc/examples/gnt-config-backup.in \
277
	doc/examples/dumb-allocator \
278 279
	doc/examples/ganeti.default \
	doc/examples/ganeti.default-debug \
Guido Trotter's avatar
Guido Trotter committed
280
	doc/examples/hooks/ethers \
Luca Bigliardi's avatar
Luca Bigliardi committed
281
	doc/examples/hooks/ipsec.in \
282 283 284 285 286
	test/testutils.py \
	test/mocks.py \
	$(dist_TESTS) \
	$(TEST_FILES) \
	man/footer.sgml \
287 288
	$(mansgml) \
	$(maninput) \
289
	qa/ganeti-qa.py \
Michael Hanselmann's avatar
Michael Hanselmann committed
290
	qa/qa-sample.json \
291 292 293 294 295 296 297 298
	qa/qa_cluster.py \
	qa/qa_config.py \
	qa/qa_daemon.py \
	qa/qa_env.py \
	qa/qa_error.py \
	qa/qa_instance.py \
	qa/qa_node.py \
	qa/qa_os.py \
Oleksiy Mishchenko's avatar
Oleksiy Mishchenko committed
299
	qa/qa_rapi.py \
300 301 302 303 304
	qa/qa_tags.py \
	qa/qa_utils.py

man_MANS = \
	man/ganeti.7 \
305
	man/ganeti-cleaner.8 \
Guido Trotter's avatar
Guido Trotter committed
306
	man/ganeti-confd.8 \
307
	man/ganeti-masterd.8 \
308 309
	man/ganeti-noded.8 \
	man/ganeti-os-interface.7 \
310
	man/ganeti-rapi.8 \
311 312 313
	man/ganeti-watcher.8 \
	man/gnt-backup.8 \
	man/gnt-cluster.8 \
314
	man/gnt-debug.8 \
315
	man/gnt-instance.8 \
316
	man/gnt-job.8 \
317 318 319
	man/gnt-node.8 \
	man/gnt-os.8

Iustin Pop's avatar
Iustin Pop committed
320 321
mansgml = $(patsubst %.7,%.sgml,$(patsubst %.8,%.sgml,$(man_MANS)))
manhtml = $(patsubst %.sgml,%.html,$(mansgml))
322 323 324
maninput = \
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
	$(patsubst %.html,%.html.in,$(manhtml))
325 326 327

TEST_FILES = \
	test/data/bdev-both.txt \
328
	test/data/bdev-8.3-both.txt \
329 330
	test/data/bdev-disk.txt \
	test/data/bdev-net.txt \
331
	test/data/cert1.pem \
332
	test/data/proc_drbd8.txt \
333
	test/data/proc_drbd80-emptyline.txt \
334 335
	test/data/proc_drbd83.txt \
	test/import-export_unittest-helper
336

337
python_tests = \
338
	test/ganeti.backend_unittest.py \
339 340 341
	test/ganeti.bdev_unittest.py \
	test/ganeti.cli_unittest.py \
	test/ganeti.cmdlib_unittest.py \
342
	test/ganeti.compat_unittest.py \
343
	test/ganeti.confd.client_unittest.py \
344
	test/ganeti.config_unittest.py \
345
	test/ganeti.constants_unittest.py \
346
	test/ganeti.errors_unittest.py \
347
	test/ganeti.hooks_unittest.py \
348
	test/ganeti.http_unittest.py \
349
	test/ganeti.locking_unittest.py \
350
	test/ganeti.luxi_unittest.py \
351
	test/ganeti.masterd.instance_unittest.py \
352
	test/ganeti.mcpu_unittest.py \
353
	test/ganeti.objects_unittest.py \
354
	test/ganeti.opcodes_unittest.py \
David Knowles's avatar
David Knowles committed
355
	test/ganeti.rapi.client_unittest.py \
356
	test/ganeti.rapi.resources_unittest.py \
357
	test/ganeti.rapi.rlib2_unittest.py \
358 359
	test/ganeti.serializer_unittest.py \
	test/ganeti.ssh_unittest.py \
Balazs Lecz's avatar
Balazs Lecz committed
360
	test/ganeti.uidpool_unittest.py \
361
	test/ganeti.utils_unittest.py \
Luca Bigliardi's avatar
Luca Bigliardi committed
362
	test/ganeti.utils_mlockall_unittest.py \
363
	test/ganeti.workerpool_unittest.py \
364 365
	test/docs_unittest.py \
	test/tempfile_fork_unittest.py
366

367
dist_TESTS = \
368
	test/daemon-util_unittest.bash \
369
	test/import-export_unittest.bash \
370
	test/check-cert-expired_unittest.bash \
371 372
	$(python_tests)

373 374 375 376
nodist_TESTS =

TESTS = $(dist_TESTS) $(nodist_TESTS)

377 378 379 380 381
# Environment for all tests
PLAIN_TESTS_ENVIRONMENT = \
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)

# Environment for tests run by automake
382
TESTS_ENVIRONMENT = \
383
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
384

385
all_python_code = \
386 387
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
388
	$(pkglib_python_scripts) \
389
	$(python_tests) \
390 391 392 393 394
	$(pkgpython_PYTHON) \
	$(hypervisor_PYTHON) \
	$(rapi_PYTHON) \
	$(http_PYTHON) \
	$(confd_PYTHON) \
Michael Hanselmann's avatar
Michael Hanselmann committed
395
	$(masterd_PYTHON) \
396 397
	$(noinst_PYTHON)

398 399
srclink_files = \
	man/footer.sgml \
400
	test/daemon-util_unittest.bash \
401
	test/import-export_unittest.bash \
402
	test/check-cert-expired_unittest.bash \
403 404 405
	$(all_python_code)

check_python_code = \
406
	$(BUILD_BASH_COMPLETION) \
407 408
	$(all_python_code)

409
lint_python_code = \
410 411 412
	ganeti \
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
413
	$(pkglib_python_scripts) \
414
	$(BUILD_BASH_COMPLETION)
415

416 417
test/daemon-util_unittest.bash: daemons/daemon-util

418
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
419 420 421
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod u+x $@

422
daemons/%: daemons/%.in \
423 424
		$(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@
425
	chmod +x $@
426

427
doc/examples/%: doc/examples/%.in \
428 429 430
		$(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@

431
doc/examples/hooks/%: doc/examples/hooks/%.in \
Luca Bigliardi's avatar
Luca Bigliardi committed
432 433 434
		$(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@

435
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
436
	lib/cli.py $(gnt_scripts) tools/burnin
437
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
438

439
doc/%.png: doc/%.dot
Iustin Pop's avatar
Iustin Pop committed
440
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
441 442
	$(DOT) -Tpng -o $@ $<

Iustin Pop's avatar
Iustin Pop committed
443
man/%.7.in man/%.8.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
444 445
	@test -n "$(DOCBOOK2MAN)" || \
	  { echo 'docbook2man' not found during configure; exit 1; }
Michael Hanselmann's avatar
Michael Hanselmann committed
446
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2MAN)" $< $(notdir $(@:.in=)) $@
447
	$(CHECK_MAN) $@
Iustin Pop's avatar
Iustin Pop committed
448 449

man/%.html.in: man/%.sgml man/footer.sgml $(DOCBOOK_WRAPPER)
450 451
	@test -n "$(DOCBOOK2HTML)" || \
	  { echo 'docbook2html' not found during configure; exit 1; }
Michael Hanselmann's avatar
Michael Hanselmann committed
452
	$(DOCBOOK_WRAPPER) "$(DOCBOOK2HTML) --nochunks" $< $(notdir $(@:.in=)) $@
Iustin Pop's avatar
Iustin Pop committed
453

454
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
455
	sed -f $(REPLACE_VARS_SED) < $< > $@
456

457
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
458
	sed -f $(REPLACE_VARS_SED) < $< > $@
459

460
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
461
	sed -f $(REPLACE_VARS_SED) < $< > $@
462

463 464 465 466
lib/_autoconf.py: Makefile stamp-directories
	set -e; \
	{ echo '# This file is automatically generated, do not edit!'; \
	  echo '#'; \
Iustin Pop's avatar
Iustin Pop committed
467 468 469 470 471 472 473 474 475
	  echo ''; \
	  echo '"""Build-time configuration for Ganeti.'; \
	  echo '';\
	  echo 'This file is autogenerated by the build process.'; \
	  echo 'For any changes you need to re-run ./configure (and'; \
	  echo 'not edit by hand).'; \
	  echo ''; \
	  echo '"""'; \
	  echo ''; \
476 477 478 479
	  echo '# pylint: disable-msg=C0301,C0324'; \
	  echo '# because this is autogenerated, we do not want'; \
	  echo '# style warnings' ; \
	  echo ''; \
480 481 482 483 484 485 486 487
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
488
	  echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
489 490
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
491
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
492 493 494
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
495
	  echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
496
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
497
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
498 499
	  echo "SOCAT_PATH = '$(SOCAT)'"; \
	  echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
500 501
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
	  echo "TOOLSDIR = '$(toolsdir)'"; \
502
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
503
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
504
	  echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
505
	  echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
506 507
	} > $@

508
$(REPLACE_VARS_SED): Makefile
509 510 511 512
	set -e; \
	{ echo 's#@PREFIX@#$(prefix)#g'; \
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
513
	  echo 's#@BINDIR@#$(bindir)#g'; \
514 515
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
516
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
517 518
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
519
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
520
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
Iustin Pop's avatar
Iustin Pop committed
521
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
522 523 524 525
	} > $@

# We need to create symlinks because "make distcheck" will not install Python
# files when building.
526
stamp-srclinks: Makefile stamp-directories
527
	set -e; \
528
	for i in $(srclink_files); do \
529 530 531 532
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
		fi; \
	done
533
	touch $@
534

Michael Hanselmann's avatar
Michael Hanselmann committed
535 536
.PHONY: ganeti
ganeti:
537
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
Michael Hanselmann's avatar
Michael Hanselmann committed
538

539 540 541
check-local:
	$(CHECK_PYTHON_CODE) $(check_python_code)

Iustin Pop's avatar
Iustin Pop committed
542
.PHONY: lint
543
lint: ganeti $(BUILT_SOURCES)
544 545
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
Iustin Pop's avatar
Iustin Pop committed
546

Iustin Pop's avatar
Iustin Pop committed
547 548
# a dist hook rule for catching revision control directories
distcheck-hook:
549 550 551 552 553 554 555 556 557 558
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
		echo "Found revision control files in final archive." 1>&2; \
		exit 1; \
	fi
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
		echo "Found Python byte code in final archive." 1>&2; \
		exit 1; \
	fi
	if find $(top_distdir) -name '*~' | grep .; then \
		echo "Found backup files in final archive." 1>&2; \
Iustin Pop's avatar
Iustin Pop committed
559 560 561
		exit 1; \
	fi

Iustin Pop's avatar
Iustin Pop committed
562
install-exec-local:
563
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
564 565
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
	  "$(DESTDIR)${localstatedir}/run/ganeti"
566 567 568 569 570

stamp-directories: Makefile
	@mkdir_p@ $(DIRS)
	touch $@

Iustin Pop's avatar
Iustin Pop committed
571
.PHONY: apidoc
572
apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
Iustin Pop's avatar
Iustin Pop committed
573
	test -e doc/api || mkdir doc/api
574 575 576
	$(RUN_IN_TEMPDIR) epydoc -v \
		--conf $(CURDIR)/epydoc.conf \
		--output $(CURDIR)/doc/api
Iustin Pop's avatar
Iustin Pop committed
577

578
.PHONY: TAGS
579
TAGS: $(BUILT_SOURCES)
580 581 582 583 584
	rm -f TAGS
	find . -path './lib/*.py' -o -path 'scripts/gnt-*' -o \
	  -path 'daemons/ganeti-*' -o -path 'tools/*' | \
	  etags -

585
.PHONY: coverage
586
coverage: $(BUILT_SOURCES) $(python_tests)
587 588 589 590 591
	set -e; \
	mkdir -p doc/coverage; \
	COVERAGE_FILE=$(CURDIR)/doc/coverage/data \
	TEXT_COVERAGE=$(CURDIR)/doc/coverage/report.txt \
	HTML_COVERAGE=$(CURDIR)/doc/coverage \
592 593
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
	$(python_tests)
594

Guido Trotter's avatar
Guido Trotter committed
595 596
commit-check: distcheck lint apidoc

597
# vim: set noet :