Makefile.am 45.7 KB
Newer Older
1 2 3 4 5
# Ganeti makefile
# - Indent with tabs only.
# - Keep files sorted; one line per file.
# - Directories in lib/ must have their own *dir variable (see hypervisor).
# - All directories must be listed DIRS.
Michael Hanselmann's avatar
Michael Hanselmann committed
6
# - Use autogen.sh to generate Makefile.in and configure script.
7 8 9 10 11

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

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

17 18 19
# Use bash in order to be able to use pipefail
SHELL=/bin/bash

20
ACLOCAL_AMFLAGS = -I autotools
21
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
22
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
23
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
24
CHECK_HEADER = $(top_srcdir)/autotools/check-header
Iustin Pop's avatar
Iustin Pop committed
25
CHECK_MAN_DASHES = $(top_srcdir)/autotools/check-man-dashes
26
CHECK_MAN_WARNINGS = $(top_srcdir)/autotools/check-man-warnings
27
CHECK_VERSION = $(top_srcdir)/autotools/check-version
28
CHECK_NEWS = $(top_srcdir)/autotools/check-news
29
CHECK_IMPORTS = $(top_srcdir)/autotools/check-imports
30
DOCPP = $(top_srcdir)/autotools/docpp
31
REPLACE_VARS_SED = autotools/replace_vars.sed
32
CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
33
BUILD_RPC = $(top_srcdir)/autotools/build-rpc
34

35 36
# Note: these are automake-specific variables, and must be named after
# the directory + 'dir' suffix
37
clientdir = $(pkgpythondir)/client
38
hypervisordir = $(pkgpythondir)/hypervisor
39
httpdir = $(pkgpythondir)/http
Michael Hanselmann's avatar
Michael Hanselmann committed
40
masterddir = $(pkgpythondir)/masterd
Guido Trotter's avatar
Guido Trotter committed
41
confddir = $(pkgpythondir)/confd
42
rapidir = $(pkgpythondir)/rapi
43
serverdir = $(pkgpythondir)/server
44
watcherdir = $(pkgpythondir)/watcher
45
impexpddir = $(pkgpythondir)/impexpd
46
utilsdir = $(pkgpythondir)/utils
47
toolsdir = $(pkglibdir)/tools
48
iallocatorsdir = $(pkglibdir)/iallocators
49
pytoolsdir = $(pkgpythondir)/tools
50
docdir = $(datadir)/doc/$(PACKAGE)
51
myexeclibdir = $(pkglibdir)
52

53 54 55
# Delete output file if an error occurred while building it
.DELETE_ON_ERROR:

56 57 58
HTOOLS_DIRS = \
	htools \
	htools/Ganeti \
Iustin Pop's avatar
Iustin Pop committed
59
	htools/Ganeti/Confd \
60
	htools/Ganeti/HTools \
61
	htools/Ganeti/HTools/Program \
Iustin Pop's avatar
Iustin Pop committed
62
	htools/Ganeti/Query \
Iustin Pop's avatar
Iustin Pop committed
63 64
	htest \
	htest/Test \
65
	htest/Test/Ganeti \
66
	htest/Test/Ganeti/Confd \
67
	htest/Test/Ganeti/HTools \
68
	htest/Test/Ganeti/Query
69

70 71 72 73 74 75
DIRS = \
	autotools \
	daemons \
	devel \
	doc \
	doc/examples \
Guido Trotter's avatar
Guido Trotter committed
76
	doc/examples/hooks \
77
	doc/examples/gnt-debug \
78
	$(HTOOLS_DIRS) \
79
	lib \
80
	lib/client \
81
	lib/build \
82
	lib/confd \
83
	lib/http \
84
	lib/hypervisor \
85
	lib/impexpd \
Michael Hanselmann's avatar
Michael Hanselmann committed
86
	lib/masterd \
87
	lib/rapi \
88
	lib/server \
89
	lib/tools \
90
	lib/utils \
91
	lib/watcher \
92 93 94 95
	man \
	qa \
	test \
	test/data \
Agata Murawska's avatar
Agata Murawska committed
96
	test/data/ovfdata \
Agata Murawska's avatar
Agata Murawska committed
97
	test/data/ovfdata/other \
98 99
	htest/data \
	htest/data/rapi \
Iustin Pop's avatar
Iustin Pop committed
100
	htest/shelltests \
101 102
	tools

103
BUILDTIME_DIR_AUTOCREATE = \
104
	scripts \
105 106 107
	$(APIDOC_DIR) \
	$(APIDOC_PY_DIR) \
	$(APIDOC_HS_DIR) \
Iustin Pop's avatar
Iustin Pop committed
108 109 110
	$(APIDOC_HS_DIR)/Ganeti \
	$(APIDOC_HS_DIR)/Ganeti/Confd \
	$(APIDOC_HS_DIR)/Ganeti/HTools \
111
	$(APIDOC_HS_DIR)/Ganeti/HTools/Program \
Iustin Pop's avatar
Iustin Pop committed
112
	$(APIDOC_HS_DIR)/Ganeti/Query \
113 114 115
	$(COVERAGE_DIR) \
	$(COVERAGE_PY_DIR) \
	$(COVERAGE_HS_DIR) \
116
	.hpc
117 118 119

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
120 121 122 123 124 125 126
	doc/html

DIRCHECK_EXCLUDE = \
	$(BUILDTIME_DIRS) \
	ganeti-[0-9]*.[0-9]*.[0-9]* \
	doc/html/_*

127 128 129 130 131 132 133 134
# some helper vars
COVERAGE_DIR = doc/coverage
COVERAGE_PY_DIR = $(COVERAGE_DIR)/py
COVERAGE_HS_DIR = $(COVERAGE_DIR)/hs
APIDOC_DIR = doc/api
APIDOC_PY_DIR = $(APIDOC_DIR)/py
APIDOC_HS_DIR = $(APIDOC_DIR)/hs

Iustin Pop's avatar
Iustin Pop committed
135
MAINTAINERCLEANFILES = \
136
	$(docpng) \
137
	$(maninput) \
138
	doc/install-quick.rst \
139
	doc/news.rst \
140
	doc/upgrade.rst \
141
	vcs-version
Iustin Pop's avatar
Iustin Pop committed
142

143
maintainer-clean-local:
144
	rm -rf $(BUILDTIME_DIRS)
145

146
CLEANFILES = \
147
	$(addsuffix /*.py[co],$(DIRS)) \
148 149
	$(addsuffix /*.hi,$(HTOOLS_DIRS)) \
	$(addsuffix /*.o,$(HTOOLS_DIRS)) \
150
	$(PYTHON_BOOTSTRAP) \
151
	epydoc.conf \
Iustin Pop's avatar
Iustin Pop committed
152
	$(REPLACE_VARS_SED) \
153
	daemons/daemon-util \
154
	daemons/ganeti-cleaner \
155
	devel/upload \
156
	$(BUILT_EXAMPLES) \
157
	doc/examples/bash_completion \
158
	lib/_generated_rpc.py \
Iustin Pop's avatar
Iustin Pop committed
159 160
	$(man_MANS) \
	$(manhtml) \
161
	tools/kvm-ifup \
162
	stamp-directories \
163
	stamp-srclinks \
164
	$(nodist_pkgpython_PYTHON) \
165
	$(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
166
	$(HS_BUILT_TEST_HELPERS) \
Iustin Pop's avatar
Iustin Pop committed
167
	.hpc/*.mix htools/*.tix htest/*.tix \
168
	doc/hs-lint.html
169

Iustin Pop's avatar
Iustin Pop committed
170
GENERATED_FILES = \
Iustin Pop's avatar
Iustin Pop committed
171
	$(built_base_sources) \
172 173 174 175
	$(BUILT_PYTHON_SOURCES) \
	$(PYTHON_BOOTSTRAP)

built_base_sources = \
176 177
	stamp-directories \
	stamp-srclinks
178

179
built_python_base_sources = \
180
	lib/_autoconf.py \
181 182 183 184
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
185
	lib/_generated_rpc.py
186

Iustin Pop's avatar
Iustin Pop committed
187 188
# Generating the RPC wrappers depends on many things, so make sure
# it's built at the end of the built sources
189 190
lib/_generated_rpc.py: | $(built_base_sources) $(built_python_base_sources)

191 192 193 194 195 196 197 198
# these are all built from the underlying %.in sources
BUILT_EXAMPLES = \
	doc/examples/ganeti-kvm-poweroff.initd \
	doc/examples/ganeti.cron \
	doc/examples/ganeti.initd \
	doc/examples/gnt-config-backup \
	doc/examples/hooks/ipsec

199 200 201
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

202
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
203
	lib/build/__init__.py \
204 205
	lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py
206

207 208
pkgpython_PYTHON = \
	lib/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
209
	lib/asyncnotifier.py \
210 211 212 213 214
	lib/backend.py \
	lib/bdev.py \
	lib/bootstrap.py \
	lib/cli.py \
	lib/cmdlib.py \
215
	lib/compat.py \
216 217
	lib/config.py \
	lib/constants.py \
218
	lib/daemon.py \
219
	lib/errors.py \
220
	lib/ht.py \
221
	lib/jqueue.py \
222
	lib/jstore.py \
223 224 225
	lib/locking.py \
	lib/luxi.py \
	lib/mcpu.py \
226
	lib/netutils.py \
227 228
	lib/objects.py \
	lib/opcodes.py \
229
	lib/ovf.py \
230
	lib/qlang.py \
231
	lib/query.py \
232
	lib/rpc.py \
233
	lib/rpc_defs.py \
234
	lib/runtime.py \
235 236 237
	lib/serializer.py \
	lib/ssconf.py \
	lib/ssh.py \
238
	lib/storage.py \
239
	lib/uidpool.py \
240
	lib/workerpool.py
241

242
client_PYTHON = \
243
	lib/client/__init__.py \
244
	lib/client/gnt_backup.py \
245
	lib/client/gnt_cluster.py \
246
	lib/client/gnt_debug.py \
247
	lib/client/gnt_group.py \
248
	lib/client/gnt_instance.py \
249
	lib/client/gnt_job.py \
250
	lib/client/gnt_node.py \
251
	lib/client/gnt_os.py
252

253 254 255
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
256
	lib/hypervisor/hv_chroot.py \
257
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
258
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
259
	lib/hypervisor/hv_lxc.py \
260 261
	lib/hypervisor/hv_xen.py

262 263
rapi_PYTHON = \
	lib/rapi/__init__.py \
264
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
265
	lib/rapi/client.py \
266
	lib/rapi/client_utils.py \
267
	lib/rapi/connector.py \
268 269
	lib/rapi/rlib2.py \
	lib/rapi/testutils.py
270

271
http_PYTHON = \
272
	lib/http/__init__.py \
273
	lib/http/auth.py \
274 275
	lib/http/client.py \
	lib/http/server.py
276

Guido Trotter's avatar
Guido Trotter committed
277
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
278
	lib/confd/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
279
	lib/confd/client.py \
280 281
	lib/confd/querylib.py \
	lib/confd/server.py
282

Michael Hanselmann's avatar
Michael Hanselmann committed
283
masterd_PYTHON = \
284 285
	lib/masterd/__init__.py \
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
286

287 288 289
impexpd_PYTHON = \
	lib/impexpd/__init__.py

290
watcher_PYTHON = \
291
	lib/watcher/__init__.py \
292 293
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
294

295
server_PYTHON = \
296
	lib/server/__init__.py \
297
	lib/server/confd.py \
298
	lib/server/masterd.py \
299 300
	lib/server/noded.py \
	lib/server/rapi.py
301

302 303 304 305
pytools_PYTHON = \
	lib/tools/__init__.py \
	lib/tools/ensure_dirs.py

306
utils_PYTHON = \
307
	lib/utils/__init__.py \
308
	lib/utils/algo.py \
309
	lib/utils/filelock.py \
310
	lib/utils/hash.py \
311
	lib/utils/io.py \
312
	lib/utils/log.py \
313
	lib/utils/mlock.py \
314
	lib/utils/nodesetup.py \
315
	lib/utils/process.py \
316
	lib/utils/retry.py \
317
	lib/utils/text.py \
318 319
	lib/utils/wrapper.py \
	lib/utils/x509.py
320

Michael Hanselmann's avatar
Michael Hanselmann committed
321
docrst = \
322
	doc/admin.rst \
323
	doc/design-2.0.rst \
324
	doc/design-2.1.rst \
325
	doc/design-2.2.rst \
Guido Trotter's avatar
Guido Trotter committed
326
	doc/design-2.3.rst \
327
	doc/design-htools-2.3.rst \
328
	doc/design-2.4.rst \
329
	doc/design-2.5.rst \
330
	doc/design-draft.rst \
331
	doc/design-oob.rst \
Tsachy Shacham's avatar
Tsachy Shacham committed
332
	doc/design-cpu-pinning.rst \
333
	doc/design-query2.rst \
334
	doc/design-x509-ca.rst \
335
	doc/design-http-server.rst \
336
	doc/design-impexp2.rst \
337
	doc/design-lu-generated-jobs.rst \
338
	doc/design-multi-reloc.rst \
339
	doc/design-network.rst \
Michael Hanselmann's avatar
Michael Hanselmann committed
340
	doc/design-chained-jobs.rst \
341
	doc/design-ovf-support.rst \
Guido Trotter's avatar
Guido Trotter committed
342
	doc/design-autorepair.rst \
343
	doc/design-resource-model.rst \
344
	doc/cluster-merge.rst \
345
	doc/design-shared-storage.rst \
346
	doc/design-node-state-cache.rst \
347
	doc/design-virtual-clusters.rst \
348
	doc/design-bulk-create.rst \
349
	doc/design-query-splitting.rst \
350
	doc/devnotes.rst \
351
	doc/glossary.rst \
352
	doc/hooks.rst \
353
	doc/iallocator.rst \
354
	doc/index.rst \
355
	doc/install-quick.rst \
356
	doc/install.rst \
357
	doc/locking.rst \
358
	doc/move-instance.rst \
Iustin Pop's avatar
Iustin Pop committed
359
	doc/news.rst \
360
	doc/ovfconverter.rst \
361
	doc/rapi.rst \
362
	doc/security.rst \
363
	doc/upgrade.rst \
Iustin Pop's avatar
Iustin Pop committed
364
	doc/walkthrough.rst
Michael Hanselmann's avatar
Michael Hanselmann committed
365

366
HS_PROGS = htools/htools
367
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck
368

Iustin Pop's avatar
Iustin Pop committed
369
HS_ALL_PROGS = $(HS_PROGS) htest/test htest/hpc-htools htools/hconfd
370
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
371
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=htest/%) htest/hail
372

373 374
HFLAGS = -O -Wall -Werror -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
375
HEXTRA =
Iustin Pop's avatar
Iustin Pop committed
376
# internal extra flags (used for htest/test mainly)
377
HEXTRA_INT =
378
# exclude options for coverage reports
379
HPCEXCL = --exclude Main \
380
	--exclude Ganeti.Constants \
381 382
	--exclude Ganeti.THH \
	--exclude Ganeti.HTools.QC \
383
	--exclude Ganeti.HTools.Version \
384
	--exclude Test.Ganeti.TestCommon \
385 386
	--exclude Test.Ganeti.TestHTools \
	--exclude Test.Ganeti.TestHelper \
387
	--exclude Test.Ganeti.TestImports \
388
	$(patsubst htools.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
389

390
HS_LIB_SRCS = \
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
	htools/Ganeti/HTools/CLI.hs \
	htools/Ganeti/HTools/Cluster.hs \
	htools/Ganeti/HTools/Container.hs \
	htools/Ganeti/HTools/ExtLoader.hs \
	htools/Ganeti/HTools/Group.hs \
	htools/Ganeti/HTools/IAlloc.hs \
	htools/Ganeti/HTools/Instance.hs \
	htools/Ganeti/HTools/Loader.hs \
	htools/Ganeti/HTools/Luxi.hs \
	htools/Ganeti/HTools/Node.hs \
	htools/Ganeti/HTools/PeerMap.hs \
	htools/Ganeti/HTools/Rapi.hs \
	htools/Ganeti/HTools/Simu.hs \
	htools/Ganeti/HTools/Text.hs \
	htools/Ganeti/HTools/Types.hs \
	htools/Ganeti/HTools/Utils.hs \
407
	htools/Ganeti/HTools/Program.hs \
408
	htools/Ganeti/HTools/Program/Hail.hs \
409
	htools/Ganeti/HTools/Program/Hbal.hs \
410
	htools/Ganeti/HTools/Program/Hcheck.hs \
411
	htools/Ganeti/HTools/Program/Hinfo.hs \
412
	htools/Ganeti/HTools/Program/Hscan.hs \
413
	htools/Ganeti/HTools/Program/Hspace.hs \
414
	htools/Ganeti/BasicTypes.hs \
415
	htools/Ganeti/Compat.hs \
416
	htools/Ganeti/Confd.hs \
Iustin Pop's avatar
Iustin Pop committed
417
	htools/Ganeti/Confd/Server.hs \
418
	htools/Ganeti/Confd/Utils.hs \
419
	htools/Ganeti/Config.hs \
420
	htools/Ganeti/Daemon.hs \
421
	htools/Ganeti/Hash.hs \
422
	htools/Ganeti/Jobs.hs \
423
	htools/Ganeti/JSON.hs \
Iustin Pop's avatar
Iustin Pop committed
424
	htools/Ganeti/Logging.hs \
425
	htools/Ganeti/Luxi.hs \
426
	htools/Ganeti/Objects.hs \
427
	htools/Ganeti/OpCodes.hs \
428
	htools/Ganeti/Query/Common.hs \
Iustin Pop's avatar
Iustin Pop committed
429
	htools/Ganeti/Query/Filter.hs \
430
	htools/Ganeti/Query/Language.hs \
431
	htools/Ganeti/Query/Node.hs \
432
	htools/Ganeti/Query/Query.hs \
433
	htools/Ganeti/Query/Server.hs \
434
	htools/Ganeti/Query/Types.hs \
435
	htools/Ganeti/Rpc.hs \
Iustin Pop's avatar
Iustin Pop committed
436
	htools/Ganeti/Runtime.hs \
Iustin Pop's avatar
Iustin Pop committed
437
	htools/Ganeti/Ssconf.hs \
438 439 440
	htools/Ganeti/THH.hs

HS_TEST_SRCS = \
Iustin Pop's avatar
Iustin Pop committed
441
	htest/Test/Ganeti/Confd/Utils.hs \
442 443 444 445 446 447 448 449 450 451 452
	htest/Test/Ganeti/HTools/CLI.hs \
	htest/Test/Ganeti/HTools/Cluster.hs \
	htest/Test/Ganeti/HTools/Container.hs \
	htest/Test/Ganeti/HTools/Instance.hs \
	htest/Test/Ganeti/HTools/Loader.hs \
	htest/Test/Ganeti/HTools/Node.hs \
	htest/Test/Ganeti/HTools/PeerMap.hs \
	htest/Test/Ganeti/HTools/Simu.hs \
	htest/Test/Ganeti/HTools/Text.hs \
	htest/Test/Ganeti/HTools/Types.hs \
	htest/Test/Ganeti/HTools/Utils.hs \
453 454
	htest/Test/Ganeti/JSON.hs \
	htest/Test/Ganeti/Jobs.hs \
455
	htest/Test/Ganeti/Luxi.hs \
456
	htest/Test/Ganeti/Objects.hs \
457 458 459
	htest/Test/Ganeti/OpCodes.hs \
	htest/Test/Ganeti/Query/Language.hs \
	htest/Test/Ganeti/Rpc.hs \
460 461 462 463
	htest/Test/Ganeti/Ssconf.hs \
	htest/Test/Ganeti/TestCommon.hs \
	htest/Test/Ganeti/TestHTools.hs \
	htest/Test/Ganeti/TestHelper.hs
464

465
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
466

467 468 469 470
HS_BUILT_SRCS = \
	htest/Test/Ganeti/TestImports.hs \
	htools/Ganeti/Constants.hs \
	htools/Ganeti/HTools/Version.hs
471
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
472

473
$(RUN_IN_TEMPDIR): | stamp-directories
474

Iustin Pop's avatar
Iustin Pop committed
475 476 477 478 479
# Note: we use here an order-only prerequisite, as the contents of
# _autoconf.py are not actually influencing the html build output: it
# has to exist in order for the sphinx module to be loaded
# successfully, but we certainly don't want the docs to be rebuilt if
# it changes
480
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
481 482
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
483
	| $(BUILT_PYTHON_SOURCES)
484 485
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
486
	@mkdir_p@ $(dir $@)
487
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
488
	    -d . \
489 490
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
491 492 493 494
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

495
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
496

497
doc/install-quick.rst: INSTALL
498
doc/news.rst: NEWS
499
doc/upgrade.rst: UPGRADE
500

501
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
502 503 504 505 506 507 508
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

509
docdot = \
510 511 512
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
513

514
docpng = $(patsubst %.dot,%.png,$(docdot))
515

516 517 518 519 520
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	devel/upload \
	doc/html \
521
	$(BUILT_EXAMPLES) \
522 523
	doc/examples/bash_completion \
	$(manhtml)
524

525
gnt_scripts = \
526 527 528
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
529
	scripts/gnt-group \
530 531 532 533 534
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

535
PYTHON_BOOTSTRAP_SBIN = \
536
	daemons/ganeti-masterd \
537
	daemons/ganeti-noded \
538
	daemons/ganeti-watcher \
539
	daemons/ganeti-rapi \
540
	$(gnt_scripts)
541

542 543 544 545
if PY_CONFD
PYTHON_BOOTSTRAP_SBIN += daemons/ganeti-confd
endif

546 547 548 549
PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
	tools/ensure-dirs

550
qa_scripts = \
551
	qa/__init__.py \
552 553 554 555 556 557
	qa/ganeti-qa.py \
	qa/qa_cluster.py \
	qa/qa_config.py \
	qa/qa_daemon.py \
	qa/qa_env.py \
	qa/qa_error.py \
Andrea Spadaccini's avatar
Andrea Spadaccini committed
558
	qa/qa_group.py \
559
	qa/qa_instance.py \
560
	qa/qa_job.py \
561 562 563 564 565 566
	qa/qa_node.py \
	qa/qa_os.py \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

567 568
bin_SCRIPTS =
if WANT_HTOOLS
569
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
570 571
install-exec-hook:
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
572 573
# FIXME: this is a hardcoded logic, instead of auto-resolving
	$(LN_S) -f ../../../bin/htools \
574
		   $(DESTDIR)$(iallocatorsdir)/hail
575
	for role in $(HS_BIN_ROLES); do \
576
		$(LN_S) -f htools \
577 578
			   $(DESTDIR)$(bindir)/$$role ; \
	done
579 580 581
if HS_CONFD
	mv $(DESTDIR)$(sbindir)/hconfd $(DESTDIR)$(sbindir)/ganeti-confd
endif
582 583
endif

584
$(HS_ALL_PROGS): %: %.hs $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS) Makefile
585 586 587 588
	@if [ -z "$(HTOOLS)" ]; then \
	  echo "Error: htools compilation disabled at configure time" 1>&2 ;\
	  exit 1; \
	fi
Iustin Pop's avatar
Iustin Pop committed
589
	@if [ "$(notdir $@)" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
590 591
	  echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \
	  exit 1; \
592
	fi
Iustin Pop's avatar
Iustin Pop committed
593 594
	@rm -f $(notdir $@).tix
	$(GHC) --make \
Iustin Pop's avatar
Iustin Pop committed
595
	  $(HFLAGS) \
596
	  $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) \
Iustin Pop's avatar
Iustin Pop committed
597
	  -osuf $(notdir $@).o -hisuf $(notdir $@).hi \
598
	  $(HEXTRA) $(HEXTRA_INT) $@
599 600
	@touch "$@"

Iustin Pop's avatar
Iustin Pop committed
601 602
# for the htest/test binary, we need to enable profiling/coverage
htest/test: HEXTRA_INT=-fhpc -ihtest
603

604
# we compile the hpc-htools binary with the program coverage
Iustin Pop's avatar
Iustin Pop committed
605
htest/hpc-htools: HEXTRA_INT=-fhpc
606

607
# test dependency
Iustin Pop's avatar
Iustin Pop committed
608
htest/offline-tests.sh: htest/hpc-htools
609

610 611 612 613 614 615
# rules for building profiling-enabled versions of the haskell
# programs: hs-prof does the full two-step build, whereas
# hs-prof-quick does only the final rebuild (hs-prof must have been
# run before)
.PHONY: hs-prof hs-prof-quick
hs-prof:
616 617
	$(MAKE) $(AM_MAKEFLAGS) clean
	$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf .o"
618
	rm -f $(HS_ALL_PROGS)
619
	$(MAKE) $(AM_MAKEFLAGS) hs-prof-quick
620 621

hs-prof-quick:
622
	$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf .prof_o -prof -auto-all"
623

624 625
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
626

627
nodist_sbin_SCRIPTS = \
628
	$(PYTHON_BOOTSTRAP_SBIN) \
629 630
	daemons/ganeti-cleaner

631 632 633 634
if HS_CONFD
nodist_sbin_SCRIPTS += htools/hconfd
endif

635
python_scripts = \
636 637 638
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
639
	tools/cfgupgrade12 \
640
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
641
	tools/confd-client \
642
	tools/fmtjson \
Iustin Pop's avatar
Iustin Pop committed
643
	tools/lvmstrap \
644
	tools/move-instance \
645
	tools/ovfconverter \
646
	tools/setup-ssh \
Iustin Pop's avatar
Iustin Pop committed
647
	tools/sanitize-config
648

649
dist_tools_SCRIPTS = \
650
	$(python_scripts) \
651
	tools/kvm-console-wrapper \
652 653
	tools/xm-console-wrapper \
	tools/master-ip-setup
654

655
pkglib_python_scripts = \
656 657
	daemons/import-export \
	tools/check-cert-expired
658

659 660 661
nodist_pkglib_python_scripts = \
	tools/ensure-dirs

662
myexeclib_SCRIPTS = \
663
	daemons/daemon-util \
664
	tools/kvm-ifup \
665
	$(pkglib_python_scripts)
666

667
nodist_myexeclib_SCRIPTS = \
668 669
	$(nodist_pkglib_python_scripts)

670 671
EXTRA_DIST = \
	NEWS \
672
	UPGRADE \
673
	epydoc.conf.in \
Michael Hanselmann's avatar
Michael Hanselmann committed
674
	pylintrc \
675
	autotools/build-bash-completion \
676
	autotools/build-rpc \
677
	autotools/check-header \
678
	autotools/check-python-code \
679
	autotools/check-imports \
Iustin Pop's avatar
Iustin Pop committed
680
	autotools/check-man-dashes \
681
	autotools/check-man-warnings \
682
	autotools/check-news \
683
	autotools/check-tar \
684
	autotools/check-version \
685
	autotools/convert-constants \
686
	autotools/docpp \
687
	autotools/gen-coverage \
688
	autotools/testrunner \
689
	autotools/wrong-hardcoded-paths \
690
	$(RUN_IN_TEMPDIR) \
691
	daemons/daemon-util.in \
692
	daemons/ganeti-cleaner.in \
693
	$(pkglib_python_scripts) \
694
	devel/upload.in \
695
	tools/kvm-ifup.in \
696
	$(docdot) \
697
	$(docpng) \
698 699 700
	$(docrst) \
	doc/conf.py \
	doc/html \
701
	$(BUILT_EXAMPLES:%=%.in) \
702 703
	doc/examples/ganeti.default \
	doc/examples/ganeti.default-debug \
Guido Trotter's avatar
Guido Trotter committed
704
	doc/examples/hooks/ethers \
705 706 707
	doc/examples/gnt-debug/README \
	doc/examples/gnt-debug/delay0.json \
	doc/examples/gnt-debug/delay50.json \
708
	test/lockperf.py \
709 710 711 712
	test/testutils.py \
	test/mocks.py \
	$(dist_TESTS) \
	$(TEST_FILES) \
Iustin Pop's avatar
Iustin Pop committed
713 714
	man/footer.rst \
	$(manrst) \
715
	$(maninput) \
Michael Hanselmann's avatar
Michael Hanselmann committed
716
	qa/qa-sample.json \
717
	$(qa_scripts) \
718
	$(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS_IN) \
719
	$(HS_PROG_SRCS) \
720
	htools/lint-hints.hs \
Iustin Pop's avatar
Iustin Pop committed
721 722
	htest/cli-tests-defs.sh \
	htest/offline-test.sh
723 724 725

man_MANS = \
	man/ganeti.7 \
726
	man/ganeti-cleaner.8 \
Guido Trotter's avatar
Guido Trotter committed
727
	man/ganeti-confd.8 \
728
	man/ganeti-listrunner.8 \
729
	man/ganeti-masterd.8 \
730 731
	man/ganeti-noded.8 \
	man/ganeti-os-interface.7 \
732
	man/ganeti-rapi.8 \
733 734 735
	man/ganeti-watcher.8 \
	man/gnt-backup.8 \
	man/gnt-cluster.8 \
736
	man/gnt-debug.8 \
737
	man/gnt-group.8 \
738
	man/gnt-instance.8 \
739
	man/gnt-job.8 \
740
	man/gnt-node.8 \