Makefile.am 47 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
	doc/examples/bash_completion-debug \
159
	lib/_generated_rpc.py \
Iustin Pop's avatar
Iustin Pop committed
160 161
	$(man_MANS) \
	$(manhtml) \
162
	tools/kvm-ifup \
163
	tools/vcluster-setup \
164
	stamp-directories \
165
	stamp-srclinks \
166
	$(nodist_pkgpython_PYTHON) \
167
	$(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
168
	$(HS_BUILT_TEST_HELPERS) \
Iustin Pop's avatar
Iustin Pop committed
169
	.hpc/*.mix htools/*.tix htest/*.tix \
170
	doc/hs-lint.html
171

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

177 178 179 180 181 182 183 184
HTOOLS_GENERATED_FILES =
if WANT_HTOOLS
HTOOLS_GENERATED_FILES += $(HS_PROGS)
if HS_CONFD
HTOOLS_GENERATED_FILES += htools/hconfd
endif
endif

185
built_base_sources = \
186 187
	stamp-directories \
	stamp-srclinks
188

189
built_python_base_sources = \
190
	lib/_autoconf.py \
191 192 193 194
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
195
	lib/_generated_rpc.py
196

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

201 202 203 204 205 206 207 208
# 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

209 210 211
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

212
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
213
	lib/build/__init__.py \
214 215
	lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py
216

217 218
pkgpython_PYTHON = \
	lib/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
219
	lib/asyncnotifier.py \
220 221 222 223 224
	lib/backend.py \
	lib/bdev.py \
	lib/bootstrap.py \
	lib/cli.py \
	lib/cmdlib.py \
225
	lib/compat.py \
226 227
	lib/config.py \
	lib/constants.py \
228
	lib/daemon.py \
229
	lib/errors.py \
230
	lib/ht.py \
231
	lib/jqueue.py \
232
	lib/jstore.py \
233 234 235
	lib/locking.py \
	lib/luxi.py \
	lib/mcpu.py \
236
	lib/netutils.py \
237
	lib/objects.py \
238
	lib/objectutils.py \
239
	lib/opcodes.py \
240
	lib/ovf.py \
241
	lib/pathutils.py \
242
	lib/qlang.py \
243
	lib/query.py \
244
	lib/rpc.py \
245
	lib/rpc_defs.py \
246
	lib/runtime.py \
247 248 249
	lib/serializer.py \
	lib/ssconf.py \
	lib/ssh.py \
250
	lib/storage.py \
251
	lib/uidpool.py \
252
	lib/vcluster.py \
253
	lib/workerpool.py
254

255
client_PYTHON = \
256
	lib/client/__init__.py \
257
	lib/client/gnt_backup.py \
258
	lib/client/gnt_cluster.py \
259
	lib/client/gnt_debug.py \
260
	lib/client/gnt_group.py \
261
	lib/client/gnt_instance.py \
262
	lib/client/gnt_job.py \
263
	lib/client/gnt_node.py \
264
	lib/client/gnt_os.py
265

266 267 268
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
269
	lib/hypervisor/hv_chroot.py \
270
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
271
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
272
	lib/hypervisor/hv_lxc.py \
273 274
	lib/hypervisor/hv_xen.py

275 276
rapi_PYTHON = \
	lib/rapi/__init__.py \
277
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
278
	lib/rapi/client.py \
279
	lib/rapi/client_utils.py \
280
	lib/rapi/connector.py \
281 282
	lib/rapi/rlib2.py \
	lib/rapi/testutils.py
283

284
http_PYTHON = \
285
	lib/http/__init__.py \
286
	lib/http/auth.py \
287 288
	lib/http/client.py \
	lib/http/server.py
289

Guido Trotter's avatar
Guido Trotter committed
290
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
291
	lib/confd/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
292
	lib/confd/client.py \
293 294
	lib/confd/querylib.py \
	lib/confd/server.py
295

Michael Hanselmann's avatar
Michael Hanselmann committed
296
masterd_PYTHON = \
297
	lib/masterd/__init__.py \
René Nussbaumer's avatar
René Nussbaumer committed
298
	lib/masterd/iallocator.py \
299
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
300

301 302 303
impexpd_PYTHON = \
	lib/impexpd/__init__.py

304
watcher_PYTHON = \
305
	lib/watcher/__init__.py \
306 307
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
308

309
server_PYTHON = \
310
	lib/server/__init__.py \
311
	lib/server/confd.py \
312
	lib/server/masterd.py \
313 314
	lib/server/noded.py \
	lib/server/rapi.py
315

316 317 318 319
pytools_PYTHON = \
	lib/tools/__init__.py \
	lib/tools/ensure_dirs.py

320
utils_PYTHON = \
321
	lib/utils/__init__.py \
322
	lib/utils/algo.py \
323
	lib/utils/filelock.py \
324
	lib/utils/hash.py \
325
	lib/utils/io.py \
326
	lib/utils/log.py \
327
	lib/utils/mlock.py \
328
	lib/utils/nodesetup.py \
329
	lib/utils/process.py \
330
	lib/utils/retry.py \
331
	lib/utils/text.py \
332 333
	lib/utils/wrapper.py \
	lib/utils/x509.py
334

Michael Hanselmann's avatar
Michael Hanselmann committed
335
docrst = \
336
	doc/admin.rst \
337
	doc/design-2.0.rst \
338
	doc/design-2.1.rst \
339
	doc/design-2.2.rst \
Guido Trotter's avatar
Guido Trotter committed
340
	doc/design-2.3.rst \
341
	doc/design-htools-2.3.rst \
342
	doc/design-2.4.rst \
343
	doc/design-2.5.rst \
344
	doc/design-draft.rst \
345
	doc/design-oob.rst \
Tsachy Shacham's avatar
Tsachy Shacham committed
346
	doc/design-cpu-pinning.rst \
347
	doc/design-query2.rst \
348
	doc/design-x509-ca.rst \
349
	doc/design-http-server.rst \
350
	doc/design-impexp2.rst \
351
	doc/design-lu-generated-jobs.rst \
352
	doc/design-multi-reloc.rst \
353
	doc/design-network.rst \
Michael Hanselmann's avatar
Michael Hanselmann committed
354
	doc/design-chained-jobs.rst \
355
	doc/design-ovf-support.rst \
Guido Trotter's avatar
Guido Trotter committed
356
	doc/design-autorepair.rst \
357
	doc/design-resource-model.rst \
358
	doc/cluster-merge.rst \
359
	doc/design-shared-storage.rst \
360
	doc/design-node-state-cache.rst \
361
	doc/design-virtual-clusters.rst \
362
	doc/design-bulk-create.rst \
363
	doc/design-query-splitting.rst \
364
	doc/devnotes.rst \
365
	doc/glossary.rst \
366
	doc/hooks.rst \
367
	doc/iallocator.rst \
368
	doc/index.rst \
369
	doc/install-quick.rst \
370
	doc/install.rst \
371
	doc/locking.rst \
372
	doc/move-instance.rst \
Iustin Pop's avatar
Iustin Pop committed
373
	doc/news.rst \
374
	doc/ovfconverter.rst \
375
	doc/rapi.rst \
376
	doc/security.rst \
377
	doc/upgrade.rst \
Iustin Pop's avatar
Iustin Pop committed
378
	doc/walkthrough.rst
Michael Hanselmann's avatar
Michael Hanselmann committed
379

380
HS_PROGS = htools/htools
381
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck
382
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
383

Iustin Pop's avatar
Iustin Pop committed
384
HS_ALL_PROGS = $(HS_PROGS) htest/test htest/hpc-htools htools/hconfd
385
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
386
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=htest/%) htest/hail
387

388 389
HFLAGS = -O -Wall -Werror -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
390
HEXTRA =
Iustin Pop's avatar
Iustin Pop committed
391
# internal extra flags (used for htest/test mainly)
392
HEXTRA_INT =
393
# exclude options for coverage reports
394
HPCEXCL = --exclude Main \
395
	--exclude Ganeti.Constants \
396 397
	--exclude Ganeti.THH \
	--exclude Ganeti.HTools.QC \
398
	--exclude Ganeti.Version \
399
	--exclude Test.Ganeti.TestCommon \
400 401
	--exclude Test.Ganeti.TestHTools \
	--exclude Test.Ganeti.TestHelper \
402
	--exclude Test.Ganeti.TestImports \
403
	$(patsubst htools.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
404

405
HS_LIB_SRCS = \
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
	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 \
422
	htools/Ganeti/HTools/Program.hs \
423
	htools/Ganeti/HTools/Program/Hail.hs \
424
	htools/Ganeti/HTools/Program/Hbal.hs \
425
	htools/Ganeti/HTools/Program/Hcheck.hs \
426
	htools/Ganeti/HTools/Program/Hinfo.hs \
427
	htools/Ganeti/HTools/Program/Hscan.hs \
428
	htools/Ganeti/HTools/Program/Hspace.hs \
429
	htools/Ganeti/BasicTypes.hs \
Iustin Pop's avatar
Iustin Pop committed
430
	htools/Ganeti/Common.hs \
431
	htools/Ganeti/Compat.hs \
432
	htools/Ganeti/Confd.hs \
Iustin Pop's avatar
Iustin Pop committed
433
	htools/Ganeti/Confd/Server.hs \
434
	htools/Ganeti/Confd/Utils.hs \
435
	htools/Ganeti/Config.hs \
436
	htools/Ganeti/Daemon.hs \
437
	htools/Ganeti/Hash.hs \
438
	htools/Ganeti/Jobs.hs \
439
	htools/Ganeti/JSON.hs \
Iustin Pop's avatar
Iustin Pop committed
440
	htools/Ganeti/Logging.hs \
441
	htools/Ganeti/Luxi.hs \
442
	htools/Ganeti/Objects.hs \
443
	htools/Ganeti/OpCodes.hs \
444
	htools/Ganeti/Path.hs \
445
	htools/Ganeti/Query/Common.hs \
Iustin Pop's avatar
Iustin Pop committed
446
	htools/Ganeti/Query/Filter.hs \
Agata Murawska's avatar
Agata Murawska committed
447
	htools/Ganeti/Query/Group.hs \
448
	htools/Ganeti/Query/Language.hs \
449
	htools/Ganeti/Query/Node.hs \
450
	htools/Ganeti/Query/Query.hs \
451
	htools/Ganeti/Query/Server.hs \
452
	htools/Ganeti/Query/Types.hs \
453
	htools/Ganeti/Rpc.hs \
Iustin Pop's avatar
Iustin Pop committed
454
	htools/Ganeti/Runtime.hs \
Iustin Pop's avatar
Iustin Pop committed
455
	htools/Ganeti/Ssconf.hs \
456 457 458
	htools/Ganeti/THH.hs

HS_TEST_SRCS = \
459
	htest/Test/Ganeti/BasicTypes.hs \
Iustin Pop's avatar
Iustin Pop committed
460 461
	htest/Test/Ganeti/Common.hs \
	htest/Test/Ganeti/Daemon.hs \
Iustin Pop's avatar
Iustin Pop committed
462
	htest/Test/Ganeti/Confd/Utils.hs \
463 464 465 466 467 468 469 470 471 472 473
	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 \
474 475
	htest/Test/Ganeti/JSON.hs \
	htest/Test/Ganeti/Jobs.hs \
476
	htest/Test/Ganeti/Luxi.hs \
477
	htest/Test/Ganeti/Objects.hs \
478
	htest/Test/Ganeti/OpCodes.hs \
Iustin Pop's avatar
Iustin Pop committed
479
	htest/Test/Ganeti/Query/Filter.hs \
480
	htest/Test/Ganeti/Query/Language.hs \
481
	htest/Test/Ganeti/Query/Query.hs \
482
	htest/Test/Ganeti/Rpc.hs \
483 484 485 486
	htest/Test/Ganeti/Ssconf.hs \
	htest/Test/Ganeti/TestCommon.hs \
	htest/Test/Ganeti/TestHTools.hs \
	htest/Test/Ganeti/TestHelper.hs
487

488
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
489

490 491 492
HS_BUILT_SRCS = \
	htest/Test/Ganeti/TestImports.hs \
	htools/Ganeti/Constants.hs \
493
	htools/Ganeti/Version.hs
494
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
495

496
$(RUN_IN_TEMPDIR): | stamp-directories
497

Iustin Pop's avatar
Iustin Pop committed
498 499 500 501 502
# 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
503
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
504 505
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
506
	| $(BUILT_PYTHON_SOURCES)
507 508
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
509
	@mkdir_p@ $(dir $@)
510
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
511
	    -d . \
512 513
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
514 515 516 517
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

518
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
519

520
doc/install-quick.rst: INSTALL
521
doc/news.rst: NEWS
522
doc/upgrade.rst: UPGRADE
523

524
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
525 526 527 528 529 530 531
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

532
docdot = \
533 534 535
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
536

537
docpng = $(patsubst %.dot,%.png,$(docdot))
538

539 540 541 542 543
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	devel/upload \
	doc/html \
544
	$(BUILT_EXAMPLES) \
545
	doc/examples/bash_completion \
546
	doc/examples/bash_completion-debug \
547
	$(manhtml)
548

549
gnt_scripts = \
550 551 552
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
553
	scripts/gnt-group \
554 555 556 557 558
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

559
PYTHON_BOOTSTRAP_SBIN = \
560
	daemons/ganeti-masterd \
561
	daemons/ganeti-noded \
562
	daemons/ganeti-watcher \
563
	daemons/ganeti-rapi \
564
	$(gnt_scripts)
565

566 567 568 569
if PY_CONFD
PYTHON_BOOTSTRAP_SBIN += daemons/ganeti-confd
endif

570 571 572 573
PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
	tools/ensure-dirs

574
qa_scripts = \
575
	qa/__init__.py \
576 577 578 579 580 581
	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
582
	qa/qa_group.py \
583
	qa/qa_instance.py \
584
	qa/qa_job.py \
585 586 587 588 589 590
	qa/qa_node.py \
	qa/qa_os.py \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

591 592
bin_SCRIPTS =
if WANT_HTOOLS
593
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
594 595
install-exec-hook:
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
596 597
# FIXME: this is a hardcoded logic, instead of auto-resolving
	$(LN_S) -f ../../../bin/htools \
598
		   $(DESTDIR)$(iallocatorsdir)/hail
599
	for role in $(HS_BIN_ROLES); do \
600
		$(LN_S) -f htools \
601 602
			   $(DESTDIR)$(bindir)/$$role ; \
	done
603 604 605
if HS_CONFD
	mv $(DESTDIR)$(sbindir)/hconfd $(DESTDIR)$(sbindir)/ganeti-confd
endif
606 607
endif

608
$(HS_ALL_PROGS): %: %.hs $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS) Makefile
609 610 611 612
	@if [ -z "$(HTOOLS)" ]; then \
	  echo "Error: htools compilation disabled at configure time" 1>&2 ;\
	  exit 1; \
	fi
Iustin Pop's avatar
Iustin Pop committed
613
	@if [ "$(notdir $@)" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
614 615
	  echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \
	  exit 1; \
616
	fi
Iustin Pop's avatar
Iustin Pop committed
617 618
	@rm -f $(notdir $@).tix
	$(GHC) --make \
Iustin Pop's avatar
Iustin Pop committed
619
	  $(HFLAGS) \
620
	  $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) \
Iustin Pop's avatar
Iustin Pop committed
621
	  -osuf $(notdir $@).o -hisuf $(notdir $@).hi \
622
	  $(HEXTRA) $(HEXTRA_INT) $@
623 624
	@touch "$@"

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

628
# we compile the hpc-htools binary with the program coverage
Iustin Pop's avatar
Iustin Pop committed
629
htest/hpc-htools: HEXTRA_INT=-fhpc
630

631
# test dependency
Iustin Pop's avatar
Iustin Pop committed
632
htest/offline-tests.sh: htest/hpc-htools
633

634 635 636 637 638 639
# 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:
640 641
	$(MAKE) $(AM_MAKEFLAGS) clean
	$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf .o"
642
	rm -f $(HS_ALL_PROGS)
643
	$(MAKE) $(AM_MAKEFLAGS) hs-prof-quick
644 645

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

648 649
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
650

651
nodist_sbin_SCRIPTS = \
652
	$(PYTHON_BOOTSTRAP_SBIN) \
653 654
	daemons/ganeti-cleaner

655 656 657 658
if HS_CONFD
nodist_sbin_SCRIPTS += htools/hconfd
endif

659
python_scripts = \
660 661 662
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
663
	tools/cfgupgrade12 \
664
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
665
	tools/confd-client \
666
	tools/fmtjson \
Iustin Pop's avatar
Iustin Pop committed
667
	tools/lvmstrap \
668
	tools/move-instance \
669
	tools/ovfconverter \
670
	tools/setup-ssh \
Iustin Pop's avatar
Iustin Pop committed
671
	tools/sanitize-config
672

673
dist_tools_SCRIPTS = \
674
	$(python_scripts) \
675
	tools/kvm-console-wrapper \
676 677
	tools/xm-console-wrapper \
	tools/master-ip-setup
678

679 680 681
nodist_tools_SCRIPTS = \
	tools/vcluster-setup

682
pkglib_python_scripts = \
683 684
	daemons/import-export \
	tools/check-cert-expired
685

686 687 688
nodist_pkglib_python_scripts = \
	tools/ensure-dirs

689
myexeclib_SCRIPTS = \
690
	daemons/daemon-util \
691
	tools/kvm-ifup \
692
	$(pkglib_python_scripts)
693

694
nodist_myexeclib_SCRIPTS = \
695 696
	$(nodist_pkglib_python_scripts)

697 698
EXTRA_DIST = \
	NEWS \
699
	UPGRADE \
700
	epydoc.conf.in \
Michael Hanselmann's avatar
Michael Hanselmann committed
701
	pylintrc \
702
	autotools/build-bash-completion \
703
	autotools/build-rpc \
704
	autotools/check-header \
705
	autotools/check-python-code \
706
	autotools/check-imports \
Iustin Pop's avatar
Iustin Pop committed
707
	autotools/check-man-dashes \
708
	autotools/check-man-warnings \
709
	autotools/check-news \
710
	autotools/check-tar \
711
	autotools/check-version \
712
	autotools/convert-constants \
713
	autotools/docpp \
714
	autotools/gen-coverage \
715
	autotools/testrunner \
716
	autotools/wrong-hardcoded-paths \
717
	$(RUN_IN_TEMPDIR) \
718
	daemons/daemon-util.in \
719
	daemons/ganeti-cleaner.in \
720
	$(pkglib_python_scripts) \
721
	devel/upload.in \
722
	tools/kvm-ifup.in \
723
	tools/vcluster-setup.in \
724
	$(docdot) \
725
	$(docpng) \
726 727 728
	$(docrst) \
	doc/conf.py \
	doc/html \
729
	$(BUILT_EXAMPLES:%=%.in) \
730 731
	doc/examples/ganeti.default \
	doc/examples/ganeti.default-debug \
Guido Trotter's avatar
Guido Trotter committed
732
	doc/examples/hooks/ethers \
733 734 735
	doc/examples/gnt-debug/README \
	doc/examples/gnt-debug/delay0.json \
	doc/e