Makefile.am 58.8 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
# Helper function to strip src/ and test/hs/ from a list
strip_hsroot = $(patsubst src/%,%,$(patsubst test/hs/%,%,$(1)))

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

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

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

59 60 61
# Delete output file if an error occurred while building it
.DELETE_ON_ERROR:

62
HS_DIRS = \
Iustin Pop's avatar
Iustin Pop committed
63 64 65 66 67
	src \
	src/Ganeti \
	src/Ganeti/Block \
	src/Ganeti/Block/Drbd \
	src/Ganeti/Confd \
68
	src/Ganeti/Curl \
Iustin Pop's avatar
Iustin Pop committed
69 70 71 72
	src/Ganeti/DataCollectors \
	src/Ganeti/HTools \
	src/Ganeti/HTools/Backend \
	src/Ganeti/HTools/Program \
73 74
	src/Ganeti/Hypervisor \
	src/Ganeti/Hypervisor/Xen \
75
	src/Ganeti/Monitoring \
Iustin Pop's avatar
Iustin Pop committed
76
	src/Ganeti/Query \
77 78 79 80 81 82 83 84
	test/hs \
	test/hs/Test \
	test/hs/Test/Ganeti \
	test/hs/Test/Ganeti/Block \
	test/hs/Test/Ganeti/Block/Drbd \
	test/hs/Test/Ganeti/Confd \
	test/hs/Test/Ganeti/HTools \
	test/hs/Test/Ganeti/HTools/Backend \
85 86
	test/hs/Test/Ganeti/Hypervisor \
	test/hs/Test/Ganeti/Hypervisor/Xen \
87
	test/hs/Test/Ganeti/Query
88

89 90 91
# Haskell directories without the roots (src, test/hs)
HS_DIRS_NOROOT = $(filter-out src,$(filter-out test/hs,$(HS_DIRS)))

92
DIRS = \
93
	$(HS_DIRS) \
94 95 96
	autotools \
	daemons \
	devel \
97
	devel/data \
98
	doc \
99
	doc/css \
100
	doc/examples \
101
	doc/examples/gnt-debug \
Iustin Pop's avatar
Iustin Pop committed
102
	doc/examples/hooks \
103 104 105
	test/data/htools \
	test/data/htools/rapi \
	test/hs/shelltests \
106
	lib \
107
	lib/build \
Iustin Pop's avatar
Iustin Pop committed
108
	lib/client \
109
	lib/cmdlib \
110
	lib/confd \
111
	lib/http \
112
	lib/hypervisor \
113
	lib/impexpd \
Michael Hanselmann's avatar
Michael Hanselmann committed
114
	lib/masterd \
115
	lib/rapi \
116
	lib/server \
117
	lib/tools \
118
	lib/utils \
119
	lib/watcher \
120 121 122 123
	man \
	qa \
	test \
	test/data \
124
	test/data/bdev-rbd \
Agata Murawska's avatar
Agata Murawska committed
125
	test/data/ovfdata \
Agata Murawska's avatar
Agata Murawska committed
126
	test/data/ovfdata/other \
Iustin Pop's avatar
Iustin Pop committed
127
	test/py \
128 129
	tools

130
ALL_APIDOC_HS_DIRS = \
131
	$(APIDOC_HS_DIR) \
132
	$(patsubst %,$(APIDOC_HS_DIR)/%,$(call strip_hsroot,$(HS_DIRS_NOROOT)))
133 134 135 136 137

BUILDTIME_DIR_AUTOCREATE = \
	scripts \
	$(APIDOC_DIR) \
	$(ALL_APIDOC_HS_DIRS) \
Iustin Pop's avatar
Iustin Pop committed
138
	$(APIDOC_PY_DIR) \
139 140
	$(COVERAGE_DIR) \
	$(COVERAGE_HS_DIR) \
Iustin Pop's avatar
Iustin Pop committed
141
	$(COVERAGE_PY_DIR) \
142
	.hpc
143 144 145

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
146 147
	doc/html \
	doc/man-html
148 149 150 151

DIRCHECK_EXCLUDE = \
	$(BUILDTIME_DIRS) \
	ganeti-[0-9]*.[0-9]*.[0-9]* \
Iustin Pop's avatar
Iustin Pop committed
152
	doc/html/_* \
153
	doc/man-html/_* \
Iustin Pop's avatar
Iustin Pop committed
154
	autom4te.cache
155

156 157 158 159 160 161 162 163
# 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
164
MAINTAINERCLEANFILES = \
165
	$(maninput) \
166
	doc/install-quick.rst \
167
	doc/news.rst \
168
	doc/upgrade.rst \
169
	vcs-version
Iustin Pop's avatar
Iustin Pop committed
170

171
maintainer-clean-local:
172
	rm -rf $(BUILDTIME_DIRS)
173

174
CLEANFILES = \
175
	$(addsuffix /*.py[co],$(DIRS)) \
176 177
	$(addsuffix /*.hi,$(HS_DIRS)) \
	$(addsuffix /*.o,$(HS_DIRS)) \
178
	$(PYTHON_BOOTSTRAP) \
179
	epydoc.conf \
Iustin Pop's avatar
Iustin Pop committed
180
	$(REPLACE_VARS_SED) \
181
	$(SHELL_ENV_INIT) \
182
	daemons/daemon-util \
183
	daemons/ganeti-cleaner \
184 185
	devel/squeeze-amd64.tar.gz \
	devel/squeeze-amd64.conf \
186 187
	$(mandocrst) \
	doc/manpages-enabled.rst \
188
	$(BUILT_EXAMPLES) \
189
	doc/examples/bash_completion \
190
	doc/examples/bash_completion-debug \
191
	lib/_generated_rpc.py \
Iustin Pop's avatar
Iustin Pop committed
192 193
	$(man_MANS) \
	$(manhtml) \
194
	tools/kvm-ifup \
195
	tools/users-setup \
196
	tools/vcluster-setup \
197
	stamp-directories \
198
	stamp-srclinks \
199
	$(nodist_pkgpython_PYTHON) \
200
	$(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
201
	$(HS_BUILT_TEST_HELPERS) \
Iustin Pop's avatar
Iustin Pop committed
202
	src/ganeti-confd \
203
	src/ganeti-mond \
204
	.hpc/*.mix src/*.tix test/hs/*.tix \
205
	doc/hs-lint.html
206

Iustin Pop's avatar
Iustin Pop committed
207
GENERATED_FILES = \
Iustin Pop's avatar
Iustin Pop committed
208
	$(built_base_sources) \
209 210 211
	$(BUILT_PYTHON_SOURCES) \
	$(PYTHON_BOOTSTRAP)

212
HS_GENERATED_FILES =
213
if WANT_HTOOLS
214
HS_GENERATED_FILES += $(HS_PROGS)
215
if ENABLE_CONFD
216
HS_GENERATED_FILES += src/hconfd src/ganeti-confd
217
endif
218 219 220 221

if ENABLE_MOND
HS_GENERATED_FILES += src/ganeti-mond
endif
222 223
endif

224
built_base_sources = \
225 226
	stamp-directories \
	stamp-srclinks
227

228
built_python_base_sources = \
229
	lib/_autoconf.py \
230 231 232 233
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
234
	lib/_generated_rpc.py
235

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

240 241 242 243 244
# 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 \
245
	doc/examples/ganeti-master-role.ocf \
246
	doc/examples/ganeti-node-role.ocf \
247 248 249
	doc/examples/gnt-config-backup \
	doc/examples/hooks/ipsec

250 251 252
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

253
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
254
	lib/build/__init__.py \
Iustin Pop's avatar
Iustin Pop committed
255 256
	lib/build/shell_example_lexer.py \
	lib/build/sphinx_ext.py
257

258 259
pkgpython_PYTHON = \
	lib/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
260
	lib/asyncnotifier.py \
261 262 263 264
	lib/backend.py \
	lib/bdev.py \
	lib/bootstrap.py \
	lib/cli.py \
265
	lib/compat.py \
266 267
	lib/config.py \
	lib/constants.py \
268
	lib/daemon.py \
269
	lib/errors.py \
270
	lib/hooksmaster.py \
271
	lib/ht.py \
272
	lib/jqueue.py \
273
	lib/jstore.py \
274 275 276
	lib/locking.py \
	lib/luxi.py \
	lib/mcpu.py \
277
	lib/netutils.py \
278 279
	lib/objects.py \
	lib/opcodes.py \
280
	lib/outils.py \
281
	lib/ovf.py \
282
	lib/pathutils.py \
283
	lib/qlang.py \
284
	lib/query.py \
285
	lib/rpc.py \
286
	lib/rpc_defs.py \
287
	lib/runtime.py \
288 289 290
	lib/serializer.py \
	lib/ssconf.py \
	lib/ssh.py \
291
	lib/storage.py \
292
	lib/uidpool.py \
293
	lib/vcluster.py \
294
	lib/network.py \
295
	lib/workerpool.py
296

297
client_PYTHON = \
298
	lib/client/__init__.py \
299
	lib/client/gnt_backup.py \
300
	lib/client/gnt_cluster.py \
301
	lib/client/gnt_debug.py \
302
	lib/client/gnt_group.py \
303
	lib/client/gnt_instance.py \
304
	lib/client/gnt_job.py \
305
	lib/client/gnt_node.py \
306
	lib/client/gnt_network.py \
307 308
	lib/client/gnt_os.py \
	lib/client/gnt_storage.py
309

310
cmdlib_PYTHON = \
311 312
	lib/cmdlib/__init__.py \
	lib/cmdlib/common.py \
313
	lib/cmdlib/base.py \
314
	lib/cmdlib/cluster.py \
315
	lib/cmdlib/group.py \
316
	lib/cmdlib/node.py \
317
	lib/cmdlib/instance.py \
318
	lib/cmdlib/instance_storage.py \
319
	lib/cmdlib/instance_utils.py \
320
	lib/cmdlib/backup.py \
321
	lib/cmdlib/query.py \
322
	lib/cmdlib/operating_system.py \
323
	lib/cmdlib/tags.py \
324
	lib/cmdlib/network.py \
325
	lib/cmdlib/misc.py \
326
	lib/cmdlib/test.py
327

328 329 330
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
331
	lib/hypervisor/hv_chroot.py \
332
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
333
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
334
	lib/hypervisor/hv_lxc.py \
335 336
	lib/hypervisor/hv_xen.py

337 338
rapi_PYTHON = \
	lib/rapi/__init__.py \
339
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
340
	lib/rapi/client.py \
341
	lib/rapi/client_utils.py \
342
	lib/rapi/connector.py \
343 344
	lib/rapi/rlib2.py \
	lib/rapi/testutils.py
345

346
http_PYTHON = \
347
	lib/http/__init__.py \
348
	lib/http/auth.py \
349 350
	lib/http/client.py \
	lib/http/server.py
351

Guido Trotter's avatar
Guido Trotter committed
352
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
353
	lib/confd/__init__.py \
354
	lib/confd/client.py
355

Michael Hanselmann's avatar
Michael Hanselmann committed
356
masterd_PYTHON = \
357
	lib/masterd/__init__.py \
René Nussbaumer's avatar
René Nussbaumer committed
358
	lib/masterd/iallocator.py \
359
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
360

361 362 363
impexpd_PYTHON = \
	lib/impexpd/__init__.py

364
watcher_PYTHON = \
365
	lib/watcher/__init__.py \
366 367
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
368

369
server_PYTHON = \
370
	lib/server/__init__.py \
371
	lib/server/masterd.py \
372 373
	lib/server/noded.py \
	lib/server/rapi.py
374

375 376
pytools_PYTHON = \
	lib/tools/__init__.py \
377
	lib/tools/burnin.py \
378
	lib/tools/ensure_dirs.py \
Michael Hanselmann's avatar
Michael Hanselmann committed
379
	lib/tools/node_cleanup.py \
380
	lib/tools/node_daemon_setup.py \
381
	lib/tools/prepare_node_join.py
382

383
utils_PYTHON = \
384
	lib/utils/__init__.py \
385
	lib/utils/algo.py \
386
	lib/utils/filelock.py \
387
	lib/utils/hash.py \
388
	lib/utils/io.py \
389
	lib/utils/log.py \
390
	lib/utils/lvm.py \
391
	lib/utils/mlock.py \
392
	lib/utils/nodesetup.py \
393
	lib/utils/process.py \
394
	lib/utils/retry.py \
395
	lib/utils/text.py \
396 397
	lib/utils/wrapper.py \
	lib/utils/x509.py
398

399 400 401
docinput = \
	doc/conf.py \
	doc/css/style.css \
402
	doc/admin.rst \
Iustin Pop's avatar
Iustin Pop committed
403
	doc/cluster-merge.rst \
404
	doc/design-2.0.rst \
405
	doc/design-2.1.rst \
406
	doc/design-2.2.rst \
Guido Trotter's avatar
Guido Trotter committed
407
	doc/design-2.3.rst \
408
	doc/design-2.4.rst \
409
	doc/design-2.5.rst \
410
	doc/design-2.6.rst \
411
	doc/design-2.7.rst \
Iustin Pop's avatar
Iustin Pop committed
412 413 414
	doc/design-autorepair.rst \
	doc/design-bulk-create.rst \
	doc/design-chained-jobs.rst \
Tsachy Shacham's avatar
Tsachy Shacham committed
415
	doc/design-cpu-pinning.rst \
416
	doc/design-device-uuid-name.rst \
Iustin Pop's avatar
Iustin Pop committed
417 418
	doc/design-draft.rst \
	doc/design-htools-2.3.rst \
419
	doc/design-http-server.rst \
420
	doc/design-impexp2.rst \
421
	doc/design-lu-generated-jobs.rst \
422
	doc/design-linuxha.rst \
423
	doc/design-multi-reloc.rst \
424
	doc/design-network.rst \
425
	doc/design-node-add.rst \
Iustin Pop's avatar
Iustin Pop committed
426
	doc/design-oob.rst \
427
	doc/design-ovf-support.rst \
428
	doc/design-opportunistic-locking.rst \
Iustin Pop's avatar
Iustin Pop committed
429 430 431
	doc/design-partitioned.rst \
	doc/design-query-splitting.rst \
	doc/design-query2.rst \
432
	doc/design-reason-trail.rst \
433
	doc/design-resource-model.rst \
434
	doc/design-restricted-commands.rst \
435
	doc/design-shared-storage.rst \
436
	doc/design-monitoring-agent.rst \
437
	doc/design-virtual-clusters.rst \
Iustin Pop's avatar
Iustin Pop committed
438
	doc/design-x509-ca.rst \
439
	doc/design-hroller.rst \
440
	doc/design-storagetypes.rst \
441
	doc/devnotes.rst \
442
	doc/glossary.rst \
443
	doc/hooks.rst \
444
	doc/iallocator.rst \
445
	doc/index.rst \
446
	doc/install-quick.rst \
447
	doc/install.rst \
448
	doc/locking.rst \
449
	doc/manpages-disabled.rst \
450
	doc/move-instance.rst \
Iustin Pop's avatar
Iustin Pop committed
451
	doc/news.rst \
452
	doc/ovfconverter.rst \
453
	doc/rapi.rst \
454
	doc/security.rst \
455
	doc/upgrade.rst \
456
	doc/virtual-cluster.rst \
Iustin Pop's avatar
Iustin Pop committed
457
	doc/walkthrough.rst
Michael Hanselmann's avatar
Michael Hanselmann committed
458

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

462 463 464 465
# Haskell programs to be installed in $PREFIX/bin
HS_BIN_PROGS=src/htools

# Haskell programs to be installed in the MYEXECLIB dir
466
if ENABLE_MOND
467
HS_MYEXECLIB_PROGS=src/mon-collector
468 469 470
else
HS_MYEXECLIB_PROGS=
endif
471

472
# Haskell programs to be compiled by "make really-all"
473
HS_COMPILE_PROGS= \
474
	src/ganeti-mond \
475 476 477 478 479 480
	src/hconfd \
	src/rpc-test

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

481
HS_BIN_ROLES = harep hbal hscan hspace hinfo hcheck hroller
482
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
483

484 485
HS_ALL_PROGS = \
	$(HS_PROGS) \
486 487
	test/hs/hpc-htools \
	test/hs/hpc-mon-collector \
Iustin Pop's avatar
Iustin Pop committed
488
	test/hs/htest \
489
	$(HS_COMPILE_PROGS)
490

491
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
492
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
493

494
HFLAGS = \
Iustin Pop's avatar
Iustin Pop committed
495
	-O -Wall -Werror -isrc \
496 497 498 499
	-fwarn-monomorphism-restriction \
	-fwarn-tabs \
	$(GHC_BYVERSION_FLAGS)

500
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
501
HEXTRA =
Iustin Pop's avatar
Iustin Pop committed
502
# internal extra flags (used for test/hs/htest mainly)
503
HEXTRA_INT =
504
# exclude options for coverage reports
505
HPCEXCL = --exclude Main \
506
	--exclude Ganeti.Constants \
507
	--exclude Ganeti.HTools.QC \
Iustin Pop's avatar
Iustin Pop committed
508
	--exclude Ganeti.THH \
509
	--exclude Ganeti.Version \
510
	--exclude Test.Ganeti.Attoparsec \
511
	--exclude Test.Ganeti.TestCommon \
512 513
	--exclude Test.Ganeti.TestHTools \
	--exclude Test.Ganeti.TestHelper \
514
	--exclude Test.Ganeti.TestImports \
Iustin Pop's avatar
Iustin Pop committed
515
	$(patsubst src.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
516

517
HS_LIB_SRCS = \
Iustin Pop's avatar
Iustin Pop committed
518 519 520 521 522 523 524 525 526 527
	src/Ganeti/Block/Drbd/Types.hs \
	src/Ganeti/Block/Drbd/Parser.hs \
	src/Ganeti/BasicTypes.hs \
	src/Ganeti/Common.hs \
	src/Ganeti/Compat.hs \
	src/Ganeti/Confd/Client.hs \
	src/Ganeti/Confd/Server.hs \
	src/Ganeti/Confd/Types.hs \
	src/Ganeti/Confd/Utils.hs \
	src/Ganeti/Config.hs \
528
	src/Ganeti/Curl/Multi.hs \
Iustin Pop's avatar
Iustin Pop committed
529 530 531 532
	src/Ganeti/Daemon.hs \
	src/Ganeti/DataCollectors/CLI.hs \
	src/Ganeti/DataCollectors/Drbd.hs \
	src/Ganeti/DataCollectors/Program.hs \
533
	src/Ganeti/DataCollectors/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550
	src/Ganeti/Errors.hs \
	src/Ganeti/HTools/Backend/IAlloc.hs \
	src/Ganeti/HTools/Backend/Luxi.hs \
	src/Ganeti/HTools/Backend/Rapi.hs \
	src/Ganeti/HTools/Backend/Simu.hs \
	src/Ganeti/HTools/Backend/Text.hs \
	src/Ganeti/HTools/CLI.hs \
	src/Ganeti/HTools/Cluster.hs \
	src/Ganeti/HTools/Container.hs \
	src/Ganeti/HTools/ExtLoader.hs \
	src/Ganeti/HTools/Graph.hs \
	src/Ganeti/HTools/Group.hs \
	src/Ganeti/HTools/Instance.hs \
	src/Ganeti/HTools/Loader.hs \
	src/Ganeti/HTools/Node.hs \
	src/Ganeti/HTools/PeerMap.hs \
	src/Ganeti/HTools/Program/Hail.hs \
551
	src/Ganeti/HTools/Program/Harep.hs \
Iustin Pop's avatar
Iustin Pop committed
552 553 554 555 556 557
	src/Ganeti/HTools/Program/Hbal.hs \
	src/Ganeti/HTools/Program/Hcheck.hs \
	src/Ganeti/HTools/Program/Hinfo.hs \
	src/Ganeti/HTools/Program/Hscan.hs \
	src/Ganeti/HTools/Program/Hspace.hs \
	src/Ganeti/HTools/Program/Hroller.hs \
558
	src/Ganeti/HTools/Program/Main.hs \
Iustin Pop's avatar
Iustin Pop committed
559
	src/Ganeti/HTools/Types.hs \
560 561
	src/Ganeti/Hypervisor/Xen/XmParser.hs \
	src/Ganeti/Hypervisor/Xen/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
562 563 564 565 566 567
	src/Ganeti/Hash.hs \
	src/Ganeti/JQueue.hs \
	src/Ganeti/JSON.hs \
	src/Ganeti/Jobs.hs \
	src/Ganeti/Logging.hs \
	src/Ganeti/Luxi.hs \
568
	src/Ganeti/Monitoring/Server.hs \
Iustin Pop's avatar
Iustin Pop committed
569 570 571 572 573 574
	src/Ganeti/Network.hs \
	src/Ganeti/Objects.hs \
	src/Ganeti/OpCodes.hs \
	src/Ganeti/OpParams.hs \
	src/Ganeti/Path.hs \
	src/Ganeti/Query/Common.hs \
575
	src/Ganeti/Query/Export.hs \
Iustin Pop's avatar
Iustin Pop committed
576 577 578 579
	src/Ganeti/Query/Filter.hs \
	src/Ganeti/Query/Group.hs \
	src/Ganeti/Query/Job.hs \
	src/Ganeti/Query/Language.hs \
580
	src/Ganeti/Query/Network.hs \
Iustin Pop's avatar
Iustin Pop committed
581 582 583 584 585 586 587 588 589 590
	src/Ganeti/Query/Node.hs \
	src/Ganeti/Query/Query.hs \
	src/Ganeti/Query/Server.hs \
	src/Ganeti/Query/Types.hs \
	src/Ganeti/Rpc.hs \
	src/Ganeti/Runtime.hs \
	src/Ganeti/Ssconf.hs \
	src/Ganeti/THH.hs \
	src/Ganeti/Types.hs \
	src/Ganeti/Utils.hs
591 592

HS_TEST_SRCS = \
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612
	test/hs/Test/Ganeti/Attoparsec.hs \
	test/hs/Test/Ganeti/BasicTypes.hs \
	test/hs/Test/Ganeti/Block/Drbd/Parser.hs \
	test/hs/Test/Ganeti/Block/Drbd/Types.hs \
	test/hs/Test/Ganeti/Common.hs \
	test/hs/Test/Ganeti/Confd/Types.hs \
	test/hs/Test/Ganeti/Confd/Utils.hs \
	test/hs/Test/Ganeti/Daemon.hs \
	test/hs/Test/Ganeti/Errors.hs \
	test/hs/Test/Ganeti/HTools/Backend/Simu.hs \
	test/hs/Test/Ganeti/HTools/Backend/Text.hs \
	test/hs/Test/Ganeti/HTools/CLI.hs \
	test/hs/Test/Ganeti/HTools/Cluster.hs \
	test/hs/Test/Ganeti/HTools/Container.hs \
	test/hs/Test/Ganeti/HTools/Graph.hs \
	test/hs/Test/Ganeti/HTools/Instance.hs \
	test/hs/Test/Ganeti/HTools/Loader.hs \
	test/hs/Test/Ganeti/HTools/Node.hs \
	test/hs/Test/Ganeti/HTools/PeerMap.hs \
	test/hs/Test/Ganeti/HTools/Types.hs \
613
	test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs \
614 615 616 617 618 619 620 621 622
	test/hs/Test/Ganeti/JSON.hs \
	test/hs/Test/Ganeti/Jobs.hs \
	test/hs/Test/Ganeti/JQueue.hs \
	test/hs/Test/Ganeti/Luxi.hs \
	test/hs/Test/Ganeti/Network.hs \
	test/hs/Test/Ganeti/Objects.hs \
	test/hs/Test/Ganeti/OpCodes.hs \
	test/hs/Test/Ganeti/Query/Filter.hs \
	test/hs/Test/Ganeti/Query/Language.hs \
623
	test/hs/Test/Ganeti/Query/Network.hs \
624 625
	test/hs/Test/Ganeti/Query/Query.hs \
	test/hs/Test/Ganeti/Rpc.hs \
626
	test/hs/Test/Ganeti/Runtime.hs \
627 628 629 630 631 632 633
	test/hs/Test/Ganeti/Ssconf.hs \
	test/hs/Test/Ganeti/THH.hs \
	test/hs/Test/Ganeti/TestCommon.hs \
	test/hs/Test/Ganeti/TestHTools.hs \
	test/hs/Test/Ganeti/TestHelper.hs \
	test/hs/Test/Ganeti/Types.hs \
	test/hs/Test/Ganeti/Utils.hs
634

635
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
636

637
HS_BUILT_SRCS = \
638
	test/hs/Test/Ganeti/TestImports.hs \
Iustin Pop's avatar
Iustin Pop committed
639
	src/Ganeti/Constants.hs \
640
	src/Ganeti/Curl/Internal.hs \
Iustin Pop's avatar
Iustin Pop committed
641
	src/Ganeti/Version.hs
642 643 644
HS_BUILT_SRCS_IN = \
	$(patsubst %,%.in,$(filter-out src/Ganeti/Curl/Internal.hs,$(HS_BUILT_SRCS))) \
	src/Ganeti/Curl/Internal.hsc
645

646 647
HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)

648
$(RUN_IN_TEMPDIR): | stamp-directories
649

650 651 652 653
doc/html/index.html: ENABLE_MANPAGES =
doc/man-html/index.html: ENABLE_MANPAGES = 1
doc/man-html/index.html: doc/manpages-enabled.rst $(mandocrst)

Iustin Pop's avatar
Iustin Pop committed
654 655 656 657 658
# 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
659 660
doc/html/index.html doc/man-html/index.html: $(docinput) doc/conf.py \
	configure.ac $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
661
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
662
	doc/css/style.css lib/rapi/connector.py lib/rapi/rlib2.py \
663
	| $(BUILT_PYTHON_SOURCES)
664 665
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
666 667 668 669 670 671
if !MANPAGES_IN_DOC
	if test -n '$(ENABLE_MANPAGES)'; then \
	  echo 'Man pages in documentation were disabled at configure time' >&2; \
	  exit 1; \
	fi
endif
672 673 674 675 676 677
## Sphinx provides little control over what content should be included. Some
## mechanisms exist, but they all have drawbacks or actual issues. Since we
## build two different versions of the documentation--once without man pages and
## once, if enabled, with them--some control is necessary. xmpp-wrapper provides
## us with this, but requires running in a temporary directory. It moves the
## correct files into place depending on environment variables.
678 679
	dir=$(dir $@) && \
	@mkdir_p@ $$dir && \
680 681
	PYTHONPATH=. ENABLE_MANPAGES=$(ENABLE_MANPAGES) COPY_DOC=1 \
	$(RUN_IN_TEMPDIR) autotools/sphinx-wrapper $(SPHINX) -q -W -b html \
682
	    -d . \
683 684
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
685
	    -D graphviz_dot="$(DOT)" \
686 687 688
	    -D enable_manpages="$(ENABLE_MANPAGES)" \
	    doc $(CURDIR)/$$dir && \
	rm -f $$dir/.buildinfo $$dir/objects.inv
689 690
	touch $@

691
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
692

693 694
doc/man-html: doc/man-html/index.html

695
doc/install-quick.rst: INSTALL
696
doc/news.rst: NEWS
697
doc/upgrade.rst: UPGRADE
698

699
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
700 701 702 703 704 705 706
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734
doc/manpages-enabled.rst: Makefile | $(built_base_sources)
	{ echo '.. This file is automatically generated, do not edit!'; \
	  echo ''; \
	  echo 'Man pages'; \
	  echo '========='; \
	  echo; \
	  echo '.. toctree::'; \
	  echo '   :maxdepth: 1'; \
	  echo; \
	  for i in $(notdir $(mandocrst)); do \
	    echo "   $$i"; \
	  done | LC_ALL=C sort; \
	} > $@

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

735 736 737 738
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	doc/html \
739
	$(BUILT_EXAMPLES) \
740
	doc/examples/bash_completion \
741
	doc/examples/bash_completion-debug \
742
	$(manhtml)
743

744 745 746 747
if MANPAGES_IN_DOC
noinst_DATA += doc/man-html
endif

748
gnt_scripts = \
749 750 751
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
752
	scripts/gnt-group \
753 754
	scripts/gnt-instance \
	scripts/gnt-job \
755
	scripts/gnt-network \
756
	scripts/gnt-node \
757 758
	scripts/gnt-os \
	scripts/gnt-storage
759

760
PYTHON_BOOTSTRAP_SBIN = \
761
	daemons/ganeti-masterd \
762
	daemons/ganeti-noded \
763
	daemons/ganeti-rapi \
Iustin Pop's avatar
Iustin Pop committed
764
	daemons/ganeti-watcher \
765
	$(gnt_scripts)
766

767 768
PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
769
	tools/burnin \
770
	tools/ensure-dirs \
Michael Hanselmann's avatar
Michael Hanselmann committed
771
	tools/node-cleanup \
772
	tools/node-daemon-setup \
773
	tools/prepare-node-join
774

775
qa_scripts = \
776
	qa/__init__.py \
777 778 779 780 781 782
	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
783
	qa/qa_group.py \
784
	qa/qa_instance.py \
785
	qa/qa_job.py \
786 787 788 789 790 791
	qa/qa_node.py \
	qa/qa_os.py \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

792 793
bin_SCRIPTS =
if WANT_HTOOLS
794
bin_SCRIPTS += $(HS_BIN_PROGS)
795 796
install-exec-hook:
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
797 798
# FIXME: this is a hardcoded logic, instead of auto-resolving
	$(LN_S) -f ../../../bin/htools \
Iustin Pop's avatar
Iustin Pop committed
799
	  $(DESTDIR)$(iallocatorsdir)/hail
800
	for role in $(HS_BIN_ROLES); do \
Iustin Pop's avatar
Iustin Pop committed
801
	  $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
802
	done
803 804
endif

805
$(HS_ALL_PROGS): %: %.hs $(HS_LIBTESTBUILT_SRCS) Makefile
806
	@if [ "$(no