Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ d26d808a

History | View | Annotate | Download (32.4 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-cpu-pinning.rst \
282
	doc/design-query2.rst \
283
	doc/design-x509-ca.rst \
284
	doc/design-http-server.rst \
285
	doc/design-impexp2.rst \
286
	doc/design-lu-generated-jobs.rst \
287
	doc/design-multi-reloc.rst \
288
	doc/design-network.rst \
289
	doc/design-chained-jobs.rst \
290
	doc/cluster-merge.rst \
291
	doc/design-shared-storage.rst \
292
	doc/devnotes.rst \
293
	doc/glossary.rst \
294
	doc/hooks.rst \
295
	doc/iallocator.rst \
296
	doc/index.rst \
297
	doc/install-quick.rst \
298
	doc/install.rst \
299
	doc/locking.rst \
300
	doc/move-instance.rst \
301
	doc/news.rst \
302
	doc/rapi.rst \
303
	doc/security.rst \
304
	doc/upgrade.rst \
305
	doc/walkthrough.rst
306

    
307
HS_PROGS = \
308
	htools/hbal \
309
	htools/hscan \
310
	htools/hail \
311
	htools/hspace \
312
	htools/htools
313

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

    
325
HS_LIB_SRCS = \
326
	htools/Ganeti/HTools/CLI.hs \
327
	htools/Ganeti/HTools/Cluster.hs \
328
	htools/Ganeti/HTools/Compat.hs \
329
	htools/Ganeti/HTools/Container.hs \
330
	htools/Ganeti/HTools/ExtLoader.hs \
331
	htools/Ganeti/HTools/Group.hs \
332
	htools/Ganeti/HTools/IAlloc.hs \
333
	htools/Ganeti/HTools/Instance.hs \
334
	htools/Ganeti/HTools/Loader.hs \
335
	htools/Ganeti/HTools/Luxi.hs \
336
	htools/Ganeti/HTools/Node.hs \
337
	htools/Ganeti/HTools/PeerMap.hs \
338
	htools/Ganeti/HTools/QC.hs \
339
	htools/Ganeti/HTools/Rapi.hs \
340
	htools/Ganeti/HTools/Simu.hs \
341
	htools/Ganeti/HTools/Text.hs \
342
	htools/Ganeti/HTools/Types.hs \
343
	htools/Ganeti/HTools/Utils.hs \
344
	htools/Ganeti/Jobs.hs \
345
	htools/Ganeti/Luxi.hs \
346
	htools/Ganeti/OpCodes.hs
347

    
348
HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
349
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
350

    
351
$(RUN_IN_TEMPDIR): | $(all_dirfiles)
352

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

    
372
doc/html: doc/html/index.html
373

    
374
doc/install-quick.rst: INSTALL
375
doc/news.rst: NEWS
376
doc/upgrade.rst: UPGRADE
377

    
378
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
379
	set -e; \
380
	{ echo '.. This file is automatically updated at build time from $<.'; \
381
	  echo '.. Do not edit.'; \
382
	  echo; \
383
	  cat $<; \
384
	} > $@
385

    
386
docdot = \
387
	doc/arch-2.0.dot \
388
	doc/design-2.1-lock-acquire.dot \
389
	doc/design-2.1-lock-release.dot
390

    
391
docpng = $(patsubst %.dot,%.png,$(docdot))
392

    
393
# Things to build but not to install (add it to EXTRA_DIST if it should be
394
# distributed)
395
noinst_DATA = \
396
	devel/upload \
397
	doc/html \
398
	doc/examples/bash_completion \
399
	doc/examples/ganeti.cron \
400
	doc/examples/ganeti.initd \
401
	doc/examples/ganeti-kvm-poweroff.initd \
402
	doc/examples/gnt-config-backup \
403
	doc/examples/hooks/ipsec \
404
	$(manhtml)
405

    
406
gnt_scripts = \
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
PYTHON_BOOTSTRAP_SBIN = \
417
	daemons/ganeti-confd \
418
	daemons/ganeti-masterd \
419
	daemons/ganeti-noded \
420
	daemons/ganeti-watcher \
421
	daemons/ganeti-rapi \
422
	scripts/gnt-backup \
423
	scripts/gnt-cluster \
424
	scripts/gnt-debug \
425
	scripts/gnt-group \
426
	scripts/gnt-instance \
427
	scripts/gnt-job \
428
	scripts/gnt-node \
429
	scripts/gnt-os
430

    
431
PYTHON_BOOTSTRAP = \
432
	$(PYTHON_BOOTSTRAP_SBIN) \
433
	tools/ensure-dirs
434

    
435
qa_scripts = \
436
	qa/ganeti-qa.py \
437
	qa/qa_cluster.py \
438
	qa/qa_config.py \
439
	qa/qa_daemon.py \
440
	qa/qa_env.py \
441
	qa/qa_error.py \
442
	qa/qa_instance.py \
443
	qa/qa_node.py \
444
	qa/qa_os.py \
445
	qa/qa_rapi.py \
446
	qa/qa_tags.py \
447
	qa/qa_utils.py
448

    
449
bin_SCRIPTS =
450
iallocators_SCRIPTS =
451
if WANT_HTOOLS
452
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
453
iallocators_SCRIPTS += $(filter htools/hail,$(HS_PROGS))
454
endif
455

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

    
471
# for the htools/test binary, we need to enable profiling/coverage
472
htools/test: HEXTRA=-fhpc -Wwarn -fno-warn-missing-signatures \
473
	-fno-warn-monomorphism-restriction -fno-warn-orphans \
474
	-fno-warn-missing-methods -fno-warn-unused-imports
475

    
476
dist_sbin_SCRIPTS = \
477
	tools/ganeti-listrunner
478

    
479
nodist_sbin_SCRIPTS = \
480
	$(PYTHON_BOOTSTRAP_SBIN) \
481
	daemons/ganeti-cleaner
482

    
483
dist_tools_PYTHON = \
484
	tools/burnin \
485
	tools/cfgshell \
486
	tools/cfgupgrade \
487
	tools/cfgupgrade12 \
488
	tools/cluster-merge \
489
	tools/lvmstrap \
490
	tools/move-instance \
491
	tools/setup-ssh \
492
	tools/sanitize-config
493

    
494
dist_tools_SCRIPTS = \
495
	$(dist_tools_PYTHON) \
496
	tools/kvm-console-wrapper \
497
	tools/xm-console-wrapper
498

    
499
pkglib_python_scripts = \
500
	daemons/import-export \
501
	tools/check-cert-expired
502

    
503
nodist_pkglib_python_scripts = \
504
	tools/ensure-dirs
505

    
506
pkglib_SCRIPTS = \
507
	daemons/daemon-util \
508
	tools/kvm-ifup \
509
	$(pkglib_python_scripts)
510

    
511
nodist_pkglib_SCRIPTS = \
512
	$(nodist_pkglib_python_scripts)
513

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

    
563
man_MANS = \
564
	man/ganeti.7 \
565
	man/ganeti-cleaner.8 \
566
	man/ganeti-confd.8 \
567
	man/ganeti-listrunner.8 \
568
	man/ganeti-masterd.8 \
569
	man/ganeti-noded.8 \
570
	man/ganeti-os-interface.7 \
571
	man/ganeti-rapi.8 \
572
	man/ganeti-watcher.8 \
573
	man/gnt-backup.8 \
574
	man/gnt-cluster.8 \
575
	man/gnt-debug.8 \
576
	man/gnt-group.8 \
577
	man/gnt-instance.8 \
578
	man/gnt-job.8 \
579
	man/gnt-node.8 \
580
	man/gnt-os.8 \
581
	man/hail.1 \
582
	man/hbal.1 \
583
	man/hscan.1 \
584
	man/hspace.1 \
585
	man/htools.1
586

    
587
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
588
manhtml = $(patsubst %.rst,%.html,$(manrst))
589
mangen = $(patsubst %.rst,%.gen,$(manrst))
590
maninput = \
591
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
592
	$(patsubst %.html,%.html.in,$(manhtml)) \
593
	man/footer.man man/footer.html $(mangen)
594

    
595
TEST_FILES = \
596
	test/data/bdev-drbd-8.0.txt \
597
	test/data/bdev-drbd-8.3.txt \
598
	test/data/bdev-drbd-disk.txt \
599
	test/data/bdev-drbd-net-ip4.txt \
600
	test/data/bdev-drbd-net-ip6.txt \
601
	test/data/cert1.pem \
602
	test/data/proc_drbd8.txt \
603
	test/data/proc_drbd80-emptyline.txt \
604
	test/data/proc_drbd83.txt \
605
	test/data/sys_drbd_usermode_helper.txt \
606
	test/import-export_unittest-helper
607

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

    
670
haskell_tests = htools/test
671

    
672
dist_TESTS = \
673
	test/check-cert-expired_unittest.bash \
674
	test/daemon-util_unittest.bash \
675
	test/ganeti-cleaner_unittest.bash \
676
	test/import-export_unittest.bash \
677
	$(python_tests)
678

    
679
nodist_TESTS =
680
if WANT_HTOOLSTESTS
681
nodist_TESTS += $(haskell_tests)
682
endif
683

    
684
TESTS = $(dist_TESTS) $(nodist_TESTS)
685

    
686
# Environment for all tests
687
PLAIN_TESTS_ENVIRONMENT = \
688
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
689

    
690
# Environment for tests run by automake
691
TESTS_ENVIRONMENT = \
692
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
693

    
694
all_python_code = \
695
	$(dist_sbin_SCRIPTS) \
696
	$(dist_tools_PYTHON) \
697
	$(pkglib_python_scripts) \
698
	$(nodist_pkglib_python_scripts) \
699
	$(python_tests) \
700
	$(pkgpython_PYTHON) \
701
	$(client_PYTHON) \
702
	$(hypervisor_PYTHON) \
703
	$(rapi_PYTHON) \
704
	$(server_PYTHON) \
705
	$(pytools_PYTHON) \
706
	$(http_PYTHON) \
707
	$(confd_PYTHON) \
708
	$(masterd_PYTHON) \
709
	$(impexpd_PYTHON) \
710
	$(utils_PYTHON) \
711
	$(watcher_PYTHON) \
712
	$(noinst_PYTHON) \
713
	$(qa_scripts)
714

    
715
srclink_files = \
716
	man/footer.rst \
717
	test/check-cert-expired_unittest.bash \
718
	test/daemon-util_unittest.bash \
719
	test/ganeti-cleaner_unittest.bash \
720
	test/import-export_unittest.bash \
721
	$(all_python_code) \
722
	$(HS_LIB_SRCS) $(HS_PROG_SRCS)
723

    
724
check_python_code = \
725
	$(BUILD_BASH_COMPLETION) \
726
	$(DOCPP) \
727
	$(all_python_code)
728

    
729
lint_python_code = \
730
	ganeti \
731
	ganeti/http/server.py \
732
	$(dist_sbin_SCRIPTS) \
733
	$(dist_tools_PYTHON) \
734
	$(pkglib_python_scripts) \
735
	$(BUILD_BASH_COMPLETION) \
736
	$(DOCPP) \
737
	$(PYTHON_BOOTSTRAP)
738

    
739
test/daemon-util_unittest.bash: daemons/daemon-util
740

    
741
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
742

    
743
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
744
	sed -f $(REPLACE_VARS_SED) < $< > $@
745
	chmod +x $@
746

    
747
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
748
	sed -f $(REPLACE_VARS_SED) < $< > $@
749
	chmod u+x $@
750

    
751
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
752
	sed -f $(REPLACE_VARS_SED) < $< > $@
753
	chmod +x $@
754

    
755
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
756
	sed -f $(REPLACE_VARS_SED) < $< > $@
757

    
758
doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
759
	sed -f $(REPLACE_VARS_SED) < $< > $@
760

    
761
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
762
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
763
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
764

    
765
doc/%.png: doc/%.dot
766
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
767
	$(DOT) -Tpng -o $@ $<
768

    
769
man/footer.man: man/footer.rst
770
	@test -n "$(PANDOC)" || \
771
	  { echo 'pandoc' not found during configure; exit 1; }
772
	$(PANDOC) -f rst -t man -o $@ $<
773

    
774
man/footer.html: man/footer.rst
775
	@test -n "$(PANDOC)" || \
776
	  { echo 'pandoc' not found during configure; exit 1; }
777
	$(PANDOC) -f rst -t html -o $@ $<
778

    
779
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
780
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
781

    
782
man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
783
	@test -n "$(PANDOC)" || \
784
	  { echo 'pandoc' not found during configure; exit 1; }
785
	set -o pipefail ; \
786
	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
787
	  sed -e 's/\\@/@/g' > $@
788
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
789

    
790
man/%.html.in: man/%.gen man/footer.html
791
	@test -n "$(PANDOC)" || \
792
	  { echo 'pandoc' not found during configure; exit 1; }
793
	set -o pipefail ; \
794
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
795
	  sed -e 's/\\@/@/g' > $@
796

    
797
man/%.1: man/%.1.in $(REPLACE_VARS_SED)
798
	sed -f $(REPLACE_VARS_SED) < $< > $@
799

    
800
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
801
	sed -f $(REPLACE_VARS_SED) < $< > $@
802

    
803
man/%.8: man/%.8.in $(REPLACE_VARS_SED)
804
	sed -f $(REPLACE_VARS_SED) < $< > $@
805

    
806
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
807
	sed -f $(REPLACE_VARS_SED) < $< > $@
808

    
809
epydoc.conf: epydoc.conf.in Makefile
810
	sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
811

    
812
vcs-version:
813
	if test -d .git; then \
814
	  git describe > $@; \
815
	elif test ! -f $@ ; then \
816
	  echo "Cannot auto-generate $@ file"; exit 1; \
817
	fi
818

    
819
.PHONY: regen-vcs-version
820
regen-vcs-version:
821
	set -e; \
822
	cd $(srcdir); \
823
	if test -d .git; then \
824
	  rm -f vcs-version; \
825
	  $(MAKE) vcs-version; \
826
	fi
827

    
828
htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version
829
	set -e; \
830
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
831
	sed -e "s/%ver%/$$VCSVER/" < $< > $@
832

    
833
htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
834
	lib/constants.py lib/_autoconf.py $(CONVERT_CONSTANTS)
835
	set -e; \
836
	{ cat $< ; PYTHONPATH=. $(CONVERT_CONSTANTS); } > $@
837

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

    
904
$(REPLACE_VARS_SED): Makefile
905
	set -e; \
906
	{ echo 's#@PREFIX@#$(prefix)#g'; \
907
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
908
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
909
	  echo 's#@BINDIR@#$(bindir)#g'; \
910
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
911
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
912
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
913
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
914
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
915
	  echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
916
	  echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
917
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
918
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
919
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
920
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
921
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
922
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
923
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
924
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
925
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
926
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
927
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
928
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
929
	} > $@
930

    
931
# Using deferred evaluation
932
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
933
daemons/ganeti-watcher: MODULE = ganeti.watcher
934
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
935
tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
936

    
937
$(PYTHON_BOOTSTRAP): Makefile | $(all_dirfiles)
938
	test -n "$(MODULE)" || { echo Missing module; exit 1; }
939
	set -e; \
940
	{ echo '#!/usr/bin/python'; \
941
	  echo '# This file is automatically generated, do not edit!'; \
942
	  echo "# Edit $(MODULE) instead."; \
943
	  echo; \
944
	  echo '"""Bootstrap script for L{$(MODULE)}"""'; \
945
	  echo; \
946
	  echo '# pylint: disable-msg=C0103'; \
947
	  echo '# C0103: Invalid name'; \
948
	  echo; \
949
	  echo 'import sys'; \
950
	  echo 'import $(MODULE) as main'; \
951
	  echo; \
952
	  echo '# Temporarily alias commands until bash completion'; \
953
	  echo '# generator is changed'; \
954
	  echo 'if hasattr(main, "commands"):'; \
955
		echo '  commands = main.commands # pylint: disable-msg=E1101'; \
956
	  echo; \
957
	  echo 'if __name__ == "__main__":'; \
958
	  echo '  sys.exit(main.Main())'; \
959
	} > $@
960
	chmod u+x $@
961

    
962
# We need to create symlinks because "make distcheck" will not install Python
963
# files when building.
964
stamp-srclinks: Makefile | $(all_dirfiles)
965
	set -e; \
966
	for i in $(srclink_files); do \
967
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
968
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
969
		fi; \
970
	done
971
	touch $@
972

    
973
.PHONY: ganeti
974
ganeti:
975
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
976

    
977
.PHONY: check-dirs
978
check-dirs: $(BUILT_SOURCES)
979
	@set -e; \
980
	find . -type d \( \( -name . \) -o \( \
981
		-name .git -o \
982
		-name autom4te.cache \
983
		\) -prune -o -print \) | { \
984
		error=; \
985
		while read dir; do \
986
			case "$$dir" in \
987
				$(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
988
				*) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
989
			esac; \
990
		done; \
991
		for dir in $(DIRS); do \
992
			if ! test -d "$$dir"; then \
993
				echo "Directory $$dir listed in DIRS does not exist" >&2; \
994
				error=1; \
995
			fi \
996
		done; \
997
		if test -n "$$error"; then exit 1; else exit 0; fi; \
998
	}
999

    
1000
check-local: check-dirs
1001
	$(CHECK_PYTHON_CODE) $(check_python_code)
1002
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
1003
	$(CHECK_NEWS) < $(top_srcdir)/NEWS
1004
	expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
1005
	if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
1006
		echo "Incorrect version in README, expected $$expver"; \
1007
		exit 1; \
1008
	fi; \
1009
	if test "`sed -ne '4 p' $(top_srcdir)/doc/iallocator.rst`" != \
1010
					"Documents Ganeti version $$expver"; then \
1011
		echo "Incorrect version in iallocator.rst, expected $$expver"; \
1012
		exit 1; \
1013
	fi
1014

    
1015
.PHONY: hs-check
1016
hs-check: htools/test
1017
	@rm -f test.tix
1018
	./htools/test
1019

    
1020
.PHONY: lint
1021
lint: $(BUILT_SOURCES)
1022
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1023
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
1024
	cd $(top_srcdir)/qa && \
1025
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
1026
	  --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
1027

    
1028
.PHONY: hlint
1029
hlint: $(HS_BUILT_SRCS)
1030
	if tty -s; then C="-c"; else C=""; fi; \
1031
	hlint --report=doc/hs-lint.html $$C htools
1032

    
1033
# a dist hook rule for updating the vcs-version file; this is
1034
# hardcoded due to where it needs to build the file...
1035
dist-hook:
1036
	$(MAKE) regen-vcs-version && \
1037
	rm -f $(top_distdir)/vcs-version && \
1038
	cp -p $(srcdir)/vcs-version $(top_distdir)
1039

    
1040
# a distcheck hook rule for catching revision control directories
1041
distcheck-hook:
1042
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
1043
		echo "Found revision control files in final archive." 1>&2; \
1044
		exit 1; \
1045
	fi
1046
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
1047
		echo "Found Python byte code in final archive." 1>&2; \
1048
		exit 1; \
1049
	fi
1050
	if find $(top_distdir) -name '*~' | grep .; then \
1051
		echo "Found backup files in final archive." 1>&2; \
1052
		exit 1; \
1053
	fi
1054
# Empty files or directories should not be distributed. They can cause
1055
# unnecessary warnings for packagers. Directories used by automake during
1056
# distcheck must be excluded.
1057
	if find $(top_distdir) -empty -and -not \( \
1058
			-path $(top_distdir)/_build -or \
1059
			-path $(top_distdir)/_inst \) | grep .; then \
1060
		echo "Found empty files or directories in final archive." 1>&2; \
1061
		exit 1; \
1062
	fi
1063
	if test -n "$(BUILD_RELEASE)" && \
1064
	   grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
1065
		echo "Found unreleased version in NEWS." >&2; \
1066
		exit 1; \
1067
	fi
1068

    
1069
# When building a release, stricter checks should be used
1070
distcheck-release dist-release: export BUILD_RELEASE = 1
1071
distcheck-release: distcheck
1072

    
1073
dist-release: dist
1074
	set -e; \
1075
	for i in $(DIST_ARCHIVES); do \
1076
		echo -n "Checking $$i ... "; \
1077
		autotools/check-tar < $$i; \
1078
		echo OK; \
1079
	done
1080

    
1081
install-exec-local:
1082
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1083
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
1084
	  "$(DESTDIR)${localstatedir}/run/ganeti"
1085

    
1086
# To avoid conflicts between directory names and other targets, a file inside
1087
# the directory is used to ensure its existence.
1088
%.dir:
1089
	@mkdir_p@ $* && touch $@
1090

    
1091
.PHONY: apidoc
1092
if WANT_HTOOLSAPIDOC
1093
apidoc: py-apidoc hs-apidoc
1094
else
1095
apidoc: py-apidoc
1096
endif
1097

    
1098
.PHONY: py-apidoc
1099
py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
1100
	$(RUN_IN_TEMPDIR) epydoc -v \
1101
		--conf $(CURDIR)/epydoc.conf \
1102
		--output $(CURDIR)/$(APIDOC_PY_DIR)
1103

    
1104
.PHONY: hs-apidoc
1105
hs-apidoc: $(HS_BUILT_SRCS)
1106
	@test -n "$(HSCOLOUR)" || \
1107
	    { echo 'HsColour' not found during configure; exit 1; }
1108
	@test -n "$(HADDOCK)" || \
1109
	    { echo 'haddock' not found during configure; exit 1; }
1110
	rm -rf $(APIDOC_HS_DIR)/*
1111
	@mkdir_p@ $(APIDOC_HS_DIR)/Ganeti/HTools
1112
	$(HSCOLOUR) -print-css > $(APIDOC_HS_DIR)/Ganeti/hscolour.css
1113
	ln -s ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/HTools/hscolour.css
1114
	set -e ; \
1115
	cd htools; \
1116
	if [ "$(HTOOLS_NOCURL)" ]; \
1117
	then OPTGHC="--optghc=$(HTOOLS_NOCURL)"; \
1118
	else OPTGHC=""; \
1119
	fi; \
1120
	if [ "$(HTOOLS_PARALLEL3)" ]; \
1121
	then OPTGHC="$$OPTGHC --optghc=$(HTOOLS_PARALLEL3)"; \
1122
	fi; \
1123
	RELSRCS="$(HS_LIB_SRCS:htools/%=%)  $(HS_BUILT_SRCS:htools/%=%)"; \
1124
	for file in $$RELSRCS; do \
1125
		hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
1126
		$(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
1127
	done ; \
1128
	$(HADDOCK) --odir ../$(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1129
		-t ganeti-htools -p haddock-prologue \
1130
		--source-module="%{MODULE/.//}.html" \
1131
		--source-entity="%{MODULE/.//}.html#%{NAME}" \
1132
		$$OPTGHC \
1133
		$(filter-out Ganeti/HTools/ExtLoader.hs,$(HS_LIB_SRCS:htools/%=%))
1134

    
1135
.PHONY: TAGS
1136
TAGS: $(BUILT_SOURCES)
1137
	rm -f TAGS
1138
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
1139
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
1140
	  -path './qa/*.py' | \
1141
	  etags -l python -
1142

    
1143
.PHONY: coverage
1144
if WANT_HTOOLS
1145
coverage: py-coverage hs-coverage
1146
else
1147
coverage: py-coverage
1148
endif
1149

    
1150
.PHONY: py-coverage
1151
py-coverage: $(BUILT_SOURCES) $(python_tests)
1152
	set -e; \
1153
	COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
1154
	TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
1155
	HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
1156
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1157
	$(python_tests)
1158

    
1159
.PHONY: hs-coverage
1160
hs-coverage: $(haskell_tests)
1161
	cd htools && rm -f *.tix *.mix && ./test
1162
	@mkdir_p@ $(COVERAGE_HS_DIR)
1163
	hpc markup --destdir=$(COVERAGE_HS_DIR) htools/test $(HPCEXCL)
1164
	hpc report htools/test $(HPCEXCL)
1165
	ln -sf hpc_index.html $(COVERAGE_HS_DIR)/index.html
1166

    
1167
# Special "kind-of-QA" target for htools, needs special setup (all
1168
# tools compiled with -fhpc)
1169
.PHONY: live-test
1170
live-test: all
1171
	set -e ; \
1172
	cd htools; \
1173
	rm -f .hpc; ln -s ../.hpc .hpc; \
1174
	rm -f *.tix *.mix; \
1175
	./live-test.sh; \
1176
	hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:htools/%=%)) \
1177
	  --output=live-test.tix ; \
1178
	@mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
1179
	hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
1180
		--srcdir=.. $(HPCEXCL) ; \
1181
	hpc report --srcdir=.. live-test $(HPCEXCL)
1182

    
1183
commit-check: distcheck lint apidoc
1184

    
1185
-include ./Makefile.local
1186

    
1187
# vim: set noet :