Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ e3b02e1f

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

    
156
# Haskell directories without the roots (src, test/hs)
157
HS_DIRS_NOROOT = $(filter-out src,$(filter-out test/hs,$(HS_DIRS)))
158

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

    
204
ALL_APIDOC_HS_DIRS = \
205
	$(APIDOC_HS_DIR) \
206
	$(patsubst %,$(APIDOC_HS_DIR)/%,$(call strip_hsroot,$(HS_DIRS_NOROOT)))
207

    
208
BUILDTIME_DIR_AUTOCREATE = \
209
	scripts \
210
	$(APIDOC_DIR) \
211
	$(ALL_APIDOC_HS_DIRS) \
212
	$(APIDOC_PY_DIR) \
213
	$(COVERAGE_DIR) \
214
	$(COVERAGE_HS_DIR) \
215
	$(COVERAGE_PY_DIR) \
216
	.hpc
217

    
218
BUILDTIME_DIRS = \
219
	$(BUILDTIME_DIR_AUTOCREATE) \
220
	doc/html \
221
	doc/man-html
222

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

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

    
238
MAINTAINERCLEANFILES = \
239
	$(maninput) \
240
	doc/install-quick.rst \
241
	doc/news.rst \
242
	doc/upgrade.rst \
243
	vcs-version
244

    
245
maintainer-clean-local:
246
	rm -rf $(BUILDTIME_DIRS)
247

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

    
294
GENERATED_FILES = \
295
	$(built_base_sources) \
296
	$(built_python_sources) \
297
	$(PYTHON_BOOTSTRAP) \
298
	$(gnt_python_sbin_SCRIPTS)
299

    
300
HS_GENERATED_FILES = $(HS_PROGS) src/hluxid src/ganeti-luxid
301
if ENABLE_CONFD
302
HS_GENERATED_FILES += src/hconfd src/ganeti-confd
303
endif
304
if ENABLE_MOND
305
HS_GENERATED_FILES += src/ganeti-mond
306
endif
307

    
308
built_base_sources = \
309
	stamp-directories \
310
	stamp-srclinks
311

    
312
built_python_base_sources = \
313
	lib/_constants.py \
314
	lib/_vcsversion.py \
315
	lib/opcodes.py \
316
	lib/rpc/stub/wconfd.py
317

    
318
built_python_sources = \
319
	$(nodist_pkgpython_PYTHON) \
320
	$(nodist_pkgpython_rpc_stub_PYTHON)
321

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

    
326
# these are all built from the underlying %.in sources
327
BUILT_EXAMPLES = \
328
	doc/examples/ganeti-kvm-poweroff.initd \
329
	doc/examples/ganeti.cron \
330
	doc/examples/ganeti.initd \
331
	doc/examples/ganeti.logrotate \
332
	doc/examples/ganeti-master-role.ocf \
333
	doc/examples/ganeti-node-role.ocf \
334
	doc/examples/gnt-config-backup \
335
	doc/examples/hooks/ipsec
336

    
337
dist_ifup_SCRIPTS = \
338
	tools/kvm-ifup-os
339

    
340
nodist_pkgpython_PYTHON = \
341
	$(built_python_base_sources) \
342
	lib/_generated_rpc.py
343

    
344
nodist_pkgpython_rpc_stub_PYTHON = \
345
	lib/rpc/stub/wconfd.py
346

    
347
nodist_pkgpython_bin_SCRIPTS = \
348
	$(nodist_pkglib_python_scripts)
349

    
350
pkgpython_bin_SCRIPTS = \
351
	$(pkglib_python_scripts)
352

    
353
noinst_PYTHON = \
354
	lib/build/__init__.py \
355
	lib/build/shell_example_lexer.py \
356
	lib/build/sphinx_ext.py
357

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

    
395
client_PYTHON = \
396
	lib/client/__init__.py \
397
	lib/client/base.py \
398
	lib/client/gnt_backup.py \
399
	lib/client/gnt_cluster.py \
400
	lib/client/gnt_debug.py \
401
	lib/client/gnt_group.py \
402
	lib/client/gnt_instance.py \
403
	lib/client/gnt_job.py \
404
	lib/client/gnt_node.py \
405
	lib/client/gnt_network.py \
406
	lib/client/gnt_os.py \
407
	lib/client/gnt_storage.py
408

    
409
cmdlib_PYTHON = \
410
	lib/cmdlib/__init__.py \
411
	lib/cmdlib/backup.py \
412
	lib/cmdlib/base.py \
413
	lib/cmdlib/cluster.py \
414
	lib/cmdlib/common.py \
415
	lib/cmdlib/group.py \
416
	lib/cmdlib/instance.py \
417
	lib/cmdlib/instance_migration.py \
418
	lib/cmdlib/instance_operation.py \
419
	lib/cmdlib/instance_query.py \
420
	lib/cmdlib/instance_storage.py \
421
	lib/cmdlib/instance_utils.py \
422
	lib/cmdlib/misc.py \
423
	lib/cmdlib/network.py \
424
	lib/cmdlib/node.py \
425
	lib/cmdlib/operating_system.py \
426
	lib/cmdlib/query.py \
427
	lib/cmdlib/tags.py \
428
	lib/cmdlib/test.py
429

    
430
hypervisor_PYTHON = \
431
	lib/hypervisor/__init__.py \
432
	lib/hypervisor/hv_base.py \
433
	lib/hypervisor/hv_chroot.py \
434
	lib/hypervisor/hv_fake.py \
435
	lib/hypervisor/hv_kvm.py \
436
	lib/hypervisor/hv_lxc.py \
437
	lib/hypervisor/hv_xen.py
438

    
439
storage_PYTHON = \
440
	lib/storage/__init__.py \
441
	lib/storage/bdev.py \
442
	lib/storage/base.py \
443
	lib/storage/container.py \
444
	lib/storage/drbd.py \
445
	lib/storage/drbd_info.py \
446
	lib/storage/drbd_cmdgen.py \
447
	lib/storage/filestorage.py \
448
	lib/storage/gluster.py
449

    
450
rapi_PYTHON = \
451
	lib/rapi/__init__.py \
452
	lib/rapi/baserlib.py \
453
	lib/rapi/client.py \
454
	lib/rapi/client_utils.py \
455
	lib/rapi/connector.py \
456
	lib/rapi/rlib2.py \
457
	lib/rapi/testutils.py
458

    
459
http_PYTHON = \
460
	lib/http/__init__.py \
461
	lib/http/auth.py \
462
	lib/http/client.py \
463
	lib/http/server.py
464

    
465
confd_PYTHON = \
466
	lib/confd/__init__.py \
467
	lib/confd/client.py
468

    
469
masterd_PYTHON = \
470
	lib/masterd/__init__.py \
471
	lib/masterd/iallocator.py \
472
	lib/masterd/instance.py
473

    
474
impexpd_PYTHON = \
475
	lib/impexpd/__init__.py
476

    
477
watcher_PYTHON = \
478
	lib/watcher/__init__.py \
479
	lib/watcher/nodemaint.py \
480
	lib/watcher/state.py
481

    
482
server_PYTHON = \
483
	lib/server/__init__.py \
484
	lib/server/masterd.py \
485
	lib/server/noded.py \
486
	lib/server/rapi.py
487

    
488
rpc_PYTHON = \
489
	lib/rpc/__init__.py \
490
	lib/rpc/client.py \
491
	lib/rpc/errors.py \
492
	lib/rpc/node.py \
493
	lib/rpc/transport.py
494

    
495
rpc_stub_PYTHON = \
496
	lib/rpc/stub/__init__.py
497

    
498
pytools_PYTHON = \
499
	lib/tools/__init__.py \
500
	lib/tools/burnin.py \
501
	lib/tools/ensure_dirs.py \
502
	lib/tools/node_cleanup.py \
503
	lib/tools/node_daemon_setup.py \
504
	lib/tools/prepare_node_join.py
505

    
506
utils_PYTHON = \
507
	lib/utils/__init__.py \
508
	lib/utils/algo.py \
509
	lib/utils/filelock.py \
510
	lib/utils/hash.py \
511
	lib/utils/io.py \
512
	lib/utils/log.py \
513
	lib/utils/lvm.py \
514
	lib/utils/mlock.py \
515
	lib/utils/nodesetup.py \
516
	lib/utils/process.py \
517
	lib/utils/retry.py \
518
	lib/utils/security.py \
519
	lib/utils/storage.py \
520
	lib/utils/text.py \
521
	lib/utils/version.py \
522
	lib/utils/wrapper.py \
523
	lib/utils/x509.py
524

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

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

    
611
# Haskell programs to be installed in $PREFIX/bin
612
HS_BIN_PROGS=src/htools
613

    
614
# Haskell programs to be installed in the MYEXECLIB dir
615
if ENABLE_MOND
616
HS_MYEXECLIB_PROGS=src/mon-collector
617
else
618
HS_MYEXECLIB_PROGS=
619
endif
620

    
621
# Haskell programs to be compiled by "make really-all"
622
HS_COMPILE_PROGS= \
623
	src/ganeti-kvmd \
624
	src/ganeti-metad \
625
	src/ganeti-mond \
626
	src/hconfd \
627
	src/ganeti-wconfd \
628
	src/hluxid \
629
	src/hs2py \
630
	src/rpc-test
631

    
632
# All Haskell non-test programs to be compiled but not automatically installed
633
HS_PROGS = $(HS_BIN_PROGS) $(HS_MYEXECLIB_PROGS)
634

    
635
HS_BIN_ROLES = harep hbal hscan hspace hinfo hcheck hroller hsqueeze
636
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
637

    
638
# Haskell programs that cannot be disabled at configure (e.g., unlike
639
# 'mon-collector')
640
HS_DEFAULT_PROGS = \
641
	$(HS_BIN_PROGS) \
642
	test/hs/hpc-htools \
643
	test/hs/hpc-mon-collector \
644
	test/hs/htest \
645
	$(HS_COMPILE_PROGS)
646

    
647
HS_ALL_PROGS = $(HS_DEFAULT_PROGS) $(HS_MYEXECLIB_PROGS)
648

    
649
HS_TEST_PROGS = $(filter test/%,$(HS_ALL_PROGS))
650
HS_SRC_PROGS = $(filter-out test/%,$(HS_ALL_PROGS))
651

    
652
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_DEFAULT_PROGS)) src/mon-collector.hs
653
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
654

    
655
HFLAGS = \
656
	-O -Wall -Werror -isrc \
657
	-fwarn-monomorphism-restriction \
658
	-fwarn-tabs \
659
	$(GHC_BYVERSION_FLAGS)
660

    
661
if HPROFILE
662
HFLAGS += -prof -auto-all
663
endif
664
if HCOVERAGE
665
HFLAGS += -fhpc
666
endif
667
if HTEST
668
HFLAGS += -DTEST
669
endif
670

    
671
HTEST_SUFFIX = hpc
672

    
673
HTEST_FLAGS = $(HFLAGS) -fhpc -itest/hs \
674
	-osuf .$(HTEST_SUFFIX)_o \
675
	-hisuf .$(HTEST_SUFFIX)_hi
676

    
677
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
678
HEXTRA =
679
# internal extra flags (used for test/hs/htest mainly)
680
HEXTRA_INT =
681
# exclude options for coverage reports
682
HPCEXCL = --exclude Main \
683
	--exclude Ganeti.Constants \
684
	--exclude Ganeti.HTools.QC \
685
	--exclude Ganeti.THH \
686
	--exclude Ganeti.Version \
687
	--exclude Test.Ganeti.Attoparsec \
688
	--exclude Test.Ganeti.TestCommon \
689
	--exclude Test.Ganeti.TestHTools \
690
	--exclude Test.Ganeti.TestHelper \
691
	--exclude Test.Ganeti.TestImports \
692
	$(patsubst src.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
693

    
694
HS_LIB_SRCS = \
695
	src/Ganeti/BasicTypes.hs \
696
	src/Ganeti/Common.hs \
697
	src/Ganeti/Compat.hs \
698
	src/Ganeti/Confd/Client.hs \
699
	src/Ganeti/Confd/ClientFunctions.hs \
700
	src/Ganeti/Confd/Server.hs \
701
	src/Ganeti/Confd/Types.hs \
702
	src/Ganeti/Confd/Utils.hs \
703
	src/Ganeti/Config.hs \
704
	src/Ganeti/ConfigReader.hs \
705
	src/Ganeti/Constants.hs \
706
	src/Ganeti/ConstantUtils.hs \
707
	src/Ganeti/Cpu/LoadParser.hs \
708
	src/Ganeti/Cpu/Types.hs \
709
	src/Ganeti/Curl/Multi.hs \
710
	src/Ganeti/Daemon.hs \
711
	src/Ganeti/DataCollectors/CLI.hs \
712
	src/Ganeti/DataCollectors/CPUload.hs \
713
	src/Ganeti/DataCollectors/Diskstats.hs \
714
	src/Ganeti/DataCollectors/Drbd.hs \
715
	src/Ganeti/DataCollectors/InstStatus.hs \
716
	src/Ganeti/DataCollectors/InstStatusTypes.hs \
717
	src/Ganeti/DataCollectors/Lv.hs \
718
	src/Ganeti/DataCollectors/Program.hs \
719
	src/Ganeti/DataCollectors/Types.hs \
720
	src/Ganeti/Errors.hs \
721
	src/Ganeti/HTools/Backend/IAlloc.hs \
722
	src/Ganeti/HTools/Backend/Luxi.hs \
723
	src/Ganeti/HTools/Backend/Rapi.hs \
724
	src/Ganeti/HTools/Backend/Simu.hs \
725
	src/Ganeti/HTools/Backend/Text.hs \
726
	src/Ganeti/HTools/CLI.hs \
727
	src/Ganeti/HTools/Cluster.hs \
728
	src/Ganeti/HTools/Container.hs \
729
	src/Ganeti/HTools/ExtLoader.hs \
730
	src/Ganeti/HTools/Graph.hs \
731
	src/Ganeti/HTools/Group.hs \
732
	src/Ganeti/HTools/Instance.hs \
733
	src/Ganeti/HTools/Loader.hs \
734
	src/Ganeti/HTools/Nic.hs \
735
	src/Ganeti/HTools/Node.hs \
736
	src/Ganeti/HTools/PeerMap.hs \
737
	src/Ganeti/HTools/Program/Hail.hs \
738
	src/Ganeti/HTools/Program/Harep.hs \
739
	src/Ganeti/HTools/Program/Hbal.hs \
740
	src/Ganeti/HTools/Program/Hcheck.hs \
741
	src/Ganeti/HTools/Program/Hinfo.hs \
742
	src/Ganeti/HTools/Program/Hscan.hs \
743
	src/Ganeti/HTools/Program/Hspace.hs \
744
	src/Ganeti/HTools/Program/Hsqueeze.hs \
745
	src/Ganeti/HTools/Program/Hroller.hs \
746
	src/Ganeti/HTools/Program/Main.hs \
747
	src/Ganeti/HTools/Types.hs \
748
	src/Ganeti/Hypervisor/Xen.hs \
749
	src/Ganeti/Hypervisor/Xen/XmParser.hs \
750
	src/Ganeti/Hypervisor/Xen/Types.hs \
751
	src/Ganeti/Hash.hs \
752
	src/Ganeti/Hs2Py/GenConstants.hs \
753
	src/Ganeti/Hs2Py/GenOpCodes.hs \
754
	src/Ganeti/Hs2Py/OpDoc.hs \
755
	src/Ganeti/JQueue.hs \
756
	src/Ganeti/JQScheduler.hs \
757
	src/Ganeti/JSON.hs \
758
	src/Ganeti/Jobs.hs \
759
	src/Ganeti/Kvmd.hs \
760
	src/Ganeti/Locking/Allocation.hs \
761
	src/Ganeti/Locking/Types.hs \
762
	src/Ganeti/Locking/Locks.hs \
763
	src/Ganeti/Logging.hs \
764
	src/Ganeti/Logging/Lifted.hs \
765
	src/Ganeti/Luxi.hs \
766
	src/Ganeti/Monitoring/Server.hs \
767
	src/Ganeti/Metad.hs \
768
	src/Ganeti/Network.hs \
769
	src/Ganeti/Objects.hs \
770
	src/Ganeti/OpCodes.hs \
771
	src/Ganeti/OpParams.hs \
772
	src/Ganeti/Path.hs \
773
	src/Ganeti/Parsers.hs \
774
	src/Ganeti/PyValue.hs \
775
	src/Ganeti/Query/Cluster.hs \
776
	src/Ganeti/Query/Common.hs \
777
	src/Ganeti/Query/Export.hs \
778
	src/Ganeti/Query/Filter.hs \
779
	src/Ganeti/Query/Group.hs \
780
	src/Ganeti/Query/Instance.hs \
781
	src/Ganeti/Query/Job.hs \
782
	src/Ganeti/Query/Language.hs \
783
	src/Ganeti/Query/Locks.hs \
784
	src/Ganeti/Query/Network.hs \
785
	src/Ganeti/Query/Node.hs \
786
	src/Ganeti/Query/Query.hs \
787
	src/Ganeti/Query/Server.hs \
788
	src/Ganeti/Query/Types.hs \
789
	src/Ganeti/Rpc.hs \
790
	src/Ganeti/Runtime.hs \
791
	src/Ganeti/Ssconf.hs \
792
	src/Ganeti/Storage/Diskstats/Parser.hs \
793
	src/Ganeti/Storage/Diskstats/Types.hs \
794
	src/Ganeti/Storage/Drbd/Parser.hs \
795
	src/Ganeti/Storage/Drbd/Types.hs \
796
	src/Ganeti/Storage/Lvm/LVParser.hs \
797
	src/Ganeti/Storage/Lvm/Types.hs \
798
	src/Ganeti/Storage/Utils.hs \
799
	src/Ganeti/THH.hs \
800
	src/Ganeti/THH/PyRPC.hs \
801
	src/Ganeti/THH/PyType.hs \
802
	src/Ganeti/THH/Types.hs \
803
	src/Ganeti/THH/RPC.hs \
804
	src/Ganeti/Types.hs \
805
	src/Ganeti/UDSServer.hs \
806
	src/Ganeti/Utils.hs \
807
	src/Ganeti/Utils/Atomic.hs \
808
	src/Ganeti/Utils/AsyncWorker.hs \
809
	src/Ganeti/VCluster.hs \
810
	src/Ganeti/WConfd/ConfigState.hs \
811
	src/Ganeti/WConfd/ConfigWriter.hs \
812
	src/Ganeti/WConfd/Core.hs \
813
	src/Ganeti/WConfd/Monad.hs \
814
	src/Ganeti/WConfd/Server.hs
815

    
816
HS_TEST_SRCS = \
817
	test/hs/Test/AutoConf.hs \
818
	test/hs/Test/Ganeti/Attoparsec.hs \
819
	test/hs/Test/Ganeti/BasicTypes.hs \
820
	test/hs/Test/Ganeti/Common.hs \
821
	test/hs/Test/Ganeti/Confd/Types.hs \
822
	test/hs/Test/Ganeti/Confd/Utils.hs \
823
	test/hs/Test/Ganeti/Constants.hs \
824
	test/hs/Test/Ganeti/Daemon.hs \
825
	test/hs/Test/Ganeti/Errors.hs \
826
	test/hs/Test/Ganeti/HTools/Backend/Simu.hs \
827
	test/hs/Test/Ganeti/HTools/Backend/Text.hs \
828
	test/hs/Test/Ganeti/HTools/CLI.hs \
829
	test/hs/Test/Ganeti/HTools/Cluster.hs \
830
	test/hs/Test/Ganeti/HTools/Container.hs \
831
	test/hs/Test/Ganeti/HTools/ExtLoader.hs \
832
	test/hs/Test/Ganeti/HTools/Graph.hs \
833
	test/hs/Test/Ganeti/HTools/Instance.hs \
834
	test/hs/Test/Ganeti/HTools/Loader.hs \
835
	test/hs/Test/Ganeti/HTools/Node.hs \
836
	test/hs/Test/Ganeti/HTools/PeerMap.hs \
837
	test/hs/Test/Ganeti/HTools/Types.hs \
838
	test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs \
839
	test/hs/Test/Ganeti/JSON.hs \
840
	test/hs/Test/Ganeti/Jobs.hs \
841
	test/hs/Test/Ganeti/JQueue.hs \
842
	test/hs/Test/Ganeti/Kvmd.hs \
843
	test/hs/Test/Ganeti/Luxi.hs \
844
	test/hs/Test/Ganeti/Locking/Allocation.hs \
845
	test/hs/Test/Ganeti/Locking/Locks.hs \
846
	test/hs/Test/Ganeti/Network.hs \
847
	test/hs/Test/Ganeti/Objects.hs \
848
	test/hs/Test/Ganeti/OpCodes.hs \
849
	test/hs/Test/Ganeti/Query/Aliases.hs \
850
	test/hs/Test/Ganeti/Query/Filter.hs \
851
	test/hs/Test/Ganeti/Query/Instance.hs \
852
	test/hs/Test/Ganeti/Query/Language.hs \
853
	test/hs/Test/Ganeti/Query/Network.hs \
854
	test/hs/Test/Ganeti/Query/Query.hs \
855
	test/hs/Test/Ganeti/Rpc.hs \
856
	test/hs/Test/Ganeti/Runtime.hs \
857
	test/hs/Test/Ganeti/Ssconf.hs \
858
	test/hs/Test/Ganeti/Storage/Diskstats/Parser.hs \
859
	test/hs/Test/Ganeti/Storage/Drbd/Parser.hs \
860
	test/hs/Test/Ganeti/Storage/Drbd/Types.hs \
861
	test/hs/Test/Ganeti/Storage/Lvm/LVParser.hs \
862
	test/hs/Test/Ganeti/THH.hs \
863
	test/hs/Test/Ganeti/THH/Types.hs \
864
	test/hs/Test/Ganeti/TestCommon.hs \
865
	test/hs/Test/Ganeti/TestHTools.hs \
866
	test/hs/Test/Ganeti/TestHelper.hs \
867
	test/hs/Test/Ganeti/Types.hs \
868
	test/hs/Test/Ganeti/Utils.hs
869

    
870
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
871

    
872
HS_BUILT_SRCS = \
873
	test/hs/Test/Ganeti/TestImports.hs \
874
	src/AutoConf.hs \
875
	src/Ganeti/Hs2Py/ListConstants.hs \
876
	src/Ganeti/Curl/Internal.hs \
877
	src/Ganeti/Version.hs
878
HS_BUILT_SRCS_IN = \
879
	$(patsubst %,%.in,$(filter-out src/Ganeti/Curl/Internal.hs,$(HS_BUILT_SRCS))) \
880
	src/Ganeti/Curl/Internal.hsc \
881
	lib/_constants.py.in \
882
	lib/opcodes.py.in_after \
883
	lib/opcodes.py.in_before
884

    
885
HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)
886

    
887
$(RUN_IN_TEMPDIR): | stamp-directories
888

    
889
doc/html/index.html: ENABLE_MANPAGES =
890
doc/man-html/index.html: ENABLE_MANPAGES = 1
891
doc/man-html/index.html: doc/manpages-enabled.rst $(mandocrst)
892

    
893
# Note: we use here an order-only prerequisite, as the contents of
894
# _constants.py are not actually influencing the html build output: it
895
# has to exist in order for the sphinx module to be loaded
896
# successfully, but we certainly don't want the docs to be rebuilt if
897
# it changes
898
doc/html/index.html doc/man-html/index.html: $(docinput) doc/conf.py \
899
	configure.ac $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
900
	lib/build/shell_example_lexer.py lib/ht.py \
901
	doc/css/style.css lib/rapi/connector.py lib/rapi/rlib2.py \
902
	autotools/sphinx-wrapper | $(built_python_sources)
903
	@test -n "$(SPHINX)" || \
904
	    { echo 'sphinx-build' not found during configure; exit 1; }
905
if !MANPAGES_IN_DOC
906
	if test -n '$(ENABLE_MANPAGES)'; then \
907
	  echo 'Man pages in documentation were disabled at configure time' >&2; \
908
	  exit 1; \
909
	fi
910
endif
911
## Sphinx provides little control over what content should be included. Some
912
## mechanisms exist, but they all have drawbacks or actual issues. Since we
913
## build two different versions of the documentation--once without man pages and
914
## once, if enabled, with them--some control is necessary. xmpp-wrapper provides
915
## us with this, but requires running in a temporary directory. It moves the
916
## correct files into place depending on environment variables.
917
	dir=$(dir $@) && \
918
	@mkdir_p@ $$dir && \
919
	PYTHONPATH=. ENABLE_MANPAGES=$(ENABLE_MANPAGES) COPY_DOC=1 \
920
	$(RUN_IN_TEMPDIR) autotools/sphinx-wrapper $(SPHINX) -q -W -b html \
921
	    -d . \
922
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
923
	    -D release="$(PACKAGE_VERSION)" \
924
	    -D graphviz_dot="$(DOT)" \
925
	    -D enable_manpages="$(ENABLE_MANPAGES)" \
926
	    doc $(CURDIR)/$$dir && \
927
	rm -f $$dir/.buildinfo $$dir/objects.inv
928
	touch $@
929

    
930
doc/html: doc/html/index.html
931

    
932
doc/man-html: doc/man-html/index.html
933

    
934
doc/install-quick.rst: INSTALL
935
doc/news.rst: NEWS
936
doc/upgrade.rst: UPGRADE
937

    
938
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
939
	set -e; \
940
	{ echo '.. This file is automatically updated at build time from $<.'; \
941
	  echo '.. Do not edit.'; \
942
	  echo; \
943
	  cat $<; \
944
	} > $@
945

    
946
doc/manpages-enabled.rst: Makefile | $(built_base_sources)
947
	{ echo '.. This file is automatically generated, do not edit!'; \
948
	  echo ''; \
949
	  echo 'Man pages'; \
950
	  echo '========='; \
951
	  echo; \
952
	  echo '.. toctree::'; \
953
	  echo '   :maxdepth: 1'; \
954
	  echo; \
955
	  for i in $(notdir $(mandocrst)); do \
956
	    echo "   $$i"; \
957
	  done | LC_ALL=C sort; \
958
	} > $@
959

    
960
doc/man-%.rst: man/%.gen Makefile $(REPLACE_VARS_SED) | $(built_base_sources)
961
if MANPAGES_IN_DOC
962
	{ echo '.. This file is automatically updated at build time from $<.'; \
963
	  echo '.. Do not edit.'; \
964
	  echo; \
965
	  echo "$*"; \
966
	  echo '=========================================='; \
967
	  tail -n +3 $< | sed -f $(REPLACE_VARS_SED); \
968
	} > $@
969
else
970
	echo 'Man pages in documentation were disabled at configure time' >&2; \
971
	exit 1;
972
endif
973

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

    
977
userspecs = \
978
	doc/users/users \
979
	doc/users/groups \
980
	doc/users/groupmemberships
981

    
982
# Things to build but not to install (add it to EXTRA_DIST if it should be
983
# distributed)
984
noinst_DATA = \
985
	$(BUILT_EXAMPLES) \
986
	doc/examples/bash_completion \
987
	doc/examples/bash_completion-debug \
988
	$(userspecs) \
989
	$(manhtml)
990

    
991
if HAS_SPHINX
992
if MANPAGES_IN_DOC
993
noinst_DATA += doc/man-html
994
else
995
noinst_DATA += doc/html
996
endif
997
endif
998

    
999
gnt_scripts = \
1000
	scripts/gnt-backup \
1001
	scripts/gnt-cluster \
1002
	scripts/gnt-debug \
1003
	scripts/gnt-group \
1004
	scripts/gnt-instance \
1005
	scripts/gnt-job \
1006
	scripts/gnt-network \
1007
	scripts/gnt-node \
1008
	scripts/gnt-os \
1009
	scripts/gnt-storage
1010

    
1011
gnt_scripts_basenames = \
1012
	$(patsubst scripts/%,%,$(patsubst daemons/%,%,$(gnt_scripts) $(gnt_python_sbin_SCRIPTS)))
1013

    
1014
gnt_python_sbin_SCRIPTS = \
1015
	$(PYTHON_BOOTSTRAP_SBIN)
1016

    
1017
gntpython_SCRIPTS = $(gnt_scripts)
1018

    
1019
PYTHON_BOOTSTRAP_SBIN = \
1020
	daemons/ganeti-masterd \
1021
	daemons/ganeti-noded \
1022
	daemons/ganeti-rapi \
1023
	daemons/ganeti-watcher
1024

    
1025
PYTHON_BOOTSTRAP = \
1026
	tools/burnin \
1027
	tools/ensure-dirs \
1028
	tools/node-cleanup \
1029
	tools/node-daemon-setup \
1030
	tools/prepare-node-join
1031

    
1032
qa_scripts = \
1033
	qa/__init__.py \
1034
	qa/ganeti-qa.py \
1035
	qa/qa_cluster.py \
1036
	qa/qa_config.py \
1037
	qa/qa_daemon.py \
1038
	qa/qa_env.py \
1039
	qa/qa_error.py \
1040
	qa/qa_group.py \
1041
	qa/qa_instance.py \
1042
	qa/qa_instance_utils.py \
1043
	qa/qa_job.py \
1044
	qa/qa_monitoring.py \
1045
	qa/qa_node.py \
1046
	qa/qa_os.py \
1047
	qa/qa_rapi.py \
1048
	qa/qa_tags.py \
1049
	qa/qa_utils.py \
1050
	qa/rapi-workload.py
1051

    
1052
bin_SCRIPTS = $(HS_BIN_PROGS)
1053
install-exec-hook:
1054
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
1055
# FIXME: this is a hardcoded logic, instead of auto-resolving
1056
	$(LN_S) -f ../../../bin/htools \
1057
	  $(DESTDIR)$(iallocatorsdir)/hail
1058
	for role in $(HS_BIN_ROLES); do \
1059
	  $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
1060
	done
1061

    
1062
HS_SRCS = $(HS_LIBTESTBUILT_SRCS)
1063

    
1064
Makefile.ghc: $(HS_ALL_PROGS:%=%.hs) $(HS_SRCS) Makefile | $(built_base_sources)
1065
	$(GHC) -M -dep-makefile $@ -dep-suffix $(HTEST_SUFFIX) $(HFLAGS) \
1066
		$(HS_PARALLEL3) $(HS_REGEX_PCRE) $(HEXTRA) $(HS_ALL_PROGS:%=%.hs) $(HS_SRCS)
1067

    
1068
@include_makefile_ghc@
1069

    
1070
%.o:
1071
	@echo '[GHC]: $@ <- $^'
1072
	@$(GHC) -c $(HFLAGS) \
1073
		$(HS_PARALLEL3) $(HS_REGEX_PCRE) $(HEXTRA) $(@:%.o=%.hs)
1074

    
1075
%.$(HTEST_SUFFIX)_o:
1076
	@echo '[GHC]: $@ <- $^'
1077
	@$(GHC) -c $(HTEST_FLAGS) \
1078
		$(HS_PARALLEL3) $(HS_REGEX_PCRE) $(HEXTRA) $(@:%.$(HTEST_SUFFIX)_o=%.hs)
1079

    
1080
%.hi: %.o ;
1081
%.$(HTEST_SUFFIX)_hi: %.$(HTEST_SUFFIX)_o ;
1082

    
1083
$(HS_SRC_PROGS): %: %.o | stamp-directories
1084
	$(GHC) $(HFLAGS) \
1085
		$(HS_PARALLEL3) $(HS_REGEX_PCRE) $(HEXTRA) --make $(@:%=%.hs)
1086
	@rm -f $(notdir $@).tix
1087
	@touch "$@"
1088

    
1089
$(HS_TEST_PROGS): %: %.$(HTEST_SUFFIX)_o \
1090
	                   | stamp-directories $(built_python_sources)
1091
	@if [ "$(HS_NODEV)" ]; then \
1092
	  echo "Error: cannot run unittests without the development" \
1093
	       " libraries (see devnotes.rst)" 1>&2; \
1094
	  exit 1; \
1095
	fi
1096
	$(GHC) $(HTEST_FLAGS) \
1097
		$(HS_PARALLEL3) $(HS_REGEX_PCRE) $(HEXTRA) --make $(@:%=%.hs)
1098
	@rm -f $(notdir $@).tix
1099
	@touch "$@"
1100

    
1101
dist_sbin_SCRIPTS = \
1102
	tools/ganeti-listrunner
1103

    
1104
nodist_sbin_SCRIPTS = \
1105
	daemons/ganeti-cleaner
1106

    
1107
# strip path prefixes off the sbin scripts
1108
all_sbin_scripts = \
1109
	$(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst scripts/%,%,\
1110
	$(patsubst src/%,%,$(dist_sbin_SCRIPTS) $(nodist_sbin_SCRIPTS)))))
1111

    
1112
if ENABLE_CONFD
1113
src/ganeti-confd: src/hconfd
1114
	cp -f $< $@
1115

    
1116
src/ganeti-luxid: src/hluxid
1117
	cp -f $< $@
1118

    
1119
nodist_sbin_SCRIPTS += src/ganeti-confd
1120
nodist_sbin_SCRIPTS += src/ganeti-wconfd
1121
nodist_sbin_SCRIPTS += src/ganeti-luxid
1122
nodist_sbin_SCRIPTS += src/ganeti-kvmd
1123
nodist_sbin_SCRIPTS += src/ganeti-metad
1124
endif
1125

    
1126
if ENABLE_MOND
1127
nodist_sbin_SCRIPTS += src/ganeti-mond
1128
endif
1129

    
1130
python_scripts = \
1131
	tools/cfgshell \
1132
	tools/cfgupgrade \
1133
	tools/cfgupgrade12 \
1134
	tools/cluster-merge \
1135
	tools/confd-client \
1136
	tools/fmtjson \
1137
	tools/lvmstrap \
1138
	tools/move-instance \
1139
	tools/ovfconverter \
1140
	tools/post-upgrade \
1141
	tools/sanitize-config
1142

    
1143
dist_tools_SCRIPTS = \
1144
	tools/kvm-console-wrapper \
1145
	tools/master-ip-setup \
1146
	tools/xen-console-wrapper
1147

    
1148
dist_tools_python_SCRIPTS = \
1149
	$(python_scripts) \
1150
	tools/burnin
1151

    
1152
nodist_tools_python_SCRIPTS = \
1153
	tools/node-cleanup
1154

    
1155
tools_python_basenames = $(patsubst tools/%,%,\
1156
	$(dist_tools_python_SCRIPTS) $(nodist_tools_python_SCRIPTS))
1157

    
1158
nodist_tools_SCRIPTS = \
1159
	tools/users-setup \
1160
	tools/vcluster-setup
1161

    
1162
tools_basenames = $(patsubst tools/%,%,$(nodist_tools_SCRIPTS) $(dist_tools_SCRIPTS))
1163

    
1164
pkglib_python_scripts = \
1165
	daemons/import-export \
1166
	tools/check-cert-expired
1167

    
1168
nodist_pkglib_python_scripts = \
1169
	tools/ensure-dirs \
1170
	tools/node-daemon-setup \
1171
	tools/prepare-node-join
1172

    
1173
pkglib_python_basenames = \
1174
	$(patsubst daemons/%,%,$(patsubst tools/%,%,\
1175
	$(pkglib_python_scripts) $(nodist_pkglib_python_scripts)))
1176

    
1177
myexeclib_SCRIPTS = \
1178
	daemons/daemon-util \
1179
	tools/kvm-ifup \
1180
	tools/kvm-ifup-os \
1181
	tools/vif-ganeti \
1182
	tools/net-common \
1183
	$(HS_MYEXECLIB_PROGS)
1184

    
1185
# compute the basenames of the myexeclib_scripts
1186
myexeclib_scripts_basenames = \
1187
	$(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst src/%,%,$(myexeclib_SCRIPTS))))
1188

    
1189
EXTRA_DIST = \
1190
	NEWS \
1191
	UPGRADE \
1192
	epydoc.conf.in \
1193
	pylintrc \
1194
	pylintrc-test \
1195
	autotools/build-bash-completion \
1196
	autotools/build-rpc \
1197
	autotools/check-header \
1198
	autotools/check-imports \
1199
	autotools/check-man-dashes \
1200
	autotools/check-man-references \
1201
	autotools/check-man-warnings \
1202
	autotools/check-news \
1203
	autotools/check-python-code \
1204
	autotools/check-tar \
1205
	autotools/check-version \
1206
	autotools/docpp \
1207
	autotools/gen-py-coverage \
1208
	autotools/print-py-constants \
1209
	autotools/sphinx-wrapper \
1210
	autotools/testrunner \
1211
	autotools/wrong-hardcoded-paths \
1212
	$(RUN_IN_TEMPDIR) \
1213
	daemons/daemon-util.in \
1214
	daemons/ganeti-cleaner.in \
1215
	$(pkglib_python_scripts) \
1216
	devel/upload \
1217
	devel/webserver \
1218
	tools/kvm-ifup.in \
1219
	tools/kvm-ifup-os.in \
1220
	tools/vif-ganeti.in \
1221
	tools/net-common.in \
1222
	tools/vcluster-setup.in \
1223
	$(docinput) \
1224
	doc/html \
1225
	$(BUILT_EXAMPLES:%=%.in) \
1226
	doc/examples/ganeti.default \
1227
	doc/examples/ganeti.default-debug \
1228
	doc/examples/hooks/ethers \
1229
	doc/examples/gnt-debug/README \
1230
	doc/examples/gnt-debug/delay0.json \
1231
	doc/examples/gnt-debug/delay50.json \
1232
	doc/users/groupmemberships.in \
1233
	doc/users/groups.in \
1234
	doc/users/users.in \
1235
	$(dist_TESTS) \
1236
	$(TEST_FILES) \
1237
	$(python_test_support) \
1238
	man/footer.rst \
1239
	$(manrst) \
1240
	$(maninput) \
1241
	qa/qa-sample.json \
1242
	$(qa_scripts) \
1243
	$(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS_IN) \
1244
	$(HS_PROG_SRCS) \
1245
	src/lint-hints.hs \
1246
	test/hs/cli-tests-defs.sh \
1247
	test/hs/offline-test.sh \
1248
	.ghci
1249

    
1250
man_MANS = \
1251
	man/ganeti-cleaner.8 \
1252
	man/ganeti-confd.8 \
1253
	man/ganeti-luxid.8 \
1254
	man/ganeti-listrunner.8 \
1255
	man/ganeti-kvmd.8 \
1256
	man/ganeti-masterd.8 \
1257
	man/ganeti-mond.8 \
1258
	man/ganeti-noded.8 \
1259
	man/ganeti-os-interface.7 \
1260
	man/ganeti-extstorage-interface.7 \
1261
	man/ganeti-rapi.8 \
1262
	man/ganeti-watcher.8 \
1263
	man/ganeti.7 \
1264
	man/gnt-backup.8 \
1265
	man/gnt-cluster.8 \
1266
	man/gnt-debug.8 \
1267
	man/gnt-group.8 \
1268
	man/gnt-network.8 \
1269
	man/gnt-instance.8 \
1270
	man/gnt-job.8 \
1271
	man/gnt-node.8 \
1272
	man/gnt-os.8 \
1273
	man/gnt-storage.8 \
1274
	man/hail.1 \
1275
	man/harep.1 \
1276
	man/hbal.1 \
1277
	man/hcheck.1 \
1278
	man/hinfo.1 \
1279
	man/hscan.1 \
1280
	man/hspace.1 \
1281
	man/hsqueeze.1 \
1282
	man/hroller.1 \
1283
	man/htools.1 \
1284
	man/mon-collector.7
1285

    
1286
# Remove extensions from all filenames in man_MANS
1287
mannoext = $(patsubst %.1,%,$(patsubst %.7,%,$(patsubst %.8,%,$(man_MANS))))
1288

    
1289
manrst = $(patsubst %,%.rst,$(mannoext))
1290
manhtml = $(patsubst %.rst,%.html,$(manrst))
1291
mangen = $(patsubst %.rst,%.gen,$(manrst))
1292
maninput = \
1293
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
1294
	$(patsubst %.html,%.html.in,$(manhtml)) \
1295
	$(mangen)
1296

    
1297
manfullpath = $(patsubst man/%.1,man1/%.1,\
1298
	$(patsubst man/%.7,man7/%.7,\
1299
	$(patsubst man/%.8,man8/%.8,$(man_MANS))))
1300

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

    
1457

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

    
1556
python_test_support = \
1557
	test/py/__init__.py \
1558
	test/py/lockperf.py \
1559
	test/py/testutils.py \
1560
	test/py/mocks.py \
1561
	test/py/cmdlib/__init__.py \
1562
	test/py/cmdlib/testsupport/__init__.py \
1563
	test/py/cmdlib/testsupport/cmdlib_testcase.py \
1564
	test/py/cmdlib/testsupport/config_mock.py \
1565
	test/py/cmdlib/testsupport/iallocator_mock.py \
1566
	test/py/cmdlib/testsupport/lock_manager_mock.py \
1567
	test/py/cmdlib/testsupport/netutils_mock.py \
1568
	test/py/cmdlib/testsupport/processor_mock.py \
1569
	test/py/cmdlib/testsupport/rpc_runner_mock.py \
1570
	test/py/cmdlib/testsupport/ssh_mock.py \
1571
	test/py/cmdlib/testsupport/utils_mock.py \
1572
	test/py/cmdlib/testsupport/util.py
1573

    
1574
haskell_tests = test/hs/htest
1575

    
1576
dist_TESTS = \
1577
	test/py/check-cert-expired_unittest.bash \
1578
	test/py/daemon-util_unittest.bash \
1579
	test/py/ganeti-cleaner_unittest.bash \
1580
	test/py/import-export_unittest.bash \
1581
	test/py/cli-test.bash \
1582
	test/py/bash_completion.bash
1583

    
1584
if PY_UNIT
1585
dist_TESTS += $(python_tests)
1586
endif
1587

    
1588
nodist_TESTS =
1589
check_SCRIPTS =
1590

    
1591
if WANT_HSTESTS
1592
nodist_TESTS += $(haskell_tests)
1593
# test dependency
1594
test/hs/offline-test.sh: test/hs/hpc-htools test/hs/hpc-mon-collector
1595
dist_TESTS += test/hs/offline-test.sh
1596
check_SCRIPTS += \
1597
	test/hs/hpc-htools \
1598
	test/hs/hpc-mon-collector \
1599
	$(HS_BUILT_TEST_HELPERS)
1600
endif
1601

    
1602
TESTS = $(dist_TESTS) $(nodist_TESTS)
1603

    
1604
# Environment for all tests
1605
PLAIN_TESTS_ENVIRONMENT = \
1606
	PYTHONPATH=.:./test/py \
1607
	TOP_SRCDIR=$(abs_top_srcdir) TOP_BUILDDIR=$(abs_top_builddir) \
1608
	PYTHON=$(PYTHON) FAKEROOT=$(FAKEROOT_PATH) \
1609
	$(RUN_IN_TEMPDIR)
1610

    
1611
# Environment for tests run by automake
1612
TESTS_ENVIRONMENT = \
1613
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
1614

    
1615
all_python_code = \
1616
	$(dist_sbin_SCRIPTS) \
1617
	$(python_scripts) \
1618
	$(pkglib_python_scripts) \
1619
	$(nodist_pkglib_python_scripts) \
1620
	$(nodist_tools_python_scripts) \
1621
	$(pkgpython_PYTHON) \
1622
	$(client_PYTHON) \
1623
	$(cmdlib_PYTHON) \
1624
	$(hypervisor_PYTHON) \
1625
	$(storage_PYTHON) \
1626
	$(rapi_PYTHON) \
1627
	$(server_PYTHON) \
1628
	$(rpc_PYTHON) \
1629
	$(rpc_stub_PYTHON) \
1630
	$(pytools_PYTHON) \
1631
	$(http_PYTHON) \
1632
	$(confd_PYTHON) \
1633
	$(masterd_PYTHON) \
1634
	$(impexpd_PYTHON) \
1635
	$(utils_PYTHON) \
1636
	$(watcher_PYTHON) \
1637
	$(noinst_PYTHON) \
1638
	$(qa_scripts)
1639

    
1640
if PY_UNIT
1641
all_python_code += $(python_tests)
1642
all_python_code += $(python_test_support)
1643
endif
1644

    
1645
srclink_files = \
1646
	man/footer.rst \
1647
	test/py/check-cert-expired_unittest.bash \
1648
	test/py/daemon-util_unittest.bash \
1649
	test/py/ganeti-cleaner_unittest.bash \
1650
	test/py/import-export_unittest.bash \
1651
	test/py/cli-test.bash \
1652
	test/py/bash_completion.bash \
1653
	test/hs/offline-test.sh \
1654
	test/hs/cli-tests-defs.sh \
1655
	$(all_python_code) \
1656
	$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS) \
1657
	$(docinput)
1658

    
1659
check_python_code = \
1660
	$(BUILD_BASH_COMPLETION) \
1661
	$(CHECK_IMPORTS) \
1662
	$(CHECK_HEADER) \
1663
	$(DOCPP) \
1664
	$(all_python_code)
1665

    
1666
lint_python_code = \
1667
	ganeti \
1668
	ganeti/http/server.py \
1669
	$(dist_sbin_SCRIPTS) \
1670
	$(python_scripts) \
1671
	$(pkglib_python_scripts) \
1672
	$(BUILD_BASH_COMPLETION) \
1673
	$(CHECK_IMPORTS) \
1674
	$(CHECK_HEADER) \
1675
	$(DOCPP) \
1676
	$(gnt_python_sbin_SCRIPTS) \
1677
	$(PYTHON_BOOTSTRAP)
1678

    
1679
standalone_python_modules = \
1680
	lib/rapi/client.py \
1681
	tools/ganeti-listrunner
1682

    
1683
pep8_python_code = \
1684
	ganeti \
1685
	ganeti/http/server.py \
1686
	$(dist_sbin_SCRIPTS) \
1687
	$(python_scripts) \
1688
	$(pkglib_python_scripts) \
1689
	$(BUILD_BASH_COMPLETION) \
1690
	$(CHECK_HEADER) \
1691
	$(DOCPP) \
1692
	$(PYTHON_BOOTSTRAP) \
1693
	$(gnt_python_sbin_SCRIPTS) \
1694
	qa \
1695
	$(python_test_support)
1696

    
1697
test/py/daemon-util_unittest.bash: daemons/daemon-util
1698

    
1699
test/py/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
1700

    
1701
test/py/bash_completion.bash: doc/examples/bash_completion-debug
1702

    
1703
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
1704
	sed -f $(REPLACE_VARS_SED) < $< > $@
1705
	chmod +x $@
1706

    
1707
tools/kvm-ifup-os: tools/kvm-ifup-os.in $(REPLACE_VARS_SED)
1708
	sed -f $(REPLACE_VARS_SED) < $< > $@
1709
	chmod +x $@
1710

    
1711
tools/vif-ganeti: tools/vif-ganeti.in $(REPLACE_VARS_SED)
1712
	sed -f $(REPLACE_VARS_SED) < $< > $@
1713
	chmod +x $@
1714

    
1715
tools/net-common: tools/net-common.in $(REPLACE_VARS_SED)
1716
	sed -f $(REPLACE_VARS_SED) < $< > $@
1717
	chmod +x $@
1718

    
1719
tools/users-setup: Makefile $(userspecs)
1720
	set -e; \
1721
	{ echo '#!/bin/sh'; \
1722
	  echo 'if [ "x$$1" != "x--yes-do-it" ];'; \
1723
	  echo 'then echo "This will do the following changes"'; \
1724
	  $(AWK) -- '{print "echo + Will add group ",$$1; count++}\
1725
	             END {if (count == 0) {print "echo + No groups to add"}}' doc/users/groups; \
1726
	  $(AWK) -- '{if (NF > 1) {print "echo + Will add user",$$1,"with primary group",$$2} \
1727
	                          else {print "echo + Will add user",$$1}; count++}\
1728
	             END {if (count == 0) {print "echo + No users to add"}}' doc/users/users; \
1729
	  $(AWK) -- '{print "echo + Will add user",$$1,"to group",$$2}' doc/users/groupmemberships; \
1730
	  echo 'echo'; \
1731
	  echo 'echo "OK? (y/n)"'; \
1732
	  echo 'read confirm'; \
1733
	  echo 'if [ "x$$confirm" != "xy" ]; then exit 0; fi'; \
1734
	  echo 'fi'; \
1735
	  $(AWK) -- '{print "addgroup --system",$$1}' doc/users/groups; \
1736
	  $(AWK) -- '{if (NF > 1) {print "adduser --system --ingroup",$$2,$$1} else {print "adduser --system",$$1}}' doc/users/users; \
1737
	  $(AWK) -- '{print "adduser",$$1,$$2}' doc/users/groupmemberships; \
1738
	} > $@
1739
	chmod +x $@
1740

    
1741
tools/vcluster-setup: tools/vcluster-setup.in $(REPLACE_VARS_SED)
1742
	sed -f $(REPLACE_VARS_SED) < $< > $@
1743
	chmod +x $@
1744

    
1745
daemons/%:: daemons/%.in $(REPLACE_VARS_SED)
1746
	sed -f $(REPLACE_VARS_SED) < $< > $@
1747
	chmod +x $@
1748

    
1749
doc/examples/%:: doc/examples/%.in $(REPLACE_VARS_SED)
1750
	sed -f $(REPLACE_VARS_SED) < $< > $@
1751

    
1752
doc/examples/bash_completion: BC_ARGS = --compact
1753
doc/examples/bash_completion-debug: BC_ARGS =
1754

    
1755
doc/examples/bash_completion doc/examples/bash_completion-debug: \
1756
	$(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
1757
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin \
1758
	daemons/ganeti-cleaner \
1759
	$(GENERATED_FILES) $(HS_GENERATED_FILES)
1760
	PYTHONPATH=. $(RUN_IN_TEMPDIR) \
1761
	  $(CURDIR)/$(BUILD_BASH_COMPLETION) $(BC_ARGS) > $@
1762

    
1763
man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py \
1764
	lib/build/shell_example_lexer.py \
1765
	| $(RUN_IN_TEMPDIR) $(built_python_sources)
1766
	@echo "Checking $< for hardcoded paths..."
1767
	@if grep -nEf autotools/wrong-hardcoded-paths $<; then \
1768
	  echo "Man page $< has hardcoded paths (see above)!" 1>&2 ; \
1769
	  exit 1; \
1770
	fi
1771
	set -e ; \
1772
	trap 'echo auto-removing $@; rm $@' EXIT; \
1773
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@ ;\
1774
	$(CHECK_MAN_REFERENCES) $@; \
1775
	trap - EXIT
1776

    
1777
man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.rst
1778
	@test -n "$(PANDOC)" || \
1779
	  { echo 'pandoc' not found during configure; exit 1; }
1780
	set -o pipefail -e; \
1781
	trap 'echo auto-removing $@; rm $@' EXIT; \
1782
	$(PANDOC) -s -f rst -t man $< man/footer.rst | \
1783
	  sed -e 's/\\@/@/g' > $@; \
1784
	if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN_WARNINGS) $@; fi; \
1785
	$(CHECK_MAN_DASHES) $@; \
1786
	trap - EXIT
1787

    
1788
man/%.html.in: man/%.gen man/footer.rst
1789
	@test -n "$(PANDOC)" || \
1790
	  { echo 'pandoc' not found during configure; exit 1; }
1791
	set -o pipefail ; \
1792
	$(PANDOC) --toc -s -f rst -t html $< man/footer.rst | \
1793
	  sed -e 's/\\@/@/g' > $@
1794

    
1795
man/%: man/%.in  $(REPLACE_VARS_SED)
1796
	sed -f $(REPLACE_VARS_SED) < $< > $@
1797

    
1798
epydoc.conf: epydoc.conf.in $(REPLACE_VARS_SED)
1799
	sed -f $(REPLACE_VARS_SED) < $< > $@
1800

    
1801
vcs-version:
1802
	if test -d .git; then \
1803
	  git describe > $@; \
1804
	elif test ! -f $@ ; then \
1805
	  echo "Cannot auto-generate $@ file"; exit 1; \
1806
	fi
1807

    
1808
.PHONY: clean-vcs-version
1809
clean-vcs-version:
1810
	rm -f vcs-version
1811

    
1812
.PHONY: regen-vcs-version
1813
regen-vcs-version:
1814
	@set -e; \
1815
	cd $(srcdir); \
1816
	if test -d .git; then \
1817
	  T=`mktemp` ; trap 'rm -f $$T' EXIT; \
1818
	  git describe > $$T; \
1819
	  if ! cmp --quiet $$T vcs-version; then \
1820
	    mv $$T vcs-version; \
1821
	  fi; \
1822
	fi
1823

    
1824
src/Ganeti/Version.hs: src/Ganeti/Version.hs.in \
1825
	vcs-version $(built_base_sources)
1826
	set -e; \
1827
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
1828
	sed -e "s/%ver%/$$VCSVER/" < $< > $@
1829

    
1830
src/Ganeti/Hs2Py/ListConstants.hs: src/Ganeti/Hs2Py/ListConstants.hs.in \
1831
				   src/Ganeti/Constants.hs \
1832
			         | stamp-directories
1833
	@echo Generating $@
1834
	@set -e; \
1835
## Extract constant names from 'Constants.hs' by extracting the left
1836
## side of all lines containing an equal sign (i.e., '=') and
1837
## prepending the apostrophe sign (i.e., "'").
1838
##
1839
## For example, the constant
1840
##   adminstDown = ...
1841
## becomes
1842
##   'adminstDown
1843
	NAMES=$$(sed -e "/^--/ d" $(abs_top_srcdir)/src/Ganeti/Constants.hs |\
1844
		 sed -n -e "/=/ s/\(.*\) =.*/    '\1:/g p"); \
1845
	m4 -DPY_CONSTANT_NAMES="$$NAMES" \
1846
		$(abs_top_srcdir)/src/Ganeti/Hs2Py/ListConstants.hs.in > $@
1847

    
1848
src/Ganeti/Curl/Internal.hs: src/Ganeti/Curl/Internal.hsc | stamp-directories
1849
	hsc2hs -o $@ $<
1850

    
1851
test/hs/Test/Ganeti/TestImports.hs: test/hs/Test/Ganeti/TestImports.hs.in \
1852
	$(built_base_sources)
1853
	set -e; \
1854
	{ cat $< ; \
1855
	  echo ; \
1856
	  for name in $(filter-out Ganeti.THH,$(subst /,.,$(patsubst %.hs,%,$(patsubst src/%,%,$(HS_LIB_SRCS))))) ; do \
1857
	    echo "import $$name ()" ; \
1858
	  done ; \
1859
	} > $@
1860

    
1861
lib/_constants.py: Makefile src/hs2py lib/_constants.py.in | stamp-directories
1862
	cat $(abs_top_srcdir)/lib/_constants.py.in > $@
1863
	src/hs2py --constants >> $@
1864

    
1865
lib/constants.py: lib/_constants.py
1866

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

    
1941
lib/_vcsversion.py: Makefile vcs-version | stamp-directories
1942
	set -e; \
1943
	VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
1944
	{ echo '# This file is automatically generated, do not edit!'; \
1945
	  echo '#'; \
1946
	  echo ''; \
1947
	  echo '"""Build-time VCS version number for Ganeti.'; \
1948
	  echo '';\
1949
	  echo 'This file is autogenerated by the build process.'; \
1950
	  echo 'For any changes you need to re-run ./configure (and'; \
1951
	  echo 'not edit by hand).'; \
1952
	  echo ''; \
1953
	  echo '"""'; \
1954
	  echo ''; \
1955
	  echo '# pylint: disable=C0301,C0324'; \
1956
	  echo '# because this is autogenerated, we do not want'; \
1957
	  echo '# style warnings' ; \
1958
	  echo ''; \
1959
	  echo "VCS_VERSION = '$$VCSVER'"; \
1960
	} > $@
1961

    
1962
lib/opcodes.py: Makefile src/hs2py lib/opcodes.py.in_before \
1963
		lib/opcodes.py.in_after | stamp-directories
1964
	cat $(abs_top_srcdir)/lib/opcodes.py.in_before > $@
1965
	src/hs2py --opcodes >> $@
1966
	cat $(abs_top_srcdir)/lib/opcodes.py.in_after >> $@
1967

    
1968
lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC)
1969
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
1970

    
1971
lib/rpc/stub/wconfd.py: Makefile src/hs2py | stamp-directories
1972
	src/hs2py --wconfd-rpc > $@
1973

    
1974
$(SHELL_ENV_INIT): Makefile stamp-directories
1975
	set -e; \
1976
	{ echo '# Allow overriding for tests'; \
1977
	  echo 'readonly LOCALSTATEDIR=$${LOCALSTATEDIR:-$${GANETI_ROOTDIR:-}$(localstatedir)}'; \
1978
	  echo 'readonly SYSCONFDIR=$${SYSCONFDIR:-$${GANETI_ROOTDIR:-}$(sysconfdir)}'; \
1979
	  echo; \
1980
	  echo 'readonly PKGLIBDIR=$(libdir)/ganeti'; \
1981
	  echo 'readonly LOG_DIR="$$LOCALSTATEDIR/log/ganeti"'; \
1982
	  echo 'readonly RUN_DIR="$$LOCALSTATEDIR/run/ganeti"'; \
1983
	  echo 'readonly DATA_DIR="$$LOCALSTATEDIR/lib/ganeti"'; \
1984
	  echo 'readonly CONF_DIR="$$SYSCONFDIR/ganeti"'; \
1985
	} > $@
1986

    
1987
## Writes sed script to replace placeholders with build-time values. The
1988
## additional quotes after the first @ sign are necessary to stop configure
1989
## from replacing those values as well.
1990
$(REPLACE_VARS_SED): $(SHELL_ENV_INIT) Makefile stamp-directories
1991
	set -e; \
1992
	{ echo 's#@''PREFIX@#$(prefix)#g'; \
1993
	  echo 's#@''SYSCONFDIR@#$(sysconfdir)#g'; \
1994
	  echo 's#@''LOCALSTATEDIR@#$(localstatedir)#g'; \
1995
	  echo 's#@''BINDIR@#$(BINDIR)#g'; \
1996
	  echo 's#@''SBINDIR@#$(SBINDIR)#g'; \
1997
	  echo 's#@''LIBDIR@#$(libdir)#g'; \
1998
	  echo 's#@''GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
1999
	  echo 's#@''CUSTOM_XEN_BOOTLOADER@#$(XEN_BOOTLOADER)#g'; \
2000
	  echo 's#@''CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
2001
	  echo 's#@''CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
2002
	  echo 's#@''CUSTOM_IALLOCATOR_SEARCH_PATH@#$(IALLOCATOR_SEARCH_PATH)#g'; \
2003
	  echo 's#@''CUSTOM_EXPORT_DIR@#$(EXPORT_DIR)#g'; \
2004
	  echo 's#@''RPL_SSH_INITD_SCRIPT@#$(SSH_INITD_SCRIPT)#g'; \
2005
	  echo 's#@''PKGLIBDIR@#$(libdir)/ganeti#g'; \
2006
	  echo 's#@''GNTMASTERUSER@#$(MASTERD_USER)#g'; \
2007
	  echo 's#@''GNTRAPIUSER@#$(RAPI_USER)#g'; \
2008
	  echo 's#@''GNTCONFDUSER@#$(CONFD_USER)#g'; \
2009
	  echo 's#@''GNTWCONFDUSER@#$(WCONFD_USER)#g'; \
2010
	  echo 's#@''GNTLUXIDUSER@#$(LUXID_USER)#g'; \
2011
	  echo 's#@''GNTNODEDUSER@#$(NODED_USER)#g'; \
2012
	  echo 's#@''GNTMONDUSER@#$(MOND_USER)#g'; \
2013
	  echo 's#@''GNTRAPIGROUP@#$(RAPI_GROUP)#g'; \
2014
	  echo 's#@''GNTADMINGROUP@#$(ADMIN_GROUP)#g'; \
2015
	  echo 's#@''GNTCONFDGROUP@#$(CONFD_GROUP)#g'; \
2016
	  echo 's#@''GNTNODEDGROUP@#$(NODED_GROUP)#g'; \
2017
	  echo 's#@''GNTWCONFDGROUP@#$(CONFD_GROUP)#g'; \
2018
	  echo 's#@''GNTLUXIDGROUP@#$(LUXID_GROUP)#g'; \
2019
	  echo 's#@''GNTMASTERDGROUP@#$(MASTERD_GROUP)#g'; \
2020
	  echo 's#@''GNTMONDGROUP@#$(MOND_GROUP)#g'; \
2021
	  echo 's#@''GNTDAEMONSGROUP@#$(DAEMONS_GROUP)#g'; \
2022
	  echo 's#@''CUSTOM_ENABLE_CONFD@#$(ENABLE_CONFD)#g'; \
2023
	  echo 's#@''CUSTOM_ENABLE_MOND@#$(ENABLE_MOND)#g'; \
2024
	  echo 's#@''MODULES@#$(strip $(lint_python_code))#g'; \
2025
	  echo 's#@''XEN_CONFIG_DIR@#$(XEN_CONFIG_DIR)#g'; \
2026
	  echo; \
2027
	  echo '/^@SHELL_ENV_INIT@$$/ {'; \
2028
	  echo '  r $(SHELL_ENV_INIT)'; \
2029
	  echo '  d'; \
2030
	  echo '}'; \
2031
	} > $@
2032

    
2033
# Using deferred evaluation
2034
daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
2035
daemons/ganeti-watcher: MODULE = ganeti.watcher
2036
scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
2037
tools/burnin: MODULE = ganeti.tools.burnin
2038
tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
2039
tools/node-daemon-setup: MODULE = ganeti.tools.node_daemon_setup
2040
tools/prepare-node-join: MODULE = ganeti.tools.prepare_node_join
2041
tools/node-cleanup: MODULE = ganeti.tools.node_cleanup
2042
$(HS_BUILT_TEST_HELPERS): TESTROLE = $(patsubst test/hs/%,%,$@)
2043

    
2044
$(PYTHON_BOOTSTRAP) $(gnt_scripts) $(gnt_python_sbin_SCRIPTS): Makefile | stamp-directories
2045
	test -n "$(MODULE)" || { echo Missing module; exit 1; }
2046
	set -e; \
2047
	{ echo '#!/usr/bin/python'; \
2048
	  echo '# This file is automatically generated, do not edit!'; \
2049
	  echo "# Edit $(MODULE) instead."; \
2050
	  echo; \
2051
	  echo '"""Bootstrap script for L{$(MODULE)}"""'; \
2052
	  echo; \
2053
	  echo '# pylint: disable=C0103'; \
2054
	  echo '# C0103: Invalid name'; \
2055
	  echo; \
2056
	  echo 'import sys'; \
2057
	  echo 'import $(MODULE) as main'; \
2058
	  echo; \
2059
	  echo '# Temporarily alias commands until bash completion'; \
2060
	  echo '# generator is changed'; \
2061
	  echo 'if hasattr(main, "commands"):'; \
2062
	  echo '  commands = main.commands # pylint: disable=E1101'; \
2063
	  echo 'if hasattr(main, "aliases"):'; \
2064
	  echo '  aliases = main.aliases # pylint: disable=E1101'; \
2065
	  echo; \
2066
	  echo 'if __name__ == "__main__":'; \
2067
	  echo '  sys.exit(main.Main())'; \
2068
	} > $@
2069
	chmod u+x $@
2070

    
2071
$(HS_BUILT_TEST_HELPERS): Makefile
2072
	@test -n "$(TESTROLE)" || { echo Missing TESTROLE; exit 1; }
2073
	set -e; \
2074
	{ echo '#!/bin/sh'; \
2075
	  echo '# This file is automatically generated, do not edit!'; \
2076
	  echo "# Edit Makefile.am instead."; \
2077
	  echo; \
2078
	  echo "HTOOLS=$(TESTROLE) exec ./test/hs/hpc-htools \"\$$@\""; \
2079
	} > $@
2080
	chmod u+x $@
2081

    
2082
stamp-directories: Makefile
2083
	$(MAKE) $(AM_MAKEFLAGS) ganeti
2084
	@mkdir_p@ $(DIRS) $(BUILDTIME_DIR_AUTOCREATE)
2085
	touch $@
2086

    
2087
# We need to create symlinks because "make distcheck" will not install Python
2088
# files when building.
2089
stamp-srclinks: Makefile | stamp-directories
2090
	set -e; \
2091
	for i in $(srclink_files); do \
2092
	  if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
2093
	    $(LN_S) $(abs_top_srcdir)/$$i $$i; \
2094
	  fi; \
2095
	done
2096
	touch $@
2097

    
2098
.PHONY: ganeti
2099
ganeti:
2100
	cd $(top_builddir) && test -h "$@" || { rm -f $@ && $(LN_S) lib $@; }
2101

    
2102
.PHONY: check-dirs
2103
check-dirs: $(GENERATED_FILES)
2104
	@set -e; \
2105
	find . -type d \( -name . -o -name .git -prune -o -print \) | { \
2106
	  error=; \
2107
	  while read dir; do \
2108
	    case "$$dir" in \
2109
	      $(strip $(patsubst %,(./%) ;;,$(DIRCHECK_EXCLUDE) $(DIRS))) \
2110
	      *) error=1; echo "Directory $$dir not listed in Makefile" >&2 ;; \
2111
	    esac; \
2112
	  done; \
2113
	  for dir in $(DIRS); do \
2114
	    if ! test -d "$$dir"; then \
2115
	      echo "Directory $$dir listed in DIRS does not exist" >&2; \
2116
	      error=1; \
2117
	    fi \
2118
	  done; \
2119
	  test -z "$$error"; \
2120
	}
2121

    
2122
.PHONY: check-news
2123
check-news:
2124
	RELEASE=$(PACKAGE_VERSION) $(CHECK_NEWS) < $(top_srcdir)/NEWS
2125

    
2126
.PHONY: check-local
2127
check-local: check-dirs check-news $(GENERATED_FILES)
2128
	$(CHECK_PYTHON_CODE) $(check_python_code)
2129
	PYTHONPATH=. $(CHECK_HEADER) $(check_python_code)
2130
	$(CHECK_VERSION) $(VERSION) $(top_srcdir)/NEWS
2131
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(CHECK_IMPORTS) . $(standalone_python_modules)
2132
	error= ; \
2133
	if [ "x`echo $(VERSION_SUFFIX)|grep 'alpha'`" == "x" ]; then \
2134
	  expver=$(VERSION_MAJOR).$(VERSION_MINOR); \
2135
	  if test "`head -n 1 $(top_srcdir)/README`" != "Ganeti $$expver"; then \
2136
	    echo "Incorrect version in README, expected $$expver" >&2; \
2137
	    error=1; \
2138
	  fi; \
2139
	  for file in doc/iallocator.rst doc/hooks.rst doc/virtual-cluster.rst \
2140
	      doc/security.rst; do \
2141
	    if test "`sed -ne '4 p' $(top_srcdir)/$$file`" != \
2142
	      "Documents Ganeti version $$expver"; then \
2143
	      echo "Incorrect version in $$file, expected $$expver" >&2; \
2144
	      error=1; \
2145
	    fi; \
2146
	  done; \
2147
	  if ! test -f $(top_srcdir)/doc/design-$$expver.rst; then \
2148
	    echo "File $(top_srcdir)/doc/design-$$expver.rst not found" >&2; \
2149
	    error=1; \
2150
	  fi; \
2151
	  if test "`sed -ne '5 p' $(top_srcdir)/doc/design-draft.rst`" != \
2152
	    ".. Last updated for Ganeti $$expver"; then \
2153
	    echo "doc/design-draft.rst was not updated for version $$expver" >&2; \
2154
	    error=1; \
2155
	  fi; \
2156
	fi; \
2157
	for file in configure.ac $(HS_LIBTEST_SRCS) $(HS_PROG_SRCS); do \
2158
	  if test $$(wc --max-line-length < $(top_srcdir)/$$file) -gt 80; then \
2159
	    echo "Longest line in $$file is longer than 80 characters" >&2; \
2160
	    error=1; \
2161
	  fi; \
2162
	done; \
2163
	test -z "$$error"
2164

    
2165
.PHONY: hs-test-%
2166
hs-test-%: test/hs/htest
2167
	@rm -f htest.tix
2168
	test/hs/htest -t $*
2169

    
2170
.PHONY: hs-tests
2171
hs-tests: test/hs/htest
2172
	@rm -f htest.tix
2173
	./test/hs/htest
2174

    
2175
.PHONY: hs-shell-%
2176
hs-shell-%: test/hs/hpc-htools test/hs/hpc-mon-collector \
2177
            $(HS_BUILT_TEST_HELPERS)
2178
	@rm -f hpc-htools.tix hpc-mon-collector.tix
2179
	HBINARY="./test/hs/hpc-htools" \
2180
	SHELLTESTARGS=$(SHELLTESTARGS) \
2181
	./test/hs/offline-test.sh $*
2182

    
2183
.PHONY: hs-shell
2184
hs-shell: test/hs/hpc-htools test/hs/hpc-mon-collector $(HS_BUILT_TEST_HELPERS)
2185
	@rm -f hpc-htools.tix hpc-mon-collector.tix
2186
	HBINARY="./test/hs/hpc-htools" \
2187
	SHELLTESTARGS=$(SHELLTESTARGS) \
2188
	./test/hs/offline-test.sh
2189

    
2190
.PHONY: hs-check
2191
hs-check: hs-tests hs-shell
2192

    
2193
# E111: indentation is not a multiple of four
2194
# E121: continuation line indentation is not a multiple of four
2195
#       (since our indent level is not 4)
2196
# E125: continuation line does not distinguish itself from next logical line
2197
#       (since our indent level is not 4)
2198
# E123: closing bracket does not match indentation of opening bracket's line
2199
# E127: continuation line over-indented for visual indent
2200
#       (since our indent level is not 4)
2201
# note: do NOT add E128 here; it's a valid style error in most cases!
2202
# I've seen real errors, but also some cases were we indent wrongly
2203
# due to line length; try to rework the cases where it is triggered,
2204
# instead of silencing it
2205
# E261: at least two spaces before inline comment
2206
# E501: line too long (80 characters)
2207
PEP8_IGNORE = E111,E121,E123,E125,E127,E261,E501
2208

    
2209
# For excluding pep8 expects filenames only, not whole paths
2210
PEP8_EXCLUDE = $(subst $(space),$(comma),$(strip $(notdir $(built_python_sources))))
2211

    
2212
# A space-separated list of pylint warnings to completely ignore:
2213
# I0013 = disable warnings for ignoring whole files
2214
LINT_DISABLE = I0013
2215
# Additional pylint options
2216
LINT_OPTS =
2217
# The combined set of pylint options
2218
LINT_OPTS_ALL = $(LINT_OPTS) \
2219
  $(addprefix --disable=,$(LINT_DISABLE))
2220

    
2221
LINT_TARGETS = pylint pylint-qa pylint-test
2222
if HAS_PEP8
2223
LINT_TARGETS += pep8
2224
endif
2225
if HAS_HLINT
2226
LINT_TARGETS += hlint
2227
endif
2228

    
2229
.PHONY: lint
2230
lint: $(LINT_TARGETS)
2231

    
2232
.PHONY: pylint
2233
pylint: $(GENERATED_FILES)
2234
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2235
	$(PYLINT) $(LINT_OPTS_ALL) $(lint_python_code)
2236

    
2237
.PHONY: pylint-qa
2238
pylint-qa: $(GENERATED_FILES)
2239
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2240
	cd $(top_srcdir)/qa && \
2241
	  PYTHONPATH=$(abs_top_srcdir) $(PYLINT) $(LINT_OPTS_ALL) \
2242
		--rcfile  ../pylintrc $(patsubst qa/%.py,%,$(qa_scripts))
2243
# FIXME: lint all test code, not just the newly added test support
2244
pylint-test: $(GENERATED_FILES)
2245
	@test -n "$(PYLINT)" || { echo 'pylint' not found during configure; exit 1; }
2246
	cd $(top_srcdir) && \
2247
		PYTHONPATH=.:./test/py $(PYLINT) $(LINT_OPTS_ALL) \
2248
		--rcfile=pylintrc-test  $(python_test_support)
2249

    
2250
.PHONY: pep8
2251
pep8: $(GENERATED_FILES)
2252
	@test -n "$(PEP8)" || { echo 'pep8' not found during configure; exit 1; }
2253
	$(PEP8) --ignore='$(PEP8_IGNORE)' --exclude='$(PEP8_EXCLUDE)' \
2254
	  --repeat $(pep8_python_code)
2255

    
2256
# FIXME: remove ignore "Use void" when GHC 6.x is deprecated
2257
HLINT_EXCLUDES = src/Ganeti/THH.hs test/hs/hpc-htools.hs
2258
.PHONY: hlint
2259
hlint: $(HS_BUILT_SRCS) src/lint-hints.hs
2260
	@test -n "$(HLINT)" || { echo 'hlint' not found during configure; exit 1; }
2261
	@rm -f doc/hs-lint.html
2262
	if tty -s; then C="-c"; else C=""; fi; \
2263
	$(HLINT) --utf8 --report=doc/hs-lint.html --cross $$C \
2264
	  --ignore "Use first" \
2265
	  --ignore "Use &&&" \
2266
	  --ignore "Use void" \
2267
	  --ignore "Reduce duplication" \
2268
	  --hint src/lint-hints \
2269
	  $(filter-out $(HLINT_EXCLUDES),$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS))
2270
	@if [ ! -f doc/hs-lint.html ]; then \
2271
	  echo "All good" > doc/hs-lint.html; \
2272
	fi
2273

    
2274
# a dist hook rule for updating the vcs-version file; this is
2275
# hardcoded due to where it needs to build the file...
2276
dist-hook:
2277
	$(MAKE) $(AM_MAKEFLAGS) regen-vcs-version
2278
	rm -f $(top_distdir)/vcs-version
2279
	cp -p $(srcdir)/vcs-version $(top_distdir)
2280

    
2281
# a distcheck hook rule for catching revision control directories
2282
distcheck-hook:
2283
	if find $(top_distdir) -name .svn -or -name .git | grep .; then \
2284
	  echo "Found revision control files in final archive." 1>&2; \
2285
	  exit 1; \
2286
	fi
2287
	if find $(top_distdir) -name '*.py[co]' | grep .; then \
2288
	  echo "Found Python byte code in final archive." 1>&2; \
2289
	  exit 1; \
2290
	fi
2291
	if find $(top_distdir) -name '*~' | grep .; then \
2292
	  echo "Found backup files in final archive." 1>&2; \
2293
	  exit 1; \
2294
	fi
2295
# Empty files or directories should not be distributed. They can cause
2296
# unnecessary warnings for packagers. Directories used by automake during
2297
# distcheck must be excluded.
2298
	if find $(top_distdir) -empty -and -not \( \
2299
	    -path $(top_distdir)/_build -or \
2300
	    -path $(top_distdir)/_inst \) | grep .; then \
2301
	  echo "Found empty files or directories in final archive." 1>&2; \
2302
	  exit 1; \
2303
	fi
2304
	if test -e $(top_distdir)/doc/man-html; then \
2305
	  echo "Found documentation including man pages in final archive" >&2; \
2306
	  exit 1; \
2307
	fi
2308

    
2309
# Backwards compatible distcheck-release target
2310
distcheck-release: distcheck
2311

    
2312
distrebuildcheck: dist
2313
	set -e; \
2314
	builddir=$$(mktemp -d $(abs_srcdir)/distrebuildcheck.XXXXXXX); \
2315
	trap "echo Removing $$builddir; cd $(abs_srcdir); rm -rf $$builddir" EXIT; \
2316
	cd $$builddir; \
2317
	tar xzf $(abs_srcdir)/$(distdir).tar.gz; \
2318
	cd $(distdir); \
2319
	./configure; \
2320
	$(MAKE) maintainer-clean; \
2321
	cp $(abs_srcdir)/vcs-version .; \
2322
	./configure; \
2323
	$(MAKE) $(AM_MAKEFLAGS)
2324

    
2325
dist-release: dist
2326
	set -e; \
2327
	for i in $(DIST_ARCHIVES); do \
2328
	  echo -n "Checking $$i ... "; \
2329
	  autotools/check-tar < $$i; \
2330
	  echo OK; \
2331
	done
2332

    
2333
install-exec-local:
2334
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
2335
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
2336
	  "$(DESTDIR)${localstatedir}/run/ganeti"
2337
	for dir in $(SYMLINK_TARGET_DIRS); do \
2338
	  @mkdir_p@  $(DESTDIR)$$dir; \
2339
	done
2340
	$(LN_S) -f $(sysconfdir)/ganeti/lib $(DESTDIR)$(defaultversiondir)
2341
	$(LN_S) -f $(sysconfdir)/ganeti/share $(DESTDIR)$(defaultversionedsharedir)
2342
	for prog in $(HS_BIN_ROLES); do \
2343
	  $(LN_S) -f $(defaultversiondir)$(BINDIR)/$$prog $(DESTDIR)$(BINDIR)/$$prog; \
2344
	done
2345
	$(LN_S) -f $(defaultversiondir)$(libdir)/ganeti/iallocators/hail $(DESTDIR)$(libdir)/ganeti/iallocators/hail
2346
	for prog in $(all_sbin_scripts); do \
2347
	  $(LN_S) -f $(defaultversiondir)$(SBINDIR)/$$prog $(DESTDIR)$(SBINDIR)/$$prog; \
2348
	done
2349
	for prog in $(gnt_scripts_basenames); do \
2350
	  $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(SBINDIR)/$$prog; \
2351
	done
2352
	for prog in $(pkglib_python_basenames); do \
2353
	  $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(libdir)/ganeti/$$prog; \
2354
	done
2355
	for prog in $(tools_python_basenames); do \
2356
	  $(LN_S) -f $(defaultversionedsharedir)/$$prog $(DESTDIR)$(libdir)/ganeti/tools/$$prog; \
2357
	done
2358
	for prog in $(tools_basenames); do \
2359
	  $(LN_S) -f $(defaultversiondir)/$(libdir)/ganeti/tools/$$prog $(DESTDIR)$(libdir)/ganeti/tools/$$prog; \
2360
	done
2361
	if ! test -n '$(ENABLE_MANPAGES)'; then \
2362
	  for man in $(manfullpath); do \
2363
	    $(LN_S) -f $(defaultversionedsharedir)/root$(MANDIR)/$$man $(DESTDIR)$(MANDIR)/$$man; \
2364
	  done; \
2365
	fi
2366
	for prog in $(myexeclib_scripts_basenames); do \
2367
	  $(LN_S) -f $(defaultversiondir)$(libdir)/ganeti/$$prog $(DESTDIR)$(libdir)/ganeti/$$prog; \
2368
	done
2369
if INSTALL_SYMLINKS
2370
	$(LN_S) -f $(versionedsharedir) $(DESTDIR)$(sysconfdir)/ganeti/share
2371
	$(LN_S) -f $(versiondir) $(DESTDIR)$(sysconfdir)/ganeti/lib
2372
endif
2373

    
2374
.PHONY: apidoc
2375
if WANT_HSAPIDOC
2376
apidoc: py-apidoc hs-apidoc
2377
else
2378
apidoc: py-apidoc
2379
endif
2380

    
2381
.PHONY: py-apidoc
2382
py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(GENERATED_FILES)
2383
	env - PATH="$$PATH" PYTHONPATH="$$PYTHONPATH" \
2384
	$(RUN_IN_TEMPDIR) epydoc -v \
2385
	  --conf $(CURDIR)/epydoc.conf \
2386
	  --output $(CURDIR)/$(APIDOC_PY_DIR)
2387

    
2388
.PHONY: hs-apidoc
2389
hs-apidoc: $(APIDOC_HS_DIR)/index.html
2390

    
2391
$(APIDOC_HS_DIR)/index.html: $(HS_LIBTESTBUILT_SRCS) Makefile
2392
	@test -n "$(HSCOLOUR)" || \
2393
	    { echo 'HsColour' not found during configure; exit 1; }
2394
	@test -n "$(HADDOCK)" || \
2395
	    { echo 'haddock' not found during configure; exit 1; }
2396
	rm -rf $(APIDOC_HS_DIR)/*
2397
	for i in $(ALL_APIDOC_HS_DIRS); do \
2398
	  @mkdir_p@ $$i; \
2399
	  $(HSCOLOUR) -print-css > $$i/hscolour.css; \
2400
	done
2401
	set -e ; \
2402
	export LC_ALL=en_US.UTF-8; \
2403
	OPTGHC="--optghc=-isrc --optghc=-itest/hs"; \
2404
	if [ "$(HS_PARALLEL3)" ]; \
2405
	then OPTGHC="$$OPTGHC --optghc=$(HS_PARALLEL3)"; \
2406
	fi; \
2407
	if [ "$(HS_REGEX_PCRE)" ]; \
2408
	then OPTGHC="$$OPTGHC --optghc=$(HS_REGEX_PCRE)"; \
2409
	fi; \
2410
	for file in $(HS_LIBTESTBUILT_SRCS); do \
2411
	  f_nosrc=$${file##src/}; \
2412
	  f_notst=$${f_nosrc##test/hs/}; \
2413
	  f_html=$${f_notst%%.hs}.html; \
2414
	  $(HSCOLOUR) -css -anchor $$file > $(APIDOC_HS_DIR)/$$f_html ; \
2415
	done ; \
2416
	$(HADDOCK) --odir $(APIDOC_HS_DIR) --html --hoogle --ignore-all-exports -w \
2417
	  -t ganeti -p src/haddock-prologue \
2418
	  --source-module="%{MODULE/.//}.html" \
2419
	  --source-entity="%{MODULE/.//}.html#%{NAME}" \
2420
	  $$OPTGHC \
2421
	  $(HS_LIBTESTBUILT_SRCS)
2422

    
2423
.PHONY: TAGS
2424
TAGS: $(GENERATED_FILES)
2425
	rm -f TAGS
2426
	$(GHC) -e ":etags TAGS_hs" -v0 \
2427
	  $(filter-out -O -Werror,$(HFLAGS)) \
2428
		-osuf tags.o \
2429
		-hisuf tags.hi \
2430
    -lcurl \
2431
	  $(HS_PARALLEL3) $(HS_REGEX_PCRE) \
2432
	  $(HS_LIBTEST_SRCS)
2433
	find . -path './lib/*.py' -o -path './scripts/gnt-*' -o \
2434
	  -path './daemons/ganeti-*' -o -path './tools/*' -o \
2435
	  -path './qa/*.py' | \
2436
	  etags --etags-include=TAGS_hs -L -
2437

    
2438
.PHONY: coverage
2439

    
2440
COVERAGE_TESTS=
2441
if HS_UNIT
2442
COVERAGE_TESTS += hs-coverage
2443
endif
2444
if PY_UNIT
2445
COVERAGE_TESTS += py-coverage
2446
endif
2447

    
2448
coverage: $(COVERAGE_TESTS)
2449

    
2450
test/py/docs_unittest.py: $(gnt_scripts)
2451

    
2452
.PHONY: py-coverage
2453
py-coverage: $(GENERATED_FILES) $(python_tests)
2454
	@test -n "$(PYCOVERAGE)" || \
2455
	    { echo 'python-coverage' not found during configure; exit 1; }
2456
	set -e; \
2457
	COVERAGE=$(PYCOVERAGE) \
2458
	COVERAGE_FILE=$(CURDIR)/$(COVERAGE_PY_DIR)/data \
2459
	TEXT_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR)/report.txt \
2460
	HTML_COVERAGE=$(CURDIR)/$(COVERAGE_PY_DIR) \
2461
	$(PLAIN_TESTS_ENVIRONMENT) \
2462
	$(abs_top_srcdir)/autotools/gen-py-coverage \
2463
	$(python_tests)
2464

    
2465
.PHONY: hs-coverage
2466
hs-coverage: $(haskell_tests) test/hs/hpc-htools test/hs/hpc-mon-collector
2467
	rm -f *.tix
2468
	$(MAKE) $(AM_MAKEFLAGS) hs-check
2469
	@mkdir_p@ $(COVERAGE_HS_DIR)
2470
	hpc sum --union $(HPCEXCL) \
2471
	  htest.tix hpc-htools.tix hpc-mon-collector.tix > coverage-hs.tix
2472
	hpc markup --destdir=$(COVERAGE_HS_DIR) coverage-hs.tix
2473
	hpc report coverage-hs.tix | tee $(COVERAGE_HS_DIR)/report.txt
2474
	$(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
2475

    
2476
# Special "kind-of-QA" target for htools, needs special setup (all
2477
# tools compiled with -fhpc)
2478
.PHONY: live-test
2479
live-test: all
2480
	set -e ; \
2481
	cd src; \
2482
	rm -f .hpc; $(LN_S) ../.hpc .hpc; \
2483
	rm -f *.tix *.mix; \
2484
	./live-test.sh; \
2485
	hpc sum --union $(HPCEXCL) $(addsuffix .tix,$(HS_PROGS:src/%=%)) \
2486
	  --output=live-test.tix ; \
2487
	@mkdir_p@ ../$(COVERAGE_HS_DIR) ; \
2488
	hpc markup --destdir=../$(COVERAGE_HS_DIR) live-test \
2489
	  --srcdir=.. $(HPCEXCL) ; \
2490
	hpc report --srcdir=.. live-test $(HPCEXCL)
2491

    
2492
commit-check: autotools-check distcheck lint apidoc
2493

    
2494
autotools-check:
2495
	TESTDATA_DIR=./test/data shelltest $(SHELLTESTARGS) \
2496
  $(abs_top_srcdir)/test/autotools/*-*.test \
2497
  -- --hide-successes
2498

    
2499
.PHONY: gitignore-check
2500
gitignore-check:
2501
	@if [ -n "`git status --short`" ]; then \
2502
	  echo "Git status is not clean!" 1>&2 ; \
2503
	  git status --short; \
2504
	  exit 1; \
2505
	fi
2506

    
2507
# target to rebuild all man pages (both groff and html output)
2508
.PHONY: man
2509
man: $(man_MANS) $(manhtml)
2510

    
2511
# Target that builds all binaries (including those that are not
2512
# rebuilt except when running the tests)
2513
.PHONY: really-all
2514
really-all: all $(check_SCRIPTS) $(haskell_tests) $(HS_ALL_PROGS)
2515

    
2516
# we don't need the ancient implicit rules:
2517
%: %,v
2518
%: RCS/%,v
2519
%: RCS/%
2520
%: s.%
2521
%: SCCS/s.%
2522

    
2523
-include ./Makefile.local
2524

    
2525
# vim: set noet :