Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ a85aef5c

History | View | Annotate | Download (73.6 kB)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
210
BUILDTIME_DIRS = \
211
	$(BUILDTIME_DIR_AUTOCREATE) \
212
	doc/html \
213
	doc/man-html
214

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

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

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

    
237
maintainer-clean-local:
238
	rm -rf $(BUILDTIME_DIRS)
239

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

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

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

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

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

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

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

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

    
322
dist_ifup_SCRIPTS = \
323
	tools/kvm-ifup-os
324

    
325
nodist_pkgpython_PYTHON = \
326
	$(BUILT_PYTHON_SOURCES)
327

    
328
nodist_pkgpython_bin_SCRIPTS = \
329
	$(nodist_pkglib_python_scripts)
330

    
331
pkgpython_bin_SCRIPTS = \
332
	$(pkglib_python_scripts)
333

    
334
noinst_PYTHON = \
335
	lib/build/__init__.py \
336
	lib/build/shell_example_lexer.py \
337
	lib/build/sphinx_ext.py
338

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

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

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

    
410
hypervisor_PYTHON = \
411
	lib/hypervisor/__init__.py \
412
	lib/hypervisor/hv_base.py \
413
	lib/hypervisor/hv_chroot.py \
414
	lib/hypervisor/hv_fake.py \
415
	lib/hypervisor/hv_kvm.py \
416
	lib/hypervisor/hv_lxc.py \
417
	lib/hypervisor/hv_xen.py
418

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

    
430
rapi_PYTHON = \
431
	lib/rapi/__init__.py \
432
	lib/rapi/baserlib.py \
433
	lib/rapi/client.py \
434
	lib/rapi/client_utils.py \
435
	lib/rapi/connector.py \
436
	lib/rapi/rlib2.py \
437
	lib/rapi/testutils.py
438

    
439
http_PYTHON = \
440
	lib/http/__init__.py \
441
	lib/http/auth.py \
442
	lib/http/client.py \
443
	lib/http/server.py
444

    
445
confd_PYTHON = \
446
	lib/confd/__init__.py \
447
	lib/confd/client.py
448

    
449
masterd_PYTHON = \
450
	lib/masterd/__init__.py \
451
	lib/masterd/iallocator.py \
452
	lib/masterd/instance.py
453

    
454
impexpd_PYTHON = \
455
	lib/impexpd/__init__.py
456

    
457
watcher_PYTHON = \
458
	lib/watcher/__init__.py \
459
	lib/watcher/nodemaint.py \
460
	lib/watcher/state.py
461

    
462
server_PYTHON = \
463
	lib/server/__init__.py \
464
	lib/server/masterd.py \
465
	lib/server/noded.py \
466
	lib/server/rapi.py
467

    
468
rpc_PYTHON = \
469
	lib/rpc/__init__.py \
470
	lib/rpc/client.py \
471
	lib/rpc/errors.py \
472
	lib/rpc/node.py \
473
	lib/rpc/transport.py
474

    
475
pytools_PYTHON = \
476
	lib/tools/__init__.py \
477
	lib/tools/burnin.py \
478
	lib/tools/ensure_dirs.py \
479
	lib/tools/node_cleanup.py \
480
	lib/tools/node_daemon_setup.py \
481
	lib/tools/prepare_node_join.py
482

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

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

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

    
588
# Haskell programs to be installed in $PREFIX/bin
589
HS_BIN_PROGS=src/htools
590

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

    
598
# Haskell programs to be compiled by "make really-all"
599
HS_COMPILE_PROGS= \
600
	src/ganeti-kvmd \
601
	src/ganeti-metad \
602
	src/ganeti-mond \
603
	src/hconfd \
604
	src/hluxid \
605
	src/hs2py \
606
	src/rpc-test
607

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

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

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

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

    
625
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_DEFAULT_PROGS)) src/mon-collector.hs
626
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
627

    
628
HFLAGS = \
629
	-O -Wall -Werror -isrc \
630
	-fwarn-monomorphism-restriction \
631
	-fwarn-tabs \
632
	$(GHC_BYVERSION_FLAGS)
633

    
634
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
635
HEXTRA =
636
# internal extra flags (used for test/hs/htest mainly)
637
HEXTRA_INT =
638
# exclude options for coverage reports
639
HPCEXCL = --exclude Main \
640
	--exclude Ganeti.Constants \
641
	--exclude Ganeti.HTools.QC \
642
	--exclude Ganeti.THH \
643
	--exclude Ganeti.Version \
644
	--exclude Test.Ganeti.Attoparsec \
645
	--exclude Test.Ganeti.TestCommon \
646
	--exclude Test.Ganeti.TestHTools \
647
	--exclude Test.Ganeti.TestHelper \
648
	--exclude Test.Ganeti.TestImports \
649
	$(patsubst src.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
650

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

    
761
HS_TEST_SRCS = \
762
	test/hs/Test/AutoConf.hs \
763
	test/hs/Test/Ganeti/Attoparsec.hs \
764
	test/hs/Test/Ganeti/BasicTypes.hs \
765
	test/hs/Test/Ganeti/Common.hs \
766
	test/hs/Test/Ganeti/Confd/Types.hs \
767
	test/hs/Test/Ganeti/Confd/Utils.hs \
768
	test/hs/Test/Ganeti/Constants.hs \
769
	test/hs/Test/Ganeti/Daemon.hs \
770
	test/hs/Test/Ganeti/Errors.hs \
771
	test/hs/Test/Ganeti/HTools/Backend/Simu.hs \
772
	test/hs/Test/Ganeti/HTools/Backend/Text.hs \
773
	test/hs/Test/Ganeti/HTools/CLI.hs \
774
	test/hs/Test/Ganeti/HTools/Cluster.hs \
775
	test/hs/Test/Ganeti/HTools/Container.hs \
776
	test/hs/Test/Ganeti/HTools/ExtLoader.hs \
777
	test/hs/Test/Ganeti/HTools/Graph.hs \
778
	test/hs/Test/Ganeti/HTools/Instance.hs \
779
	test/hs/Test/Ganeti/HTools/Loader.hs \
780
	test/hs/Test/Ganeti/HTools/Node.hs \
781
	test/hs/Test/Ganeti/HTools/PeerMap.hs \
782
	test/hs/Test/Ganeti/HTools/Types.hs \
783
	test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs \
784
	test/hs/Test/Ganeti/JSON.hs \
785
	test/hs/Test/Ganeti/Jobs.hs \
786
	test/hs/Test/Ganeti/JQueue.hs \
787
	test/hs/Test/Ganeti/Kvmd.hs \
788
	test/hs/Test/Ganeti/Luxi.hs \
789
	test/hs/Test/Ganeti/Network.hs \
790
	test/hs/Test/Ganeti/Objects.hs \
791
	test/hs/Test/Ganeti/OpCodes.hs \
792
	test/hs/Test/Ganeti/Query/Aliases.hs \
793
	test/hs/Test/Ganeti/Query/Filter.hs \
794
	test/hs/Test/Ganeti/Query/Instance.hs \
795
	test/hs/Test/Ganeti/Query/Language.hs \
796
	test/hs/Test/Ganeti/Query/Network.hs \
797
	test/hs/Test/Ganeti/Query/Query.hs \
798
	test/hs/Test/Ganeti/Rpc.hs \
799
	test/hs/Test/Ganeti/Runtime.hs \
800
	test/hs/Test/Ganeti/Ssconf.hs \
801
	test/hs/Test/Ganeti/Storage/Diskstats/Parser.hs \
802
	test/hs/Test/Ganeti/Storage/Drbd/Parser.hs \
803
	test/hs/Test/Ganeti/Storage/Drbd/Types.hs \
804
	test/hs/Test/Ganeti/Storage/Lvm/LVParser.hs \
805
	test/hs/Test/Ganeti/THH.hs \
806
	test/hs/Test/Ganeti/THH/Types.hs \
807
	test/hs/Test/Ganeti/TestCommon.hs \
808
	test/hs/Test/Ganeti/TestHTools.hs \
809
	test/hs/Test/Ganeti/TestHelper.hs \
810
	test/hs/Test/Ganeti/Types.hs \
811
	test/hs/Test/Ganeti/Utils.hs
812

    
813
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
814

    
815
HS_BUILT_SRCS = \
816
	test/hs/Test/Ganeti/TestImports.hs \
817
	src/AutoConf.hs \
818
	src/Ganeti/Hs2Py/ListConstants.hs \
819
	src/Ganeti/Curl/Internal.hs \
820
	src/Ganeti/Version.hs
821
HS_BUILT_SRCS_IN = \
822
	$(patsubst %,%.in,$(filter-out src/Ganeti/Curl/Internal.hs,$(HS_BUILT_SRCS))) \
823
	src/Ganeti/Curl/Internal.hsc \
824
	lib/_constants.py.in \
825
	lib/opcodes.py.in_after \
826
	lib/opcodes.py.in_before
827

    
828
HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)
829

    
830
$(RUN_IN_TEMPDIR): | stamp-directories
831

    
832
doc/html/index.html: ENABLE_MANPAGES =
833
doc/man-html/index.html: ENABLE_MANPAGES = 1
834
doc/man-html/index.html: doc/manpages-enabled.rst $(mandocrst)
835

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

    
873
doc/html: doc/html/index.html
874

    
875
doc/man-html: doc/man-html/index.html
876

    
877
doc/install-quick.rst: INSTALL
878
doc/news.rst: NEWS
879
doc/upgrade.rst: UPGRADE
880

    
881
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
882
	set -e; \
883
	{ echo '.. This file is automatically updated at build time from $<.'; \
884
	  echo '.. Do not edit.'; \
885
	  echo; \
886
	  cat $<; \
887
	} > $@
888

    
889
doc/manpages-enabled.rst: Makefile | $(built_base_sources)
890
	{ echo '.. This file is automatically generated, do not edit!'; \
891
	  echo ''; \
892
	  echo 'Man pages'; \
893
	  echo '========='; \
894
	  echo; \
895
	  echo '.. toctree::'; \
896
	  echo '   :maxdepth: 1'; \
897
	  echo; \
898
	  for i in $(notdir $(mandocrst)); do \
899
	    echo "   $$i"; \
900
	  done | LC_ALL=C sort; \
901
	} > $@
902

    
903
doc/man-%.rst: man/%.gen Makefile $(REPLACE_VARS_SED) | $(built_base_sources)
904
if MANPAGES_IN_DOC
905
	{ echo '.. This file is automatically updated at build time from $<.'; \
906
	  echo '.. Do not edit.'; \
907
	  echo; \
908
	  echo "$*"; \
909
	  echo '=========================================='; \
910
	  tail -n +3 $< | sed -f $(REPLACE_VARS_SED); \
911
	} > $@
912
else
913
	echo 'Man pages in documentation were disabled at configure time' >&2; \
914
	exit 1;
915
endif
916

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

    
920
userspecs = \
921
	doc/users/users \
922
	doc/users/groups \
923
	doc/users/groupmemberships
924

    
925
# Things to build but not to install (add it to EXTRA_DIST if it should be
926
# distributed)
927
noinst_DATA = \
928
	$(BUILT_EXAMPLES) \
929
	doc/examples/bash_completion \
930
	doc/examples/bash_completion-debug \
931
	$(userspecs) \
932
	$(manhtml)
933

    
934
if HAS_SPHINX
935
if MANPAGES_IN_DOC
936
noinst_DATA += doc/man-html
937
else
938
noinst_DATA += doc/html
939
endif
940
endif
941

    
942
gnt_scripts = \
943
	scripts/gnt-backup \
944
	scripts/gnt-cluster \
945
	scripts/gnt-debug \
946
	scripts/gnt-group \
947
	scripts/gnt-instance \
948
	scripts/gnt-job \
949
	scripts/gnt-network \
950
	scripts/gnt-node \
951
	scripts/gnt-os \
952
	scripts/gnt-storage
953

    
954
gnt_scripts_basenames = \
955
	$(patsubst scripts/%,%,$(patsubst daemons/%,%,$(gnt_scripts) $(gnt_python_sbin_SCRIPTS)))
956

    
957
gnt_python_sbin_SCRIPTS = \
958
	$(PYTHON_BOOTSTRAP_SBIN)
959

    
960
gntpython_SCRIPTS = $(gnt_scripts)
961

    
962
PYTHON_BOOTSTRAP_SBIN = \
963
	daemons/ganeti-masterd \
964
	daemons/ganeti-noded \
965
	daemons/ganeti-rapi \
966
	daemons/ganeti-watcher
967

    
968
PYTHON_BOOTSTRAP = \
969
	tools/burnin \
970
	tools/ensure-dirs \
971
	tools/node-cleanup \
972
	tools/node-daemon-setup \
973
	tools/prepare-node-join
974

    
975
qa_scripts = \
976
	qa/__init__.py \
977
	qa/ganeti-qa.py \
978
	qa/qa_cluster.py \
979
	qa/qa_config.py \
980
	qa/qa_daemon.py \
981
	qa/qa_env.py \
982
	qa/qa_error.py \
983
	qa/qa_group.py \
984
	qa/qa_instance.py \
985
	qa/qa_instance_utils.py \
986
	qa/qa_job.py \
987
	qa/qa_monitoring.py \
988
	qa/qa_node.py \
989
	qa/qa_os.py \
990
	qa/qa_rapi.py \
991
	qa/qa_tags.py \
992
	qa/qa_utils.py \
993
        qa/rapi-workload.py
994

    
995
bin_SCRIPTS = $(HS_BIN_PROGS)
996
install-exec-hook:
997
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
998
# FIXME: this is a hardcoded logic, instead of auto-resolving
999
	$(LN_S) -f ../../../bin/htools \
1000
	  $(DESTDIR)$(iallocatorsdir)/hail
1001
	for role in $(HS_BIN_ROLES); do \
1002
	  $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
1003
	done
1004

    
1005
HNORMAL_SUFFIX = .o
1006
HPROFILE_SUFFIX = .prof.o
1007
HCOVERAGE_SUFFIX = .hpc.o
1008
HTEST_SUFFIX = .test.o
1009

    
1010
HSUFFIX = $(if $(HPROFILE),$(HPROFILE_SUFFIX), \
1011
	  $(if $(HCOVERAGE),$(HCOVERAGE_SUFFIX), \
1012
	  $(if $(HTEST),$(HTEST_SUFFIX), \
1013
	  $(HNORMAL_SUFFIX))))
1014

    
1015
HFLAGS += $(if $(HPROFILE),-prof -auto-all,)
1016
HFLAGS += $(if $(HCOVERAGE),-fhpc,)
1017
HFLAGS += $(if $(HTEST),-DTEST,)
1018

    
1019
HS_SRCS = $(HS_LIBTESTBUILT_SRCS)
1020

    
1021
.NOTPARALLEL: $(HS_ALL_PROGS)
1022
.PHONY: $(HS_ALL_PROGS)
1023
$(HS_ALL_PROGS): %: %.hs $(HS_SRCS) Makefile
1024
	@if [ "$(notdir $@)" = "test" ] && [ "$(HS_NODEV)" ]; then \
1025
	  echo "Error: cannot run unittests without the development" \
1026
	       " libraries (see devnotes.rst)" 1>&2; \
1027
	  exit 1; \
1028
	fi
1029
	@rm -f $(notdir $@).tix
1030
	$(GHC) --make $(HFLAGS) \
1031
		-osuf $(HSUFFIX) \
1032
		-hisuf $(patsubst %.o,%.hi,$(HSUFFIX)) \
1033
		$(HS_PARALLEL3) $(HS_REGEX_PCRE) $(HEXTRA) $@
1034
	@touch "$@"
1035

    
1036
# for the test/hs/htest binary, we need to enable profiling/coverage
1037
test/hs/htest: HCOVERAGE = true
1038
test/hs/htest: HFLAGS += -itest/hs
1039
test/hs/htest: | $(BUILT_PYTHON_SOURCES)
1040

    
1041
# we compile the hpc-htools binary with the program coverage
1042
test/hs/hpc-htools: HCOVERAGE = true
1043

    
1044
# we compile the hpc-mon-collector binary with the program coverage
1045
test/hs/hpc-mon-collector: HCOVERAGE = true
1046

    
1047
# test dependency
1048
test/hs/offline-test.sh: test/hs/hpc-htools test/hs/hpc-mon-collector
1049

    
1050
# rule for building profiling-enabled versions of the haskell programs
1051
.PHONY: hs-prof
1052
hs-prof:
1053
	@if [ -z "$(TARGET)" ]; then \
1054
	  echo "You need to define TARGET when running this rule" 1>&2; \
1055
	  exit 1; \
1056
	fi
1057
	$(MAKE) $(AM_MAKEFLAGS) HPROFILE=y $(TARGET)
1058

    
1059
dist_sbin_SCRIPTS = \
1060
	tools/ganeti-listrunner
1061

    
1062
nodist_sbin_SCRIPTS = \
1063
	daemons/ganeti-cleaner
1064

    
1065
# strip path prefixes off the sbin scripts
1066
all_sbin_scripts = \
1067
	$(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst scripts/%,%,\
1068
	$(patsubst src/%,%,$(dist_sbin_SCRIPTS) $(nodist_sbin_SCRIPTS)))))
1069

    
1070
if ENABLE_CONFD
1071
src/ganeti-confd: src/hconfd
1072
	cp -f $< $@
1073

    
1074
src/ganeti-luxid: src/hluxid
1075
	cp -f $< $@
1076

    
1077
nodist_sbin_SCRIPTS += src/ganeti-confd
1078
nodist_sbin_SCRIPTS += src/ganeti-luxid
1079
nodist_sbin_SCRIPTS += src/ganeti-kvmd
1080
nodist_sbin_SCRIPTS += src/ganeti-metad
1081
endif
1082

    
1083
if ENABLE_MOND
1084
nodist_sbin_SCRIPTS += src/ganeti-mond
1085
endif
1086

    
1087
python_scripts = \
1088
	tools/cfgshell \
1089
	tools/cfgupgrade \
1090
	tools/cfgupgrade12 \
1091
	tools/cluster-merge \
1092
	tools/confd-client \
1093
	tools/fmtjson \
1094
	tools/lvmstrap \
1095
	tools/move-instance \
1096
	tools/ovfconverter \
1097
	tools/post-upgrade \
1098
	tools/sanitize-config
1099

    
1100
dist_tools_SCRIPTS = \
1101
	tools/kvm-console-wrapper \
1102
	tools/master-ip-setup \
1103
	tools/xen-console-wrapper
1104

    
1105
dist_tools_python_SCRIPTS = \
1106
	$(python_scripts) \
1107
	tools/burnin
1108

    
1109
nodist_tools_python_SCRIPTS = \
1110
	tools/node-cleanup
1111

    
1112
tools_python_basenames = $(patsubst tools/%,%,\
1113
	$(dist_tools_python_SCRIPTS) $(nodist_tools_python_SCRIPTS))
1114

    
1115
nodist_tools_SCRIPTS = \
1116
	tools/users-setup \
1117
	tools/vcluster-setup
1118

    
1119
tools_basenames = $(patsubst tools/%,%,$(nodist_tools_SCRIPTS) $(dist_tools_SCRIPTS))
1120

    
1121
pkglib_python_scripts = \
1122
	daemons/import-export \
1123
	tools/check-cert-expired
1124

    
1125
nodist_pkglib_python_scripts = \
1126
	tools/ensure-dirs \
1127
	tools/node-daemon-setup \
1128
	tools/prepare-node-join
1129

    
1130
pkglib_python_basenames = \
1131
	$(patsubst daemons/%,%,$(patsubst tools/%,%,\
1132
	$(pkglib_python_scripts) $(nodist_pkglib_python_scripts)))
1133

    
1134
myexeclib_SCRIPTS = \
1135
	daemons/daemon-util \
1136
	tools/kvm-ifup \
1137
	tools/kvm-ifup-os \
1138
	tools/vif-ganeti \
1139
	tools/net-common \
1140
	$(HS_MYEXECLIB_PROGS)
1141

    
1142
# compute the basenames of the myexeclib_scripts
1143
myexeclib_scripts_basenames = \
1144
	$(patsubst tools/%,%,$(patsubst daemons/%,%,$(patsubst src/%,%,$(myexeclib_SCRIPTS))))
1145

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

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

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

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

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

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

    
1414

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

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

    
1531
haskell_tests = test/hs/htest
1532

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

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

    
1545
nodist_TESTS =
1546
check_SCRIPTS =
1547

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

    
1557
TESTS = $(dist_TESTS) $(nodist_TESTS)
1558

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

    
1566
# Environment for tests run by automake
1567
TESTS_ENVIRONMENT = \
1568
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
1569

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

    
1594
if PY_UNIT
1595
all_python_code += $(python_tests)
1596
all_python_code += $(python_test_support)
1597
endif
1598

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

    
1613
check_python_code = \
1614
	$(BUILD_BASH_COMPLETION) \
1615
	$(CHECK_IMPORTS) \
1616
	$(CHECK_HEADER) \
1617
	$(DOCPP) \
1618
	$(all_python_code)
1619

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

    
1633
standalone_python_modules = \
1634
	lib/rapi/client.py \
1635
	tools/ganeti-listrunner
1636

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

    
1651
test/py/daemon-util_unittest.bash: daemons/daemon-util
1652

    
1653
test/py/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner
1654

    
1655
test/py/bash_completion.bash: doc/examples/bash_completion-debug
1656

    
1657
tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
1658
	sed -f $(REPLACE_VARS_SED) < $< > $@
1659
	chmod +x $@
1660

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2136
.PHONY: hs-check
2137
hs-check: hs-tests hs-shell
2138

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

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

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

    
2166
.PHONY: lint
2167
lint: $(LINT_TARGETS)
2168

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

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

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

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

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

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

    
2246
# Backwards compatible distcheck-release target
2247
distcheck-release: distcheck
2248

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

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

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

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

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

    
2325
.PHONY: hs-apidoc
2326
hs-apidoc: $(APIDOC_HS_DIR)/index.html
2327

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

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

    
2375
.PHONY: coverage
2376

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

    
2385
coverage: $(COVERAGE_TESTS)
2386

    
2387
test/py/docs_unittest.py: $(gnt_scripts)
2388

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

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

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

    
2429
commit-check: autotools-check distcheck lint apidoc
2430

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

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

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

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

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

    
2460
-include ./Makefile.local
2461

    
2462
# vim: set noet :