Makefile.am 26.8 KB
Newer Older
1 2 3 4 5
# Ganeti makefile
# - Indent with tabs only.
# - Keep files sorted; one line per file.
# - Directories in lib/ must have their own *dir variable (see hypervisor).
# - All directories must be listed DIRS.
Michael Hanselmann's avatar
Michael Hanselmann committed
6
# - Use autogen.sh to generate Makefile.in and configure script.
7 8 9 10 11

# Automake doesn't export these variables before version 1.10.
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@

12 13 14
# Use bash in order to be able to use pipefail
SHELL=/bin/bash

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

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

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

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

70
BUILDTIME_DIR_AUTOCREATE = \
71
	scripts \
72
	doc/api \
73 74 75 76
	doc/coverage

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
77 78 79 80 81 82 83
	doc/html

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

84
all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
85

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

94
maintainer-clean-local:
95
	rm -rf $(BUILDTIME_DIRS)
96

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

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

131 132 133
nodist_pkgpython_PYTHON = \
	lib/_autoconf.py

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

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

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

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

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

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

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

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

215 216 217
impexpd_PYTHON = \
	lib/impexpd/__init__.py

218 219 220
watcher_PYTHON = \
	lib/watcher/__init__.py

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

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

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

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


309 310
$(RUN_IN_TEMPDIR): | $(all_dirfiles)

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

330
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
331

332
doc/install-quick.rst: INSTALL
333
doc/news.rst: NEWS
334
doc/upgrade.rst: UPGRADE
335

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

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

349
docpng = $(patsubst %.dot,%.png,$(docdot))
350

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

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

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

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

403 404 405 406 407 408 409 410 411
bin_SCRIPTS =
if WANT_HTOOLS
bin_SCRIPTS += $(HPROGS)
endif

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

412 413
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
414

415
nodist_sbin_SCRIPTS = \
416
	$(PYTHON_BOOTSTRAP) \
417 418
	daemons/ganeti-cleaner

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

430
pkglib_python_scripts = \
431 432
	daemons/import-export \
	tools/check-cert-expired
433

434
pkglib_SCRIPTS = \
435
	daemons/daemon-util \
436
	daemons/ensure-dirs \
437
	tools/kvm-ifup \
438
	$(pkglib_python_scripts)
439

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

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

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

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

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

594
dist_TESTS = \
595
	test/check-cert-expired_unittest.bash \
596
	test/daemon-util_unittest.bash \
597
	test/ganeti-cleaner_unittest.bash \
598
	test/import-export_unittest.bash \
599 600
	$(python_tests)

601 602 603 604
nodist_TESTS =

TESTS = $(dist_TESTS) $(nodist_TESTS)

605 606 607 608 609
# Environment for all tests
PLAIN_TESTS_ENVIRONMENT = \
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)

# Environment for tests run by automake
610
TESTS_ENVIRONMENT = \
611
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
612

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

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

check_python_code = \
642
	$(BUILD_BASH_COMPLETION) \
643
	$(DOCPP) \
644 645
	$(all_python_code)

646
lint_python_code = \
647
	ganeti \
648
	ganeti/http/server.py \
649 650
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
651
	$(pkglib_python_scripts) \
652
	$(BUILD_BASH_COMPLETION) \
653
	$(DOCPP) \
654
	$(PYTHON_BOOTSTRAP)
655

656 657
test/daemon-util_unittest.bash: daemons/daemon-util

658 659
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner

660 661 662 663
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod +x $@

664
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
665 666 667
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod u+x $@

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

672
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
673 674
	sed -f $(REPLACE_VARS_SED) < $< > $@

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

678
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
679
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
680
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
681

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

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

696 697 698
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@

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

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

714 715 716
man/%.1: man/%.1.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@

717
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
718
	sed -f $(REPLACE_VARS_SED) < $< > $@
719

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

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

726 727
epydoc.conf: epydoc.conf.in Makefile
	sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
728

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

745 746 747 748 749
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/" < $< > $@

750
lib/_autoconf.py: Makefile vcs-version | lib/.dir
751 752
	set -e; \
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
753 754
	{ echo '# This file is automatically generated, do not edit!'; \
	  echo '#'; \
Iustin Pop's avatar
Iustin Pop committed
755 756 757 758 759 760 761 762 763
	  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 ''; \
764 765 766 767
	  echo '# pylint: disable-msg=C0301,C0324'; \
	  echo '# because this is autogenerated, we do not want'; \
	  echo '# style warnings' ; \
	  echo ''; \
768 769 770 771