Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ c2b8d366

History | View | Annotate | Download (74.6 kB)

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

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

    
12
# 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
pkgpython_rpc_stubdir = $(versionedsharedir)/ganeti/rpc/stub
77
gntpythondir = $(versionedsharedir)
78
pkgpython_bindir = $(versionedsharedir)
79
gnt_python_sbindir = $(versionedsharedir)
80
tools_pythondir = $(versionedsharedir)
81

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

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

    
113
# Delete output file if an error occurred while building it
114
.DELETE_ON_ERROR:
115

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

    
153
# Haskell directories without the roots (src, test/hs)
154
HS_DIRS_NOROOT = $(filter-out src,$(filter-out test/hs,$(HS_DIRS)))
155

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

    
201
ALL_APIDOC_HS_DIRS = \
202
	$(APIDOC_HS_DIR) \
203
	$(patsubst %,$(APIDOC_HS_DIR)/%,$(call strip_hsroot,$(HS_DIRS_NOROOT)))
204

    
205
BUILDTIME_DIR_AUTOCREATE = \
206
	scripts \
207
	$(APIDOC_DIR) \
208
	$(ALL_APIDOC_HS_DIRS) \
209
	$(APIDOC_PY_DIR) \
210
	$(COVERAGE_DIR) \
211
	$(COVERAGE_HS_DIR) \
212
	$(COVERAGE_PY_DIR) \
213
	.hpc
214

    
215
BUILDTIME_DIRS = \
216
	$(BUILDTIME_DIR_AUTOCREATE) \
217
	doc/html \
218
	doc/man-html
219

    
220
DIRCHECK_EXCLUDE = \
221
	$(BUILDTIME_DIRS) \
222
	ganeti-[0-9]*.[0-9]*.[0-9]* \
223
	doc/html/_* \
224
	doc/man-html/_* \
225
	autom4te.cache
226

    
227
# some helper vars
228
COVERAGE_DIR = doc/coverage
229
COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
230
COVERAGE_HS_DIR = $(COVERAGE_DIR)/hs
231
APIDOC_DIR = doc/api
232
APIDOC_PY_DIR = $(APIDOC_DIR)/py
233
APIDOC_HS_DIR = $(APIDOC_DIR)/hs
234

    
235
MAINTAINERCLEANFILES = \
236
	$(maninput) \
237
	doc/install-quick.rst \
238
	doc/news.rst \
239
	doc/upgrade.rst \
240
	vcs-version
241

    
242
maintainer-clean-local:
243
	rm -rf $(BUILDTIME_DIRS)
244

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

    
287
GENERATED_FILES = \
288
	$(built_base_sources) \
289
	$(built_python_sources) \
290
	$(PYTHON_BOOTSTRAP) \
291
	$(gnt_python_sbin_SCRIPTS)
292

    
293
HS_GENERATED_FILES = $(HS_PROGS) src/hluxid src/ganeti-luxid
294
if ENABLE_CONFD
295
HS_GENERATED_FILES += src/hconfd src/ganeti-confd
296
endif
297
if ENABLE_MOND
298
HS_GENERATED_FILES += src/ganeti-mond
299
endif
300

    
301
built_base_sources = \
302
	stamp-directories \
303
	stamp-srclinks
304

    
305
built_python_base_sources = \
306
	lib/_constants.py \
307
	lib/_vcsversion.py \
308
	lib/opcodes.py \
309
	lib/rpc/stub/wconfd.py
310

    
311
built_python_sources = \
312
	$(nodist_pkgpython_PYTHON) \
313
	$(nodist_pkgpython_rpc_stub_PYTHON)
314

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

    
319
# these are all built from the underlying %.in sources
320
BUILT_EXAMPLES = \
321
	doc/examples/ganeti-kvm-poweroff.initd \
322
	doc/examples/ganeti.cron \
323
	doc/examples/ganeti.initd \
324
	doc/examples/ganeti.logrotate \
325
	doc/examples/ganeti-master-role.ocf \
326
	doc/examples/ganeti-node-role.ocf \
327
	doc/examples/gnt-config-backup \
328
	doc/examples/hooks/ipsec
329

    
330
dist_ifup_SCRIPTS = \
331
	tools/kvm-ifup-os
332

    
333
nodist_pkgpython_PYTHON = \
334
	$(built_python_base_sources) \
335
	lib/_generated_rpc.py
336

    
337
nodist_pkgpython_rpc_stub_PYTHON = \
338
	lib/rpc/stub/wconfd.py
339

    
340
nodist_pkgpython_bin_SCRIPTS = \
341
	$(nodist_pkglib_python_scripts)
342

    
343
pkgpython_bin_SCRIPTS = \
344
	$(pkglib_python_scripts)
345

    
346
noinst_PYTHON = \
347
	lib/build/__init__.py \
348
	lib/build/shell_example_lexer.py \
349
	lib/build/sphinx_ext.py
350

    
351
pkgpython_PYTHON = \
352
	lib/__init__.py \
353
	lib/asyncnotifier.py \
354
	lib/backend.py \
355
	lib/bootstrap.py \
356
	lib/cli.py \
357
	lib/compat.py \
358
	lib/config.py \
359
	lib/constants.py \
360
	lib/daemon.py \
361
	lib/errors.py \
362
	lib/hooksmaster.py \
363
	lib/ht.py \
364
	lib/jqueue.py \
365
	lib/jstore.py \
366
	lib/locking.py \
367
	lib/luxi.py \
368
	lib/mcpu.py \
369
	lib/netutils.py \
370
	lib/objects.py \
371
	lib/opcodes_base.py \
372
	lib/outils.py \
373
	lib/ovf.py \
374
	lib/pathutils.py \
375
	lib/qlang.py \
376
	lib/query.py \
377
	lib/rpc_defs.py \
378
	lib/runtime.py \
379
	lib/serializer.py \
380
	lib/ssconf.py \
381
	lib/ssh.py \
382
	lib/uidpool.py \
383
	lib/vcluster.py \
384
	lib/network.py \
385
	lib/wconfd.py \
386
	lib/workerpool.py
387

    
388
client_PYTHON = \
389
	lib/client/__init__.py \
390
	lib/client/base.py \
391
	lib/client/gnt_backup.py \
392
	lib/client/gnt_cluster.py \
393
	lib/client/gnt_debug.py \
394
	lib/client/gnt_group.py \
395
	lib/client/gnt_instance.py \
396
	lib/client/gnt_job.py \
397
	lib/client/gnt_node.py \
398
	lib/client/gnt_network.py \
399
	lib/client/gnt_os.py \
400
	lib/client/gnt_storage.py
401

    
402
cmdlib_PYTHON = \
403
	lib/cmdlib/__init__.py \
404
	lib/cmdlib/backup.py \
405
	lib/cmdlib/base.py \
406
	lib/cmdlib/cluster.py \
407
	lib/cmdlib/common.py \
408
	lib/cmdlib/group.py \
409
	lib/cmdlib/instance.py \
410
	lib/cmdlib/instance_migration.py \
411
	lib/cmdlib/instance_operation.py \
412
	lib/cmdlib/instance_query.py \
413
	lib/cmdlib/instance_storage.py \
414
	lib/cmdlib/instance_utils.py \
415
	lib/cmdlib/misc.py \
416
	lib/cmdlib/network.py \
417
	lib/cmdlib/node.py \
418
	lib/cmdlib/operating_system.py \
419
	lib/cmdlib/query.py \
420
	lib/cmdlib/tags.py \
421
	lib/cmdlib/test.py
422

    
423
hypervisor_PYTHON = \
424
	lib/hypervisor/__init__.py \
425
	lib/hypervisor/hv_base.py \
426
	lib/hypervisor/hv_chroot.py \
427
	lib/hypervisor/hv_fake.py \
428
	lib/hypervisor/hv_kvm.py \
429
	lib/hypervisor/hv_lxc.py \
430
	lib/hypervisor/hv_xen.py
431

    
432
storage_PYTHON = \
433
	lib/storage/__init__.py \
434
	lib/storage/bdev.py \
435
	lib/storage/base.py \
436
	lib/storage/container.py \
437
	lib/storage/drbd.py \
438
	lib/storage/drbd_info.py \
439
	lib/storage/drbd_cmdgen.py \
440
	lib/storage/filestorage.py \
441
	lib/storage/gluster.py
442

    
443
rapi_PYTHON = \
444
	lib/rapi/__init__.py \
445
	lib/rapi/baserlib.py \
446
	lib/rapi/client.py \
447
	lib/rapi/client_utils.py \
448
	lib/rapi/connector.py \
449
	lib/rapi/rlib2.py \
450
	lib/rapi/testutils.py
451

    
452
http_PYTHON = \
453
	lib/http/__init__.py \
454
	lib/http/auth.py \
455
	lib/http/client.py \
456
	lib/http/server.py
457

    
458
confd_PYTHON = \
459
	lib/confd/__init__.py \
460
	lib/confd/client.py
461

    
462
masterd_PYTHON = \
463
	lib/masterd/__init__.py \
464
	lib/masterd/iallocator.py \
465
	lib/masterd/instance.py
466

    
467
impexpd_PYTHON = \
468
	lib/impexpd/__init__.py
469

    
470
watcher_PYTHON = \
471
	lib/watcher/__init__.py \
472
	lib/watcher/nodemaint.py \
473
	lib/watcher/state.py
474

    
475
server_PYTHON = \
476
	lib/server/__init__.py \
477
	lib/server/masterd.py \
478
	lib/server/noded.py \
479
	lib/server/rapi.py
480

    
481
rpc_PYTHON = \
482
	lib/rpc/__init__.py \
483
	lib/rpc/client.py \
484
	lib/rpc/errors.py \
485
	lib/rpc/node.py \
486
	lib/rpc/transport.py
487

    
488
rpc_stub_PYTHON = \
489
	lib/rpc/stub/__init__.py
490

    
491
pytools_PYTHON = \
492
	lib/tools/__init__.py \
493
	lib/tools/burnin.py \
494
	lib/tools/ensure_dirs.py \
495
	lib/tools/node_cleanup.py \
496
	lib/tools/node_daemon_setup.py \
497
	lib/tools/prepare_node_join.py
498

    
499
utils_PYTHON = \
500
	lib/utils/__init__.py \
501
	lib/utils/algo.py \
502
	lib/utils/filelock.py \
503
	lib/utils/hash.py \
504
	lib/utils/io.py \
505
	lib/utils/log.py \
506
	lib/utils/lvm.py \
507
	lib/utils/mlock.py \
508
	lib/utils/nodesetup.py \
509
	lib/utils/process.py \
510
	lib/utils/retry.py \
511
	lib/utils/security.py \
512
	lib/utils/storage.py \
513
	lib/utils/text.py \
514
	lib/utils/version.py \
515
	lib/utils/wrapper.py \
516
	lib/utils/x509.py
517

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

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

    
604
# Haskell programs to be installed in $PREFIX/bin
605
HS_BIN_PROGS=src/htools
606

    
607
# Haskell programs to be installed in the MYEXECLIB dir
608
if ENABLE_MOND
609
HS_MYEXECLIB_PROGS=src/mon-collector
610
else
611
HS_MYEXECLIB_PROGS=
612
endif
613

    
614
# Haskell programs to be compiled by "make really-all"
615
HS_COMPILE_PROGS= \
616
	src/ganeti-kvmd \
617
	src/ganeti-metad \
618
	src/ganeti-mond \
619
	src/hconfd \
620
	src/ganeti-wconfd \
621
	src/hluxid \
622
	src/hs2py \
623
	src/rpc-test
624

    
625
# All Haskell non-test programs to be compiled but not automatically installed
626
HS_PROGS = $(HS_BIN_PROGS) $(HS_MYEXECLIB_PROGS)
627

    
628
HS_BIN_ROLES = harep hbal hscan hspace hinfo hcheck hroller hsqueeze
629
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
630

    
631
# Haskell programs that cannot be disabled at configure (e.g., unlike
632
# 'mon-collector')
633
HS_DEFAULT_PROGS = \
634
	$(HS_BIN_PROGS) \
635
	test/hs/hpc-htools \
636
	test/hs/hpc-mon-collector \
637
	test/hs/htest \
638
	$(HS_COMPILE_PROGS)
639

    
640
HS_ALL_PROGS = $(HS_DEFAULT_PROGS) $(HS_MYEXECLIB_PROGS)
641

    
642
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_DEFAULT_PROGS)) src/mon-collector.hs
643
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
644

    
645
HFLAGS = \
646
	-O -Wall -Werror -isrc \
647
	-fwarn-monomorphism-restriction \
648
	-fwarn-tabs \
649
	$(GHC_BYVERSION_FLAGS)
650

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

    
668
HS_LIB_SRCS = \
669
	src/Ganeti/BasicTypes.hs \
670
	src/Ganeti/Common.hs \
671
	src/Ganeti/Compat.hs \
672
	src/Ganeti/Confd/Client.hs \
673
	src/Ganeti/Confd/ClientFunctions.hs \
674
	src/Ganeti/Confd/Server.hs \
675
	src/Ganeti/Confd/Types.hs \
676
	src/Ganeti/Confd/Utils.hs \
677
	src/Ganeti/Config.hs \
678
	src/Ganeti/ConfigReader.hs \
679
	src/Ganeti/Constants.hs \
680
	src/Ganeti/ConstantUtils.hs \
681
	src/Ganeti/Cpu/LoadParser.hs \
682
	src/Ganeti/Cpu/Types.hs \
683
	src/Ganeti/Curl/Multi.hs \
684
	src/Ganeti/Daemon.hs \
685
	src/Ganeti/DataCollectors/CLI.hs \
686
	src/Ganeti/DataCollectors/CPUload.hs \
687
	src/Ganeti/DataCollectors/Diskstats.hs \
688
	src/Ganeti/DataCollectors/Drbd.hs \
689
	src/Ganeti/DataCollectors/InstStatus.hs \
690
	src/Ganeti/DataCollectors/InstStatusTypes.hs \
691
	src/Ganeti/DataCollectors/Lv.hs \
692
	src/Ganeti/DataCollectors/Program.hs \
693
	src/Ganeti/DataCollectors/Types.hs \
694
	src/Ganeti/Errors.hs \
695
	src/Ganeti/HTools/Backend/IAlloc.hs \
696
	src/Ganeti/HTools/Backend/Luxi.hs \
697
	src/Ganeti/HTools/Backend/Rapi.hs \
698
	src/Ganeti/HTools/Backend/Simu.hs \
699
	src/Ganeti/HTools/Backend/Text.hs \
700
	src/Ganeti/HTools/CLI.hs \
701
	src/Ganeti/HTools/Cluster.hs \
702
	src/Ganeti/HTools/Container.hs \
703
	src/Ganeti/HTools/ExtLoader.hs \
704
	src/Ganeti/HTools/Graph.hs \
705
	src/Ganeti/HTools/Group.hs \
706
	src/Ganeti/HTools/Instance.hs \
707
	src/Ganeti/HTools/Loader.hs \
708
	src/Ganeti/HTools/Nic.hs \
709
	src/Ganeti/HTools/Node.hs \
710
	src/Ganeti/HTools/PeerMap.hs \
711
	src/Ganeti/HTools/Program/Hail.hs \
712
	src/Ganeti/HTools/Program/Harep.hs \
713
	src/Ganeti/HTools/Program/Hbal.hs \
714
	src/Ganeti/HTools/Program/Hcheck.hs \
715
	src/Ganeti/HTools/Program/Hinfo.hs \
716
	src/Ganeti/HTools/Program/Hscan.hs \
717
	src/Ganeti/HTools/Program/Hspace.hs \
718
	src/Ganeti/HTools/Program/Hsqueeze.hs \
719
	src/Ganeti/HTools/Program/Hroller.hs \
720
	src/Ganeti/HTools/Program/Main.hs \
721
	src/Ganeti/HTools/Types.hs \
722
	src/Ganeti/Hypervisor/Xen.hs \
723
	src/Ganeti/Hypervisor/Xen/XmParser.hs \
724
	src/Ganeti/Hypervisor/Xen/Types.hs \
725
	src/Ganeti/Hash.hs \
726
	src/Ganeti/Hs2Py/GenConstants.hs \
727
	src/Ganeti/Hs2Py/GenOpCodes.hs \
728
	src/Ganeti/Hs2Py/OpDoc.hs \
729
	src/Ganeti/JQueue.hs \
730
	src/Ganeti/JQScheduler.hs \
731
	src/Ganeti/JSON.hs \
732
	src/Ganeti/Jobs.hs \
733
	src/Ganeti/Kvmd.hs \
734
        src/Ganeti/Locking/Allocation.hs \
735
	src/Ganeti/Logging.hs \
736
	src/Ganeti/Luxi.hs \
737
	src/Ganeti/Monitoring/Server.hs \
738
	src/Ganeti/Metad.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/PyRPC.hs \
772
	src/Ganeti/THH/PyType.hs \
773
	src/Ganeti/THH/Types.hs \
774
	src/Ganeti/THH/RPC.hs \
775
	src/Ganeti/Types.hs \
776
	src/Ganeti/UDSServer.hs \
777
	src/Ganeti/Utils.hs \
778
	src/Ganeti/VCluster.hs \
779
	src/Ganeti/WConfd/ConfigState.hs \
780
	src/Ganeti/WConfd/Core.hs \
781
	src/Ganeti/WConfd/Monad.hs \
782
	src/Ganeti/WConfd/Server.hs
783

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

    
836
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
837

    
838
HS_BUILT_SRCS = \
839
	test/hs/Test/Ganeti/TestImports.hs \
840
	src/AutoConf.hs \
841
	src/Ganeti/Hs2Py/ListConstants.hs \
842
	src/Ganeti/Curl/Internal.hs \
843
	src/Ganeti/Version.hs
844
HS_BUILT_SRCS_IN = \
845
	$(patsubst %,%.in,$(filter-out src/Ganeti/Curl/Internal.hs,$(HS_BUILT_SRCS))) \
846
	src/Ganeti/Curl/Internal.hsc \
847
	lib/_constants.py.in \
848
	lib/opcodes.py.in_after \
849
	lib/opcodes.py.in_before
850

    
851
HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)
852

    
853
$(RUN_IN_TEMPDIR): | stamp-directories
854

    
855
doc/html/index.html: ENABLE_MANPAGES =
856
doc/man-html/index.html: ENABLE_MANPAGES = 1
857
doc/man-html/index.html: doc/manpages-enabled.rst $(mandocrst)
858

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

    
896
doc/html: doc/html/index.html
897

    
898
doc/man-html: doc/man-html/index.html
899

    
900
doc/install-quick.rst: INSTALL
901
doc/news.rst: NEWS
902
doc/upgrade.rst: UPGRADE
903

    
904
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
905
	set -e; \
906
	{ echo '.. This file is automatically updated at build time from $<.'; \
907
	  echo '.. Do not edit.'; \
908
	  echo; \
909
	  cat $<; \
910
	} > $@
911

    
912
doc/manpages-enabled.rst: Makefile | $(built_base_sources)
913
	{ echo '.. This file is automatically generated, do not edit!'; \
914
	  echo ''; \
915
	  echo 'Man pages'; \
916
	  echo '========='; \
917
	  echo; \
918
	  echo '.. toctree::'; \
919
	  echo '   :maxdepth: 1'; \
920
	  echo; \
921
	  for i in $(notdir $(mandocrst)); do \
922
	    echo "   $$i"; \
923
	  done | LC_ALL=C sort; \
924
	} > $@
925

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

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

    
943
userspecs = \
944
	doc/users/users \
945
	doc/users/groups \
946
	doc/users/groupmemberships
947

    
948
# Things to build but not to install (add it to EXTRA_DIST if it should be
949
# distributed)
950
noinst_DATA = \
951
	$(BUILT_EXAMPLES) \
952
	doc/examples/bash_completion \
953
	doc/examples/bash_completion-debug \
954
	$(userspecs) \
955
	$(manhtml)
956

    
957
if HAS_SPHINX
958
if MANPAGES_IN_DOC
959
noinst_DATA += doc/man-html
960
else
961
noinst_DATA += doc/html
962
endif
963
endif
964

    
965
gnt_scripts = \
966
	scripts/gnt-backup \
967
	scripts/gnt-cluster \
968
	scripts/gnt-debug \
969
	scripts/gnt-group \
970
	scripts/gnt-instance \
971
	scripts/gnt-job \
972
	scripts/gnt-network \
973
	scripts/gnt-node \
974
	scripts/gnt-os \
975
	scripts/gnt-storage
976

    
977
gnt_scripts_basenames = \
978
	$(patsubst scripts/%,%,$(patsubst daemons/%,%,$(gnt_scripts) $(gnt_python_sbin_SCRIPTS)))
979

    
980
gnt_python_sbin_SCRIPTS = \
981
	$(PYTHON_BOOTSTRAP_SBIN)
982

    
983
gntpython_SCRIPTS = $(gnt_scripts)
984

    
985
PYTHON_BOOTSTRAP_SBIN = \
986
	daemons/ganeti-masterd \
987
	daemons/ganeti-noded \
988
	daemons/ganeti-rapi \
989
	daemons/ganeti-watcher
990

    
991
PYTHON_BOOTSTRAP = \
992
	tools/burnin \
993
	tools/ensure-dirs \
994
	tools/node-cleanup \
995
	tools/node-daemon-setup \
996
	tools/prepare-node-join
997

    
998
qa_scripts = \
999
	qa/__init__.py \
1000
	qa/ganeti-qa.py \
1001
	qa/qa_cluster.py \
1002
	qa/qa_config.py \
1003
	qa/qa_daemon.py \
1004
	qa/qa_env.py \
1005
	qa/qa_error.py \
1006
	qa/qa_group.py \
1007
	qa/qa_instance.py \
1008
	qa/qa_instance_utils.py \
1009
	qa/qa_job.py \
1010
	qa/qa_monitoring.py \
1011
	qa/qa_node.py \
1012
	qa/qa_os.py \
1013
	qa/qa_rapi.py \
1014
	qa/qa_tags.py \
1015
	qa/qa_utils.py \
1016
        qa/rapi-workload.py
1017

    
1018
bin_SCRIPTS = $(HS_BIN_PROGS)
1019
install-exec-hook:
1020
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
1021
# FIXME: this is a hardcoded logic, instead of auto-resolving
1022
	$(LN_S) -f ../../../bin/htools \
1023
	  $(DESTDIR)$(iallocatorsdir)/hail
1024
	for role in $(HS_BIN_ROLES); do \
1025
	  $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
1026
	done
1027

    
1028
HNORMAL_SUFFIX = .o
1029
HPROFILE_SUFFIX = .prof.o
1030
HCOVERAGE_SUFFIX = .hpc.o
1031
HTEST_SUFFIX = .test.o
1032

    
1033
HSUFFIX = $(if $(HPROFILE),$(HPROFILE_SUFFIX), \
1034
	  $(if $(HCOVERAGE),$(HCOVERAGE_SUFFIX), \
1035
	  $(if $(HTEST),$(HTEST_SUFFIX), \
1036
	  $(HNORMAL_SUFFIX))))
1037

    
1038
HFLAGS += $(if $(HPROFILE),-prof -auto-all,)
1039
HFLAGS += $(if $(HCOVERAGE),-fhpc,)
1040
HFLAGS += $(if $(HTEST),-DTEST,)
1041

    
1042
HS_SRCS = $(HS_LIBTESTBUILT_SRCS)
1043

    
1044
.NOTPARALLEL: $(HS_ALL_PROGS)
1045
.PHONY: $(HS_ALL_PROGS)
1046
$(HS_ALL_PROGS): %: %.hs $(HS_SRCS) Makefile
1047
	@if [ "$(notdir $@)" = "test" ] && [ "$(HS_NODEV)" ]; then \
1048
	  echo "Error: cannot run unittests without the development" \
1049
	       " libraries (see devnotes.rst)" 1>&2; \
1050
	  exit 1; \
1051
	fi
1052
	@rm -f $(notdir $@).tix
1053
	$(GHC) --make $(HFLAGS) \
1054
		-osuf $(HSUFFIX) \
1055
		-hisuf $(patsubst %.o,%.hi,$(HSUFFIX)) \
1056
		$(HS_PARALLEL3) $(HS_REGEX_PCRE) $(HEXTRA) $@
1057
	@touch "$@"
1058

    
1059
# for the test/hs/htest binary, we need to enable profiling/coverage
1060
test/hs/htest: HCOVERAGE = true
1061
test/hs/htest: HFLAGS += -itest/hs
1062
test/hs/htest: | $(built_python_sources)
1063

    
1064
# we compile the hpc-htools binary with the program coverage
1065
test/hs/hpc-htools: HCOVERAGE = true
1066

    
1067
# we compile the hpc-mon-collector binary with the program coverage
1068
test/hs/hpc-mon-collector: HCOVERAGE = true
1069

    
1070
# test dependency
1071
test/hs/offline-test.sh: test/hs/hpc-htools test/hs/hpc-mon-collector
1072

    
1073
# rule for building profiling-enabled versions of the haskell programs
1074
.PHONY: hs-prof
1075
hs-prof:
1076
	@if [ -z "$(TARGET)" ]; then \
1077
	  echo "You need to define TARGET when running this rule" 1>&2; \
1078
	  exit 1; \
1079
	fi
1080
	$(MAKE) $(AM_MAKEFLAGS) HPROFILE=y $(TARGET)
1081

    
1082
dist_sbin_SCRIPTS = \
1083
	tools/ganeti-listrunner
1084

    
1085
nodist_sbin_SCRIPTS = \
1086
	daemons/ganeti-cleaner
1087

    
1088
# strip path prefixes off the sbin scripts
1089
all_sbin_scripts = \
1090
	$(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst scripts/%,%,\
1091
	$(patsubst src/%,%,$(dist_sbin_SCRIPTS) $(nodist_sbin_SCRIPTS)))))
1092

    
1093
if ENABLE_CONFD
1094
src/ganeti-confd: src/hconfd
1095
	cp -f $< $@
1096

    
1097
src/ganeti-luxid: src/hluxid
1098
	cp -f $< $@
1099

    
1100
nodist_sbin_SCRIPTS += src/ganeti-confd
1101
nodist_sbin_SCRIPTS += src/ganeti-wconfd
1102
nodist_sbin_SCRIPTS += src/ganeti-luxid
1103
nodist_sbin_SCRIPTS += src/ganeti-kvmd
1104
nodist_sbin_SCRIPTS += src/ganeti-metad
1105
endif
1106

    
1107
if ENABLE_MOND
1108
nodist_sbin_SCRIPTS += src/ganeti-mond
1109
endif
1110

    
1111
python_scripts = \
1112
	tools/cfgshell \
1113
	tools/cfgupgrade \
1114
	tools/cfgupgrade12 \
1115
	tools/cluster-merge \
1116
	tools/confd-client \
1117
	tools/fmtjson \
1118
	tools/lvmstrap \
1119
	tools/move-instance \
1120
	tools/ovfconverter \
1121
	tools/post-upgrade \
1122
	tools/sanitize-config
1123

    
1124
dist_tools_SCRIPTS = \
1125
	tools/kvm-console-wrapper \
1126
	tools/master-ip-setup \
1127
	tools/xen-console-wrapper
1128

    
1129
dist_tools_python_SCRIPTS = \
1130
	$(python_scripts) \
1131
	tools/burnin
1132

    
1133
nodist_tools_python_SCRIPTS = \
1134
	tools/node-cleanup
1135

    
1136
tools_python_basenames = $(patsubst tools/%,%,\
1137
	$(dist_tools_python_SCRIPTS) $(nodist_tools_python_SCRIPTS))
1138

    
1139
nodist_tools_SCRIPTS = \
1140
	tools/users-setup \
1141
	tools/vcluster-setup
1142

    
1143
tools_basenames = $(patsubst tools/%,%,$(nodist_tools_SCRIPTS) $(dist_tools_SCRIPTS))
1144

    
1145
pkglib_python_scripts = \
1146
	daemons/import-export \
1147
	tools/check-cert-expired
1148

    
1149
nodist_pkglib_python_scripts = \
1150
	tools/ensure-dirs \
1151
	tools/node-daemon-setup \
1152
	tools/prepare-node-join
1153

    
1154
pkglib_python_basenames = \
1155
	$(patsubst daemons/%,%,$(patsubst tools/%,%,\
1156
	$(pkglib_python_scripts) $(nodist_pkglib_python_scripts)))
1157

    
1158
myexeclib_SCRIPTS = \
1159
	daemons/daemon-util \
1160
	tools/kvm-ifup \
1161
	tools/kvm-ifup-os \
1162
	tools/vif-ganeti \
1163
	tools/net-common \
1164
	$(HS_MYEXECLIB_PROGS)
1165

    
1166
# compute the basenames of the myexeclib_scripts
1167
myexeclib_scripts_basenames = \
1168
	$(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst src/%,%,$(myexeclib_SCRIPTS))))
1169

    
1170
EXTRA_DIST = \
1171
	NEWS \
1172
	UPGRADE \
1173
	epydoc.conf.in \
1174
	pylintrc \
1175
	pylintrc-test \
1176
	autotools/build-bash-completion \
1177
	autotools/build-rpc \
1178
	autotools/check-header \
1179
	autotools/check-imports \
1180
	autotools/check-man-dashes \
1181
	autotools/check-man-references \
1182
	autotools/check-man-warnings \
1183
	autotools/check-news \
1184
	autotools/check-python-code \
1185
	autotools/check-tar \
1186
	autotools/check-version \
1187
	autotools/docpp \
1188
	autotools/gen-py-coverage \
1189
	autotools/print-py-constants \
1190
	autotools/sphinx-wrapper \
1191
	autotools/testrunner \
1192
	autotools/wrong-hardcoded-paths \
1193
	$(RUN_IN_TEMPDIR) \
1194
	daemons/daemon-util.in \
1195
	daemons/ganeti-cleaner.in \
1196
	$(pkglib_python_scripts) \
1197
	devel/upload \
1198
	devel/webserver \
1199
	tools/kvm-ifup.in \
1200
	tools/kvm-ifup-os.in \
1201
	tools/vif-ganeti.in \
1202
	tools/net-common.in \
1203
	tools/vcluster-setup.in \
1204
	$(docinput) \
1205
	doc/html \
1206
	$(BUILT_EXAMPLES:%=%.in) \
1207
	doc/examples/ganeti.default \
1208
	doc/examples/ganeti.default-debug \
1209
	doc/examples/hooks/ethers \
1210
	doc/examples/gnt-debug/README \
1211
	doc/examples/gnt-debug/delay0.json \
1212
	doc/examples/gnt-debug/delay50.json \
1213
	doc/users/groupmemberships.in \
1214
	doc/users/groups.in \
1215
	doc/users/users.in \
1216
	$(dist_TESTS) \
1217
	$(TEST_FILES) \
1218
	$(python_test_support) \
1219
	man/footer.rst \
1220
	$(manrst) \
1221
	$(maninput) \
1222
	qa/qa-sample.json \
1223
	$(qa_scripts) \
1224
	$(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS_IN) \
1225
	$(HS_PROG_SRCS) \
1226
	src/lint-hints.hs \
1227
	test/hs/cli-tests-defs.sh \
1228
	test/hs/offline-test.sh \
1229
	.ghci
1230

    
1231
man_MANS = \
1232
	man/ganeti-cleaner.8 \
1233
	man/ganeti-confd.8 \
1234
	man/ganeti-luxid.8 \
1235
	man/ganeti-listrunner.8 \
1236
	man/ganeti-kvmd.8 \
1237
	man/ganeti-masterd.8 \
1238
	man/ganeti-mond.8 \
1239
	man/ganeti-noded.8 \
1240
	man/ganeti-os-interface.7 \
1241
	man/ganeti-extstorage-interface.7 \
1242
	man/ganeti-rapi.8 \
1243
	man/ganeti-watcher.8 \
1244
	man/ganeti.7 \
1245
	man/gnt-backup.8 \
1246
	man/gnt-cluster.8 \
1247
	man/gnt-debug.8 \
1248
	man/gnt-group.8 \
1249
	man/gnt-network.8 \
1250
	man/gnt-instance.8 \
1251
	man/gnt-job.8 \
1252
	man/gnt-node.8 \
1253
	man/gnt-os.8 \
1254
	man/gnt-storage.8 \
1255
	man/hail.1 \
1256
	man/harep.1 \
1257
	man/hbal.1 \
1258
	man/hcheck.1 \
1259
	man/hinfo.1 \
1260
	man/hscan.1 \
1261
	man/hspace.1 \
1262
	man/hsqueeze.1 \
1263
	man/hroller.1 \
1264
	man/htools.1 \
1265
	man/mon-collector.7
1266

    
1267
# Remove extensions from all filenames in man_MANS
1268
mannoext = $(patsubst %.1,%,$(patsubst %.7,%,$(patsubst %.8,%,$(man_MANS))))
1269

    
1270
manrst = $(patsubst %,%.rst,$(mannoext))
1271
manhtml = $(patsubst %.rst,%.html,$(manrst))
1272
mangen = $(patsubst %.rst,%.gen,$(manrst))
1273
maninput = \
1274
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
1275
	$(patsubst %.html,%.html.in,$(manhtml)) \
1276
	$(mangen)
1277

    
1278
manfullpath = $(patsubst man/%.1,man1/%.1,\
1279
	$(patsubst man/%.7,man7/%.7,\
1280
	$(patsubst man/%.8,man8/%.8,$(man_MANS))))
1281

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

    
1438

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

    
1537
python_test_support = \
1538
	test/py/__init__.py \
1539
	test/py/lockperf.py \
1540
	test/py/testutils.py \
1541
	test/py/mocks.py \
1542
	test/py/cmdlib/__init__.py \
1543
	test/py/cmdlib/testsupport/__init__.py \
1544
	test/py/cmdlib/testsupport/cmdlib_testcase.py \
1545
	test/py/cmdlib/testsupport/config_mock.py \
1546
	test/py/cmdlib/testsupport/iallocator_mock.py \
1547
	test/py/cmdlib/testsupport/lock_manager_mock.py \
1548
	test/py/cmdlib/testsupport/netutils_mock.py \
1549
	test/py/cmdlib/testsupport/processor_mock.py \
1550
	test/py/cmdlib/testsupport/rpc_runner_mock.py \
1551
	test/py/cmdlib/testsupport/ssh_mock.py \
1552
	test/py/cmdlib/testsupport/utils_mock.py \
1553
	test/py/cmdlib/testsupport/util.py
1554

    
1555
haskell_tests = test/hs/htest
1556

    
1557
dist_TESTS = \
1558
	test/py/check-cert-expired_unittest.bash \
1559
	test/py/daemon-util_unittest.bash \
1560
	test/py/ganeti-cleaner_unittest.bash \
1561
	test/py/import-export_unittest.bash \
1562
	test/py/cli-test.bash \
1563
	test/py/bash_completion.bash
1564

    
1565
if PY_UNIT
1566
dist_TESTS += $(python_tests)
1567
endif
1568

    
1569
nodist_TESTS =
1570
check_SCRIPTS =
1571

    
1572
if WANT_HSTESTS
1573
nodist_TESTS += $(haskell_tests)
1574
dist_TESTS += test/hs/offline-test.sh
1575
check_SCRIPTS += \
1576
	test/hs/hpc-htools \
1577
	test/hs/hpc-mon-collector \
1578
	$(HS_BUILT_TEST_HELPERS)
1579
endif
1580

    
1581
TESTS = $(dist_TESTS) $(nodist_TESTS)
1582

    
1583
# Environment for all tests
1584
PLAIN_TESTS_ENVIRONMENT = \
1585
	PYTHONPATH=.:./test/py \
1586
	TOP_SRCDIR=$(abs_top_srcdir) TOP_BUILDDIR=$(abs_top_builddir) \
1587
	PYTHON=$(PYTHON) FAKEROOT=$(FAKEROOT_PATH) \
1588
	$(RUN_IN_TEMPDIR)
1589

    
1590
# Environment for tests run by automake
1591
TESTS_ENVIRONMENT = \
1592
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
1593

    
1594
all_python_code = \
1595
	$(dist_sbin_SCRIPTS) \
1596
	$(python_scripts) \
1597
	$(pkglib_python_scripts) \
1598
	$(nodist_pkglib_python_scripts) \
1599
	$(nodist_tools_python_scripts) \
1600
	$(pkgpython_PYTHON) \
1601
	$(client_PYTHON) \
1602
	$(cmdlib_PYTHON) \
1603
	$(hypervisor_PYTHON) \
1604
	$(storage_PYTHON) \
1605
	$(rapi_PYTHON) \
1606
	$(server_PYTHON) \
1607
	$(rpc_PYTHON) \
1608
	$(rpc_stub_PYTHON) \
1609
	$(pytools_PYTHON) \
1610
	$(http_PYTHON) \
1611
	$(confd_PYTHON) \
1612
	$(masterd_PYTHON) \
1613
	$(impexpd_PYTHON) \
1614
	$(utils_PYTHON) \
1615
	$(watcher_PYTHON) \
1616
	$(noinst_PYTHON) \
1617
	$(qa_scripts)
1618

    
1619
if PY_UNIT
1620
all_python_code += $(python_tests)
1621
all_python_code += $(python_test_support)
1622
endif
1623

    
1624
srclink_files = \
1625
	man/footer.rst \
1626
	test/py/check-cert-expired_unittest.bash \
1627
	test/py/daemon-util_unittest.bash \
1628
	test/py/ganeti-cleaner_unittest.bash \
1629
	test/py/import-export_unittest.bash \
1630
	test/py/cli-test.bash \
1631
	test/py/bash_completion.bash \
1632
	test/hs/offline-test.sh \
1633
	test/hs/cli-tests-defs.sh \
1634
	$(all_python_code) \
1635
	$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS) \
1636
	$(docinput)
1637

    
1638
check_python_code = \
1639
	$(BUILD_BASH_COMPLETION) \
1640
	$(CHECK_IMPORTS) \
1641
	$(CHECK_HEADER) \
1642
	$(DOCPP) \
1643
	$(all_python_code)
1644

    
1645
lint_python_code = \
1646
	ganeti \
1647
	ganeti/http/server.py \
1648
	$(dist_sbin_SCRIPTS) \
1649
	$(python_scripts) \
1650
	$(pkglib_python_scripts) \
1651
	$(BUILD_BASH_COMPLETION) \
1652
	$(CHECK_IMPORTS) \
1653
	$(CHECK_HEADER) \
1654
	$(DOCPP) \
1655
	$(gnt_python_sbin_SCRIPTS) \
1656
	$(PYTHON_BOOTSTRAP)
1657

    
1658
standalone_python_modules = \
1659
	lib/rapi/client.py \
1660
	tools/ganeti-listrunner
1661

    
1662
pep8_python_code = \
1663
	ganeti \
1664
	ganeti/http/server.py \
1665
	$(dist_sbin_SCRIPTS) \
1666
	$(python_scripts) \
1667
	$(pkglib_python_scripts) \
1668
	$(BUILD_BASH_COMPLETION) \
1669
	$(CHECK_HEADER) \
1670
	$(DOCPP) \
1671
	$(PYTHON_BOOTSTRAP) \
1672
	$(gnt_python_sbin_SCRIPTS) \
1673
	qa \
1674
	$(python_test_support)
1675

    
1676
test/py/daemon-util_unittest.bash: daemons/daemon-util
1677

    
1678
test/py/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
1679

    
1680
test/py/bash_completion.bash: doc/examples/bash_completion-debug
1681

    
1682
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
1683
	sed -f $(REPLACE_VARS_SED) < $< > $@
1684
	chmod +x $@
1685

    
1686
tools/kvm-ifup-os: tools/kvm-ifup-os.in $(REPLACE_VARS_SED)
1687
	sed -f $(REPLACE_VARS_SED) < $< > $@
1688
	chmod +x $@
1689

    
1690
tools/vif-ganeti: tools/vif-ganeti.in $(REPLACE_VARS_SED)
1691
	sed -f $(REPLACE_VARS_SED) < $< > $@
1692
	chmod +x $@
1693

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

    
1698
tools/users-setup: Makefile $(userspecs)
1699
	set -e; \
1700
	{ echo '#!/bin/sh'; \
1701
	  echo 'if [ "x$$1" != "x--yes-do-it" ];'; \
1702
	  echo 'then echo "This will do the following changes"'; \
1703
	  $(AWK) -- '{print "echo + Will add group ",$$1; count++}\
1704
	             END {if (count == 0) {print "echo + No groups to add"}}' doc/users/groups; \
1705
	  $(AWK) -- '{if (NF > 1) {print "echo + Will add user",$$1,"with primary group",$$2} \
1706
	                          else {print "echo + Will add user",$$1}; count++}\
1707
	             END {if (count == 0) {print "echo + No users to add"}}' doc/users/users; \
1708
	  $(AWK) -- '{print "echo + Will add user",$$1,"to group",$$2}' doc/users/groupmemberships; \
1709
	  echo 'echo'; \
1710
	  echo 'echo "OK? (y/n)"'; \
1711
	  echo 'read confirm'; \
1712
	  echo 'if [ "x$$confirm" != "xy" ]; then exit 0; fi'; \
1713
	  echo 'fi'; \
1714
	  $(AWK) -- '{print "addgroup --system",$$1}' doc/users/groups; \
1715
	  $(AWK) -- '{if (NF > 1) {print "adduser --system --ingroup",$$2,$$1} else {print "adduser --system",$$1}}' doc/users/users; \
1716
	  $(AWK) -- '{print "adduser",$$1,$$2}' doc/users/groupmemberships; \
1717
	} > $@
1718
	chmod +x $@
1719

    
1720
tools/vcluster-setup: tools/vcluster-setup.in $(REPLACE_VARS_SED)
1721
	sed -f $(REPLACE_VARS_SED) < $< > $@
1722
	chmod +x $@
1723

    
1724
daemons/%:: daemons/%.in $(REPLACE_VARS_SED)
1725
	sed -f $(REPLACE_VARS_SED) < $< > $@
1726
	chmod +x $@
1727

    
1728
doc/examples/%:: doc/examples/%.in $(REPLACE_VARS_SED)
1729
	sed -f $(REPLACE_VARS_SED) < $< > $@
1730

    
1731
doc/examples/bash_completion: BC_ARGS = --compact
1732
doc/examples/bash_completion-debug: BC_ARGS =
1733

    
1734
doc/examples/bash_completion doc/examples/bash_completion-debug: \
1735
	$(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
1736
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin \
1737
	daemons/ganeti-cleaner \
1738
	$(GENERATED_FILES) $(HS_GENERATED_FILES)
1739
	PYTHONPATH=. $(RUN_IN_TEMPDIR) \
1740
	  $(CURDIR)/$(BUILD_BASH_COMPLETION) $(BC_ARGS) > $@
1741

    
1742
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py \
1743
	lib/build/shell_example_lexer.py \
1744
	| $(RUN_IN_TEMPDIR) $(built_python_sources)
1745
	@echo "Checking $< for hardcoded paths..."
1746
	@if grep -nEf autotools/wrong-hardcoded-paths $<; then \
1747
	  echo "Man page $< has hardcoded paths (see above)!" 1>&2 ; \
1748
	  exit 1; \
1749
	fi
1750
	set -e ; \
1751
	trap 'echo auto-removing $@; rm $@' EXIT; \
1752
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@ ;\
1753
	$(CHECK_MAN_REFERENCES) $@; \
1754
	trap - EXIT
1755

    
1756
man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.rst
1757
	@test -n "$(PANDOC)" || \
1758
	  { echo 'pandoc' not found during configure; exit 1; }
1759
	set -o pipefail -e; \
1760
	trap 'echo auto-removing $@; rm $@' EXIT; \
1761
	$(PANDOC) -s -f rst -t man $< man/footer.rst | \
1762
	  sed -e 's/\\@/@/g' > $@; \
1763
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN_WARNINGS) $@; fi; \
1764
	$(CHECK_MAN_DASHES) $@; \
1765
	trap - EXIT
1766

    
1767
man/%.html.in: man/%.gen man/footer.rst
1768
	@test -n "$(PANDOC)" || \
1769
	  { echo 'pandoc' not found during configure; exit 1; }
1770
	set -o pipefail ; \
1771
	$(PANDOC) --toc -s -f rst -t html $< man/footer.rst | \
1772
	  sed -e 's/\\@/@/g' > $@
1773

    
1774
man/%: man/%.in  $(REPLACE_VARS_SED)
1775
	sed -f $(REPLACE_VARS_SED) < $< > $@
1776

    
1777
epydoc.conf: epydoc.conf.in $(REPLACE_VARS_SED)
1778
	sed -f $(REPLACE_VARS_SED) < $< > $@
1779

    
1780
vcs-version:
1781
	if test -d .git; then \
1782
	  git describe > $@; \
1783
	elif test ! -f $@ ; then \
1784
	  echo "Cannot auto-generate $@ file"; exit 1; \
1785
	fi
1786

    
1787
.PHONY: clean-vcs-version
1788
clean-vcs-version:
1789
	rm -f vcs-version
1790

    
1791
.PHONY: regen-vcs-version
1792
regen-vcs-version:
1793
	@set -e; \
1794
	cd $(srcdir); \
1795
	if test -d .git; then \
1796
	  T=`mktemp` ; trap 'rm -f $$T' EXIT; \
1797
	  git describe > $$T; \
1798
	  if ! cmp --quiet $$T vcs-version; then \
1799
	    mv $$T vcs-version; \
1800
	  fi; \
1801
	fi
1802

    
1803
src/Ganeti/Version.hs: src/Ganeti/Version.hs.in \
1804
	vcs-version $(built_base_sources)
1805
	set -e; \
1806
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
1807
	sed -e "s/%ver%/$$VCSVER/" < $< > $@
1808

    
1809
src/Ganeti/Hs2Py/ListConstants.hs: src/Ganeti/Hs2Py/ListConstants.hs.in \
1810
				   src/Ganeti/Constants.hs \
1811
			         | stamp-directories
1812
	@echo Generating $@
1813
	@set -e; \
1814
## Extract constant names from 'Constants.hs' by extracting the left
1815
## side of all lines containing an equal sign (i.e., '=') and
1816
## prepending the apostrophe sign (i.e., "'").
1817
##
1818
## For example, the constant
1819
##   adminstDown = ...
1820
## becomes
1821
##   'adminstDown
1822
	NAMES=$$(sed -e "/^--/ d" $(abs_top_srcdir)/src/Ganeti/Constants.hs |\
1823
		 sed -n -e "/=/ s/\(.*\) =.*/    '\1:/g p"); \
1824
	m4 -DPY_CONSTANT_NAMES="$$NAMES" $(abs_top_srcdir)/$< > $@
1825

    
1826
src/Ganeti/Curl/Internal.hs: src/Ganeti/Curl/Internal.hsc | stamp-directories
1827
	hsc2hs -o $@ $<
1828

    
1829
test/hs/Test/Ganeti/TestImports.hs: test/hs/Test/Ganeti/TestImports.hs.in \
1830
	$(built_base_sources)
1831
	set -e; \
1832
	{ cat $< ; \
1833
	  echo ; \
1834
	  for name in $(filter-out Ganeti.THH,$(subst /,.,$(patsubst %.hs,%,$(patsubst src/%,%,$(HS_LIB_SRCS))))) ; do \
1835
	    echo "import $$name ()" ; \
1836
	  done ; \
1837
	} > $@
1838

    
1839
lib/_constants.py: Makefile src/hs2py lib/_constants.py.in | stamp-directories
1840
	cat $(abs_top_srcdir)/lib/_constants.py.in > $@
1841
	src/hs2py --constants >> $@
1842

    
1843
lib/constants.py: lib/_constants.py
1844

    
1845
src/AutoConf.hs: Makefile src/AutoConf.hs.in $(PRINT_PY_CONSTANTS) \
1846
	       | $(built_base_sources)
1847
	@echo "m4 ... >" $@
1848
	@m4 -DPACKAGE_VERSION="$(PACKAGE_VERSION)" \
1849
	    -DVERSION_MAJOR="$(VERSION_MAJOR)" \
1850
	    -DVERSION_MINOR="$(VERSION_MINOR)" \
1851
	    -DVERSION_REVISION="$(VERSION_REVISION)" \
1852
	    -DVERSION_SUFFIX="$(VERSION_SUFFIX)" \
1853
	    -DVERSION_FULL="$(VERSION_FULL)" \
1854
	    -DDIRVERSION="$(DIRVERSION)" \
1855
	    -DLOCALSTATEDIR="$(localstatedir)" \
1856
	    -DSYSCONFDIR="$(sysconfdir)" \
1857
	    -DSSH_CONFIG_DIR="$(SSH_CONFIG_DIR)" \
1858
	    -DSSH_LOGIN_USER="$(SSH_LOGIN_USER)" \
1859
	    -DSSH_CONSOLE_USER="$(SSH_CONSOLE_USER)" \
1860
	    -DEXPORT_DIR="$(EXPORT_DIR)" \
1861
	    -DOS_SEARCH_PATH="\"$(OS_SEARCH_PATH)\"" \
1862
	    -DES_SEARCH_PATH="\"$(ES_SEARCH_PATH)\"" \
1863
	    -DXEN_BOOTLOADER="$(XEN_BOOTLOADER)" \
1864
	    -DXEN_CONFIG_DIR="$(XEN_CONFIG_DIR)" \
1865
	    -DXEN_KERNEL="$(XEN_KERNEL)" \
1866
	    -DXEN_INITRD="$(XEN_INITRD)" \
1867
	    -DKVM_KERNEL="$(KVM_KERNEL)" \
1868
	    -DSHARED_FILE_STORAGE_DIR="$(SHARED_FILE_STORAGE_DIR)" \
1869
	    -DIALLOCATOR_SEARCH_PATH="\"$(IALLOCATOR_SEARCH_PATH)\"" \
1870
	    -DKVM_PATH="$(KVM_PATH)" \
1871
	    -DIP_PATH="$(IP_PATH)" \
1872
	    -DSOCAT_PATH="$(SOCAT)" \
1873
	    -DSOCAT_USE_ESCAPE="$(SOCAT_USE_ESCAPE)" \
1874
	    -DSOCAT_USE_COMPRESS="$(SOCAT_USE_COMPRESS)" \
1875
	    -DLVM_STRIPECOUNT="$(LVM_STRIPECOUNT)" \
1876
	    -DTOOLSDIR="$(libdir)/ganeti/tools" \
1877
	    -DGNT_SCRIPTS="$(foreach i,$(notdir $(gnt_scripts)),\"$(i)\":)" \
1878
	    -DHS_HTOOLS_PROGS="$(foreach i,$(HS_HTOOLS_PROGS),\"$(i)\":)" \
1879
	    -DPKGLIBDIR="$(libdir)/ganeti" \
1880
	    -DSHAREDIR="$(prefix)/share/ganeti" \
1881
	    -DVERSIONEDSHAREDIR="$(versionedsharedir)" \
1882
	    -DDRBD_BARRIERS="$(DRBD_BARRIERS)" \
1883
	    -DDRBD_NO_META_FLUSH="$(DRBD_NO_META_FLUSH)" \
1884
	    -DSYSLOG_USAGE="$(SYSLOG_USAGE)" \
1885
	    -DDAEMONS_GROUP="$(DAEMONS_GROUP)" \
1886
	    -DADMIN_GROUP="$(ADMIN_GROUP)" \
1887
	    -DMASTERD_USER="$(MASTERD_USER)" \
1888
	    -DMASTERD_GROUP="$(MASTERD_GROUP)" \
1889
	    -DMETAD_USER="$(METAD_USER)" \
1890
	    -DMETAD_GROUP="$(METAD_GROUP)" \
1891
	    -DRAPI_USER="$(RAPI_USER)" \
1892
	    -DRAPI_GROUP="$(RAPI_GROUP)" \
1893
	    -DCONFD_USER="$(CONFD_USER)" \
1894
	    -DCONFD_GROUP="$(CONFD_GROUP)" \
1895
	    -DWCONFD_USER="$(WCONFD_USER)" \
1896
	    -DWCONFD_GROUP="$(WCONFD_GROUP)" \
1897
	    -DKVMD_USER="$(KVMD_USER)" \
1898
	    -DKVMD_GROUP="$(KVMD_GROUP)" \
1899
	    -DLUXID_USER="$(LUXID_USER)" \
1900
	    -DLUXID_GROUP="$(LUXID_GROUP)" \
1901
	    -DNODED_USER="$(NODED_USER)" \
1902
	    -DNODED_GROUP="$(NODED_GROUP)" \
1903
	    -DMOND_USER="$(MOND_USER)" \
1904
	    -DMOND_GROUP="$(MOND_GROUP)" \
1905
	    -DDISK_SEPARATOR="$(DISK_SEPARATOR)" \
1906
	    -DQEMUIMG_PATH="$(QEMUIMG_PATH)" \
1907
	    -DENABLE_CONFD="$(ENABLE_CONFD)" \
1908
	    -DXEN_CMD="$(XEN_CMD)" \
1909
	    -DENABLE_RESTRICTED_COMMANDS="$(ENABLE_RESTRICTED_COMMANDS)" \
1910
	    -DENABLE_MOND="$(ENABLE_MOND)" \
1911
	    -DHAS_GNU_LN="$(HAS_GNU_LN)" \
1912
	    -DMAN_PAGES="$$(for i in $(notdir $(man_MANS)); do \
1913
	                    echo -n "$$i" | sed -re 's/^(.*)\.([0-9]+)$$/("\1",\2):/g'; \
1914
	                    done)" \
1915
	    -DAF_INET4="$$(PYTHONPATH=. python $(PRINT_PY_CONSTANTS) AF_INET4)" \
1916
	    -DAF_INET6="$$(PYTHONPATH=. python $(PRINT_PY_CONSTANTS) AF_INET6)" \
1917
	$(abs_top_srcdir)/src/AutoConf.hs.in > $@
1918

    
1919
lib/_vcsversion.py: Makefile vcs-version | stamp-directories
1920
	set -e; \
1921
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
1922
	{ echo '# This file is automatically generated, do not edit!'; \
1923
	  echo '#'; \
1924
	  echo ''; \
1925
	  echo '"""Build-time VCS version number for Ganeti.'; \
1926
	  echo '';\
1927
	  echo 'This file is autogenerated by the build process.'; \
1928
	  echo 'For any changes you need to re-run ./configure (and'; \
1929
	  echo 'not edit by hand).'; \
1930
	  echo ''; \
1931
	  echo '"""'; \
1932
	  echo ''; \
1933
	  echo '# pylint: disable=C0301,C0324'; \
1934
	  echo '# because this is autogenerated, we do not want'; \
1935
	  echo '# style warnings' ; \
1936
	  echo ''; \
1937
	  echo "VCS_VERSION = '$$VCSVER'"; \
1938
	} > $@
1939

    
1940
lib/opcodes.py: Makefile src/hs2py lib/opcodes.py.in_before \
1941
		lib/opcodes.py.in_after | stamp-directories
1942
	cat $(abs_top_srcdir)/lib/opcodes.py.in_before > $@
1943
	src/hs2py --opcodes >> $@
1944
	cat $(abs_top_srcdir)/lib/opcodes.py.in_after >> $@
1945

    
1946
lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC)
1947
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
1948

    
1949
lib/rpc/stub/wconfd.py: Makefile src/hs2py | stamp-directories
1950
	src/hs2py --wconfd-rpc > $@
1951

    
1952
$(SHELL_ENV_INIT): Makefile stamp-directories
1953
	set -e; \
1954
	{ echo '# Allow overriding for tests'; \
1955
	  echo 'readonly LOCALSTATEDIR=$${LOCALSTATEDIR:-$${GANETI_ROOTDIR:-}$(localstatedir)}'; \
1956
	  echo 'readonly SYSCONFDIR=$${SYSCONFDIR:-$${GANETI_ROOTDIR:-}$(sysconfdir)}'; \
1957
	  echo; \
1958
	  echo 'readonly PKGLIBDIR=$(libdir)/ganeti'; \
1959
	  echo 'readonly LOG_DIR="$$LOCALSTATEDIR/log/ganeti"'; \
1960
	  echo 'readonly RUN_DIR="$$LOCALSTATEDIR/run/ganeti"'; \
1961
	  echo 'readonly DATA_DIR="$$LOCALSTATEDIR/lib/ganeti"'; \
1962
	  echo 'readonly CONF_DIR="$$SYSCONFDIR/ganeti"'; \
1963
	} > $@
1964

    
1965
## Writes sed script to replace placeholders with build-time values. The
1966
## additional quotes after the first @ sign are necessary to stop configure
1967
## from replacing those values as well.
1968
$(REPLACE_VARS_SED): $(SHELL_ENV_INIT) Makefile stamp-directories
1969
	set -e; \
1970
	{ echo 's#@''PREFIX@#$(prefix)#g'; \
1971
	  echo 's#@''SYSCONFDIR@#$(sysconfdir)#g'; \
1972
	  echo 's#@''LOCALSTATEDIR@#$(localstatedir)#g'; \
1973
	  echo 's#@''BINDIR@#$(BINDIR)#g'; \
1974
	  echo 's#@''SBINDIR@#$(SBINDIR)#g'; \
1975
	  echo 's#@''LIBDIR@#$(libdir)#g'; \
1976
	  echo 's#@''GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
1977
	  echo 's#@''CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
1978
	  echo 's#@''CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
1979
	  echo 's#@''CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
1980
	  echo 's#@''CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
1981
	  echo 's#@''CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
1982
	  echo 's#@''RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
1983
	  echo 's#@''PKGLIBDIR@#$(libdir)/ganeti#g'; \
1984
	  echo 's#@''GNTMASTERUSER@#$(MASTERD_USER)#g'; \
1985
	  echo 's#@''GNTRAPIUSER@#$(RAPI_USER)#g'; \
1986
	  echo 's#@''GNTCONFDUSER@#$(CONFD_USER)#g'; \
1987
	  echo 's#@''GNTWCONFDUSER@#$(WCONFD_USER)#g'; \
1988
	  echo 's#@''GNTLUXIDUSER@#$(LUXID_USER)#g'; \
1989
	  echo 's#@''GNTNODEDUSER@#$(NODED_USER)#g'; \
1990
	  echo 's#@''GNTMONDUSER@#$(MOND_USER)#g'; \
1991
	  echo 's#@''GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
1992
	  echo 's#@''GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
1993
	  echo 's#@''GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
1994
	  echo 's#@''GNTNODEDGROUP@#$(NODED_GROUP)#g'; \
1995
	  echo 's#@''GNTWCONFDGROUP@#$(CONFD_GROUP)#g'; \
1996
	  echo 's#@''GNTLUXIDGROUP@#$(LUXID_GROUP)#g'; \
1997
	  echo 's#@''GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
1998
	  echo 's#@''GNTMONDGROUP@#$(MOND_GROUP)#g'; \
1999
	  echo 's#@''GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
2000
	  echo 's#@''CUSTOM_ENABLE_CONFD@#$(ENABLE_CONFD)#g'; \
2001
	  echo 's#@''CUSTOM_ENABLE_MOND@#$(ENABLE_MOND)#g'; \
2002
	  echo 's#@''MODULES@#$(strip $(lint_python_code))#g'; \
2003
	  echo 's#@''XEN_CONFIG_DIR@#$(XEN_CONFIG_DIR)#g'; \
2004
	  echo; \
2005
	  echo '/^@SHELL_ENV_INIT@$$/ {'; \
2006
	  echo '  r $(SHELL_ENV_INIT)'; \
2007
	  echo '  d'; \
2008
	  echo '}'; \
2009
	} > $@
2010

    
2011
# Using deferred evaluation
2012
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
2013
daemons/ganeti-watcher: MODULE = ganeti.watcher
2014
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
2015
tools/burnin: MODULE = ganeti.tools.burnin
2016
tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
2017
tools/node-daemon-setup: MODULE = ganeti.tools.node_daemon_setup
2018
tools/prepare-node-join: MODULE = ganeti.tools.prepare_node_join
2019
tools/node-cleanup: MODULE = ganeti.tools.node_cleanup
2020
$(HS_BUILT_TEST_HELPERS): TESTROLE = $(patsubst test/hs/%,%,$@)
2021

    
2022
$(PYTHON_BOOTSTRAP) $(gnt_scripts) $(gnt_python_sbin_SCRIPTS): Makefile | stamp-directories
2023
	test -n "$(MODULE)" || { echo Missing module; exit 1; }
2024
	set -e; \
2025
	{ echo '#!/usr/bin/python'; \
2026
	  echo '# This file is automatically generated, do not edit!'; \
2027
	  echo "# Edit $(MODULE) instead."; \
2028
	  echo; \
2029
	  echo '"""Bootstrap script for L{$(MODULE)}"""'; \
2030
	  echo; \
2031
	  echo '# pylint: disable=C0103'; \
2032
	  echo '# C0103: Invalid name'; \
2033
	  echo; \
2034
	  echo 'import sys'; \
2035
	  echo 'import $(MODULE) as main'; \
2036
	  echo; \
2037
	  echo '# Temporarily alias commands until bash completion'; \
2038
	  echo '# generator is changed'; \
2039
	  echo 'if hasattr(main, "commands"):'; \
2040
	  echo '  commands = main.commands # pylint: disable=E1101'; \
2041
	  echo 'if hasattr(main, "aliases"):'; \
2042
	  echo '  aliases = main.aliases # pylint: disable=E1101'; \
2043
	  echo; \
2044
	  echo 'if __name__ == "__main__":'; \
2045
	  echo '  sys.exit(main.Main())'; \
2046
	} > $@
2047
	chmod u+x $@
2048

    
2049
$(HS_BUILT_TEST_HELPERS): Makefile
2050
	@test -n "$(TESTROLE)" || { echo Missing TESTROLE; exit 1; }
2051
	set -e; \
2052
	{ echo '#!/bin/sh'; \
2053
	  echo '# This file is automatically generated, do not edit!'; \
2054
	  echo "# Edit Makefile.am instead."; \
2055
	  echo; \
2056
	  echo "HTOOLS=$(TESTROLE) exec ./test/hs/hpc-htools \"\$$@\""; \
2057
	} > $@
2058
	chmod u+x $@
2059

    
2060
stamp-directories: Makefile
2061
	$(MAKE) $(AM_MAKEFLAGS) ganeti
2062
	@mkdir_p@ $(DIRS) $(BUILDTIME_DIR_AUTOCREATE)
2063
	touch $@
2064

    
2065
# We need to create symlinks because "make distcheck" will not install Python
2066
# files when building.
2067
stamp-srclinks: Makefile | stamp-directories
2068
	set -e; \
2069
	for i in $(srclink_files); do \
2070
	  if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
2071
	    $(LN_S) $(abs_top_srcdir)/$$i $$i; \
2072
	  fi; \
2073
	done
2074
	touch $@
2075

    
2076
.PHONY: ganeti
2077
ganeti:
2078
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
2079

    
2080
.PHONY: check-dirs
2081
check-dirs: $(GENERATED_FILES)
2082
	@set -e; \
2083
	find . -type d \( -name . -o -name .git -prune -o -print \) | { \
2084
	  error=; \
2085
	  while read dir; do \
2086
	    case "$$dir" in \
2087
	      $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
2088
	      *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
2089
	    esac; \
2090
	  done; \
2091
	  for dir in $(DIRS); do \
2092
	    if ! test -d "$$dir"; then \
2093
	      echo "Directory $$dir listed in DIRS does not exist" >&2; \
2094
	      error=1; \
2095
	    fi \
2096
	  done; \
2097
	  test -z "$$error"; \
2098
	}
2099

    
2100
.PHONY: check-news
2101
check-news:
2102
	RELEASE=$(PACKAGE_VERSION) $(CHECK_NEWS) < $(top_srcdir)/NEWS
2103

    
2104
.PHONY: check-local
2105
check-local: check-dirs check-news $(GENERATED_FILES)
2106
	$(CHECK_PYTHON_CODE) $(check_python_code)
2107
	PYTHONPATH=. $(CHECK_HEADER) $(check_python_code)
2108
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
2109
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CHECK_IMPORTS) . $(standalone_python_modules)
2110
	error= ; \
2111
	if [ "x`echo $(VERSION_SUFFIX)|grep 'alpha'`" == "x" ]; then \
2112
	  expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
2113
	  if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
2114
	    echo "Incorrect version in README, expected $$expver" >&2; \
2115
	    error=1; \
2116
	  fi; \
2117
	  for file in doc/iallocator.rst doc/hooks.rst doc/virtual-cluster.rst \
2118
	      doc/security.rst; do \
2119
	    if test "`sed -ne '4 p' $(top_srcdir)/$$file`" != \
2120
	      "Documents Ganeti version $$expver"; then \
2121
	      echo "Incorrect version in $$file, expected $$expver" >&2; \
2122
	      error=1; \
2123
	    fi; \
2124
	  done; \
2125
	  if ! test -f $(top_srcdir)/doc/design-$$expver.rst; then \
2126
	    echo "File $(top_srcdir)/doc/design-$$expver.rst not found" >&2; \
2127
	    error=1; \
2128
	  fi; \
2129
	  if test "`sed -ne '5 p' $(top_srcdir)/doc/design-draft.rst`" != \
2130
	    ".. Last updated for Ganeti $$expver"; then \
2131
	    echo "doc/design-draft.rst was not updated for version $$expver" >&2; \
2132
	    error=1; \
2133
	  fi; \
2134
	fi; \
2135
	for file in configure.ac $(HS_LIBTEST_SRCS) $(HS_PROG_SRCS); do \
2136
	  if test $$(wc --max-line-length < $(top_srcdir)/$$file) -gt 80; then \
2137
	    echo "Longest line in $$file is longer than 80 characters" >&2; \
2138
	    error=1; \
2139
	  fi; \
2140
	done; \
2141
	test -z "$$error"
2142

    
2143
.PHONY: hs-test-%
2144
hs-test-%: test/hs/htest
2145
	@rm -f htest.tix
2146
	test/hs/htest -t $*
2147

    
2148
.PHONY: hs-tests
2149
hs-tests: test/hs/htest
2150
	@rm -f htest.tix
2151
	./test/hs/htest
2152

    
2153
.PHONY: hs-shell-%
2154
hs-shell-%: test/hs/hpc-htools test/hs/hpc-mon-collector \
2155
            $(HS_BUILT_TEST_HELPERS)
2156
	@rm -f hpc-htools.tix hpc-mon-collector.tix
2157
	HBINARY="./test/hs/hpc-htools" \
2158
	SHELLTESTARGS=$(SHELLTESTARGS) \
2159
	./test/hs/offline-test.sh $*
2160

    
2161
.PHONY: hs-shell
2162
hs-shell: test/hs/hpc-htools test/hs/hpc-mon-collector $(HS_BUILT_TEST_HELPERS)
2163
	@rm -f hpc-htools.tix hpc-mon-collector.tix
2164
	HBINARY="./test/hs/hpc-htools" \
2165
	SHELLTESTARGS=$(SHELLTESTARGS) \
2166
	./test/hs/offline-test.sh
2167

    
2168
.PHONY: hs-check
2169
hs-check: hs-tests hs-shell
2170

    
2171
# E111: indentation is not a multiple of four
2172
# E121: continuation line indentation is not a multiple of four
2173
#       (since our indent level is not 4)
2174
# E125: continuation line does not distinguish itself from next logical line
2175
#       (since our indent level is not 4)
2176
# E123: closing bracket does not match indentation of opening bracket's line
2177
# E127: continuation line over-indented for visual indent
2178
#       (since our indent level is not 4)
2179
# note: do NOT add E128 here; it's a valid style error in most cases!
2180
# I've seen real errors, but also some cases were we indent wrongly
2181
# due to line length; try to rework the cases where it is triggered,
2182
# instead of silencing it
2183
# E261: at least two spaces before inline comment
2184
# E501: line too long (80 characters)
2185
PEP8_IGNORE = E111,E121,E123,E125,E127,E261,E501
2186

    
2187
# For excluding pep8 expects filenames only, not whole paths
2188
PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(built_python_sources))))
2189

    
2190
LINT_TARGETS = pylint pylint-qa pylint-test
2191
if HAS_PEP8
2192
LINT_TARGETS += pep8
2193
endif
2194
if HAS_HLINT
2195
LINT_TARGETS += hlint
2196
endif
2197

    
2198
.PHONY: lint
2199
lint: $(LINT_TARGETS)
2200

    
2201
.PHONY: pylint
2202
pylint: $(GENERATED_FILES)
2203
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2204
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
2205

    
2206
.PHONY: pylint-qa
2207
pylint-qa: $(GENERATED_FILES)
2208
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2209
	cd $(top_srcdir)/qa && \
2210
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
2211
	  --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
2212
# FIXME: lint all test code, not just the newly added test support
2213
pylint-test: $(GENERATED_FILES)
2214
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2215
	cd $(top_srcdir) && \
2216
		PYTHONPATH=.:./test/py $(PYLINT) $(LINT_OPTS) \
2217
		--rcfile=pylintrc-test  $(python_test_support)
2218

    
2219
.PHONY: pep8
2220
pep8: $(GENERATED_FILES)
2221
	@test -n "$(PEP8)" || { echo 'pep8' not found during configure; exit 1; }
2222
	$(PEP8) --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
2223
	  --repeat $(pep8_python_code)
2224

    
2225
# FIXME: remove ignore "Use void" when GHC 6.x is deprecated
2226
HLINT_EXCLUDES = src/Ganeti/THH.hs test/hs/hpc-htools.hs
2227
.PHONY: hlint
2228
hlint: $(HS_BUILT_SRCS) src/lint-hints.hs
2229
	@test -n "$(HLINT)" || { echo 'hlint' not found during configure; exit 1; }
2230
	@rm -f doc/hs-lint.html
2231
	if tty -s; then C="-c"; else C=""; fi; \
2232
	$(HLINT) --utf8 --report=doc/hs-lint.html --cross $$C \
2233
	  --ignore "Use first" \
2234
	  --ignore "Use &&&" \
2235
	  --ignore "Use void" \
2236
	  --ignore "Reduce duplication" \
2237
	  --hint src/lint-hints \
2238
	  $(filter-out $(HLINT_EXCLUDES),$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS))
2239
	@if [ ! -f doc/hs-lint.html ]; then \
2240
	  echo "All good" > doc/hs-lint.html; \
2241
	fi
2242

    
2243
# a dist hook rule for updating the vcs-version file; this is
2244
# hardcoded due to where it needs to build the file...
2245
dist-hook:
2246
	$(MAKE) $(AM_MAKEFLAGS) regen-vcs-version
2247
	rm -f $(top_distdir)/vcs-version
2248
	cp -p $(srcdir)/vcs-version $(top_distdir)
2249

    
2250
# a distcheck hook rule for catching revision control directories
2251
distcheck-hook:
2252
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
2253
	  echo "Found revision control files in final archive." 1>&2; \
2254
	  exit 1; \
2255
	fi
2256
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
2257
	  echo "Found Python byte code in final archive." 1>&2; \
2258
	  exit 1; \
2259
	fi
2260
	if find $(top_distdir) -name '*~' | grep .; then \
2261
	  echo "Found backup files in final archive." 1>&2; \
2262
	  exit 1; \
2263
	fi
2264
# Empty files or directories should not be distributed. They can cause
2265
# unnecessary warnings for packagers. Directories used by automake during
2266
# distcheck must be excluded.
2267
	if find $(top_distdir) -empty -and -not \( \
2268
	    -path $(top_distdir)/_build -or \
2269
	    -path $(top_distdir)/_inst \) | grep .; then \
2270
	  echo "Found empty files or directories in final archive." 1>&2; \
2271
	  exit 1; \
2272
	fi
2273
	if test -e $(top_distdir)/doc/man-html; then \
2274
	  echo "Found documentation including man pages in final archive" >&2; \
2275
	  exit 1; \
2276
	fi
2277

    
2278
# Backwards compatible distcheck-release target
2279
distcheck-release: distcheck
2280

    
2281
distrebuildcheck: dist
2282
	set -e; \
2283
	builddir=$$(mktemp -d $(abs_srcdir)/distrebuildcheck.XXXXXXX); \
2284
	trap "echo Removing $$builddir; cd $(abs_srcdir); rm -rf $$builddir" EXIT; \
2285
	cd $$builddir; \
2286
	tar xzf $(abs_srcdir)/$(distdir).tar.gz; \
2287
	cd $(distdir); \
2288
	./configure; \
2289
	$(MAKE) maintainer-clean; \
2290
	cp $(abs_srcdir)/vcs-version .; \
2291
	./configure; \
2292
	$(MAKE) $(AM_MAKEFLAGS)
2293

    
2294
dist-release: dist
2295
	set -e; \
2296
	for i in $(DIST_ARCHIVES); do \
2297
	  echo -n "Checking $$i ... "; \
2298
	  autotools/check-tar < $$i; \
2299
	  echo OK; \
2300
	done
2301

    
2302
install-exec-local:
2303
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
2304
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
2305
	  "$(DESTDIR)${localstatedir}/run/ganeti"
2306
	for dir in $(SYMLINK_TARGET_DIRS); do \
2307
	  @mkdir_p@  $(DESTDIR)$$dir; \
2308
	done
2309
	$(LN_S) -f $(sysconfdir)/ganeti/lib $(DESTDIR)$(defaultversiondir)
2310
	$(LN_S) -f $(sysconfdir)/ganeti/share $(DESTDIR)$(defaultversionedsharedir)
2311
	for prog in $(HS_BIN_ROLES); do \
2312
	  $(LN_S) -f $(defaultversiondir)$(BINDIR)/$$prog $(DESTDIR)$(BINDIR)/$$prog; \
2313
	done
2314
	$(LN_S) -f $(defaultversiondir)$(libdir)/ganeti/iallocators/hail $(DESTDIR)$(libdir)/ganeti/iallocators/hail
2315
	for prog in $(all_sbin_scripts); do \
2316
	  $(LN_S) -f $(defaultversiondir)$(SBINDIR)/$$prog $(DESTDIR)$(SBINDIR)/$$prog; \
2317
	done
2318
	for prog in $(gnt_scripts_basenames); do \
2319
	  $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(SBINDIR)/$$prog; \
2320
	done
2321
	for prog in $(pkglib_python_basenames); do \
2322
	  $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(libdir)/ganeti/$$prog; \
2323
	done
2324
	for prog in $(tools_python_basenames); do \
2325
	  $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(libdir)/ganeti/tools/$$prog; \
2326
	done
2327
	for prog in $(tools_basenames); do \
2328
	  $(LN_S) -f $(defaultversiondir)/$(libdir)/ganeti/tools/$$prog $(DESTDIR)$(libdir)/ganeti/tools/$$prog; \
2329
	done
2330
	if ! test -n '$(ENABLE_MANPAGES)'; then \
2331
	  for man in $(manfullpath); do \
2332
	    $(LN_S) -f $(defaultversionedsharedir)/root$(MANDIR)/$$man $(DESTDIR)$(MANDIR)/$$man; \
2333
	  done; \
2334
	fi
2335
	for prog in $(myexeclib_scripts_basenames); do \
2336
	  $(LN_S) -f $(defaultversiondir)$(libdir)/ganeti/$$prog $(DESTDIR)$(libdir)/ganeti/$$prog; \
2337
	done
2338
if INSTALL_SYMLINKS
2339
	$(LN_S) -f $(versionedsharedir) $(DESTDIR)$(sysconfdir)/ganeti/share
2340
	$(LN_S) -f $(versiondir) $(DESTDIR)$(sysconfdir)/ganeti/lib
2341
endif
2342

    
2343
.PHONY: apidoc
2344
if WANT_HSAPIDOC
2345
apidoc: py-apidoc hs-apidoc
2346
else
2347
apidoc: py-apidoc
2348
endif
2349

    
2350
.PHONY: py-apidoc
2351
py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(GENERATED_FILES)
2352
	env - PATH="$$PATH" PYTHONPATH="$$PYTHONPATH" \
2353
	$(RUN_IN_TEMPDIR) epydoc -v \
2354
	  --conf $(CURDIR)/epydoc.conf \
2355
	  --output $(CURDIR)/$(APIDOC_PY_DIR)
2356

    
2357
.PHONY: hs-apidoc
2358
hs-apidoc: $(APIDOC_HS_DIR)/index.html
2359

    
2360
$(APIDOC_HS_DIR)/index.html: $(HS_LIBTESTBUILT_SRCS) Makefile
2361
	@test -n "$(HSCOLOUR)" || \
2362
	    { echo 'HsColour' not found during configure; exit 1; }
2363
	@test -n "$(HADDOCK)" || \
2364
	    { echo 'haddock' not found during configure; exit 1; }
2365
	rm -rf $(APIDOC_HS_DIR)/*
2366
	for i in $(ALL_APIDOC_HS_DIRS); do \
2367
	  @mkdir_p@ $$i; \
2368
	  $(HSCOLOUR) -print-css > $$i/hscolour.css; \
2369
	done
2370
	set -e ; \
2371
	export LC_ALL=en_US.UTF-8; \
2372
	OPTGHC="--optghc=-isrc --optghc=-itest/hs"; \
2373
	if [ "$(HS_PARALLEL3)" ]; \
2374
	then OPTGHC="$$OPTGHC --optghc=$(HS_PARALLEL3)"; \
2375
	fi; \
2376
	if [ "$(HS_REGEX_PCRE)" ]; \
2377
	then OPTGHC="$$OPTGHC --optghc=$(HS_REGEX_PCRE)"; \
2378
	fi; \
2379
	for file in $(HS_LIBTESTBUILT_SRCS); do \
2380
	  f_nosrc=$${file##src/}; \
2381
	  f_notst=$${f_nosrc##test/hs/}; \
2382
	  f_html=$${f_notst%%.hs}.html; \
2383
	  $(HSCOLOUR) -css -anchor $$file > $(APIDOC_HS_DIR)/$$f_html ; \
2384
	done ; \
2385
	$(HADDOCK) --odir $(APIDOC_HS_DIR) --html --hoogle --ignore-all-exports -w \
2386
	  -t ganeti -p src/haddock-prologue \
2387
	  --source-module="%{MODULE/.//}.html" \
2388
	  --source-entity="%{MODULE/.//}.html#%{NAME}" \
2389
	  $$OPTGHC \
2390
	  $(HS_LIBTESTBUILT_SRCS)
2391

    
2392
.PHONY: TAGS
2393
TAGS: $(GENERATED_FILES)
2394
	rm -f TAGS
2395
	$(GHC) -e ":etags TAGS_hs" -v0 \
2396
	  $(filter-out -O -Werror,$(HFLAGS)) \
2397
		-osuf tags.o \
2398
		-hisuf tags.hi \
2399
    -lcurl \
2400
	  $(HS_PARALLEL3) $(HS_REGEX_PCRE) \
2401
	  $(HS_LIBTEST_SRCS)
2402
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
2403
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
2404
	  -path './qa/*.py' | \
2405
	  etags --etags-include=TAGS_hs -L -
2406

    
2407
.PHONY: coverage
2408

    
2409
COVERAGE_TESTS=
2410
if HS_UNIT
2411
COVERAGE_TESTS += hs-coverage
2412
endif
2413
if PY_UNIT
2414
COVERAGE_TESTS += py-coverage
2415
endif
2416

    
2417
coverage: $(COVERAGE_TESTS)
2418

    
2419
test/py/docs_unittest.py: $(gnt_scripts)
2420

    
2421
.PHONY: py-coverage
2422
py-coverage: $(GENERATED_FILES) $(python_tests)
2423
	@test -n "$(PYCOVERAGE)" || \
2424
	    { echo 'python-coverage' not found during configure; exit 1; }
2425
	set -e; \
2426
	COVERAGE=$(PYCOVERAGE) \
2427
	COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
2428
	TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
2429
	HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
2430
	$(PLAIN_TESTS_ENVIRONMENT) \
2431
	$(abs_top_srcdir)/autotools/gen-py-coverage \
2432
	$(python_tests)
2433

    
2434
.PHONY: hs-coverage
2435
hs-coverage: $(haskell_tests) test/hs/hpc-htools test/hs/hpc-mon-collector
2436
	rm -f *.tix
2437
	$(MAKE) $(AM_MAKEFLAGS) hs-check
2438
	@mkdir_p@ $(COVERAGE_HS_DIR)
2439
	hpc sum --union $(HPCEXCL) \
2440
	  htest.tix hpc-htools.tix hpc-mon-collector.tix > coverage-hs.tix
2441
	hpc markup --destdir=$(COVERAGE_HS_DIR) coverage-hs.tix
2442
	hpc report coverage-hs.tix | tee $(COVERAGE_HS_DIR)/report.txt
2443
	$(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
2444

    
2445
# Special "kind-of-QA" target for htools, needs special setup (all
2446
# tools compiled with -fhpc)
2447
.PHONY: live-test
2448
live-test: all
2449
	set -e ; \
2450
	cd src; \
2451
	rm -f .hpc; $(LN_S) ../.hpc .hpc; \
2452
	rm -f *.tix *.mix; \
2453
	./live-test.sh; \
2454
	hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:src/%=%)) \
2455
	  --output=live-test.tix ; \
2456
	@mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
2457
	hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
2458
	  --srcdir=.. $(HPCEXCL) ; \
2459
	hpc report --srcdir=.. live-test $(HPCEXCL)
2460

    
2461
commit-check: autotools-check distcheck lint apidoc
2462

    
2463
autotools-check:
2464
	TESTDATA_DIR=./test/data shelltest $(SHELLTESTARGS) \
2465
  $(abs_top_srcdir)/test/autotools/*-*.test \
2466
  -- --hide-successes
2467

    
2468
.PHONY: gitignore-check
2469
gitignore-check:
2470
	@if [ -n "`git status --short`" ]; then \
2471
	  echo "Git status is not clean!" 1>&2 ; \
2472
	  git status --short; \
2473
	  exit 1; \
2474
	fi
2475

    
2476
# target to rebuild all man pages (both groff and html output)
2477
.PHONY: man
2478
man: $(man_MANS) $(manhtml)
2479

    
2480
# Target that builds all binaries (including those that are not
2481
# rebuilt except when running the tests)
2482
.PHONY: really-all
2483
really-all: all $(check_SCRIPTS) $(haskell_tests) $(HS_ALL_PROGS)
2484

    
2485
# we don't need the ancient implicit rules:
2486
%: %,v
2487
%: RCS/%,v
2488
%: RCS/%
2489
%: s.%
2490
%: SCCS/s.%
2491

    
2492
-include ./Makefile.local
2493

    
2494
# vim: set noet :