Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ aed2325f

History | View | Annotate | Download (44.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
# Helper values for calling builtin functions
13
empty :=
14
space := $(empty) $(empty)
15
comma := ,
16

    
17
# Use bash in order to be able to use pipefail
18
SHELL=/bin/bash
19

    
20
ACLOCAL_AMFLAGS = -I autotools
21
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
22
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
23
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
24
CHECK_HEADER = $(top_srcdir)/autotools/check-header
25
CHECK_MAN_DASHES = $(top_srcdir)/autotools/check-man-dashes
26
CHECK_MAN_WARNINGS = $(top_srcdir)/autotools/check-man-warnings
27
CHECK_VERSION = $(top_srcdir)/autotools/check-version
28
CHECK_NEWS = $(top_srcdir)/autotools/check-news
29
CHECK_IMPORTS = $(top_srcdir)/autotools/check-imports
30
DOCPP = $(top_srcdir)/autotools/docpp
31
REPLACE_VARS_SED = autotools/replace_vars.sed
32
CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
33
BUILD_RPC = $(top_srcdir)/autotools/build-rpc
34

    
35
# Note: these are automake-specific variables, and must be named after
36
# the directory + 'dir' suffix
37
clientdir = $(pkgpythondir)/client
38
hypervisordir = $(pkgpythondir)/hypervisor
39
httpdir = $(pkgpythondir)/http
40
masterddir = $(pkgpythondir)/masterd
41
confddir = $(pkgpythondir)/confd
42
rapidir = $(pkgpythondir)/rapi
43
serverdir = $(pkgpythondir)/server
44
watcherdir = $(pkgpythondir)/watcher
45
impexpddir = $(pkgpythondir)/impexpd
46
utilsdir = $(pkgpythondir)/utils
47
toolsdir = $(pkglibdir)/tools
48
iallocatorsdir = $(pkglibdir)/iallocators
49
pytoolsdir = $(pkgpythondir)/tools
50
docdir = $(datadir)/doc/$(PACKAGE)
51
myexeclibdir = $(pkglibdir)
52

    
53
# Delete output file if an error occurred while building it
54
.DELETE_ON_ERROR:
55

    
56
HTOOLS_DIRS = \
57
	htools \
58
	htools/Ganeti \
59
	htools/Ganeti/Confd \
60
	htools/Ganeti/HTools \
61
	htools/Ganeti/HTools/Program \
62
	htools/Ganeti/Query \
63
	htest \
64
	htest/Test \
65
	htest/Test/Ganeti \
66
	htest/Test/Ganeti/Confd \
67
	htest/Test/Ganeti/Query
68

    
69
DIRS = \
70
	autotools \
71
	daemons \
72
	devel \
73
	doc \
74
	doc/examples \
75
	doc/examples/hooks \
76
	doc/examples/gnt-debug \
77
	$(HTOOLS_DIRS) \
78
	lib \
79
	lib/client \
80
	lib/build \
81
	lib/confd \
82
	lib/http \
83
	lib/hypervisor \
84
	lib/impexpd \
85
	lib/masterd \
86
	lib/rapi \
87
	lib/server \
88
	lib/tools \
89
	lib/utils \
90
	lib/watcher \
91
	man \
92
	qa \
93
	test \
94
	test/data \
95
	test/data/ovfdata \
96
	test/data/ovfdata/other \
97
	htest/data \
98
	htest/data/rapi \
99
	tools
100

    
101
BUILDTIME_DIR_AUTOCREATE = \
102
	scripts \
103
	$(APIDOC_DIR) \
104
	$(APIDOC_PY_DIR) \
105
	$(APIDOC_HS_DIR) \
106
	$(APIDOC_HS_DIR)/Ganeti \
107
	$(APIDOC_HS_DIR)/Ganeti/Confd \
108
	$(APIDOC_HS_DIR)/Ganeti/HTools \
109
	$(APIDOC_HS_DIR)/Ganeti/HTools/Program \
110
	$(COVERAGE_DIR) \
111
	$(COVERAGE_PY_DIR) \
112
	$(COVERAGE_HS_DIR) \
113
	.hpc
114

    
115
BUILDTIME_DIRS = \
116
	$(BUILDTIME_DIR_AUTOCREATE) \
117
	doc/html
118

    
119
DIRCHECK_EXCLUDE = \
120
	$(BUILDTIME_DIRS) \
121
	ganeti-[0-9]*.[0-9]*.[0-9]* \
122
	doc/html/_*
123

    
124
# some helper vars
125
COVERAGE_DIR = doc/coverage
126
COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
127
COVERAGE_HS_DIR = $(COVERAGE_DIR)/hs
128
APIDOC_DIR = doc/api
129
APIDOC_PY_DIR = $(APIDOC_DIR)/py
130
APIDOC_HS_DIR = $(APIDOC_DIR)/hs
131

    
132
MAINTAINERCLEANFILES = \
133
	$(docpng) \
134
	$(maninput) \
135
	doc/install-quick.rst \
136
	doc/news.rst \
137
	doc/upgrade.rst \
138
	vcs-version
139

    
140
maintainer-clean-local:
141
	rm -rf $(BUILDTIME_DIRS)
142

    
143
CLEANFILES = \
144
	$(addsuffix /*.py[co],$(DIRS)) \
145
	$(addsuffix /*.hi,$(HTOOLS_DIRS)) \
146
	$(addsuffix /*.o,$(HTOOLS_DIRS)) \
147
	$(PYTHON_BOOTSTRAP) \
148
	epydoc.conf \
149
	$(REPLACE_VARS_SED) \
150
	daemons/daemon-util \
151
	daemons/ganeti-cleaner \
152
	devel/upload \
153
	$(BUILT_EXAMPLES) \
154
	doc/examples/bash_completion \
155
	lib/_generated_rpc.py \
156
	$(man_MANS) \
157
	$(manhtml) \
158
	tools/kvm-ifup \
159
	stamp-directories \
160
	stamp-srclinks \
161
	$(nodist_pkgpython_PYTHON) \
162
	$(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
163
	$(HS_BUILT_TEST_HELPERS) \
164
	.hpc/*.mix htools/*.tix htest/*.tix \
165
	doc/hs-lint.html
166

    
167
GENERATED_FILES = \
168
	$(built_base_sources) \
169
	$(BUILT_PYTHON_SOURCES) \
170
	$(PYTHON_BOOTSTRAP)
171

    
172
built_base_sources = \
173
	stamp-directories \
174
	stamp-srclinks
175

    
176
built_python_base_sources = \
177
	lib/_autoconf.py \
178
	lib/_vcsversion.py
179

    
180
BUILT_PYTHON_SOURCES = \
181
	$(built_python_base_sources) \
182
	lib/_generated_rpc.py
183

    
184
# Generating the RPC wrappers depends on many things, so make sure
185
# it's built at the end of the built sources
186
lib/_generated_rpc.py: | $(built_base_sources) $(built_python_base_sources)
187

    
188
# these are all built from the underlying %.in sources
189
BUILT_EXAMPLES = \
190
	doc/examples/ganeti-kvm-poweroff.initd \
191
	doc/examples/ganeti.cron \
192
	doc/examples/ganeti.initd \
193
	doc/examples/gnt-config-backup \
194
	doc/examples/hooks/ipsec
195

    
196
nodist_pkgpython_PYTHON = \
197
	$(BUILT_PYTHON_SOURCES)
198

    
199
noinst_PYTHON = \
200
	lib/build/__init__.py \
201
	lib/build/sphinx_ext.py \
202
	lib/build/shell_example_lexer.py
203

    
204
pkgpython_PYTHON = \
205
	lib/__init__.py \
206
	lib/asyncnotifier.py \
207
	lib/backend.py \
208
	lib/bdev.py \
209
	lib/bootstrap.py \
210
	lib/cli.py \
211
	lib/cmdlib.py \
212
	lib/compat.py \
213
	lib/config.py \
214
	lib/constants.py \
215
	lib/daemon.py \
216
	lib/errors.py \
217
	lib/ht.py \
218
	lib/jqueue.py \
219
	lib/jstore.py \
220
	lib/locking.py \
221
	lib/luxi.py \
222
	lib/mcpu.py \
223
	lib/netutils.py \
224
	lib/objects.py \
225
	lib/opcodes.py \
226
	lib/ovf.py \
227
	lib/qlang.py \
228
	lib/query.py \
229
	lib/rpc.py \
230
	lib/rpc_defs.py \
231
	lib/runtime.py \
232
	lib/serializer.py \
233
	lib/ssconf.py \
234
	lib/ssh.py \
235
	lib/storage.py \
236
	lib/uidpool.py \
237
	lib/workerpool.py
238

    
239
client_PYTHON = \
240
	lib/client/__init__.py \
241
	lib/client/gnt_backup.py \
242
	lib/client/gnt_cluster.py \
243
	lib/client/gnt_debug.py \
244
	lib/client/gnt_group.py \
245
	lib/client/gnt_instance.py \
246
	lib/client/gnt_job.py \
247
	lib/client/gnt_node.py \
248
	lib/client/gnt_os.py
249

    
250
hypervisor_PYTHON = \
251
	lib/hypervisor/__init__.py \
252
	lib/hypervisor/hv_base.py \
253
	lib/hypervisor/hv_chroot.py \
254
	lib/hypervisor/hv_fake.py \
255
	lib/hypervisor/hv_kvm.py \
256
	lib/hypervisor/hv_lxc.py \
257
	lib/hypervisor/hv_xen.py
258

    
259
rapi_PYTHON = \
260
	lib/rapi/__init__.py \
261
	lib/rapi/baserlib.py \
262
	lib/rapi/client.py \
263
	lib/rapi/client_utils.py \
264
	lib/rapi/connector.py \
265
	lib/rapi/rlib2.py \
266
	lib/rapi/testutils.py
267

    
268
http_PYTHON = \
269
	lib/http/__init__.py \
270
	lib/http/auth.py \
271
	lib/http/client.py \
272
	lib/http/server.py
273

    
274
confd_PYTHON = \
275
	lib/confd/__init__.py \
276
	lib/confd/client.py \
277
	lib/confd/querylib.py \
278
	lib/confd/server.py
279

    
280
masterd_PYTHON = \
281
	lib/masterd/__init__.py \
282
	lib/masterd/instance.py
283

    
284
impexpd_PYTHON = \
285
	lib/impexpd/__init__.py
286

    
287
watcher_PYTHON = \
288
	lib/watcher/__init__.py \
289
	lib/watcher/nodemaint.py \
290
	lib/watcher/state.py
291

    
292
server_PYTHON = \
293
	lib/server/__init__.py \
294
	lib/server/confd.py \
295
	lib/server/masterd.py \
296
	lib/server/noded.py \
297
	lib/server/rapi.py
298

    
299
pytools_PYTHON = \
300
	lib/tools/__init__.py \
301
	lib/tools/ensure_dirs.py
302

    
303
utils_PYTHON = \
304
	lib/utils/__init__.py \
305
	lib/utils/algo.py \
306
	lib/utils/filelock.py \
307
	lib/utils/hash.py \
308
	lib/utils/io.py \
309
	lib/utils/log.py \
310
	lib/utils/mlock.py \
311
	lib/utils/nodesetup.py \
312
	lib/utils/process.py \
313
	lib/utils/retry.py \
314
	lib/utils/text.py \
315
	lib/utils/wrapper.py \
316
	lib/utils/x509.py
317

    
318
docrst = \
319
	doc/admin.rst \
320
	doc/design-2.0.rst \
321
	doc/design-2.1.rst \
322
	doc/design-2.2.rst \
323
	doc/design-2.3.rst \
324
	doc/design-htools-2.3.rst \
325
	doc/design-2.4.rst \
326
	doc/design-2.5.rst \
327
	doc/design-draft.rst \
328
	doc/design-oob.rst \
329
	doc/design-cpu-pinning.rst \
330
	doc/design-query2.rst \
331
	doc/design-x509-ca.rst \
332
	doc/design-http-server.rst \
333
	doc/design-impexp2.rst \
334
	doc/design-lu-generated-jobs.rst \
335
	doc/design-multi-reloc.rst \
336
	doc/design-network.rst \
337
	doc/design-chained-jobs.rst \
338
	doc/design-ovf-support.rst \
339
	doc/design-autorepair.rst \
340
	doc/design-resource-model.rst \
341
	doc/cluster-merge.rst \
342
	doc/design-shared-storage.rst \
343
	doc/design-node-state-cache.rst \
344
	doc/design-virtual-clusters.rst \
345
	doc/design-bulk-create.rst \
346
	doc/design-query-splitting.rst \
347
	doc/devnotes.rst \
348
	doc/glossary.rst \
349
	doc/hooks.rst \
350
	doc/iallocator.rst \
351
	doc/index.rst \
352
	doc/install-quick.rst \
353
	doc/install.rst \
354
	doc/locking.rst \
355
	doc/move-instance.rst \
356
	doc/news.rst \
357
	doc/ovfconverter.rst \
358
	doc/rapi.rst \
359
	doc/security.rst \
360
	doc/upgrade.rst \
361
	doc/walkthrough.rst
362

    
363
HS_PROGS = htools/htools
364
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck
365

    
366
HS_ALL_PROGS = $(HS_PROGS) htest/test htest/hpc-htools htools/hconfd
367
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
368
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=htest/%) htest/hail
369

    
370
HFLAGS = -O -Wall -Werror -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
371
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
372
HEXTRA =
373
# internal extra flags (used for htest/test mainly)
374
HEXTRA_INT =
375
# exclude options for coverage reports
376
HPCEXCL = --exclude Main \
377
	--exclude Ganeti.Constants \
378
	--exclude Ganeti.THH \
379
	--exclude Ganeti.HTools.QC \
380
	--exclude Ganeti.HTools.Version \
381
	--exclude Test.Ganeti.TestHelper \
382
	--exclude Test.Ganeti.TestCommon \
383
	$(patsubst htools.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(filter-out htest/%,$(HS_LIB_SRCS)))))
384

    
385
HS_LIB_SRCS = \
386
	htools/Ganeti/HTools/CLI.hs \
387
	htools/Ganeti/HTools/Cluster.hs \
388
	htools/Ganeti/HTools/Compat.hs \
389
	htools/Ganeti/HTools/Container.hs \
390
	htools/Ganeti/HTools/ExtLoader.hs \
391
	htools/Ganeti/HTools/Group.hs \
392
	htools/Ganeti/HTools/IAlloc.hs \
393
	htools/Ganeti/HTools/Instance.hs \
394
	htools/Ganeti/HTools/JSON.hs \
395
	htools/Ganeti/HTools/Loader.hs \
396
	htools/Ganeti/HTools/Luxi.hs \
397
	htools/Ganeti/HTools/Node.hs \
398
	htools/Ganeti/HTools/PeerMap.hs \
399
	htools/Ganeti/HTools/QC.hs \
400
	htools/Ganeti/HTools/Rapi.hs \
401
	htools/Ganeti/HTools/Simu.hs \
402
	htools/Ganeti/HTools/Text.hs \
403
	htools/Ganeti/HTools/Types.hs \
404
	htools/Ganeti/HTools/Utils.hs \
405
	htools/Ganeti/HTools/Program.hs \
406
	htools/Ganeti/HTools/Program/Hail.hs \
407
	htools/Ganeti/HTools/Program/Hbal.hs \
408
	htools/Ganeti/HTools/Program/Hcheck.hs \
409
	htools/Ganeti/HTools/Program/Hinfo.hs \
410
	htools/Ganeti/HTools/Program/Hscan.hs \
411
	htools/Ganeti/HTools/Program/Hspace.hs \
412
	htools/Ganeti/BasicTypes.hs \
413
	htools/Ganeti/Confd.hs \
414
	htools/Ganeti/Confd/Server.hs \
415
	htools/Ganeti/Confd/Utils.hs \
416
	htools/Ganeti/Config.hs \
417
	htools/Ganeti/Daemon.hs \
418
	htools/Ganeti/Hash.hs \
419
	htools/Ganeti/Jobs.hs \
420
	htools/Ganeti/Logging.hs \
421
	htools/Ganeti/Luxi.hs \
422
	htools/Ganeti/Objects.hs \
423
	htools/Ganeti/OpCodes.hs \
424
	htools/Ganeti/Query/Common.hs \
425
	htools/Ganeti/Query/Filter.hs \
426
	htools/Ganeti/Query/Language.hs \
427
	htools/Ganeti/Query/Node.hs \
428
	htools/Ganeti/Query/Query.hs \
429
	htools/Ganeti/Query/Server.hs \
430
	htools/Ganeti/Query/Types.hs \
431
	htools/Ganeti/Rpc.hs \
432
	htools/Ganeti/Runtime.hs \
433
	htools/Ganeti/Ssconf.hs \
434
	htools/Ganeti/THH.hs \
435
	htest/Test/Ganeti/TestHelper.hs \
436
	htest/Test/Ganeti/TestCommon.hs \
437
	htest/Test/Ganeti/Confd/Utils.hs \
438
	htest/Test/Ganeti/Luxi.hs \
439
	htest/Test/Ganeti/Objects.hs \
440
	htest/Test/Ganeti/OpCodes.hs \
441
	htest/Test/Ganeti/Query/Language.hs \
442
	htest/Test/Ganeti/Rpc.hs \
443
	htest/Test/Ganeti/Ssconf.hs
444

    
445

    
446
HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
447
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
448

    
449
$(RUN_IN_TEMPDIR): | stamp-directories
450

    
451
# Note: we use here an order-only prerequisite, as the contents of
452
# _autoconf.py are not actually influencing the html build output: it
453
# has to exist in order for the sphinx module to be loaded
454
# successfully, but we certainly don't want the docs to be rebuilt if
455
# it changes
456
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
457
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
458
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
459
	| $(BUILT_PYTHON_SOURCES)
460
	@test -n "$(SPHINX)" || \
461
	    { echo 'sphinx-build' not found during configure; exit 1; }
462
	@mkdir_p@ $(dir $@)
463
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
464
	    -d . \
465
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
466
	    -D release="$(PACKAGE_VERSION)" \
467
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
468
	rm -f doc/html/.buildinfo doc/html/objects.inv
469
	touch $@
470

    
471
doc/html: doc/html/index.html
472

    
473
doc/install-quick.rst: INSTALL
474
doc/news.rst: NEWS
475
doc/upgrade.rst: UPGRADE
476

    
477
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
478
	set -e; \
479
	{ echo '.. This file is automatically updated at build time from $<.'; \
480
	  echo '.. Do not edit.'; \
481
	  echo; \
482
	  cat $<; \
483
	} > $@
484

    
485
docdot = \
486
	doc/arch-2.0.dot \
487
	doc/design-2.1-lock-acquire.dot \
488
	doc/design-2.1-lock-release.dot
489

    
490
docpng = $(patsubst %.dot,%.png,$(docdot))
491

    
492
# Things to build but not to install (add it to EXTRA_DIST if it should be
493
# distributed)
494
noinst_DATA = \
495
	devel/upload \
496
	doc/html \
497
	$(BUILT_EXAMPLES) \
498
	doc/examples/bash_completion \
499
	$(manhtml)
500

    
501
gnt_scripts = \
502
	scripts/gnt-backup \
503
	scripts/gnt-cluster \
504
	scripts/gnt-debug \
505
	scripts/gnt-group \
506
	scripts/gnt-instance \
507
	scripts/gnt-job \
508
	scripts/gnt-node \
509
	scripts/gnt-os
510

    
511
PYTHON_BOOTSTRAP_SBIN = \
512
	daemons/ganeti-masterd \
513
	daemons/ganeti-noded \
514
	daemons/ganeti-watcher \
515
	daemons/ganeti-rapi \
516
	$(gnt_scripts)
517

    
518
if PY_CONFD
519
PYTHON_BOOTSTRAP_SBIN += daemons/ganeti-confd
520
endif
521

    
522
PYTHON_BOOTSTRAP = \
523
	$(PYTHON_BOOTSTRAP_SBIN) \
524
	tools/ensure-dirs
525

    
526
qa_scripts = \
527
	qa/__init__.py \
528
	qa/ganeti-qa.py \
529
	qa/qa_cluster.py \
530
	qa/qa_config.py \
531
	qa/qa_daemon.py \
532
	qa/qa_env.py \
533
	qa/qa_error.py \
534
	qa/qa_group.py \
535
	qa/qa_instance.py \
536
	qa/qa_job.py \
537
	qa/qa_node.py \
538
	qa/qa_os.py \
539
	qa/qa_rapi.py \
540
	qa/qa_tags.py \
541
	qa/qa_utils.py
542

    
543
bin_SCRIPTS =
544
if WANT_HTOOLS
545
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
546
install-exec-hook:
547
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
548
# FIXME: this is a hardcoded logic, instead of auto-resolving
549
	$(LN_S) -f ../../../bin/htools \
550
		   $(DESTDIR)$(iallocatorsdir)/hail
551
	for role in $(HS_BIN_ROLES); do \
552
		$(LN_S) -f htools \
553
			   $(DESTDIR)$(bindir)/$$role ; \
554
	done
555
if HS_CONFD
556
	mv $(DESTDIR)$(sbindir)/hconfd $(DESTDIR)$(sbindir)/ganeti-confd
557
endif
558
endif
559

    
560
$(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
561
	@if [ -z "$(HTOOLS)" ]; then \
562
	  echo "Error: htools compilation disabled at configure time" 1>&2 ;\
563
	  exit 1; \
564
	fi
565
	@if [ "$(notdir $@)" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
566
	  echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \
567
	  exit 1; \
568
	fi
569
	@rm -f $(notdir $@).tix
570
	$(GHC) --make \
571
	  $(HFLAGS) \
572
	  $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) \
573
	  -osuf $(notdir $@).o -hisuf $(notdir $@).hi \
574
	  $(HEXTRA) $(HEXTRA_INT) $@
575
	@touch "$@"
576

    
577
# for the htest/test binary, we need to enable profiling/coverage
578
htest/test: HEXTRA_INT=-fhpc -ihtest
579

    
580
# we compile the hpc-htools binary with the program coverage
581
htest/hpc-htools: HEXTRA_INT=-fhpc
582

    
583
# test dependency
584
htest/offline-tests.sh: htest/hpc-htools
585

    
586
# rules for building profiling-enabled versions of the haskell
587
# programs: hs-prof does the full two-step build, whereas
588
# hs-prof-quick does only the final rebuild (hs-prof must have been
589
# run before)
590
.PHONY: hs-prof hs-prof-quick
591
hs-prof:
592
	$(MAKE) $(AM_MAKEFLAGS) clean
593
	$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf .o"
594
	rm -f $(HS_ALL_PROGS)
595
	$(MAKE) $(AM_MAKEFLAGS) hs-prof-quick
596

    
597
hs-prof-quick:
598
	$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf .prof_o -prof -auto-all"
599

    
600
dist_sbin_SCRIPTS = \
601
	tools/ganeti-listrunner
602

    
603
nodist_sbin_SCRIPTS = \
604
	$(PYTHON_BOOTSTRAP_SBIN) \
605
	daemons/ganeti-cleaner
606

    
607
if HS_CONFD
608
nodist_sbin_SCRIPTS += htools/hconfd
609
endif
610

    
611
python_scripts = \
612
	tools/burnin \
613
	tools/cfgshell \
614
	tools/cfgupgrade \
615
	tools/cfgupgrade12 \
616
	tools/cluster-merge \
617
	tools/confd-client \
618
	tools/fmtjson \
619
	tools/lvmstrap \
620
	tools/move-instance \
621
	tools/ovfconverter \
622
	tools/setup-ssh \
623
	tools/sanitize-config
624

    
625
dist_tools_SCRIPTS = \
626
	$(python_scripts) \
627
	tools/kvm-console-wrapper \
628
	tools/xm-console-wrapper \
629
	tools/master-ip-setup
630

    
631
pkglib_python_scripts = \
632
	daemons/import-export \
633
	tools/check-cert-expired
634

    
635
nodist_pkglib_python_scripts = \
636
	tools/ensure-dirs
637

    
638
myexeclib_SCRIPTS = \
639
	daemons/daemon-util \
640
	tools/kvm-ifup \
641
	$(pkglib_python_scripts)
642

    
643
nodist_myexeclib_SCRIPTS = \
644
	$(nodist_pkglib_python_scripts)
645

    
646
EXTRA_DIST = \
647
	NEWS \
648
	UPGRADE \
649
	epydoc.conf.in \
650
	pylintrc \
651
	autotools/build-bash-completion \
652
	autotools/build-rpc \
653
	autotools/check-header \
654
	autotools/check-python-code \
655
	autotools/check-imports \
656
	autotools/check-man-dashes \
657
	autotools/check-man-warnings \
658
	autotools/check-news \
659
	autotools/check-tar \
660
	autotools/check-version \
661
	autotools/convert-constants \
662
	autotools/docpp \
663
	autotools/gen-coverage \
664
	autotools/testrunner \
665
	autotools/wrong-hardcoded-paths \
666
	$(RUN_IN_TEMPDIR) \
667
	daemons/daemon-util.in \
668
	daemons/ganeti-cleaner.in \
669
	$(pkglib_python_scripts) \
670
	devel/upload.in \
671
	tools/kvm-ifup.in \
672
	$(docdot) \
673
	$(docpng) \
674
	$(docrst) \
675
	doc/conf.py \
676
	doc/html \
677
	$(BUILT_EXAMPLES:%=%.in) \
678
	doc/examples/ganeti.default \
679
	doc/examples/ganeti.default-debug \
680
	doc/examples/hooks/ethers \
681
	doc/examples/gnt-debug/README \
682
	doc/examples/gnt-debug/delay0.json \
683
	doc/examples/gnt-debug/delay50.json \
684
	test/lockperf.py \
685
	test/testutils.py \
686
	test/mocks.py \
687
	$(dist_TESTS) \
688
	$(TEST_FILES) \
689
	man/footer.rst \
690
	$(manrst) \
691
	$(maninput) \
692
	qa/qa-sample.json \
693
	$(qa_scripts) \
694
	$(HS_LIB_SRCS) $(HS_BUILT_SRCS_IN) \
695
	$(HS_PROG_SRCS) \
696
	htools/lint-hints.hs \
697
	htest/cli-tests-defs.sh \
698
	htest/offline-test.sh
699

    
700
man_MANS = \
701
	man/ganeti.7 \
702
	man/ganeti-cleaner.8 \
703
	man/ganeti-confd.8 \
704
	man/ganeti-listrunner.8 \
705
	man/ganeti-masterd.8 \
706
	man/ganeti-noded.8 \
707
	man/ganeti-os-interface.7 \
708
	man/ganeti-rapi.8 \
709
	man/ganeti-watcher.8 \
710
	man/gnt-backup.8 \
711
	man/gnt-cluster.8 \
712
	man/gnt-debug.8 \
713
	man/gnt-group.8 \
714
	man/gnt-instance.8 \
715
	man/gnt-job.8 \
716
	man/gnt-node.8 \
717
	man/gnt-os.8 \
718
	man/hail.1 \
719
	man/hbal.1 \
720
	man/hcheck.1 \
721
	man/hinfo.1 \
722
	man/hscan.1 \
723
	man/hspace.1 \
724
	man/htools.1
725

    
726
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
727
manhtml = $(patsubst %.rst,%.html,$(manrst))
728
mangen = $(patsubst %.rst,%.gen,$(manrst))
729
maninput = \
730
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
731
	$(patsubst %.html,%.html.in,$(manhtml)) \
732
	man/footer.man man/footer.html $(mangen)
733

    
734
TEST_FILES = \
735
	test/data/bdev-drbd-8.0.txt \
736
	test/data/bdev-drbd-8.3.txt \
737
	test/data/bdev-drbd-disk.txt \
738
	test/data/bdev-drbd-net-ip4.txt \
739
	test/data/bdev-drbd-net-ip6.txt \
740
	test/data/cert1.pem \
741
	test/data/ip-addr-show-dummy0.txt \
742
	test/data/ip-addr-show-lo-ipv4.txt \
743
	test/data/ip-addr-show-lo-ipv6.txt \
744
	test/data/ip-addr-show-lo-oneline-ipv4.txt \
745
	test/data/ip-addr-show-lo-oneline-ipv6.txt \
746
	test/data/ip-addr-show-lo-oneline.txt \
747
	test/data/ip-addr-show-lo.txt \
748
	test/data/proc_drbd8.txt \
749
	test/data/proc_drbd80-emptyline.txt \
750
	test/data/proc_drbd83.txt \
751
	test/data/proc_drbd83_sync.txt \
752
	test/data/proc_drbd83_sync_krnl2.6.39.txt \
753
	test/data/kvm_1.0_help.txt \
754
	test/data/kvm_0.15.90_help.txt \
755
	test/data/kvm_0.12.5_help.txt \
756
	test/data/kvm_0.9.1_help.txt \
757
	test/data/sys_drbd_usermode_helper.txt \
758
	test/data/ovfdata/compr_disk.vmdk.gz \
759
	test/data/ovfdata/config.ini \
760
	test/data/ovfdata/corrupted_resources.ovf \
761
	test/data/ovfdata/empty.ini \
762
	test/data/ovfdata/empty.ovf \
763
	test/data/ovfdata/ganeti.mf \
764
	test/data/ovfdata/ganeti.ovf \
765
	test/data/ovfdata/gzip_disk.ovf \
766
	test/data/ovfdata/new_disk.vmdk \
767
	test/data/ovfdata/no_disk.ini \
768
	test/data/ovfdata/no_disk_in_ref.ovf \
769
	test/data/ovfdata/no_os.ini \
770
	test/data/ovfdata/no_ovf.ova \
771
	test/data/ovfdata/ova.ova \
772
	test/data/ovfdata/second_disk.vmdk \
773
	test/data/ovfdata/rawdisk.raw \
774
	test/data/ovfdata/unsafe_path.ini \
775
	test/data/ovfdata/virtualbox.ovf \
776
	test/data/ovfdata/wrong_extension.ovd \
777
	test/data/ovfdata/wrong_config.ini \
778
	test/data/ovfdata/wrong_manifest.mf \
779
	test/data/ovfdata/wrong_manifest.ovf \
780
	test/data/ovfdata/wrong_ova.ova \
781
	test/data/ovfdata/wrong_xml.ovf \
782
	test/data/ovfdata/other/rawdisk.raw \
783
	test/data/vgreduce-removemissing-2.02.02.txt \
784
	test/data/vgreduce-removemissing-2.02.66-fail.txt \
785
	test/data/vgreduce-removemissing-2.02.66-ok.txt \
786
	test/data/vgs-missing-pvs-2.02.02.txt \
787
	test/data/vgs-missing-pvs-2.02.66.txt \
788
	test/import-export_unittest-helper \
789
	test/gnt-cli.test \
790
	test/ganeti-cli.test \
791
	htest/shelltests/htools-balancing.test \
792
	htest/shelltests/htools-basic.test \
793
	htest/shelltests/htools-dynutil.test \
794
	htest/shelltests/htools-excl.test \
795
	htest/shelltests/htools-hail.test \
796
	htest/shelltests/htools-hspace.test \
797
	htest/shelltests/htools-invalid.test \
798
	htest/shelltests/htools-multi-group.test \
799
	htest/shelltests/htools-no-backend.test \
800
	htest/shelltests/htools-rapi.test \
801
	htest/shelltests/htools-single-group.test \
802
	htest/shelltests/htools-text-backend.test \
803
	htest/data/hail-alloc-drbd.json \
804
	htest/data/hail-change-group.json \
805
	htest/data/hail-invalid-reloc.json \
806
	htest/data/hail-node-evac.json \
807
	htest/data/hail-reloc-drbd.json \
808
	htest/data/hbal-split-insts.data \
809
	htest/data/common-suffix.data \
810
	htest/data/invalid-node.data \
811
	htest/data/missing-resources.data \
812
	htest/data/rapi/groups.json \
813
	htest/data/rapi/info.json \
814
	htest/data/rapi/instances.json \
815
	htest/data/rapi/nodes.json
816

    
817
python_tests = \
818
	doc/examples/rapi_testutils.py \
819
	test/ganeti.asyncnotifier_unittest.py \
820
	test/ganeti.backend_unittest.py \
821
	test/ganeti.bdev_unittest.py \
822
	test/ganeti.cli_unittest.py \
823
	test/ganeti.client.gnt_cluster_unittest.py \
824
	test/ganeti.client.gnt_instance_unittest.py \
825
	test/ganeti.daemon_unittest.py \
826
	test/ganeti.cmdlib_unittest.py \
827
	test/ganeti.compat_unittest.py \
828
	test/ganeti.confd.client_unittest.py \
829
	test/ganeti.config_unittest.py \
830
	test/ganeti.constants_unittest.py \
831
	test/ganeti.errors_unittest.py \
832
	test/ganeti.hooks_unittest.py \
833
	test/ganeti.ht_unittest.py \
834
	test/ganeti.http_unittest.py \
835
	test/ganeti.hypervisor_unittest.py \
836
	test/ganeti.hypervisor.hv_chroot_unittest.py \
837
	test/ganeti.hypervisor.hv_fake_unittest.py \
838
	test/ganeti.hypervisor.hv_kvm_unittest.py \
839
	test/ganeti.hypervisor.hv_lxc_unittest.py \
840
	test/ganeti.hypervisor.hv_xen_unittest.py \
841
	test/ganeti.impexpd_unittest.py \
842
	test/ganeti.jqueue_unittest.py \
843
	test/ganeti.jstore_unittest.py \
844
	test/ganeti.locking_unittest.py \
845
	test/ganeti.luxi_unittest.py \
846
	test/ganeti.masterd.instance_unittest.py \
847
	test/ganeti.mcpu_unittest.py \
848
	test/ganeti.netutils_unittest.py \
849
	test/ganeti.objects_unittest.py \
850
	test/ganeti.opcodes_unittest.py \
851
	test/ganeti.ovf_unittest.py \
852
	test/ganeti.qlang_unittest.py \
853
	test/ganeti.query_unittest.py \
854
	test/ganeti.rapi.baserlib_unittest.py \
855
	test/ganeti.rapi.client_unittest.py \
856
	test/ganeti.rapi.resources_unittest.py \
857
	test/ganeti.rapi.rlib2_unittest.py \
858
	test/ganeti.rapi.testutils_unittest.py \
859
	test/ganeti.rpc_unittest.py \
860
	test/ganeti.runtime_unittest.py \
861
	test/ganeti.serializer_unittest.py \
862
	test/ganeti.ssh_unittest.py \
863
	test/ganeti.storage_unittest.py \
864
	test/ganeti.tools.ensure_dirs_unittest.py \
865
	test/ganeti.uidpool_unittest.py \
866
	test/ganeti.utils.algo_unittest.py \
867
	test/ganeti.utils.filelock_unittest.py \
868
	test/ganeti.utils.hash_unittest.py \
869
	test/ganeti.utils.io_unittest.py \
870
	test/ganeti.utils.log_unittest.py \
871
	test/ganeti.utils.mlock_unittest.py \
872
	test/ganeti.utils.nodesetup_unittest.py \
873
	test/ganeti.utils.process_unittest.py \
874
	test/ganeti.utils.retry_unittest.py \
875
	test/ganeti.utils.text_unittest.py \
876
	test/ganeti.utils.wrapper_unittest.py \
877
	test/ganeti.utils.x509_unittest.py \
878
	test/ganeti.utils_unittest.py \
879
	test/ganeti.workerpool_unittest.py \
880
	test/qa.qa_config_unittest.py \
881
	test/cfgupgrade_unittest.py \
882
	test/docs_unittest.py \
883
	test/pycurl_reset_unittest.py \
884
	test/tempfile_fork_unittest.py
885
if HAS_FAKEROOT
886
python_tests += test/ganeti.utils.io_unittest-runasroot.py
887
endif
888

    
889
haskell_tests = htest/test
890

    
891
dist_TESTS = \
892
	test/check-cert-expired_unittest.bash \
893
	test/daemon-util_unittest.bash \
894
	test/ganeti-cleaner_unittest.bash \
895
	test/import-export_unittest.bash \
896
	test/cli-test.bash \
897
	$(python_tests)
898

    
899
nodist_TESTS =
900
check_SCRIPTS =
901

    
902
if WANT_HTOOLSTESTS
903
nodist_TESTS += $(haskell_tests)
904
dist_TESTS += htest/offline-test.sh
905
check_SCRIPTS += htest/hpc-htools $(HS_BUILT_TEST_HELPERS)
906
endif
907

    
908
TESTS = $(dist_TESTS) $(nodist_TESTS)
909

    
910
# Environment for all tests
911
PLAIN_TESTS_ENVIRONMENT = \
912
	PYTHONPATH=. \
913
	TOP_SRCDIR=$(abs_top_srcdir) TOP_BUILDDIR=$(abs_top_builddir) \
914
	PYTHON=$(PYTHON) FAKEROOT=$(FAKEROOT_PATH) \
915
	$(RUN_IN_TEMPDIR)
916

    
917
# Environment for tests run by automake
918
TESTS_ENVIRONMENT = \
919
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
920

    
921
all_python_code = \
922
	$(dist_sbin_SCRIPTS) \
923
	$(python_scripts) \
924
	$(pkglib_python_scripts) \
925
	$(nodist_pkglib_python_scripts) \
926
	$(python_tests) \
927
	$(pkgpython_PYTHON) \
928
	$(client_PYTHON) \
929
	$(hypervisor_PYTHON) \
930
	$(rapi_PYTHON) \
931
	$(server_PYTHON) \
932
	$(pytools_PYTHON) \
933
	$(http_PYTHON) \
934
	$(confd_PYTHON) \
935
	$(masterd_PYTHON) \
936
	$(impexpd_PYTHON) \
937
	$(utils_PYTHON) \
938
	$(watcher_PYTHON) \
939
	$(noinst_PYTHON) \
940
	$(qa_scripts)
941

    
942
srclink_files = \
943
	man/footer.rst \
944
	test/check-cert-expired_unittest.bash \
945
	test/daemon-util_unittest.bash \
946
	test/ganeti-cleaner_unittest.bash \
947
	test/import-export_unittest.bash \
948
	test/cli-test.bash \
949
	htest/offline-test.sh \
950
	htest/cli-tests-defs.sh \
951
	$(all_python_code) \
952
	$(HS_LIB_SRCS) $(HS_PROG_SRCS)
953

    
954
check_python_code = \
955
	$(BUILD_BASH_COMPLETION) \
956
	$(CHECK_IMPORTS) \
957
	$(CHECK_HEADER) \
958
	$(DOCPP) \
959
	$(all_python_code)
960

    
961
lint_python_code = \
962
	ganeti \
963
	ganeti/http/server.py \
964
	$(dist_sbin_SCRIPTS) \
965
	$(python_scripts) \
966
	$(pkglib_python_scripts) \
967
	$(BUILD_BASH_COMPLETION) \
968
	$(CHECK_IMPORTS) \
969
	$(CHECK_HEADER) \
970
	$(DOCPP) \
971
	$(PYTHON_BOOTSTRAP)
972

    
973
standalone_python_modules = \
974
	lib/rapi/client.py \
975
	tools/ganeti-listrunner
976

    
977
pep8_python_code = \
978
	ganeti \
979
	ganeti/http/server.py \
980
	$(dist_sbin_SCRIPTS) \
981
	$(python_scripts) \
982
	$(pkglib_python_scripts) \
983
	$(BUILD_BASH_COMPLETION) \
984
	$(CHECK_HEADER) \
985
	$(DOCPP) \
986
	$(PYTHON_BOOTSTRAP) \
987
	qa
988

    
989
test/daemon-util_unittest.bash: daemons/daemon-util
990

    
991
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
992

    
993
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
994
	sed -f $(REPLACE_VARS_SED) < $< > $@
995
	chmod +x $@
996

    
997
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
998
	sed -f $(REPLACE_VARS_SED) < $< > $@
999
	chmod u+x $@
1000

    
1001
daemons/%:: daemons/%.in $(REPLACE_VARS_SED)
1002
	sed -f $(REPLACE_VARS_SED) < $< > $@
1003
	chmod +x $@
1004

    
1005
doc/examples/%:: doc/examples/%.in $(REPLACE_VARS_SED)
1006
	sed -f $(REPLACE_VARS_SED) < $< > $@
1007

    
1008
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
1009
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin \
1010
	$(GENERATED_FILES)
1011
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
1012

    
1013
doc/%.png: doc/%.dot
1014
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
1015
	$(DOT) -Tpng -o $@ $<
1016

    
1017
man/footer.man: man/footer.rst
1018
	@test -n "$(PANDOC)" || \
1019
	  { echo 'pandoc' not found during configure; exit 1; }
1020
	$(PANDOC) -f rst -t man -o $@ $<
1021

    
1022
man/footer.html: man/footer.rst
1023
	@test -n "$(PANDOC)" || \
1024
	  { echo 'pandoc' not found during configure; exit 1; }
1025
	$(PANDOC) -f rst -t html -o $@ $<
1026

    
1027
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py \
1028
	lib/build/shell_example_lexer.py \
1029
	| $(RUN_IN_TEMPDIR) $(BUILT_PYTHON_SOURCES)
1030
	@echo "Checking $< for hardcoded paths..."
1031
	@if grep -nEf autotools/wrong-hardcoded-paths $<; then \
1032
	  echo "Man page $< has harcoded paths (see above)!" 1>&2 ; \
1033
	  exit 1; \
1034
	fi
1035
	set -e ; \
1036
	trap 'echo auto-removing $@; rm $@' EXIT; \
1037
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@ ;\
1038
	trap - EXIT
1039

    
1040
man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
1041
	@test -n "$(PANDOC)" || \
1042
	  { echo 'pandoc' not found during configure; exit 1; }
1043
	set -o pipefail ; \
1044
	trap 'echo auto-removing $@; rm $@' EXIT; \
1045
	$(PANDOC) -s -f rst -t man -A man/footer.man $< | \
1046
	  sed -e 's/\\@/@/g' > $@; \
1047
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN_WARNINGS) $@; fi; \
1048
	$(CHECK_MAN_DASHES) $@; \
1049
	trap - EXIT
1050

    
1051

    
1052
man/%.html.in: man/%.gen man/footer.html
1053
	@test -n "$(PANDOC)" || \
1054
	  { echo 'pandoc' not found during configure; exit 1; }
1055
	set -o pipefail ; \
1056
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
1057
	  sed -e 's/\\@/@/g' > $@
1058

    
1059
man/%: man/%.in  $(REPLACE_VARS_SED)
1060
	sed -f $(REPLACE_VARS_SED) < $< > $@
1061

    
1062
epydoc.conf: epydoc.conf.in $(REPLACE_VARS_SED)
1063
	sed -f $(REPLACE_VARS_SED) < $< > $@
1064

    
1065
vcs-version:
1066
	if test -d .git; then \
1067
	  git describe > $@; \
1068
	elif test ! -f $@ ; then \
1069
	  echo "Cannot auto-generate $@ file"; exit 1; \
1070
	fi
1071

    
1072
.PHONY: clean-vcs-version
1073
clean-vcs-version:
1074
	rm -f vcs-version
1075

    
1076
.PHONY: regen-vcs-version
1077
regen-vcs-version:
1078
	set -e; \
1079
	cd $(srcdir); \
1080
	if test -d .git; then \
1081
	  $(MAKE) $(AM_MAKEFLAGS) clean-vcs-version; \
1082
	  $(MAKE) $(AM_MAKEFLAGS) vcs-version; \
1083
	fi
1084

    
1085
htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in \
1086
	vcs-version $(built_base_sources)
1087
	set -e; \
1088
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
1089
	sed -e "s/%ver%/$$VCSVER/" < $< > $@
1090

    
1091
htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
1092
	lib/constants.py lib/_autoconf.py lib/luxi.py \
1093
	$(CONVERT_CONSTANTS) $(built_base_sources) \
1094
	| lib/_vcsversion.py
1095
	set -e; \
1096
	{ cat $< ; PYTHONPATH=. $(CONVERT_CONSTANTS); } > $@
1097

    
1098
lib/_autoconf.py: Makefile | stamp-directories
1099
	set -e; \
1100
	{ echo '# This file is automatically generated, do not edit!'; \
1101
	  echo '#'; \
1102
	  echo ''; \
1103
	  echo '"""Build-time configuration for Ganeti.'; \
1104
	  echo '';\
1105
	  echo 'This file is autogenerated by the build process.'; \
1106
	  echo 'For any changes you need to re-run ./configure (and'; \
1107
	  echo 'not edit by hand).'; \
1108
	  echo ''; \
1109
	  echo '"""'; \
1110
	  echo ''; \
1111
	  echo '# pylint: disable=C0301,C0324'; \
1112
	  echo '# because this is autogenerated, we do not want'; \
1113
	  echo '# style warnings' ; \
1114
	  echo ''; \
1115
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
1116
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
1117
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
1118
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
1119
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
1120
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
1121
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
1122
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
1123
	  echo "SSH_CONFIG_DIR = '$(SSH_CONFIG_DIR)'"; \
1124
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
1125
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
1126
	  echo "XEN_BOOTLOADER = '$(XEN_BOOTLOADER)'"; \
1127
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
1128
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
1129
	  echo "KVM_KERNEL = '$(KVM_KERNEL)'"; \
1130
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
1131
	  echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
1132
	  echo "SHARED_FILE_STORAGE_DIR = '$(SHARED_FILE_STORAGE_DIR)'"; \
1133
	  echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \
1134
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
1135
	  echo "KVM_PATH = '$(KVM_PATH)'"; \
1136
	  echo "IP_PATH = '$(IP_PATH)'"; \
1137
	  echo "SOCAT_PATH = '$(SOCAT)'"; \
1138
	  echo "SOCAT_USE_ESCAPE = $(SOCAT_USE_ESCAPE)"; \
1139
	  echo "SOCAT_USE_COMPRESS = $(SOCAT_USE_COMPRESS)"; \
1140
	  echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
1141
	  echo "TOOLSDIR = '$(toolsdir)'"; \
1142
	  echo "GNT_SCRIPTS = [$(foreach i,$(notdir $(gnt_scripts)),'$(i)',)]"; \
1143
	  echo "PKGLIBDIR = '$(pkglibdir)'"; \
1144
	  echo "DRBD_BARRIERS = '$(DRBD_BARRIERS)'"; \
1145
	  echo "DRBD_NO_META_FLUSH = $(DRBD_NO_META_FLUSH)"; \
1146
	  echo "SYSLOG_USAGE = '$(SYSLOG_USAGE)'"; \
1147
	  echo "DAEMONS_GROUP = '$(DAEMONS_GROUP)'"; \
1148
	  echo "ADMIN_GROUP = '$(ADMIN_GROUP)'"; \
1149
	  echo "MASTERD_USER = '$(MASTERD_USER)'"; \
1150
	  echo "MASTERD_GROUP = '$(MASTERD_GROUP)'"; \
1151
	  echo "RAPI_USER = '$(RAPI_USER)'"; \
1152
	  echo "RAPI_GROUP = '$(RAPI_GROUP)'"; \
1153
	  echo "CONFD_USER = '$(CONFD_USER)'"; \
1154
	  echo "CONFD_GROUP = '$(CONFD_GROUP)'"; \
1155
	  echo "NODED_USER = '$(NODED_USER)'"; \
1156
	  echo "NODED_GROUP = '$(NODED_GROUP)'"; \
1157
	  echo "DISK_SEPARATOR = '$(DISK_SEPARATOR)'"; \
1158
	  echo "QEMUIMG_PATH = '$(QEMUIMG_PATH)'"; \
1159
	  if [ "$(HTOOLS)" ]; then \
1160
	    echo "HTOOLS = True"; \
1161
	  else \
1162
	    echo "HTOOLS = False"; \
1163
	  fi; \
1164
	  echo "ENABLE_CONFD = $(ENABLE_CONFD)"; \
1165
	  echo "PY_CONFD = $(PY_CONFD)"; \
1166
	  echo "HS_CONFD = $(HS_CONFD)"; \
1167
	  echo "XEN_CMD = '$(XEN_CMD)'"; \
1168
	  echo "ENABLE_SPLIT_QUERY = $(ENABLE_SPLIT_QUERY)"; \
1169
	} > $@
1170

    
1171
lib/_vcsversion.py: Makefile vcs-version | stamp-directories
1172
	set -e; \
1173
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
1174
	{ echo '# This file is automatically generated, do not edit!'; \
1175
	  echo '#'; \
1176
	  echo ''; \
1177
	  echo '"""Build-time VCS version number for Ganeti.'; \
1178
	  echo '';\
1179
	  echo 'This file is autogenerated by the build process.'; \
1180
	  echo 'For any changes you need to re-run ./configure (and'; \
1181
	  echo 'not edit by hand).'; \
1182
	  echo ''; \
1183
	  echo '"""'; \
1184
	  echo ''; \
1185
	  echo '# pylint: disable=C0301,C0324'; \
1186
	  echo '# because this is autogenerated, we do not want'; \
1187
	  echo '# style warnings' ; \
1188
	  echo ''; \
1189
	  echo "VCS_VERSION = '$$VCSVER'"; \
1190
	} > $@
1191

    
1192
lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC)
1193
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
1194

    
1195
$(REPLACE_VARS_SED): Makefile stamp-directories
1196
	set -e; \
1197
	{ echo 's#@PREFIX@#$(prefix)#g'; \
1198
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
1199
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
1200
	  echo 's#@BINDIR@#$(bindir)#g'; \
1201
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
1202
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
1203
	  echo 's#@CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
1204
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
1205
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
1206
	  echo 's#@CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
1207
	  echo 's#@CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
1208
	  echo 's#@RPL_FILE_STORAGE_DIR@#$(FILE_STORAGE_DIR)#g'; \
1209
	  echo 's#@RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
1210
	  echo 's#@PKGLIBDIR@#$(pkglibdir)#g'; \
1211
	  echo 's#@GNTMASTERUSER@#$(MASTERD_USER)#g'; \
1212
	  echo 's#@GNTRAPIUSER@#$(RAPI_USER)#g'; \
1213
	  echo 's#@GNTCONFDUSER@#$(CONFD_USER)#g'; \
1214
	  echo 's#@GNTNODEDUSER@#$(NODED_USER)#g'; \
1215
	  echo 's#@GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
1216
	  echo 's#@GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
1217
	  echo 's#@GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
1218
	  echo 's#@GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
1219
	  echo 's#@GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
1220
	  echo 's#@CUSTOM_ENABLE_CONFD@#$(ENABLE_CONFD)#g'; \
1221
	  echo 's#@MODULES@#$(strip $(lint_python_code))#g'; \
1222
	  echo 's#@ENABLE_SPLIT_QUERY@#$(ENABLE_SPLIT_QUERY)#g'; \
1223
	} > $@
1224

    
1225
# Using deferred evaluation
1226
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
1227
daemons/ganeti-watcher: MODULE = ganeti.watcher
1228
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
1229
tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
1230
$(HS_BUILT_TEST_HELPERS): TESTROLE = $(patsubst htest/%,%,$@)
1231

    
1232
$(PYTHON_BOOTSTRAP): Makefile | stamp-directories
1233
	test -n "$(MODULE)" || { echo Missing module; exit 1; }
1234
	set -e; \
1235
	{ echo '#!/usr/bin/python'; \
1236
	  echo '# This file is automatically generated, do not edit!'; \
1237
	  echo "# Edit $(MODULE) instead."; \
1238
	  echo; \
1239
	  echo '"""Bootstrap script for L{$(MODULE)}"""'; \
1240
	  echo; \
1241
	  echo '# pylint: disable=C0103'; \
1242
	  echo '# C0103: Invalid name'; \
1243
	  echo; \
1244
	  echo 'import sys'; \
1245
	  echo 'import $(MODULE) as main'; \
1246
	  echo; \
1247
	  echo '# Temporarily alias commands until bash completion'; \
1248
	  echo '# generator is changed'; \
1249
	  echo 'if hasattr(main, "commands"):'; \
1250
	  echo '  commands = main.commands # pylint: disable=E1101'; \
1251
	  echo 'if hasattr(main, "aliases"):'; \
1252
	  echo '  aliases = main.aliases # pylint: disable=E1101'; \
1253
	  echo; \
1254
	  echo 'if __name__ == "__main__":'; \
1255
	  echo '  sys.exit(main.Main())'; \
1256
	} > $@
1257
	chmod u+x $@
1258

    
1259
$(HS_BUILT_TEST_HELPERS): Makefile
1260
	@test -n "$(TESTROLE)" || { echo Missing TESTROLE; exit 1; }
1261
	set -e; \
1262
	{ echo '#!/bin/sh'; \
1263
	  echo '# This file is automatically generated, do not edit!'; \
1264
	  echo "# Edit Makefile.am instead."; \
1265
	  echo; \
1266
	  echo "HTOOLS=$(TESTROLE) exec ./htest/hpc-htools \"\$$@\""; \
1267
	} > $@
1268
	chmod u+x $@
1269

    
1270
stamp-directories: Makefile
1271
	$(MAKE) $(AM_MAKEFLAGS) ganeti
1272
	@mkdir_p@ $(DIRS) $(BUILDTIME_DIR_AUTOCREATE)
1273
	touch $@
1274

    
1275
# We need to create symlinks because "make distcheck" will not install Python
1276
# files when building.
1277
stamp-srclinks: Makefile | stamp-directories
1278
	set -e; \
1279
	for i in $(srclink_files); do \
1280
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
1281
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
1282
		fi; \
1283
	done
1284
	touch $@
1285

    
1286
.PHONY: ganeti
1287
ganeti:
1288
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
1289

    
1290
.PHONY: check-dirs
1291
check-dirs: $(GENERATED_FILES)
1292
	@set -e; \
1293
	find . -type d \( \( -name . \) -o \( \
1294
		-name .git -o \
1295
		-name autom4te.cache \
1296
		\) -prune -o -print \) | { \
1297
		error=; \
1298
		while read dir; do \
1299
			case "$$dir" in \
1300
				$(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
1301
				*) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
1302
			esac; \
1303
		done; \
1304
		for dir in $(DIRS); do \
1305
			if ! test -d "$$dir"; then \
1306
				echo "Directory $$dir listed in DIRS does not exist" >&2; \
1307
				error=1; \
1308
			fi \
1309
		done; \
1310
		if test -n "$$error"; then exit 1; else exit 0; fi; \
1311
	}
1312

    
1313
.PHONY: check-local
1314
check-local: check-dirs $(GENERATED_FILES)
1315
	$(CHECK_PYTHON_CODE) $(check_python_code)
1316
	PYTHONPATH=. $(CHECK_HEADER) $(check_python_code)
1317
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
1318
	$(CHECK_NEWS) < $(top_srcdir)/NEWS
1319
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CHECK_IMPORTS) . $(standalone_python_modules)
1320
	expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
1321
	if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
1322
		echo "Incorrect version in README, expected $$expver"; \
1323
		exit 1; \
1324
	fi; \
1325
	for file in doc/iallocator.rst doc/hooks.rst; do \
1326
		if test "`sed -ne '4 p' $(top_srcdir)/$$file`" != \
1327
			"Documents Ganeti version $$expver"; then \
1328
			echo "Incorrect version in $$file, expected $$expver"; \
1329
			exit 1; \
1330
		fi; \
1331
	done
1332

    
1333
.PHONY: hs-check
1334
hs-check: htest/test htest/hpc-htools $(HS_BUILT_TEST_HELPERS)
1335
	@rm -f test.tix
1336
	./htest/test
1337
	HBINARY="./htest/hpc-htools" ./htest/offline-test.sh
1338

    
1339
# E111: indentation is not a multiple of four
1340
# E121: continuation line indentation is not a multiple of four
1341
#       (since our indent level is not 4)
1342
# E125: continuation line does not distinguish itself from next logical line
1343
#       (since our indent level is not 4)
1344
# E127: continuation line over-indented for visual indent
1345
#       (since our indent level is not 4)
1346
# note: do NOT add E128 here; it's a valid style error in most cases!
1347
# I've seen real errors, but also some cases were we indent wrongly
1348
# due to line length; try to rework the cases where it is triggered,
1349
# instead of silencing it
1350
# E261: at least two spaces before inline comment
1351
# E501: line too long (80 characters)
1352
PEP8_IGNORE = E111,E121,E125,E127,E261,E501
1353

    
1354
# For excluding pep8 expects filenames only, not whole paths
1355
PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(BUILT_PYTHON_SOURCES))))
1356

    
1357
LINT_TARGETS = pylint pylint-qa
1358
if HAS_PEP8
1359
LINT_TARGETS += pep8
1360
endif
1361
if HAS_HLINT
1362
LINT_TARGETS += hlint
1363
endif
1364

    
1365
.PHONY: lint
1366
lint: $(LINT_TARGETS)
1367

    
1368
.PHONY: pylint
1369
pylint: $(GENERATED_FILES)
1370
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1371
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
1372

    
1373
.PHONY: pylint-qa
1374
pylint-qa: $(GENERATED_FILES)
1375
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1376
	cd $(top_srcdir)/qa && \
1377
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
1378
	  --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
1379

    
1380
.PHONY: pep8
1381
pep8: $(GENERATED_FILES)
1382
	@test -n "$(PEP8)" || { echo 'pep8' not found during configure; exit 1; }
1383
	$(PEP8) --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
1384
		--repeat $(pep8_python_code)
1385

    
1386
# FIXME: remove ignore "Use void" when GHC 6.x is deprecated
1387
.PHONY: hlint
1388
hlint: $(HS_BUILT_SRCS) htools/lint-hints.hs
1389
	@test -n "$(HLINT)" || { echo 'hlint' not found during configure; exit 1; }
1390
	if tty -s; then C="-c"; else C=""; fi; \
1391
	$(HLINT) --report=doc/hs-lint.html --cross $$C \
1392
	  --ignore "Use first" \
1393
	  --ignore "Use comparing" \
1394
	  --ignore "Use on" \
1395
	  --ignore "Reduce duplication" \
1396
	  --ignore "Use &&&" \
1397
	  --ignore "Use void" \
1398
	  --hint htools/lint-hints \
1399
	  $(filter-out htools/Ganeti/THH.hs,$(HS_LIB_SRCS))
1400

    
1401
# a dist hook rule for updating the vcs-version file; this is
1402
# hardcoded due to where it needs to build the file...
1403
dist-hook:
1404
	$(MAKE) $(AM_MAKEFLAGS) regen-vcs-version
1405
	rm -f $(top_distdir)/vcs-version
1406
	cp -p $(srcdir)/vcs-version $(top_distdir)
1407

    
1408
# a distcheck hook rule for catching revision control directories
1409
distcheck-hook:
1410
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
1411
		echo "Found revision control files in final archive." 1>&2; \
1412
		exit 1; \
1413
	fi
1414
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
1415
		echo "Found Python byte code in final archive." 1>&2; \
1416
		exit 1; \
1417
	fi
1418
	if find $(top_distdir) -name '*~' | grep .; then \
1419
		echo "Found backup files in final archive." 1>&2; \
1420
		exit 1; \
1421
	fi
1422
# Empty files or directories should not be distributed. They can cause
1423
# unnecessary warnings for packagers. Directories used by automake during
1424
# distcheck must be excluded.
1425
	if find $(top_distdir) -empty -and -not \( \
1426
			-path $(top_distdir)/_build -or \
1427
			-path $(top_distdir)/_inst \) | grep .; then \
1428
		echo "Found empty files or directories in final archive." 1>&2; \
1429
		exit 1; \
1430
	fi
1431
	if test -n "$(BUILD_RELEASE)" && \
1432
	   grep -n -H -E '^\*.*unreleased' $(top_distdir)/NEWS; then \
1433
		echo "Found unreleased version in NEWS." >&2; \
1434
		exit 1; \
1435
	fi
1436

    
1437
# When building a release, stricter checks should be used
1438
distcheck-release dist-release: export BUILD_RELEASE = 1
1439
distcheck-release: distcheck
1440

    
1441
distrebuildcheck: dist
1442
	set -e; \
1443
	builddir=$$(mktemp -d $(abs_srcdir)/distrebuildcheck.XXXXXXX); \
1444
	trap "echo Removing $$builddir; cd $(abs_srcdir); rm -rf $$builddir" EXIT; \
1445
	cd $$builddir; \
1446
	tar xzf $(abs_srcdir)/$(distdir).tar.gz; \
1447
	cd $(distdir); \
1448
	./configure; \
1449
	$(MAKE) maintainer-clean; \
1450
	cp $(abs_srcdir)/vcs-version .; \
1451
	./configure; \
1452
	$(MAKE) $(AM_MAKEFLAGS)
1453

    
1454
dist-release: dist
1455
	set -e; \
1456
	for i in $(DIST_ARCHIVES); do \
1457
		echo -n "Checking $$i ... "; \
1458
		autotools/check-tar < $$i; \
1459
		echo OK; \
1460
	done
1461

    
1462
install-exec-local:
1463
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1464
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
1465
	  "$(DESTDIR)${localstatedir}/run/ganeti"
1466

    
1467
.PHONY: apidoc
1468
if WANT_HTOOLSAPIDOC
1469
apidoc: py-apidoc hs-apidoc
1470
else
1471
apidoc: py-apidoc
1472
endif
1473

    
1474
.PHONY: py-apidoc
1475
py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(GENERATED_FILES)
1476
	$(RUN_IN_TEMPDIR) epydoc -v \
1477
		--conf $(CURDIR)/epydoc.conf \
1478
		--output $(CURDIR)/$(APIDOC_PY_DIR)
1479

    
1480
.PHONY: hs-apidoc
1481
hs-apidoc: $(HS_BUILT_SRCS)
1482
	@test -n "$(HSCOLOUR)" || \
1483
	    { echo 'HsColour' not found during configure; exit 1; }
1484
	@test -n "$(HADDOCK)" || \
1485
	    { echo 'haddock' not found during configure; exit 1; }
1486
	rm -rf $(APIDOC_HS_DIR)/*
1487
	@mkdir_p@ $(APIDOC_HS_DIR)/Ganeti/HTools/Program
1488
	@mkdir_p@ $(APIDOC_HS_DIR)/Ganeti/Confd
1489
	@mkdir_p@ $(APIDOC_HS_DIR)/Ganeti/Query
1490
	$(HSCOLOUR) -print-css > $(APIDOC_HS_DIR)/Ganeti/hscolour.css
1491
	$(LN_S) ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/HTools/hscolour.css
1492
	$(LN_S) ../hscolour.css $(APIDOC_HS_DIR)/Ganeti/Confd/hscolour.css
1493
	set -e ; \
1494
	cd htools; \
1495
	if [ "$(HTOOLS_NOCURL)" ]; \
1496
	then OPTGHC="--optghc=$(HTOOLS_NOCURL)"; \
1497
	else OPTGHC=""; \
1498
	fi; \
1499
	if [ "$(HTOOLS_PARALLEL3)" ]; \
1500
	then OPTGHC="$$OPTGHC --optghc=$(HTOOLS_PARALLEL3)"; \
1501
	fi; \
1502
	RELSRCS="$(HS_LIB_SRCS:htools/%=%)  $(HS_BUILT_SRCS:htools/%=%)"; \
1503
	for file in $$RELSRCS; do \
1504
		hfile=`echo $$file|sed 's/\\.hs$$//'`.html; \
1505
		$(HSCOLOUR) -css -anchor $$file > ../$(APIDOC_HS_DIR)/$$hfile ; \
1506
	done ; \
1507
	$(HADDOCK) --odir ../$(APIDOC_HS_DIR) --html --ignore-all-exports -w \
1508
		-t ganeti-htools -p haddock-prologue \
1509
		--source-module="%{MODULE/.//}.html" \
1510
		--source-entity="%{MODULE/.//}.html#%{NAME}" \
1511
		$$OPTGHC \
1512
		$(filter-out Ganeti/HTools/ExtLoader.hs,$(HS_LIB_SRCS:htools/%=%))
1513

    
1514
.PHONY: TAGS
1515
TAGS: $(GENERATED_FILES)
1516
	rm -f TAGS
1517
	$(GHC) -e ":etags" -v0 $(HFLAGS) $(HS_LIB_SRCS)
1518
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
1519
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
1520
	  -path './qa/*.py' | \
1521
	  etags -l python -a -
1522

    
1523
.PHONY: coverage
1524
if WANT_HTOOLS
1525
coverage: py-coverage hs-coverage
1526
else
1527
coverage: py-coverage
1528
endif
1529

    
1530
.PHONY: py-coverage
1531
py-coverage: $(GENERATED_FILES) $(python_tests)
1532
	set -e; \
1533
	COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
1534
	TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
1535
	HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
1536
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1537
	$(python_tests)
1538

    
1539
.PHONY: hs-coverage
1540
hs-coverage: $(haskell_tests) htest/hpc-htools
1541
	rm -f *.tix
1542
	$(MAKE) $(AM_MAKEFLAGS) hs-check
1543
	@mkdir_p@ $(COVERAGE_HS_DIR)
1544
	hpc combine --union $(HPCEXCL) \
1545
	  test.tix hpc-htools.tix > coverage-htools.tix
1546
	hpc markup --destdir=$(COVERAGE_HS_DIR) coverage-htools.tix
1547
	hpc report coverage-htools.tix
1548
	$(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
1549

    
1550
# Special "kind-of-QA" target for htools, needs special setup (all
1551
# tools compiled with -fhpc)
1552
.PHONY: live-test
1553
live-test: all
1554
	set -e ; \
1555
	cd htools; \
1556
	rm -f .hpc; $(LN_S) ../.hpc .hpc; \
1557
	rm -f *.tix *.mix; \
1558
	./live-test.sh; \
1559
	hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:htools/%=%)) \
1560
	  --output=live-test.tix ; \
1561
	@mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
1562
	hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
1563
		--srcdir=.. $(HPCEXCL) ; \
1564
	hpc report --srcdir=.. live-test $(HPCEXCL)
1565

    
1566
commit-check: distcheck lint apidoc
1567

    
1568
.PHONY: gitignore-check
1569
gitignore-check:
1570
	@if [ -n "`git status --short`" ]; then \
1571
	  echo "Git status is not clean!" 1>&2 ; \
1572
	  git status --short; \
1573
	  exit 1; \
1574
	fi
1575

    
1576
# we don't need the ancient implicit rules:
1577
%: %,v
1578
%: RCS/%,v
1579
%: RCS/%
1580
%: s.%
1581
%: SCCS/s.%
1582

    
1583
-include ./Makefile.local
1584

    
1585
# vim: set noet :