Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 458a286a

History | View | Annotate | Download (32.6 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
	htools/Ganeti/HTools/Program
51

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

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

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

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

    
101
all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
102

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

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

    
119
maintainer-clean-local:
120
	rm -rf $(BUILDTIME_DIRS)
121

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

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

    
157
nodist_pkgpython_PYTHON = \
158
	lib/_autoconf.py
159

    
160
noinst_PYTHON = \
161
	lib/build/__init__.py \
162
	lib/build/sphinx_ext.py
163

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

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

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

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

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

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

    
237
masterd_PYTHON = \
238
	lib/masterd/__init__.py \
239
	lib/masterd/instance.py
240

    
241
impexpd_PYTHON = \
242
	lib/impexpd/__init__.py
243

    
244
watcher_PYTHON = \
245
	lib/watcher/__init__.py
246

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

    
254
pytools_PYTHON = \
255
	lib/tools/__init__.py \
256
	lib/tools/ensure_dirs.py
257

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

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

    
309
HS_PROGS = \
310
	htools/hbal \
311
	htools/hscan \
312
	htools/hspace \
313
	htools/htools
314

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

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

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

    
353
$(RUN_IN_TEMPDIR): | $(all_dirfiles)
354

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

    
374
doc/html: doc/html/index.html
375

    
376
doc/install-quick.rst: INSTALL
377
doc/news.rst: NEWS
378
doc/upgrade.rst: UPGRADE
379

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

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

    
393
docpng = $(patsubst %.dot,%.png,$(docdot))
394

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

    
408
gnt_scripts = \
409
	scripts/gnt-backup \
410
	scripts/gnt-cluster \
411
	scripts/gnt-debug \
412
	scripts/gnt-group \
413
	scripts/gnt-instance \
414
	scripts/gnt-job \
415
	scripts/gnt-node \
416
	scripts/gnt-os
417

    
418
PYTHON_BOOTSTRAP_SBIN = \
419
	daemons/ganeti-confd \
420
	daemons/ganeti-masterd \
421
	daemons/ganeti-noded \
422
	daemons/ganeti-watcher \
423
	daemons/ganeti-rapi \
424
	scripts/gnt-backup \
425
	scripts/gnt-cluster \
426
	scripts/gnt-debug \
427
	scripts/gnt-group \
428
	scripts/gnt-instance \
429
	scripts/gnt-job \
430
	scripts/gnt-node \
431
	scripts/gnt-os
432

    
433
PYTHON_BOOTSTRAP = \
434
	$(PYTHON_BOOTSTRAP_SBIN) \
435
	tools/ensure-dirs
436

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

    
451
bin_SCRIPTS =
452
if WANT_HTOOLS
453
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
454
install-exec-hook:
455
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
456
	$(LN_S) -f $(DESTDIR)$(bindir)/htools \
457
		   $(DESTDIR)$(iallocatorsdir)/hail
458
endif
459

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

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

    
480
dist_sbin_SCRIPTS = \
481
	tools/ganeti-listrunner
482

    
483
nodist_sbin_SCRIPTS = \
484
	$(PYTHON_BOOTSTRAP_SBIN) \
485
	daemons/ganeti-cleaner
486

    
487
dist_tools_PYTHON = \
488
	tools/burnin \
489
	tools/cfgshell \
490
	tools/cfgupgrade \
491
	tools/cfgupgrade12 \
492
	tools/cluster-merge \
493
	tools/lvmstrap \
494
	tools/move-instance \
495
	tools/setup-ssh \
496
	tools/sanitize-config
497

    
498
dist_tools_SCRIPTS = \
499
	$(dist_tools_PYTHON) \
500
	tools/kvm-console-wrapper \
501
	tools/xm-console-wrapper
502

    
503
pkglib_python_scripts = \
504
	daemons/import-export \
505
	tools/check-cert-expired
506

    
507
nodist_pkglib_python_scripts = \
508
	tools/ensure-dirs
509

    
510
pkglib_SCRIPTS = \
511
	daemons/daemon-util \
512
	tools/kvm-ifup \
513
	$(pkglib_python_scripts)
514

    
515
nodist_pkglib_SCRIPTS = \
516
	$(nodist_pkglib_python_scripts)
517

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

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

    
591
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
592
manhtml = $(patsubst %.rst,%.html,$(manrst))
593
mangen = $(patsubst %.rst,%.gen,$(manrst))
594
maninput = \
595
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
596
	$(patsubst %.html,%.html.in,$(manhtml)) \
597
	man/footer.man man/footer.html $(mangen)
598

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

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

    
674
haskell_tests = htools/test
675

    
676
dist_TESTS = \
677
	test/check-cert-expired_unittest.bash \
678
	test/daemon-util_unittest.bash \
679
	test/ganeti-cleaner_unittest.bash \
680
	test/import-export_unittest.bash \
681
	$(python_tests)
682

    
683
nodist_TESTS =
684
if WANT_HTOOLSTESTS
685
nodist_TESTS += $(haskell_tests)
686
endif
687

    
688
TESTS = $(dist_TESTS) $(nodist_TESTS)
689

    
690
# Environment for all tests
691
PLAIN_TESTS_ENVIRONMENT = \
692
	PYTHONPATH=. TOP_SRCDIR=$(abs_top_srcdir) PYTHON=$(PYTHON) $(RUN_IN_TEMPDIR)
693

    
694
# Environment for tests run by automake
695
TESTS_ENVIRONMENT = \
696
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
697

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

    
719
srclink_files = \
720
	man/footer.rst \
721
	test/check-cert-expired_unittest.bash \
722
	test/daemon-util_unittest.bash \
723
	test/ganeti-cleaner_unittest.bash \
724
	test/import-export_unittest.bash \
725
	$(all_python_code) \
726
	$(HS_LIB_SRCS) $(HS_PROG_SRCS)
727

    
728
check_python_code = \
729
	$(BUILD_BASH_COMPLETION) \
730
	$(DOCPP) \
731
	$(all_python_code)
732

    
733
lint_python_code = \
734
	ganeti \
735
	ganeti/http/server.py \
736
	$(dist_sbin_SCRIPTS) \
737
	$(dist_tools_PYTHON) \
738
	$(pkglib_python_scripts) \
739
	$(BUILD_BASH_COMPLETION) \
740
	$(DOCPP) \
741
	$(PYTHON_BOOTSTRAP)
742

    
743
test/daemon-util_unittest.bash: daemons/daemon-util
744

    
745
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
746

    
747
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
748
	sed -f $(REPLACE_VARS_SED) < $< > $@
749
	chmod +x $@
750

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

    
755
daemons/%: daemons/%.in $(REPLACE_VARS_SED)
756
	sed -f $(REPLACE_VARS_SED) < $< > $@
757
	chmod +x $@
758

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

    
762
doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
763
	sed -f $(REPLACE_VARS_SED) < $< > $@
764

    
765
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
766
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
767
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
768

    
769
doc/%.png: doc/%.dot
770
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
771
	$(DOT) -Tpng -o $@ $<
772

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

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

    
783
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
784
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
785

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

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

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

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

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

    
810
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
811
	sed -f $(REPLACE_VARS_SED) < $< > $@
812

    
813
epydoc.conf: epydoc.conf.in Makefile
814
	sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
815

    
816
vcs-version:
817
	if test -d .git; then \
818
	  git describe > $@; \
819
	elif test ! -f $@ ; then \
820
	  echo "Cannot auto-generate $@ file"; exit 1; \
821
	fi
822

    
823
.PHONY: regen-vcs-version
824
regen-vcs-version:
825
	set -e; \
826
	cd $(srcdir); \
827
	if test -d .git; then \
828
	  rm -f vcs-version; \
829
	  $(MAKE) vcs-version; \
830
	fi
831

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

    
837
htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
838
	lib/constants.py lib/_autoconf.py $(CONVERT_CONSTANTS)
839
	set -e; \
840
	{ cat $< ; PYTHONPATH=. $(CONVERT_CONSTANTS); } > $@
841

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

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

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

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

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

    
977
.PHONY: ganeti
978
ganeti:
979
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
980

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

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

    
1019
.PHONY: hs-check
1020
hs-check: htools/test
1021
	@rm -f test.tix
1022
	./htools/test
1023

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

    
1032
.PHONY: hlint
1033
hlint: $(HS_BUILT_SRCS)
1034
	if tty -s; then C="-c"; else C=""; fi; \
1035
	hlint --report=doc/hs-lint.html $$C htools
1036

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

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

    
1073
# When building a release, stricter checks should be used
1074
distcheck-release dist-release: export BUILD_RELEASE = 1
1075
distcheck-release: distcheck
1076

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

    
1085
install-exec-local:
1086
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1087
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
1088
	  "$(DESTDIR)${localstatedir}/run/ganeti"
1089

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

    
1095
.PHONY: apidoc
1096
if WANT_HTOOLSAPIDOC
1097
apidoc: py-apidoc hs-apidoc
1098
else
1099
apidoc: py-apidoc
1100
endif
1101

    
1102
.PHONY: py-apidoc
1103
py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(BUILT_SOURCES)
1104
	$(RUN_IN_TEMPDIR) epydoc -v \
1105
		--conf $(CURDIR)/epydoc.conf \
1106
		--output $(CURDIR)/$(APIDOC_PY_DIR)
1107

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

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

    
1147
.PHONY: coverage
1148
if WANT_HTOOLS
1149
coverage: py-coverage hs-coverage
1150
else
1151
coverage: py-coverage
1152
endif
1153

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

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

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

    
1187
commit-check: distcheck lint apidoc
1188

    
1189
-include ./Makefile.local
1190

    
1191
# vim: set noet :