Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 2e5eb96a

History | View | Annotate | Download (31.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
CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
25

    
26
# Note: these are automake-specific variables, and must be named after
27
# the directory + 'dir' suffix
28
clientdir = $(pkgpythondir)/client
29
hypervisordir = $(pkgpythondir)/hypervisor
30
httpdir = $(pkgpythondir)/http
31
masterddir = $(pkgpythondir)/masterd
32
confddir = $(pkgpythondir)/confd
33
rapidir = $(pkgpythondir)/rapi
34
serverdir = $(pkgpythondir)/server
35
watcherdir = $(pkgpythondir)/watcher
36
impexpddir = $(pkgpythondir)/impexpd
37
utilsdir = $(pkgpythondir)/utils
38
toolsdir = $(pkglibdir)/tools
39
iallocatorsdir = $(pkglibdir)/iallocators
40
pytoolsdir = $(pkgpythondir)/tools
41
docdir = $(datadir)/doc/$(PACKAGE)
42

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

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

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

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

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

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

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

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

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

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

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

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

    
155
nodist_pkgpython_PYTHON = \
156
	lib/_autoconf.py
157

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
304
HS_PROGS = \
305
	htools/hbal \
306
	htools/hscan \
307
	htools/hail \
308
	htools/hspace
309

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

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

    
341
HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
342
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
343

    
344
$(RUN_IN_TEMPDIR): | $(all_dirfiles)
345

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

    
365
doc/html: doc/html/index.html
366

    
367
doc/install-quick.rst: INSTALL
368
doc/news.rst: NEWS
369
doc/upgrade.rst: UPGRADE
370

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

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

    
384
docpng = $(patsubst %.dot,%.png,$(docdot))
385

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

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

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

    
424
PYTHON_BOOTSTRAP = \
425
	$(PYTHON_BOOTSTRAP_SBIN) \
426
	tools/ensure-dirs
427

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

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

    
449
$(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
450
	@if [ -z "$(HTOOLS)" ]; then \
451
	  echo "Error: htools compilation disabled at configure time" 1>&2 ;\
452
	  exit 1; \
453
	fi
454
	@BINARY=$(@:htools/%=%); \
455
	if [ "$BINARY" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
456
	  echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \
457
	  exit 1; \
458
	fi
459
	BINARY=$(@:htools/%=%); $(GHC) --make \
460
	  $(HFLAGS) $(HEXTRA) $(HTOOLS_NOCURL) \
461
	  -osuf $$BINARY.o -hisuf $$BINARY.hi $@
462

    
463
# for the htools/test binary, we need to enable profiling/coverage
464
htools/test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
465
	-fno-warn-monomorphism-restriction -fno-warn-orphans \
466
	-fno-warn-missing-methods -fno-warn-unused-imports
467

    
468
dist_sbin_SCRIPTS = \
469
	tools/ganeti-listrunner
470

    
471
nodist_sbin_SCRIPTS = \
472
	$(PYTHON_BOOTSTRAP_SBIN) \
473
	daemons/ganeti-cleaner
474

    
475
dist_tools_SCRIPTS = \
476
	tools/burnin \
477
	tools/cfgshell \
478
	tools/cfgupgrade \
479
	tools/cfgupgrade12 \
480
	tools/cluster-merge \
481
	tools/lvmstrap \
482
	tools/move-instance \
483
	tools/setup-ssh \
484
	tools/sanitize-config
485

    
486
pkglib_python_scripts = \
487
	daemons/import-export \
488
	tools/check-cert-expired
489

    
490
nodist_pkglib_python_scripts = \
491
	tools/ensure-dirs
492

    
493
pkglib_SCRIPTS = \
494
	daemons/daemon-util \
495
	tools/kvm-ifup \
496
	$(pkglib_python_scripts)
497

    
498
nodist_pkglib_SCRIPTS = \
499
	$(nodist_pkglib_python_scripts)
500

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

    
550
man_MANS = \
551
	man/ganeti.7 \
552
	man/ganeti-cleaner.8 \
553
	man/ganeti-confd.8 \
554
	man/ganeti-listrunner.8 \
555
	man/ganeti-masterd.8 \
556
	man/ganeti-noded.8 \
557
	man/ganeti-os-interface.7 \
558
	man/ganeti-rapi.8 \
559
	man/ganeti-watcher.8 \
560
	man/gnt-backup.8 \
561
	man/gnt-cluster.8 \
562
	man/gnt-debug.8 \
563
	man/gnt-group.8 \
564
	man/gnt-instance.8 \
565
	man/gnt-job.8 \
566
	man/gnt-node.8 \
567
	man/gnt-os.8 \
568
	man/hail.1 \
569
	man/hbal.1 \
570
	man/hscan.1 \
571
	man/hspace.1
572

    
573
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
574
manhtml = $(patsubst %.rst,%.html,$(manrst))
575
mangen = $(patsubst %.rst,%.gen,$(manrst))
576
maninput = \
577
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
578
	$(patsubst %.html,%.html.in,$(manhtml)) \
579
	man/footer.man man/footer.html $(mangen)
580

    
581
TEST_FILES = \
582
	test/data/bdev-drbd-8.0.txt \
583
	test/data/bdev-drbd-8.3.txt \
584
	test/data/bdev-drbd-disk.txt \
585
	test/data/bdev-drbd-net-ip4.txt \
586
	test/data/bdev-drbd-net-ip6.txt \
587
	test/data/cert1.pem \
588
	test/data/proc_drbd8.txt \
589
	test/data/proc_drbd80-emptyline.txt \
590
	test/data/proc_drbd83.txt \
591
	test/data/sys_drbd_usermode_helper.txt \
592
	test/import-export_unittest-helper
593

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

    
656
haskell_tests = htools/test
657

    
658
dist_TESTS = \
659
	test/check-cert-expired_unittest.bash \
660
	test/daemon-util_unittest.bash \
661
	test/ganeti-cleaner_unittest.bash \
662
	test/import-export_unittest.bash \
663
	$(python_tests)
664

    
665
nodist_TESTS =
666
if WANT_HTOOLS
667
nodist_TESTS += $(haskell_tests)
668
endif
669

    
670
TESTS = $(dist_TESTS) $(nodist_TESTS)
671

    
672
# Environment for all tests
673
PLAIN_TESTS_ENVIRONMENT = \
674
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
675

    
676
# Environment for tests run by automake
677
TESTS_ENVIRONMENT = \
678
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
679

    
680
all_python_code = \
681
	$(dist_sbin_SCRIPTS) \
682
	$(dist_tools_SCRIPTS) \
683
	$(pkglib_python_scripts) \
684
	$(nodist_pkglib_python_scripts) \
685
	$(python_tests) \
686
	$(pkgpython_PYTHON) \
687
	$(client_PYTHON) \
688
	$(hypervisor_PYTHON) \
689
	$(rapi_PYTHON) \
690
	$(server_PYTHON) \
691
	$(pytools_PYTHON) \
692
	$(http_PYTHON) \
693
	$(confd_PYTHON) \
694
	$(masterd_PYTHON) \
695
	$(impexpd_PYTHON) \
696
	$(utils_PYTHON) \
697
	$(watcher_PYTHON) \
698
	$(noinst_PYTHON) \
699
	$(qa_scripts)
700

    
701
srclink_files = \
702
	man/footer.rst \
703
	test/check-cert-expired_unittest.bash \
704
	test/daemon-util_unittest.bash \
705
	test/ganeti-cleaner_unittest.bash \
706
	test/import-export_unittest.bash \
707
	$(all_python_code) \
708
	$(HS_LIB_SRCS) $(HS_PROG_SRCS)
709

    
710
check_python_code = \
711
	$(BUILD_BASH_COMPLETION) \
712
	$(DOCPP) \
713
	$(all_python_code)
714

    
715
lint_python_code = \
716
	ganeti \
717
	ganeti/http/server.py \
718
	$(dist_sbin_SCRIPTS) \
719
	$(dist_tools_SCRIPTS) \
720
	$(pkglib_python_scripts) \
721
	$(BUILD_BASH_COMPLETION) \
722
	$(DOCPP) \
723
	$(PYTHON_BOOTSTRAP)
724

    
725
test/daemon-util_unittest.bash: daemons/daemon-util
726

    
727
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
728

    
729
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
730
	sed -f $(REPLACE_VARS_SED) < $< > $@
731
	chmod +x $@
732

    
733
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
734
	sed -f $(REPLACE_VARS_SED) < $< > $@
735
	chmod u+x $@
736

    
737
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
738
	sed -f $(REPLACE_VARS_SED) < $< > $@
739
	chmod +x $@
740

    
741
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
742
	sed -f $(REPLACE_VARS_SED) < $< > $@
743

    
744
doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
745
	sed -f $(REPLACE_VARS_SED) < $< > $@
746

    
747
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
748
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
749
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
750

    
751
doc/%.png: doc/%.dot
752
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
753
	$(DOT) -Tpng -o $@ $<
754

    
755
man/footer.man: man/footer.rst
756
	@test -n "$(PANDOC)" || \
757
	  { echo 'pandoc' not found during configure; exit 1; }
758
	$(PANDOC) -f rst -t man -o $@ $<
759

    
760
man/footer.html: man/footer.rst
761
	@test -n "$(PANDOC)" || \
762
	  { echo 'pandoc' not found during configure; exit 1; }
763
	$(PANDOC) -f rst -t html -o $@ $<
764

    
765
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
766
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
767

    
768
man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
769
	@test -n "$(PANDOC)" || \
770
	  { echo 'pandoc' not found during configure; exit 1; }
771
	set -o pipefail ; \
772
	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
773
	  sed -e 's/\\@/@/g' > $@
774
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
775

    
776
man/%.html.in: man/%.gen man/footer.html
777
	@test -n "$(PANDOC)" || \
778
	  { echo 'pandoc' not found during configure; exit 1; }
779
	set -o pipefail ; \
780
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
781
	  sed -e 's/\\@/@/g' > $@
782

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

    
786
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
787
	sed -f $(REPLACE_VARS_SED) < $< > $@
788

    
789
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
790
	sed -f $(REPLACE_VARS_SED) < $< > $@
791

    
792
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
793
	sed -f $(REPLACE_VARS_SED) < $< > $@
794

    
795
epydoc.conf: epydoc.conf.in Makefile
796
	sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
797

    
798
vcs-version:
799
	if test -d .git; then \
800
	  git describe > $@; \
801
	elif test ! -f $@ ; then \
802
	  echo "Cannot auto-generate $@ file"; exit 1; \
803
	fi
804

    
805
.PHONY: regen-vcs-version
806
regen-vcs-version:
807
	set -e; \
808
	cd $(srcdir); \
809
	if test -d .git; then \
810
	  rm -f vcs-version; \
811
	  $(MAKE) vcs-version; \
812
	fi
813

    
814
htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version
815
	set -e; \
816
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
817
	sed -e "s/%ver%/$$VCSVER/" < $< > $@
818

    
819
htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
820
	lib/constants.py lib/_autoconf.py $(CONVERT_CONSTANTS)
821
	set -e; { cat $< ; $(CONVERT_CONSTANTS); } > $@
822

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

    
888
$(REPLACE_VARS_SED): Makefile
889
	set -e; \
890
	{ echo 's#@PREFIX@#$(prefix)#g'; \
891
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
892
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
893
	  echo 's#@BINDIR@#$(bindir)#g'; \
894
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
895
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
896
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
897
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
898
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
899
	  echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
900
	  echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
901
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
902
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
903
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
904
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
905
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
906
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
907
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
908
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
909
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
910
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
911
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
912
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
913
	} > $@
914

    
915
# Using deferred evaluation
916
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
917
daemons/ganeti-watcher: MODULE = ganeti.watcher
918
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
919
tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
920

    
921
$(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
922
	test -n "$(MODULE)" || { echo Missing module; exit 1; }
923
	set -e; \
924
	{ echo '#!/usr/bin/python'; \
925
	  echo '# This file is automatically generated, do not edit!'; \
926
	  echo "# Edit $(MODULE) instead."; \
927
	  echo; \
928
	  echo '"""Bootstrap script for L{$(MODULE)}"""'; \
929
	  echo; \
930
	  echo '# pylint: disable-msg=C0103'; \
931
	  echo '# C0103: Invalid name'; \
932
	  echo; \
933
	  echo 'import sys'; \
934
	  echo 'import $(MODULE) as main'; \
935
	  echo; \
936
	  echo '# Temporarily alias commands until bash completion'; \
937
	  echo '# generator is changed'; \
938
	  echo 'if hasattr(main, "commands"):'; \
939
		echo '  commands = main.commands # pylint: disable-msg=E1101'; \
940
	  echo; \
941
	  echo 'if __name__ == "__main__":'; \
942
	  echo '  sys.exit(main.Main())'; \
943
	} > $@
944
	chmod u+x $@
945

    
946
# We need to create symlinks because "make distcheck" will not install Python
947
# files when building.
948
stamp-srclinks: Makefile | $(all_dirfiles)
949
	set -e; \
950
	for i in $(srclink_files); do \
951
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
952
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
953
		fi; \
954
	done
955
	touch $@
956

    
957
.PHONY: ganeti
958
ganeti:
959
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
960

    
961
.PHONY: check-dirs
962
check-dirs: $(BUILT_SOURCES)
963
	@set -e; \
964
	find . -type d \( \( -name . \) -o \( \
965
		-name .git -o \
966
		-name autom4te.cache \
967
		\) -prune -o -print \) | { \
968
		error=; \
969
		while read dir; do \
970
			case "$$dir" in \
971
				$(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
972
				*) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
973
			esac; \
974
		done; \
975
		for dir in $(DIRS); do \
976
			if ! test -d "$$dir"; then \
977
				echo "Directory $$dir listed in DIRS does not exist" >&2; \
978
				error=1; \
979
			fi \
980
		done; \
981
		if test -n "$$error"; then exit 1; else exit 0; fi; \
982
	}
983

    
984
check-local: check-dirs
985
	$(CHECK_PYTHON_CODE) $(check_python_code)
986
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
987
	$(CHECK_NEWS) < $(top_srcdir)/NEWS
988
	expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
989
	if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
990
		echo "Incorrect version in README, expected $$expver"; \
991
		exit 1; \
992
	fi
993

    
994
.PHONY: hs-check
995
hs-check: htools/test
996
	@rm -f test.tix
997
	./htools/test
998

    
999
.PHONY: lint
1000
lint: $(BUILT_SOURCES)
1001
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1002
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
1003
	cd $(top_srcdir)/qa && \
1004
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
1005
	  --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
1006

    
1007
.PHONY: hlint
1008
hlint: $(HS_BUILT_SRCS)
1009
	if tty -s; then C="-c"; else C=""; fi; \
1010
	hlint --report=doc/hs-lint.html $$C htools
1011

    
1012
# a dist hook rule for updating the vcs-version file; this is
1013
# hardcoded due to where it needs to build the file...
1014
dist-hook:
1015
	$(MAKE) regen-vcs-version && \
1016
	rm -f $(top_distdir)/vcs-version && \
1017
	cp -p $(srcdir)/vcs-version $(top_distdir)
1018

    
1019
# a distcheck hook rule for catching revision control directories
1020
distcheck-hook:
1021
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
1022
		echo "Found revision control files in final archive." 1>&2; \
1023
		exit 1; \
1024
	fi
1025
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
1026
		echo "Found Python byte code in final archive." 1>&2; \
1027
		exit 1; \
1028
	fi
1029
	if find $(top_distdir) -name '*~' | grep .; then \
1030
		echo "Found backup files in final archive." 1>&2; \
1031
		exit 1; \
1032
	fi
1033
# Empty files or directories should not be distributed. They can cause
1034
# unnecessary warnings for packagers. Directories used by automake during
1035
# distcheck must be excluded.
1036
	if find $(top_distdir) -empty -and -not \( \
1037
			-path $(top_distdir)/_build -or \
1038
			-path $(top_distdir)/_inst \) | grep .; then \
1039
		echo "Found empty files or directories in final archive." 1>&2; \
1040
		exit 1; \
1041
	fi
1042
	if test -n "$(BUILD_RELEASE)" && \
1043
	   grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
1044
		echo "Found unreleased version in NEWS." >&2; \
1045
		exit 1; \
1046
	fi
1047

    
1048
# When building a release, stricter checks should be used
1049
distcheck-release dist-release: export BUILD_RELEASE = 1
1050
distcheck-release: distcheck
1051

    
1052
dist-release: dist
1053
	set -e; \
1054
	for i in $(DIST_ARCHIVES); do \
1055
		echo -n "Checking $$i ... "; \
1056
		autotools/check-tar < $$i; \
1057
		echo OK; \
1058
	done
1059

    
1060
install-exec-local:
1061
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1062
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
1063
	  "$(DESTDIR)${localstatedir}/run/ganeti"
1064

    
1065
# To avoid conflicts between directory names and other targets, a file inside
1066
# the directory is used to ensure its existence.
1067
%.dir:
1068
	@mkdir_p@ $* && touch $@
1069

    
1070
.PHONY: apidoc
1071
if WANT_HTOOLSAPIDOC
1072
apidoc: py-apidoc hs-apidoc
1073
else
1074
apidoc: py-apidoc
1075
endif
1076

    
1077
.PHONY: py-apidoc
1078
py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
1079
	$(RUN_IN_TEMPDIR) epydoc -v \
1080
		--conf $(CURDIR)/epydoc.conf \
1081
		--output $(CURDIR)/$(APIDOC_PY_DIR)
1082

    
1083
.PHONY: hs-apidoc
1084
hs-apidoc: $(HS_BUILT_SRCS)
1085
	@test -n "$(HSCOLOUR)" || \
1086
	    { echo 'HsColour' not found during configure; exit 1; }
1087
	@test -n "$(HADDOCK)" || \
1088
	    { echo 'haddock' not found during configure; exit 1; }
1089
	rm -rf $(APIDOC_HS_DIR)/*
1090
	@mkdir_p@ $(APIDOC_HS_DIR)/Ganeti/HTools
1091
	$(HSCOLOUR) -print-css > $(APIDOC_HS_DIR)/Ganeti/hscolour.css
1092
	ln -s ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/HTools/hscolour.css
1093
	set -e ; \
1094
	cd htools; \
1095
	if [ "$(HTOOLS_NOCURL)" ]; \
1096
	then OPTGHC="--optghc=$(HTOOLS_NOCURL)"; \
1097
	else OPTGHC=""; \
1098
	fi; \
1099
	RELSRCS="$(HS_LIB_SRCS:htools/%=%)"; \
1100
	for file in $$RELSRCS; do \
1101
		hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
1102
		$(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
1103
	done ; \
1104
	$(HADDOCK) --odir ../$(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1105
		-t ganeti-htools -p haddock-prologue \
1106
		--source-module="%{MODULE/.//}.html" \
1107
		--source-entity="%{MODULE/.//}.html#%{NAME}" \
1108
		$$OPTGHC \
1109
		$(filter-out Ganeti/HTools/ExtLoader.hs,$(HS_LIB_SRCS:htools/%=%))
1110

    
1111
.PHONY: TAGS
1112
TAGS: $(BUILT_SOURCES)
1113
	rm -f TAGS
1114
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
1115
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
1116
	  -path './qa/*.py' | \
1117
	  etags -l python -
1118

    
1119
.PHONY: coverage
1120
if WANT_HTOOLS
1121
coverage: py-coverage hs-coverage
1122
else
1123
coverage: py-coverage
1124
endif
1125

    
1126
.PHONY: py-coverage
1127
py-coverage: $(BUILT_SOURCES) $(python_tests)
1128
	set -e; \
1129
	COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
1130
	TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
1131
	HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
1132
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1133
	$(python_tests)
1134

    
1135
.PHONY: hs-coverage
1136
hs-coverage: $(haskell_tests)
1137
	cd htools && rm -f *.tix *.mix && ./test
1138
	mkdir -p $(COVERAGE_HS_DIR)
1139
	hpc markup --destdir=$(COVERAGE_HS_DIR) htools/test $(HPCEXCL)
1140
	hpc report htools/test $(HPCEXCL)
1141
	ln -sf hpc_index.html $(COVERAGE_HS_DIR)/index.html
1142

    
1143
# Special "kind-of-QA" target for htools, needs special setup (all
1144
# tools compiled with -fhpc)
1145
.PHONY: live-test
1146
live-test: all
1147
	set -e ; \
1148
	cd htools; \
1149
	rm -f .hpc; ln -s ../.hpc .hpc; \
1150
	rm -f *.tix *.mix; \
1151
	./live-test.sh; \
1152
	hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:htools/%=%)) \
1153
	  --output=live-test.tix ; \
1154
	@mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
1155
	hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
1156
		--srcdir=.. $(HPCEXCL) ; \
1157
	hpc report --srcdir=.. live-test $(HPCEXCL)
1158

    
1159
commit-check: distcheck lint apidoc
1160

    
1161
-include ./Makefile.local
1162

    
1163
# vim: set noet :