Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 2733df51

History | View | Annotate | Download (44.5 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
195
nodist_pkgpython_PYTHON = \
196
	$(BUILT_PYTHON_SOURCES)
197

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
439

    
440
HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
441
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
442

    
443
$(RUN_IN_TEMPDIR): | stamp-directories
444

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

    
465
doc/html: doc/html/index.html
466

    
467
doc/install-quick.rst: INSTALL
468
doc/news.rst: NEWS
469
doc/upgrade.rst: UPGRADE
470

    
471
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
472
	set -e; \
473
	{ echo '.. This file is automatically updated at build time from $<.'; \
474
	  echo '.. Do not edit.'; \
475
	  echo; \
476
	  cat $<; \
477
	} > $@
478

    
479
docdot = \
480
	doc/arch-2.0.dot \
481
	doc/design-2.1-lock-acquire.dot \
482
	doc/design-2.1-lock-release.dot
483

    
484
docpng = $(patsubst %.dot,%.png,$(docdot))
485

    
486
# Things to build but not to install (add it to EXTRA_DIST if it should be
487
# distributed)
488
noinst_DATA = \
489
	devel/upload \
490
	doc/html \
491
	$(BUILT_EXAMPLES) \
492
	doc/examples/bash_completion \
493
	$(manhtml)
494

    
495
gnt_scripts = \
496
	scripts/gnt-backup \
497
	scripts/gnt-cluster \
498
	scripts/gnt-debug \
499
	scripts/gnt-group \
500
	scripts/gnt-instance \
501
	scripts/gnt-job \
502
	scripts/gnt-node \
503
	scripts/gnt-os
504

    
505
PYTHON_BOOTSTRAP_SBIN = \
506
	daemons/ganeti-masterd \
507
	daemons/ganeti-noded \
508
	daemons/ganeti-watcher \
509
	daemons/ganeti-rapi \
510
	$(gnt_scripts)
511

    
512
if PY_CONFD
513
PYTHON_BOOTSTRAP_SBIN += daemons/ganeti-confd
514
endif
515

    
516
PYTHON_BOOTSTRAP = \
517
	$(PYTHON_BOOTSTRAP_SBIN) \
518
	tools/ensure-dirs
519

    
520
qa_scripts = \
521
	qa/__init__.py \
522
	qa/ganeti-qa.py \
523
	qa/qa_cluster.py \
524
	qa/qa_config.py \
525
	qa/qa_daemon.py \
526
	qa/qa_env.py \
527
	qa/qa_error.py \
528
	qa/qa_group.py \
529
	qa/qa_instance.py \
530
	qa/qa_job.py \
531
	qa/qa_node.py \
532
	qa/qa_os.py \
533
	qa/qa_rapi.py \
534
	qa/qa_tags.py \
535
	qa/qa_utils.py
536

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

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

    
571
# for the htest/test binary, we need to enable profiling/coverage
572
htest/test: HEXTRA_INT=-fhpc -ihtest
573

    
574
# we compile the hpc-htools binary with the program coverage
575
htest/hpc-htools: HEXTRA_INT=-fhpc
576

    
577
# test dependency
578
htest/offline-tests.sh: htest/hpc-htools
579

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

    
591
hs-prof-quick:
592
	$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf .prof_o -prof -auto-all"
593

    
594
dist_sbin_SCRIPTS = \
595
	tools/ganeti-listrunner
596

    
597
nodist_sbin_SCRIPTS = \
598
	$(PYTHON_BOOTSTRAP_SBIN) \
599
	daemons/ganeti-cleaner
600

    
601
if HS_CONFD
602
nodist_sbin_SCRIPTS += htools/hconfd
603
endif
604

    
605
python_scripts = \
606
	tools/burnin \
607
	tools/cfgshell \
608
	tools/cfgupgrade \
609
	tools/cfgupgrade12 \
610
	tools/cluster-merge \
611
	tools/confd-client \
612
	tools/fmtjson \
613
	tools/lvmstrap \
614
	tools/move-instance \
615
	tools/ovfconverter \
616
	tools/setup-ssh \
617
	tools/sanitize-config
618

    
619
dist_tools_SCRIPTS = \
620
	$(python_scripts) \
621
	tools/kvm-console-wrapper \
622
	tools/xm-console-wrapper \
623
	tools/master-ip-setup
624

    
625
pkglib_python_scripts = \
626
	daemons/import-export \
627
	tools/check-cert-expired
628

    
629
nodist_pkglib_python_scripts = \
630
	tools/ensure-dirs
631

    
632
myexeclib_SCRIPTS = \
633
	daemons/daemon-util \
634
	tools/kvm-ifup \
635
	$(pkglib_python_scripts)
636

    
637
nodist_myexeclib_SCRIPTS = \
638
	$(nodist_pkglib_python_scripts)
639

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

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

    
720
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
721
manhtml = $(patsubst %.rst,%.html,$(manrst))
722
mangen = $(patsubst %.rst,%.gen,$(manrst))
723
maninput = \
724
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
725
	$(patsubst %.html,%.html.in,$(manhtml)) \
726
	man/footer.man man/footer.html $(mangen)
727

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

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

    
883
haskell_tests = htest/test
884

    
885
dist_TESTS = \
886
	test/check-cert-expired_unittest.bash \
887
	test/daemon-util_unittest.bash \
888
	test/ganeti-cleaner_unittest.bash \
889
	test/import-export_unittest.bash \
890
	test/cli-test.bash \
891
	$(python_tests)
892

    
893
nodist_TESTS =
894
check_SCRIPTS =
895

    
896
if WANT_HTOOLSTESTS
897
nodist_TESTS += $(haskell_tests)
898
dist_TESTS += htest/offline-test.sh
899
check_SCRIPTS += htest/hpc-htools $(HS_BUILT_TEST_HELPERS)
900
endif
901

    
902
TESTS = $(dist_TESTS) $(nodist_TESTS)
903

    
904
# Environment for all tests
905
PLAIN_TESTS_ENVIRONMENT = \
906
	PYTHONPATH=. \
907
	TOP_SRCDIR=$(abs_top_srcdir) TOP_BUILDDIR=$(abs_top_builddir) \
908
	PYTHON=$(PYTHON) FAKEROOT=$(FAKEROOT_PATH) \
909
	$(RUN_IN_TEMPDIR)
910

    
911
# Environment for tests run by automake
912
TESTS_ENVIRONMENT = \
913
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
914

    
915
all_python_code = \
916
	$(dist_sbin_SCRIPTS) \
917
	$(python_scripts) \
918
	$(pkglib_python_scripts) \
919
	$(nodist_pkglib_python_scripts) \
920
	$(python_tests) \
921
	$(pkgpython_PYTHON) \
922
	$(client_PYTHON) \
923
	$(hypervisor_PYTHON) \
924
	$(rapi_PYTHON) \
925
	$(server_PYTHON) \
926
	$(pytools_PYTHON) \
927
	$(http_PYTHON) \
928
	$(confd_PYTHON) \
929
	$(masterd_PYTHON) \
930
	$(impexpd_PYTHON) \
931
	$(utils_PYTHON) \
932
	$(watcher_PYTHON) \
933
	$(noinst_PYTHON) \
934
	$(qa_scripts)
935

    
936
srclink_files = \
937
	man/footer.rst \
938
	test/check-cert-expired_unittest.bash \
939
	test/daemon-util_unittest.bash \
940
	test/ganeti-cleaner_unittest.bash \
941
	test/import-export_unittest.bash \
942
	test/cli-test.bash \
943
	htest/offline-test.sh \
944
	htest/cli-tests-defs.sh \
945
	$(all_python_code) \
946
	$(HS_LIB_SRCS) $(HS_PROG_SRCS)
947

    
948
check_python_code = \
949
	$(BUILD_BASH_COMPLETION) \
950
	$(CHECK_IMPORTS) \
951
	$(CHECK_HEADER) \
952
	$(DOCPP) \
953
	$(all_python_code)
954

    
955
lint_python_code = \
956
	ganeti \
957
	ganeti/http/server.py \
958
	$(dist_sbin_SCRIPTS) \
959
	$(python_scripts) \
960
	$(pkglib_python_scripts) \
961
	$(BUILD_BASH_COMPLETION) \
962
	$(CHECK_IMPORTS) \
963
	$(CHECK_HEADER) \
964
	$(DOCPP) \
965
	$(PYTHON_BOOTSTRAP)
966

    
967
standalone_python_modules = \
968
	lib/rapi/client.py \
969
	tools/ganeti-listrunner
970

    
971
pep8_python_code = \
972
	ganeti \
973
	ganeti/http/server.py \
974
	$(dist_sbin_SCRIPTS) \
975
	$(python_scripts) \
976
	$(pkglib_python_scripts) \
977
	$(BUILD_BASH_COMPLETION) \
978
	$(CHECK_HEADER) \
979
	$(DOCPP) \
980
	$(PYTHON_BOOTSTRAP) \
981
	qa
982

    
983
test/daemon-util_unittest.bash: daemons/daemon-util
984

    
985
test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
986

    
987
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
988
	sed -f $(REPLACE_VARS_SED) < $< > $@
989
	chmod +x $@
990

    
991
devel/upload: devel/upload.in $(REPLACE_VARS_SED)
992
	sed -f $(REPLACE_VARS_SED) < $< > $@
993
	chmod u+x $@
994

    
995
daemons/%:: daemons/%.in $(REPLACE_VARS_SED)
996
	sed -f $(REPLACE_VARS_SED) < $< > $@
997
	chmod +x $@
998

    
999
doc/examples/%:: doc/examples/%.in $(REPLACE_VARS_SED)
1000
	sed -f $(REPLACE_VARS_SED) < $< > $@
1001

    
1002
doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
1003
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin \
1004
	$(GENERATED_FILES)
1005
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
1006

    
1007
doc/%.png: doc/%.dot
1008
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
1009
	$(DOT) -Tpng -o $@ $<
1010

    
1011
man/footer.man: man/footer.rst
1012
	@test -n "$(PANDOC)" || \
1013
	  { echo 'pandoc' not found during configure; exit 1; }
1014
	$(PANDOC) -f rst -t man -o $@ $<
1015

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

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

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

    
1045

    
1046
man/%.html.in: man/%.gen man/footer.html
1047
	@test -n "$(PANDOC)" || \
1048
	  { echo 'pandoc' not found during configure; exit 1; }
1049
	set -o pipefail ; \
1050
	$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
1051
	  sed -e 's/\\@/@/g' > $@
1052

    
1053
man/%: man/%.in  $(REPLACE_VARS_SED)
1054
	sed -f $(REPLACE_VARS_SED) < $< > $@
1055

    
1056
epydoc.conf: epydoc.conf.in $(REPLACE_VARS_SED)
1057
	sed -f $(REPLACE_VARS_SED) < $< > $@
1058

    
1059
vcs-version:
1060
	if test -d .git; then \
1061
	  git describe > $@; \
1062
	elif test ! -f $@ ; then \
1063
	  echo "Cannot auto-generate $@ file"; exit 1; \
1064
	fi
1065

    
1066
.PHONY: clean-vcs-version
1067
clean-vcs-version:
1068
	rm -f vcs-version
1069

    
1070
.PHONY: regen-vcs-version
1071
regen-vcs-version:
1072
	set -e; \
1073
	cd $(srcdir); \
1074
	if test -d .git; then \
1075
	  $(MAKE) $(AM_MAKEFLAGS) clean-vcs-version; \
1076
	  $(MAKE) $(AM_MAKEFLAGS) vcs-version; \
1077
	fi
1078

    
1079
htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in \
1080
	vcs-version $(built_base_sources)
1081
	set -e; \
1082
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
1083
	sed -e "s/%ver%/$$VCSVER/" < $< > $@
1084

    
1085
htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
1086
	lib/constants.py lib/_autoconf.py lib/luxi.py \
1087
	$(CONVERT_CONSTANTS) $(built_base_sources) \
1088
	| lib/_vcsversion.py
1089
	set -e; \
1090
	{ cat $< ; PYTHONPATH=. $(CONVERT_CONSTANTS); } > $@
1091

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

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

    
1186
lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC)
1187
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
1188

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

    
1219
# Using deferred evaluation
1220
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
1221
daemons/ganeti-watcher: MODULE = ganeti.watcher
1222
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
1223
tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
1224
$(HS_BUILT_TEST_HELPERS): TESTROLE = $(patsubst htest/%,%,$@)
1225

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

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

    
1264
stamp-directories: Makefile
1265
	$(MAKE) $(AM_MAKEFLAGS) ganeti
1266
	@mkdir_p@ $(DIRS) $(BUILDTIME_DIR_AUTOCREATE)
1267
	touch $@
1268

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

    
1280
.PHONY: ganeti
1281
ganeti:
1282
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
1283

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

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

    
1327
.PHONY: hs-check
1328
hs-check: htest/test htest/hpc-htools $(HS_BUILT_TEST_HELPERS)
1329
	@rm -f test.tix
1330
	./htest/test
1331
	HBINARY="./htest/hpc-htools" ./htest/offline-test.sh
1332

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

    
1348
# For excluding pep8 expects filenames only, not whole paths
1349
PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(BUILT_PYTHON_SOURCES))))
1350

    
1351
LINT_TARGETS = pylint pylint-qa
1352
if HAS_PEP8
1353
LINT_TARGETS += pep8
1354
endif
1355
if HAS_HLINT
1356
LINT_TARGETS += hlint
1357
endif
1358

    
1359
.PHONY: lint
1360
lint: $(LINT_TARGETS)
1361

    
1362
.PHONY: pylint
1363
pylint: $(GENERATED_FILES)
1364
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1365
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
1366

    
1367
.PHONY: pylint-qa
1368
pylint-qa: $(GENERATED_FILES)
1369
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
1370
	cd $(top_srcdir)/qa && \
1371
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
1372
	  --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
1373

    
1374
.PHONY: pep8
1375
pep8: $(GENERATED_FILES)
1376
	@test -n "$(PEP8)" || { echo 'pep8' not found during configure; exit 1; }
1377
	$(PEP8) --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
1378
		--repeat $(pep8_python_code)
1379

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

    
1395
# a dist hook rule for updating the vcs-version file; this is
1396
# hardcoded due to where it needs to build the file...
1397
dist-hook:
1398
	$(MAKE) $(AM_MAKEFLAGS) regen-vcs-version
1399
	rm -f $(top_distdir)/vcs-version
1400
	cp -p $(srcdir)/vcs-version $(top_distdir)
1401

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

    
1431
# When building a release, stricter checks should be used
1432
distcheck-release dist-release: export BUILD_RELEASE = 1
1433
distcheck-release: distcheck
1434

    
1435
distrebuildcheck: dist
1436
	set -e; \
1437
	builddir=$$(mktemp -d $(abs_srcdir)/distrebuildcheck.XXXXXXX); \
1438
	trap "echo Removing $$builddir; cd $(abs_srcdir); rm -rf $$builddir" EXIT; \
1439
	cd $$builddir; \
1440
	tar xzf $(abs_srcdir)/$(distdir).tar.gz; \
1441
	cd $(distdir); \
1442
	./configure; \
1443
	$(MAKE) maintainer-clean; \
1444
	cp $(abs_srcdir)/vcs-version .; \
1445
	./configure; \
1446
	$(MAKE) $(AM_MAKEFLAGS)
1447

    
1448
dist-release: dist
1449
	set -e; \
1450
	for i in $(DIST_ARCHIVES); do \
1451
		echo -n "Checking $$i ... "; \
1452
		autotools/check-tar < $$i; \
1453
		echo OK; \
1454
	done
1455

    
1456
install-exec-local:
1457
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
1458
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
1459
	  "$(DESTDIR)${localstatedir}/run/ganeti"
1460

    
1461
.PHONY: apidoc
1462
if WANT_HTOOLSAPIDOC
1463
apidoc: py-apidoc hs-apidoc
1464
else
1465
apidoc: py-apidoc
1466
endif
1467

    
1468
.PHONY: py-apidoc
1469
py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(GENERATED_FILES)
1470
	$(RUN_IN_TEMPDIR) epydoc -v \
1471
		--conf $(CURDIR)/epydoc.conf \
1472
		--output $(CURDIR)/$(APIDOC_PY_DIR)
1473

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

    
1508
.PHONY: TAGS
1509
TAGS: $(GENERATED_FILES)
1510
	rm -f TAGS
1511
	$(GHC) -e ":etags" -v0 $(HFLAGS) $(HS_LIB_SRCS)
1512
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
1513
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
1514
	  -path './qa/*.py' | \
1515
	  etags -l python -a -
1516

    
1517
.PHONY: coverage
1518
if WANT_HTOOLS
1519
coverage: py-coverage hs-coverage
1520
else
1521
coverage: py-coverage
1522
endif
1523

    
1524
.PHONY: py-coverage
1525
py-coverage: $(GENERATED_FILES) $(python_tests)
1526
	set -e; \
1527
	COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
1528
	TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
1529
	HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
1530
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/gen-coverage \
1531
	$(python_tests)
1532

    
1533
.PHONY: hs-coverage
1534
hs-coverage: $(haskell_tests) htest/hpc-htools
1535
	rm -f *.tix
1536
	$(MAKE) $(AM_MAKEFLAGS) hs-check
1537
	@mkdir_p@ $(COVERAGE_HS_DIR)
1538
	hpc combine --union $(HPCEXCL) \
1539
	  test.tix hpc-htools.tix > coverage-htools.tix
1540
	hpc markup --destdir=$(COVERAGE_HS_DIR) coverage-htools.tix
1541
	hpc report coverage-htools.tix
1542
	$(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
1543

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

    
1560
commit-check: distcheck lint apidoc
1561

    
1562
.PHONY: gitignore-check
1563
gitignore-check:
1564
	@if [ -n "`git status --short`" ]; then \
1565
	  echo "Git status is not clean!" 1>&2 ; \
1566
	  git status --short; \
1567
	  exit 1; \
1568
	fi
1569

    
1570
# we don't need the ancient implicit rules:
1571
%: %,v
1572
%: RCS/%,v
1573
%: RCS/%
1574
%: s.%
1575
%: SCCS/s.%
1576

    
1577
-include ./Makefile.local
1578

    
1579
# vim: set noet :