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
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
	doc/users \
104 105 106
	test/data/htools \
	test/data/htools/rapi \
	test/hs/shelltests \
Michele Tartara's avatar
Michele Tartara committed
107
	test/autotools \
108
	lib \
109
	lib/build \
Iustin Pop's avatar
Iustin Pop committed
110
	lib/client \
111
	lib/cmdlib \
112
	lib/confd \
113
	lib/http \
114
	lib/hypervisor \
115
	lib/impexpd \
Michael Hanselmann's avatar
Michael Hanselmann committed
116
	lib/masterd \
117
	lib/rapi \
118
	lib/server \
119
	lib/tools \
120
	lib/utils \
121
	lib/watcher \
122 123 124 125
	man \
	qa \
	test \
	test/data \
126
	test/data/bdev-rbd \
Agata Murawska's avatar
Agata Murawska committed
127
	test/data/ovfdata \
Agata Murawska's avatar
Agata Murawska committed
128
	test/data/ovfdata/other \
Iustin Pop's avatar
Iustin Pop committed
129
	test/py \
130 131
	tools

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

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

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

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

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

173
maintainer-clean-local:
174
	rm -rf $(BUILDTIME_DIRS)
175

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

Iustin Pop's avatar
Iustin Pop committed
211
GENERATED_FILES = \
Iustin Pop's avatar
Iustin Pop committed
212
	$(built_base_sources) \
213 214 215
	$(BUILT_PYTHON_SOURCES) \
	$(PYTHON_BOOTSTRAP)

216
HS_GENERATED_FILES =
217
if WANT_HTOOLS
218
HS_GENERATED_FILES += $(HS_PROGS)
219
if ENABLE_CONFD
Thomas Thrainer's avatar
Thomas Thrainer committed
220
HS_GENERATED_FILES += src/hconfd src/ganeti-confd src/hluxid src/ganeti-luxid
221
endif
222 223 224 225

if ENABLE_MOND
HS_GENERATED_FILES += src/ganeti-mond
endif
226 227
endif

228
built_base_sources = \
229 230
	stamp-directories \
	stamp-srclinks
231

232
built_python_base_sources = \
233
	lib/_autoconf.py \
234 235 236 237
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
238
	lib/_generated_rpc.py
239

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

244 245 246 247 248
# 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 \
Apollon Oikonomopoulos's avatar
Apollon Oikonomopoulos committed
249
	doc/examples/ganeti.logrotate \
250
	doc/examples/ganeti-master-role.ocf \
251
	doc/examples/ganeti-node-role.ocf \
252 253 254
	doc/examples/gnt-config-backup \
	doc/examples/hooks/ipsec

255 256 257
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

258
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
259
	lib/build/__init__.py \
Iustin Pop's avatar
Iustin Pop committed
260 261
	lib/build/shell_example_lexer.py \
	lib/build/sphinx_ext.py
262

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

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

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

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

345 346
rapi_PYTHON = \
	lib/rapi/__init__.py \
347
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
348
	lib/rapi/client.py \
349
	lib/rapi/client_utils.py \
350
	lib/rapi/connector.py \
351 352
	lib/rapi/rlib2.py \
	lib/rapi/testutils.py
353

354
http_PYTHON = \
355
	lib/http/__init__.py \
356
	lib/http/auth.py \
357 358
	lib/http/client.py \
	lib/http/server.py
359

Guido Trotter's avatar
Guido Trotter committed
360
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
361
	lib/confd/__init__.py \
362
	lib/confd/client.py
363

Michael Hanselmann's avatar
Michael Hanselmann committed
364
masterd_PYTHON = \
365
	lib/masterd/__init__.py \
René Nussbaumer's avatar
René Nussbaumer committed
366
	lib/masterd/iallocator.py \
367
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
368

369 370 371
impexpd_PYTHON = \
	lib/impexpd/__init__.py

372
watcher_PYTHON = \
373
	lib/watcher/__init__.py \
374 375
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
376

377
server_PYTHON = \
378
	lib/server/__init__.py \
379
	lib/server/masterd.py \
380 381
	lib/server/noded.py \
	lib/server/rapi.py
382

383 384
pytools_PYTHON = \
	lib/tools/__init__.py \
385
	lib/tools/burnin.py \
386
	lib/tools/ensure_dirs.py \
Michael Hanselmann's avatar
Michael Hanselmann committed
387
	lib/tools/node_cleanup.py \
388
	lib/tools/node_daemon_setup.py \
389
	lib/tools/prepare_node_join.py
390

391
utils_PYTHON = \
392
	lib/utils/__init__.py \
393
	lib/utils/algo.py \
394
	lib/utils/filelock.py \
395
	lib/utils/hash.py \
396
	lib/utils/io.py \
397
	lib/utils/log.py \
398
	lib/utils/lvm.py \
399
	lib/utils/mlock.py \
400
	lib/utils/nodesetup.py \
401
	lib/utils/process.py \
402
	lib/utils/retry.py \
403
	lib/utils/text.py \
404 405
	lib/utils/wrapper.py \
	lib/utils/x509.py
406

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

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

473 474 475 476
# Haskell programs to be installed in $PREFIX/bin
HS_BIN_PROGS=src/htools

# Haskell programs to be installed in the MYEXECLIB dir
477
if ENABLE_MOND
478
HS_MYEXECLIB_PROGS=src/mon-collector
479 480 481
else
HS_MYEXECLIB_PROGS=
endif
482

483
# Haskell programs to be compiled by "make really-all"
484
HS_COMPILE_PROGS= \
485
	src/ganeti-mond \
486
	src/hconfd \
Thomas Thrainer's avatar
Thomas Thrainer committed
487
	src/hluxid \
488 489 490 491 492
	src/rpc-test

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

493
HS_BIN_ROLES = harep hbal hscan hspace hinfo hcheck hroller
494
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
495

496 497
HS_ALL_PROGS = \
	$(HS_PROGS) \
498 499
	test/hs/hpc-htools \
	test/hs/hpc-mon-collector \
Iustin Pop's avatar
Iustin Pop committed
500
	test/hs/htest \
501
	$(HS_COMPILE_PROGS)
502

503
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
504
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
505

506
HFLAGS = \
Iustin Pop's avatar
Iustin Pop committed
507
	-O -Wall -Werror -isrc \
508 509 510 511
	-fwarn-monomorphism-restriction \
	-fwarn-tabs \
	$(GHC_BYVERSION_FLAGS)

512
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
513
HEXTRA =
Iustin Pop's avatar
Iustin Pop committed
514
# internal extra flags (used for test/hs/htest mainly)
515
HEXTRA_INT =
516
# exclude options for coverage reports
517
HPCEXCL = --exclude Main \
518
	--exclude Ganeti.Constants \
519
	--exclude Ganeti.HTools.QC \
Iustin Pop's avatar
Iustin Pop committed
520
	--exclude Ganeti.THH \
521
	--exclude Ganeti.Version \
522
	--exclude Test.Ganeti.Attoparsec \
523
	--exclude Test.Ganeti.TestCommon \
524 525
	--exclude Test.Ganeti.TestHTools \
	--exclude Test.Ganeti.TestHelper \
526
	--exclude Test.Ganeti.TestImports \
Iustin Pop's avatar
Iustin Pop committed
527
	$(patsubst src.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
528

529
HS_LIB_SRCS = \
Iustin Pop's avatar
Iustin Pop committed
530 531 532 533 534 535 536 537 538 539
	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 \
540
	src/Ganeti/ConfigReader.hs \
541
	src/Ganeti/Curl/Multi.hs \
Iustin Pop's avatar
Iustin Pop committed
542 543 544 545
	src/Ganeti/Daemon.hs \
	src/Ganeti/DataCollectors/CLI.hs \
	src/Ganeti/DataCollectors/Drbd.hs \
	src/Ganeti/DataCollectors/Program.hs \
546
	src/Ganeti/DataCollectors/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
547 548 549 550 551 552 553 554 555 556 557 558 559 560
	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 \
561
	src/Ganeti/HTools/Nic.hs \
Iustin Pop's avatar
Iustin Pop committed
562 563 564
	src/Ganeti/HTools/Node.hs \
	src/Ganeti/HTools/PeerMap.hs \
	src/Ganeti/HTools/Program/Hail.hs \
565
	src/Ganeti/HTools/Program/Harep.hs \
Iustin Pop's avatar
Iustin Pop committed
566 567 568 569 570 571
	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 \
572
	src/Ganeti/HTools/Program/Main.hs \
Iustin Pop's avatar
Iustin Pop committed
573
	src/Ganeti/HTools/Types.hs \
574 575
	src/Ganeti/Hypervisor/Xen/XmParser.hs \
	src/Ganeti/Hypervisor/Xen/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
576 577 578 579 580 581
	src/Ganeti/Hash.hs \
	src/Ganeti/JQueue.hs \
	src/Ganeti/JSON.hs \
	src/Ganeti/Jobs.hs \
	src/Ganeti/Logging.hs \
	src/Ganeti/Luxi.hs \
582
	src/Ganeti/Monitoring/Server.hs \
Iustin Pop's avatar
Iustin Pop committed
583 584 585 586 587 588
	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 \
589
	src/Ganeti/Query/Export.hs \
Iustin Pop's avatar
Iustin Pop committed
590 591 592 593
	src/Ganeti/Query/Filter.hs \
	src/Ganeti/Query/Group.hs \
	src/Ganeti/Query/Job.hs \
	src/Ganeti/Query/Language.hs \
594
	src/Ganeti/Query/Network.hs \
Iustin Pop's avatar
Iustin Pop committed
595 596 597 598 599 600 601 602 603 604
	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
605 606

HS_TEST_SRCS = \
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626
	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 \
627
	test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs \
628 629 630 631 632 633 634 635 636
	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 \
637
	test/hs/Test/Ganeti/Query/Network.hs \
638 639
	test/hs/Test/Ganeti/Query/Query.hs \
	test/hs/Test/Ganeti/Rpc.hs \
640
	test/hs/Test/Ganeti/Runtime.hs \
641 642 643 644 645 646 647
	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
648

649
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
650

651
HS_BUILT_SRCS = \
652
	test/hs/Test/Ganeti/TestImports.hs \
Iustin Pop's avatar
Iustin Pop committed
653
	src/Ganeti/Constants.hs \
654
	src/Ganeti/Curl/Internal.hs \
Iustin Pop's avatar
Iustin Pop committed
655
	src/Ganeti/Version.hs
656 657 658
HS_BUILT_SRCS_IN = \
	$(patsubst %,%.in,$(filter-out src/Ganeti/Curl/Internal.hs,$(HS_BUILT_SRCS))) \
	src/Ganeti/Curl/Internal.hsc
659

660 661
HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)

662
$(RUN_IN_TEMPDIR): | stamp-directories
663

664 665 666 667
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
668 669 670 671 672
# 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
673 674
doc/html/index.html doc/man-html/index.html: $(docinput) doc/conf.py \
	configure.ac $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
675
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
676
	doc/css/style.css lib/rapi/connector.py lib/rapi/rlib2.py \
677
	| $(BUILT_PYTHON_SOURCES)
678 679
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
680 681 682 683 684 685
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
686 687 688 689 690 691
## 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.
692 693
	dir=$(dir $@) && \
	@mkdir_p@ $$dir && \
694 695
	PYTHONPATH=. ENABLE_MANPAGES=$(ENABLE_MANPAGES) COPY_DOC=1 \
	$(RUN_IN_TEMPDIR) autotools/sphinx-wrapper $(SPHINX) -q -W -b html \
696
	    -d . \
697 698
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
699
	    -D graphviz_dot="$(DOT)" \
700 701 702
	    -D enable_manpages="$(ENABLE_MANPAGES)" \
	    doc $(CURDIR)/$$dir && \
	rm -f $$dir/.buildinfo $$dir/objects.inv
703 704
	touch $@

705
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
706

707 708
doc/man-html: doc/man-html/index.html

709
doc/install-quick.rst: INSTALL
710
doc/news.rst: NEWS
711
doc/upgrade.rst: UPGRADE
712

713
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
714 715 716 717 718 719 720
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748
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

749 750 751 752 753 754 755 756
doc/users/%: doc/users/%.in Makefile $(REPLACE_VARS_SED)
	cat $< | sed -f $(REPLACE_VARS_SED) | LC_ALL=C sort | uniq | (grep -v '^root' || true) > $@

userspecs = \
	doc/users/users \
	doc/users/groups \
	doc/users/groupmemberships

757 758 759
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
760
	$(BUILT_EXAMPLES) \
761
	doc/examples/bash_completion \
762
	doc/examples/bash_completion-debug \
763
	$(userspecs) \
764
	$(manhtml)
765

766
if HAS_SPHINX
767 768
if MANPAGES_IN_DOC
noinst_DATA += doc/man-html
769 770 771
else
noinst_DATA += doc/html
endif
772 773
endif

774
gnt_scripts = \
775 776 777
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
778
	scripts/gnt-group \
779 780
	scripts/gnt-instance \
	scripts/gnt-job \
781
	scripts/gnt-network \
782
	scripts/gnt-node \
783 784
	scripts/gnt-os \
	scripts/gnt-storage
785

786
PYTHON_BOOTSTRAP_SBIN = \
787
	daemons/ganeti-masterd \
788
	daemons/ganeti-noded \
789
	daemons/ganeti-rapi \
Iustin Pop's avatar
Iustin Pop committed
790
	daemons/ganeti-watcher \
791
	$(gnt_scripts)
792

793 794
PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
795
	tools/burnin \
796
	tools/ensure-dirs \
Michael Hanselmann's avatar
Michael Hanselmann committed
797
	tools/node-cleanup \
798
	tools/node-daemon-setup \