Makefile.am 29.5 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
HTOOLS_DIRS = \
	htools \
	htools/Ganeti \
	htools/Ganeti/HTools

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

75
BUILDTIME_DIR_AUTOCREATE = \
76
	scripts \
77 78
	doc/py-apidoc \
	$(HS_APIDOC) $(HS_APIDOC)/Ganeti $(HS_APIDOC)/Ganeti/HTools \
79 80 81
	doc/py-coverage \
	doc/hs-coverage \
	.hpc
82 83 84

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
85 86 87 88 89 90 91
	doc/html

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

92
all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
93

Iustin Pop's avatar
Iustin Pop committed
94
MAINTAINERCLEANFILES = \
95
	$(docpng) \
96
	$(maninput) \
97
	doc/install-quick.rst \
98
	doc/news.rst \
99
	doc/upgrade.rst \
100
	vcs-version
Iustin Pop's avatar
Iustin Pop committed
101

102
maintainer-clean-local:
103
	rm -rf $(BUILDTIME_DIRS)
104

105
CLEANFILES = \
106
	$(addsuffix /*.py[co],$(DIRS)) \
107 108
	$(addsuffix /*.hi,$(HTOOLS_DIRS)) \
	$(addsuffix /*.o,$(HTOOLS_DIRS)) \
109
	$(all_dirfiles) \
110
	$(PYTHON_BOOTSTRAP) \
111
	epydoc.conf \
112
	autotools/replace_vars.sed \
113
	daemons/daemon-util \
114
	daemons/ensure-dirs \
115
	daemons/ganeti-cleaner \
116
	devel/upload \
117
	doc/examples/bash_completion \
118
	doc/examples/ganeti.initd \
119
	doc/examples/ganeti-kvm-poweroff.initd \
120
	doc/examples/ganeti.cron \
121
	doc/examples/gnt-config-backup \
Luca Bigliardi's avatar
Luca Bigliardi committed
122
	doc/examples/hooks/ipsec \
Iustin Pop's avatar
Iustin Pop committed
123 124
	$(man_MANS) \
	$(manhtml) \
125
	tools/kvm-ifup \
126
	stamp-srclinks \
127
	$(nodist_pkgpython_PYTHON) \
128 129
	$(HALLPROGS) $(HSRCS2) \
	.hpc/*.mix htools/*.tix
130

131 132
# BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
# it'll cause the target to rebuild every time.
133 134
BUILT_SOURCES = \
	ganeti \
135
	stamp-srclinks \
136
	lib/_autoconf.py \
137
	$(all_dirfiles) \
138 139
	$(PYTHON_BOOTSTRAP)

140 141 142
nodist_pkgpython_PYTHON = \
	lib/_autoconf.py

143
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
144 145
	lib/build/__init__.py \
	lib/build/sphinx_ext.py
146

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

180
client_PYTHON = \
181
	lib/client/__init__.py \
182
	lib/client/gnt_backup.py \
183
	lib/client/gnt_cluster.py \
184
	lib/client/gnt_debug.py \
185
	lib/client/gnt_group.py \
186
	lib/client/gnt_instance.py \
187
	lib/client/gnt_job.py \
188
	lib/client/gnt_node.py \
189
	lib/client/gnt_os.py
190

191 192 193
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
194
	lib/hypervisor/hv_chroot.py \
195
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
196
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
197
	lib/hypervisor/hv_lxc.py \
198 199
	lib/hypervisor/hv_xen.py

200 201
rapi_PYTHON = \
	lib/rapi/__init__.py \
202
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
203
	lib/rapi/client.py \
204
	lib/rapi/client_utils.py \
205 206
	lib/rapi/connector.py \
	lib/rapi/rlib2.py
207

208
http_PYTHON = \
209
	lib/http/__init__.py \
210
	lib/http/auth.py \
211 212
	lib/http/client.py \
	lib/http/server.py
213

Guido Trotter's avatar
Guido Trotter committed
214
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
215
	lib/confd/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
216
	lib/confd/client.py \
217 218
	lib/confd/querylib.py \
	lib/confd/server.py
219

Michael Hanselmann's avatar
Michael Hanselmann committed
220
masterd_PYTHON = \
221 222
	lib/masterd/__init__.py \
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
223

224 225 226
impexpd_PYTHON = \
	lib/impexpd/__init__.py

227 228 229
watcher_PYTHON = \
	lib/watcher/__init__.py

230
server_PYTHON = \
231
	lib/server/__init__.py \
232
	lib/server/confd.py \
233
	lib/server/masterd.py \
234 235
	lib/server/noded.py \
	lib/server/rapi.py
236

237
utils_PYTHON = \
238
	lib/utils/__init__.py \
239
	lib/utils/algo.py \
240
	lib/utils/filelock.py \
241
	lib/utils/hash.py \
242
	lib/utils/io.py \
243
	lib/utils/log.py \
244
	lib/utils/mlock.py \
245
	lib/utils/nodesetup.py \
246
	lib/utils/process.py \
247
	lib/utils/retry.py \
248
	lib/utils/text.py \
249 250
	lib/utils/wrapper.py \
	lib/utils/x509.py
251

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

280 281 282 283 284 285 286 287 288
HPROGS = \
	htools/hbal \
	htools/hscan \
	htools/hail \
	htools/hspace

HALLPROGS = $(HPROGS) htools/test
HSRCPROGS = $(patsubst %,%.hs,$(HALLPROGS))
# we don't add -Werror by default
289
HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
290
# extra flags that can be overriden on the command line
291
HEXTRA =
292 293
# exclude options for coverage reports
HPCEXCL = --exclude Main --exclude Ganeti.HTools.QC
294 295
# directory for apidoc
HS_APIDOC = doc/hs-apidoc
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321

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))

322 323
$(RUN_IN_TEMPDIR): | $(all_dirfiles)

Iustin Pop's avatar
Iustin Pop committed
324 325 326 327 328
# 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
329
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
Iustin Pop's avatar
Iustin Pop committed
330 331
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
	| lib/_autoconf.py
332 333
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
334
	@mkdir_p@ $(dir $@)
335
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
336
	    -d . \
337 338
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
339 340 341 342
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

343
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
344

345
doc/install-quick.rst: INSTALL
346
doc/news.rst: NEWS
347
doc/upgrade.rst: UPGRADE
348

349
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
350 351 352 353 354 355 356
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

357
docdot = \
358 359 360
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
361

362
docpng = $(patsubst %.dot,%.png,$(docdot))
363

364 365 366 367 368 369 370 371
# 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 \
372
	doc/examples/ganeti-kvm-poweroff.initd \
373
	doc/examples/gnt-config-backup \
374 375
	doc/examples/hooks/ipsec \
	$(manhtml)
376

377
gnt_scripts = \
378 379 380
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
381
	scripts/gnt-group \
382 383 384 385 386
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

387
PYTHON_BOOTSTRAP = \
388
	daemons/ganeti-confd \
389
	daemons/ganeti-masterd \
390
	daemons/ganeti-noded \
391
	daemons/ganeti-watcher \
392
	daemons/ganeti-rapi \
393
	scripts/gnt-backup \
394
	scripts/gnt-cluster \
395
	scripts/gnt-debug \
396
	scripts/gnt-group \
397
	scripts/gnt-instance \
398
	scripts/gnt-job \
399
	scripts/gnt-node \
400
	scripts/gnt-os
401

402 403 404 405 406 407 408 409 410 411 412 413 414 415
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

416
bin_SCRIPTS =
417
iallocators_SCRIPTS =
418
if WANT_HTOOLS
419 420
bin_SCRIPTS += $(filter-out htools/hail,$(HPROGS))
iallocators_SCRIPTS += $(filter htools/hail,$(HPROGS))
421 422
endif

423
$(HALLPROGS): %: %.hs $(HSRCS) $(HSRCS2) Makefile
424 425 426 427 428
	BINARY=$(@:htools/%=%); \
	$(GHC) --make \
	  $(HFLAGS) $(HEXTRA) $(HTOOLS_NOCURL) \
	  -osuf $$BINARY.o -hisuf $$BINARY.hi \
	  $@
429

430 431 432 433 434
# for the htools/test binary, we need to enable profiling/coverage
htools/test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
	-fno-warn-monomorphism-restriction -fno-warn-orphans \
	-fno-warn-missing-methods -fno-warn-unused-imports

435 436
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
437

438
nodist_sbin_SCRIPTS = \
439
	$(PYTHON_BOOTSTRAP) \
440 441
	daemons/ganeti-cleaner

442 443 444 445
dist_tools_SCRIPTS = \
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
446
	tools/cfgupgrade12 \
447
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
448
	tools/lvmstrap \
449
	tools/move-instance \
450
	tools/setup-ssh \
Iustin Pop's avatar
Iustin Pop committed
451
	tools/sanitize-config
452

453
pkglib_python_scripts = \
454 455
	daemons/import-export \
	tools/check-cert-expired
456

457
pkglib_SCRIPTS = \
458
	daemons/daemon-util \
459
	daemons/ensure-dirs \
460
	tools/kvm-ifup \
461
	$(pkglib_python_scripts)
462

463 464
EXTRA_DIST = \
	NEWS \
465
	UPGRADE \
466
	epydoc.conf.in \
Michael Hanselmann's avatar
Michael Hanselmann committed
467
	pylintrc \
468
	autotools/build-bash-completion \
469
	autotools/check-python-code \
470
	autotools/check-man \
471
	autotools/check-news \
472
	autotools/check-tar \
473
	autotools/check-version \
474
	autotools/docpp \
475
	autotools/gen-coverage \
476
	autotools/testrunner \
477
	$(RUN_IN_TEMPDIR) \
478
	daemons/daemon-util.in \
479
	daemons/ensure-dirs.in \
480
	daemons/ganeti-cleaner.in \
481
	$(pkglib_python_scripts) \
482
	devel/upload.in \
483
	tools/kvm-ifup.in \
484
	$(docdot) \
485
	$(docpng) \
486 487 488
	$(docrst) \
	doc/conf.py \
	doc/html \
489
	doc/examples/ganeti.initd.in \
490
	doc/examples/ganeti-kvm-poweroff.initd.in \
491
	doc/examples/ganeti.cron.in \
492
	doc/examples/gnt-config-backup.in \
493 494
	doc/examples/ganeti.default \
	doc/examples/ganeti.default-debug \
Guido Trotter's avatar
Guido Trotter committed
495
	doc/examples/hooks/ethers \
Luca Bigliardi's avatar
Luca Bigliardi committed
496
	doc/examples/hooks/ipsec.in \
497 498 499
	doc/examples/gnt-debug/README \
	doc/examples/gnt-debug/delay0.json \
	doc/examples/gnt-debug/delay50.json \
500 501 502 503
	test/testutils.py \
	test/mocks.py \
	$(dist_TESTS) \
	$(TEST_FILES) \
Iustin Pop's avatar
Iustin Pop committed
504 505
	man/footer.rst \
	$(manrst) \
506
	$(maninput) \
Michael Hanselmann's avatar
Michael Hanselmann committed
507
	qa/qa-sample.json \
508 509 510
	$(qa_scripts) \
	$(HSRCS) $(HSRCS2IN) \
	$(HSRCPROGS)
511 512 513

man_MANS = \
	man/ganeti.7 \
514
	man/ganeti-cleaner.8 \
Guido Trotter's avatar
Guido Trotter committed
515
	man/ganeti-confd.8 \
516
	man/ganeti-listrunner.8 \
517
	man/ganeti-masterd.8 \
518 519
	man/ganeti-noded.8 \
	man/ganeti-os-interface.7 \
520
	man/ganeti-rapi.8 \
521 522 523
	man/ganeti-watcher.8 \
	man/gnt-backup.8 \
	man/gnt-cluster.8 \
524
	man/gnt-debug.8 \
525
	man/gnt-group.8 \
526
	man/gnt-instance.8 \
527
	man/gnt-job.8 \
528
	man/gnt-node.8 \
529 530 531 532 533
	man/gnt-os.8 \
	man/hail.1 \
	man/hbal.1 \
	man/hscan.1 \
	man/hspace.1
534

535
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
Iustin Pop's avatar
Iustin Pop committed
536
manhtml = $(patsubst %.rst,%.html,$(manrst))
537
mangen = $(patsubst %.rst,%.gen,$(manrst))
538
maninput = \
539
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
Iustin Pop's avatar
Iustin Pop committed
540
	$(patsubst %.html,%.html.in,$(manhtml)) \
541
	man/footer.man man/footer.html $(mangen)
542 543

TEST_FILES = \
Manuel Franceschini's avatar
Manuel Franceschini committed
544 545 546 547 548
	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 \
549
	test/data/cert1.pem \
550
	test/data/proc_drbd8.txt \
551
	test/data/proc_drbd80-emptyline.txt \
552
	test/data/proc_drbd83.txt \
553
	test/data/sys_drbd_usermode_helper.txt \
554
	test/import-export_unittest-helper
555

556
python_tests = \
Guido Trotter's avatar
Guido Trotter committed
557
	test/ganeti.asyncnotifier_unittest.py \
558
	test/ganeti.backend_unittest.py \
559 560
	test/ganeti.bdev_unittest.py \
	test/ganeti.cli_unittest.py \
René Nussbaumer's avatar
René Nussbaumer committed
561
	test/ganeti.client.gnt_cluster_unittest.py \
562
	test/ganeti.client.gnt_instance_unittest.py \
Guido Trotter's avatar
Guido Trotter committed
563
	test/ganeti.daemon_unittest.py \
564
	test/ganeti.cmdlib_unittest.py \
565
	test/ganeti.compat_unittest.py \
566
	test/ganeti.confd.client_unittest.py \
567
	test/ganeti.config_unittest.py \
568
	test/ganeti.constants_unittest.py \
569
	test/ganeti.errors_unittest.py \
570
	test/ganeti.hooks_unittest.py \
571
	test/ganeti.ht_unittest.py \
572
	test/ganeti.http_unittest.py \
573
	test/ganeti.hypervisor_unittest.py \
574 575
	test/ganeti.hypervisor.hv_chroot_unittest.py \
	test/ganeti.hypervisor.hv_fake_unittest.py \
576
	test/ganeti.hypervisor.hv_kvm_unittest.py \
577 578
	test/ganeti.hypervisor.hv_lxc_unittest.py \
	test/ganeti.hypervisor.hv_xen_unittest.py \
579
	test/ganeti.impexpd_unittest.py \
580
	test/ganeti.jqueue_unittest.py \
581
	test/ganeti.locking_unittest.py \
582
	test/ganeti.luxi_unittest.py \
583
	test/ganeti.masterd.instance_unittest.py \
584
	test/ganeti.mcpu_unittest.py \
585
	test/ganeti.netutils_unittest.py \
586
	test/ganeti.objects_unittest.py \
587
	test/ganeti.opcodes_unittest.py \
588
	test/ganeti.qlang_unittest.py \
589
	test/ganeti.query_unittest.py \
590
	test/ganeti.rapi.baserlib_unittest.py \
David Knowles's avatar
David Knowles committed
591
	test/ganeti.rapi.client_unittest.py \
592
	test/ganeti.rapi.resources_unittest.py \
593
	test/ganeti.rapi.rlib2_unittest.py \
594
	test/ganeti.rpc_unittest.py \
595
	test/ganeti.runtime_unittest.py \
596 597
	test/ganeti.serializer_unittest.py \
	test/ganeti.ssh_unittest.py \
Balazs Lecz's avatar
Balazs Lecz committed
598
	test/ganeti.uidpool_unittest.py \
599
	test/ganeti.utils.algo_unittest.py \
600
	test/ganeti.utils.filelock_unittest.py \
601
	test/ganeti.utils.hash_unittest.py \
602
	test/ganeti.utils.io_unittest.py \
603
	test/ganeti.utils.log_unittest.py \
604
	test/ganeti.utils.mlock_unittest.py \
605
	test/ganeti.utils.nodesetup_unittest.py \
606
	test/ganeti.utils.process_unittest.py \
607
	test/ganeti.utils.retry_unittest.py \
608
	test/ganeti.utils.text_unittest.py \
609
	test/ganeti.utils.wrapper_unittest.py \
610
	test/ganeti.utils.x509_unittest.py \
611
	test/ganeti.utils_unittest.py \
612
	test/ganeti.workerpool_unittest.py \
613
	test/cfgupgrade_unittest.py \
614 615
	test/docs_unittest.py \
	test/tempfile_fork_unittest.py
616

617 618
haskell_tests = htools/test

619
dist_TESTS = \
620
	test/check-cert-expired_unittest.bash \
621
	test/daemon-util_unittest.bash \
622
	test/ganeti-cleaner_unittest.bash \
623
	test/import-export_unittest.bash \
624 625
	$(python_tests)

626
nodist_TESTS =
627 628 629
if WANT_HTOOLS
nodist_TESTS += $(haskell_tests)
endif
630 631 632

TESTS = $(dist_TESTS) $(nodist_TESTS)

633 634 635 636 637
# Environment for all tests
PLAIN_TESTS_ENVIRONMENT = \
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)

# Environment for tests run by automake
638
TESTS_ENVIRONMENT = \
639
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
640

641
all_python_code = \
642 643
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
644
	$(pkglib_python_scripts) \
645
	$(python_tests) \
646
	$(pkgpython_PYTHON) \
647
	$(client_PYTHON) \
648 649
	$(hypervisor_PYTHON) \
	$(rapi_PYTHON) \
650
	$(server_PYTHON) \
651 652
	$(http_PYTHON) \
	$(confd_PYTHON) \
Michael Hanselmann's avatar
Michael Hanselmann committed
653
	$(masterd_PYTHON) \
654
	$(impexpd_PYTHON) \
655
	$(utils_PYTHON) \
656
	$(watcher_PYTHON) \
657 658
	$(noinst_PYTHON) \
	$(qa_scripts)
659

660
srclink_files = \
Iustin Pop's avatar
Iustin Pop committed
661
	man/footer.rst \
662
	test/check-cert-expired_unittest.bash \
663
	test/daemon-util_unittest.bash \
664
	test/ganeti-cleaner_unittest.bash \
665
	test/import-export_unittest.bash \
666 667
	$(all_python_code) \
	$(HSRCS) $(HSRCPROGS)
668 669

check_python_code = \
670
	$(BUILD_BASH_COMPLETION) \
671
	$(DOCPP) \
672 673
	$(all_python_code)

674
lint_python_code = \
675
	ganeti \
676
	ganeti/http/server.py \
677 678
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
679
	$(pkglib_python_scripts) \
680
	$(BUILD_BASH_COMPLETION) \
681
	$(DOCPP) \
682
	$(PYTHON_BOOTSTRAP)
683

684 685
test/daemon-util_unittest.bash: daemons/daemon-util

686 687
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner

688 689 690 691
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod +x $@

692
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
693 694 695
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod u+x $@

696
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
697
	sed -f $(REPLACE_VARS_SED) < $< > $@
698
	chmod +x $@
699

700
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
701 702
	sed -f $(REPLACE_VARS_SED) < $< > $@

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

706
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
707
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
708
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
709

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

Iustin Pop's avatar
Iustin Pop committed
714 715 716 717 718
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
719 720 721 722 723
man/footer.html: man/footer.rst
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
	$(PANDOC) -f rst -t html -o $@ $<

724 725 726
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@

727
man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
Iustin Pop's avatar
Iustin Pop committed
728 729
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
730
	set -o pipefail ; \
Iustin Pop's avatar
Iustin Pop committed
731 732
	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
	  sed -e 's/\\@/@/g' > $@
733
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
Iustin Pop's avatar
Iustin Pop committed
734

735
man/%.html.in: man/%.gen man/footer.html
Iustin Pop's avatar
Iustin Pop committed
736 737
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
738
	set -o pipefail ; \
Iustin Pop's avatar
Iustin Pop committed
739 740 741
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
	  sed -e 's/\\@/@/g' > $@

742 743 744
man/%.1: man/%.1.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@

745
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
746
	sed -f $(REPLACE_VARS_SED) < $< > $@
747

748