Statistics
| Branch: | Tag: | Revision:

root / Makefile.am @ dc1fe8df

History | View | Annotate | Download (73.5 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

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

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

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

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

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

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

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

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

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

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

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

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

    
292
if ENABLE_MOND
293
HS_GENERATED_FILES += src/ganeti-mond
294
endif
295
endif
296

    
297
built_base_sources = \
298
	stamp-directories \
299
	stamp-srclinks
300

    
301
built_python_base_sources = \
302
	lib/_constants.py \
303
	lib/_vcsversion.py \
304
	lib/opcodes.py
305

    
306
BUILT_PYTHON_SOURCES = \
307
	$(built_python_base_sources) \
308
	lib/_generated_rpc.py
309

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

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

    
325
dist_ifup_SCRIPTS = \
326
	tools/kvm-ifup-os
327

    
328
nodist_pkgpython_PYTHON = \
329
	$(BUILT_PYTHON_SOURCES)
330

    
331
nodist_pkgpython_bin_SCRIPTS = \
332
	$(nodist_pkglib_python_scripts)
333

    
334
pkgpython_bin_SCRIPTS = \
335
	$(pkglib_python_scripts)
336

    
337
noinst_PYTHON = \
338
	lib/build/__init__.py \
339
	lib/build/shell_example_lexer.py \
340
	lib/build/sphinx_ext.py
341

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

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

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

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

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

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

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

    
447
confd_PYTHON = \
448
	lib/confd/__init__.py \
449
	lib/confd/client.py
450

    
451
masterd_PYTHON = \
452
	lib/masterd/__init__.py \
453
	lib/masterd/iallocator.py \
454
	lib/masterd/instance.py
455

    
456
impexpd_PYTHON = \
457
	lib/impexpd/__init__.py
458

    
459
watcher_PYTHON = \
460
	lib/watcher/__init__.py \
461
	lib/watcher/nodemaint.py \
462
	lib/watcher/state.py
463

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

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

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

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

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

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

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

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

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

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

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

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

    
625
HS_ALL_PROGS = $(HS_DEFAULT_PROGS) $(HS_MYEXECLIB_PROGS)
626

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

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

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

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

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

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

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

    
829
$(RUN_IN_TEMPDIR): | stamp-directories
830

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

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

    
872
doc/html: doc/html/index.html
873

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

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

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

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

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

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

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

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

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

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

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

    
956
gnt_python_sbin_SCRIPTS = \
957
	$(PYTHON_BOOTSTRAP_SBIN)
958

    
959
gntpython_SCRIPTS = $(gnt_scripts)
960

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

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

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

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

    
1007
HNORMAL_SUFFIX = .o
1008
HPROFILE_SUFFIX = .prof.o
1009
HCOVERAGE_SUFFIX = .hpc.o
1010
HTEST_SUFFIX = .test.o
1011

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

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

    
1021
HS_SRCS = $(HS_LIBTESTBUILT_SRCS)
1022

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

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

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

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

    
1049
# test dependency
1050
test/hs/offline-test.sh: test/hs/hpc-htools test/hs/hpc-mon-collector
1051

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

    
1061
dist_sbin_SCRIPTS = \
1062
	tools/ganeti-listrunner
1063

    
1064
nodist_sbin_SCRIPTS = \
1065
	daemons/ganeti-cleaner
1066

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

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

    
1076
src/ganeti-luxid: src/hluxid
1077
	cp -f $< $@
1078

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

    
1085
if ENABLE_MOND
1086
nodist_sbin_SCRIPTS += src/ganeti-mond
1087
endif
1088

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

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

    
1107
dist_tools_python_SCRIPTS = \
1108
	$(python_scripts) \
1109
	tools/burnin
1110

    
1111
nodist_tools_python_SCRIPTS = \
1112
	tools/node-cleanup
1113

    
1114
tools_python_basenames = $(patsubst tools/%,%,\
1115
	$(dist_tools_python_SCRIPTS) $(nodist_tools_python_SCRIPTS))
1116

    
1117
nodist_tools_SCRIPTS = \
1118
	tools/users-setup \
1119
	tools/vcluster-setup
1120

    
1121
tools_basenames = $(patsubst tools/%,%,$(nodist_tools_SCRIPTS) $(dist_tools_SCRIPTS))
1122

    
1123
pkglib_python_scripts = \
1124
	daemons/import-export \
1125
	tools/check-cert-expired
1126

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

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

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

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

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

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

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

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

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

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

    
1416

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

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

    
1533
haskell_tests = test/hs/htest
1534

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

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

    
1547
nodist_TESTS =
1548
check_SCRIPTS =
1549

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1708
doc/examples/bash_completion: BC_ARGS = --compact
1709
doc/examples/bash_completion-debug: BC_ARGS =
1710

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

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

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

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

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

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

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

    
1764
.PHONY: clean-vcs-version
1765
clean-vcs-version:
1766
	rm -f vcs-version
1767

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

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

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

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

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

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

    
1820
lib/constants.py: lib/_constants.py
1821

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

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

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

    
1922
lib/_generated_rpc.py: lib/rpc_defs.py $(BUILD_RPC)
1923
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_RPC) lib/rpc_defs.py > $@
1924

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
2138
.PHONY: hs-check
2139
hs-check: hs-tests hs-shell
2140

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

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

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

    
2168
.PHONY: lint
2169
lint: $(LINT_TARGETS)
2170

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

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

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

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

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

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

    
2248
# Backwards compatible distcheck-release target
2249
distcheck-release: distcheck
2250

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

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

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

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

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

    
2327
.PHONY: hs-apidoc
2328
hs-apidoc: $(APIDOC_HS_DIR)/index.html
2329

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

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

    
2377
.PHONY: coverage
2378

    
2379
COVERAGE_TESTS=
2380
if WANT_HTOOLS
2381
COVERAGE_TESTS += hs-coverage
2382
endif
2383
if PY_UNIT
2384
COVERAGE_TESTS += py-coverage
2385
endif
2386

    
2387
coverage: $(COVERAGE_TESTS)
2388

    
2389
test/py/docs_unittest.py: $(gnt_scripts)
2390

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

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

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

    
2431
commit-check: autotools-check distcheck lint apidoc
2432

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

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

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

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

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

    
2462
-include ./Makefile.local
2463

    
2464
# vim: set noet :