Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 1375e1d9

History | View | Annotate | Download (30.1 kB)

1
# Ganeti makefile
2
# - Indent with tabs only.
3
# - Keep files sorted; one line per file.
4
# - Directories in lib/ must have their own *dir variable (see hypervisor).
5
# - All directories must be listed DIRS.
6
# - Use autogen.sh to generate Makefile.in and configure script.
7

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

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

    
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
REPLACE_VARS_SED = autotools/replace_vars.sed
24

    
25
# Note: these are automake-specific variables, and must be named after
26
# the directory + 'dir' suffix
27
clientdir = $(pkgpythondir)/client
28
hypervisordir = $(pkgpythondir)/hypervisor
29
httpdir = $(pkgpythondir)/http
30
masterddir = $(pkgpythondir)/masterd
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
docdir = $(datadir)/doc/$(PACKAGE)
40

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

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

    
49
DIRS = \
50
	autotools \
51
	daemons \
52
	devel \
53
	doc \
54
	doc/examples \
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 \
65
	lib/masterd \
66
	lib/rapi \
67
	lib/server \
68
	lib/utils \
69
	lib/watcher \
70
	man \
71
	qa \
72
	test \
73
	test/data \
74
	tools
75

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

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

    
91
DIRCHECK_EXCLUDE = \
92
	$(BUILDTIME_DIRS) \
93
	ganeti-[0-9]*.[0-9]*.[0-9]* \
94
	doc/html/_*
95

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

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

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

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

    
117
CLEANFILES = \
118
	$(addsuffix /*.py[co],$(DIRS)) \
119
	$(addsuffix /*.hi,$(HTOOLS_DIRS)) \
120
	$(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 \
134
	doc/examples/hooks/ipsec \
135
	$(man_MANS) \
136
	$(manhtml) \
137
	tools/kvm-ifup \
138
	stamp-srclinks \
139
	$(nodist_pkgpython_PYTHON) \
140
	$(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
141
	.hpc/*.mix htools/*.tix \
142
	doc/hs-lint.html
143

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

    
153
nodist_pkgpython_PYTHON = \
154
	lib/_autoconf.py
155

    
156
noinst_PYTHON = \
157
	lib/build/__init__.py \
158
	lib/build/sphinx_ext.py
159

    
160
pkgpython_PYTHON = \
161
	lib/__init__.py \
162
	lib/asyncnotifier.py \
163
	lib/backend.py \
164
	lib/bdev.py \
165
	lib/bootstrap.py \
166
	lib/cli.py \
167
	lib/cmdlib.py \
168
	lib/compat.py \
169
	lib/config.py \
170
	lib/constants.py \
171
	lib/daemon.py \
172
	lib/errors.py \
173
	lib/ht.py \
174
	lib/jqueue.py \
175
	lib/jstore.py \
176
	lib/locking.py \
177
	lib/luxi.py \
178
	lib/mcpu.py \
179
	lib/netutils.py \
180
	lib/objects.py \
181
	lib/opcodes.py \
182
	lib/qlang.py \
183
	lib/query.py \
184
	lib/rpc.py \
185
	lib/runtime.py \
186
	lib/serializer.py \
187
	lib/ssconf.py \
188
	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
hypervisor_PYTHON = \
205
	lib/hypervisor/__init__.py \
206
	lib/hypervisor/hv_base.py \
207
	lib/hypervisor/hv_chroot.py \
208
	lib/hypervisor/hv_fake.py \
209
	lib/hypervisor/hv_kvm.py \
210
	lib/hypervisor/hv_lxc.py \
211
	lib/hypervisor/hv_xen.py
212

    
213
rapi_PYTHON = \
214
	lib/rapi/__init__.py \
215
	lib/rapi/baserlib.py \
216
	lib/rapi/client.py \
217
	lib/rapi/client_utils.py \
218
	lib/rapi/connector.py \
219
	lib/rapi/rlib2.py
220

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

    
227
confd_PYTHON = \
228
	lib/confd/__init__.py \
229
	lib/confd/client.py \
230
	lib/confd/querylib.py \
231
	lib/confd/server.py
232

    
233
masterd_PYTHON = \
234
	lib/masterd/__init__.py \
235
	lib/masterd/instance.py
236

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

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

    
243
server_PYTHON = \
244
	lib/server/__init__.py \
245
	lib/server/confd.py \
246
	lib/server/masterd.py \
247
	lib/server/noded.py \
248
	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
	lib/utils/wrapper.py \
263
	lib/utils/x509.py
264

    
265
docrst = \
266
	doc/admin.rst \
267
	doc/design-2.0.rst \
268
	doc/design-2.1.rst \
269
	doc/design-2.2.rst \
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/design-x509-ca.rst \
277
	doc/design-http-server.rst \
278
	doc/design-impexp2.rst \
279
	doc/cluster-merge.rst \
280
	doc/design-shared-storage.rst \
281
	doc/devnotes.rst \
282
	doc/glossary.rst \
283
	doc/hooks.rst \
284
	doc/iallocator.rst \
285
	doc/index.rst \
286
	doc/install-quick.rst \
287
	doc/install.rst \
288
	doc/locking.rst \
289
	doc/move-instance.rst \
290
	doc/news.rst \
291
	doc/rapi.rst \
292
	doc/security.rst \
293
	doc/upgrade.rst \
294
	doc/walkthrough.rst
295

    
296
HS_PROGS = \
297
	htools/hbal \
298
	htools/hscan \
299
	htools/hail \
300
	htools/hspace
301

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

    
311
HS_LIB_SRCS = \
312
	htools/Ganeti/HTools/CLI.hs \
313
	htools/Ganeti/HTools/Cluster.hs \
314
	htools/Ganeti/HTools/Container.hs \
315
	htools/Ganeti/HTools/ExtLoader.hs \
316
	htools/Ganeti/HTools/Group.hs \
317
	htools/Ganeti/HTools/IAlloc.hs \
318
	htools/Ganeti/HTools/Instance.hs \
319
	htools/Ganeti/HTools/Loader.hs \
320
	htools/Ganeti/HTools/Luxi.hs \
321
	htools/Ganeti/HTools/Node.hs \
322
	htools/Ganeti/HTools/PeerMap.hs \
323
	htools/Ganeti/HTools/QC.hs \
324
	htools/Ganeti/HTools/Rapi.hs \
325
	htools/Ganeti/HTools/Simu.hs \
326
	htools/Ganeti/HTools/Text.hs \
327
	htools/Ganeti/HTools/Types.hs \
328
	htools/Ganeti/HTools/Utils.hs \
329
	htools/Ganeti/Jobs.hs \
330
	htools/Ganeti/Luxi.hs \
331
	htools/Ganeti/OpCodes.hs
332

    
333
HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs
334
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
335

    
336
$(RUN_IN_TEMPDIR): | $(all_dirfiles)
337

    
338
# Note: we use here an order-only prerequisite, as the contents of
339
# _autoconf.py are not actually influencing the html build output: it
340
# has to exist in order for the sphinx module to be loaded
341
# successfully, but we certainly don't want the docs to be rebuilt if
342
# it changes
343
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
344
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
345
	| lib/_autoconf.py
346
	@test -n "$(SPHINX)" || \
347
	    { echo 'sphinx-build' not found during configure; exit 1; }
348
	@mkdir_p@ $(dir $@)
349
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
350
	    -d . \
351
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
352
	    -D release="$(PACKAGE_VERSION)" \
353
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
354
	rm -f doc/html/.buildinfo doc/html/objects.inv
355
	touch $@
356

    
357
doc/html: doc/html/index.html
358

    
359
doc/install-quick.rst: INSTALL
360
doc/news.rst: NEWS
361
doc/upgrade.rst: UPGRADE
362

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

    
371
docdot = \
372
	doc/arch-2.0.dot \
373
	doc/design-2.1-lock-acquire.dot \
374
	doc/design-2.1-lock-release.dot
375

    
376
docpng = $(patsubst %.dot,%.png,$(docdot))
377

    
378
# Things to build but not to install (add it to EXTRA_DIST if it should be
379
# distributed)
380
noinst_DATA = \
381
	devel/upload \
382
	doc/html \
383
	doc/examples/bash_completion \
384
	doc/examples/ganeti.cron \
385
	doc/examples/ganeti.initd \
386
	doc/examples/ganeti-kvm-poweroff.initd \
387
	doc/examples/gnt-config-backup \
388
	doc/examples/hooks/ipsec \
389
	$(manhtml)
390

    
391
gnt_scripts = \
392
	scripts/gnt-backup \
393
	scripts/gnt-cluster \
394
	scripts/gnt-debug \
395
	scripts/gnt-group \
396
	scripts/gnt-instance \
397
	scripts/gnt-job \
398
	scripts/gnt-node \
399
	scripts/gnt-os
400

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

    
416
qa_scripts = \
417
	qa/ganeti-qa.py \
418
	qa/qa_cluster.py \
419
	qa/qa_config.py \
420
	qa/qa_daemon.py \
421
	qa/qa_env.py \
422
	qa/qa_error.py \
423
	qa/qa_instance.py \
424
	qa/qa_node.py \
425
	qa/qa_os.py \
426
	qa/qa_rapi.py \
427
	qa/qa_tags.py \
428
	qa/qa_utils.py
429

    
430
bin_SCRIPTS =
431
iallocators_SCRIPTS =
432
if WANT_HTOOLS
433
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
434
iallocators_SCRIPTS += $(filter htools/hail,$(HS_PROGS))
435
endif
436

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

    
444
# for the htools/test binary, we need to enable profiling/coverage
445
htools/test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
446
	-fno-warn-monomorphism-restriction -fno-warn-orphans \
447
	-fno-warn-missing-methods -fno-warn-unused-imports
448

    
449
dist_sbin_SCRIPTS = \
450
	tools/ganeti-listrunner
451

    
452
nodist_sbin_SCRIPTS = \
453
	$(PYTHON_BOOTSTRAP) \
454
	daemons/ganeti-cleaner
455

    
456
dist_tools_SCRIPTS = \
457
	tools/burnin \
458
	tools/cfgshell \
459
	tools/cfgupgrade \
460
	tools/cfgupgrade12 \
461
	tools/cluster-merge \
462
	tools/lvmstrap \
463
	tools/move-instance \
464
	tools/setup-ssh \
465
	tools/sanitize-config
466

    
467
pkglib_python_scripts = \
468
	daemons/import-export \
469
	tools/check-cert-expired
470

    
471
pkglib_SCRIPTS = \
472
	daemons/daemon-util \
473
	daemons/ensure-dirs \
474
	tools/kvm-ifup \
475
	$(pkglib_python_scripts)
476

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

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

    
549
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
550
manhtml = $(patsubst %.rst,%.html,$(manrst))
551
mangen = $(patsubst %.rst,%.gen,$(manrst))
552
maninput = \
553
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
554
	$(patsubst %.html,%.html.in,$(manhtml)) \
555
	man/footer.man man/footer.html $(mangen)
556

    
557
TEST_FILES = \
558
	test/data/bdev-drbd-8.0.txt \
559
	test/data/bdev-drbd-8.3.txt \
560
	test/data/bdev-drbd-disk.txt \
561
	test/data/bdev-drbd-net-ip4.txt \
562
	test/data/bdev-drbd-net-ip6.txt \
563
	test/data/cert1.pem \
564
	test/data/proc_drbd8.txt \
565
	test/data/proc_drbd80-emptyline.txt \
566
	test/data/proc_drbd83.txt \
567
	test/data/sys_drbd_usermode_helper.txt \
568
	test/import-export_unittest-helper
569

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

    
631
haskell_tests = htools/test
632

    
633
dist_TESTS = \
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
	$(python_tests)
639

    
640
nodist_TESTS =
641
if WANT_HTOOLS
642
nodist_TESTS += $(haskell_tests)
643
endif
644

    
645
TESTS = $(dist_TESTS) $(nodist_TESTS)
646

    
647
# Environment for all tests
648
PLAIN_TESTS_ENVIRONMENT = \
649
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
650

    
651
# Environment for tests run by automake
652
TESTS_ENVIRONMENT = \
653
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
654

    
655
all_python_code = \
656
	$(dist_sbin_SCRIPTS) \
657
	$(dist_tools_SCRIPTS) \
658
	$(pkglib_python_scripts) \
659
	$(python_tests) \
660
	$(pkgpython_PYTHON) \
661
	$(client_PYTHON) \
662
	$(hypervisor_PYTHON) \
663
	$(rapi_PYTHON) \
664
	$(server_PYTHON) \
665
	$(http_PYTHON) \
666
	$(confd_PYTHON) \
667
	$(masterd_PYTHON) \
668
	$(impexpd_PYTHON) \
669
	$(utils_PYTHON) \
670
	$(watcher_PYTHON) \
671
	$(noinst_PYTHON) \
672
	$(qa_scripts)
673

    
674
srclink_files = \
675
	man/footer.rst \
676
	test/check-cert-expired_unittest.bash \
677
	test/daemon-util_unittest.bash \
678
	test/ganeti-cleaner_unittest.bash \
679
	test/import-export_unittest.bash \
680
	$(all_python_code) \
681
	$(HS_LIB_SRCS) $(HS_PROG_SRCS)
682

    
683
check_python_code = \
684
	$(BUILD_BASH_COMPLETION) \
685
	$(DOCPP) \
686
	$(all_python_code)
687

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

    
698
test/daemon-util_unittest.bash: daemons/daemon-util
699

    
700
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
701

    
702
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
703
	sed -f $(REPLACE_VARS_SED) < $< > $@
704
	chmod +x $@
705

    
706
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
707
	sed -f $(REPLACE_VARS_SED) < $< > $@
708
	chmod u+x $@
709

    
710
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
711
	sed -f $(REPLACE_VARS_SED) < $< > $@
712
	chmod +x $@
713

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

    
717
doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
718
	sed -f $(REPLACE_VARS_SED) < $< > $@
719

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

    
724
doc/%.png: doc/%.dot
725
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
726
	$(DOT) -Tpng -o $@ $<
727

    
728
man/footer.man: man/footer.rst
729
	@test -n "$(PANDOC)" || \
730
	  { echo 'pandoc' not found during configure; exit 1; }
731
	$(PANDOC) -f rst -t man -o $@ $<
732

    
733
man/footer.html: man/footer.rst
734
	@test -n "$(PANDOC)" || \
735
	  { echo 'pandoc' not found during configure; exit 1; }
736
	$(PANDOC) -f rst -t html -o $@ $<
737

    
738
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
739
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
740

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

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

    
756
man/%.1: man/%.1.in $(REPLACE_VARS_SED)
757
	sed -f $(REPLACE_VARS_SED) < $< > $@
758

    
759
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
760
	sed -f $(REPLACE_VARS_SED) < $< > $@
761

    
762
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
763
	sed -f $(REPLACE_VARS_SED) < $< > $@
764

    
765
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
766
	sed -f $(REPLACE_VARS_SED) < $< > $@
767

    
768
epydoc.conf: epydoc.conf.in Makefile
769
	sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
770

    
771
vcs-version:
772
	if test -d .git; then \
773
	  git describe > $@; \
774
	elif test ! -f $@ ; then \
775
	  echo "Cannot auto-generate $@ file"; exit 1; \
776
	fi
777

    
778
.PHONY: regen-vcs-version
779
regen-vcs-version:
780
	set -e; \
781
	cd $(srcdir); \
782
	if test -d .git; then \
783
	  rm -f vcs-version; \
784
	  $(MAKE) vcs-version; \
785
	fi
786

    
787
htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version
788
	set -e; \
789
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
790
	sed -e "s/%ver%/$$VCSVER/" < $< > $@
791

    
792
lib/_autoconf.py: Makefile vcs-version | lib/.dir
793
	set -e; \
794
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
795
	{ echo '# This file is automatically generated, do not edit!'; \
796
	  echo '#'; \
797
	  echo ''; \
798
	  echo '"""Build-time configuration for Ganeti.'; \
799
	  echo '';\
800
	  echo 'This file is autogenerated by the build process.'; \
801
	  echo 'For any changes you need to re-run ./configure (and'; \
802
	  echo 'not edit by hand).'; \
803
	  echo ''; \
804
	  echo '"""'; \
805
	  echo ''; \
806
	  echo '# pylint: disable-msg=C0301,C0324'; \
807
	  echo '# because this is autogenerated, we do not want'; \
808
	  echo '# style warnings' ; \
809
	  echo ''; \
810
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
811
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
812
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
813
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
814
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
815
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
816
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
817
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
818
	  echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
819
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
820
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
821
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
822
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
823
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
824
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
825
	  echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
826
	  echo "SHARED_FILE_STORAGE_DIR = '$(SHARED_FILE_STORAGE_DIR)'"; \
827
	  echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \
828
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
829
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
830
	  echo "SOCAT_PATH = '$(SOCAT)'"; \
831
	  echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
832
	  echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
833
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
834
	  echo "TOOLSDIR = '$(toolsdir)'"; \
835
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
836
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
837
	  echo "DRBD_BARRIERS = $(DRBD_BARRIERS)"; \
838
	  echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
839
	  echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
840
	  echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
841
	  echo "MASTERD_USER = '$(MASTERD_USER)'"; \
842
	  echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
843
	  echo "RAPI_USER = '$(RAPI_USER)'"; \
844
	  echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
845
	  echo "CONFD_USER = '$(CONFD_USER)'"; \
846
	  echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
847
	  echo "NODED_USER = '$(NODED_USER)'"; \
848
	  echo "VCS_VERSION = '$$VCSVER'"; \
849
	  echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
850
	} > $@
851

    
852
$(REPLACE_VARS_SED): Makefile
853
	set -e; \
854
	{ echo 's#@PREFIX@#$(prefix)#g'; \
855
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
856
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
857
	  echo 's#@BINDIR@#$(bindir)#g'; \
858
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
859
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
860
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
861
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
862
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
863
	  echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
864
	  echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
865
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
866
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
867
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
868
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
869
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
870
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
871
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
872
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
873
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
874
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
875
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
876
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
877
	} > $@
878

    
879
# Using deferred evaluation
880
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
881
daemons/ganeti-watcher: MODULE = ganeti.watcher
882
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
883

    
884
$(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
885
	test -n "$(MODULE)" || { echo Missing module; exit 1; }
886
	set -e; \
887
	{ echo '#!/usr/bin/python'; \
888
	  echo '# This file is automatically generated, do not edit!'; \
889
	  echo "# Edit $(MODULE) instead."; \
890
	  echo; \
891
	  echo '"""Bootstrap script for L{$(MODULE)}"""'; \
892
	  echo; \
893
	  echo '# pylint: disable-msg=C0103'; \
894
	  echo '# C0103: Invalid name'; \
895
	  echo; \
896
	  echo 'import sys'; \
897
	  echo 'import $(MODULE) as main'; \
898
	  echo; \
899
	  echo '# Temporarily alias commands until bash completion'; \
900
	  echo '# generator is changed'; \
901
	  echo 'if hasattr(main, "commands"):'; \
902
		echo '  commands = main.commands # pylint: disable-msg=E1101'; \
903
	  echo; \
904
	  echo 'if __name__ == "__main__":'; \
905
	  echo '  sys.exit(main.Main())'; \
906
	} > $@
907
	chmod u+x $@
908

    
909
# We need to create symlinks because "make distcheck" will not install Python
910
# files when building.
911
stamp-srclinks: Makefile | $(all_dirfiles)
912
	set -e; \
913
	for i in $(srclink_files); do \
914
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
915
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
916
		fi; \
917
	done
918
	touch $@
919

    
920
.PHONY: ganeti
921
ganeti:
922
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
923

    
924
.PHONY: check-dirs
925
check-dirs: $(BUILT_SOURCES)
926
	@set -e; \
927
	find . -type d \( \( -name . \) -o \( \
928
		-name .git -o \
929
		-name autom4te.cache \
930
		\) -prune -o -print \) | { \
931
		error=; \
932
		while read dir; do \
933
			case "$$dir" in \
934
				$(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
935
				*) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
936
			esac; \
937
		done; \
938
		for dir in $(DIRS); do \
939
			if ! test -d "$$dir"; then \
940
				echo "Directory $$dir listed in DIRS does not exist" >&2; \
941
				error=1; \
942
			fi \
943
		done; \
944
		if test -n "$$error"; then exit 1; else exit 0; fi; \
945
	}
946

    
947
check-local: check-dirs
948
	$(CHECK_PYTHON_CODE) $(check_python_code)
949
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
950
	$(CHECK_NEWS) < $(top_srcdir)/NEWS
951

    
952
.PHONY: lint
953
lint: $(BUILT_SOURCES)
954
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
955
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
956
	cd $(top_srcdir)/qa && \
957
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
958
	  --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
959

    
960
.PHONY: hlint
961
hlint: $(HS_BUILT_SRCS)
962
	if tty -s; then C="-c"; else C=""; fi; \
963
	hlint --report=doc/hs-lint.html $$C htools
964

    
965
# a dist hook rule for updating the vcs-version file; this is
966
# hardcoded due to where it needs to build the file...
967
dist-hook:
968
	$(MAKE) regen-vcs-version && \
969
	rm -f $(top_distdir)/vcs-version && \
970
	cp -p $(srcdir)/vcs-version $(top_distdir)
971

    
972
# a distcheck hook rule for catching revision control directories
973
distcheck-hook:
974
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
975
		echo "Found revision control files in final archive." 1>&2; \
976
		exit 1; \
977
	fi
978
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
979
		echo "Found Python byte code in final archive." 1>&2; \
980
		exit 1; \
981
	fi
982
	if find $(top_distdir) -name '*~' | grep .; then \
983
		echo "Found backup files in final archive." 1>&2; \
984
		exit 1; \
985
	fi
986
# Empty files or directories should not be distributed. They can cause
987
# unnecessary warnings for packagers. Directories used by automake during
988
# distcheck must be excluded.
989
	if find $(top_distdir) -empty -and -not \( \
990
			-path $(top_distdir)/_build -or \
991
			-path $(top_distdir)/_inst \) | grep .; then \
992
		echo "Found empty files or directories in final archive." 1>&2; \
993
		exit 1; \
994
	fi
995
	if test -n "$(BUILD_RELEASE)" && \
996
	   grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
997
		echo "Found unreleased version in NEWS." >&2; \
998
		exit 1; \
999
	fi
1000

    
1001
# When building a release, stricter checks should be used
1002
distcheck-release dist-release: export BUILD_RELEASE = 1
1003
distcheck-release: distcheck
1004

    
1005
dist-release: dist
1006
	set -e; \
1007
	for i in $(DIST_ARCHIVES); do \
1008
		echo -n "Checking $$i ... "; \
1009
		autotools/check-tar < $$i; \
1010
		echo OK; \
1011
	done
1012

    
1013
install-exec-local:
1014
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1015
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
1016
	  "$(DESTDIR)${localstatedir}/run/ganeti"
1017

    
1018
# To avoid conflicts between directory names and other targets, a file inside
1019
# the directory is used to ensure its existence.
1020
%.dir:
1021
	@mkdir_p@ $* && touch $@
1022

    
1023
.PHONY: apidoc
1024
if WANT_HTOOLSAPIDOC
1025
apidoc: py-apidoc hs-apidoc
1026
else
1027
apidoc: py-apidoc
1028
endif
1029

    
1030
.PHONY: py-apidoc
1031
py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
1032
	$(RUN_IN_TEMPDIR) epydoc -v \
1033
		--conf $(CURDIR)/epydoc.conf \
1034
		--output $(CURDIR)/$(APIDOC_PY_DIR)
1035

    
1036
.PHONY: hs-apidoc
1037
hs-apidoc: $(HS_BUILT_SRCS)
1038
	@test -n "$(HSCOLOUR)" || \
1039
	    { echo 'HsColour' not found during configure; exit 1; }
1040
	@test -n "$(HADDOCK)" || \
1041
	    { echo 'haddock' not found during configure; exit 1; }
1042
	rm -rf $(APIDOC_HS_DIR)/*
1043
	@mkdir_p@ $(APIDOC_HS_DIR)/Ganeti/HTools
1044
	$(HSCOLOUR) -print-css > $(APIDOC_HS_DIR)/Ganeti/hscolour.css
1045
	ln -s ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/HTools/hscolour.css
1046
	set -e ; \
1047
	cd htools; \
1048
	RELSRCS="$(HS_LIB_SRCS:htools/%=%)"; \
1049
	for file in $$RELSRCS; do \
1050
		hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
1051
		$(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
1052
	done ; \
1053
	$(HADDOCK) --odir ../$(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1054
		-t ganeti-htools -p haddock-prologue \
1055
		--source-module="%{MODULE/.//}.html" \
1056
		--source-entity="%{MODULE/.//}.html#%{NAME}" \
1057
		$(filter-out Ganeti/HTools/ExtLoader.hs,$(HS_LIB_SRCS:htools/%=%))
1058

    
1059
.PHONY: TAGS
1060
TAGS: $(BUILT_SOURCES)
1061
	rm -f TAGS
1062
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
1063
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
1064
	  -path './qa/*.py' | \
1065
	  etags -l python -
1066

    
1067
.PHONY: coverage
1068
if WANT_HTOOLS
1069
coverage: py-coverage hs-coverage
1070
else
1071
coverage: py-coverage
1072
endif
1073

    
1074
.PHONY: py-coverage
1075
py-coverage: $(BUILT_SOURCES) $(python_tests)
1076
	set -e; \
1077
	COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
1078
	TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
1079
	HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
1080
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1081
	$(python_tests)
1082

    
1083
.PHONY: hs-coverage
1084
hs-coverage: $(haskell_tests)
1085
	cd htools && rm -f *.tix *.mix && ./test
1086
	mkdir -p $(COVERAGE_HS_DIR)
1087
	hpc markup --destdir=$(COVERAGE_HS_DIR) htools/test $(HPCEXCL)
1088
	hpc report htools/test $(HPCEXCL)
1089

    
1090
# Special "kind-of-QA" target for htools, needs special setup (all
1091
# tools compiled with -fhpc)
1092
.PHONY: live-test
1093
live-test: all
1094
	set -e ; \
1095
	cd htools; \
1096
	rm -f .hpc; ln -s ../.hpc .hpc; \
1097
	rm -f *.tix *.mix; \
1098
	./live-test.sh; \
1099
	hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:htools/%=%)) \
1100
	  --output=live-test.tix ; \
1101
	@mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
1102
	hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
1103
		--srcdir=.. $(HPCEXCL) ; \
1104
	hpc report --srcdir=.. live-test $(HPCEXCL)
1105

    
1106
commit-check: distcheck lint apidoc
1107

    
1108
-include ./Makefile.local
1109

    
1110
# vim: set noet :