Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 8a7738b9

History | View | Annotate | Download (73.4 kB)

1
# Ganeti makefile
2
# - Indent with tabs only.
3
# - Keep files sorted; one line per file.
4
# - Directories in lib/ must have their own *dir variable (see hypervisor).
5
# - All directories must be listed DIRS.
6
# - Use autogen.sh to generate Makefile.in and configure script.
7

    
8
# Automake doesn't export these variables before version 1.10.
9
abs_top_builddir = @abs_top_builddir@
10
abs_top_srcdir = @abs_top_srcdir@
11

    
12
# Helper values for calling builtin functions
13
empty :=
14
space := $(empty) $(empty)
15
comma := ,
16

    
17
# Helper function to strip src/ and test/hs/ from a list
18
strip_hsroot = $(patsubst src/%,%,$(patsubst test/hs/%,%,$(1)))
19

    
20
# Use bash in order to be able to use pipefail
21
SHELL=/bin/bash
22

    
23
# Enable colors in shelltest
24
SHELLTESTARGS = "-c"
25

    
26
ACLOCAL_AMFLAGS = -I autotools
27
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
28
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
29
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
30
CHECK_HEADER = $(top_srcdir)/autotools/check-header
31
CHECK_MAN_DASHES = $(top_srcdir)/autotools/check-man-dashes
32
CHECK_MAN_REFERENCES = $(top_srcdir)/autotools/check-man-references
33
CHECK_MAN_WARNINGS = $(top_srcdir)/autotools/check-man-warnings
34
CHECK_VERSION = $(top_srcdir)/autotools/check-version
35
CHECK_NEWS = $(top_srcdir)/autotools/check-news
36
CHECK_IMPORTS = $(top_srcdir)/autotools/check-imports
37
DOCPP = $(top_srcdir)/autotools/docpp
38
REPLACE_VARS_SED = autotools/replace_vars.sed
39
PRINT_PY_CONSTANTS = $(top_srcdir)/autotools/print-py-constants
40
BUILD_RPC = $(top_srcdir)/autotools/build-rpc
41
SHELL_ENV_INIT = autotools/shell-env-init
42

    
43
# starting as of Ganeti 2.10, all files are stored in two directories,
44
# with only symbolic links added at other places.
45
#
46
# $(versiondir) contains most of Ganeti and all architecture-dependent files
47
# $(versionedsharedir) contains only architecture-independent files; all python
48
# executables need to go directly to $(versionedsharedir), as all ganeti python
49
# mdules are installed outside the usual python path, i.e., as private modules.
50
#
51
# $(defaultversiondir) and $(defaultversionedsharedir) are the corresponding
52
# directories for "the currently running" version of Ganeti. We never install
53
# there, but all symbolic links go there, rather than directory to $(versiondir)
54
# or $(versionedsharedir). Note that all links to $(default*dir) need to be stable;
55
# so, if some currently architecture-independent executable is replaced by an
56
# architecture-dependent one (and hence has to go under $(versiondir)), add a link
57
# under $(versionedsharedir) but do not change the external links.
58
if USE_VERSION_FULL
59
DIRVERSION=$(VERSION_FULL)
60
else
61
DIRVERSION=$(VERSION_MAJOR).$(VERSION_MINOR)
62
endif
63
versiondir = $(libdir)/ganeti/$(DIRVERSION)
64
defaultversiondir = $(libdir)/ganeti/default
65
versionedsharedir = $(prefix)/share/ganeti/$(DIRVERSION)
66
defaultversionedsharedir = $(prefix)/share/ganeti/default
67

    
68
# Note: these are automake-specific variables, and must be named after
69
# the directory + 'dir' suffix
70
pkglibdir = $(versiondir)$(libdir)/ganeti
71
myexeclibdir = $(pkglibdir)
72
bindir = $(versiondir)/$(BINDIR)
73
sbindir = $(versiondir)$(SBINDIR)
74
mandir = $(versionedsharedir)/root$(MANDIR)
75
pkgpythondir = $(versionedsharedir)/ganeti
76
gntpythondir = $(versionedsharedir)
77
pkgpython_bindir = $(versionedsharedir)
78
gnt_python_sbindir = $(versionedsharedir)
79
tools_pythondir = $(versionedsharedir)
80

    
81
clientdir = $(pkgpythondir)/client
82
cmdlibdir = $(pkgpythondir)/cmdlib
83
hypervisordir = $(pkgpythondir)/hypervisor
84
storagedir = $(pkgpythondir)/storage
85
httpdir = $(pkgpythondir)/http
86
masterddir = $(pkgpythondir)/masterd
87
confddir = $(pkgpythondir)/confd
88
rapidir = $(pkgpythondir)/rapi
89
rpcdir = $(pkgpythondir)/rpc
90
serverdir = $(pkgpythondir)/server
91
watcherdir = $(pkgpythondir)/watcher
92
impexpddir = $(pkgpythondir)/impexpd
93
utilsdir = $(pkgpythondir)/utils
94
toolsdir = $(pkglibdir)/tools
95
iallocatorsdir = $(pkglibdir)/iallocators
96
pytoolsdir = $(pkgpythondir)/tools
97
docdir = $(versiondir)$(datadir)/doc/$(PACKAGE)
98

    
99
SYMLINK_TARGET_DIRS = \
100
	$(sysconfdir)/ganeti \
101
	$(libdir)/ganeti/iallocators \
102
	$(libdir)/ganeti/tools \
103
	$(prefix)/share/ganeti \
104
	$(BINDIR) \
105
	$(SBINDIR) \
106
	$(MANDIR)/man1 \
107
	$(MANDIR)/man7 \
108
	$(MANDIR)/man8
109

    
110
# Delete output file if an error occurred while building it
111
.DELETE_ON_ERROR:
112

    
113
HS_DIRS = \
114
	src \
115
	src/Ganeti \
116
	src/Ganeti/Confd \
117
	src/Ganeti/Curl \
118
	src/Ganeti/Cpu \
119
	src/Ganeti/DataCollectors \
120
	src/Ganeti/Hs2Py \
121
	src/Ganeti/HTools \
122
	src/Ganeti/HTools/Backend \
123
	src/Ganeti/HTools/Program \
124
	src/Ganeti/Hypervisor \
125
	src/Ganeti/Hypervisor/Xen \
126
	src/Ganeti/Monitoring \
127
	src/Ganeti/Query \
128
	src/Ganeti/Storage \
129
	src/Ganeti/Storage/Diskstats \
130
	src/Ganeti/Storage/Drbd \
131
	src/Ganeti/Storage/Lvm \
132
	src/Ganeti/THH \
133
	test/hs \
134
	test/hs/Test \
135
	test/hs/Test/Ganeti \
136
	test/hs/Test/Ganeti/Storage \
137
	test/hs/Test/Ganeti/Storage/Diskstats \
138
	test/hs/Test/Ganeti/Storage/Drbd \
139
	test/hs/Test/Ganeti/Storage/Lvm \
140
	test/hs/Test/Ganeti/Confd \
141
	test/hs/Test/Ganeti/HTools \
142
	test/hs/Test/Ganeti/HTools/Backend \
143
	test/hs/Test/Ganeti/Hypervisor \
144
	test/hs/Test/Ganeti/Hypervisor/Xen \
145
	test/hs/Test/Ganeti/Query
146

    
147
# Haskell directories without the roots (src, test/hs)
148
HS_DIRS_NOROOT = $(filter-out src,$(filter-out test/hs,$(HS_DIRS)))
149

    
150
DIRS = \
151
	$(HS_DIRS) \
152
	autotools \
153
	daemons \
154
	devel \
155
	devel/data \
156
	doc \
157
	doc/css \
158
	doc/examples \
159
	doc/examples/gnt-debug \
160
	doc/examples/hooks \
161
	doc/users \
162
	test/data/htools \
163
	test/data/htools/rapi \
164
	test/hs/shelltests \
165
	test/autotools \
166
	lib \
167
	lib/build \
168
	lib/client \
169
	lib/cmdlib \
170
	lib/confd \
171
	lib/http \
172
	lib/hypervisor \
173
	lib/impexpd \
174
	lib/masterd \
175
	lib/rapi \
176
	lib/rpc \
177
	lib/server \
178
	lib/storage \
179
	lib/tools \
180
	lib/utils \
181
	lib/watcher \
182
	man \
183
	qa \
184
	test \
185
	test/data \
186
	test/data/bdev-rbd \
187
	test/data/ovfdata \
188
	test/data/ovfdata/other \
189
	test/py \
190
	test/py/cmdlib \
191
	test/py/cmdlib/testsupport \
192
	tools
193

    
194
ALL_APIDOC_HS_DIRS = \
195
	$(APIDOC_HS_DIR) \
196
	$(patsubst %,$(APIDOC_HS_DIR)/%,$(call strip_hsroot,$(HS_DIRS_NOROOT)))
197

    
198
BUILDTIME_DIR_AUTOCREATE = \
199
	scripts \
200
	$(APIDOC_DIR) \
201
	$(ALL_APIDOC_HS_DIRS) \
202
	$(APIDOC_PY_DIR) \
203
	$(COVERAGE_DIR) \
204
	$(COVERAGE_HS_DIR) \
205
	$(COVERAGE_PY_DIR) \
206
	.hpc
207

    
208
BUILDTIME_DIRS = \
209
	$(BUILDTIME_DIR_AUTOCREATE) \
210
	doc/html \
211
	doc/man-html
212

    
213
DIRCHECK_EXCLUDE = \
214
	$(BUILDTIME_DIRS) \
215
	ganeti-[0-9]*.[0-9]*.[0-9]* \
216
	doc/html/_* \
217
	doc/man-html/_* \
218
	autom4te.cache
219

    
220
# some helper vars
221
COVERAGE_DIR = doc/coverage
222
COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
223
COVERAGE_HS_DIR = $(COVERAGE_DIR)/hs
224
APIDOC_DIR = doc/api
225
APIDOC_PY_DIR = $(APIDOC_DIR)/py
226
APIDOC_HS_DIR = $(APIDOC_DIR)/hs
227

    
228
MAINTAINERCLEANFILES = \
229
	$(maninput) \
230
	doc/install-quick.rst \
231
	doc/news.rst \
232
	doc/upgrade.rst \
233
	vcs-version
234

    
235
maintainer-clean-local:
236
	rm -rf $(BUILDTIME_DIRS)
237

    
238
CLEANFILES = \
239
	$(addsuffix /*.py[co],$(DIRS)) \
240
	$(addsuffix /*.hi,$(HS_DIRS)) \
241
	$(addsuffix /*.o,$(HS_DIRS)) \
242
	$(addsuffix /*.$(HTEST_SUFFIX)_hi,$(HS_DIRS)) \
243
	$(addsuffix /*.$(HTEST_SUFFIX)_o,$(HS_DIRS)) \
244
	Makefile.ghc \
245
	Makefile.ghc.bak \
246
	$(PYTHON_BOOTSTRAP) \
247
	$(gnt_python_sbin_SCRIPTS) \
248
	epydoc.conf \
249
	$(REPLACE_VARS_SED) \
250
	$(SHELL_ENV_INIT) \
251
	daemons/daemon-util \
252
	daemons/ganeti-cleaner \
253
	devel/squeeze-amd64.tar.gz \
254
	devel/squeeze-amd64.conf \
255
	$(mandocrst) \
256
	doc/manpages-enabled.rst \
257
	$(BUILT_EXAMPLES) \
258
	doc/examples/bash_completion \
259
	doc/examples/bash_completion-debug \
260
	$(userspecs) \
261
	lib/_generated_rpc.py \
262
	$(man_MANS) \
263
	$(manhtml) \
264
	tools/kvm-ifup \
265
	tools/vif-ganeti \
266
	tools/net-common \
267
	tools/users-setup \
268
	tools/vcluster-setup \
269
	stamp-directories \
270
	stamp-srclinks \
271
	$(nodist_pkgpython_PYTHON) \
272
	$(gnt_scripts) \
273
	$(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
274
	$(HS_BUILT_TEST_HELPERS) \
275
	src/ganeti-confd \
276
	src/ganeti-luxid \
277
	src/ganeti-mond \
278
	.hpc/*.mix src/*.tix test/hs/*.tix *.tix \
279
	doc/hs-lint.html
280

    
281
GENERATED_FILES = \
282
	$(built_base_sources) \
283
	$(BUILT_PYTHON_SOURCES) \
284
	$(PYTHON_BOOTSTRAP) \
285
	$(gnt_python_sbin_SCRIPTS)
286

    
287
HS_GENERATED_FILES = $(HS_PROGS) src/hluxid src/ganeti-luxid
288
if ENABLE_CONFD
289
HS_GENERATED_FILES += src/hconfd src/ganeti-confd
290
endif
291
if ENABLE_MOND
292
HS_GENERATED_FILES += src/ganeti-mond
293
endif
294

    
295
built_base_sources = \
296
	stamp-directories \
297
	stamp-srclinks
298

    
299
built_python_base_sources = \
300
	lib/_constants.py \
301
	lib/_vcsversion.py \
302
	lib/opcodes.py
303

    
304
BUILT_PYTHON_SOURCES = \
305
	$(built_python_base_sources) \
306
	lib/_generated_rpc.py
307

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

    
312
# these are all built from the underlying %.in sources
313
BUILT_EXAMPLES = \
314
	doc/examples/ganeti-kvm-poweroff.initd \
315
	doc/examples/ganeti.cron \
316
	doc/examples/ganeti.initd \
317
	doc/examples/ganeti.logrotate \
318
	doc/examples/ganeti-master-role.ocf \
319
	doc/examples/ganeti-node-role.ocf \
320
	doc/examples/gnt-config-backup \
321
	doc/examples/hooks/ipsec
322

    
323
nodist_pkgpython_PYTHON = \
324
	$(BUILT_PYTHON_SOURCES)
325

    
326
nodist_pkgpython_bin_SCRIPTS = \
327
	$(nodist_pkglib_python_scripts)
328

    
329
pkgpython_bin_SCRIPTS = \
330
	$(pkglib_python_scripts)
331

    
332
noinst_PYTHON = \
333
	lib/build/__init__.py \
334
	lib/build/shell_example_lexer.py \
335
	lib/build/sphinx_ext.py
336

    
337
pkgpython_PYTHON = \
338
	lib/__init__.py \
339
	lib/asyncnotifier.py \
340
	lib/backend.py \
341
	lib/bootstrap.py \
342
	lib/cli.py \
343
	lib/compat.py \
344
	lib/config.py \
345
	lib/constants.py \
346
	lib/daemon.py \
347
	lib/errors.py \
348
	lib/hooksmaster.py \
349
	lib/ht.py \
350
	lib/jqueue.py \
351
	lib/jstore.py \
352
	lib/locking.py \
353
	lib/luxi.py \
354
	lib/mcpu.py \
355
	lib/netutils.py \
356
	lib/objects.py \
357
	lib/opcodes_base.py \
358
	lib/outils.py \
359
	lib/ovf.py \
360
	lib/pathutils.py \
361
	lib/qlang.py \
362
	lib/query.py \
363
	lib/rpc_defs.py \
364
	lib/runtime.py \
365
	lib/serializer.py \
366
	lib/ssconf.py \
367
	lib/ssh.py \
368
	lib/uidpool.py \
369
	lib/vcluster.py \
370
	lib/network.py \
371
	lib/workerpool.py
372

    
373
client_PYTHON = \
374
	lib/client/__init__.py \
375
	lib/client/gnt_backup.py \
376
	lib/client/gnt_cluster.py \
377
	lib/client/gnt_debug.py \
378
	lib/client/gnt_group.py \
379
	lib/client/gnt_instance.py \
380
	lib/client/gnt_job.py \
381
	lib/client/gnt_node.py \
382
	lib/client/gnt_network.py \
383
	lib/client/gnt_os.py \
384
	lib/client/gnt_storage.py
385

    
386
cmdlib_PYTHON = \
387
	lib/cmdlib/__init__.py \
388
	lib/cmdlib/backup.py \
389
	lib/cmdlib/base.py \
390
	lib/cmdlib/cluster.py \
391
	lib/cmdlib/common.py \
392
	lib/cmdlib/group.py \
393
	lib/cmdlib/instance.py \
394
	lib/cmdlib/instance_migration.py \
395
	lib/cmdlib/instance_operation.py \
396
	lib/cmdlib/instance_query.py \
397
	lib/cmdlib/instance_storage.py \
398
	lib/cmdlib/instance_utils.py \
399
	lib/cmdlib/misc.py \
400
	lib/cmdlib/network.py \
401
	lib/cmdlib/node.py \
402
	lib/cmdlib/operating_system.py \
403
	lib/cmdlib/query.py \
404
	lib/cmdlib/tags.py \
405
	lib/cmdlib/test.py
406

    
407
hypervisor_PYTHON = \
408
	lib/hypervisor/__init__.py \
409
	lib/hypervisor/hv_base.py \
410
	lib/hypervisor/hv_chroot.py \
411
	lib/hypervisor/hv_fake.py \
412
	lib/hypervisor/hv_kvm.py \
413
	lib/hypervisor/hv_lxc.py \
414
	lib/hypervisor/hv_xen.py
415

    
416
storage_PYTHON = \
417
	lib/storage/__init__.py \
418
	lib/storage/bdev.py \
419
	lib/storage/base.py \
420
	lib/storage/container.py \
421
	lib/storage/drbd.py \
422
	lib/storage/drbd_info.py \
423
	lib/storage/drbd_cmdgen.py \
424
	lib/storage/filestorage.py \
425
	lib/storage/gluster.py
426

    
427
rapi_PYTHON = \
428
	lib/rapi/__init__.py \
429
	lib/rapi/baserlib.py \
430
	lib/rapi/client.py \
431
	lib/rapi/client_utils.py \
432
	lib/rapi/connector.py \
433
	lib/rapi/rlib2.py \
434
	lib/rapi/testutils.py
435

    
436
http_PYTHON = \
437
	lib/http/__init__.py \
438
	lib/http/auth.py \
439
	lib/http/client.py \
440
	lib/http/server.py
441

    
442
confd_PYTHON = \
443
	lib/confd/__init__.py \
444
	lib/confd/client.py
445

    
446
masterd_PYTHON = \
447
	lib/masterd/__init__.py \
448
	lib/masterd/iallocator.py \
449
	lib/masterd/instance.py
450

    
451
impexpd_PYTHON = \
452
	lib/impexpd/__init__.py
453

    
454
watcher_PYTHON = \
455
	lib/watcher/__init__.py \
456
	lib/watcher/nodemaint.py \
457
	lib/watcher/state.py
458

    
459
server_PYTHON = \
460
	lib/server/__init__.py \
461
	lib/server/masterd.py \
462
	lib/server/noded.py \
463
	lib/server/rapi.py
464

    
465
rpc_PYTHON = \
466
	lib/rpc/__init__.py \
467
	lib/rpc/client.py \
468
	lib/rpc/errors.py \
469
	lib/rpc/node.py \
470
	lib/rpc/transport.py
471

    
472
pytools_PYTHON = \
473
	lib/tools/__init__.py \
474
	lib/tools/burnin.py \
475
	lib/tools/ensure_dirs.py \
476
	lib/tools/node_cleanup.py \
477
	lib/tools/node_daemon_setup.py \
478
	lib/tools/prepare_node_join.py
479

    
480
utils_PYTHON = \
481
	lib/utils/__init__.py \
482
	lib/utils/algo.py \
483
	lib/utils/filelock.py \
484
	lib/utils/hash.py \
485
	lib/utils/io.py \
486
	lib/utils/log.py \
487
	lib/utils/lvm.py \
488
	lib/utils/mlock.py \
489
	lib/utils/nodesetup.py \
490
	lib/utils/process.py \
491
	lib/utils/retry.py \
492
	lib/utils/security.py \
493
	lib/utils/storage.py \
494
	lib/utils/text.py \
495
	lib/utils/version.py \
496
	lib/utils/wrapper.py \
497
	lib/utils/x509.py
498

    
499
docinput = \
500
	doc/admin.rst \
501
	doc/cluster-keys-replacement.rst \
502
	doc/cluster-merge.rst \
503
	doc/conf.py \
504
	doc/css/style.css \
505
	doc/design-2.0.rst \
506
	doc/design-2.1.rst \
507
	doc/design-2.2.rst \
508
	doc/design-2.3.rst \
509
	doc/design-2.4.rst \
510
	doc/design-2.5.rst \
511
	doc/design-2.6.rst \
512
	doc/design-2.7.rst \
513
	doc/design-2.8.rst \
514
	doc/design-2.9.rst \
515
	doc/design-2.10.rst \
516
	doc/design-2.11.rst \
517
	doc/design-autorepair.rst \
518
	doc/design-bulk-create.rst \
519
	doc/design-ceph-ganeti-support.rst \
520
	doc/design-chained-jobs.rst \
521
	doc/design-cmdlib-unittests.rst \
522
	doc/design-cpu-pinning.rst \
523
	doc/design-daemons.rst \
524
	doc/design-device-uuid-name.rst \
525
	doc/design-draft.rst \
526
	doc/design-file-based-storage.rst \
527
	doc/design-glusterfs-ganeti-support.rst \
528
	doc/design-hotplug.rst \
529
	doc/design-hroller.rst \
530
	doc/design-hsqueeze.rst \
531
	doc/design-htools-2.3.rst \
532
	doc/design-http-server.rst \
533
	doc/design-hugepages-support.rst \
534
	doc/design-impexp2.rst \
535
	doc/design-internal-shutdown.rst \
536
	doc/design-kvmd.rst \
537
	doc/design-linuxha.rst \
538
	doc/design-lu-generated-jobs.rst \
539
	doc/design-monitoring-agent.rst \
540
	doc/design-multi-reloc.rst \
541
	doc/design-multi-version-tests.rst \
542
	doc/design-network.rst \
543
	doc/design-node-add.rst \
544
	doc/design-oob.rst \
545
	doc/design-openvswitch.rst \
546
	doc/design-opportunistic-locking.rst \
547
	doc/design-optables.rst \
548
	doc/design-os.rst \
549
	doc/design-ovf-support.rst \
550
	doc/design-partitioned.rst \
551
	doc/design-query2.rst \
552
	doc/design-query-splitting.rst \
553
	doc/design-reason-trail.rst \
554
	doc/design-resource-model.rst \
555
	doc/design-restricted-commands.rst \
556
	doc/design-shared-storage.rst \
557
	doc/design-ssh-ports.rst \
558
	doc/design-storagetypes.rst \
559
	doc/design-upgrade.rst \
560
	doc/design-virtual-clusters.rst \
561
	doc/design-x509-ca.rst \
562
	doc/dev-codestyle.rst \
563
	doc/devnotes.rst \
564
	doc/glossary.rst \
565
	doc/hooks.rst \
566
	doc/iallocator.rst \
567
	doc/index.rst \
568
	doc/install-quick.rst \
569
	doc/install.rst \
570
	doc/locking.rst \
571
	doc/manpages-disabled.rst \
572
	doc/monitoring-query-format.rst \
573
	doc/move-instance.rst \
574
	doc/news.rst \
575
	doc/ovfconverter.rst \
576
	doc/rapi.rst \
577
	doc/security.rst \
578
	doc/upgrade.rst \
579
	doc/virtual-cluster.rst \
580
	doc/walkthrough.rst
581

    
582
# Generates file names such as "doc/man-gnt-instance.rst"
583
mandocrst = $(addprefix doc/man-,$(notdir $(manrst)))
584

    
585
# Haskell programs to be installed in $PREFIX/bin
586
HS_BIN_PROGS=src/htools
587

    
588
# Haskell programs to be installed in the MYEXECLIB dir
589
if ENABLE_MOND
590
HS_MYEXECLIB_PROGS=src/mon-collector
591
else
592
HS_MYEXECLIB_PROGS=
593
endif
594

    
595
# Haskell programs to be compiled by "make really-all"
596
HS_COMPILE_PROGS = \
597
	src/ganeti-kvmd \
598
	src/hluxid \
599
	src/hs2py \
600
	src/rpc-test
601
if ENABLE_CONFD
602
HS_COMPILE_PROGS += src/hconfd
603
endif
604
if ENABLE_MOND
605
HS_COMPILE_PROGS += src/ganeti-mond
606
endif
607

    
608
# All Haskell non-test programs to be compiled but not automatically installed
609
HS_PROGS = $(HS_BIN_PROGS) $(HS_MYEXECLIB_PROGS)
610

    
611
HS_BIN_ROLES = harep hbal hscan hspace hinfo hcheck hroller hsqueeze
612
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
613

    
614
# Haskell programs that cannot be disabled at configure (e.g., unlike
615
# 'mon-collector')
616
HS_DEFAULT_PROGS = \
617
	$(HS_BIN_PROGS) \
618
	test/hs/hpc-htools \
619
	test/hs/hpc-mon-collector \
620
	test/hs/htest \
621
	$(HS_COMPILE_PROGS)
622

    
623
HS_ALL_PROGS = $(HS_DEFAULT_PROGS) $(HS_MYEXECLIB_PROGS)
624

    
625
HS_TEST_PROGS = $(filter test/%,$(HS_ALL_PROGS))
626
HS_SRC_PROGS = $(filter-out test/%,$(HS_ALL_PROGS))
627

    
628
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_DEFAULT_PROGS)) src/mon-collector.hs
629
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
630

    
631
HFLAGS = \
632
	-O -Wall -Werror -isrc \
633
	-fwarn-monomorphism-restriction \
634
	-fwarn-tabs \
635
	$(GHC_BYVERSION_FLAGS)
636

    
637
if HPROFILE
638
HFLAGS += -prof -auto-all
639
endif
640
if HCOVERAGE
641
HFLAGS += -fhpc
642
endif
643
if HTEST
644
HFLAGS += -DTEST
645
endif
646

    
647
HTEST_SUFFIX = hpc
648

    
649
HTEST_FLAGS = $(HFLAGS) -fhpc -itest/hs \
650
	-osuf .$(HTEST_SUFFIX)_o \
651
	-hisuf .$(HTEST_SUFFIX)_hi
652

    
653
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
654
HEXTRA =
655
# internal extra flags (used for test/hs/htest mainly)
656
HEXTRA_INT =
657
# exclude options for coverage reports
658
HPCEXCL = --exclude Main \
659
	--exclude Ganeti.Constants \
660
	--exclude Ganeti.HTools.QC \
661
	--exclude Ganeti.THH \
662
	--exclude Ganeti.Version \
663
	--exclude Test.Ganeti.Attoparsec \
664
	--exclude Test.Ganeti.TestCommon \
665
	--exclude Test.Ganeti.TestHTools \
666
	--exclude Test.Ganeti.TestHelper \
667
	--exclude Test.Ganeti.TestImports \
668
	$(patsubst src.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
669

    
670
HS_LIB_SRCS = \
671
	src/Ganeti/BasicTypes.hs \
672
	src/Ganeti/Common.hs \
673
	src/Ganeti/Compat.hs \
674
	src/Ganeti/Confd/Client.hs \
675
	src/Ganeti/Confd/ClientFunctions.hs \
676
	src/Ganeti/Confd/Server.hs \
677
	src/Ganeti/Confd/Types.hs \
678
	src/Ganeti/Confd/Utils.hs \
679
	src/Ganeti/Config.hs \
680
	src/Ganeti/ConfigReader.hs \
681
	src/Ganeti/Constants.hs \
682
	src/Ganeti/ConstantUtils.hs \
683
	src/Ganeti/Cpu/LoadParser.hs \
684
	src/Ganeti/Cpu/Types.hs \
685
	src/Ganeti/Curl/Multi.hs \
686
	src/Ganeti/Daemon.hs \
687
	src/Ganeti/DataCollectors/CLI.hs \
688
	src/Ganeti/DataCollectors/CPUload.hs \
689
	src/Ganeti/DataCollectors/Diskstats.hs \
690
	src/Ganeti/DataCollectors/Drbd.hs \
691
	src/Ganeti/DataCollectors/InstStatus.hs \
692
	src/Ganeti/DataCollectors/InstStatusTypes.hs \
693
	src/Ganeti/DataCollectors/Lv.hs \
694
	src/Ganeti/DataCollectors/Program.hs \
695
	src/Ganeti/DataCollectors/Types.hs \
696
	src/Ganeti/Errors.hs \
697
	src/Ganeti/HTools/Backend/IAlloc.hs \
698
	src/Ganeti/HTools/Backend/Luxi.hs \
699
	src/Ganeti/HTools/Backend/Rapi.hs \
700
	src/Ganeti/HTools/Backend/Simu.hs \
701
	src/Ganeti/HTools/Backend/Text.hs \
702
	src/Ganeti/HTools/CLI.hs \
703
	src/Ganeti/HTools/Cluster.hs \
704
	src/Ganeti/HTools/Container.hs \
705
	src/Ganeti/HTools/ExtLoader.hs \
706
	src/Ganeti/HTools/Graph.hs \
707
	src/Ganeti/HTools/Group.hs \
708
	src/Ganeti/HTools/Instance.hs \
709
	src/Ganeti/HTools/Loader.hs \
710
	src/Ganeti/HTools/Nic.hs \
711
	src/Ganeti/HTools/Node.hs \
712
	src/Ganeti/HTools/PeerMap.hs \
713
	src/Ganeti/HTools/Program/Hail.hs \
714
	src/Ganeti/HTools/Program/Harep.hs \
715
	src/Ganeti/HTools/Program/Hbal.hs \
716
	src/Ganeti/HTools/Program/Hcheck.hs \
717
	src/Ganeti/HTools/Program/Hinfo.hs \
718
	src/Ganeti/HTools/Program/Hscan.hs \
719
	src/Ganeti/HTools/Program/Hspace.hs \
720
	src/Ganeti/HTools/Program/Hsqueeze.hs \
721
	src/Ganeti/HTools/Program/Hroller.hs \
722
	src/Ganeti/HTools/Program/Main.hs \
723
	src/Ganeti/HTools/Types.hs \
724
	src/Ganeti/Hypervisor/Xen.hs \
725
	src/Ganeti/Hypervisor/Xen/XmParser.hs \
726
	src/Ganeti/Hypervisor/Xen/Types.hs \
727
	src/Ganeti/Hash.hs \
728
	src/Ganeti/Hs2Py/GenConstants.hs \
729
	src/Ganeti/Hs2Py/GenOpCodes.hs \
730
	src/Ganeti/Hs2Py/OpDoc.hs \
731
	src/Ganeti/JQueue.hs \
732
	src/Ganeti/JQScheduler.hs \
733
	src/Ganeti/JSON.hs \
734
	src/Ganeti/Jobs.hs \
735
	src/Ganeti/Kvmd.hs \
736
	src/Ganeti/Logging.hs \
737
	src/Ganeti/Luxi.hs \
738
	src/Ganeti/Monitoring/Server.hs \
739
	src/Ganeti/Network.hs \
740
	src/Ganeti/Objects.hs \
741
	src/Ganeti/OpCodes.hs \
742
	src/Ganeti/OpParams.hs \
743
	src/Ganeti/Path.hs \
744
	src/Ganeti/Parsers.hs \
745
	src/Ganeti/PyValue.hs \
746
	src/Ganeti/Query/Cluster.hs \
747
	src/Ganeti/Query/Common.hs \
748
	src/Ganeti/Query/Export.hs \
749
	src/Ganeti/Query/Filter.hs \
750
	src/Ganeti/Query/Group.hs \
751
	src/Ganeti/Query/Instance.hs \
752
	src/Ganeti/Query/Job.hs \
753
	src/Ganeti/Query/Language.hs \
754
	src/Ganeti/Query/Locks.hs \
755
	src/Ganeti/Query/Network.hs \
756
	src/Ganeti/Query/Node.hs \
757
	src/Ganeti/Query/Query.hs \
758
	src/Ganeti/Query/Server.hs \
759
	src/Ganeti/Query/Types.hs \
760
	src/Ganeti/Rpc.hs \
761
	src/Ganeti/Runtime.hs \
762
	src/Ganeti/Ssconf.hs \
763
	src/Ganeti/Storage/Diskstats/Parser.hs \
764
	src/Ganeti/Storage/Diskstats/Types.hs \
765
	src/Ganeti/Storage/Drbd/Parser.hs \
766
	src/Ganeti/Storage/Drbd/Types.hs \
767
	src/Ganeti/Storage/Lvm/LVParser.hs \
768
	src/Ganeti/Storage/Lvm/Types.hs \
769
	src/Ganeti/Storage/Utils.hs \
770
	src/Ganeti/THH.hs \
771
	src/Ganeti/THH/PyType.hs \
772
	src/Ganeti/Types.hs \
773
	src/Ganeti/UDSServer.hs \
774
	src/Ganeti/Utils.hs\
775
	src/Ganeti/VCluster.hs
776

    
777
HS_TEST_SRCS = \
778
	test/hs/Test/AutoConf.hs \
779
	test/hs/Test/Ganeti/Attoparsec.hs \
780
	test/hs/Test/Ganeti/BasicTypes.hs \
781
	test/hs/Test/Ganeti/Common.hs \
782
	test/hs/Test/Ganeti/Confd/Types.hs \
783
	test/hs/Test/Ganeti/Confd/Utils.hs \
784
	test/hs/Test/Ganeti/Constants.hs \
785
	test/hs/Test/Ganeti/Daemon.hs \
786
	test/hs/Test/Ganeti/Errors.hs \
787
	test/hs/Test/Ganeti/HTools/Backend/Simu.hs \
788
	test/hs/Test/Ganeti/HTools/Backend/Text.hs \
789
	test/hs/Test/Ganeti/HTools/CLI.hs \
790
	test/hs/Test/Ganeti/HTools/Cluster.hs \
791
	test/hs/Test/Ganeti/HTools/Container.hs \
792
	test/hs/Test/Ganeti/HTools/ExtLoader.hs \
793
	test/hs/Test/Ganeti/HTools/Graph.hs \
794
	test/hs/Test/Ganeti/HTools/Instance.hs \
795
	test/hs/Test/Ganeti/HTools/Loader.hs \
796
	test/hs/Test/Ganeti/HTools/Node.hs \
797
	test/hs/Test/Ganeti/HTools/PeerMap.hs \
798
	test/hs/Test/Ganeti/HTools/Types.hs \
799
	test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs \
800
	test/hs/Test/Ganeti/JSON.hs \
801
	test/hs/Test/Ganeti/Jobs.hs \
802
	test/hs/Test/Ganeti/JQueue.hs \
803
	test/hs/Test/Ganeti/Kvmd.hs \
804
	test/hs/Test/Ganeti/Luxi.hs \
805
	test/hs/Test/Ganeti/Network.hs \
806
	test/hs/Test/Ganeti/Objects.hs \
807
	test/hs/Test/Ganeti/OpCodes.hs \
808
	test/hs/Test/Ganeti/Query/Aliases.hs \
809
	test/hs/Test/Ganeti/Query/Filter.hs \
810
	test/hs/Test/Ganeti/Query/Instance.hs \
811
	test/hs/Test/Ganeti/Query/Language.hs \
812
	test/hs/Test/Ganeti/Query/Network.hs \
813
	test/hs/Test/Ganeti/Query/Query.hs \
814
	test/hs/Test/Ganeti/Rpc.hs \
815
	test/hs/Test/Ganeti/Runtime.hs \
816
	test/hs/Test/Ganeti/Ssconf.hs \
817
	test/hs/Test/Ganeti/Storage/Diskstats/Parser.hs \
818
	test/hs/Test/Ganeti/Storage/Drbd/Parser.hs \
819
	test/hs/Test/Ganeti/Storage/Drbd/Types.hs \
820
	test/hs/Test/Ganeti/Storage/Lvm/LVParser.hs \
821
	test/hs/Test/Ganeti/THH.hs \
822
	test/hs/Test/Ganeti/TestCommon.hs \
823
	test/hs/Test/Ganeti/TestHTools.hs \
824
	test/hs/Test/Ganeti/TestHelper.hs \
825
	test/hs/Test/Ganeti/Types.hs \
826
	test/hs/Test/Ganeti/Utils.hs
827

    
828
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
829

    
830
HS_BUILT_SRCS = \
831
	test/hs/Test/Ganeti/TestImports.hs \
832
	src/AutoConf.hs \
833
	src/Ganeti/Hs2Py/ListConstants.hs \
834
	src/Ganeti/Curl/Internal.hs \
835
	src/Ganeti/Version.hs
836
HS_BUILT_SRCS_IN = \
837
	$(patsubst %,%.in,$(filter-out src/Ganeti/Curl/Internal.hs,$(HS_BUILT_SRCS))) \
838
	src/Ganeti/Curl/Internal.hsc \
839
	lib/_constants.py.in \
840
	lib/opcodes.py.in_after \
841
	lib/opcodes.py.in_before
842

    
843
HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)
844

    
845
$(RUN_IN_TEMPDIR): | stamp-directories
846

    
847
doc/html/index.html: ENABLE_MANPAGES =
848
doc/man-html/index.html: ENABLE_MANPAGES = 1
849
doc/man-html/index.html: doc/manpages-enabled.rst $(mandocrst)
850

    
851
# Note: we use here an order-only prerequisite, as the contents of
852
# _constants.py are not actually influencing the html build output: it
853
# has to exist in order for the sphinx module to be loaded
854
# successfully, but we certainly don't want the docs to be rebuilt if
855
# it changes
856
doc/html/index.html doc/man-html/index.html: $(docinput) doc/conf.py \
857
	configure.ac $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
858
	lib/build/shell_example_lexer.py lib/ht.py \
859
	doc/css/style.css lib/rapi/connector.py lib/rapi/rlib2.py \
860
	autotools/sphinx-wrapper | $(BUILT_PYTHON_SOURCES)
861
	@test -n "$(SPHINX)" || \
862
	    { echo 'sphinx-build' not found during configure; exit 1; }
863
if !MANPAGES_IN_DOC
864
	if test -n '$(ENABLE_MANPAGES)'; then \
865
	  echo 'Man pages in documentation were disabled at configure time' >&2; \
866
	  exit 1; \
867
	fi
868
endif
869
## Sphinx provides little control over what content should be included. Some
870
## mechanisms exist, but they all have drawbacks or actual issues. Since we
871
## build two different versions of the documentation--once without man pages and
872
## once, if enabled, with them--some control is necessary. xmpp-wrapper provides
873
## us with this, but requires running in a temporary directory. It moves the
874
## correct files into place depending on environment variables.
875
	dir=$(dir $@) && \
876
	@mkdir_p@ $$dir && \
877
	PYTHONPATH=. ENABLE_MANPAGES=$(ENABLE_MANPAGES) COPY_DOC=1 \
878
	$(RUN_IN_TEMPDIR) autotools/sphinx-wrapper $(SPHINX) -q -W -b html \
879
	    -d . \
880
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
881
	    -D release="$(PACKAGE_VERSION)" \
882
	    -D graphviz_dot="$(DOT)" \
883
	    -D enable_manpages="$(ENABLE_MANPAGES)" \
884
	    doc $(CURDIR)/$$dir && \
885
	rm -f $$dir/.buildinfo $$dir/objects.inv
886
	touch $@
887

    
888
doc/html: doc/html/index.html
889

    
890
doc/man-html: doc/man-html/index.html
891

    
892
doc/install-quick.rst: INSTALL
893
doc/news.rst: NEWS
894
doc/upgrade.rst: UPGRADE
895

    
896
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
897
	set -e; \
898
	{ echo '.. This file is automatically updated at build time from $<.'; \
899
	  echo '.. Do not edit.'; \
900
	  echo; \
901
	  cat $<; \
902
	} > $@
903

    
904
doc/manpages-enabled.rst: Makefile | $(built_base_sources)
905
	{ echo '.. This file is automatically generated, do not edit!'; \
906
	  echo ''; \
907
	  echo 'Man pages'; \
908
	  echo '========='; \
909
	  echo; \
910
	  echo '.. toctree::'; \
911
	  echo '   :maxdepth: 1'; \
912
	  echo; \
913
	  for i in $(notdir $(mandocrst)); do \
914
	    echo "   $$i"; \
915
	  done | LC_ALL=C sort; \
916
	} > $@
917

    
918
doc/man-%.rst: man/%.gen Makefile $(REPLACE_VARS_SED) | $(built_base_sources)
919
if MANPAGES_IN_DOC
920
	{ echo '.. This file is automatically updated at build time from $<.'; \
921
	  echo '.. Do not edit.'; \
922
	  echo; \
923
	  echo "$*"; \
924
	  echo '=========================================='; \
925
	  tail -n +3 $< | sed -f $(REPLACE_VARS_SED); \
926
	} > $@
927
else
928
	echo 'Man pages in documentation were disabled at configure time' >&2; \
929
	exit 1;
930
endif
931

    
932
doc/users/%: doc/users/%.in Makefile $(REPLACE_VARS_SED)
933
	cat $< | sed -f $(REPLACE_VARS_SED) | LC_ALL=C sort | uniq | (grep -v '^root' || true) > $@
934

    
935
userspecs = \
936
	doc/users/users \
937
	doc/users/groups \
938
	doc/users/groupmemberships
939

    
940
# Things to build but not to install (add it to EXTRA_DIST if it should be
941
# distributed)
942
noinst_DATA = \
943
	$(BUILT_EXAMPLES) \
944
	doc/examples/bash_completion \
945
	doc/examples/bash_completion-debug \
946
	$(userspecs) \
947
	$(manhtml)
948

    
949
if HAS_SPHINX
950
if MANPAGES_IN_DOC
951
noinst_DATA += doc/man-html
952
else
953
noinst_DATA += doc/html
954
endif
955
endif
956

    
957
gnt_scripts = \
958
	scripts/gnt-backup \
959
	scripts/gnt-cluster \
960
	scripts/gnt-debug \
961
	scripts/gnt-group \
962
	scripts/gnt-instance \
963
	scripts/gnt-job \
964
	scripts/gnt-network \
965
	scripts/gnt-node \
966
	scripts/gnt-os \
967
	scripts/gnt-storage
968

    
969
gnt_scripts_basenames = \
970
	$(patsubst scripts/%,%,$(patsubst daemons/%,%,$(gnt_scripts) $(gnt_python_sbin_SCRIPTS)))
971

    
972
gnt_python_sbin_SCRIPTS = \
973
	$(PYTHON_BOOTSTRAP_SBIN)
974

    
975
gntpython_SCRIPTS = $(gnt_scripts)
976

    
977
PYTHON_BOOTSTRAP_SBIN = \
978
	daemons/ganeti-masterd \
979
	daemons/ganeti-noded \
980
	daemons/ganeti-rapi \
981
	daemons/ganeti-watcher
982

    
983
PYTHON_BOOTSTRAP = \
984
	tools/burnin \
985
	tools/ensure-dirs \
986
	tools/node-cleanup \
987
	tools/node-daemon-setup \
988
	tools/prepare-node-join
989

    
990
qa_scripts = \
991
	qa/__init__.py \
992
	qa/ganeti-qa.py \
993
	qa/qa_cluster.py \
994
	qa/qa_config.py \
995
	qa/qa_daemon.py \
996
	qa/qa_env.py \
997
	qa/qa_error.py \
998
	qa/qa_group.py \
999
	qa/qa_instance.py \
1000
	qa/qa_instance_utils.py \
1001
	qa/qa_job.py \
1002
	qa/qa_monitoring.py \
1003
	qa/qa_node.py \
1004
	qa/qa_os.py \
1005
	qa/qa_rapi.py \
1006
	qa/qa_tags.py \
1007
	qa/qa_utils.py \
1008
        qa/rapi-workload.py
1009

    
1010
bin_SCRIPTS = $(HS_BIN_PROGS)
1011
install-exec-hook:
1012
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
1013
# FIXME: this is a hardcoded logic, instead of auto-resolving
1014
	$(LN_S) -f ../../../bin/htools \
1015
	  $(DESTDIR)$(iallocatorsdir)/hail
1016
	for role in $(HS_BIN_ROLES); do \
1017
	  $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
1018
	done
1019

    
1020
HS_SRCS = $(HS_LIBTESTBUILT_SRCS)
1021

    
1022
HS_MAKEFILE_GHC_SRCS = $(HS_SRC_PROGS:%=%.hs)
1023
if WANT_HSTESTS
1024
HS_MAKEFILE_GHC_SRCS += $(HS_TEST_PROGS:%=%.hs)
1025
endif
1026
Makefile.ghc: $(HS_MAKEFILE_GHC_SRCS) Makefile \
1027
              | $(built_base_sources) $(HS_BUILT_SRCS)
1028
	$(GHC) -M -dep-makefile $@ -dep-suffix $(HTEST_SUFFIX) $(HFLAGS) -itest/hs \
1029
		$(HS_PARALLEL3) $(HS_REGEX_PCRE) $(HEXTRA) $(HS_MAKEFILE_GHC_SRCS)
1030

    
1031
@include_makefile_ghc@
1032

    
1033
%.o:
1034
	@echo '[GHC]: $@ <- $^'
1035
	@$(GHC) -c $(HFLAGS) \
1036
		$(HS_PARALLEL3) $(HS_REGEX_PCRE) $(HEXTRA) $(@:%.o=%.hs)
1037

    
1038
%.$(HTEST_SUFFIX)_o:
1039
	@echo '[GHC]: $@ <- $^'
1040
	@$(GHC) -c $(HTEST_FLAGS) \
1041
		$(HS_PARALLEL3) $(HS_REGEX_PCRE) $(HEXTRA) $(@:%.$(HTEST_SUFFIX)_o=%.hs)
1042

    
1043
%.hi: %.o ;
1044
%.$(HTEST_SUFFIX)_hi: %.$(HTEST_SUFFIX)_o ;
1045

    
1046
$(HS_SRC_PROGS): %: %.o | stamp-directories
1047
	$(GHC) $(HFLAGS) \
1048
		$(HS_PARALLEL3) $(HS_REGEX_PCRE) $(HEXTRA) --make $(@:%=%.hs)
1049
	@rm -f $(notdir $@).tix
1050
	@touch "$@"
1051

    
1052
$(HS_TEST_PROGS): %: %.$(HTEST_SUFFIX)_o \
1053
	                   | stamp-directories $(BUILT_PYTHON_SOURCES)
1054
	@if [ "$(HS_NODEV)" ]; then \
1055
	  echo "Error: cannot run unittests without the development" \
1056
	       " libraries (see devnotes.rst)" 1>&2; \
1057
	  exit 1; \
1058
	fi
1059
	$(GHC) $(HTEST_FLAGS) \
1060
		$(HS_PARALLEL3) $(HS_REGEX_PCRE) $(HEXTRA) --make $(@:%=%.hs)
1061
	@rm -f $(notdir $@).tix
1062
	@touch "$@"
1063

    
1064
dist_sbin_SCRIPTS = \
1065
	tools/ganeti-listrunner
1066

    
1067
nodist_sbin_SCRIPTS = \
1068
	daemons/ganeti-cleaner
1069

    
1070
# strip path prefixes off the sbin scripts
1071
all_sbin_scripts = \
1072
	$(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst scripts/%,%,\
1073
	$(patsubst src/%,%,$(dist_sbin_SCRIPTS) $(nodist_sbin_SCRIPTS)))))
1074

    
1075
if ENABLE_CONFD
1076
src/ganeti-confd: src/hconfd
1077
	cp -f $< $@
1078

    
1079
src/ganeti-luxid: src/hluxid
1080
	cp -f $< $@
1081

    
1082
nodist_sbin_SCRIPTS += src/ganeti-confd
1083
nodist_sbin_SCRIPTS += src/ganeti-luxid
1084
nodist_sbin_SCRIPTS += src/ganeti-kvmd
1085
endif
1086

    
1087
if ENABLE_MOND
1088
nodist_sbin_SCRIPTS += src/ganeti-mond
1089
endif
1090

    
1091
python_scripts = \
1092
	tools/cfgshell \
1093
	tools/cfgupgrade \
1094
	tools/cfgupgrade12 \
1095
	tools/cluster-merge \
1096
	tools/confd-client \
1097
	tools/fmtjson \
1098
	tools/lvmstrap \
1099
	tools/move-instance \
1100
	tools/ovfconverter \
1101
	tools/post-upgrade \
1102
	tools/sanitize-config
1103

    
1104
dist_tools_SCRIPTS = \
1105
	tools/kvm-console-wrapper \
1106
	tools/master-ip-setup \
1107
	tools/xen-console-wrapper
1108

    
1109
dist_tools_python_SCRIPTS = \
1110
	$(python_scripts) \
1111
	tools/burnin
1112

    
1113
nodist_tools_python_SCRIPTS = \
1114
	tools/node-cleanup
1115

    
1116
tools_python_basenames = $(patsubst tools/%,%,\
1117
	$(dist_tools_python_SCRIPTS) $(nodist_tools_python_SCRIPTS))
1118

    
1119
nodist_tools_SCRIPTS = \
1120
	tools/users-setup \
1121
	tools/vcluster-setup
1122

    
1123
tools_basenames = $(patsubst tools/%,%,$(nodist_tools_SCRIPTS) $(dist_tools_SCRIPTS))
1124

    
1125
pkglib_python_scripts = \
1126
	daemons/import-export \
1127
	tools/check-cert-expired
1128

    
1129
nodist_pkglib_python_scripts = \
1130
	tools/ensure-dirs \
1131
	tools/node-daemon-setup \
1132
	tools/prepare-node-join
1133

    
1134
pkglib_python_basenames = \
1135
	$(patsubst daemons/%,%,$(patsubst tools/%,%,\
1136
	$(pkglib_python_scripts) $(nodist_pkglib_python_scripts)))
1137

    
1138
myexeclib_SCRIPTS = \
1139
	daemons/daemon-util \
1140
	tools/kvm-ifup \
1141
	tools/vif-ganeti \
1142
	tools/net-common \
1143
	$(HS_MYEXECLIB_PROGS)
1144

    
1145
# compute the basenames of the myexeclib_scripts
1146
myexeclib_scripts_basenames = \
1147
	$(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst src/%,%,$(myexeclib_SCRIPTS))))
1148

    
1149
EXTRA_DIST = \
1150
	NEWS \
1151
	UPGRADE \
1152
	epydoc.conf.in \
1153
	pylintrc \
1154
	pylintrc-test \
1155
	autotools/build-bash-completion \
1156
	autotools/build-rpc \
1157
	autotools/check-header \
1158
	autotools/check-imports \
1159
	autotools/check-man-dashes \
1160
	autotools/check-man-references \
1161
	autotools/check-man-warnings \
1162
	autotools/check-news \
1163
	autotools/check-python-code \
1164
	autotools/check-tar \
1165
	autotools/check-version \
1166
	autotools/docpp \
1167
	autotools/gen-py-coverage \
1168
	autotools/print-py-constants \
1169
	autotools/sphinx-wrapper \
1170
	autotools/testrunner \
1171
	autotools/wrong-hardcoded-paths \
1172
	$(RUN_IN_TEMPDIR) \
1173
	daemons/daemon-util.in \
1174
	daemons/ganeti-cleaner.in \
1175
	$(pkglib_python_scripts) \
1176
	devel/upload \
1177
	devel/webserver \
1178
	tools/kvm-ifup.in \
1179
	tools/vif-ganeti.in \
1180
	tools/net-common.in \
1181
	tools/vcluster-setup.in \
1182
	$(docinput) \
1183
	doc/html \
1184
	$(BUILT_EXAMPLES:%=%.in) \
1185
	doc/examples/ganeti.default \
1186
	doc/examples/ganeti.default-debug \
1187
	doc/examples/hooks/ethers \
1188
	doc/examples/gnt-debug/README \
1189
	doc/examples/gnt-debug/delay0.json \
1190
	doc/examples/gnt-debug/delay50.json \
1191
	doc/users/groupmemberships.in \
1192
	doc/users/groups.in \
1193
	doc/users/users.in \
1194
	$(dist_TESTS) \
1195
	$(TEST_FILES) \
1196
	$(python_test_support) \
1197
	man/footer.rst \
1198
	$(manrst) \
1199
	$(maninput) \
1200
	qa/qa-sample.json \
1201
	$(qa_scripts) \
1202
	$(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS_IN) \
1203
	$(HS_PROG_SRCS) \
1204
	src/lint-hints.hs \
1205
	test/hs/cli-tests-defs.sh \
1206
	test/hs/offline-test.sh \
1207
	.ghci
1208

    
1209
man_MANS = \
1210
	man/ganeti-cleaner.8 \
1211
	man/ganeti-confd.8 \
1212
	man/ganeti-luxid.8 \
1213
	man/ganeti-listrunner.8 \
1214
	man/ganeti-kvmd.8 \
1215
	man/ganeti-masterd.8 \
1216
	man/ganeti-mond.8 \
1217
	man/ganeti-noded.8 \
1218
	man/ganeti-os-interface.7 \
1219
	man/ganeti-extstorage-interface.7 \
1220
	man/ganeti-rapi.8 \
1221
	man/ganeti-watcher.8 \
1222
	man/ganeti.7 \
1223
	man/gnt-backup.8 \
1224
	man/gnt-cluster.8 \
1225
	man/gnt-debug.8 \
1226
	man/gnt-group.8 \
1227
	man/gnt-network.8 \
1228
	man/gnt-instance.8 \
1229
	man/gnt-job.8 \
1230
	man/gnt-node.8 \
1231
	man/gnt-os.8 \
1232
	man/gnt-storage.8 \
1233
	man/hail.1 \
1234
	man/harep.1 \
1235
	man/hbal.1 \
1236
	man/hcheck.1 \
1237
	man/hinfo.1 \
1238
	man/hscan.1 \
1239
	man/hspace.1 \
1240
	man/hsqueeze.1 \
1241
	man/hroller.1 \
1242
	man/htools.1 \
1243
	man/mon-collector.7
1244

    
1245
# Remove extensions from all filenames in man_MANS
1246
mannoext = $(patsubst %.1,%,$(patsubst %.7,%,$(patsubst %.8,%,$(man_MANS))))
1247

    
1248
manrst = $(patsubst %,%.rst,$(mannoext))
1249
manhtml = $(patsubst %.rst,%.html,$(manrst))
1250
mangen = $(patsubst %.rst,%.gen,$(manrst))
1251
maninput = \
1252
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
1253
	$(patsubst %.html,%.html.in,$(manhtml)) \
1254
	$(mangen)
1255

    
1256
manfullpath = $(patsubst man/%.1,man1/%.1,\
1257
	$(patsubst man/%.7,man7/%.7,\
1258
	$(patsubst man/%.8,man8/%.8,$(man_MANS))))
1259

    
1260
TEST_FILES = \
1261
	test/autotools/autotools-check-news.test \
1262
	test/data/htools/clean-nonzero-score.data \
1263
	test/data/htools/common-suffix.data \
1264
	test/data/htools/empty-cluster.data \
1265
	test/data/htools/hail-alloc-drbd.json \
1266
	test/data/htools/hail-alloc-invalid-network.json \
1267
	test/data/htools/hail-alloc-invalid-twodisks.json \
1268
	test/data/htools/hail-alloc-restricted-network.json \
1269
	test/data/htools/hail-alloc-spindles.json \
1270
	test/data/htools/hail-alloc-twodisks.json \
1271
	test/data/htools/hail-change-group.json \
1272
	test/data/htools/hail-invalid-reloc.json \
1273
	test/data/htools/hail-node-evac.json \
1274
	test/data/htools/hail-reloc-drbd.json \
1275
	test/data/htools/hbal-dyn.data \
1276
	test/data/htools/hbal-excl-tags.data \
1277
	test/data/htools/hbal-split-insts.data \
1278
	test/data/htools/hspace-tiered-dualspec-exclusive.data \
1279
	test/data/htools/hspace-tiered-dualspec.data \
1280
	test/data/htools/hspace-tiered-exclusive.data \
1281
	test/data/htools/hspace-tiered-ipolicy.data \
1282
	test/data/htools/hspace-tiered-mixed.data \
1283
	test/data/htools/hspace-tiered-resourcetypes.data \
1284
	test/data/htools/hspace-tiered-vcpu.data \
1285
	test/data/htools/hspace-tiered.data \
1286
	test/data/htools/invalid-node.data \
1287
	test/data/htools/missing-resources.data \
1288
	test/data/htools/multiple-master.data \
1289
	test/data/htools/multiple-tags.data \
1290
	test/data/htools/n1-failure.data \
1291
	test/data/htools/rapi/groups.json \
1292
	test/data/htools/rapi/info.json \
1293
	test/data/htools/rapi/instances.json \
1294
	test/data/htools/rapi/nodes.json \
1295
	test/data/htools/hroller-full.data \
1296
	test/data/htools/hroller-nodegroups.data \
1297
	test/data/htools/hroller-nonredundant.data \
1298
	test/data/htools/hroller-online.data \
1299
	test/data/htools/hsqueeze-mixed-instances.data \
1300
	test/data/htools/hsqueeze-overutilized.data \
1301
	test/data/htools/hsqueeze-underutilized.data \
1302
	test/data/htools/unique-reboot-order.data \
1303
	test/hs/shelltests/htools-balancing.test \
1304
	test/hs/shelltests/htools-basic.test \
1305
	test/hs/shelltests/htools-dynutil.test \
1306
	test/hs/shelltests/htools-excl.test \
1307
	test/hs/shelltests/htools-hail.test \
1308
	test/hs/shelltests/htools-hroller.test \
1309
	test/hs/shelltests/htools-hspace.test \
1310
	test/hs/shelltests/htools-hsqueeze.test \
1311
	test/hs/shelltests/htools-invalid.test \
1312
	test/hs/shelltests/htools-multi-group.test \
1313
	test/hs/shelltests/htools-no-backend.test \
1314
	test/hs/shelltests/htools-rapi.test \
1315
	test/hs/shelltests/htools-single-group.test \
1316
	test/hs/shelltests/htools-text-backend.test \
1317
	test/hs/shelltests/htools-mon-collector.test \
1318
	test/data/bdev-drbd-8.0.txt \
1319
	test/data/bdev-drbd-8.3.txt \
1320
	test/data/bdev-drbd-8.4.txt \
1321
	test/data/bdev-drbd-8.4-no-disk-params.txt \
1322
	test/data/bdev-drbd-disk.txt \
1323
	test/data/bdev-drbd-net-ip4.txt \
1324
	test/data/bdev-drbd-net-ip6.txt \
1325
	test/data/bdev-rbd/json_output_empty.txt \
1326
	test/data/bdev-rbd/json_output_extra_matches.txt \
1327
	test/data/bdev-rbd/json_output_no_matches.txt \
1328
	test/data/bdev-rbd/json_output_ok.txt \
1329
	test/data/bdev-rbd/plain_output_new_extra_matches.txt \
1330
	test/data/bdev-rbd/plain_output_new_no_matches.txt \
1331
	test/data/bdev-rbd/plain_output_new_ok.txt \
1332
	test/data/bdev-rbd/plain_output_old_empty.txt \
1333
	test/data/bdev-rbd/plain_output_old_extra_matches.txt \
1334
	test/data/bdev-rbd/plain_output_old_no_matches.txt \
1335
	test/data/bdev-rbd/plain_output_old_ok.txt \
1336
	test/data/bdev-rbd/output_invalid.txt \
1337
	test/data/cert1.pem \
1338
	test/data/cert2.pem \
1339
	test/data/cluster_config_2.7.json \
1340
	test/data/cluster_config_2.8.json \
1341
	test/data/cluster_config_2.9.json \
1342
	test/data/cluster_config_2.10.json \
1343
	test/data/instance-minor-pairing.txt \
1344
	test/data/instance-prim-sec.txt \
1345
	test/data/ip-addr-show-dummy0.txt \
1346
	test/data/ip-addr-show-lo-ipv4.txt \
1347
	test/data/ip-addr-show-lo-ipv6.txt \
1348
	test/data/ip-addr-show-lo-oneline-ipv4.txt \
1349
	test/data/ip-addr-show-lo-oneline-ipv6.txt \
1350
	test/data/ip-addr-show-lo-oneline.txt \
1351
	test/data/ip-addr-show-lo.txt \
1352
	test/data/kvm_0.12.5_help.txt \
1353
	test/data/kvm_0.15.90_help.txt \
1354
	test/data/kvm_0.9.1_help.txt \
1355
	test/data/kvm_0.9.1_help_boot_test.txt \
1356
	test/data/kvm_1.0_help.txt \
1357
	test/data/kvm_1.1.2_help.txt \
1358
	test/data/kvm_runtime.json \
1359
	test/data/lvs_lv.txt \
1360
	test/data/NEWS_OK.txt \
1361
	test/data/NEWS_previous_unreleased.txt \
1362
	test/data/ovfdata/compr_disk.vmdk.gz \
1363
	test/data/ovfdata/config.ini \
1364
	test/data/ovfdata/corrupted_resources.ovf \
1365
	test/data/ovfdata/empty.ini \
1366
	test/data/ovfdata/empty.ovf \
1367
	test/data/ovfdata/ganeti.mf \
1368
	test/data/ovfdata/ganeti.ovf \
1369
	test/data/ovfdata/gzip_disk.ovf \
1370
	test/data/ovfdata/new_disk.vmdk \
1371
	test/data/ovfdata/no_disk.ini \
1372
	test/data/ovfdata/no_disk_in_ref.ovf \
1373
	test/data/ovfdata/no_os.ini \
1374
	test/data/ovfdata/no_ovf.ova \
1375
	test/data/ovfdata/other/rawdisk.raw \
1376
	test/data/ovfdata/ova.ova \
1377
	test/data/ovfdata/rawdisk.raw \
1378
	test/data/ovfdata/second_disk.vmdk \
1379
	test/data/ovfdata/unsafe_path.ini \
1380
	test/data/ovfdata/virtualbox.ovf \
1381
	test/data/ovfdata/wrong_config.ini \
1382
	test/data/ovfdata/wrong_extension.ovd \
1383
	test/data/ovfdata/wrong_manifest.mf \
1384
	test/data/ovfdata/wrong_manifest.ovf \
1385
	test/data/ovfdata/wrong_ova.ova \
1386
	test/data/ovfdata/wrong_xml.ovf \
1387
	test/data/proc_diskstats.txt \
1388
	test/data/proc_drbd8.txt \
1389
	test/data/proc_drbd80-emptyline.txt \
1390
	test/data/proc_drbd80-emptyversion.txt \
1391
	test/data/proc_drbd83.txt \
1392
	test/data/proc_drbd83_sync.txt \
1393
	test/data/proc_drbd83_sync_want.txt \
1394
	test/data/proc_drbd83_sync_krnl2.6.39.txt \
1395
	test/data/proc_drbd84.txt \
1396
	test/data/proc_drbd84_sync.txt \
1397
	test/data/proc_meminfo.txt \
1398
	test/data/proc_cpuinfo.txt \
1399
	test/data/qa-minimal-nodes-instances-only.json \
1400
	test/data/sys_drbd_usermode_helper.txt \
1401
	test/data/vgreduce-removemissing-2.02.02.txt \
1402
	test/data/vgreduce-removemissing-2.02.66-fail.txt \
1403
	test/data/vgreduce-removemissing-2.02.66-ok.txt \
1404
	test/data/vgs-missing-pvs-2.02.02.txt \
1405
	test/data/vgs-missing-pvs-2.02.66.txt \
1406
	test/data/xen-xm-info-4.0.1.txt \
1407
	test/data/xen-xm-list-4.0.1-dom0-only.txt \
1408
	test/data/xen-xm-list-4.0.1-four-instances.txt \
1409
	test/data/xen-xm-list-long-4.0.1.txt \
1410
	test/data/xen-xm-uptime-4.0.1.txt \
1411
	test/py/ganeti-cli.test \
1412
	test/py/gnt-cli.test \
1413
	test/py/import-export_unittest-helper
1414

    
1415

    
1416
python_tests = \
1417
	doc/examples/rapi_testutils.py \
1418
	test/py/cmdlib/backup_unittest.py \
1419
	test/py/cmdlib/cluster_unittest.py \
1420
	test/py/cmdlib/cmdlib_unittest.py \
1421
	test/py/cmdlib/group_unittest.py \
1422
	test/py/cmdlib/instance_unittest.py \
1423
	test/py/cmdlib/instance_migration_unittest.py \
1424
	test/py/cmdlib/instance_query_unittest.py \
1425
	test/py/cmdlib/instance_storage_unittest.py \
1426
	test/py/cmdlib/node_unittest.py \
1427
	test/py/cmdlib/test_unittest.py \
1428
	test/py/cfgupgrade_unittest.py \
1429
	test/py/docs_unittest.py \
1430
	test/py/ganeti.asyncnotifier_unittest.py \
1431
	test/py/ganeti.backend_unittest-runasroot.py \
1432
	test/py/ganeti.backend_unittest.py \
1433
	test/py/ganeti.bootstrap_unittest.py \
1434
	test/py/ganeti.cli_unittest.py \
1435
	test/py/ganeti.client.gnt_cluster_unittest.py \
1436
	test/py/ganeti.client.gnt_instance_unittest.py \
1437
	test/py/ganeti.client.gnt_job_unittest.py \
1438
	test/py/ganeti.compat_unittest.py \
1439
	test/py/ganeti.confd.client_unittest.py \
1440
	test/py/ganeti.config_unittest.py \
1441
	test/py/ganeti.constants_unittest.py \
1442
	test/py/ganeti.daemon_unittest.py \
1443
	test/py/ganeti.errors_unittest.py \
1444
	test/py/ganeti.hooks_unittest.py \
1445
	test/py/ganeti.ht_unittest.py \
1446
	test/py/ganeti.http_unittest.py \
1447
	test/py/ganeti.hypervisor.hv_chroot_unittest.py \
1448
	test/py/ganeti.hypervisor.hv_fake_unittest.py \
1449
	test/py/ganeti.hypervisor.hv_kvm_unittest.py \
1450
	test/py/ganeti.hypervisor.hv_lxc_unittest.py \
1451
	test/py/ganeti.hypervisor.hv_xen_unittest.py \
1452
	test/py/ganeti.hypervisor_unittest.py \
1453
	test/py/ganeti.impexpd_unittest.py \
1454
	test/py/ganeti.jqueue_unittest.py \
1455
	test/py/ganeti.jstore_unittest.py \
1456
	test/py/ganeti.locking_unittest.py \
1457
	test/py/ganeti.luxi_unittest.py \
1458
	test/py/ganeti.masterd.iallocator_unittest.py \
1459
	test/py/ganeti.masterd.instance_unittest.py \
1460
	test/py/ganeti.mcpu_unittest.py \
1461
	test/py/ganeti.netutils_unittest.py \
1462
	test/py/ganeti.objects_unittest.py \
1463
	test/py/ganeti.opcodes_unittest.py \
1464
	test/py/ganeti.outils_unittest.py \
1465
	test/py/ganeti.ovf_unittest.py \
1466
	test/py/ganeti.qlang_unittest.py \
1467
	test/py/ganeti.query_unittest.py \
1468
	test/py/ganeti.rapi.baserlib_unittest.py \
1469
	test/py/ganeti.rapi.client_unittest.py \
1470
	test/py/ganeti.rapi.resources_unittest.py \
1471
	test/py/ganeti.rapi.rlib2_unittest.py \
1472
	test/py/ganeti.rapi.testutils_unittest.py \
1473
	test/py/ganeti.rpc_unittest.py \
1474
	test/py/ganeti.rpc.client_unittest.py \
1475
	test/py/ganeti.runtime_unittest.py \
1476
	test/py/ganeti.serializer_unittest.py \
1477
	test/py/ganeti.server.rapi_unittest.py \
1478
	test/py/ganeti.ssconf_unittest.py \
1479
	test/py/ganeti.ssh_unittest.py \
1480
	test/py/ganeti.storage.bdev_unittest.py \
1481
	test/py/ganeti.storage.container_unittest.py \
1482
	test/py/ganeti.storage.drbd_unittest.py \
1483
	test/py/ganeti.storage.filestorage_unittest.py \
1484
	test/py/ganeti.storage.gluster_unittest.py \
1485
	test/py/ganeti.tools.burnin_unittest.py \
1486
	test/py/ganeti.tools.ensure_dirs_unittest.py \
1487
	test/py/ganeti.tools.node_daemon_setup_unittest.py \
1488
	test/py/ganeti.tools.prepare_node_join_unittest.py \
1489
	test/py/ganeti.uidpool_unittest.py \
1490
	test/py/ganeti.utils.algo_unittest.py \
1491
	test/py/ganeti.utils.filelock_unittest.py \
1492
	test/py/ganeti.utils.hash_unittest.py \
1493
	test/py/ganeti.utils.io_unittest-runasroot.py \
1494
	test/py/ganeti.utils.io_unittest.py \
1495
	test/py/ganeti.utils.log_unittest.py \
1496
	test/py/ganeti.utils.lvm_unittest.py \
1497
	test/py/ganeti.utils.mlock_unittest.py \
1498
	test/py/ganeti.utils.nodesetup_unittest.py \
1499
	test/py/ganeti.utils.process_unittest.py \
1500
	test/py/ganeti.utils.retry_unittest.py \
1501
	test/py/ganeti.utils.security_unittest.py \
1502
	test/py/ganeti.utils.storage_unittest.py \
1503
	test/py/ganeti.utils.text_unittest.py \
1504
	test/py/ganeti.utils.version_unittest.py \
1505
	test/py/ganeti.utils.wrapper_unittest.py \
1506
	test/py/ganeti.utils.x509_unittest.py \
1507
	test/py/ganeti.utils_unittest.py \
1508
	test/py/ganeti.vcluster_unittest.py \
1509
	test/py/ganeti.workerpool_unittest.py \
1510
	test/py/pycurl_reset_unittest.py \
1511
	test/py/qa.qa_config_unittest.py \
1512
	test/py/tempfile_fork_unittest.py
1513

    
1514
python_test_support = \
1515
	test/py/__init__.py \
1516
	test/py/lockperf.py \
1517
	test/py/testutils.py \
1518
	test/py/mocks.py \
1519
	test/py/cmdlib/__init__.py \
1520
	test/py/cmdlib/testsupport/__init__.py \
1521
	test/py/cmdlib/testsupport/cmdlib_testcase.py \
1522
	test/py/cmdlib/testsupport/config_mock.py \
1523
	test/py/cmdlib/testsupport/iallocator_mock.py \
1524
	test/py/cmdlib/testsupport/lock_manager_mock.py \
1525
	test/py/cmdlib/testsupport/netutils_mock.py \
1526
	test/py/cmdlib/testsupport/processor_mock.py \
1527
	test/py/cmdlib/testsupport/rpc_runner_mock.py \
1528
	test/py/cmdlib/testsupport/ssh_mock.py \
1529
	test/py/cmdlib/testsupport/utils_mock.py \
1530
	test/py/cmdlib/testsupport/util.py
1531

    
1532
haskell_tests = test/hs/htest
1533

    
1534
dist_TESTS = \
1535
	test/py/check-cert-expired_unittest.bash \
1536
	test/py/daemon-util_unittest.bash \
1537
	test/py/ganeti-cleaner_unittest.bash \
1538
	test/py/import-export_unittest.bash \
1539
	test/py/cli-test.bash \
1540
	test/py/bash_completion.bash
1541

    
1542
if PY_UNIT
1543
dist_TESTS += $(python_tests)
1544
endif
1545

    
1546
nodist_TESTS =
1547
check_SCRIPTS =
1548

    
1549
if WANT_HSTESTS
1550
nodist_TESTS += $(haskell_tests)
1551
# test dependency
1552
test/hs/offline-test.sh: test/hs/hpc-htools test/hs/hpc-mon-collector
1553
dist_TESTS += test/hs/offline-test.sh
1554
check_SCRIPTS += \
1555
	test/hs/hpc-htools \
1556
	test/hs/hpc-mon-collector \
1557
	$(HS_BUILT_TEST_HELPERS)
1558
endif
1559

    
1560
TESTS = $(dist_TESTS) $(nodist_TESTS)
1561

    
1562
# Environment for all tests
1563
PLAIN_TESTS_ENVIRONMENT = \
1564
	PYTHONPATH=.:./test/py \
1565
	TOP_SRCDIR=$(abs_top_srcdir) TOP_BUILDDIR=$(abs_top_builddir) \
1566
	PYTHON=$(PYTHON) FAKEROOT=$(FAKEROOT_PATH) \
1567
	$(RUN_IN_TEMPDIR)
1568

    
1569
# Environment for tests run by automake
1570
TESTS_ENVIRONMENT = \
1571
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
1572

    
1573
all_python_code = \
1574
	$(dist_sbin_SCRIPTS) \
1575
	$(python_scripts) \
1576
	$(pkglib_python_scripts) \
1577
	$(nodist_pkglib_python_scripts) \
1578
	$(nodist_tools_python_scripts) \
1579
	$(pkgpython_PYTHON) \
1580
	$(client_PYTHON) \
1581
	$(cmdlib_PYTHON) \
1582
	$(hypervisor_PYTHON) \
1583
	$(storage_PYTHON) \
1584
	$(rapi_PYTHON) \
1585
	$(server_PYTHON) \
1586
	$(rpc_PYTHON) \
1587
	$(pytools_PYTHON) \
1588
	$(http_PYTHON) \
1589
	$(confd_PYTHON) \
1590
	$(masterd_PYTHON) \
1591
	$(impexpd_PYTHON) \
1592
	$(utils_PYTHON) \
1593
	$(watcher_PYTHON) \
1594
	$(noinst_PYTHON) \
1595
	$(qa_scripts)
1596

    
1597
if PY_UNIT
1598
all_python_code += $(python_tests)
1599
all_python_code += $(python_test_support)
1600
endif
1601

    
1602
srclink_files = \
1603
	man/footer.rst \
1604
	test/py/check-cert-expired_unittest.bash \
1605
	test/py/daemon-util_unittest.bash \
1606
	test/py/ganeti-cleaner_unittest.bash \
1607
	test/py/import-export_unittest.bash \
1608
	test/py/cli-test.bash \
1609
	test/py/bash_completion.bash \
1610
	test/hs/offline-test.sh \
1611
	test/hs/cli-tests-defs.sh \
1612
	$(all_python_code) \
1613
	$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS) \
1614
	$(docinput)
1615

    
1616
check_python_code = \
1617
	$(BUILD_BASH_COMPLETION) \
1618
	$(CHECK_IMPORTS) \
1619
	$(CHECK_HEADER) \
1620
	$(DOCPP) \
1621
	$(all_python_code)
1622

    
1623
lint_python_code = \
1624
	ganeti \
1625
	ganeti/http/server.py \
1626
	$(dist_sbin_SCRIPTS) \
1627
	$(python_scripts) \
1628
	$(pkglib_python_scripts) \
1629
	$(BUILD_BASH_COMPLETION) \
1630
	$(CHECK_IMPORTS) \
1631
	$(CHECK_HEADER) \
1632
	$(DOCPP) \
1633
	$(gnt_python_sbin_SCRIPTS) \
1634
	$(PYTHON_BOOTSTRAP)
1635

    
1636
standalone_python_modules = \
1637
	lib/rapi/client.py \
1638
	tools/ganeti-listrunner
1639

    
1640
pep8_python_code = \
1641
	ganeti \
1642
	ganeti/http/server.py \
1643
	$(dist_sbin_SCRIPTS) \
1644
	$(python_scripts) \
1645
	$(pkglib_python_scripts) \
1646
	$(BUILD_BASH_COMPLETION) \
1647
	$(CHECK_HEADER) \
1648
	$(DOCPP) \
1649
	$(PYTHON_BOOTSTRAP) \
1650
	$(gnt_python_sbin_SCRIPTS) \
1651
	qa \
1652
	$(python_test_support)
1653

    
1654
test/py/daemon-util_unittest.bash: daemons/daemon-util
1655

    
1656
test/py/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
1657

    
1658
test/py/bash_completion.bash: doc/examples/bash_completion-debug
1659

    
1660
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
1661
	sed -f $(REPLACE_VARS_SED) < $< > $@
1662
	chmod +x $@
1663

    
1664
tools/vif-ganeti: tools/vif-ganeti.in $(REPLACE_VARS_SED)
1665
	sed -f $(REPLACE_VARS_SED) < $< > $@
1666
	chmod +x $@
1667

    
1668
tools/net-common: tools/net-common.in $(REPLACE_VARS_SED)
1669
	sed -f $(REPLACE_VARS_SED) < $< > $@
1670
	chmod +x $@
1671

    
1672
tools/users-setup: Makefile $(userspecs)
1673
	set -e; \
1674
	{ echo '#!/bin/sh'; \
1675
	  echo 'if [ "x$$1" != "x--yes-do-it" ];'; \
1676
	  echo 'then echo "This will do the following changes"'; \
1677
	  $(AWK) -- '{print "echo + Will add group ",$$1; count++}\
1678
	             END {if (count == 0) {print "echo + No groups to add"}}' doc/users/groups; \
1679
	  $(AWK) -- '{if (NF > 1) {print "echo + Will add user",$$1,"with primary group",$$2} \
1680
	                          else {print "echo + Will add user",$$1}; count++}\
1681
	             END {if (count == 0) {print "echo + No users to add"}}' doc/users/users; \
1682
	  $(AWK) -- '{print "echo + Will add user",$$1,"to group",$$2}' doc/users/groupmemberships; \
1683
	  echo 'echo'; \
1684
	  echo 'echo "OK? (y/n)"'; \
1685
	  echo 'read confirm'; \
1686
	  echo 'if [ "x$$confirm" != "xy" ]; then exit 0; fi'; \
1687
	  echo 'fi'; \
1688
	  $(AWK) -- '{print "addgroup --system",$$1}' doc/users/groups; \
1689
	  $(AWK) -- '{if (NF > 1) {print "adduser --system --ingroup",$$2,$$1} else {print "adduser --system",$$1}}' doc/users/users; \
1690
	  $(AWK) -- '{print "adduser",$$1,$$2}' doc/users/groupmemberships; \
1691
	} > $@
1692
	chmod +x $@
1693

    
1694
tools/vcluster-setup: tools/vcluster-setup.in $(REPLACE_VARS_SED)
1695
	sed -f $(REPLACE_VARS_SED) < $< > $@
1696
	chmod +x $@
1697

    
1698
daemons/%:: daemons/%.in $(REPLACE_VARS_SED)
1699
	sed -f $(REPLACE_VARS_SED) < $< > $@
1700
	chmod +x $@
1701

    
1702
doc/examples/%:: doc/examples/%.in $(REPLACE_VARS_SED)
1703
	sed -f $(REPLACE_VARS_SED) < $< > $@
1704

    
1705
doc/examples/bash_completion: BC_ARGS = --compact
1706
doc/examples/bash_completion-debug: BC_ARGS =
1707

    
1708
doc/examples/bash_completion doc/examples/bash_completion-debug: \
1709
	$(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
1710
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin \
1711
	daemons/ganeti-cleaner \
1712
	$(GENERATED_FILES) $(HS_GENERATED_FILES)
1713
	PYTHONPATH=. $(RUN_IN_TEMPDIR) \
1714
	  $(CURDIR)/$(BUILD_BASH_COMPLETION) $(BC_ARGS) > $@
1715

    
1716
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py \
1717
	lib/build/shell_example_lexer.py \
1718
	| $(RUN_IN_TEMPDIR) $(BUILT_PYTHON_SOURCES)
1719
	@echo "Checking $< for hardcoded paths..."
1720
	@if grep -nEf autotools/wrong-hardcoded-paths $<; then \
1721
	  echo "Man page $< has hardcoded paths (see above)!" 1>&2 ; \
1722
	  exit 1; \
1723
	fi
1724
	set -e ; \
1725
	trap 'echo auto-removing $@; rm $@' EXIT; \
1726
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@ ;\
1727
	$(CHECK_MAN_REFERENCES) $@; \
1728
	trap - EXIT
1729

    
1730
man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.rst
1731
	@test -n "$(PANDOC)" || \
1732
	  { echo 'pandoc' not found during configure; exit 1; }
1733
	set -o pipefail -e; \
1734
	trap 'echo auto-removing $@; rm $@' EXIT; \
1735
	$(PANDOC) -s -f rst -t man $< man/footer.rst | \
1736
	  sed -e 's/\\@/@/g' > $@; \
1737
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN_WARNINGS) $@; fi; \
1738
	$(CHECK_MAN_DASHES) $@; \
1739
	trap - EXIT
1740

    
1741
man/%.html.in: man/%.gen man/footer.rst
1742
	@test -n "$(PANDOC)" || \
1743
	  { echo 'pandoc' not found during configure; exit 1; }
1744
	set -o pipefail ; \
1745
	$(PANDOC) --toc -s -f rst -t html $< man/footer.rst | \
1746
	  sed -e 's/\\@/@/g' > $@
1747

    
1748
man/%: man/%.in  $(REPLACE_VARS_SED)
1749
	sed -f $(REPLACE_VARS_SED) < $< > $@
1750

    
1751
epydoc.conf: epydoc.conf.in $(REPLACE_VARS_SED)
1752
	sed -f $(REPLACE_VARS_SED) < $< > $@
1753

    
1754
vcs-version:
1755
	if test -d .git; then \
1756
	  git describe > $@; \
1757
	elif test ! -f $@ ; then \
1758
	  echo "Cannot auto-generate $@ file"; exit 1; \
1759
	fi
1760

    
1761
.PHONY: clean-vcs-version
1762
clean-vcs-version:
1763
	rm -f vcs-version
1764

    
1765
.PHONY: regen-vcs-version
1766
regen-vcs-version:
1767
	@set -e; \
1768
	cd $(srcdir); \
1769
	if test -d .git; then \
1770
	  T=`mktemp` ; trap 'rm -f $$T' EXIT; \
1771
	  git describe > $$T; \
1772
	  if ! cmp --quiet $$T vcs-version; then \
1773
	    mv $$T vcs-version; \
1774
	  fi; \
1775
	fi
1776

    
1777
src/Ganeti/Version.hs: src/Ganeti/Version.hs.in \
1778
	vcs-version $(built_base_sources)
1779
	set -e; \
1780
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
1781
	sed -e "s/%ver%/$$VCSVER/" < $< > $@
1782

    
1783
src/Ganeti/Hs2Py/ListConstants.hs: src/Ganeti/Hs2Py/ListConstants.hs.in \
1784
				   src/Ganeti/Constants.hs \
1785
			         | stamp-directories
1786
	@echo Generating $@
1787
	@set -e; \
1788
## Extract constant names from 'Constants.hs' by extracting the left
1789
## side of all lines containing an equal sign (i.e., '=') and
1790
## prepending the apostrophe sign (i.e., "'").
1791
##
1792
## For example, the constant
1793
##   adminstDown = ...
1794
## becomes
1795
##   'adminstDown
1796
	NAMES=$$(sed -e "/^--/ d" $(abs_top_srcdir)/src/Ganeti/Constants.hs |\
1797
		 sed -n -e "/=/ s/\(.*\) =.*/    '\1:/g p"); \
1798
	m4 -DPY_CONSTANT_NAMES="$$NAMES" \
1799
		$(abs_top_srcdir)/src/Ganeti/Hs2Py/ListConstants.hs.in > $@
1800

    
1801
src/Ganeti/Curl/Internal.hs: src/Ganeti/Curl/Internal.hsc | stamp-directories
1802
	hsc2hs -o $@ $<
1803

    
1804
test/hs/Test/Ganeti/TestImports.hs: test/hs/Test/Ganeti/TestImports.hs.in \
1805
	$(built_base_sources)
1806
	set -e; \
1807
	{ cat $< ; \
1808
	  echo ; \
1809
	  for name in $(filter-out Ganeti.THH,$(subst /,.,$(patsubst %.hs,%,$(patsubst src/%,%,$(HS_LIB_SRCS))))) ; do \
1810
	    echo "import $$name ()" ; \
1811
	  done ; \
1812
	} > $@
1813

    
1814
lib/_constants.py: Makefile src/hs2py lib/_constants.py.in | stamp-directories
1815
	cat $(abs_top_srcdir)/lib/_constants.py.in > $@
1816
	src/hs2py --constants >> $@
1817

    
1818
lib/constants.py: lib/_constants.py
1819

    
1820
src/AutoConf.hs: Makefile src/AutoConf.hs.in $(PRINT_PY_CONSTANTS) \
1821
	       | $(built_base_sources)
1822
	@echo "m4 ... >" $@
1823
	@m4 -DPACKAGE_VERSION="$(PACKAGE_VERSION)" \
1824
	    -DVERSION_MAJOR="$(VERSION_MAJOR)" \
1825
	    -DVERSION_MINOR="$(VERSION_MINOR)" \
1826
	    -DVERSION_REVISION="$(VERSION_REVISION)" \
1827
	    -DVERSION_SUFFIX="$(VERSION_SUFFIX)" \
1828
	    -DVERSION_FULL="$(VERSION_FULL)" \
1829
	    -DDIRVERSION="$(DIRVERSION)" \
1830
	    -DLOCALSTATEDIR="$(localstatedir)" \
1831
	    -DSYSCONFDIR="$(sysconfdir)" \
1832
	    -DSSH_CONFIG_DIR="$(SSH_CONFIG_DIR)" \
1833
	    -DSSH_LOGIN_USER="$(SSH_LOGIN_USER)" \
1834
	    -DSSH_CONSOLE_USER="$(SSH_CONSOLE_USER)" \
1835
	    -DEXPORT_DIR="$(EXPORT_DIR)" \
1836
	    -DOS_SEARCH_PATH="\"$(OS_SEARCH_PATH)\"" \
1837
	    -DES_SEARCH_PATH="\"$(ES_SEARCH_PATH)\"" \
1838
	    -DXEN_BOOTLOADER="$(XEN_BOOTLOADER)" \
1839
	    -DXEN_CONFIG_DIR="$(XEN_CONFIG_DIR)" \
1840
	    -DXEN_KERNEL="$(XEN_KERNEL)" \
1841
	    -DXEN_INITRD="$(XEN_INITRD)" \
1842
	    -DKVM_KERNEL="$(KVM_KERNEL)" \
1843
	    -DSHARED_FILE_STORAGE_DIR="$(SHARED_FILE_STORAGE_DIR)" \
1844
	    -DIALLOCATOR_SEARCH_PATH="\"$(IALLOCATOR_SEARCH_PATH)\"" \
1845
	    -DKVM_PATH="$(KVM_PATH)" \
1846
	    -DIP_PATH="$(IP_PATH)" \
1847
	    -DSOCAT_PATH="$(SOCAT)" \
1848
	    -DSOCAT_USE_ESCAPE="$(SOCAT_USE_ESCAPE)" \
1849
	    -DSOCAT_USE_COMPRESS="$(SOCAT_USE_COMPRESS)" \
1850
	    -DLVM_STRIPECOUNT="$(LVM_STRIPECOUNT)" \
1851
	    -DTOOLSDIR="$(libdir)/ganeti/tools" \
1852
	    -DGNT_SCRIPTS="$(foreach i,$(notdir $(gnt_scripts)),\"$(i)\":)" \
1853
	    -DHS_HTOOLS_PROGS="$(foreach i,$(HS_HTOOLS_PROGS),\"$(i)\":)" \
1854
	    -DPKGLIBDIR="$(libdir)/ganeti" \
1855
	    -DSHAREDIR="$(prefix)/share/ganeti" \
1856
	    -DVERSIONEDSHAREDIR="$(versionedsharedir)" \
1857
	    -DDRBD_BARRIERS="$(DRBD_BARRIERS)" \
1858
	    -DDRBD_NO_META_FLUSH="$(DRBD_NO_META_FLUSH)" \
1859
	    -DSYSLOG_USAGE="$(SYSLOG_USAGE)" \
1860
	    -DDAEMONS_GROUP="$(DAEMONS_GROUP)" \
1861
	    -DADMIN_GROUP="$(ADMIN_GROUP)" \
1862
	    -DMASTERD_USER="$(MASTERD_USER)" \
1863
	    -DMASTERD_GROUP="$(MASTERD_GROUP)" \
1864
	    -DRAPI_USER="$(RAPI_USER)" \
1865
	    -DRAPI_GROUP="$(RAPI_GROUP)" \
1866
	    -DCONFD_USER="$(CONFD_USER)" \
1867
	    -DCONFD_GROUP="$(CONFD_GROUP)" \
1868
	    -DKVMD_USER="$(KVMD_USER)" \
1869
	    -DKVMD_GROUP="$(KVMD_GROUP)" \
1870
	    -DLUXID_USER="$(LUXID_USER)" \
1871
	    -DLUXID_GROUP="$(LUXID_GROUP)" \
1872
	    -DNODED_USER="$(NODED_USER)" \
1873
	    -DNODED_GROUP="$(NODED_GROUP)" \
1874
	    -DMOND_USER="$(MOND_USER)" \
1875
	    -DMOND_GROUP="$(MOND_GROUP)" \
1876
	    -DDISK_SEPARATOR="$(DISK_SEPARATOR)" \
1877
	    -DQEMUIMG_PATH="$(QEMUIMG_PATH)" \
1878
	    -DENABLE_CONFD="$(ENABLE_CONFD)" \
1879
	    -DXEN_CMD="$(XEN_CMD)" \
1880
	    -DENABLE_RESTRICTED_COMMANDS="$(ENABLE_RESTRICTED_COMMANDS)" \
1881
	    -DENABLE_MOND="$(ENABLE_MOND)" \
1882
	    -DHAS_GNU_LN="$(HAS_GNU_LN)" \
1883
	    -DMAN_PAGES="$$(for i in $(notdir $(man_MANS)); do \
1884
	                    echo -n "$$i" | sed -re 's/^(.*)\.([0-9]+)$$/("\1",\2):/g'; \
1885
	                    done)" \
1886
	    -DAF_INET4="$$(PYTHONPATH=. python $(PRINT_PY_CONSTANTS) AF_INET4)" \
1887
	    -DAF_INET6="$$(PYTHONPATH=. python $(PRINT_PY_CONSTANTS) AF_INET6)" \
1888
	$(abs_top_srcdir)/src/AutoConf.hs.in > $@
1889

    
1890
lib/_vcsversion.py: Makefile vcs-version | stamp-directories
1891
	set -e; \
1892
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
1893
	{ echo '# This file is automatically generated, do not edit!'; \
1894
	  echo '#'; \
1895
	  echo ''; \
1896
	  echo '"""Build-time VCS version number for Ganeti.'; \
1897
	  echo '';\
1898
	  echo 'This file is autogenerated by the build process.'; \
1899
	  echo 'For any changes you need to re-run ./configure (and'; \
1900
	  echo 'not edit by hand).'; \
1901
	  echo ''; \
1902
	  echo '"""'; \
1903
	  echo ''; \
1904
	  echo '# pylint: disable=C0301,C0324'; \
1905
	  echo '# because this is autogenerated, we do not want'; \
1906
	  echo '# style warnings' ; \
1907
	  echo ''; \
1908
	  echo "VCS_VERSION = '$$VCSVER'"; \
1909
	} > $@
1910

    
1911
lib/opcodes.py: Makefile src/hs2py lib/opcodes.py.in_before \
1912
		lib/opcodes.py.in_after | stamp-directories
1913
	cat $(abs_top_srcdir)/lib/opcodes.py.in_before > $@
1914
	src/hs2py --opcodes >> $@
1915
	cat $(abs_top_srcdir)/lib/opcodes.py.in_after >> $@
1916

    
1917
lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC)
1918
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
1919

    
1920
$(SHELL_ENV_INIT): Makefile stamp-directories
1921
	set -e; \
1922
	{ echo '# Allow overriding for tests'; \
1923
	  echo 'readonly LOCALSTATEDIR=$${LOCALSTATEDIR:-$${GANETI_ROOTDIR:-}$(localstatedir)}'; \
1924
	  echo 'readonly SYSCONFDIR=$${SYSCONFDIR:-$${GANETI_ROOTDIR:-}$(sysconfdir)}'; \
1925
	  echo; \
1926
	  echo 'readonly PKGLIBDIR=$(libdir)/ganeti'; \
1927
	  echo 'readonly LOG_DIR="$$LOCALSTATEDIR/log/ganeti"'; \
1928
	  echo 'readonly RUN_DIR="$$LOCALSTATEDIR/run/ganeti"'; \
1929
	  echo 'readonly DATA_DIR="$$LOCALSTATEDIR/lib/ganeti"'; \
1930
	  echo 'readonly CONF_DIR="$$SYSCONFDIR/ganeti"'; \
1931
	} > $@
1932

    
1933
## Writes sed script to replace placeholders with build-time values. The
1934
## additional quotes after the first @ sign are necessary to stop configure
1935
## from replacing those values as well.
1936
$(REPLACE_VARS_SED): $(SHELL_ENV_INIT) Makefile stamp-directories
1937
	set -e; \
1938
	{ echo 's#@''PREFIX@#$(prefix)#g'; \
1939
	  echo 's#@''SYSCONFDIR@#$(sysconfdir)#g'; \
1940
	  echo 's#@''LOCALSTATEDIR@#$(localstatedir)#g'; \
1941
	  echo 's#@''BINDIR@#$(BINDIR)#g'; \
1942
	  echo 's#@''SBINDIR@#$(SBINDIR)#g'; \
1943
	  echo 's#@''LIBDIR@#$(libdir)#g'; \
1944
	  echo 's#@''GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
1945
	  echo 's#@''CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
1946
	  echo 's#@''CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
1947
	  echo 's#@''CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
1948
	  echo 's#@''CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
1949
	  echo 's#@''CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
1950
	  echo 's#@''RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
1951
	  echo 's#@''PKGLIBDIR@#$(libdir)/ganeti#g'; \
1952
	  echo 's#@''GNTMASTERUSER@#$(MASTERD_USER)#g'; \
1953
	  echo 's#@''GNTRAPIUSER@#$(RAPI_USER)#g'; \
1954
	  echo 's#@''GNTCONFDUSER@#$(CONFD_USER)#g'; \
1955
	  echo 's#@''GNTLUXIDUSER@#$(LUXID_USER)#g'; \
1956
	  echo 's#@''GNTNODEDUSER@#$(NODED_USER)#g'; \
1957
	  echo 's#@''GNTMONDUSER@#$(MOND_USER)#g'; \
1958
	  echo 's#@''GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
1959
	  echo 's#@''GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
1960
	  echo 's#@''GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
1961
	  echo 's#@''GNTNODEDGROUP@#$(NODED_GROUP)#g'; \
1962
	  echo 's#@''GNTLUXIDGROUP@#$(LUXID_GROUP)#g'; \
1963
	  echo 's#@''GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
1964
	  echo 's#@''GNTMONDGROUP@#$(MOND_GROUP)#g'; \
1965
	  echo 's#@''GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
1966
	  echo 's#@''CUSTOM_ENABLE_CONFD@#$(ENABLE_CONFD)#g'; \
1967
	  echo 's#@''CUSTOM_ENABLE_MOND@#$(ENABLE_MOND)#g'; \
1968
	  echo 's#@''MODULES@#$(strip $(lint_python_code))#g'; \
1969
	  echo 's#@''XEN_CONFIG_DIR@#$(XEN_CONFIG_DIR)#g'; \
1970
	  echo; \
1971
	  echo '/^@SHELL_ENV_INIT@$$/ {'; \
1972
	  echo '  r $(SHELL_ENV_INIT)'; \
1973
	  echo '  d'; \
1974
	  echo '}'; \
1975
	} > $@
1976

    
1977
# Using deferred evaluation
1978
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
1979
daemons/ganeti-watcher: MODULE = ganeti.watcher
1980
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
1981
tools/burnin: MODULE = ganeti.tools.burnin
1982
tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
1983
tools/node-daemon-setup: MODULE = ganeti.tools.node_daemon_setup
1984
tools/prepare-node-join: MODULE = ganeti.tools.prepare_node_join
1985
tools/node-cleanup: MODULE = ganeti.tools.node_cleanup
1986
$(HS_BUILT_TEST_HELPERS): TESTROLE = $(patsubst test/hs/%,%,$@)
1987

    
1988
$(PYTHON_BOOTSTRAP) $(gnt_scripts) $(gnt_python_sbin_SCRIPTS): Makefile | stamp-directories
1989
	test -n "$(MODULE)" || { echo Missing module; exit 1; }
1990
	set -e; \
1991
	{ echo '#!/usr/bin/python'; \
1992
	  echo '# This file is automatically generated, do not edit!'; \
1993
	  echo "# Edit $(MODULE) instead."; \
1994
	  echo; \
1995
	  echo '"""Bootstrap script for L{$(MODULE)}"""'; \
1996
	  echo; \
1997
	  echo '# pylint: disable=C0103'; \
1998
	  echo '# C0103: Invalid name'; \
1999
	  echo; \
2000
	  echo 'import sys'; \
2001
	  echo 'import $(MODULE) as main'; \
2002
	  echo; \
2003
	  echo '# Temporarily alias commands until bash completion'; \
2004
	  echo '# generator is changed'; \
2005
	  echo 'if hasattr(main, "commands"):'; \
2006
	  echo '  commands = main.commands # pylint: disable=E1101'; \
2007
	  echo 'if hasattr(main, "aliases"):'; \
2008
	  echo '  aliases = main.aliases # pylint: disable=E1101'; \
2009
	  echo; \
2010
	  echo 'if __name__ == "__main__":'; \
2011
	  echo '  sys.exit(main.Main())'; \
2012
	} > $@
2013
	chmod u+x $@
2014

    
2015
$(HS_BUILT_TEST_HELPERS): Makefile
2016
	@test -n "$(TESTROLE)" || { echo Missing TESTROLE; exit 1; }
2017
	set -e; \
2018
	{ echo '#!/bin/sh'; \
2019
	  echo '# This file is automatically generated, do not edit!'; \
2020
	  echo "# Edit Makefile.am instead."; \
2021
	  echo; \
2022
	  echo "HTOOLS=$(TESTROLE) exec ./test/hs/hpc-htools \"\$$@\""; \
2023
	} > $@
2024
	chmod u+x $@
2025

    
2026
stamp-directories: Makefile
2027
	$(MAKE) $(AM_MAKEFLAGS) ganeti
2028
	@mkdir_p@ $(DIRS) $(BUILDTIME_DIR_AUTOCREATE)
2029
	touch $@
2030

    
2031
# We need to create symlinks because "make distcheck" will not install Python
2032
# files when building.
2033
stamp-srclinks: Makefile | stamp-directories
2034
	set -e; \
2035
	for i in $(srclink_files); do \
2036
	  if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
2037
	    $(LN_S) $(abs_top_srcdir)/$$i $$i; \
2038
	  fi; \
2039
	done
2040
	touch $@
2041

    
2042
.PHONY: ganeti
2043
ganeti:
2044
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
2045

    
2046
.PHONY: check-dirs
2047
check-dirs: $(GENERATED_FILES)
2048
	@set -e; \
2049
	find . -type d \( -name . -o -name .git -prune -o -print \) | { \
2050
	  error=; \
2051
	  while read dir; do \
2052
	    case "$$dir" in \
2053
	      $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
2054
	      *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
2055
	    esac; \
2056
	  done; \
2057
	  for dir in $(DIRS); do \
2058
	    if ! test -d "$$dir"; then \
2059
	      echo "Directory $$dir listed in DIRS does not exist" >&2; \
2060
	      error=1; \
2061
	    fi \
2062
	  done; \
2063
	  test -z "$$error"; \
2064
	}
2065

    
2066
.PHONY: check-news
2067
check-news:
2068
	RELEASE=$(PACKAGE_VERSION) $(CHECK_NEWS) < $(top_srcdir)/NEWS
2069

    
2070
.PHONY: check-local
2071
check-local: check-dirs check-news $(GENERATED_FILES)
2072
	$(CHECK_PYTHON_CODE) $(check_python_code)
2073
	PYTHONPATH=. $(CHECK_HEADER) $(check_python_code)
2074
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
2075
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CHECK_IMPORTS) . $(standalone_python_modules)
2076
	error= ; \
2077
	if [ "x`echo $(VERSION_SUFFIX)|grep 'alpha'`" == "x" ]; then \
2078
	  expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
2079
	  if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
2080
	    echo "Incorrect version in README, expected $$expver" >&2; \
2081
	    error=1; \
2082
	  fi; \
2083
	  for file in doc/iallocator.rst doc/hooks.rst doc/virtual-cluster.rst \
2084
	      doc/security.rst; do \
2085
	    if test "`sed -ne '4 p' $(top_srcdir)/$$file`" != \
2086
	      "Documents Ganeti version $$expver"; then \
2087
	      echo "Incorrect version in $$file, expected $$expver" >&2; \
2088
	      error=1; \
2089
	    fi; \
2090
	  done; \
2091
	  if ! test -f $(top_srcdir)/doc/design-$$expver.rst; then \
2092
	    echo "File $(top_srcdir)/doc/design-$$expver.rst not found" >&2; \
2093
	    error=1; \
2094
	  fi; \
2095
	  if test "`sed -ne '5 p' $(top_srcdir)/doc/design-draft.rst`" != \
2096
	    ".. Last updated for Ganeti $$expver"; then \
2097
	    echo "doc/design-draft.rst was not updated for version $$expver" >&2; \
2098
	    error=1; \
2099
	  fi; \
2100
	fi; \
2101
	for file in configure.ac $(HS_LIBTEST_SRCS) $(HS_PROG_SRCS); do \
2102
	  if test $$(wc --max-line-length < $(top_srcdir)/$$file) -gt 80; then \
2103
	    echo "Longest line in $$file is longer than 80 characters" >&2; \
2104
	    error=1; \
2105
	  fi; \
2106
	done; \
2107
	test -z "$$error"
2108

    
2109
.PHONY: hs-test-%
2110
hs-test-%: test/hs/htest
2111
	@rm -f htest.tix
2112
	test/hs/htest -t $*
2113

    
2114
.PHONY: hs-tests
2115
hs-tests: test/hs/htest
2116
	@rm -f htest.tix
2117
	./test/hs/htest
2118

    
2119
.PHONY: hs-shell-%
2120
hs-shell-%: test/hs/hpc-htools test/hs/hpc-mon-collector \
2121
            $(HS_BUILT_TEST_HELPERS)
2122
	@rm -f hpc-htools.tix hpc-mon-collector.tix
2123
	HBINARY="./test/hs/hpc-htools" \
2124
	SHELLTESTARGS=$(SHELLTESTARGS) \
2125
	./test/hs/offline-test.sh $*
2126

    
2127
.PHONY: hs-shell
2128
hs-shell: test/hs/hpc-htools test/hs/hpc-mon-collector $(HS_BUILT_TEST_HELPERS)
2129
	@rm -f hpc-htools.tix hpc-mon-collector.tix
2130
	HBINARY="./test/hs/hpc-htools" \
2131
	SHELLTESTARGS=$(SHELLTESTARGS) \
2132
	./test/hs/offline-test.sh
2133

    
2134
.PHONY: hs-check
2135
hs-check: hs-tests hs-shell
2136

    
2137
# E111: indentation is not a multiple of four
2138
# E121: continuation line indentation is not a multiple of four
2139
#       (since our indent level is not 4)
2140
# E125: continuation line does not distinguish itself from next logical line
2141
#       (since our indent level is not 4)
2142
# E123: closing bracket does not match indentation of opening bracket's line
2143
# E127: continuation line over-indented for visual indent
2144
#       (since our indent level is not 4)
2145
# note: do NOT add E128 here; it's a valid style error in most cases!
2146
# I've seen real errors, but also some cases were we indent wrongly
2147
# due to line length; try to rework the cases where it is triggered,
2148
# instead of silencing it
2149
# E261: at least two spaces before inline comment
2150
# E501: line too long (80 characters)
2151
PEP8_IGNORE = E111,E121,E123,E125,E127,E261,E501
2152

    
2153
# For excluding pep8 expects filenames only, not whole paths
2154
PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(BUILT_PYTHON_SOURCES))))
2155

    
2156
LINT_TARGETS = pylint pylint-qa pylint-test
2157
if HAS_PEP8
2158
LINT_TARGETS += pep8
2159
endif
2160
if HAS_HLINT
2161
LINT_TARGETS += hlint
2162
endif
2163

    
2164
.PHONY: lint
2165
lint: $(LINT_TARGETS)
2166

    
2167
.PHONY: pylint
2168
pylint: $(GENERATED_FILES)
2169
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2170
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
2171

    
2172
.PHONY: pylint-qa
2173
pylint-qa: $(GENERATED_FILES)
2174
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2175
	cd $(top_srcdir)/qa && \
2176
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
2177
	  --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
2178
# FIXME: lint all test code, not just the newly added test support
2179
pylint-test: $(GENERATED_FILES)
2180
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2181
	cd $(top_srcdir) && \
2182
		PYTHONPATH=.:./test/py $(PYLINT) $(LINT_OPTS) \
2183
		--rcfile=pylintrc-test  $(python_test_support)
2184

    
2185
.PHONY: pep8
2186
pep8: $(GENERATED_FILES)
2187
	@test -n "$(PEP8)" || { echo 'pep8' not found during configure; exit 1; }
2188
	$(PEP8) --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
2189
	  --repeat $(pep8_python_code)
2190

    
2191
# FIXME: remove ignore "Use void" when GHC 6.x is deprecated
2192
HLINT_EXCLUDES = src/Ganeti/THH.hs test/hs/hpc-htools.hs
2193
.PHONY: hlint
2194
hlint: $(HS_BUILT_SRCS) src/lint-hints.hs
2195
	@test -n "$(HLINT)" || { echo 'hlint' not found during configure; exit 1; }
2196
	@rm -f doc/hs-lint.html
2197
	if tty -s; then C="-c"; else C=""; fi; \
2198
	$(HLINT) --utf8 --report=doc/hs-lint.html --cross $$C \
2199
	  --ignore "Use first" \
2200
	  --ignore "Use &&&" \
2201
	  --ignore "Use void" \
2202
	  --ignore "Reduce duplication" \
2203
	  --hint src/lint-hints \
2204
	  $(filter-out $(HLINT_EXCLUDES),$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS))
2205
	@if [ ! -f doc/hs-lint.html ]; then \
2206
	  echo "All good" > doc/hs-lint.html; \
2207
	fi
2208

    
2209
# a dist hook rule for updating the vcs-version file; this is
2210
# hardcoded due to where it needs to build the file...
2211
dist-hook:
2212
	$(MAKE) $(AM_MAKEFLAGS) regen-vcs-version
2213
	rm -f $(top_distdir)/vcs-version
2214
	cp -p $(srcdir)/vcs-version $(top_distdir)
2215

    
2216
# a distcheck hook rule for catching revision control directories
2217
distcheck-hook:
2218
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
2219
	  echo "Found revision control files in final archive." 1>&2; \
2220
	  exit 1; \
2221
	fi
2222
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
2223
	  echo "Found Python byte code in final archive." 1>&2; \
2224
	  exit 1; \
2225
	fi
2226
	if find $(top_distdir) -name '*~' | grep .; then \
2227
	  echo "Found backup files in final archive." 1>&2; \
2228
	  exit 1; \
2229
	fi
2230
# Empty files or directories should not be distributed. They can cause
2231
# unnecessary warnings for packagers. Directories used by automake during
2232
# distcheck must be excluded.
2233
	if find $(top_distdir) -empty -and -not \( \
2234
	    -path $(top_distdir)/_build -or \
2235
	    -path $(top_distdir)/_inst \) | grep .; then \
2236
	  echo "Found empty files or directories in final archive." 1>&2; \
2237
	  exit 1; \
2238
	fi
2239
	if test -e $(top_distdir)/doc/man-html; then \
2240
	  echo "Found documentation including man pages in final archive" >&2; \
2241
	  exit 1; \
2242
	fi
2243

    
2244
# Backwards compatible distcheck-release target
2245
distcheck-release: distcheck
2246

    
2247
distrebuildcheck: dist
2248
	set -e; \
2249
	builddir=$$(mktemp -d $(abs_srcdir)/distrebuildcheck.XXXXXXX); \
2250
	trap "echo Removing $$builddir; cd $(abs_srcdir); rm -rf $$builddir" EXIT; \
2251
	cd $$builddir; \
2252
	tar xzf $(abs_srcdir)/$(distdir).tar.gz; \
2253
	cd $(distdir); \
2254
	./configure; \
2255
	$(MAKE) maintainer-clean; \
2256
	cp $(abs_srcdir)/vcs-version .; \
2257
	./configure; \
2258
	$(MAKE) $(AM_MAKEFLAGS)
2259

    
2260
dist-release: dist
2261
	set -e; \
2262
	for i in $(DIST_ARCHIVES); do \
2263
	  echo -n "Checking $$i ... "; \
2264
	  autotools/check-tar < $$i; \
2265
	  echo OK; \
2266
	done
2267

    
2268
install-exec-local:
2269
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
2270
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
2271
	  "$(DESTDIR)${localstatedir}/run/ganeti"
2272
	for dir in $(SYMLINK_TARGET_DIRS); do \
2273
	  @mkdir_p@  $(DESTDIR)$$dir; \
2274
	done
2275
	$(LN_S) -f $(sysconfdir)/ganeti/lib $(DESTDIR)$(defaultversiondir)
2276
	$(LN_S) -f $(sysconfdir)/ganeti/share $(DESTDIR)$(defaultversionedsharedir)
2277
	for prog in $(HS_BIN_ROLES); do \
2278
	  $(LN_S) -f $(defaultversiondir)$(BINDIR)/$$prog $(DESTDIR)$(BINDIR)/$$prog; \
2279
	done
2280
	$(LN_S) -f $(defaultversiondir)$(libdir)/ganeti/iallocators/hail $(DESTDIR)$(libdir)/ganeti/iallocators/hail
2281
	for prog in $(all_sbin_scripts); do \
2282
	  $(LN_S) -f $(defaultversiondir)$(SBINDIR)/$$prog $(DESTDIR)$(SBINDIR)/$$prog; \
2283
	done
2284
	for prog in $(gnt_scripts_basenames); do \
2285
	  $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(SBINDIR)/$$prog; \
2286
	done
2287
	for prog in $(pkglib_python_basenames); do \
2288
	  $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(libdir)/ganeti/$$prog; \
2289
	done
2290
	for prog in $(tools_python_basenames); do \
2291
	  $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(libdir)/ganeti/tools/$$prog; \
2292
	done
2293
	for prog in $(tools_basenames); do \
2294
	  $(LN_S) -f $(defaultversiondir)/$(libdir)/ganeti/tools/$$prog $(DESTDIR)$(libdir)/ganeti/tools/$$prog; \
2295
	done
2296
	if ! test -n '$(ENABLE_MANPAGES)'; then \
2297
	  for man in $(manfullpath); do \
2298
	    $(LN_S) -f $(defaultversionedsharedir)/root$(MANDIR)/$$man $(DESTDIR)$(MANDIR)/$$man; \
2299
	  done; \
2300
	fi
2301
	for prog in $(myexeclib_scripts_basenames); do \
2302
	  $(LN_S) -f $(defaultversiondir)$(libdir)/ganeti/$$prog $(DESTDIR)$(libdir)/ganeti/$$prog; \
2303
	done
2304
if INSTALL_SYMLINKS
2305
	$(LN_S) -f $(versionedsharedir) $(DESTDIR)$(sysconfdir)/ganeti/share
2306
	$(LN_S) -f $(versiondir) $(DESTDIR)$(sysconfdir)/ganeti/lib
2307
endif
2308

    
2309
.PHONY: apidoc
2310
if WANT_HSAPIDOC
2311
apidoc: py-apidoc hs-apidoc
2312
else
2313
apidoc: py-apidoc
2314
endif
2315

    
2316
.PHONY: py-apidoc
2317
py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(GENERATED_FILES)
2318
	env - PATH="$$PATH" PYTHONPATH="$$PYTHONPATH" \
2319
	$(RUN_IN_TEMPDIR) epydoc -v \
2320
	  --conf $(CURDIR)/epydoc.conf \
2321
	  --output $(CURDIR)/$(APIDOC_PY_DIR)
2322

    
2323
.PHONY: hs-apidoc
2324
hs-apidoc: $(APIDOC_HS_DIR)/index.html
2325

    
2326
$(APIDOC_HS_DIR)/index.html: $(HS_LIBTESTBUILT_SRCS) Makefile
2327
	@test -n "$(HSCOLOUR)" || \
2328
	    { echo 'HsColour' not found during configure; exit 1; }
2329
	@test -n "$(HADDOCK)" || \
2330
	    { echo 'haddock' not found during configure; exit 1; }
2331
	rm -rf $(APIDOC_HS_DIR)/*
2332
	for i in $(ALL_APIDOC_HS_DIRS); do \
2333
	  @mkdir_p@ $$i; \
2334
	  $(HSCOLOUR) -print-css > $$i/hscolour.css; \
2335
	done
2336
	set -e ; \
2337
	export LC_ALL=en_US.UTF-8; \
2338
	OPTGHC="--optghc=-isrc --optghc=-itest/hs"; \
2339
	if [ "$(HS_PARALLEL3)" ]; \
2340
	then OPTGHC="$$OPTGHC --optghc=$(HS_PARALLEL3)"; \
2341
	fi; \
2342
	if [ "$(HS_REGEX_PCRE)" ]; \
2343
	then OPTGHC="$$OPTGHC --optghc=$(HS_REGEX_PCRE)"; \
2344
	fi; \
2345
	for file in $(HS_LIBTESTBUILT_SRCS); do \
2346
	  f_nosrc=$${file##src/}; \
2347
	  f_notst=$${f_nosrc##test/hs/}; \
2348
	  f_html=$${f_notst%%.hs}.html; \
2349
	  $(HSCOLOUR) -css -anchor $$file > $(APIDOC_HS_DIR)/$$f_html ; \
2350
	done ; \
2351
	$(HADDOCK) --odir $(APIDOC_HS_DIR) --html --ignore-all-exports -w \
2352
	  -t ganeti -p src/haddock-prologue \
2353
	  --source-module="%{MODULE/.//}.html" \
2354
	  --source-entity="%{MODULE/.//}.html#%{NAME}" \
2355
	  $$OPTGHC \
2356
	  $(HS_LIBTESTBUILT_SRCS)
2357

    
2358
.PHONY: TAGS
2359
TAGS: $(GENERATED_FILES)
2360
	rm -f TAGS
2361
	$(GHC) -e ":etags TAGS_hs" -v0 \
2362
	  $(filter-out -O -Werror,$(HFLAGS)) \
2363
		-osuf tags.o \
2364
		-hisuf tags.hi \
2365
    -lcurl \
2366
	  $(HS_PARALLEL3) $(HS_REGEX_PCRE) \
2367
	  $(HS_LIBTEST_SRCS)
2368
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
2369
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
2370
	  -path './qa/*.py' | \
2371
	  etags --etags-include=TAGS_hs -L -
2372

    
2373
.PHONY: coverage
2374

    
2375
COVERAGE_TESTS=
2376
if HS_UNIT
2377
COVERAGE_TESTS += hs-coverage
2378
endif
2379
if PY_UNIT
2380
COVERAGE_TESTS += py-coverage
2381
endif
2382

    
2383
coverage: $(COVERAGE_TESTS)
2384

    
2385
test/py/docs_unittest.py: $(gnt_scripts)
2386

    
2387
.PHONY: py-coverage
2388
py-coverage: $(GENERATED_FILES) $(python_tests)
2389
	@test -n "$(PYCOVERAGE)" || \
2390
	    { echo 'python-coverage' not found during configure; exit 1; }
2391
	set -e; \
2392
	COVERAGE=$(PYCOVERAGE) \
2393
	COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
2394
	TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
2395
	HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
2396
	$(PLAIN_TESTS_ENVIRONMENT) \
2397
	$(abs_top_srcdir)/autotools/gen-py-coverage \
2398
	$(python_tests)
2399

    
2400
.PHONY: hs-coverage
2401
hs-coverage: $(haskell_tests) test/hs/hpc-htools test/hs/hpc-mon-collector
2402
	rm -f *.tix
2403
	$(MAKE) $(AM_MAKEFLAGS) hs-check
2404
	@mkdir_p@ $(COVERAGE_HS_DIR)
2405
	hpc sum --union $(HPCEXCL) \
2406
	  htest.tix hpc-htools.tix hpc-mon-collector.tix > coverage-hs.tix
2407
	hpc markup --destdir=$(COVERAGE_HS_DIR) coverage-hs.tix
2408
	hpc report coverage-hs.tix | tee $(COVERAGE_HS_DIR)/report.txt
2409
	$(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
2410

    
2411
# Special "kind-of-QA" target for htools, needs special setup (all
2412
# tools compiled with -fhpc)
2413
.PHONY: live-test
2414
live-test: all
2415
	set -e ; \
2416
	cd src; \
2417
	rm -f .hpc; $(LN_S) ../.hpc .hpc; \
2418
	rm -f *.tix *.mix; \
2419
	./live-test.sh; \
2420
	hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:src/%=%)) \
2421
	  --output=live-test.tix ; \
2422
	@mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
2423
	hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
2424
	  --srcdir=.. $(HPCEXCL) ; \
2425
	hpc report --srcdir=.. live-test $(HPCEXCL)
2426

    
2427
commit-check: autotools-check distcheck lint apidoc
2428

    
2429
autotools-check:
2430
	TESTDATA_DIR=./test/data shelltest $(SHELLTESTARGS) \
2431
  $(abs_top_srcdir)/test/autotools/*-*.test \
2432
  -- --hide-successes
2433

    
2434
.PHONY: gitignore-check
2435
gitignore-check:
2436
	@if [ -n "`git status --short`" ]; then \
2437
	  echo "Git status is not clean!" 1>&2 ; \
2438
	  git status --short; \
2439
	  exit 1; \
2440
	fi
2441

    
2442
# target to rebuild all man pages (both groff and html output)
2443
.PHONY: man
2444
man: $(man_MANS) $(manhtml)
2445

    
2446
# Target that builds all binaries (including those that are not
2447
# rebuilt except when running the tests)
2448
.PHONY: really-all
2449
really-all: all $(check_SCRIPTS) $(haskell_tests) $(HS_ALL_PROGS)
2450

    
2451
# we don't need the ancient implicit rules:
2452
%: %,v
2453
%: RCS/%,v
2454
%: RCS/%
2455
%: s.%
2456
%: SCCS/s.%
2457

    
2458
-include ./Makefile.local
2459

    
2460
# vim: set noet :