Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ 30ac9195

History | View | Annotate | Download (74.3 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/Monitoring \
130
	src/Ganeti/Query \
131
	src/Ganeti/Storage \
132
	src/Ganeti/Storage/Diskstats \
133
	src/Ganeti/Storage/Drbd \
134
	src/Ganeti/Storage/Lvm \
135
	src/Ganeti/THH \
136
	src/Ganeti/WConfd \
137
	test/hs \
138
	test/hs/Test \
139
	test/hs/Test/Ganeti \
140
	test/hs/Test/Ganeti/Storage \
141
	test/hs/Test/Ganeti/Storage/Diskstats \
142
	test/hs/Test/Ganeti/Storage/Drbd \
143
	test/hs/Test/Ganeti/Storage/Lvm \
144
	test/hs/Test/Ganeti/Confd \
145
	test/hs/Test/Ganeti/HTools \
146
	test/hs/Test/Ganeti/HTools/Backend \
147
	test/hs/Test/Ganeti/Hypervisor \
148
	test/hs/Test/Ganeti/Hypervisor/Xen \
149
	test/hs/Test/Ganeti/Query \
150
	test/hs/Test/Ganeti/THH
151

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

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

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

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

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

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

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

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

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

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

    
286
GENERATED_FILES = \
287
	$(built_base_sources) \
288
	$(BUILT_PYTHON_SOURCES) \
289
	$(PYTHON_BOOTSTRAP) \
290
	$(gnt_python_sbin_SCRIPTS)
291

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

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

    
304
built_python_base_sources = \
305
	lib/_constants.py \
306
	lib/_vcsversion.py \
307
	lib/opcodes.py
308

    
309
BUILT_PYTHON_SOURCES = \
310
	$(nodist_pkgpython_PYTHON) \
311
	$(nodist_pkgpython_rpc_stub_PYTHON)
312

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

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

    
328
dist_ifup_SCRIPTS = \
329
	tools/kvm-ifup-os
330

    
331
nodist_pkgpython_PYTHON = \
332
	$(built_python_base_sources) \
333
	lib/_generated_rpc.py
334

    
335
nodist_pkgpython_rpc_stub_PYTHON =
336

    
337
nodist_pkgpython_bin_SCRIPTS = \
338
	$(nodist_pkglib_python_scripts)
339

    
340
pkgpython_bin_SCRIPTS = \
341
	$(pkglib_python_scripts)
342

    
343
noinst_PYTHON = \
344
	lib/build/__init__.py \
345
	lib/build/shell_example_lexer.py \
346
	lib/build/sphinx_ext.py
347

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

    
384
client_PYTHON = \
385
	lib/client/__init__.py \
386
	lib/client/base.py \
387
	lib/client/gnt_backup.py \
388
	lib/client/gnt_cluster.py \
389
	lib/client/gnt_debug.py \
390
	lib/client/gnt_group.py \
391
	lib/client/gnt_instance.py \
392
	lib/client/gnt_job.py \
393
	lib/client/gnt_node.py \
394
	lib/client/gnt_network.py \
395
	lib/client/gnt_os.py \
396
	lib/client/gnt_storage.py
397

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

    
419
hypervisor_PYTHON = \
420
	lib/hypervisor/__init__.py \
421
	lib/hypervisor/hv_base.py \
422
	lib/hypervisor/hv_chroot.py \
423
	lib/hypervisor/hv_fake.py \
424
	lib/hypervisor/hv_kvm.py \
425
	lib/hypervisor/hv_lxc.py \
426
	lib/hypervisor/hv_xen.py
427

    
428
storage_PYTHON = \
429
	lib/storage/__init__.py \
430
	lib/storage/bdev.py \
431
	lib/storage/base.py \
432
	lib/storage/container.py \
433
	lib/storage/drbd.py \
434
	lib/storage/drbd_info.py \
435
	lib/storage/drbd_cmdgen.py \
436
	lib/storage/filestorage.py \
437
	lib/storage/gluster.py
438

    
439
rapi_PYTHON = \
440
	lib/rapi/__init__.py \
441
	lib/rapi/baserlib.py \
442
	lib/rapi/client.py \
443
	lib/rapi/client_utils.py \
444
	lib/rapi/connector.py \
445
	lib/rapi/rlib2.py \
446
	lib/rapi/testutils.py
447

    
448
http_PYTHON = \
449
	lib/http/__init__.py \
450
	lib/http/auth.py \
451
	lib/http/client.py \
452
	lib/http/server.py
453

    
454
confd_PYTHON = \
455
	lib/confd/__init__.py \
456
	lib/confd/client.py
457

    
458
masterd_PYTHON = \
459
	lib/masterd/__init__.py \
460
	lib/masterd/iallocator.py \
461
	lib/masterd/instance.py
462

    
463
impexpd_PYTHON = \
464
	lib/impexpd/__init__.py
465

    
466
watcher_PYTHON = \
467
	lib/watcher/__init__.py \
468
	lib/watcher/nodemaint.py \
469
	lib/watcher/state.py
470

    
471
server_PYTHON = \
472
	lib/server/__init__.py \
473
	lib/server/masterd.py \
474
	lib/server/noded.py \
475
	lib/server/rapi.py
476

    
477
rpc_PYTHON = \
478
	lib/rpc/__init__.py \
479
	lib/rpc/client.py \
480
	lib/rpc/errors.py \
481
	lib/rpc/node.py \
482
	lib/rpc/transport.py
483

    
484
rpc_stub_PYTHON = \
485
	lib/rpc/stub/__init__.py
486

    
487
pytools_PYTHON = \
488
	lib/tools/__init__.py \
489
	lib/tools/burnin.py \
490
	lib/tools/ensure_dirs.py \
491
	lib/tools/node_cleanup.py \
492
	lib/tools/node_daemon_setup.py \
493
	lib/tools/prepare_node_join.py
494

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

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

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

    
600
# Haskell programs to be installed in $PREFIX/bin
601
HS_BIN_PROGS=src/htools
602

    
603
# Haskell programs to be installed in the MYEXECLIB dir
604
if ENABLE_MOND
605
HS_MYEXECLIB_PROGS=src/mon-collector
606
else
607
HS_MYEXECLIB_PROGS=
608
endif
609

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

    
621
# All Haskell non-test programs to be compiled but not automatically installed
622
HS_PROGS = $(HS_BIN_PROGS) $(HS_MYEXECLIB_PROGS)
623

    
624
HS_BIN_ROLES = harep hbal hscan hspace hinfo hcheck hroller hsqueeze
625
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
626

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

    
636
HS_ALL_PROGS = $(HS_DEFAULT_PROGS) $(HS_MYEXECLIB_PROGS)
637

    
638
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_DEFAULT_PROGS)) src/mon-collector.hs
639
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
640

    
641
HFLAGS = \
642
	-O -Wall -Werror -isrc \
643
	-fwarn-monomorphism-restriction \
644
	-fwarn-tabs \
645
	$(GHC_BYVERSION_FLAGS)
646

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

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

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

    
830
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
831

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

    
845
HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)
846

    
847
$(RUN_IN_TEMPDIR): | stamp-directories
848

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

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

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

    
892
doc/man-html: doc/man-html/index.html
893

    
894
doc/install-quick.rst: INSTALL
895
doc/news.rst: NEWS
896
doc/upgrade.rst: UPGRADE
897

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

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

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

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

    
937
userspecs = \
938
	doc/users/users \
939
	doc/users/groups \
940
	doc/users/groupmemberships
941

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

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

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

    
971
gnt_scripts_basenames = \
972
	$(patsubst scripts/%,%,$(patsubst daemons/%,%,$(gnt_scripts) $(gnt_python_sbin_SCRIPTS)))
973

    
974
gnt_python_sbin_SCRIPTS = \
975
	$(PYTHON_BOOTSTRAP_SBIN)
976

    
977
gntpython_SCRIPTS = $(gnt_scripts)
978

    
979
PYTHON_BOOTSTRAP_SBIN = \
980
	daemons/ganeti-masterd \
981
	daemons/ganeti-noded \
982
	daemons/ganeti-rapi \
983
	daemons/ganeti-watcher
984

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

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

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

    
1022
HNORMAL_SUFFIX = .o
1023
HPROFILE_SUFFIX = .prof.o
1024
HCOVERAGE_SUFFIX = .hpc.o
1025
HTEST_SUFFIX = .test.o
1026

    
1027
HSUFFIX = $(if $(HPROFILE),$(HPROFILE_SUFFIX), \
1028
	  $(if $(HCOVERAGE),$(HCOVERAGE_SUFFIX), \
1029
	  $(if $(HTEST),$(HTEST_SUFFIX), \
1030
	  $(HNORMAL_SUFFIX))))
1031

    
1032
HFLAGS += $(if $(HPROFILE),-prof -auto-all,)
1033
HFLAGS += $(if $(HCOVERAGE),-fhpc,)
1034
HFLAGS += $(if $(HTEST),-DTEST,)
1035

    
1036
HS_SRCS = $(HS_LIBTESTBUILT_SRCS)
1037

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

    
1053
# for the test/hs/htest binary, we need to enable profiling/coverage
1054
test/hs/htest: HCOVERAGE = true
1055
test/hs/htest: HFLAGS += -itest/hs
1056
test/hs/htest: | $(BUILT_PYTHON_SOURCES)
1057

    
1058
# we compile the hpc-htools binary with the program coverage
1059
test/hs/hpc-htools: HCOVERAGE = true
1060

    
1061
# we compile the hpc-mon-collector binary with the program coverage
1062
test/hs/hpc-mon-collector: HCOVERAGE = true
1063

    
1064
# test dependency
1065
test/hs/offline-test.sh: test/hs/hpc-htools test/hs/hpc-mon-collector
1066

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

    
1076
dist_sbin_SCRIPTS = \
1077
	tools/ganeti-listrunner
1078

    
1079
nodist_sbin_SCRIPTS = \
1080
	daemons/ganeti-cleaner
1081

    
1082
# strip path prefixes off the sbin scripts
1083
all_sbin_scripts = \
1084
	$(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst scripts/%,%,\
1085
	$(patsubst src/%,%,$(dist_sbin_SCRIPTS) $(nodist_sbin_SCRIPTS)))))
1086

    
1087
if ENABLE_CONFD
1088
src/ganeti-confd: src/hconfd
1089
	cp -f $< $@
1090

    
1091
src/ganeti-luxid: src/hluxid
1092
	cp -f $< $@
1093

    
1094
nodist_sbin_SCRIPTS += src/ganeti-confd
1095
nodist_sbin_SCRIPTS += src/ganeti-wconfd
1096
nodist_sbin_SCRIPTS += src/ganeti-luxid
1097
nodist_sbin_SCRIPTS += src/ganeti-kvmd
1098
nodist_sbin_SCRIPTS += src/ganeti-metad
1099
endif
1100

    
1101
if ENABLE_MOND
1102
nodist_sbin_SCRIPTS += src/ganeti-mond
1103
endif
1104

    
1105
python_scripts = \
1106
	tools/cfgshell \
1107
	tools/cfgupgrade \
1108
	tools/cfgupgrade12 \
1109
	tools/cluster-merge \
1110
	tools/confd-client \
1111
	tools/fmtjson \
1112
	tools/lvmstrap \
1113
	tools/move-instance \
1114
	tools/ovfconverter \
1115
	tools/post-upgrade \
1116
	tools/sanitize-config
1117

    
1118
dist_tools_SCRIPTS = \
1119
	tools/kvm-console-wrapper \
1120
	tools/master-ip-setup \
1121
	tools/xen-console-wrapper
1122

    
1123
dist_tools_python_SCRIPTS = \
1124
	$(python_scripts) \
1125
	tools/burnin
1126

    
1127
nodist_tools_python_SCRIPTS = \
1128
	tools/node-cleanup
1129

    
1130
tools_python_basenames = $(patsubst tools/%,%,\
1131
	$(dist_tools_python_SCRIPTS) $(nodist_tools_python_SCRIPTS))
1132

    
1133
nodist_tools_SCRIPTS = \
1134
	tools/users-setup \
1135
	tools/vcluster-setup
1136

    
1137
tools_basenames = $(patsubst tools/%,%,$(nodist_tools_SCRIPTS) $(dist_tools_SCRIPTS))
1138

    
1139
pkglib_python_scripts = \
1140
	daemons/import-export \
1141
	tools/check-cert-expired
1142

    
1143
nodist_pkglib_python_scripts = \
1144
	tools/ensure-dirs \
1145
	tools/node-daemon-setup \
1146
	tools/prepare-node-join
1147

    
1148
pkglib_python_basenames = \
1149
	$(patsubst daemons/%,%,$(patsubst tools/%,%,\
1150
	$(pkglib_python_scripts) $(nodist_pkglib_python_scripts)))
1151

    
1152
myexeclib_SCRIPTS = \
1153
	daemons/daemon-util \
1154
	tools/kvm-ifup \
1155
	tools/kvm-ifup-os \
1156
	tools/vif-ganeti \
1157
	tools/net-common \
1158
	$(HS_MYEXECLIB_PROGS)
1159

    
1160
# compute the basenames of the myexeclib_scripts
1161
myexeclib_scripts_basenames = \
1162
	$(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst src/%,%,$(myexeclib_SCRIPTS))))
1163

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

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

    
1261
# Remove extensions from all filenames in man_MANS
1262
mannoext = $(patsubst %.1,%,$(patsubst %.7,%,$(patsubst %.8,%,$(man_MANS))))
1263

    
1264
manrst = $(patsubst %,%.rst,$(mannoext))
1265
manhtml = $(patsubst %.rst,%.html,$(manrst))
1266
mangen = $(patsubst %.rst,%.gen,$(manrst))
1267
maninput = \
1268
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
1269
	$(patsubst %.html,%.html.in,$(manhtml)) \
1270
	$(mangen)
1271

    
1272
manfullpath = $(patsubst man/%.1,man1/%.1,\
1273
	$(patsubst man/%.7,man7/%.7,\
1274
	$(patsubst man/%.8,man8/%.8,$(man_MANS))))
1275

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

    
1432

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

    
1531
python_test_support = \
1532
	test/py/__init__.py \
1533
	test/py/lockperf.py \
1534
	test/py/testutils.py \
1535
	test/py/mocks.py \
1536
	test/py/cmdlib/__init__.py \
1537
	test/py/cmdlib/testsupport/__init__.py \
1538
	test/py/cmdlib/testsupport/cmdlib_testcase.py \
1539
	test/py/cmdlib/testsupport/config_mock.py \
1540
	test/py/cmdlib/testsupport/iallocator_mock.py \
1541
	test/py/cmdlib/testsupport/lock_manager_mock.py \
1542
	test/py/cmdlib/testsupport/netutils_mock.py \
1543
	test/py/cmdlib/testsupport/processor_mock.py \
1544
	test/py/cmdlib/testsupport/rpc_runner_mock.py \
1545
	test/py/cmdlib/testsupport/ssh_mock.py \
1546
	test/py/cmdlib/testsupport/utils_mock.py \
1547
	test/py/cmdlib/testsupport/util.py
1548

    
1549
haskell_tests = test/hs/htest
1550

    
1551
dist_TESTS = \
1552
	test/py/check-cert-expired_unittest.bash \
1553
	test/py/daemon-util_unittest.bash \
1554
	test/py/ganeti-cleaner_unittest.bash \
1555
	test/py/import-export_unittest.bash \
1556
	test/py/cli-test.bash \
1557
	test/py/bash_completion.bash
1558

    
1559
if PY_UNIT
1560
dist_TESTS += $(python_tests)
1561
endif
1562

    
1563
nodist_TESTS =
1564
check_SCRIPTS =
1565

    
1566
if WANT_HSTESTS
1567
nodist_TESTS += $(haskell_tests)
1568
dist_TESTS += test/hs/offline-test.sh
1569
check_SCRIPTS += \
1570
	test/hs/hpc-htools \
1571
	test/hs/hpc-mon-collector \
1572
	$(HS_BUILT_TEST_HELPERS)
1573
endif
1574

    
1575
TESTS = $(dist_TESTS) $(nodist_TESTS)
1576

    
1577
# Environment for all tests
1578
PLAIN_TESTS_ENVIRONMENT = \
1579
	PYTHONPATH=.:./test/py \
1580
	TOP_SRCDIR=$(abs_top_srcdir) TOP_BUILDDIR=$(abs_top_builddir) \
1581
	PYTHON=$(PYTHON) FAKEROOT=$(FAKEROOT_PATH) \
1582
	$(RUN_IN_TEMPDIR)
1583

    
1584
# Environment for tests run by automake
1585
TESTS_ENVIRONMENT = \
1586
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
1587

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

    
1613
if PY_UNIT
1614
all_python_code += $(python_tests)
1615
all_python_code += $(python_test_support)
1616
endif
1617

    
1618
srclink_files = \
1619
	man/footer.rst \
1620
	test/py/check-cert-expired_unittest.bash \
1621
	test/py/daemon-util_unittest.bash \
1622
	test/py/ganeti-cleaner_unittest.bash \
1623
	test/py/import-export_unittest.bash \
1624
	test/py/cli-test.bash \
1625
	test/py/bash_completion.bash \
1626
	test/hs/offline-test.sh \
1627
	test/hs/cli-tests-defs.sh \
1628
	$(all_python_code) \
1629
	$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS) \
1630
	$(docinput)
1631

    
1632
check_python_code = \
1633
	$(BUILD_BASH_COMPLETION) \
1634
	$(CHECK_IMPORTS) \
1635
	$(CHECK_HEADER) \
1636
	$(DOCPP) \
1637
	$(all_python_code)
1638

    
1639
lint_python_code = \
1640
	ganeti \
1641
	ganeti/http/server.py \
1642
	$(dist_sbin_SCRIPTS) \
1643
	$(python_scripts) \
1644
	$(pkglib_python_scripts) \
1645
	$(BUILD_BASH_COMPLETION) \
1646
	$(CHECK_IMPORTS) \
1647
	$(CHECK_HEADER) \
1648
	$(DOCPP) \
1649
	$(gnt_python_sbin_SCRIPTS) \
1650
	$(PYTHON_BOOTSTRAP)
1651

    
1652
standalone_python_modules = \
1653
	lib/rapi/client.py \
1654
	tools/ganeti-listrunner
1655

    
1656
pep8_python_code = \
1657
	ganeti \
1658
	ganeti/http/server.py \
1659
	$(dist_sbin_SCRIPTS) \
1660
	$(python_scripts) \
1661
	$(pkglib_python_scripts) \
1662
	$(BUILD_BASH_COMPLETION) \
1663
	$(CHECK_HEADER) \
1664
	$(DOCPP) \
1665
	$(PYTHON_BOOTSTRAP) \
1666
	$(gnt_python_sbin_SCRIPTS) \
1667
	qa \
1668
	$(python_test_support)
1669

    
1670
test/py/daemon-util_unittest.bash: daemons/daemon-util
1671

    
1672
test/py/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
1673

    
1674
test/py/bash_completion.bash: doc/examples/bash_completion-debug
1675

    
1676
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
1677
	sed -f $(REPLACE_VARS_SED) < $< > $@
1678
	chmod +x $@
1679

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

    
1684
tools/vif-ganeti: tools/vif-ganeti.in $(REPLACE_VARS_SED)
1685
	sed -f $(REPLACE_VARS_SED) < $< > $@
1686
	chmod +x $@
1687

    
1688
tools/net-common: tools/net-common.in $(REPLACE_VARS_SED)
1689
	sed -f $(REPLACE_VARS_SED) < $< > $@
1690
	chmod +x $@
1691

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

    
1714
tools/vcluster-setup: tools/vcluster-setup.in $(REPLACE_VARS_SED)
1715
	sed -f $(REPLACE_VARS_SED) < $< > $@
1716
	chmod +x $@
1717

    
1718
daemons/%:: daemons/%.in $(REPLACE_VARS_SED)
1719
	sed -f $(REPLACE_VARS_SED) < $< > $@
1720
	chmod +x $@
1721

    
1722
doc/examples/%:: doc/examples/%.in $(REPLACE_VARS_SED)
1723
	sed -f $(REPLACE_VARS_SED) < $< > $@
1724

    
1725
doc/examples/bash_completion: BC_ARGS = --compact
1726
doc/examples/bash_completion-debug: BC_ARGS =
1727

    
1728
doc/examples/bash_completion doc/examples/bash_completion-debug: \
1729
	$(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
1730
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin \
1731
	daemons/ganeti-cleaner \
1732
	$(GENERATED_FILES) $(HS_GENERATED_FILES)
1733
	PYTHONPATH=. $(RUN_IN_TEMPDIR) \
1734
	  $(CURDIR)/$(BUILD_BASH_COMPLETION) $(BC_ARGS) > $@
1735

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

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

    
1761
man/%.html.in: man/%.gen man/footer.rst
1762
	@test -n "$(PANDOC)" || \
1763
	  { echo 'pandoc' not found during configure; exit 1; }
1764
	set -o pipefail ; \
1765
	$(PANDOC) --toc -s -f rst -t html $< man/footer.rst | \
1766
	  sed -e 's/\\@/@/g' > $@
1767

    
1768
man/%: man/%.in  $(REPLACE_VARS_SED)
1769
	sed -f $(REPLACE_VARS_SED) < $< > $@
1770

    
1771
epydoc.conf: epydoc.conf.in $(REPLACE_VARS_SED)
1772
	sed -f $(REPLACE_VARS_SED) < $< > $@
1773

    
1774
vcs-version:
1775
	if test -d .git; then \
1776
	  git describe > $@; \
1777
	elif test ! -f $@ ; then \
1778
	  echo "Cannot auto-generate $@ file"; exit 1; \
1779
	fi
1780

    
1781
.PHONY: clean-vcs-version
1782
clean-vcs-version:
1783
	rm -f vcs-version
1784

    
1785
.PHONY: regen-vcs-version
1786
regen-vcs-version:
1787
	@set -e; \
1788
	cd $(srcdir); \
1789
	if test -d .git; then \
1790
	  T=`mktemp` ; trap 'rm -f $$T' EXIT; \
1791
	  git describe > $$T; \
1792
	  if ! cmp --quiet $$T vcs-version; then \
1793
	    mv $$T vcs-version; \
1794
	  fi; \
1795
	fi
1796

    
1797
src/Ganeti/Version.hs: src/Ganeti/Version.hs.in \
1798
	vcs-version $(built_base_sources)
1799
	set -e; \
1800
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
1801
	sed -e "s/%ver%/$$VCSVER/" < $< > $@
1802

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

    
1820
src/Ganeti/Curl/Internal.hs: src/Ganeti/Curl/Internal.hsc | stamp-directories
1821
	hsc2hs -o $@ $<
1822

    
1823
test/hs/Test/Ganeti/TestImports.hs: test/hs/Test/Ganeti/TestImports.hs.in \
1824
	$(built_base_sources)
1825
	set -e; \
1826
	{ cat $< ; \
1827
	  echo ; \
1828
	  for name in $(filter-out Ganeti.THH,$(subst /,.,$(patsubst %.hs,%,$(patsubst src/%,%,$(HS_LIB_SRCS))))) ; do \
1829
	    echo "import $$name ()" ; \
1830
	  done ; \
1831
	} > $@
1832

    
1833
lib/_constants.py: Makefile src/hs2py lib/_constants.py.in | stamp-directories
1834
	cat $(abs_top_srcdir)/lib/_constants.py.in > $@
1835
	src/hs2py --constants >> $@
1836

    
1837
lib/constants.py: lib/_constants.py
1838

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

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

    
1934
lib/opcodes.py: Makefile src/hs2py lib/opcodes.py.in_before \
1935
		lib/opcodes.py.in_after | stamp-directories
1936
	cat $(abs_top_srcdir)/lib/opcodes.py.in_before > $@
1937
	src/hs2py --opcodes >> $@
1938
	cat $(abs_top_srcdir)/lib/opcodes.py.in_after >> $@
1939

    
1940
lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC)
1941
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
1942

    
1943
$(SHELL_ENV_INIT): Makefile stamp-directories
1944
	set -e; \
1945
	{ echo '# Allow overriding for tests'; \
1946
	  echo 'readonly LOCALSTATEDIR=$${LOCALSTATEDIR:-$${GANETI_ROOTDIR:-}$(localstatedir)}'; \
1947
	  echo 'readonly SYSCONFDIR=$${SYSCONFDIR:-$${GANETI_ROOTDIR:-}$(sysconfdir)}'; \
1948
	  echo; \
1949
	  echo 'readonly PKGLIBDIR=$(libdir)/ganeti'; \
1950
	  echo 'readonly LOG_DIR="$$LOCALSTATEDIR/log/ganeti"'; \
1951
	  echo 'readonly RUN_DIR="$$LOCALSTATEDIR/run/ganeti"'; \
1952
	  echo 'readonly DATA_DIR="$$LOCALSTATEDIR/lib/ganeti"'; \
1953
	  echo 'readonly CONF_DIR="$$SYSCONFDIR/ganeti"'; \
1954
	} > $@
1955

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

    
2002
# Using deferred evaluation
2003
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
2004
daemons/ganeti-watcher: MODULE = ganeti.watcher
2005
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
2006
tools/burnin: MODULE = ganeti.tools.burnin
2007
tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
2008
tools/node-daemon-setup: MODULE = ganeti.tools.node_daemon_setup
2009
tools/prepare-node-join: MODULE = ganeti.tools.prepare_node_join
2010
tools/node-cleanup: MODULE = ganeti.tools.node_cleanup
2011
$(HS_BUILT_TEST_HELPERS): TESTROLE = $(patsubst test/hs/%,%,$@)
2012

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

    
2040
$(HS_BUILT_TEST_HELPERS): Makefile
2041
	@test -n "$(TESTROLE)" || { echo Missing TESTROLE; exit 1; }
2042
	set -e; \
2043
	{ echo '#!/bin/sh'; \
2044
	  echo '# This file is automatically generated, do not edit!'; \
2045
	  echo "# Edit Makefile.am instead."; \
2046
	  echo; \
2047
	  echo "HTOOLS=$(TESTROLE) exec ./test/hs/hpc-htools \"\$$@\""; \
2048
	} > $@
2049
	chmod u+x $@
2050

    
2051
stamp-directories: Makefile
2052
	$(MAKE) $(AM_MAKEFLAGS) ganeti
2053
	@mkdir_p@ $(DIRS) $(BUILDTIME_DIR_AUTOCREATE)
2054
	touch $@
2055

    
2056
# We need to create symlinks because "make distcheck" will not install Python
2057
# files when building.
2058
stamp-srclinks: Makefile | stamp-directories
2059
	set -e; \
2060
	for i in $(srclink_files); do \
2061
	  if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
2062
	    $(LN_S) $(abs_top_srcdir)/$$i $$i; \
2063
	  fi; \
2064
	done
2065
	touch $@
2066

    
2067
.PHONY: ganeti
2068
ganeti:
2069
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
2070

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

    
2091
.PHONY: check-news
2092
check-news:
2093
	RELEASE=$(PACKAGE_VERSION) $(CHECK_NEWS) < $(top_srcdir)/NEWS
2094

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

    
2134
.PHONY: hs-test-%
2135
hs-test-%: test/hs/htest
2136
	@rm -f htest.tix
2137
	test/hs/htest -t $*
2138

    
2139
.PHONY: hs-tests
2140
hs-tests: test/hs/htest
2141
	@rm -f htest.tix
2142
	./test/hs/htest
2143

    
2144
.PHONY: hs-shell-%
2145
hs-shell-%: test/hs/hpc-htools test/hs/hpc-mon-collector \
2146
            $(HS_BUILT_TEST_HELPERS)
2147
	@rm -f hpc-htools.tix hpc-mon-collector.tix
2148
	HBINARY="./test/hs/hpc-htools" \
2149
	SHELLTESTARGS=$(SHELLTESTARGS) \
2150
	./test/hs/offline-test.sh $*
2151

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

    
2159
.PHONY: hs-check
2160
hs-check: hs-tests hs-shell
2161

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

    
2178
# For excluding pep8 expects filenames only, not whole paths
2179
PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(BUILT_PYTHON_SOURCES))))
2180

    
2181
LINT_TARGETS = pylint pylint-qa pylint-test
2182
if HAS_PEP8
2183
LINT_TARGETS += pep8
2184
endif
2185
if HAS_HLINT
2186
LINT_TARGETS += hlint
2187
endif
2188

    
2189
.PHONY: lint
2190
lint: $(LINT_TARGETS)
2191

    
2192
.PHONY: pylint
2193
pylint: $(GENERATED_FILES)
2194
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2195
	$(PYLINT) $(LINT_OPTS) $(lint_python_code)
2196

    
2197
.PHONY: pylint-qa
2198
pylint-qa: $(GENERATED_FILES)
2199
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2200
	cd $(top_srcdir)/qa && \
2201
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS) \
2202
	  --rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
2203
# FIXME: lint all test code, not just the newly added test support
2204
pylint-test: $(GENERATED_FILES)
2205
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2206
	cd $(top_srcdir) && \
2207
		PYTHONPATH=.:./test/py $(PYLINT) $(LINT_OPTS) \
2208
		--rcfile=pylintrc-test  $(python_test_support)
2209

    
2210
.PHONY: pep8
2211
pep8: $(GENERATED_FILES)
2212
	@test -n "$(PEP8)" || { echo 'pep8' not found during configure; exit 1; }
2213
	$(PEP8) --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
2214
	  --repeat $(pep8_python_code)
2215

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

    
2234
# a dist hook rule for updating the vcs-version file; this is
2235
# hardcoded due to where it needs to build the file...
2236
dist-hook:
2237
	$(MAKE) $(AM_MAKEFLAGS) regen-vcs-version
2238
	rm -f $(top_distdir)/vcs-version
2239
	cp -p $(srcdir)/vcs-version $(top_distdir)
2240

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

    
2269
# Backwards compatible distcheck-release target
2270
distcheck-release: distcheck
2271

    
2272
distrebuildcheck: dist
2273
	set -e; \
2274
	builddir=$$(mktemp -d $(abs_srcdir)/distrebuildcheck.XXXXXXX); \
2275
	trap "echo Removing $$builddir; cd $(abs_srcdir); rm -rf $$builddir" EXIT; \
2276
	cd $$builddir; \
2277
	tar xzf $(abs_srcdir)/$(distdir).tar.gz; \
2278
	cd $(distdir); \
2279
	./configure; \
2280
	$(MAKE) maintainer-clean; \
2281
	cp $(abs_srcdir)/vcs-version .; \
2282
	./configure; \
2283
	$(MAKE) $(AM_MAKEFLAGS)
2284

    
2285
dist-release: dist
2286
	set -e; \
2287
	for i in $(DIST_ARCHIVES); do \
2288
	  echo -n "Checking $$i ... "; \
2289
	  autotools/check-tar < $$i; \
2290
	  echo OK; \
2291
	done
2292

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

    
2334
.PHONY: apidoc
2335
if WANT_HSAPIDOC
2336
apidoc: py-apidoc hs-apidoc
2337
else
2338
apidoc: py-apidoc
2339
endif
2340

    
2341
.PHONY: py-apidoc
2342
py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(GENERATED_FILES)
2343
	env - PATH="$$PATH" PYTHONPATH="$$PYTHONPATH" \
2344
	$(RUN_IN_TEMPDIR) epydoc -v \
2345
	  --conf $(CURDIR)/epydoc.conf \
2346
	  --output $(CURDIR)/$(APIDOC_PY_DIR)
2347

    
2348
.PHONY: hs-apidoc
2349
hs-apidoc: $(APIDOC_HS_DIR)/index.html
2350

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

    
2383
.PHONY: TAGS
2384
TAGS: $(GENERATED_FILES)
2385
	rm -f TAGS
2386
	$(GHC) -e ":etags TAGS_hs" -v0 \
2387
	  $(filter-out -O -Werror,$(HFLAGS)) \
2388
		-osuf tags.o \
2389
		-hisuf tags.hi \
2390
    -lcurl \
2391
	  $(HS_PARALLEL3) $(HS_REGEX_PCRE) \
2392
	  $(HS_LIBTEST_SRCS)
2393
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
2394
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
2395
	  -path './qa/*.py' | \
2396
	  etags --etags-include=TAGS_hs -L -
2397

    
2398
.PHONY: coverage
2399

    
2400
COVERAGE_TESTS=
2401
if HS_UNIT
2402
COVERAGE_TESTS += hs-coverage
2403
endif
2404
if PY_UNIT
2405
COVERAGE_TESTS += py-coverage
2406
endif
2407

    
2408
coverage: $(COVERAGE_TESTS)
2409

    
2410
test/py/docs_unittest.py: $(gnt_scripts)
2411

    
2412
.PHONY: py-coverage
2413
py-coverage: $(GENERATED_FILES) $(python_tests)
2414
	@test -n "$(PYCOVERAGE)" || \
2415
	    { echo 'python-coverage' not found during configure; exit 1; }
2416
	set -e; \
2417
	COVERAGE=$(PYCOVERAGE) \
2418
	COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
2419
	TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
2420
	HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
2421
	$(PLAIN_TESTS_ENVIRONMENT) \
2422
	$(abs_top_srcdir)/autotools/gen-py-coverage \
2423
	$(python_tests)
2424

    
2425
.PHONY: hs-coverage
2426
hs-coverage: $(haskell_tests) test/hs/hpc-htools test/hs/hpc-mon-collector
2427
	rm -f *.tix
2428
	$(MAKE) $(AM_MAKEFLAGS) hs-check
2429
	@mkdir_p@ $(COVERAGE_HS_DIR)
2430
	hpc sum --union $(HPCEXCL) \
2431
	  htest.tix hpc-htools.tix hpc-mon-collector.tix > coverage-hs.tix
2432
	hpc markup --destdir=$(COVERAGE_HS_DIR) coverage-hs.tix
2433
	hpc report coverage-hs.tix | tee $(COVERAGE_HS_DIR)/report.txt
2434
	$(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
2435

    
2436
# Special "kind-of-QA" target for htools, needs special setup (all
2437
# tools compiled with -fhpc)
2438
.PHONY: live-test
2439
live-test: all
2440
	set -e ; \
2441
	cd src; \
2442
	rm -f .hpc; $(LN_S) ../.hpc .hpc; \
2443
	rm -f *.tix *.mix; \
2444
	./live-test.sh; \
2445
	hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:src/%=%)) \
2446
	  --output=live-test.tix ; \
2447
	@mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
2448
	hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
2449
	  --srcdir=.. $(HPCEXCL) ; \
2450
	hpc report --srcdir=.. live-test $(HPCEXCL)
2451

    
2452
commit-check: autotools-check distcheck lint apidoc
2453

    
2454
autotools-check:
2455
	TESTDATA_DIR=./test/data shelltest $(SHELLTESTARGS) \
2456
  $(abs_top_srcdir)/test/autotools/*-*.test \
2457
  -- --hide-successes
2458

    
2459
.PHONY: gitignore-check
2460
gitignore-check:
2461
	@if [ -n "`git status --short`" ]; then \
2462
	  echo "Git status is not clean!" 1>&2 ; \
2463
	  git status --short; \
2464
	  exit 1; \
2465
	fi
2466

    
2467
# target to rebuild all man pages (both groff and html output)
2468
.PHONY: man
2469
man: $(man_MANS) $(manhtml)
2470

    
2471
# Target that builds all binaries (including those that are not
2472
# rebuilt except when running the tests)
2473
.PHONY: really-all
2474
really-all: all $(check_SCRIPTS) $(haskell_tests) $(HS_ALL_PROGS)
2475

    
2476
# we don't need the ancient implicit rules:
2477
%: %,v
2478
%: RCS/%,v
2479
%: RCS/%
2480
%: s.%
2481
%: SCCS/s.%
2482

    
2483
-include ./Makefile.local
2484

    
2485
# vim: set noet :