Makefile.am 24 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
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
14
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
15
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
16
CHECK_MAN = $(top_srcdir)/autotools/check-man
17
CHECK_VERSION = $(top_srcdir)/autotools/check-version
18
CHECK_NEWS = $(top_srcdir)/autotools/check-news
19 20
REPLACE_VARS_SED = autotools/replace_vars.sed

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

34 35 36
# Delete output file if an error occurred while building it
.DELETE_ON_ERROR:

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

63
BUILDTIME_DIR_AUTOCREATE = \
64
	scripts \
65
	doc/api \
66 67 68 69
	doc/coverage

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
70 71 72 73 74 75 76
	doc/html

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

77
all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
78

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

87
maintainer-clean-local:
88
	rm -rf $(BUILDTIME_DIRS)
89

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

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

121 122 123
nodist_pkgpython_PYTHON = \
	lib/_autoconf.py

124 125 126
noinst_PYTHON = \
	lib/build/__init__.py

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

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

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

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

188
http_PYTHON = \
189
	lib/http/__init__.py \
190
	lib/http/auth.py \
191 192
	lib/http/client.py \
	lib/http/server.py
193

Guido Trotter's avatar
Guido Trotter committed
194
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
195
	lib/confd/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
196
	lib/confd/client.py \
197 198
	lib/confd/querylib.py \
	lib/confd/server.py
199

Michael Hanselmann's avatar
Michael Hanselmann committed
200
masterd_PYTHON = \
201 202
	lib/masterd/__init__.py \
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
203

204 205 206
impexpd_PYTHON = \
	lib/impexpd/__init__.py

207 208 209
watcher_PYTHON = \
	lib/watcher/__init__.py

210
server_PYTHON = \
211
	lib/server/__init__.py \
212
	lib/server/confd.py \
213
	lib/server/masterd.py \
214 215
	lib/server/noded.py \
	lib/server/rapi.py
216

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

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

257 258 259
$(RUN_IN_TEMPDIR): | $(all_dirfiles)

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

272
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
273

274
doc/install-quick.rst: INSTALL
275
doc/news.rst: NEWS
276
doc/upgrade.rst: UPGRADE
277

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

286
docdot = \
287 288 289
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
290

291
docpng = $(patsubst %.dot,%.png,$(docdot))
292

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

306
gnt_scripts = \
307 308 309
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
310
	scripts/gnt-group \
311 312 313 314 315
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

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

331 332 333 334 335 336 337 338 339 340 341 342 343 344
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

345 346
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
347

348
nodist_sbin_SCRIPTS = \
349
	$(PYTHON_BOOTSTRAP) \
350 351
	daemons/ganeti-cleaner

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

363
pkglib_python_scripts = \
364 365
	daemons/import-export \
	tools/check-cert-expired
366

367
pkglib_SCRIPTS = \
368
	daemons/daemon-util \
369
	daemons/ensure-dirs \
370
	tools/kvm-ifup \
371
	$(pkglib_python_scripts)
372

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

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

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

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

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

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

524 525 526 527
nodist_TESTS =

TESTS = $(dist_TESTS) $(nodist_TESTS)

528 529 530 531 532
# Environment for all tests
PLAIN_TESTS_ENVIRONMENT = \
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)

# Environment for tests run by automake
533
TESTS_ENVIRONMENT = \
534
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
535

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

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

check_python_code = \
564
	$(BUILD_BASH_COMPLETION) \
565 566
	$(all_python_code)

567
lint_python_code = \
568
	ganeti \
569
	ganeti/http/server.py \
570 571
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
572
	$(pkglib_python_scripts) \
573 574
	$(BUILD_BASH_COMPLETION) \
	$(PYTHON_BOOTSTRAP)
575

576 577
test/daemon-util_unittest.bash: daemons/daemon-util

578 579
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner

580 581 582 583
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod +x $@

584
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
585 586 587
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod u+x $@

588
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
589
	sed -f $(REPLACE_VARS_SED) < $< > $@
590
	chmod +x $@
591

592
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
593 594
	sed -f $(REPLACE_VARS_SED) < $< > $@

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

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

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

Iustin Pop's avatar
Iustin Pop committed
606 607 608 609 610
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
611 612 613 614 615 616 617 618 619 620
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; }
	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
	  sed -e 's/\\@/@/g' > $@
621
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
Iustin Pop's avatar
Iustin Pop committed
622

Iustin Pop's avatar
Iustin Pop committed
623 624 625 626 627 628
man/%.html.in: man/%.rst man/footer.html
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
	  sed -e 's/\\@/@/g' > $@

629
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
630
	sed -f $(REPLACE_VARS_SED) < $< > $@
631

632
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
633
	sed -f $(REPLACE_VARS_SED) < $< > $@
634

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

638 639 640
epydoc.conf: epydoc.conf.in
	sed -e 's#@MODULES@#$(lint_python_code)#g' < $< > $@

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

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

715
$(REPLACE_VARS_SED): Makefile
716 717 718 719
	set -e; \
	{ echo 's#@PREFIX@#$(prefix)#g'; \
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
720
	  echo 's#@BINDIR@#$(bindir)#g'; \
721 722
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
723
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
724 725
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
Iustin Pop's avatar
Iustin Pop committed
726 727
	  echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
	  echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
728
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
729
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
Iustin Pop's avatar
Iustin Pop committed
730
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
731 732 733 734 735 736 737 738
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
739
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
740 741
	} > $@

742
# Using deferred evaluation
743