Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 0c39d5eb

History | View | Annotate | Download (30.7 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
pytoolsdir = $(pkgpythondir)/tools
40
docdir = $(datadir)/doc/$(PACKAGE)
41

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

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

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

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

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

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

    
98
all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
99

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

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

    
116
maintainer-clean-local:
117
	rm -rf $(BUILDTIME_DIRS)
118

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

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

    
154
nodist_pkgpython_PYTHON = \
155
	lib/_autoconf.py
156

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

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

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

    
205
hypervisor_PYTHON = \
206
	lib/hypervisor/__init__.py \
207
	lib/hypervisor/hv_base.py \
208
	lib/hypervisor/hv_chroot.py \
209
	lib/hypervisor/hv_fake.py \
210
	lib/hypervisor/hv_kvm.py \
211
	lib/hypervisor/hv_lxc.py \
212
	lib/hypervisor/hv_xen.py
213

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

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

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

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

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

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

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

    
251
pytools_PYTHON = \
252
	lib/tools/__init__.py \
253
	lib/tools/ensure_dirs.py
254

    
255
utils_PYTHON = \
256
	lib/utils/__init__.py \
257
	lib/utils/algo.py \
258
	lib/utils/filelock.py \
259
	lib/utils/hash.py \
260
	lib/utils/io.py \
261
	lib/utils/log.py \
262
	lib/utils/mlock.py \
263
	lib/utils/nodesetup.py \
264
	lib/utils/process.py \
265
	lib/utils/retry.py \
266
	lib/utils/text.py \
267
	lib/utils/wrapper.py \
268
	lib/utils/x509.py
269

    
270
docrst = \
271
	doc/admin.rst \
272
	doc/design-2.0.rst \
273
	doc/design-2.1.rst \
274
	doc/design-2.2.rst \
275
	doc/design-2.3.rst \
276
	doc/design-htools-2.3.rst \
277
	doc/design-2.4.rst \
278
	doc/design-draft.rst \
279
	doc/design-oob.rst \
280
	doc/design-query2.rst \
281
	doc/design-x509-ca.rst \
282
	doc/design-http-server.rst \
283
	doc/design-impexp2.rst \
284
	doc/design-lu-generated-jobs.rst \
285
	doc/cluster-merge.rst \
286
	doc/design-shared-storage.rst \
287
	doc/devnotes.rst \
288
	doc/glossary.rst \
289
	doc/hooks.rst \
290
	doc/iallocator.rst \
291
	doc/index.rst \
292
	doc/install-quick.rst \
293
	doc/install.rst \
294
	doc/locking.rst \
295
	doc/move-instance.rst \
296
	doc/news.rst \
297
	doc/rapi.rst \
298
	doc/security.rst \
299
	doc/upgrade.rst \
300
	doc/walkthrough.rst
301

    
302
HS_PROGS = \
303
	htools/hbal \
304
	htools/hscan \
305
	htools/hail \
306
	htools/hspace
307

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

    
317
HS_LIB_SRCS = \
318
	htools/Ganeti/HTools/CLI.hs \
319
	htools/Ganeti/HTools/Cluster.hs \
320
	htools/Ganeti/HTools/Container.hs \
321
	htools/Ganeti/HTools/ExtLoader.hs \
322
	htools/Ganeti/HTools/Group.hs \
323
	htools/Ganeti/HTools/IAlloc.hs \
324
	htools/Ganeti/HTools/Instance.hs \
325
	htools/Ganeti/HTools/Loader.hs \
326
	htools/Ganeti/HTools/Luxi.hs \
327
	htools/Ganeti/HTools/Node.hs \
328
	htools/Ganeti/HTools/PeerMap.hs \
329
	htools/Ganeti/HTools/QC.hs \
330
	htools/Ganeti/HTools/Rapi.hs \
331
	htools/Ganeti/HTools/Simu.hs \
332
	htools/Ganeti/HTools/Text.hs \
333
	htools/Ganeti/HTools/Types.hs \
334
	htools/Ganeti/HTools/Utils.hs \
335
	htools/Ganeti/Jobs.hs \
336
	htools/Ganeti/Luxi.hs \
337
	htools/Ganeti/OpCodes.hs
338

    
339
HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs
340
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
341

    
342
$(RUN_IN_TEMPDIR): | $(all_dirfiles)
343

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

    
363
doc/html: doc/html/index.html
364

    
365
doc/install-quick.rst: INSTALL
366
doc/news.rst: NEWS
367
doc/upgrade.rst: UPGRADE
368

    
369
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
370
	set -e; \
371
	{ echo '.. This file is automatically updated at build time from $<.'; \
372
	  echo '.. Do not edit.'; \
373
	  echo; \
374
	  cat $<; \
375
	} > $@
376

    
377
docdot = \
378
	doc/arch-2.0.dot \
379
	doc/design-2.1-lock-acquire.dot \
380
	doc/design-2.1-lock-release.dot
381

    
382
docpng = $(patsubst %.dot,%.png,$(docdot))
383

    
384
# Things to build but not to install (add it to EXTRA_DIST if it should be
385
# distributed)
386
noinst_DATA = \
387
	devel/upload \
388
	doc/html \
389
	doc/examples/bash_completion \
390
	doc/examples/ganeti.cron \
391
	doc/examples/ganeti.initd \
392
	doc/examples/ganeti-kvm-poweroff.initd \
393
	doc/examples/gnt-config-backup \
394
	doc/examples/hooks/ipsec \
395
	$(manhtml)
396

    
397
gnt_scripts = \
398
	scripts/gnt-backup \
399
	scripts/gnt-cluster \
400
	scripts/gnt-debug \
401
	scripts/gnt-group \
402
	scripts/gnt-instance \
403
	scripts/gnt-job \
404
	scripts/gnt-node \
405
	scripts/gnt-os
406

    
407
PYTHON_BOOTSTRAP_SBIN = \
408
	daemons/ganeti-confd \
409
	daemons/ganeti-masterd \
410
	daemons/ganeti-noded \
411
	daemons/ganeti-watcher \
412
	daemons/ganeti-rapi \
413
	scripts/gnt-backup \
414
	scripts/gnt-cluster \
415
	scripts/gnt-debug \
416
	scripts/gnt-group \
417
	scripts/gnt-instance \
418
	scripts/gnt-job \
419
	scripts/gnt-node \
420
	scripts/gnt-os
421

    
422
PYTHON_BOOTSTRAP = \
423
	$(PYTHON_BOOTSTRAP_SBIN) \
424
	tools/ensure-dirs
425

    
426
qa_scripts = \
427
	qa/ganeti-qa.py \
428
	qa/qa_cluster.py \
429
	qa/qa_config.py \
430
	qa/qa_daemon.py \
431
	qa/qa_env.py \
432
	qa/qa_error.py \
433
	qa/qa_instance.py \
434
	qa/qa_node.py \
435
	qa/qa_os.py \
436
	qa/qa_rapi.py \
437
	qa/qa_tags.py \
438
	qa/qa_utils.py
439

    
440
bin_SCRIPTS =
441
iallocators_SCRIPTS =
442
if WANT_HTOOLS
443
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
444
iallocators_SCRIPTS += $(filter htools/hail,$(HS_PROGS))
445
endif
446

    
447
$(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
448
	BINARY=$(@:htools/%=%); \
449
	$(GHC) --make \
450
	  $(HFLAGS) $(HEXTRA) $(HTOOLS_NOCURL) \
451
	  -osuf $$BINARY.o -hisuf $$BINARY.hi \
452
	  $@
453

    
454
# for the htools/test binary, we need to enable profiling/coverage
455
htools/test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
456
	-fno-warn-monomorphism-restriction -fno-warn-orphans \
457
	-fno-warn-missing-methods -fno-warn-unused-imports
458

    
459
dist_sbin_SCRIPTS = \
460
	tools/ganeti-listrunner
461

    
462
nodist_sbin_SCRIPTS = \
463
	$(PYTHON_BOOTSTRAP_SBIN) \
464
	daemons/ganeti-cleaner
465

    
466
dist_tools_SCRIPTS = \
467
	tools/burnin \
468
	tools/cfgshell \
469
	tools/cfgupgrade \
470
	tools/cfgupgrade12 \
471
	tools/cluster-merge \
472
	tools/lvmstrap \
473
	tools/move-instance \
474
	tools/setup-ssh \
475
	tools/sanitize-config
476

    
477
pkglib_python_scripts = \
478
	daemons/import-export \
479
	tools/check-cert-expired
480

    
481
nodist_pkglib_python_scripts = \
482
	tools/ensure-dirs
483

    
484
pkglib_SCRIPTS = \
485
	daemons/daemon-util \
486
	tools/kvm-ifup \
487
	$(pkglib_python_scripts)
488

    
489
nodist_pkglib_SCRIPTS = \
490
	$(nodist_pkglib_python_scripts)
491

    
492
EXTRA_DIST = \
493
	NEWS \
494
	UPGRADE \
495
	epydoc.conf.in \
496
	pylintrc \
497
	autotools/build-bash-completion \
498
	autotools/check-python-code \
499
	autotools/check-man \
500
	autotools/check-news \
501
	autotools/check-tar \
502
	autotools/check-version \
503
	autotools/docpp \
504
	autotools/gen-coverage \
505
	autotools/testrunner \
506
	$(RUN_IN_TEMPDIR) \
507
	daemons/daemon-util.in \
508
	daemons/ganeti-cleaner.in \
509
	$(pkglib_python_scripts) \
510
	devel/upload.in \
511
	tools/kvm-ifup.in \
512
	$(docdot) \
513
	$(docpng) \
514
	$(docrst) \
515
	doc/conf.py \
516
	doc/html \
517
	doc/examples/ganeti.initd.in \
518
	doc/examples/ganeti-kvm-poweroff.initd.in \
519
	doc/examples/ganeti.cron.in \
520
	doc/examples/gnt-config-backup.in \
521
	doc/examples/ganeti.default \
522
	doc/examples/ganeti.default-debug \
523
	doc/examples/hooks/ethers \
524
	doc/examples/hooks/ipsec.in \
525
	doc/examples/gnt-debug/README \
526
	doc/examples/gnt-debug/delay0.json \
527
	doc/examples/gnt-debug/delay50.json \
528
	test/testutils.py \
529
	test/mocks.py \
530
	$(dist_TESTS) \
531
	$(TEST_FILES) \
532
	man/footer.rst \
533
	$(manrst) \
534
	$(maninput) \
535
	qa/qa-sample.json \
536
	$(qa_scripts) \
537
	$(HS_LIB_SRCS) $(HS_BUILT_SRCS_IN) \
538
	$(HS_PROG_SRCS)
539

    
540
man_MANS = \
541
	man/ganeti.7 \
542
	man/ganeti-cleaner.8 \
543
	man/ganeti-confd.8 \
544
	man/ganeti-listrunner.8 \
545
	man/ganeti-masterd.8 \
546
	man/ganeti-noded.8 \
547
	man/ganeti-os-interface.7 \
548
	man/ganeti-rapi.8 \
549
	man/ganeti-watcher.8 \
550
	man/gnt-backup.8 \
551
	man/gnt-cluster.8 \
552
	man/gnt-debug.8 \
553
	man/gnt-group.8 \
554
	man/gnt-instance.8 \
555
	man/gnt-job.8 \
556
	man/gnt-node.8 \
557
	man/gnt-os.8 \
558
	man/hail.1 \
559
	man/hbal.1 \
560
	man/hscan.1 \
561
	man/hspace.1
562

    
563
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
564
manhtml = $(patsubst %.rst,%.html,$(manrst))
565
mangen = $(patsubst %.rst,%.gen,$(manrst))
566
maninput = \
567
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
568
	$(patsubst %.html,%.html.in,$(manhtml)) \
569
	man/footer.man man/footer.html $(mangen)
570

    
571
TEST_FILES = \
572
	test/data/bdev-drbd-8.0.txt \
573
	test/data/bdev-drbd-8.3.txt \
574
	test/data/bdev-drbd-disk.txt \
575
	test/data/bdev-drbd-net-ip4.txt \
576
	test/data/bdev-drbd-net-ip6.txt \
577
	test/data/cert1.pem \
578
	test/data/proc_drbd8.txt \
579
	test/data/proc_drbd80-emptyline.txt \
580
	test/data/proc_drbd83.txt \
581
	test/data/sys_drbd_usermode_helper.txt \
582
	test/import-export_unittest-helper
583

    
584
python_tests = \
585
	test/ganeti.asyncnotifier_unittest.py \
586
	test/ganeti.backend_unittest.py \
587
	test/ganeti.bdev_unittest.py \
588
	test/ganeti.cli_unittest.py \
589
	test/ganeti.client.gnt_cluster_unittest.py \
590
	test/ganeti.client.gnt_instance_unittest.py \
591
	test/ganeti.daemon_unittest.py \
592
	test/ganeti.cmdlib_unittest.py \
593
	test/ganeti.compat_unittest.py \
594
	test/ganeti.confd.client_unittest.py \
595
	test/ganeti.config_unittest.py \
596
	test/ganeti.constants_unittest.py \
597
	test/ganeti.errors_unittest.py \
598
	test/ganeti.hooks_unittest.py \
599
	test/ganeti.ht_unittest.py \
600
	test/ganeti.http_unittest.py \
601
	test/ganeti.hypervisor_unittest.py \
602
	test/ganeti.hypervisor.hv_chroot_unittest.py \
603
	test/ganeti.hypervisor.hv_fake_unittest.py \
604
	test/ganeti.hypervisor.hv_kvm_unittest.py \
605
	test/ganeti.hypervisor.hv_lxc_unittest.py \
606
	test/ganeti.hypervisor.hv_xen_unittest.py \
607
	test/ganeti.impexpd_unittest.py \
608
	test/ganeti.jqueue_unittest.py \
609
	test/ganeti.locking_unittest.py \
610
	test/ganeti.luxi_unittest.py \
611
	test/ganeti.masterd.instance_unittest.py \
612
	test/ganeti.mcpu_unittest.py \
613
	test/ganeti.netutils_unittest.py \
614
	test/ganeti.objects_unittest.py \
615
	test/ganeti.opcodes_unittest.py \
616
	test/ganeti.qlang_unittest.py \
617
	test/ganeti.query_unittest.py \
618
	test/ganeti.rapi.baserlib_unittest.py \
619
	test/ganeti.rapi.client_unittest.py \
620
	test/ganeti.rapi.resources_unittest.py \
621
	test/ganeti.rapi.rlib2_unittest.py \
622
	test/ganeti.rpc_unittest.py \
623
	test/ganeti.runtime_unittest.py \
624
	test/ganeti.serializer_unittest.py \
625
	test/ganeti.ssh_unittest.py \
626
	test/ganeti.tools.ensure_dirs_unittest.py \
627
	test/ganeti.uidpool_unittest.py \
628
	test/ganeti.utils.algo_unittest.py \
629
	test/ganeti.utils.filelock_unittest.py \
630
	test/ganeti.utils.hash_unittest.py \
631
	test/ganeti.utils.io_unittest.py \
632
	test/ganeti.utils.log_unittest.py \
633
	test/ganeti.utils.mlock_unittest.py \
634
	test/ganeti.utils.nodesetup_unittest.py \
635
	test/ganeti.utils.process_unittest.py \
636
	test/ganeti.utils.retry_unittest.py \
637
	test/ganeti.utils.text_unittest.py \
638
	test/ganeti.utils.wrapper_unittest.py \
639
	test/ganeti.utils.x509_unittest.py \
640
	test/ganeti.utils_unittest.py \
641
	test/ganeti.workerpool_unittest.py \
642
	test/cfgupgrade_unittest.py \
643
	test/docs_unittest.py \
644
	test/tempfile_fork_unittest.py
645

    
646
haskell_tests = htools/test
647

    
648
dist_TESTS = \
649
	test/check-cert-expired_unittest.bash \
650
	test/daemon-util_unittest.bash \
651
	test/ganeti-cleaner_unittest.bash \
652
	test/import-export_unittest.bash \
653
	$(python_tests)
654

    
655
nodist_TESTS =
656
if WANT_HTOOLS
657
nodist_TESTS += $(haskell_tests)
658
endif
659

    
660
TESTS = $(dist_TESTS) $(nodist_TESTS)
661

    
662
# Environment for all tests
663
PLAIN_TESTS_ENVIRONMENT = \
664
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
665

    
666
# Environment for tests run by automake
667
TESTS_ENVIRONMENT = \
668
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
669

    
670
all_python_code = \
671
	$(dist_sbin_SCRIPTS) \
672
	$(dist_tools_SCRIPTS) \
673
	$(pkglib_python_scripts) \
674
	$(nodist_pkglib_python_scripts) \
675
	$(python_tests) \
676
	$(pkgpython_PYTHON) \
677
	$(client_PYTHON) \
678
	$(hypervisor_PYTHON) \
679
	$(rapi_PYTHON) \
680
	$(server_PYTHON) \
681
	$(pytools_PYTHON) \
682
	$(http_PYTHON) \
683
	$(confd_PYTHON) \
684
	$(masterd_PYTHON) \
685
	$(impexpd_PYTHON) \
686
	$(utils_PYTHON) \
687
	$(watcher_PYTHON) \
688
	$(noinst_PYTHON) \
689
	$(qa_scripts)
690

    
691
srclink_files = \
692
	man/footer.rst \
693
	test/check-cert-expired_unittest.bash \
694
	test/daemon-util_unittest.bash \
695
	test/ganeti-cleaner_unittest.bash \
696
	test/import-export_unittest.bash \
697
	$(all_python_code) \
698
	$(HS_LIB_SRCS) $(HS_PROG_SRCS)
699

    
700
check_python_code = \
701
	$(BUILD_BASH_COMPLETION) \
702
	$(DOCPP) \
703
	$(all_python_code)
704

    
705
lint_python_code = \
706
	ganeti \
707
	ganeti/http/server.py \
708
	$(dist_sbin_SCRIPTS) \
709
	$(dist_tools_SCRIPTS) \
710
	$(pkglib_python_scripts) \
711
	$(BUILD_BASH_COMPLETION) \
712
	$(DOCPP) \
713
	$(PYTHON_BOOTSTRAP)
714

    
715
test/daemon-util_unittest.bash: daemons/daemon-util
716

    
717
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
718

    
719
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
720
	sed -f $(REPLACE_VARS_SED) < $< > $@
721
	chmod +x $@
722

    
723
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
724
	sed -f $(REPLACE_VARS_SED) < $< > $@
725
	chmod u+x $@
726

    
727
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
728
	sed -f $(REPLACE_VARS_SED) < $< > $@
729
	chmod +x $@
730

    
731
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
732
	sed -f $(REPLACE_VARS_SED) < $< > $@
733

    
734
doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
735
	sed -f $(REPLACE_VARS_SED) < $< > $@
736

    
737
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
738
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
739
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
740

    
741
doc/%.png: doc/%.dot
742
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
743
	$(DOT) -Tpng -o $@ $<
744

    
745
man/footer.man: man/footer.rst
746
	@test -n "$(PANDOC)" || \
747
	  { echo 'pandoc' not found during configure; exit 1; }
748
	$(PANDOC) -f rst -t man -o $@ $<
749

    
750
man/footer.html: man/footer.rst
751
	@test -n "$(PANDOC)" || \
752
	  { echo 'pandoc' not found during configure; exit 1; }
753
	$(PANDOC) -f rst -t html -o $@ $<
754

    
755
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
756
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
757

    
758
man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
759
	@test -n "$(PANDOC)" || \
760
	  { echo 'pandoc' not found during configure; exit 1; }
761
	set -o pipefail ; \
762
	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
763
	  sed -e 's/\\@/@/g' > $@
764
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
765

    
766
man/%.html.in: man/%.gen man/footer.html
767
	@test -n "$(PANDOC)" || \
768
	  { echo 'pandoc' not found during configure; exit 1; }
769
	set -o pipefail ; \
770
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
771
	  sed -e 's/\\@/@/g' > $@
772

    
773
man/%.1: man/%.1.in $(REPLACE_VARS_SED)
774
	sed -f $(REPLACE_VARS_SED) < $< > $@
775

    
776
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
777
	sed -f $(REPLACE_VARS_SED) < $< > $@
778

    
779
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
780
	sed -f $(REPLACE_VARS_SED) < $< > $@
781

    
782
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
783
	sed -f $(REPLACE_VARS_SED) < $< > $@
784

    
785
epydoc.conf: epydoc.conf.in Makefile
786
	sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
787

    
788
vcs-version:
789
	if test -d .git; then \
790
	  git describe > $@; \
791
	elif test ! -f $@ ; then \
792
	  echo "Cannot auto-generate $@ file"; exit 1; \
793
	fi
794

    
795
.PHONY: regen-vcs-version
796
regen-vcs-version:
797
	set -e; \
798
	cd $(srcdir); \
799
	if test -d .git; then \
800
	  rm -f vcs-version; \
801
	  $(MAKE) vcs-version; \
802
	fi
803

    
804
htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version
805
	set -e; \
806
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
807
	sed -e "s/%ver%/$$VCSVER/" < $< > $@
808

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

    
869
$(REPLACE_VARS_SED): Makefile
870
	set -e; \
871
	{ echo 's#@PREFIX@#$(prefix)#g'; \
872
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
873
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
874
	  echo 's#@BINDIR@#$(bindir)#g'; \
875
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
876
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
877
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
878
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
879
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
880
	  echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
881
	  echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
882
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
883
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
884
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
885
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
886
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
887
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
888
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
889
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
890
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
891
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
892
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
893
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
894
	} > $@
895

    
896
# Using deferred evaluation
897
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
898
daemons/ganeti-watcher: MODULE = ganeti.watcher
899
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
900
tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
901

    
902
$(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
903
	test -n "$(MODULE)" || { echo Missing module; exit 1; }
904
	set -e; \
905
	{ echo '#!/usr/bin/python'; \
906
	  echo '# This file is automatically generated, do not edit!'; \
907
	  echo "# Edit $(MODULE) instead."; \
908
	  echo; \
909
	  echo '"""Bootstrap script for L{$(MODULE)}"""'; \
910
	  echo; \
911
	  echo '# pylint: disable-msg=C0103'; \
912
	  echo '# C0103: Invalid name'; \
913
	  echo; \
914
	  echo 'import sys'; \
915
	  echo 'import $(MODULE) as main'; \
916
	  echo; \
917
	  echo '# Temporarily alias commands until bash completion'; \
918
	  echo '# generator is changed'; \
919
	  echo 'if hasattr(main, "commands"):'; \
920
		echo '  commands = main.commands # pylint: disable-msg=E1101'; \
921
	  echo; \
922
	  echo 'if __name__ == "__main__":'; \
923
	  echo '  sys.exit(main.Main())'; \
924
	} > $@
925
	chmod u+x $@
926

    
927
# We need to create symlinks because "make distcheck" will not install Python
928
# files when building.
929
stamp-srclinks: Makefile | $(all_dirfiles)
930
	set -e; \
931
	for i in $(srclink_files); do \
932
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
933
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
934
		fi; \
935
	done
936
	touch $@
937

    
938
.PHONY: ganeti
939
ganeti:
940
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
941

    
942
.PHONY: check-dirs
943
check-dirs: $(BUILT_SOURCES)
944
	@set -e; \
945
	find . -type d \( \( -name . \) -o \( \
946
		-name .git -o \
947
		-name autom4te.cache \
948
		\) -prune -o -print \) | { \
949
		error=; \
950
		while read dir; do \
951
			case "$$dir" in \
952
				$(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
953
				*) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
954
			esac; \
955
		done; \
956
		for dir in $(DIRS); do \
957
			if ! test -d "$$dir"; then \
958
				echo "Directory $$dir listed in DIRS does not exist" >&2; \
959
				error=1; \
960
			fi \
961
		done; \
962
		if test -n "$$error"; then exit 1; else exit 0; fi; \
963
	}
964

    
965
check-local: check-dirs
966
	$(CHECK_PYTHON_CODE) $(check_python_code)
967
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
968
	$(CHECK_NEWS) < $(top_srcdir)/NEWS
969

    
970
.PHONY: lint
971
lint: $(BUILT_SOURCES)
972
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
973
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
974
	cd $(top_srcdir)/qa && \
975
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
976
	  --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
977

    
978
.PHONY: hlint
979
hlint: $(HS_BUILT_SRCS)
980
	if tty -s; then C="-c"; else C=""; fi; \
981
	hlint --report=doc/hs-lint.html $$C htools
982

    
983
# a dist hook rule for updating the vcs-version file; this is
984
# hardcoded due to where it needs to build the file...
985
dist-hook:
986
	$(MAKE) regen-vcs-version && \
987
	rm -f $(top_distdir)/vcs-version && \
988
	cp -p $(srcdir)/vcs-version $(top_distdir)
989

    
990
# a distcheck hook rule for catching revision control directories
991
distcheck-hook:
992
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
993
		echo "Found revision control files in final archive." 1>&2; \
994
		exit 1; \
995
	fi
996
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
997
		echo "Found Python byte code in final archive." 1>&2; \
998
		exit 1; \
999
	fi
1000
	if find $(top_distdir) -name '*~' | grep .; then \
1001
		echo "Found backup files in final archive." 1>&2; \
1002
		exit 1; \
1003
	fi
1004
# Empty files or directories should not be distributed. They can cause
1005
# unnecessary warnings for packagers. Directories used by automake during
1006
# distcheck must be excluded.
1007
	if find $(top_distdir) -empty -and -not \( \
1008
			-path $(top_distdir)/_build -or \
1009
			-path $(top_distdir)/_inst \) | grep .; then \
1010
		echo "Found empty files or directories in final archive." 1>&2; \
1011
		exit 1; \
1012
	fi
1013
	if test -n "$(BUILD_RELEASE)" && \
1014
	   grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
1015
		echo "Found unreleased version in NEWS." >&2; \
1016
		exit 1; \
1017
	fi
1018

    
1019
# When building a release, stricter checks should be used
1020
distcheck-release dist-release: export BUILD_RELEASE = 1
1021
distcheck-release: distcheck
1022

    
1023
dist-release: dist
1024
	set -e; \
1025
	for i in $(DIST_ARCHIVES); do \
1026
		echo -n "Checking $$i ... "; \
1027
		autotools/check-tar < $$i; \
1028
		echo OK; \
1029
	done
1030

    
1031
install-exec-local:
1032
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1033
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
1034
	  "$(DESTDIR)${localstatedir}/run/ganeti"
1035

    
1036
# To avoid conflicts between directory names and other targets, a file inside
1037
# the directory is used to ensure its existence.
1038
%.dir:
1039
	@mkdir_p@ $* && touch $@
1040

    
1041
.PHONY: apidoc
1042
if WANT_HTOOLSAPIDOC
1043
apidoc: py-apidoc hs-apidoc
1044
else
1045
apidoc: py-apidoc
1046
endif
1047

    
1048
.PHONY: py-apidoc
1049
py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
1050
	$(RUN_IN_TEMPDIR) epydoc -v \
1051
		--conf $(CURDIR)/epydoc.conf \
1052
		--output $(CURDIR)/$(APIDOC_PY_DIR)
1053

    
1054
.PHONY: hs-apidoc
1055
hs-apidoc: $(HS_BUILT_SRCS)
1056
	@test -n "$(HSCOLOUR)" || \
1057
	    { echo 'HsColour' not found during configure; exit 1; }
1058
	@test -n "$(HADDOCK)" || \
1059
	    { echo 'haddock' not found during configure; exit 1; }
1060
	rm -rf $(APIDOC_HS_DIR)/*
1061
	@mkdir_p@ $(APIDOC_HS_DIR)/Ganeti/HTools
1062
	$(HSCOLOUR) -print-css > $(APIDOC_HS_DIR)/Ganeti/hscolour.css
1063
	ln -s ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/HTools/hscolour.css
1064
	set -e ; \
1065
	cd htools; \
1066
	if [ "$(HTOOLS_NOCURL)" ]; \
1067
	then OPTGHC="--optghc=$(HTOOLS_NOCURL)"; \
1068
	else OPTGHC=""; \
1069
	fi; \
1070
	RELSRCS="$(HS_LIB_SRCS:htools/%=%)"; \
1071
	for file in $$RELSRCS; do \
1072
		hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
1073
		$(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
1074
	done ; \
1075
	$(HADDOCK) --odir ../$(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1076
		-t ganeti-htools -p haddock-prologue \
1077
		--source-module="%{MODULE/.//}.html" \
1078
		--source-entity="%{MODULE/.//}.html#%{NAME}" \
1079
		$$OPTGHC \
1080
		$(filter-out Ganeti/HTools/ExtLoader.hs,$(HS_LIB_SRCS:htools/%=%))
1081

    
1082
.PHONY: TAGS
1083
TAGS: $(BUILT_SOURCES)
1084
	rm -f TAGS
1085
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
1086
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
1087
	  -path './qa/*.py' | \
1088
	  etags -l python -
1089

    
1090
.PHONY: coverage
1091
if WANT_HTOOLS
1092
coverage: py-coverage hs-coverage
1093
else
1094
coverage: py-coverage
1095
endif
1096

    
1097
.PHONY: py-coverage
1098
py-coverage: $(BUILT_SOURCES) $(python_tests)
1099
	set -e; \
1100
	COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
1101
	TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
1102
	HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
1103
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1104
	$(python_tests)
1105

    
1106
.PHONY: hs-coverage
1107
hs-coverage: $(haskell_tests)
1108
	cd htools && rm -f *.tix *.mix && ./test
1109
	mkdir -p $(COVERAGE_HS_DIR)
1110
	hpc markup --destdir=$(COVERAGE_HS_DIR) htools/test $(HPCEXCL)
1111
	hpc report htools/test $(HPCEXCL)
1112
	ln -s hpc_index.html $(COVERAGE_HS_DIR)/index.html
1113

    
1114
# Special "kind-of-QA" target for htools, needs special setup (all
1115
# tools compiled with -fhpc)
1116
.PHONY: live-test
1117
live-test: all
1118
	set -e ; \
1119
	cd htools; \
1120
	rm -f .hpc; ln -s ../.hpc .hpc; \
1121
	rm -f *.tix *.mix; \
1122
	./live-test.sh; \
1123
	hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:htools/%=%)) \
1124
	  --output=live-test.tix ; \
1125
	@mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
1126
	hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
1127
		--srcdir=.. $(HPCEXCL) ; \
1128
	hpc report --srcdir=.. live-test $(HPCEXCL)
1129

    
1130
commit-check: distcheck lint apidoc
1131

    
1132
-include ./Makefile.local
1133

    
1134
# vim: set noet :