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

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

44
45
46
47
48
HTOOLS_DIRS = \
	htools \
	htools/Ganeti \
	htools/Ganeti/HTools

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

76
BUILDTIME_DIR_AUTOCREATE = \
77
	scripts \
78
79
80
81
82
83
84
	$(APIDOC_DIR) \
	$(APIDOC_PY_DIR) \
	$(APIDOC_HS_DIR) \
	$(APIDOC_HS_DIR)/Ganeti $(APIDOC_HS_DIR)/Ganeti/HTools \
	$(COVERAGE_DIR) \
	$(COVERAGE_PY_DIR) \
	$(COVERAGE_HS_DIR) \
85
	.hpc
86
87
88

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
89
90
91
92
93
94
95
	doc/html

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

96
all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
97

98
99
100
101
102
103
104
105
# some helper vars
COVERAGE_DIR = doc/coverage
COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
COVERAGE_HS_DIR = $(COVERAGE_DIR)/hs
APIDOC_DIR = doc/api
APIDOC_PY_DIR = $(APIDOC_DIR)/py
APIDOC_HS_DIR = $(APIDOC_DIR)/hs

Iustin Pop's avatar
Iustin Pop committed
106
MAINTAINERCLEANFILES = \
107
	$(docpng) \
108
	$(maninput) \
109
	doc/install-quick.rst \
110
	doc/news.rst \
111
	doc/upgrade.rst \
112
	vcs-version
Iustin Pop's avatar
Iustin Pop committed
113

114
maintainer-clean-local:
115
	rm -rf $(BUILDTIME_DIRS)
116

117
CLEANFILES = \
118
	$(addsuffix /*.py[co],$(DIRS)) \
119
120
	$(addsuffix /*.hi,$(HTOOLS_DIRS)) \
	$(addsuffix /*.o,$(HTOOLS_DIRS)) \
121
	$(all_dirfiles) \
122
	$(PYTHON_BOOTSTRAP) \
123
	epydoc.conf \
124
	autotools/replace_vars.sed \
125
	daemons/daemon-util \
126
	daemons/ensure-dirs \
127
	daemons/ganeti-cleaner \
128
	devel/upload \
129
	doc/examples/bash_completion \
130
	doc/examples/ganeti.initd \
131
	doc/examples/ganeti-kvm-poweroff.initd \
132
	doc/examples/ganeti.cron \
133
	doc/examples/gnt-config-backup \
Luca Bigliardi's avatar
Luca Bigliardi committed
134
	doc/examples/hooks/ipsec \
Iustin Pop's avatar
Iustin Pop committed
135
136
	$(man_MANS) \
	$(manhtml) \
137
	tools/kvm-ifup \
138
	stamp-srclinks \
139
	$(nodist_pkgpython_PYTHON) \
140
	$(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
141
142
	.hpc/*.mix htools/*.tix \
	doc/hs-lint.html
143

144
145
# BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
# it'll cause the target to rebuild every time.
146
147
BUILT_SOURCES = \
	ganeti \
148
	stamp-srclinks \
149
	lib/_autoconf.py \
150
	$(all_dirfiles) \
151
152
	$(PYTHON_BOOTSTRAP)

153
154
155
nodist_pkgpython_PYTHON = \
	lib/_autoconf.py

156
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
157
158
	lib/build/__init__.py \
	lib/build/sphinx_ext.py
159

160
161
pkgpython_PYTHON = \
	lib/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
162
	lib/asyncnotifier.py \
163
164
165
166
167
	lib/backend.py \
	lib/bdev.py \
	lib/bootstrap.py \
	lib/cli.py \
	lib/cmdlib.py \
168
	lib/compat.py \
169
170
	lib/config.py \
	lib/constants.py \
171
	lib/daemon.py \
172
	lib/errors.py \
173
	lib/ht.py \
174
	lib/jqueue.py \
175
	lib/jstore.py \
176
177
178
	lib/locking.py \
	lib/luxi.py \
	lib/mcpu.py \
179
	lib/netutils.py \
180
181
	lib/objects.py \
	lib/opcodes.py \
182
	lib/qlang.py \
183
	lib/query.py \
184
	lib/rpc.py \
185
	lib/runtime.py \
186
187
188
	lib/serializer.py \
	lib/ssconf.py \
	lib/ssh.py \
189
	lib/storage.py \
190
	lib/uidpool.py \
191
	lib/workerpool.py
192

193
client_PYTHON = \
194
	lib/client/__init__.py \
195
	lib/client/gnt_backup.py \
196
	lib/client/gnt_cluster.py \
197
	lib/client/gnt_debug.py \
198
	lib/client/gnt_group.py \
199
	lib/client/gnt_instance.py \
200
	lib/client/gnt_job.py \
201
	lib/client/gnt_node.py \
202
	lib/client/gnt_os.py
203

204
205
206
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
207
	lib/hypervisor/hv_chroot.py \
208
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
209
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
210
	lib/hypervisor/hv_lxc.py \
211
212
	lib/hypervisor/hv_xen.py

213
214
rapi_PYTHON = \
	lib/rapi/__init__.py \
215
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
216
	lib/rapi/client.py \
217
	lib/rapi/client_utils.py \
218
219
	lib/rapi/connector.py \
	lib/rapi/rlib2.py
220

221
http_PYTHON = \
222
	lib/http/__init__.py \
223
	lib/http/auth.py \
224
225
	lib/http/client.py \
	lib/http/server.py
226

Guido Trotter's avatar
Guido Trotter committed
227
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
228
	lib/confd/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
229
	lib/confd/client.py \
230
231
	lib/confd/querylib.py \
	lib/confd/server.py
232

Michael Hanselmann's avatar
Michael Hanselmann committed
233
masterd_PYTHON = \
234
235
	lib/masterd/__init__.py \
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
236

237
238
239
impexpd_PYTHON = \
	lib/impexpd/__init__.py

240
241
242
watcher_PYTHON = \
	lib/watcher/__init__.py

243
server_PYTHON = \
244
	lib/server/__init__.py \
245
	lib/server/confd.py \
246
	lib/server/masterd.py \
247
248
	lib/server/noded.py \
	lib/server/rapi.py
249

250
utils_PYTHON = \
251
	lib/utils/__init__.py \
252
	lib/utils/algo.py \
253
	lib/utils/filelock.py \
254
	lib/utils/hash.py \
255
	lib/utils/io.py \
256
	lib/utils/log.py \
257
	lib/utils/mlock.py \
258
	lib/utils/nodesetup.py \
259
	lib/utils/process.py \
260
	lib/utils/retry.py \
261
	lib/utils/text.py \
262
263
	lib/utils/wrapper.py \
	lib/utils/x509.py
264

Michael Hanselmann's avatar
Michael Hanselmann committed
265
docrst = \
266
	doc/admin.rst \
267
	doc/design-2.0.rst \
268
	doc/design-2.1.rst \
269
	doc/design-2.2.rst \
Guido Trotter's avatar
Guido Trotter committed
270
	doc/design-2.3.rst \
271
	doc/design-htools-2.3.rst \
272
	doc/design-2.4.rst \
273
	doc/design-draft.rst \
274
	doc/design-oob.rst \
275
	doc/design-query2.rst \
276
	doc/cluster-merge.rst \
277
	doc/design-shared-storage.rst \
278
	doc/devnotes.rst \
279
	doc/glossary.rst \
280
	doc/hooks.rst \
281
	doc/iallocator.rst \
282
	doc/index.rst \
283
	doc/install-quick.rst \
284
	doc/install.rst \
285
	doc/locking.rst \
286
	doc/move-instance.rst \
Iustin Pop's avatar
Iustin Pop committed
287
	doc/news.rst \
288
	doc/rapi.rst \
289
	doc/security.rst \
290
	doc/upgrade.rst \
Iustin Pop's avatar
Iustin Pop committed
291
	doc/walkthrough.rst
Michael Hanselmann's avatar
Michael Hanselmann committed
292

293
HS_PROGS = \
294
295
296
297
298
	htools/hbal \
	htools/hscan \
	htools/hail \
	htools/hspace

299
300
HS_ALL_PROGS = $(HS_PROGS) htools/test
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
301
# we don't add -Werror by default
302
HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
303
# extra flags that can be overriden on the command line
304
HEXTRA =
305
306
# exclude options for coverage reports
HPCEXCL = --exclude Main --exclude Ganeti.HTools.QC
307

308
HS_LIB_SRCS = \
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
	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

330
331
HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
332

333
334
$(RUN_IN_TEMPDIR): | $(all_dirfiles)

Iustin Pop's avatar
Iustin Pop committed
335
336
337
338
339
# 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
340
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
Iustin Pop's avatar
Iustin Pop committed
341
342
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
	| lib/_autoconf.py
343
344
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
345
	@mkdir_p@ $(dir $@)
346
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
347
	    -d . \
348
349
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
350
351
352
353
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

354
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
355

356
doc/install-quick.rst: INSTALL
357
doc/news.rst: NEWS
358
doc/upgrade.rst: UPGRADE
359

360
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
361
362
363
364
365
366
367
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

368
docdot = \
369
370
371
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
372

373
docpng = $(patsubst %.dot,%.png,$(docdot))
374

375
376
377
378
379
380
381
382
# 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 \
383
	doc/examples/ganeti-kvm-poweroff.initd \
384
	doc/examples/gnt-config-backup \
385
386
	doc/examples/hooks/ipsec \
	$(manhtml)
387

388
gnt_scripts = \
389
390
391
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
392
	scripts/gnt-group \
393
394
395
396
397
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

398
PYTHON_BOOTSTRAP = \
399
	daemons/ganeti-confd \
400
	daemons/ganeti-masterd \
401
	daemons/ganeti-noded \
402
	daemons/ganeti-watcher \
403
	daemons/ganeti-rapi \
404
	scripts/gnt-backup \
405
	scripts/gnt-cluster \
406
	scripts/gnt-debug \
407
	scripts/gnt-group \
408
	scripts/gnt-instance \
409
	scripts/gnt-job \
410
	scripts/gnt-node \
411
	scripts/gnt-os
412

413
414
415
416
417
418
419
420
421
422
423
424
425
426
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

427
bin_SCRIPTS =
428
iallocators_SCRIPTS =
429
if WANT_HTOOLS
430
431
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
iallocators_SCRIPTS += $(filter htools/hail,$(HS_PROGS))
432
433
endif

434
$(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
435
436
437
438
439
	BINARY=$(@:htools/%=%); \
	$(GHC) --make \
	  $(HFLAGS) $(HEXTRA) $(HTOOLS_NOCURL) \
	  -osuf $$BINARY.o -hisuf $$BINARY.hi \
	  $@
440

441
442
443
444
445
# 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

446
447
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
448

449
nodist_sbin_SCRIPTS = \
450
	$(PYTHON_BOOTSTRAP) \
451
452
	daemons/ganeti-cleaner

453
454
455
456
dist_tools_SCRIPTS = \
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
457
	tools/cfgupgrade12 \
458
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
459
	tools/lvmstrap \
460
	tools/move-instance \
461
	tools/setup-ssh \
Iustin Pop's avatar
Iustin Pop committed
462
	tools/sanitize-config
463

464
pkglib_python_scripts = \
465
466
	daemons/import-export \
	tools/check-cert-expired
467

468
pkglib_SCRIPTS = \
469
	daemons/daemon-util \
470
	daemons/ensure-dirs \
471
	tools/kvm-ifup \
472
	$(pkglib_python_scripts)
473

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

man_MANS = \
	man/ganeti.7 \
525
	man/ganeti-cleaner.8 \
Guido Trotter's avatar
Guido Trotter committed
526
	man/ganeti-confd.8 \
527
	man/ganeti-listrunner.8 \
528
	man/ganeti-masterd.8 \
529
530
	man/ganeti-noded.8 \
	man/ganeti-os-interface.7 \
531
	man/ganeti-rapi.8 \
532
533
534
	man/ganeti-watcher.8 \
	man/gnt-backup.8 \
	man/gnt-cluster.8 \
535
	man/gnt-debug.8 \
536
	man/gnt-group.8 \
537
	man/gnt-instance.8 \
538
	man/gnt-job.8 \
539
	man/gnt-node.8 \
540
541
542
543
544
	man/gnt-os.8 \
	man/hail.1 \
	man/hbal.1 \
	man/hscan.1 \
	man/hspace.1
545

546
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
Iustin Pop's avatar
Iustin Pop committed
547
manhtml = $(patsubst %.rst,%.html,$(manrst))
548
mangen = $(patsubst %.rst,%.gen,$(manrst))
549
maninput = \
550
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
Iustin Pop's avatar
Iustin Pop committed
551
	$(patsubst %.html,%.html.in,$(manhtml)) \
552
	man/footer.man man/footer.html $(mangen)
553
554

TEST_FILES = \
Manuel Franceschini's avatar
Manuel Franceschini committed
555
556
557
558
559
	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 \
560
	test/data/cert1.pem \
561
	test/data/proc_drbd8.txt \
562
	test/data/proc_drbd80-emptyline.txt \
563
	test/data/proc_drbd83.txt \
564
	test/data/sys_drbd_usermode_helper.txt \
565
	test/import-export_unittest-helper
566

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

628
629
haskell_tests = htools/test

630
dist_TESTS = \
631
	test/check-cert-expired_unittest.bash \
632
	test/daemon-util_unittest.bash \
633
	test/ganeti-cleaner_unittest.bash \
634
	test/import-export_unittest.bash \
635
636
	$(python_tests)

637
nodist_TESTS =
638
639
640
if WANT_HTOOLS
nodist_TESTS += $(haskell_tests)
endif
641
642
643

TESTS = $(dist_TESTS) $(nodist_TESTS)

644
645
646
647
648
# Environment for all tests
PLAIN_TESTS_ENVIRONMENT = \
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)

# Environment for tests run by automake
649
TESTS_ENVIRONMENT = \
650
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
651

652
all_python_code = \
653
654
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
655
	$(pkglib_python_scripts) \
656
	$(python_tests) \
657
	$(pkgpython_PYTHON) \
658
	$(client_PYTHON) \
659
660
	$(hypervisor_PYTHON) \
	$(rapi_PYTHON) \
661
	$(server_PYTHON) \
662
663
	$(http_PYTHON) \
	$(confd_PYTHON) \
Michael Hanselmann's avatar
Michael Hanselmann committed
664
	$(masterd_PYTHON) \
665
	$(impexpd_PYTHON) \
666
	$(utils_PYTHON) \
667
	$(watcher_PYTHON) \
668
669
	$(noinst_PYTHON) \
	$(qa_scripts)
670

671
srclink_files = \
Iustin Pop's avatar
Iustin Pop committed
672
	man/footer.rst \
673
	test/check-cert-expired_unittest.bash \
674
	test/daemon-util_unittest.bash \
675
	test/ganeti-cleaner_unittest.bash \
676
	test/import-export_unittest.bash \
677
	$(all_python_code) \
678
	$(HS_LIB_SRCS) $(HS_PROG_SRCS)
679
680

check_python_code = \
681
	$(BUILD_BASH_COMPLETION) \
682
	$(DOCPP) \
683
684
	$(all_python_code)

685
lint_python_code = \
686
	ganeti \
687
	ganeti/http/server.py \
688
689
	$(dist_sbin_SCRIPTS) \
	$(dist_tools_SCRIPTS) \
690
	$(pkglib_python_scripts) \
691
	$(BUILD_BASH_COMPLETION) \
692
	$(DOCPP) \
693
	$(PYTHON_BOOTSTRAP)
694

695
696
test/daemon-util_unittest.bash: daemons/daemon-util

697
698
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner

699
700
701
702
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod +x $@

703
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
704
705
706
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod u+x $@

707
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
708
	sed -f $(REPLACE_VARS_SED) < $< > $@
709
	chmod +x $@
710

711
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
712
713
	sed -f $(REPLACE_VARS_SED) < $< > $@

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

717
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
718
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
719
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
720

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

Iustin Pop's avatar
Iustin Pop committed
725
726
727
728
729
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
730
731
732
733
734
man/footer.html: man/footer.rst
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
	$(PANDOC) -f rst -t html -o $@ $<

735
736
737
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@

738
man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
Iustin Pop's avatar
Iustin Pop committed
739
740
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
741
	set -o pipefail ; \
Iustin Pop's avatar
Iustin Pop committed
742
743
	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
	  sed -e 's/\\@/@/g' > $@
744
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
Iustin Pop's avatar
Iustin Pop committed
745

746
man/%.html.in: man/%.gen man/footer.html
Iustin Pop's avatar
Iustin Pop committed
747
748
	@test -n "$(PANDOC)" || \
	  { echo 'pandoc' not found during configure; exit 1; }
749
	set -o pipefail ; \
Iustin Pop's avatar
Iustin Pop committed
750
751
752
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
	  sed -e 's/\\@/@/g' > $@

753
754
755
man/%.1: man/%.1.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@

756
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
757
	sed -f $(REPLACE_VARS_SED) < $< > $@
758

759
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
760
	sed -f $(REPLACE_VARS_SED) < $< > $@
761

762
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
Iustin Pop's avatar
Iustin Pop committed
763
	sed -f $(REPLACE_VARS_SED) < $< > $@
764

765
766
epydoc.conf: epydoc.conf.in Makefile
	sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
767

768
769
770
771
772
773
774
775
776
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:
777
	set -e; \
778
779
780
781
782
783
	cd $(srcdir); \
	if test -d .git; then \
	  rm -f vcs-version; \
	  $(MAKE) vcs-version; \
	fi

784
785
786
787
788
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/" < $< > $@

789
lib/_autoconf.py: Makefile vcs-version | lib/.dir
790
791
	set -e; \
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
792
793
	{ echo '# This file is automatically generated, do not edit!'; \
	  echo '#'; \
Iustin Pop's avatar
Iustin Pop committed
794
795
796
797
798
799
800
801
802
	  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 ''; \
803
804
805
806
	  echo '# pylint: disable-msg=C0301,C0324'; \
	  echo '# because this is autogenerated, we do not want'; \
	  echo '# style warnings' ; \
	  echo ''; \
807
808
809
810
811
812
813
814
	  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)'"; \