Makefile.am 61.6 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
storagedir = $(pkgpythondir)/storage
46
httpdir = $(pkgpythondir)/http
Michael Hanselmann's avatar
Michael Hanselmann committed
47
masterddir = $(pkgpythondir)/masterd
Guido Trotter's avatar
Guido Trotter committed
48
confddir = $(pkgpythondir)/confd
49
rapidir = $(pkgpythondir)/rapi
50
serverdir = $(pkgpythondir)/server
51
watcherdir = $(pkgpythondir)/watcher
52
impexpddir = $(pkgpythondir)/impexpd
53
utilsdir = $(pkgpythondir)/utils
54
toolsdir = $(pkglibdir)/tools
55
iallocatorsdir = $(pkglibdir)/iallocators
56
pytoolsdir = $(pkgpythondir)/tools
57
docdir = $(datadir)/doc/$(PACKAGE)
58
myexeclibdir = $(pkglibdir)
59

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

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

93 94 95
# Haskell directories without the roots (src, test/hs)
HS_DIRS_NOROOT = $(filter-out src,$(filter-out test/hs,$(HS_DIRS)))

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

136
ALL_APIDOC_HS_DIRS = \
137
	$(APIDOC_HS_DIR) \
138
	$(patsubst %,$(APIDOC_HS_DIR)/%,$(call strip_hsroot,$(HS_DIRS_NOROOT)))
139 140 141 142 143

BUILDTIME_DIR_AUTOCREATE = \
	scripts \
	$(APIDOC_DIR) \
	$(ALL_APIDOC_HS_DIRS) \
Iustin Pop's avatar
Iustin Pop committed
144
	$(APIDOC_PY_DIR) \
145 146
	$(COVERAGE_DIR) \
	$(COVERAGE_HS_DIR) \
Iustin Pop's avatar
Iustin Pop committed
147
	$(COVERAGE_PY_DIR) \
148
	.hpc
149 150 151

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
152 153
	doc/html \
	doc/man-html
154 155 156 157

DIRCHECK_EXCLUDE = \
	$(BUILDTIME_DIRS) \
	ganeti-[0-9]*.[0-9]*.[0-9]* \
Iustin Pop's avatar
Iustin Pop committed
158
	doc/html/_* \
159
	doc/man-html/_* \
Iustin Pop's avatar
Iustin Pop committed
160
	autom4te.cache
161

162 163 164 165 166 167 168 169
# 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
170
MAINTAINERCLEANFILES = \
171
	$(maninput) \
172
	doc/install-quick.rst \
173
	doc/news.rst \
174
	doc/upgrade.rst \
175
	vcs-version
Iustin Pop's avatar
Iustin Pop committed
176

177
maintainer-clean-local:
178
	rm -rf $(BUILDTIME_DIRS)
179

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

Iustin Pop's avatar
Iustin Pop committed
215
GENERATED_FILES = \
Iustin Pop's avatar
Iustin Pop committed
216
	$(built_base_sources) \
217 218 219
	$(BUILT_PYTHON_SOURCES) \
	$(PYTHON_BOOTSTRAP)

220
HS_GENERATED_FILES =
221
if WANT_HTOOLS
222
HS_GENERATED_FILES += $(HS_PROGS)
223
if ENABLE_CONFD
224
HS_GENERATED_FILES += src/hconfd src/ganeti-confd
225
endif
226 227 228 229

if ENABLE_MOND
HS_GENERATED_FILES += src/ganeti-mond
endif
230 231
endif

232
built_base_sources = \
233 234
	stamp-directories \
	stamp-srclinks
235

236
built_python_base_sources = \
237
	lib/_autoconf.py \
238 239 240 241
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
242
	lib/_generated_rpc.py
243

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

248 249 250 251 252
# 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 \
253
	doc/examples/ganeti-master-role.ocf \
254
	doc/examples/ganeti-node-role.ocf \
255 256 257
	doc/examples/gnt-config-backup \
	doc/examples/hooks/ipsec

258 259 260
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

261
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
262
	lib/build/__init__.py \
Iustin Pop's avatar
Iustin Pop committed
263 264
	lib/build/shell_example_lexer.py \
	lib/build/sphinx_ext.py
265

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

303
client_PYTHON = \
304
	lib/client/__init__.py \
305
	lib/client/gnt_backup.py \
306
	lib/client/gnt_cluster.py \
307
	lib/client/gnt_debug.py \
308
	lib/client/gnt_group.py \
309
	lib/client/gnt_instance.py \
310
	lib/client/gnt_job.py \
311
	lib/client/gnt_node.py \
312
	lib/client/gnt_network.py \
313 314
	lib/client/gnt_os.py \
	lib/client/gnt_storage.py
315

316
cmdlib_PYTHON = \
317
	lib/cmdlib/__init__.py \
318
	lib/cmdlib/backup.py \
319
	lib/cmdlib/base.py \
320
	lib/cmdlib/cluster.py \
321
	lib/cmdlib/common.py \
322
	lib/cmdlib/group.py \
323
	lib/cmdlib/instance.py \
324
	lib/cmdlib/instance_migration.py \
325
	lib/cmdlib/instance_operation.py \
326
	lib/cmdlib/instance_query.py \
327
	lib/cmdlib/instance_storage.py \
328
	lib/cmdlib/instance_utils.py \
329 330 331
	lib/cmdlib/misc.py \
	lib/cmdlib/network.py \
	lib/cmdlib/node.py \
332
	lib/cmdlib/operating_system.py \
333
	lib/cmdlib/query.py \
334
	lib/cmdlib/tags.py \
335
	lib/cmdlib/test.py
336

337 338 339
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
340
	lib/hypervisor/hv_chroot.py \
341
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
342
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
343
	lib/hypervisor/hv_lxc.py \
344 345
	lib/hypervisor/hv_xen.py

346 347 348 349
storage_PYTHON = \
	lib/storage/__init__.py \
	lib/storage/bdev.py \
	lib/storage/base.py \
350
	lib/storage/container.py \
351 352
	lib/storage/drbd.py \
	lib/storage/drbd_info.py \
353 354
	lib/storage/drbd_cmdgen.py \
	lib/storage/filestorage.py
355

356 357
rapi_PYTHON = \
	lib/rapi/__init__.py \
358
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
359
	lib/rapi/client.py \
360
	lib/rapi/client_utils.py \
361
	lib/rapi/connector.py \
362 363
	lib/rapi/rlib2.py \
	lib/rapi/testutils.py
364

365
http_PYTHON = \
366
	lib/http/__init__.py \
367
	lib/http/auth.py \
368 369
	lib/http/client.py \
	lib/http/server.py
370

Guido Trotter's avatar
Guido Trotter committed
371
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
372
	lib/confd/__init__.py \
373
	lib/confd/client.py
374

Michael Hanselmann's avatar
Michael Hanselmann committed
375
masterd_PYTHON = \
376
	lib/masterd/__init__.py \
René Nussbaumer's avatar
René Nussbaumer committed
377
	lib/masterd/iallocator.py \
378
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
379

380 381 382
impexpd_PYTHON = \
	lib/impexpd/__init__.py

383
watcher_PYTHON = \
384
	lib/watcher/__init__.py \
385 386
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
387

388
server_PYTHON = \
389
	lib/server/__init__.py \
390
	lib/server/masterd.py \
391 392
	lib/server/noded.py \
	lib/server/rapi.py
393

394 395
pytools_PYTHON = \
	lib/tools/__init__.py \
396
	lib/tools/burnin.py \
397
	lib/tools/ensure_dirs.py \
Michael Hanselmann's avatar
Michael Hanselmann committed
398
	lib/tools/node_cleanup.py \
399
	lib/tools/node_daemon_setup.py \
400
	lib/tools/prepare_node_join.py
401

402
utils_PYTHON = \
403
	lib/utils/__init__.py \
404
	lib/utils/algo.py \
405
	lib/utils/filelock.py \
406
	lib/utils/hash.py \
407
	lib/utils/io.py \
408
	lib/utils/log.py \
409
	lib/utils/lvm.py \
410
	lib/utils/mlock.py \
411
	lib/utils/nodesetup.py \
412
	lib/utils/process.py \
413
	lib/utils/retry.py \
Helga Velroyen's avatar
Helga Velroyen committed
414
	lib/utils/storage.py \
415
	lib/utils/text.py \
416 417
	lib/utils/wrapper.py \
	lib/utils/x509.py
418

419 420 421
docinput = \
	doc/conf.py \
	doc/css/style.css \
422
	doc/admin.rst \
Iustin Pop's avatar
Iustin Pop committed
423
	doc/cluster-merge.rst \
424
	doc/design-2.0.rst \
425
	doc/design-2.1.rst \
426
	doc/design-2.2.rst \
Guido Trotter's avatar
Guido Trotter committed
427
	doc/design-2.3.rst \
428
	doc/design-2.4.rst \
429
	doc/design-2.5.rst \
430
	doc/design-2.6.rst \
431
	doc/design-2.7.rst \
432
	doc/design-2.8.rst \
Iustin Pop's avatar
Iustin Pop committed
433 434 435
	doc/design-autorepair.rst \
	doc/design-bulk-create.rst \
	doc/design-chained-jobs.rst \
Tsachy Shacham's avatar
Tsachy Shacham committed
436
	doc/design-cpu-pinning.rst \
437
	doc/design-device-uuid-name.rst \
Iustin Pop's avatar
Iustin Pop committed
438 439
	doc/design-draft.rst \
	doc/design-htools-2.3.rst \
440
	doc/design-http-server.rst \
441
	doc/design-impexp2.rst \
442
	doc/design-internal-shutdown.rst \
443
	doc/design-lu-generated-jobs.rst \
444
	doc/design-linuxha.rst \
445
	doc/design-multi-reloc.rst \
446
	doc/design-network.rst \
447
	doc/design-node-add.rst \
Iustin Pop's avatar
Iustin Pop committed
448
	doc/design-oob.rst \
449
	doc/design-ovf-support.rst \
450
	doc/design-opportunistic-locking.rst \
Iustin Pop's avatar
Iustin Pop committed
451 452 453
	doc/design-partitioned.rst \
	doc/design-query-splitting.rst \
	doc/design-query2.rst \
454
	doc/design-reason-trail.rst \
455
	doc/design-resource-model.rst \
456
	doc/design-restricted-commands.rst \
457
	doc/design-shared-storage.rst \
458
	doc/design-monitoring-agent.rst \
459
	doc/design-virtual-clusters.rst \
Iustin Pop's avatar
Iustin Pop committed
460
	doc/design-x509-ca.rst \
461
	doc/design-hroller.rst \
462
	doc/design-storagetypes.rst \
463
	doc/devnotes.rst \
464
	doc/glossary.rst \
465
	doc/hooks.rst \
466
	doc/iallocator.rst \
467
	doc/index.rst \
468
	doc/install-quick.rst \
469
	doc/install.rst \
470
	doc/locking.rst \
471
	doc/manpages-disabled.rst \
472
	doc/move-instance.rst \
Iustin Pop's avatar
Iustin Pop committed
473
	doc/news.rst \
474
	doc/ovfconverter.rst \
475
	doc/rapi.rst \
476
	doc/security.rst \
477
	doc/upgrade.rst \
478
	doc/virtual-cluster.rst \
Iustin Pop's avatar
Iustin Pop committed
479
	doc/walkthrough.rst
Michael Hanselmann's avatar
Michael Hanselmann committed
480

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

484 485 486 487
# Haskell programs to be installed in $PREFIX/bin
HS_BIN_PROGS=src/htools

# Haskell programs to be installed in the MYEXECLIB dir
488
if ENABLE_MOND
489
HS_MYEXECLIB_PROGS=src/mon-collector
490 491 492
else
HS_MYEXECLIB_PROGS=
endif
493

494
# Haskell programs to be compiled by "make really-all"
495
HS_COMPILE_PROGS= \
496
	src/ganeti-mond \
497 498 499 500 501 502
	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)

503
HS_BIN_ROLES = harep hbal hscan hspace hinfo hcheck hroller
504
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
505

506 507
HS_ALL_PROGS = \
	$(HS_PROGS) \
508 509
	test/hs/hpc-htools \
	test/hs/hpc-mon-collector \
Iustin Pop's avatar
Iustin Pop committed
510
	test/hs/htest \
511
	$(HS_COMPILE_PROGS)
512

513
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
514
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
515

516
HFLAGS = \
Iustin Pop's avatar
Iustin Pop committed
517
	-O -Wall -Werror -isrc \
518 519 520 521
	-fwarn-monomorphism-restriction \
	-fwarn-tabs \
	$(GHC_BYVERSION_FLAGS)

522
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
523
HEXTRA =
Iustin Pop's avatar
Iustin Pop committed
524
# internal extra flags (used for test/hs/htest mainly)
525
HEXTRA_INT =
526
# exclude options for coverage reports
527
HPCEXCL = --exclude Main \
528
	--exclude Ganeti.Constants \
529
	--exclude Ganeti.HTools.QC \
Iustin Pop's avatar
Iustin Pop committed
530
	--exclude Ganeti.THH \
531
	--exclude Ganeti.Version \
532
	--exclude Test.Ganeti.Attoparsec \
533
	--exclude Test.Ganeti.TestCommon \
534 535
	--exclude Test.Ganeti.TestHTools \
	--exclude Test.Ganeti.TestHelper \
536
	--exclude Test.Ganeti.TestImports \
Iustin Pop's avatar
Iustin Pop committed
537
	$(patsubst src.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
538

539
HS_LIB_SRCS = \
Iustin Pop's avatar
Iustin Pop committed
540 541 542 543 544 545 546 547
	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 \
548
	src/Ganeti/Curl/Multi.hs \
Iustin Pop's avatar
Iustin Pop committed
549 550
	src/Ganeti/Daemon.hs \
	src/Ganeti/DataCollectors/CLI.hs \
Michele Tartara's avatar
Michele Tartara committed
551
	src/Ganeti/DataCollectors/Diskstats.hs \
Iustin Pop's avatar
Iustin Pop committed
552
	src/Ganeti/DataCollectors/Drbd.hs \
553 554
	src/Ganeti/DataCollectors/InstStatus.hs \
	src/Ganeti/DataCollectors/InstStatusTypes.hs \
Iustin Pop's avatar
Iustin Pop committed
555
	src/Ganeti/DataCollectors/Program.hs \
556
	src/Ganeti/DataCollectors/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
557 558 559 560 561 562 563 564 565 566 567 568 569 570
	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 \
571
	src/Ganeti/HTools/Nic.hs \
Iustin Pop's avatar
Iustin Pop committed
572 573 574
	src/Ganeti/HTools/Node.hs \
	src/Ganeti/HTools/PeerMap.hs \
	src/Ganeti/HTools/Program/Hail.hs \
575
	src/Ganeti/HTools/Program/Harep.hs \
Iustin Pop's avatar
Iustin Pop committed
576 577 578 579 580 581
	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 \
582
	src/Ganeti/HTools/Program/Main.hs \
Iustin Pop's avatar
Iustin Pop committed
583
	src/Ganeti/HTools/Types.hs \
584
	src/Ganeti/Hypervisor/Xen.hs \
585 586
	src/Ganeti/Hypervisor/Xen/XmParser.hs \
	src/Ganeti/Hypervisor/Xen/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
587 588 589 590 591 592
	src/Ganeti/Hash.hs \
	src/Ganeti/JQueue.hs \
	src/Ganeti/JSON.hs \
	src/Ganeti/Jobs.hs \
	src/Ganeti/Logging.hs \
	src/Ganeti/Luxi.hs \
593
	src/Ganeti/Monitoring/Server.hs \
Iustin Pop's avatar
Iustin Pop committed
594 595 596 597 598
	src/Ganeti/Network.hs \
	src/Ganeti/Objects.hs \
	src/Ganeti/OpCodes.hs \
	src/Ganeti/OpParams.hs \
	src/Ganeti/Path.hs \
Thomas Thrainer's avatar
Thomas Thrainer committed
599
	src/Ganeti/Query/Cluster.hs \
Iustin Pop's avatar
Iustin Pop committed
600
	src/Ganeti/Query/Common.hs \
601
	src/Ganeti/Query/Export.hs \
Iustin Pop's avatar
Iustin Pop committed
602 603 604 605
	src/Ganeti/Query/Filter.hs \
	src/Ganeti/Query/Group.hs \
	src/Ganeti/Query/Job.hs \
	src/Ganeti/Query/Language.hs \
606
	src/Ganeti/Query/Network.hs \
Iustin Pop's avatar
Iustin Pop committed
607 608 609 610 611 612 613
	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 \
614 615 616 617
	src/Ganeti/Storage/Diskstats/Parser.hs \
	src/Ganeti/Storage/Diskstats/Types.hs \
	src/Ganeti/Storage/Drbd/Parser.hs \
	src/Ganeti/Storage/Drbd/Types.hs \
Michele Tartara's avatar
Michele Tartara committed
618 619
	src/Ganeti/Storage/Lvm/LVParser.hs \
	src/Ganeti/Storage/Lvm/Types.hs \
620
	src/Ganeti/Storage/Utils.hs \
Iustin Pop's avatar
Iustin Pop committed
621 622 623
	src/Ganeti/THH.hs \
	src/Ganeti/Types.hs \
	src/Ganeti/Utils.hs
624 625

HS_TEST_SRCS = \
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643
	test/hs/Test/Ganeti/Attoparsec.hs \
	test/hs/Test/Ganeti/BasicTypes.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 \
644
	test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs \
645 646 647 648 649 650 651 652 653
	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 \
654
	test/hs/Test/Ganeti/Query/Network.hs \
655 656
	test/hs/Test/Ganeti/Query/Query.hs \
	test/hs/Test/Ganeti/Rpc.hs \
657
	test/hs/Test/Ganeti/Runtime.hs \
658
	test/hs/Test/Ganeti/Ssconf.hs \
659 660 661
	test/hs/Test/Ganeti/Storage/Diskstats/Parser.hs \
	test/hs/Test/Ganeti/Storage/Drbd/Parser.hs \
	test/hs/Test/Ganeti/Storage/Drbd/Types.hs \
662 663 664 665 666 667
	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
668

669
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
670

671
HS_BUILT_SRCS = \
672
	test/hs/Test/Ganeti/TestImports.hs \
Iustin Pop's avatar
Iustin Pop committed
673
	src/Ganeti/Constants.hs \
674
	src/Ganeti/Curl/Internal.hs \
Iustin Pop's avatar
Iustin Pop committed
675
	src/Ganeti/Version.hs
676 677 678
HS_BUILT_SRCS_IN = \
	$(patsubst %,%.in,$(filter-out src/Ganeti/Curl/Internal.hs,$(HS_BUILT_SRCS))) \
	src/Ganeti/Curl/Internal.hsc
679

680 681
HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)

682
$(RUN_IN_TEMPDIR): | stamp-directories
683

684 685 686 687
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
688 689 690 691 692
# 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
693 694
doc/html/index.html doc/man-html/index.html: $(docinput) doc/conf.py \
	configure.ac $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
695
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
696
	doc/css/style.css lib/rapi/connector.py lib/rapi/rlib2.py \
697
	| $(BUILT_PYTHON_SOURCES)
698 699
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
700 701 702 703 704 705
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
706 707 708 709 710 711
## 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.
712 713
	dir=$(dir $@) && \
	@mkdir_p@ $$dir && \
714 715
	PYTHONPATH=. ENABLE_MANPAGES=$(ENABLE_MANPAGES) COPY_DOC=1 \
	$(RUN_IN_TEMPDIR) autotools/sphinx-wrapper $(SPHINX) -q -W -b html \
716
	    -d . \
717 718
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
719
	    -D graphviz_dot="$(DOT)" \
720 721 722
	    -D enable_manpages="$(ENABLE_MANPAGES)" \
	    doc $(CURDIR)/$$dir && \
	rm -f $$dir/.buildinfo $$dir/objects.inv
723 724
	touch $@

725
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
726

727 728
doc/man-html: doc/man-html/index.html

729
doc/install-quick.rst: INSTALL
730
doc/news.rst: NEWS
731
doc/upgrade.rst: UPGRADE
732

733
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
734 735 736 737 738 739 740
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768
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

769 770 771 772
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	doc/html \
773
	$(BUILT_EXAMPLES) \
774
	doc/examples/bash_completion \
775
	doc/examples/bash_completion-debug \
776
	$(manhtml)
777

778 779 780 781
if MANPAGES_IN_DOC
noinst_DATA += doc/man-html
endif

782
gnt_scripts = \
783 784 785
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
786
	scripts/gnt-group \
787 788
	scripts/gnt-instance \
	scripts/gnt-job \
789
	scripts/gnt-network \
790
	scripts/gnt-node \
791 792
	scripts/gnt-os \
	scripts/gnt-storage
793

794
PYTHON_BOOTSTRAP_SBIN = \
795
	daemons/ganeti-masterd \