Makefile.am 27 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
# Note: the variable must be named after the directory + 'dir' suffix
26
clientdir = $(pkgpythondir)/client
27
hypervisordir = $(pkgpythondir)/hypervisor
28
httpdir = $(pkgpythondir)/http
Michael Hanselmann's avatar
Michael Hanselmann committed
29
masterddir = $(pkgpythondir)/masterd
Guido Trotter's avatar
Guido Trotter committed
30
confddir = $(pkgpythondir)/confd
31
rapidir = $(pkgpythondir)/rapi
32
serverdir = $(pkgpythondir)/server
33
watcherdir = $(pkgpythondir)/watcher
34
impexpddir = $(pkgpythondir)/impexpd
35
utilsdir = $(pkgpythondir)/utils
36
toolsdir = $(pkglibdir)/tools
37
iallocatorsdir = $(pkglibdir)/iallocators
38 39
docdir = $(datadir)/doc/$(PACKAGE)

40 41 42
# Delete output file if an error occurred while building it
.DELETE_ON_ERROR:

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

72
BUILDTIME_DIR_AUTOCREATE = \
73
	scripts \
74
	doc/api \
75 76 77 78
	doc/coverage

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
79 80 81 82 83 84 85
	doc/html

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

86
all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
87

Iustin Pop's avatar
Iustin Pop committed
88
MAINTAINERCLEANFILES = \
89
	$(docpng) \
90
	$(maninput) \
91
	doc/install-quick.rst \
92
	doc/news.rst \
93
	doc/upgrade.rst \
94
	vcs-version
Iustin Pop's avatar
Iustin Pop committed
95

96
maintainer-clean-local:
97
	rm -rf $(BUILDTIME_DIRS)
98

99
CLEANFILES = \
100
	$(addsuffix /*.py[co],$(DIRS)) \
101
	$(all_dirfiles) \
102
	$(PYTHON_BOOTSTRAP) \
103
	epydoc.conf \
104
	autotools/replace_vars.sed \
105
	daemons/daemon-util \
106
	daemons/ensure-dirs \
107
	daemons/ganeti-cleaner \
108
	devel/upload \
109
	doc/examples/bash_completion \
110
	doc/examples/ganeti.initd \
111
	doc/examples/ganeti-kvm-poweroff.initd \
112
	doc/examples/ganeti.cron \
113
	doc/examples/gnt-config-backup \
Luca Bigliardi's avatar
Luca Bigliardi committed
114
	doc/examples/hooks/ipsec \
Iustin Pop's avatar
Iustin Pop committed
115 116
	$(man_MANS) \
	$(manhtml) \
117
	tools/kvm-ifup \
118
	stamp-srclinks \
119 120 121 122
	$(nodist_pkgpython_PYTHON) \
	$(HALLPROGS) $(HSRCS2) \
	$(patsubst %.hs,%.hi,$(HSRCS) $(HSRCPROGS) $(HSRCS2)) \
	$(patsubst %.hs,%.o,$(HSRCS) $(HSRCPROGS) $(HSRCS2))
123

124 125
# BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
# it'll cause the target to rebuild every time.
126 127
BUILT_SOURCES = \
	ganeti \
128
	stamp-srclinks \
129
	lib/_autoconf.py \
130
	$(all_dirfiles) \
131 132
	$(PYTHON_BOOTSTRAP)

133 134 135
nodist_pkgpython_PYTHON = \
	lib/_autoconf.py

136
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
137 138
	lib/build/__init__.py \
	lib/build/sphinx_ext.py
139

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

173
client_PYTHON = \
174
	lib/client/__init__.py \
175
	lib/client/gnt_backup.py \
176
	lib/client/gnt_cluster.py \
177
	lib/client/gnt_debug.py \
178
	lib/client/gnt_group.py \
179
	lib/client/gnt_instance.py \
180
	lib/client/gnt_job.py \
181
	lib/client/gnt_node.py \
182
	lib/client/gnt_os.py
183

184 185 186
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
187
	lib/hypervisor/hv_chroot.py \
188
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
189
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
190
	lib/hypervisor/hv_lxc.py \
191 192
	lib/hypervisor/hv_xen.py

193 194
rapi_PYTHON = \
	lib/rapi/__init__.py \
195
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
196
	lib/rapi/client.py \
197
	lib/rapi/client_utils.py \
198 199
	lib/rapi/connector.py \
	lib/rapi/rlib2.py
200

201
http_PYTHON = \
202
	lib/http/__init__.py \
203
	lib/http/auth.py \
204 205
	lib/http/client.py \
	lib/http/server.py
206

Guido Trotter's avatar
Guido Trotter committed
207
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
208
	lib/confd/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
209
	lib/confd/client.py \
210 211
	lib/confd/querylib.py \
	lib/confd/server.py
212

Michael Hanselmann's avatar
Michael Hanselmann committed
213
masterd_PYTHON = \
214 215
	lib/masterd/__init__.py \
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
216

217 218 219
impexpd_PYTHON = \
	lib/impexpd/__init__.py

220 221 222
watcher_PYTHON = \
	lib/watcher/__init__.py

223
server_PYTHON = \
224
	lib/server/__init__.py \
225
	lib/server/confd.py \
226
	lib/server/masterd.py \
227 228
	lib/server/noded.py \
	lib/server/rapi.py
229

230
utils_PYTHON = \
231
	lib/utils/__init__.py \
232
	lib/utils/algo.py \
233
	lib/utils/filelock.py \
234
	lib/utils/hash.py \
235
	lib/utils/io.py \
236
	lib/utils/log.py \
237
	lib/utils/mlock.py \
238
	lib/utils/nodesetup.py \
239
	lib/utils/process.py \
240
	lib/utils/retry.py \
241
	lib/utils/text.py \
242 243
	lib/utils/wrapper.py \
	lib/utils/x509.py
244

Michael Hanselmann's avatar
Michael Hanselmann committed
245
docrst = \
246
	doc/admin.rst \
247
	doc/design-2.0.rst \
248
	doc/design-2.1.rst \
249
	doc/design-2.2.rst \
Guido Trotter's avatar
Guido Trotter committed
250
	doc/design-2.3.rst \
251
	doc/design-htools-2.3.rst \
252
	doc/design-2.4.rst \
253
	doc/design-draft.rst \
254
	doc/design-oob.rst \
255
	doc/design-query2.rst \
256
	doc/cluster-merge.rst \
257
	doc/design-shared-storage.rst \
258
	doc/devnotes.rst \
259
	doc/glossary.rst \
260
	doc/hooks.rst \
261
	doc/iallocator.rst \
262
	doc/index.rst \
263
	doc/install-quick.rst \
264
	doc/install.rst \
265
	doc/locking.rst \
266
	doc/move-instance.rst \
Iustin Pop's avatar
Iustin Pop committed
267
	doc/news.rst \
268
	doc/rapi.rst \
269
	doc/security.rst \
270
	doc/upgrade.rst \
Iustin Pop's avatar
Iustin Pop committed
271
	doc/walkthrough.rst
Michael Hanselmann's avatar
Michael Hanselmann committed
272

273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
HPROGS = \
	htools/hbal \
	htools/hscan \
	htools/hail \
	htools/hspace

HALLPROGS = $(HPROGS) htools/test
HSRCPROGS = $(patsubst %,%.hs,$(HALLPROGS))
# we don't add -Werror by default
HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs
HEXTRA =

HSRCS = \
	htools/Ganeti/HTools/CLI.hs \
	htools/Ganeti/HTools/Cluster.hs \
	htools/Ganeti/HTools/Container.hs \
	htools/Ganeti/HTools/ExtLoader.hs \
	htools/Ganeti/HTools/Group.hs \
	htools/Ganeti/HTools/IAlloc.hs \
	htools/Ganeti/HTools/Instance.hs \
	htools/Ganeti/HTools/Loader.hs \
	htools/Ganeti/HTools/Luxi.hs \
	htools/Ganeti/HTools/Node.hs \
	htools/Ganeti/HTools/PeerMap.hs \
	htools/Ganeti/HTools/QC.hs \
	htools/Ganeti/HTools/Rapi.hs \
	htools/Ganeti/HTools/Simu.hs \
	htools/Ganeti/HTools/Text.hs \
	htools/Ganeti/HTools/Types.hs \
	htools/Ganeti/HTools/Utils.hs \
	htools/Ganeti/Jobs.hs \
	htools/Ganeti/Luxi.hs \
	htools/Ganeti/OpCodes.hs

HSRCS2 = htools/Ganeti/HTools/Version.hs
HSRCS2IN = $(patsubst %,%.in,$(HSRCS2))


311 312
$(RUN_IN_TEMPDIR): | $(all_dirfiles)

Iustin Pop's avatar
Iustin Pop committed
313 314 315 316 317
# 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
318
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
Iustin Pop's avatar
Iustin Pop committed
319 320
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
	| lib/_autoconf.py
321 322
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
323
	@mkdir_p@ $(dir $@)
324
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
325
	    -d . \
326 327
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
328 329 330 331
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

332
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
333

334
doc/install-quick.rst: INSTALL
335
doc/news.rst: NEWS
336
doc/upgrade.rst: UPGRADE
337

338
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
339 340 341 342 343 344 345
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

346
docdot = \
347 348 349
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
350

351
docpng = $(patsubst %.dot,%.png,$(docdot))
352

353 354 355 356 357 358 359 360
# 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 \
361
	doc/examples/ganeti-kvm-poweroff.initd \
362
	doc/examples/gnt-config-backup \
363 364
	doc/examples/hooks/ipsec \
	$(manhtml)
365

366
gnt_scripts = \
367 368 369
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
370
	scripts/gnt-group \
371 372 373 374 375
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

376
PYTHON_BOOTSTRAP = \
377
	daemons/ganeti-confd \
378
	daemons/ganeti-masterd \
379
	daemons/ganeti-noded \
380
	daemons/ganeti-watcher \
381
	daemons/ganeti-rapi \
382
	scripts/gnt-backup \
383
	scripts/gnt-cluster \
384
	scripts/gnt-debug \
385
	scripts/gnt-group \
386
	scripts/gnt-instance \
387
	scripts/gnt-job \
388
	scripts/gnt-node \
389
	scripts/gnt-os
390

391 392 393 394 395 396 397 398 399 400 401 402 403 404
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

405
bin_SCRIPTS =
406
iallocators_SCRIPTS =
407
if WANT_HTOOLS
408 409
bin_SCRIPTS += $(filter-out htools/hail,$(HPROGS))
iallocators_SCRIPTS += $(filter htools/hail,$(HPROGS))
410 411 412 413 414 415
endif

$(HALLPROGS): %: %.hs $(HSRCS) $(HSRCS2)
	cd htools && $(GHC) --make $(HFLAGS) $(HEXTRA) $(HTOOLS_NOCURL) \
	  $(patsubst htools/%,%,$@)

416 417
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
418

419
nodist_sbin_SCRIPTS = \
420
	$(PYTHON_BOOTSTRAP) \
421 422
	daemons/ganeti-cleaner

423 424 425 426
dist_tools_SCRIPTS = \
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
427
	tools/cfgupgrade12 \
428
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
429
	tools/lvmstrap \
430
	tools/move-instance \
431
	tools/setup-ssh \
Iustin Pop's avatar
Iustin Pop committed
432
	tools/sanitize-config
433

434
pkglib_python_scripts = \
435 436
	daemons/import-export \
	tools/check-cert-expired
437

438
pkglib_SCRIPTS = \
439
	daemons/daemon-util \
440
	daemons/ensure-dirs \
441
	tools/kvm-ifup \
442
	$(pkglib_python_scripts)
443

444 445
EXTRA_DIST = \
	NEWS \
446
	UPGRADE \
447
	epydoc.conf.in \
Michael Hanselmann's avatar
Michael Hanselmann committed
448
	pylintrc \
449
	autotools/build-bash-completion \
450
	autotools/check-python-code \
451
	autotools/check-man \
452
	autotools/check-news \
453
	autotools/check-tar \
454
	autotools/check-version \
455
	autotools/docpp \
456
	autotools/gen-coverage \
457
	autotools/testrunner \
458
	$(RUN_IN_TEMPDIR) \
459
	daemons/daemon-util.in \
460
	daemons/ensure-dirs.in \
461
	daemons/ganeti-cleaner.in \
462
	$(pkglib_python_scripts) \
463
	devel/upload.in \
464
	tools/kvm-ifup.in \
465
	$(docdot) \
466
	$(docpng) \
467 468 469
	$(docrst) \
	doc/conf.py \
	doc/html \
470
	doc/examples/ganeti.initd.in \
471
	doc/examples/ganeti-kvm-poweroff.initd.in \
472
	doc/examples/ganeti.cron.in \
473
	doc/examples/gnt-config-backup.in \
474 475
	doc/examples/ganeti.default \
	doc/examples/ganeti.default-debug \
Guido Trotter's avatar
Guido Trotter committed
476
	doc/examples/hooks/ethers \
Luca Bigliardi's avatar
Luca Bigliardi committed
477
	doc/examples/hooks/ipsec.in \
478 479 480
	doc/examples/gnt-debug/README \
	doc/examples/gnt-debug/delay0.json \
	doc/examples/gnt-debug/delay50.json \
481 482 483 484
	test/testutils.py \
	test/mocks.py \
	$(dist_TESTS) \
	$(TEST_FILES) \
Iustin Pop's avatar
Iustin Pop committed
485 486
	man/footer.rst \
	$(manrst) \
487
	$(maninput) \
Michael Hanselmann's avatar
Michael Hanselmann committed
488
	qa/qa-sample.json \
489 490 491
	$(qa_scripts) \
	$(HSRCS) $(HSRCS2IN) \
	$(HSRCPROGS)
492 493 494

man_MANS = \
	man/ganeti.7 \
495
	man/ganeti-cleaner.8 \
Guido Trotter's avatar
Guido Trotter committed
496
	man/ganeti-confd.8 \
497
	man/ganeti-listrunner.8 \
498
	man/ganeti-masterd.8 \
499 500
	man/ganeti-noded.8 \
	man/ganeti-os-interface.7 \
501
	man/ganeti-rapi.8 \
502 503 504
	man/ganeti-watcher.8 \
	man/gnt-backup.8 \
	man/gnt-cluster.8 \
505
	man/gnt-debug.8 \
506
	man/gnt-group.8 \
507
	man/gnt-instance.8 \
508
	man/gnt-job.8 \
509
	man/gnt-node.8 \
510 511 512 513 514
	man/gnt-os.8 \
	man/hail.1 \
	man/hbal.1 \
	man/hscan.1 \
	man/hspace.1
515

516
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
Iustin Pop's avatar
Iustin Pop committed
517
manhtml = $(patsubst %.rst,%.html,$(manrst))
518
mangen = $(patsubst %.rst,%.gen,$(manrst))
519
maninput = \
520
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
Iustin Pop's avatar
Iustin Pop committed
521
	$(patsubst %.html,%.html.in,$(manhtml)) \
522
	man/footer.man man/footer.html $(mangen)
523 524

TEST_FILES = \
Manuel Franceschini's avatar
Manuel Franceschini committed
525 526 527 528 529
	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 \
530
	test/data/cert1.pem \
531
	test/data/proc_drbd8.txt \
532
	test/data/proc_drbd80-emptyline.txt \
533
	test/data/proc_drbd83.txt \
534
	test/data/sys_drbd_usermode_helper.txt \
535
	test/import-export_unittest-helper
536

537
python_tests = \
Guido Trotter's avatar
Guido Trotter committed
538
	test/ganeti.asyncnotifier_unittest.py \
539
	test/ganeti.backend_unittest.py \
540 541
	test/ganeti.bdev_unittest.py \
	test/ganeti.cli_unittest.py \
René Nussbaumer's avatar
René Nussbaumer committed
542
	test/ganeti.client.gnt_cluster_unittest.py \
543
	test/ganeti.client.gnt_instance_unittest.py \
Guido Trotter's avatar
Guido Trotter committed
544
	test/ganeti.daemon_unittest.py \
545
	test/ganeti.cmdlib_unittest.py \
546
	test/ganeti.compat_unittest.py \
547
	test/ganeti.confd.client_unittest.py \
548
	test/ganeti.config_unittest.py \
549
	test/ganeti.constants_unittest.py \
550
	test/ganeti.errors_unittest.py \
551
	test/ganeti.hooks_unittest.py \
552
	test/ganeti.ht_unittest.py \
553
	test/ganeti.http_unittest.py \
554
	test/ganeti.hypervisor_unittest.py \
555 556
	test/ganeti.hypervisor.hv_chroot_unittest.py \
	test/ganeti.hypervisor.hv_fake_unittest.py \
557
	test/ganeti.hypervisor.hv_kvm_unittest.py \
558 559
	test/ganeti.hypervisor.hv_lxc_unittest.py \
	test/ganeti.hypervisor.hv_xen_unittest.py \
560
	test/ganeti.impexpd_unittest.py \
561
	test/ganeti.jqueue_unittest.py \
562
	test/ganeti.locking_unittest.py \
563
	test/ganeti.luxi_unittest.py \
564
	test/ganeti.masterd.instance_unittest.py \
565
	test/ganeti.mcpu_unittest.py \
566
	test/ganeti.netutils_unittest.py \
567
	test/ganeti.objects_unittest.py \
568
	test/ganeti.opcodes_unittest.py \
569
	test/ganeti.qlang_unittest.py \
570
	test/ganeti.query_unittest.py \
571
	test/ganeti.rapi.baserlib_unittest.py \
David Knowles's avatar
David Knowles committed
572
	test/ganeti.rapi.client_unittest.py \
573
	test/ganeti.rapi.resources_unittest.py \
574
	test/ganeti.rapi.rlib2_unittest.py \
575
	test/ganeti.rpc_unittest.py \
576
	test/ganeti.runtime_unittest.py \
577 578
	test/ganeti.serializer_unittest.py \
	test/ganeti.ssh_unittest.py \
Balazs Lecz's avatar
Balazs Lecz committed
579
	test/ganeti.uidpool_unittest.py \
580
	test/ganeti.utils.algo_unittest.py \
581
	test/ganeti.utils.filelock_unittest.py \
582
	test/ganeti.utils.hash_unittest.py \
583
	test/ganeti.utils.io_unittest.py \
584
	test/ganeti.utils.log_unittest.py \
585
	test/ganeti.utils.mlock_unittest.py \
586
	test/ganeti.utils.nodesetup_unittest.py \
587
	test/ganeti.utils.process_unittest.py \
588
	test/ganeti.utils.retry_unittest.py \
589
	test/ganeti.utils.text_unittest.py \
590
	test/ganeti.utils.wrapper_unittest.py \
591
	test/ganeti.utils.x509_unittest.py \
592
	test/ganeti.utils_unittest.py \
593
	test/ganeti.workerpool_unittest.py \
594
	test/cfgupgrade_unittest.py \
595 596
	test/docs_unittest.py \
	test/tempfile_fork_unittest.py
597

598
dist_TESTS = \
599
	test/check-cert-expired_unittest.bash \
600
	test/daemon-util_unittest.bash \
601
	test/ganeti-cleaner_unittest.bash \
602
	test/import-export_unittest.bash \
603 604
	$(python_tests)

605 606 607 608
nodist_TESTS =

TESTS = $(dist_TESTS) $(nodist_TESTS)

609 610 611 612 613
# Environment for all tests
PLAIN_TESTS_ENVIRONMENT = \
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)

# Environment for tests run by automake
614
TESTS_ENVIRONMENT = \
615
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
616

617
all_python_code = \
618 619
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
620
	$(pkglib_python_scripts) \
621
	$(python_tests) \
622
	$(pkgpython_PYTHON) \
623
	$(client_PYTHON) \
624 625
	$(hypervisor_PYTHON) \
	$(rapi_PYTHON) \
626
	$(server_PYTHON) \
627 628
	$(http_PYTHON) \
	$(confd_PYTHON) \
Michael Hanselmann's avatar
Michael Hanselmann committed
629
	$(masterd_PYTHON) \
630
	$(impexpd_PYTHON) \
631
	$(utils_PYTHON) \
632
	$(watcher_PYTHON) \
633 634
	$(noinst_PYTHON) \
	$(qa_scripts)
635

636
srclink_files = \
Iustin Pop's avatar
Iustin Pop committed
637
	man/footer.rst \
638
	test/check-cert-expired_unittest.bash \
639
	test/daemon-util_unittest.bash \
640
	test/ganeti-cleaner_unittest.bash \
641
	test/import-export_unittest.bash \
642 643
	$(all_python_code) \
	$(HSRCS) $(HSRCPROGS)
644 645

check_python_code = \
646
	$(BUILD_BASH_COMPLETION) \
647
	$(DOCPP) \
648 649
	$(all_python_code)

650
lint_python_code = \
651
	ganeti \
652
	ganeti/http/server.py \
653 654
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
655
	$(pkglib_python_scripts) \
656
	$(BUILD_BASH_COMPLETION) \
657
	$(DOCPP) \
658
	$(PYTHON_BOOTSTRAP)
659

660 661
test/daemon-util_unittest.bash: daemons/daemon-util

662 663
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner

664 665 666 667
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod +x $@

668
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
669 670 671
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod u+x $@

672
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
673
	sed -f $(REPLACE_VARS_SED) < $< > $@
674
	chmod +x $@
675

676
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
677 678
	sed -f $(REPLACE_VARS_SED) < $< > $@

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

682
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
683
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
684
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
685

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

Iustin Pop's avatar
Iustin Pop committed
690 691 692 693 694
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
695 696 697 698 699
man/footer.html: man/footer.rst
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
	$(PANDOC) -f rst -t html -o $@ $<

700 701 702
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@

703
man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
Iustin Pop's avatar
Iustin Pop committed
704 705
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
706
	set -o pipefail ; \
Iustin Pop's avatar
Iustin Pop committed
707 708
	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
	  sed -e 's/\\@/@/g' > $@
709
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
Iustin Pop's avatar
Iustin Pop committed
710

711
man/%.html.in: man/%.gen man/footer.html
Iustin Pop's avatar
Iustin Pop committed
712 713
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
714
	set -o pipefail ; \
Iustin Pop's avatar
Iustin Pop committed
715 716 717
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
	  sed -e 's/\\@/@/g' > $@

718 719 720
man/%.1: man/%.1.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@

721
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
722
	sed -f $(REPLACE_VARS_SED) < $< > $@
723

724
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
725
	sed -f $(REPLACE_VARS_SED) < $< > $@
726

727
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
728
	sed -f $(REPLACE_VARS_SED) < $< > $@
729

730 731
epydoc.conf: epydoc.conf.in Makefile
	sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
732

733 734 735 736 737 738 739 740 741
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:
742
	set -e; \
743 744 745 746 747 748
	cd $(srcdir); \
	if test -d .git; then \
	  rm -f vcs-version; \
	  $(MAKE) vcs-version; \
	fi

749 750 751 752 753
htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version
	set -e; \
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
	sed -e "s/%ver%/$$VCSVER/" < $< > $@

754
lib/_autoconf.py: Makefile vcs-version | lib/.dir
755 756
	set -e; \
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \