Makefile.am 24.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 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 23
REPLACE_VARS_SED = autotools/replace_vars.sed

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

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

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

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

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

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

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

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

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

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

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

124 125 126
nodist_pkgpython_PYTHON = \
	lib/_autoconf.py

127 128 129
noinst_PYTHON = \
	lib/build/__init__.py

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

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

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

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

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

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

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

207 208 209
impexpd_PYTHON = \
	lib/impexpd/__init__.py

210 211 212
watcher_PYTHON = \
	lib/watcher/__init__.py

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

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

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

260 261 262
$(RUN_IN_TEMPDIR): | $(all_dirfiles)

doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
263
	$(RUN_IN_TEMPDIR)
264 265
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
266
	@mkdir_p@ $(dir $@)
267
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
268
	    -d . \
269 270
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
271 272 273 274
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

275
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
276

277
doc/install-quick.rst: INSTALL
278
doc/news.rst: NEWS
279
doc/upgrade.rst: UPGRADE
280

281
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
282 283 284 285 286 287 288
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

289
docdot = \
290 291 292
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
293

294
docpng = $(patsubst %.dot,%.png,$(docdot))
295

296 297 298 299 300 301 302 303
# 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 \
304
	doc/examples/ganeti-kvm-poweroff.initd \
305
	doc/examples/gnt-config-backup \
306 307
	doc/examples/hooks/ipsec \
	$(manhtml)
308

309
gnt_scripts = \
310 311 312
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
313
	scripts/gnt-group \
314 315 316 317 318
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

319
PYTHON_BOOTSTRAP = \
320
	daemons/ganeti-confd \
321
	daemons/ganeti-masterd \
322
	daemons/ganeti-noded \
323
	daemons/ganeti-watcher \
324
	daemons/ganeti-rapi \
325
	scripts/gnt-backup \
326
	scripts/gnt-cluster \
327
	scripts/gnt-debug \
328
	scripts/gnt-group \
329
	scripts/gnt-instance \
330
	scripts/gnt-job \
331
	scripts/gnt-node \
332
	scripts/gnt-os
333

334 335 336 337 338 339 340 341 342 343 344 345 346 347
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

348 349
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
350

351
nodist_sbin_SCRIPTS = \
352
	$(PYTHON_BOOTSTRAP) \
353 354
	daemons/ganeti-cleaner

355 356 357 358
dist_tools_SCRIPTS = \
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
359
	tools/cfgupgrade12 \
360
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
361
	tools/lvmstrap \
362
	tools/move-instance \
363
	tools/setup-ssh \
Iustin Pop's avatar
Iustin Pop committed
364
	tools/sanitize-config
365

366
pkglib_python_scripts = \
367 368
	daemons/import-export \
	tools/check-cert-expired
369

370
pkglib_SCRIPTS = \
371
	daemons/daemon-util \
372
	daemons/ensure-dirs \
373
	tools/kvm-ifup \
374
	$(pkglib_python_scripts)
375

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

man_MANS = \
	man/ganeti.7 \
424
	man/ganeti-cleaner.8 \
Guido Trotter's avatar
Guido Trotter committed
425
	man/ganeti-confd.8 \
426
	man/ganeti-listrunner.8 \
427
	man/ganeti-masterd.8 \
428 429
	man/ganeti-noded.8 \
	man/ganeti-os-interface.7 \
430
	man/ganeti-rapi.8 \
431 432 433
	man/ganeti-watcher.8 \
	man/gnt-backup.8 \
	man/gnt-cluster.8 \
434
	man/gnt-debug.8 \
435
	man/gnt-group.8 \
436
	man/gnt-instance.8 \
437
	man/gnt-job.8 \
438 439 440
	man/gnt-node.8 \
	man/gnt-os.8

Iustin Pop's avatar
Iustin Pop committed
441 442
manrst = $(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS)))
manhtml = $(patsubst %.rst,%.html,$(manrst))
443 444
maninput = \
	$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
Iustin Pop's avatar
Iustin Pop committed
445
	$(patsubst %.html,%.html.in,$(manhtml)) \
Iustin Pop's avatar
Iustin Pop committed
446
	man/footer.man man/footer.html
447 448

TEST_FILES = \
Manuel Franceschini's avatar
Manuel Franceschini committed
449 450 451 452 453
	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 \
454
	test/data/cert1.pem \
455
	test/data/proc_drbd8.txt \
456
	test/data/proc_drbd80-emptyline.txt \
457
	test/data/proc_drbd83.txt \
458
	test/data/sys_drbd_usermode_helper.txt \
459
	test/import-export_unittest-helper
460

461
python_tests = \
Guido Trotter's avatar
Guido Trotter committed
462
	test/ganeti.asyncnotifier_unittest.py \
463
	test/ganeti.backend_unittest.py \
464 465
	test/ganeti.bdev_unittest.py \
	test/ganeti.cli_unittest.py \
466
	test/ganeti.client.gnt_instance_unittest.py \
Guido Trotter's avatar
Guido Trotter committed
467
	test/ganeti.daemon_unittest.py \
468
	test/ganeti.cmdlib_unittest.py \
469
	test/ganeti.compat_unittest.py \
470
	test/ganeti.confd.client_unittest.py \
471
	test/ganeti.config_unittest.py \
472
	test/ganeti.constants_unittest.py \
473
	test/ganeti.errors_unittest.py \
474
	test/ganeti.hooks_unittest.py \
475
	test/ganeti.ht_unittest.py \
476
	test/ganeti.http_unittest.py \
477
	test/ganeti.hypervisor_unittest.py \
478 479
	test/ganeti.hypervisor.hv_chroot_unittest.py \
	test/ganeti.hypervisor.hv_fake_unittest.py \
480
	test/ganeti.hypervisor.hv_kvm_unittest.py \
481 482
	test/ganeti.hypervisor.hv_lxc_unittest.py \
	test/ganeti.hypervisor.hv_xen_unittest.py \
483
	test/ganeti.impexpd_unittest.py \
484
	test/ganeti.jqueue_unittest.py \
485
	test/ganeti.locking_unittest.py \
486
	test/ganeti.luxi_unittest.py \
487
	test/ganeti.masterd.instance_unittest.py \
488
	test/ganeti.mcpu_unittest.py \
489
	test/ganeti.netutils_unittest.py \
490
	test/ganeti.objects_unittest.py \
491
	test/ganeti.opcodes_unittest.py \
492
	test/ganeti.qlang_unittest.py \
493
	test/ganeti.query_unittest.py \
494
	test/ganeti.rapi.baserlib_unittest.py \
David Knowles's avatar
David Knowles committed
495
	test/ganeti.rapi.client_unittest.py \
496
	test/ganeti.rapi.resources_unittest.py \
497
	test/ganeti.rapi.rlib2_unittest.py \
498
	test/ganeti.rpc_unittest.py \
499
	test/ganeti.runtime_unittest.py \
500 501
	test/ganeti.serializer_unittest.py \
	test/ganeti.ssh_unittest.py \
Balazs Lecz's avatar
Balazs Lecz committed
502
	test/ganeti.uidpool_unittest.py \
503
	test/ganeti.utils.algo_unittest.py \
504
	test/ganeti.utils.filelock_unittest.py \
505
	test/ganeti.utils.hash_unittest.py \
506
	test/ganeti.utils.io_unittest.py \
507
	test/ganeti.utils.mlock_unittest.py \
508
	test/ganeti.utils.nodesetup_unittest.py \
509
	test/ganeti.utils.process_unittest.py \
510
	test/ganeti.utils.retry_unittest.py \
511
	test/ganeti.utils.text_unittest.py \
512
	test/ganeti.utils.wrapper_unittest.py \
513
	test/ganeti.utils.x509_unittest.py \
514
	test/ganeti.utils_unittest.py \
515
	test/ganeti.workerpool_unittest.py \
516
	test/cfgupgrade_unittest.py \
517 518
	test/docs_unittest.py \
	test/tempfile_fork_unittest.py
519

520
dist_TESTS = \
521
	test/check-cert-expired_unittest.bash \
522
	test/daemon-util_unittest.bash \
523
	test/ganeti-cleaner_unittest.bash \
524
	test/import-export_unittest.bash \
525 526
	$(python_tests)

527 528 529 530
nodist_TESTS =

TESTS = $(dist_TESTS) $(nodist_TESTS)

531 532 533 534 535
# Environment for all tests
PLAIN_TESTS_ENVIRONMENT = \
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)

# Environment for tests run by automake
536
TESTS_ENVIRONMENT = \
537
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
538

539
all_python_code = \
540 541
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
542
	$(pkglib_python_scripts) \
543
	$(python_tests) \
544
	$(pkgpython_PYTHON) \
545
	$(client_PYTHON) \
546 547
	$(hypervisor_PYTHON) \
	$(rapi_PYTHON) \
548
	$(server_PYTHON) \
549 550
	$(http_PYTHON) \
	$(confd_PYTHON) \
Michael Hanselmann's avatar
Michael Hanselmann committed
551
	$(masterd_PYTHON) \
552
	$(impexpd_PYTHON) \
553
	$(utils_PYTHON) \
554
	$(watcher_PYTHON) \
555 556
	$(noinst_PYTHON) \
	$(qa_scripts)
557

558
srclink_files = \
Iustin Pop's avatar
Iustin Pop committed
559
	man/footer.rst \
560
	test/check-cert-expired_unittest.bash \
561
	test/daemon-util_unittest.bash \
562
	test/ganeti-cleaner_unittest.bash \
563
	test/import-export_unittest.bash \
564 565 566
	$(all_python_code)

check_python_code = \
567
	$(BUILD_BASH_COMPLETION) \
568 569
	$(all_python_code)

570
lint_python_code = \
571
	ganeti \
572
	ganeti/http/server.py \
573 574
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
575
	$(pkglib_python_scripts) \
576 577
	$(BUILD_BASH_COMPLETION) \
	$(PYTHON_BOOTSTRAP)
578

579 580
test/daemon-util_unittest.bash: daemons/daemon-util

581 582
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner

583 584 585 586
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod +x $@

587
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
588 589 590
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod u+x $@

591
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
592
	sed -f $(REPLACE_VARS_SED) < $< > $@
593
	chmod +x $@
594

595
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
596 597
	sed -f $(REPLACE_VARS_SED) < $< > $@

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

601
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
602
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
603
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
604

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

Iustin Pop's avatar
Iustin Pop committed
609 610 611 612 613
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
614 615 616 617 618 619 620 621
man/footer.html: man/footer.rst
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
	$(PANDOC) -f rst -t html -o $@ $<

man/%.7.in man/%.8.in: man/%.rst man/footer.man
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
622
	set -o pipefail ; \
Iustin Pop's avatar
Iustin Pop committed
623 624
	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
	  sed -e 's/\\@/@/g' > $@
625
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
Iustin Pop's avatar
Iustin Pop committed
626

Iustin Pop's avatar
Iustin Pop committed
627 628 629
man/%.html.in: man/%.rst man/footer.html
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
630
	set -o pipefail ; \
Iustin Pop's avatar
Iustin Pop committed
631 632 633
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
	  sed -e 's/\\@/@/g' > $@

634
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
635
	sed -f $(REPLACE_VARS_SED) < $< > $@
636

637
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
638
	sed -f $(REPLACE_VARS_SED) < $< > $@
639

640
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
641
	sed -f $(REPLACE_VARS_SED) < $< > $@
642

643 644 645
epydoc.conf: epydoc.conf.in
	sed -e 's#@MODULES@#$(lint_python_code)#g' < $< > $@

646 647 648 649 650 651 652 653 654
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:
655
	set -e; \
656 657 658 659 660 661
	cd $(srcdir); \
	if test -d .git; then \
	  rm -f vcs-version; \
	  $(MAKE) vcs-version; \
	fi

662
lib/_autoconf.py: Makefile vcs-version | lib/.dir
663 664
	set -e; \
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
665 666
	{ echo '# This file is automatically generated, do not edit!'; \
	  echo '#'; \
Iustin Pop's avatar
Iustin Pop committed
667 668 669 670 671 672 673 674 675
	  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 ''; \
676 677 678 679
	  echo '# pylint: disable-msg=C0301,C0324'; \
	  echo '# because this is autogenerated, we do not want'; \
	  echo '# style warnings' ; \
	  echo ''; \
680 681 682 683 684 685 686 687
	  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)'"; \
688
	  echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
689 690
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
691
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
692 693 694
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
695
	  echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
696
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
697
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
698 699
	  echo "SOCAT_PATH = '$(SOCAT)'"; \
	  echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
700
	  echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
701 702
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
	  echo "TOOLSDIR = '$(toolsdir)'"; \
703
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
704
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
705
	  echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
706
	  echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
707
	  echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
708
	  echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
709
	  echo "MASTERD_USER = '$(MASTERD_USER)'"; \
710
	  echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
711
	  echo "RAPI_USER = '$(RAPI_USER)'"; \
712 713 714 715
	  echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
	  echo "CONFD_USER = '$(CONFD_USER)'"; \
	  echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
	  echo "NODED_USER = '$(NODED_USER)'"; \
716
	  echo "VCS_VERSION = '$$VCSVER'"; \
717
	  echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
718 719
	} > $@

720
$(REPLACE_VARS_SED): Makefile
721 722 723 724
	set -e; \
	{ echo 's#@PREFIX@#$(prefix)#g'; \
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
725
	  echo 's#@BINDIR@#$(bindir)#g'; \
726 727
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
728
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
729 730
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
Iustin Pop's avatar
Iustin Pop committed
731 732
	  echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
	  echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
733
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
734
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
Iustin Pop's avatar
Iustin Pop committed
735
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
736 737 738 739 740 741 742 743
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \