Makefile.am 25.2 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 13 14
# Use bash in order to be able to use pipefail
SHELL=/bin/bash

15
ACLOCAL_AMFLAGS = -I autotools
16
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
17
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
18
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
19
CHECK_MAN = $(top_srcdir)/autotools/check-man
20
CHECK_VERSION = $(top_srcdir)/autotools/check-version
21
CHECK_NEWS = $(top_srcdir)/autotools/check-news
22
DOCPP = $(top_srcdir)/autotools/docpp
23 24
REPLACE_VARS_SED = autotools/replace_vars.sed

25
clientdir = $(pkgpythondir)/client
26
hypervisordir = $(pkgpythondir)/hypervisor
27
httpdir = $(pkgpythondir)/http
Michael Hanselmann's avatar
Michael Hanselmann committed
28
masterddir = $(pkgpythondir)/masterd
Guido Trotter's avatar
Guido Trotter committed
29
confddir = $(pkgpythondir)/confd
30
rapidir = $(pkgpythondir)/rapi
31
serverdir = $(pkgpythondir)/server
32
watcherdir = $(pkgpythondir)/watcher
33
impexpddir = $(pkgpythondir)/impexpd
34
utilsdir = $(pkgpythondir)/utils
35 36 37
toolsdir = $(pkglibdir)/tools
docdir = $(datadir)/doc/$(PACKAGE)

38 39 40
# Delete output file if an error occurred while building it
.DELETE_ON_ERROR:

41 42 43 44 45 46
DIRS = \
	autotools \
	daemons \
	devel \
	doc \
	doc/examples \
Guido Trotter's avatar
Guido Trotter committed
47
	doc/examples/hooks \
48
	doc/examples/gnt-debug \
49
	lib \
50
	lib/client \
51
	lib/build \
52
	lib/confd \
53
	lib/http \
54
	lib/hypervisor \
55
	lib/impexpd \
Michael Hanselmann's avatar
Michael Hanselmann committed
56
	lib/masterd \
57
	lib/rapi \
58
	lib/server \
59
	lib/utils \
60
	lib/watcher \
61 62 63 64 65 66
	man \
	qa \
	test \
	test/data \
	tools

67
BUILDTIME_DIR_AUTOCREATE = \
68
	scripts \
69
	doc/api \
70 71 72 73
	doc/coverage

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
74 75 76 77 78 79 80
	doc/html

DIRCHECK_EXCLUDE = \
	$(BUILDTIME_DIRS) \
	ganeti-[0-9]*.[0-9]*.[0-9]* \
	doc/html/_*

81
all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
82

Iustin Pop's avatar
Iustin Pop committed
83
MAINTAINERCLEANFILES = \
84
	$(docpng) \
85
	$(maninput) \
86
	doc/install-quick.rst \
87
	doc/news.rst \
88
	doc/upgrade.rst \
89
	vcs-version
Iustin Pop's avatar
Iustin Pop committed
90

91
maintainer-clean-local:
92
	rm -rf $(BUILDTIME_DIRS)
93

94
CLEANFILES = \
95
	$(addsuffix /*.py[co],$(DIRS)) \
96
	$(all_dirfiles) \
97
	$(PYTHON_BOOTSTRAP) \
98
	epydoc.conf \
99
	autotools/replace_vars.sed \
100
	daemons/daemon-util \
101
	daemons/ensure-dirs \
102
	daemons/ganeti-cleaner \
103
	devel/upload \
104
	doc/examples/bash_completion \
105
	doc/examples/ganeti.initd \
106
	doc/examples/ganeti-kvm-poweroff.initd \
107
	doc/examples/ganeti.cron \
108
	doc/examples/gnt-config-backup \
Luca Bigliardi's avatar
Luca Bigliardi committed
109
	doc/examples/hooks/ipsec \
Iustin Pop's avatar
Iustin Pop committed
110 111
	$(man_MANS) \
	$(manhtml) \
112
	tools/kvm-ifup \
113
	stamp-srclinks \
114 115
	$(nodist_pkgpython_PYTHON)

116 117
# BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
# it'll cause the target to rebuild every time.
118 119
BUILT_SOURCES = \
	ganeti \
120
	stamp-srclinks \
121
	lib/_autoconf.py \
122
	$(all_dirfiles) \
123 124
	$(PYTHON_BOOTSTRAP)

125 126 127
nodist_pkgpython_PYTHON = \
	lib/_autoconf.py

128
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
129 130
	lib/build/__init__.py \
	lib/build/sphinx_ext.py
131

132 133
pkgpython_PYTHON = \
	lib/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
134
	lib/asyncnotifier.py \
135 136 137 138 139
	lib/backend.py \
	lib/bdev.py \
	lib/bootstrap.py \
	lib/cli.py \
	lib/cmdlib.py \
140
	lib/compat.py \
141 142
	lib/config.py \
	lib/constants.py \
143
	lib/daemon.py \
144
	lib/errors.py \
145
	lib/ht.py \
146
	lib/jqueue.py \
147
	lib/jstore.py \
148 149 150
	lib/locking.py \
	lib/luxi.py \
	lib/mcpu.py \
151
	lib/netutils.py \
152 153
	lib/objects.py \
	lib/opcodes.py \
154
	lib/qlang.py \
155
	lib/query.py \
156
	lib/rpc.py \
157
	lib/runtime.py \
158 159 160
	lib/serializer.py \
	lib/ssconf.py \
	lib/ssh.py \
161
	lib/storage.py \
162
	lib/uidpool.py \
163
	lib/workerpool.py
164

165
client_PYTHON = \
166
	lib/client/__init__.py \
167
	lib/client/gnt_backup.py \
168
	lib/client/gnt_cluster.py \
169
	lib/client/gnt_debug.py \
170
	lib/client/gnt_group.py \
171
	lib/client/gnt_instance.py \
172
	lib/client/gnt_job.py \
173
	lib/client/gnt_node.py \
174
	lib/client/gnt_os.py
175

176 177 178
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
179
	lib/hypervisor/hv_chroot.py \
180
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
181
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
182
	lib/hypervisor/hv_lxc.py \
183 184
	lib/hypervisor/hv_xen.py

185 186
rapi_PYTHON = \
	lib/rapi/__init__.py \
187
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
188
	lib/rapi/client.py \
189
	lib/rapi/client_utils.py \
190 191
	lib/rapi/connector.py \
	lib/rapi/rlib2.py
192

193
http_PYTHON = \
194
	lib/http/__init__.py \
195
	lib/http/auth.py \
196 197
	lib/http/client.py \
	lib/http/server.py
198

Guido Trotter's avatar
Guido Trotter committed
199
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
200
	lib/confd/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
201
	lib/confd/client.py \
202 203
	lib/confd/querylib.py \
	lib/confd/server.py
204

Michael Hanselmann's avatar
Michael Hanselmann committed
205
masterd_PYTHON = \
206 207
	lib/masterd/__init__.py \
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
208

209 210 211
impexpd_PYTHON = \
	lib/impexpd/__init__.py

212 213 214
watcher_PYTHON = \
	lib/watcher/__init__.py

215
server_PYTHON = \
216
	lib/server/__init__.py \
217
	lib/server/confd.py \
218
	lib/server/masterd.py \
219 220
	lib/server/noded.py \
	lib/server/rapi.py
221

222
utils_PYTHON = \
223
	lib/utils/__init__.py \
224
	lib/utils/algo.py \
225
	lib/utils/filelock.py \
226
	lib/utils/hash.py \
227
	lib/utils/io.py \
228
	lib/utils/log.py \
229
	lib/utils/mlock.py \
230
	lib/utils/nodesetup.py \
231
	lib/utils/process.py \
232
	lib/utils/retry.py \
233
	lib/utils/text.py \
234 235
	lib/utils/wrapper.py \
	lib/utils/x509.py
236

Michael Hanselmann's avatar
Michael Hanselmann committed
237
docrst = \
238
	doc/admin.rst \
239
	doc/design-2.0.rst \
240
	doc/design-2.1.rst \
241
	doc/design-2.2.rst \
Guido Trotter's avatar
Guido Trotter committed
242
	doc/design-2.3.rst \
243
	doc/design-2.4.rst \
244
	doc/design-draft.rst \
245
	doc/design-oob.rst \
246
	doc/design-query2.rst \
247
	doc/cluster-merge.rst \
248
	doc/design-shared-storage.rst \
249
	doc/devnotes.rst \
250
	doc/glossary.rst \
251
	doc/hooks.rst \
252
	doc/iallocator.rst \
253
	doc/index.rst \
254
	doc/install-quick.rst \
255
	doc/install.rst \
256
	doc/locking.rst \
257
	doc/move-instance.rst \
Iustin Pop's avatar
Iustin Pop committed
258
	doc/news.rst \
259
	doc/rapi.rst \
260
	doc/security.rst \
261
	doc/upgrade.rst \
Iustin Pop's avatar
Iustin Pop committed
262
	doc/walkthrough.rst
Michael Hanselmann's avatar
Michael Hanselmann committed
263

264 265
$(RUN_IN_TEMPDIR): | $(all_dirfiles)

Iustin Pop's avatar
Iustin Pop committed
266 267 268 269 270
# Note: we use here an order-only prerequisite, as the contents of
# _autoconf.py are not actually influencing the html build output: it
# has to exist in order for the sphinx module to be loaded
# successfully, but we certainly don't want the docs to be rebuilt if
# it changes
271
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
Iustin Pop's avatar
Iustin Pop committed
272 273
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
	| lib/_autoconf.py
274 275
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
276
	@mkdir_p@ $(dir $@)
277
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
278
	    -d . \
279 280
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
281 282 283 284
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

285
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
286

287
doc/install-quick.rst: INSTALL
288
doc/news.rst: NEWS
289
doc/upgrade.rst: UPGRADE
290

291
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
292 293 294 295 296 297 298
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

299
docdot = \
300 301 302
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
303

304
docpng = $(patsubst %.dot,%.png,$(docdot))
305

306 307 308 309 310 311 312 313
# 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 \
314
	doc/examples/ganeti-kvm-poweroff.initd \
315
	doc/examples/gnt-config-backup \
316 317
	doc/examples/hooks/ipsec \
	$(manhtml)
318

319
gnt_scripts = \
320 321 322
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
323
	scripts/gnt-group \
324 325 326 327 328
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

329
PYTHON_BOOTSTRAP = \
330
	daemons/ganeti-confd \
331
	daemons/ganeti-masterd \
332
	daemons/ganeti-noded \
333
	daemons/ganeti-watcher \
334
	daemons/ganeti-rapi \
335
	scripts/gnt-backup \
336
	scripts/gnt-cluster \
337
	scripts/gnt-debug \
338
	scripts/gnt-group \
339
	scripts/gnt-instance \
340
	scripts/gnt-job \
341
	scripts/gnt-node \
342
	scripts/gnt-os
343

344 345 346 347 348 349 350 351 352 353 354 355 356 357
qa_scripts = \
	qa/ganeti-qa.py \
	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 \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

358 359
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
360

361
nodist_sbin_SCRIPTS = \
362
	$(PYTHON_BOOTSTRAP) \
363 364
	daemons/ganeti-cleaner

365 366 367 368
dist_tools_SCRIPTS = \
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
369
	tools/cfgupgrade12 \
370
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
371
	tools/lvmstrap \
372
	tools/move-instance \
373
	tools/setup-ssh \
Iustin Pop's avatar
Iustin Pop committed
374
	tools/sanitize-config
375

376
pkglib_python_scripts = \
377 378
	daemons/import-export \
	tools/check-cert-expired
379

380
pkglib_SCRIPTS = \
381
	daemons/daemon-util \
382
	daemons/ensure-dirs \
383
	tools/kvm-ifup \
384
	$(pkglib_python_scripts)
385

386 387
EXTRA_DIST = \
	NEWS \
388
	UPGRADE \
389
	epydoc.conf.in \
Michael Hanselmann's avatar
Michael Hanselmann committed
390
	pylintrc \
391
	autotools/build-bash-completion \
392
	autotools/check-python-code \
393
	autotools/check-man \
394
	autotools/check-news \
395
	autotools/check-tar \
396
	autotools/check-version \
397
	autotools/docpp \
398
	autotools/gen-coverage \
399
	autotools/testrunner \
400
	$(RUN_IN_TEMPDIR) \
401
	daemons/daemon-util.in \
402
	daemons/ensure-dirs.in \
403
	daemons/ganeti-cleaner.in \
404
	$(pkglib_python_scripts) \
405
	devel/upload.in \
406
	tools/kvm-ifup.in \
407
	$(docdot) \
408
	$(docpng) \
409 410 411
	$(docrst) \
	doc/conf.py \
	doc/html \
412
	doc/examples/ganeti.initd.in \
413
	doc/examples/ganeti-kvm-poweroff.initd.in \
414
	doc/examples/ganeti.cron.in \
415
	doc/examples/gnt-config-backup.in \
416 417
	doc/examples/ganeti.default \
	doc/examples/ganeti.default-debug \
Guido Trotter's avatar
Guido Trotter committed
418
	doc/examples/hooks/ethers \
Luca Bigliardi's avatar
Luca Bigliardi committed
419
	doc/examples/hooks/ipsec.in \
420 421 422
	doc/examples/gnt-debug/README \
	doc/examples/gnt-debug/delay0.json \
	doc/examples/gnt-debug/delay50.json \
423 424 425 426
	test/testutils.py \
	test/mocks.py \
	$(dist_TESTS) \
	$(TEST_FILES) \
Iustin Pop's avatar
Iustin Pop committed
427 428
	man/footer.rst \
	$(manrst) \
429
	$(maninput) \
Michael Hanselmann's avatar
Michael Hanselmann committed
430
	qa/qa-sample.json \
431
	$(qa_scripts)
432 433 434

man_MANS = \
	man/ganeti.7 \
435
	man/ganeti-cleaner.8 \
Guido Trotter's avatar
Guido Trotter committed
436
	man/ganeti-confd.8 \
437
	man/ganeti-listrunner.8 \
438
	man/ganeti-masterd.8 \
439 440
	man/ganeti-noded.8 \
	man/ganeti-os-interface.7 \
441
	man/ganeti-rapi.8 \
442 443 444
	man/ganeti-watcher.8 \
	man/gnt-backup.8 \
	man/gnt-cluster.8 \
445
	man/gnt-debug.8 \
446
	man/gnt-group.8 \
447
	man/gnt-instance.8 \
448
	man/gnt-job.8 \
449
	man/gnt-node.8 \
450 451 452 453 454
	man/gnt-os.8 \
	man/hail.1 \
	man/hbal.1 \
	man/hscan.1 \
	man/hspace.1
455

456
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
Iustin Pop's avatar
Iustin Pop committed
457
manhtml = $(patsubst %.rst,%.html,$(manrst))
458
mangen = $(patsubst %.rst,%.gen,$(manrst))
459
maninput = \
460
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
Iustin Pop's avatar
Iustin Pop committed
461
	$(patsubst %.html,%.html.in,$(manhtml)) \
462
	man/footer.man man/footer.html $(mangen)
463 464

TEST_FILES = \
Manuel Franceschini's avatar
Manuel Franceschini committed
465 466 467 468 469
	test/data/bdev-drbd-8.0.txt \
	test/data/bdev-drbd-8.3.txt \
	test/data/bdev-drbd-disk.txt \
	test/data/bdev-drbd-net-ip4.txt \
	test/data/bdev-drbd-net-ip6.txt \
470
	test/data/cert1.pem \
471
	test/data/proc_drbd8.txt \
472
	test/data/proc_drbd80-emptyline.txt \
473
	test/data/proc_drbd83.txt \
474
	test/data/sys_drbd_usermode_helper.txt \
475
	test/import-export_unittest-helper
476

477
python_tests = \
Guido Trotter's avatar
Guido Trotter committed
478
	test/ganeti.asyncnotifier_unittest.py \
479
	test/ganeti.backend_unittest.py \
480 481
	test/ganeti.bdev_unittest.py \
	test/ganeti.cli_unittest.py \
René Nussbaumer's avatar
René Nussbaumer committed
482
	test/ganeti.client.gnt_cluster_unittest.py \
483
	test/ganeti.client.gnt_instance_unittest.py \
Guido Trotter's avatar
Guido Trotter committed
484
	test/ganeti.daemon_unittest.py \
485
	test/ganeti.cmdlib_unittest.py \
486
	test/ganeti.compat_unittest.py \
487
	test/ganeti.confd.client_unittest.py \
488
	test/ganeti.config_unittest.py \
489
	test/ganeti.constants_unittest.py \
490
	test/ganeti.errors_unittest.py \
491
	test/ganeti.hooks_unittest.py \
492
	test/ganeti.ht_unittest.py \
493
	test/ganeti.http_unittest.py \
494
	test/ganeti.hypervisor_unittest.py \
495 496
	test/ganeti.hypervisor.hv_chroot_unittest.py \
	test/ganeti.hypervisor.hv_fake_unittest.py \
497
	test/ganeti.hypervisor.hv_kvm_unittest.py \
498 499
	test/ganeti.hypervisor.hv_lxc_unittest.py \
	test/ganeti.hypervisor.hv_xen_unittest.py \
500
	test/ganeti.impexpd_unittest.py \
501
	test/ganeti.jqueue_unittest.py \
502
	test/ganeti.locking_unittest.py \
503
	test/ganeti.luxi_unittest.py \
504
	test/ganeti.masterd.instance_unittest.py \
505
	test/ganeti.mcpu_unittest.py \
506
	test/ganeti.netutils_unittest.py \
507
	test/ganeti.objects_unittest.py \
508
	test/ganeti.opcodes_unittest.py \
509
	test/ganeti.qlang_unittest.py \
510
	test/ganeti.query_unittest.py \
511
	test/ganeti.rapi.baserlib_unittest.py \
David Knowles's avatar
David Knowles committed
512
	test/ganeti.rapi.client_unittest.py \
513
	test/ganeti.rapi.resources_unittest.py \
514
	test/ganeti.rapi.rlib2_unittest.py \
515
	test/ganeti.rpc_unittest.py \
516
	test/ganeti.runtime_unittest.py \
517 518
	test/ganeti.serializer_unittest.py \
	test/ganeti.ssh_unittest.py \
Balazs Lecz's avatar
Balazs Lecz committed
519
	test/ganeti.uidpool_unittest.py \
520
	test/ganeti.utils.algo_unittest.py \
521
	test/ganeti.utils.filelock_unittest.py \
522
	test/ganeti.utils.hash_unittest.py \
523
	test/ganeti.utils.io_unittest.py \
524
	test/ganeti.utils.log_unittest.py \
525
	test/ganeti.utils.mlock_unittest.py \
526
	test/ganeti.utils.nodesetup_unittest.py \
527
	test/ganeti.utils.process_unittest.py \
528
	test/ganeti.utils.retry_unittest.py \
529
	test/ganeti.utils.text_unittest.py \
530
	test/ganeti.utils.wrapper_unittest.py \
531
	test/ganeti.utils.x509_unittest.py \
532
	test/ganeti.utils_unittest.py \
533
	test/ganeti.workerpool_unittest.py \
534
	test/cfgupgrade_unittest.py \
535 536
	test/docs_unittest.py \
	test/tempfile_fork_unittest.py
537

538
dist_TESTS = \
539
	test/check-cert-expired_unittest.bash \
540
	test/daemon-util_unittest.bash \
541
	test/ganeti-cleaner_unittest.bash \
542
	test/import-export_unittest.bash \
543 544
	$(python_tests)

545 546 547 548
nodist_TESTS =

TESTS = $(dist_TESTS) $(nodist_TESTS)

549 550 551 552 553
# Environment for all tests
PLAIN_TESTS_ENVIRONMENT = \
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)

# Environment for tests run by automake
554
TESTS_ENVIRONMENT = \
555
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
556

557
all_python_code = \
558 559
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
560
	$(pkglib_python_scripts) \
561
	$(python_tests) \
562
	$(pkgpython_PYTHON) \
563
	$(client_PYTHON) \
564 565
	$(hypervisor_PYTHON) \
	$(rapi_PYTHON) \
566
	$(server_PYTHON) \
567 568
	$(http_PYTHON) \
	$(confd_PYTHON) \
Michael Hanselmann's avatar
Michael Hanselmann committed
569
	$(masterd_PYTHON) \
570
	$(impexpd_PYTHON) \
571
	$(utils_PYTHON) \
572
	$(watcher_PYTHON) \
573 574
	$(noinst_PYTHON) \
	$(qa_scripts)
575

576
srclink_files = \
Iustin Pop's avatar
Iustin Pop committed
577
	man/footer.rst \
578
	test/check-cert-expired_unittest.bash \
579
	test/daemon-util_unittest.bash \
580
	test/ganeti-cleaner_unittest.bash \
581
	test/import-export_unittest.bash \
582 583 584
	$(all_python_code)

check_python_code = \
585
	$(BUILD_BASH_COMPLETION) \
586
	$(DOCPP) \
587 588
	$(all_python_code)

589
lint_python_code = \
590
	ganeti \
591
	ganeti/http/server.py \
592 593
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
594
	$(pkglib_python_scripts) \
595
	$(BUILD_BASH_COMPLETION) \
596
	$(DOCPP) \
597
	$(PYTHON_BOOTSTRAP)
598

599 600
test/daemon-util_unittest.bash: daemons/daemon-util

601 602
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner

603 604 605 606
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod +x $@

607
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
608 609 610
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod u+x $@

611
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
612
	sed -f $(REPLACE_VARS_SED) < $< > $@
613
	chmod +x $@
614

615
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
616 617
	sed -f $(REPLACE_VARS_SED) < $< > $@

618
doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
Luca Bigliardi's avatar
Luca Bigliardi committed
619 620
	sed -f $(REPLACE_VARS_SED) < $< > $@

621
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
622
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
623
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
624

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

Iustin Pop's avatar
Iustin Pop committed
629 630 631 632 633
man/footer.man: man/footer.rst
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
	$(PANDOC) -f rst -t man -o $@ $<

Iustin Pop's avatar
Iustin Pop committed
634 635 636 637 638
man/footer.html: man/footer.rst
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
	$(PANDOC) -f rst -t html -o $@ $<

639 640 641
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@

642
man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
Iustin Pop's avatar
Iustin Pop committed
643 644
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
645
	set -o pipefail ; \
Iustin Pop's avatar
Iustin Pop committed
646 647
	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
	  sed -e 's/\\@/@/g' > $@
648
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
Iustin Pop's avatar
Iustin Pop committed
649

650
man/%.html.in: man/%.gen man/footer.html
Iustin Pop's avatar
Iustin Pop committed
651 652
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
653
	set -o pipefail ; \
Iustin Pop's avatar
Iustin Pop committed
654 655 656
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
	  sed -e 's/\\@/@/g' > $@

657 658 659
man/%.1: man/%.1.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@

660
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
661
	sed -f $(REPLACE_VARS_SED) < $< > $@
662

663
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
664
	sed -f $(REPLACE_VARS_SED) < $< > $@
665

666
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
667
	sed -f $(REPLACE_VARS_SED) < $< > $@
668

669 670
epydoc.conf: epydoc.conf.in Makefile
	sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
671

672 673 674 675 676 677 678 679 680
vcs-version:
	if test -d .git; then \
	  git describe > $@; \
	elif test ! -f $@ ; then \
	  echo "Cannot auto-generate $@ file"; exit 1; \
	fi

.PHONY: regen-vcs-version
regen-vcs-version:
681
	set -e; \
682 683 684 685 686 687
	cd $(srcdir); \
	if test -d .git; then \
	  rm -f vcs-version; \
	  $(MAKE) vcs-version; \
	fi

688
lib/_autoconf.py: Makefile vcs-version | lib/.dir
689 690
	set -e; \
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
691 692
	{ echo '# This file is automatically generated, do not edit!'; \
	  echo '#'; \
Iustin Pop's avatar
Iustin Pop committed
693 694 695 696 697 698 699 700 701
	  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 ''; \
702 703 704 705
	  echo '# pylint: disable-msg=C0301,C0324'; \
	  echo '# because this is autogenerated, we do not want'; \
	  echo '# style warnings' ; \
	  echo ''; \
706 707 708 709 710 711 712 713
	  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)'"; \
714
	  echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
715 716
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
717
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
718 719 720
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
721
	  echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
722 723
	  echo "SHARED_FILE_STORAGE_DIR = '$(SHARED_FILE_STORAGE_DIR)'"; \
	  echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \
724
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
725
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
726 727
	  echo "SOCAT_PATH = '$(SOCAT)'"; \
	  echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
728
	  echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
729 730
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
	  echo "TOOLSDIR = '$(toolsdir)'"; \
731
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
732
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \