Makefile.am 64.3 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 24 25
# Enable colors in shelltest
SHELLTESTARGS = "-c"

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

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

63 64 65
# Delete output file if an error occurred while building it
.DELETE_ON_ERROR:

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

97 98 99
# Haskell directories without the roots (src, test/hs)
HS_DIRS_NOROOT = $(filter-out src,$(filter-out test/hs,$(HS_DIRS)))

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

142
ALL_APIDOC_HS_DIRS = \
143
	$(APIDOC_HS_DIR) \
144
	$(patsubst %,$(APIDOC_HS_DIR)/%,$(call strip_hsroot,$(HS_DIRS_NOROOT)))
145 146 147 148 149

BUILDTIME_DIR_AUTOCREATE = \
	scripts \
	$(APIDOC_DIR) \
	$(ALL_APIDOC_HS_DIRS) \
Iustin Pop's avatar
Iustin Pop committed
150
	$(APIDOC_PY_DIR) \
151 152
	$(COVERAGE_DIR) \
	$(COVERAGE_HS_DIR) \
Iustin Pop's avatar
Iustin Pop committed
153
	$(COVERAGE_PY_DIR) \
154
	.hpc
155 156 157

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
158 159
	doc/html \
	doc/man-html
160 161 162 163

DIRCHECK_EXCLUDE = \
	$(BUILDTIME_DIRS) \
	ganeti-[0-9]*.[0-9]*.[0-9]* \
Iustin Pop's avatar
Iustin Pop committed
164
	doc/html/_* \
165
	doc/man-html/_* \
Iustin Pop's avatar
Iustin Pop committed
166
	autom4te.cache
167

168 169 170 171 172 173 174 175
# 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
176
MAINTAINERCLEANFILES = \
177
	$(maninput) \
178
	doc/install-quick.rst \
179
	doc/news.rst \
180
	doc/upgrade.rst \
181
	vcs-version
Iustin Pop's avatar
Iustin Pop committed
182

183
maintainer-clean-local:
184
	rm -rf $(BUILDTIME_DIRS)
185

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

Iustin Pop's avatar
Iustin Pop committed
223
GENERATED_FILES = \
Iustin Pop's avatar
Iustin Pop committed
224
	$(built_base_sources) \
225 226 227
	$(BUILT_PYTHON_SOURCES) \
	$(PYTHON_BOOTSTRAP)

228
HS_GENERATED_FILES =
229
if WANT_HTOOLS
230
HS_GENERATED_FILES += $(HS_PROGS)
231
if ENABLE_CONFD
Thomas Thrainer's avatar
Thomas Thrainer committed
232
HS_GENERATED_FILES += src/hconfd src/ganeti-confd src/hluxid src/ganeti-luxid
233
endif
234 235 236 237

if ENABLE_MOND
HS_GENERATED_FILES += src/ganeti-mond
endif
238 239
endif

240
built_base_sources = \
241 242
	stamp-directories \
	stamp-srclinks
243

244
built_python_base_sources = \
245
	lib/_autoconf.py \
246 247 248 249
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
250
	lib/_generated_rpc.py
251

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

256 257 258 259 260
# 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
261
	doc/examples/ganeti.logrotate \
262
	doc/examples/ganeti-master-role.ocf \
263
	doc/examples/ganeti-node-role.ocf \
264 265 266
	doc/examples/gnt-config-backup \
	doc/examples/hooks/ipsec

267 268 269
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

270
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
271
	lib/build/__init__.py \
Iustin Pop's avatar
Iustin Pop committed
272 273
	lib/build/shell_example_lexer.py \
	lib/build/sphinx_ext.py
274

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

312
client_PYTHON = \
313
	lib/client/__init__.py \
314
	lib/client/gnt_backup.py \
315
	lib/client/gnt_cluster.py \
316
	lib/client/gnt_debug.py \
317
	lib/client/gnt_group.py \
318
	lib/client/gnt_instance.py \
319
	lib/client/gnt_job.py \
320
	lib/client/gnt_node.py \
321
	lib/client/gnt_network.py \
322 323
	lib/client/gnt_os.py \
	lib/client/gnt_storage.py
324

325
cmdlib_PYTHON = \
326
	lib/cmdlib/__init__.py \
327
	lib/cmdlib/backup.py \
328
	lib/cmdlib/base.py \
329
	lib/cmdlib/cluster.py \
330
	lib/cmdlib/common.py \
331
	lib/cmdlib/group.py \
332
	lib/cmdlib/instance.py \
333
	lib/cmdlib/instance_migration.py \
334
	lib/cmdlib/instance_operation.py \
335
	lib/cmdlib/instance_query.py \
336
	lib/cmdlib/instance_storage.py \
337
	lib/cmdlib/instance_utils.py \
338 339 340
	lib/cmdlib/misc.py \
	lib/cmdlib/network.py \
	lib/cmdlib/node.py \
341
	lib/cmdlib/operating_system.py \
342
	lib/cmdlib/query.py \
343
	lib/cmdlib/tags.py \
344
	lib/cmdlib/test.py
345

346 347 348
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
349
	lib/hypervisor/hv_chroot.py \
350
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
351
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
352
	lib/hypervisor/hv_lxc.py \
353 354
	lib/hypervisor/hv_xen.py

355 356 357 358
storage_PYTHON = \
	lib/storage/__init__.py \
	lib/storage/bdev.py \
	lib/storage/base.py \
359
	lib/storage/container.py \
360 361
	lib/storage/drbd.py \
	lib/storage/drbd_info.py \
362 363
	lib/storage/drbd_cmdgen.py \
	lib/storage/filestorage.py
364

365 366
rapi_PYTHON = \
	lib/rapi/__init__.py \
367
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
368
	lib/rapi/client.py \
369
	lib/rapi/client_utils.py \
370
	lib/rapi/connector.py \
371 372
	lib/rapi/rlib2.py \
	lib/rapi/testutils.py
373

374
http_PYTHON = \
375
	lib/http/__init__.py \
376
	lib/http/auth.py \
377 378
	lib/http/client.py \
	lib/http/server.py
379

Guido Trotter's avatar
Guido Trotter committed
380
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
381
	lib/confd/__init__.py \
382
	lib/confd/client.py
383

Michael Hanselmann's avatar
Michael Hanselmann committed
384
masterd_PYTHON = \
385
	lib/masterd/__init__.py \
René Nussbaumer's avatar
René Nussbaumer committed
386
	lib/masterd/iallocator.py \
387
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
388

389 390 391
impexpd_PYTHON = \
	lib/impexpd/__init__.py

392
watcher_PYTHON = \
393
	lib/watcher/__init__.py \
394 395
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
396

397
server_PYTHON = \
398
	lib/server/__init__.py \
399
	lib/server/masterd.py \
400 401
	lib/server/noded.py \
	lib/server/rapi.py
402

403 404
pytools_PYTHON = \
	lib/tools/__init__.py \
405
	lib/tools/burnin.py \
406
	lib/tools/ensure_dirs.py \
Michael Hanselmann's avatar
Michael Hanselmann committed
407
	lib/tools/node_cleanup.py \
408
	lib/tools/node_daemon_setup.py \
409
	lib/tools/prepare_node_join.py
410

411
utils_PYTHON = \
412
	lib/utils/__init__.py \
413
	lib/utils/algo.py \
414
	lib/utils/filelock.py \
415
	lib/utils/hash.py \
416
	lib/utils/io.py \
417
	lib/utils/log.py \
418
	lib/utils/lvm.py \
419
	lib/utils/mlock.py \
420
	lib/utils/nodesetup.py \
421
	lib/utils/process.py \
422
	lib/utils/retry.py \
Helga Velroyen's avatar
Helga Velroyen committed
423
	lib/utils/storage.py \
424
	lib/utils/text.py \
425 426
	lib/utils/wrapper.py \
	lib/utils/x509.py
427

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

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

498 499 500 501
# Haskell programs to be installed in $PREFIX/bin
HS_BIN_PROGS=src/htools

# Haskell programs to be installed in the MYEXECLIB dir
502
if ENABLE_MOND
503
HS_MYEXECLIB_PROGS=src/mon-collector
504 505 506
else
HS_MYEXECLIB_PROGS=
endif
507

508
# Haskell programs to be compiled by "make really-all"
509
HS_COMPILE_PROGS= \
510
	src/ganeti-mond \
511
	src/hconfd \
Thomas Thrainer's avatar
Thomas Thrainer committed
512
	src/hluxid \
513 514 515 516 517
	src/rpc-test

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

518
HS_BIN_ROLES = harep hbal hscan hspace hinfo hcheck hroller
519
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
520

521 522
HS_ALL_PROGS = \
	$(HS_PROGS) \
523 524
	test/hs/hpc-htools \
	test/hs/hpc-mon-collector \
Iustin Pop's avatar
Iustin Pop committed
525
	test/hs/htest \
526
	$(HS_COMPILE_PROGS)
527

528
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
529
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
530

531
HFLAGS = \
Iustin Pop's avatar
Iustin Pop committed
532
	-O -Wall -Werror -isrc \
533 534 535 536
	-fwarn-monomorphism-restriction \
	-fwarn-tabs \
	$(GHC_BYVERSION_FLAGS)

537
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
538
HEXTRA =
Iustin Pop's avatar
Iustin Pop committed
539
# internal extra flags (used for test/hs/htest mainly)
540
HEXTRA_INT =
541
# exclude options for coverage reports
542
HPCEXCL = --exclude Main \
543
	--exclude Ganeti.Constants \
544
	--exclude Ganeti.HTools.QC \
Iustin Pop's avatar
Iustin Pop committed
545
	--exclude Ganeti.THH \
546
	--exclude Ganeti.Version \
547
	--exclude Test.Ganeti.Attoparsec \
548
	--exclude Test.Ganeti.TestCommon \
549 550
	--exclude Test.Ganeti.TestHTools \
	--exclude Test.Ganeti.TestHelper \
551
	--exclude Test.Ganeti.TestImports \
Iustin Pop's avatar
Iustin Pop committed
552
	$(patsubst src.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
553

554
HS_LIB_SRCS = \
Iustin Pop's avatar
Iustin Pop committed
555 556 557 558
	src/Ganeti/BasicTypes.hs \
	src/Ganeti/Common.hs \
	src/Ganeti/Compat.hs \
	src/Ganeti/Confd/Client.hs \
559
	src/Ganeti/Confd/ClientFunctions.hs \
Iustin Pop's avatar
Iustin Pop committed
560 561 562 563
	src/Ganeti/Confd/Server.hs \
	src/Ganeti/Confd/Types.hs \
	src/Ganeti/Confd/Utils.hs \
	src/Ganeti/Config.hs \
564
	src/Ganeti/ConfigReader.hs \
565
	src/Ganeti/Curl/Multi.hs \
Iustin Pop's avatar
Iustin Pop committed
566 567
	src/Ganeti/Daemon.hs \
	src/Ganeti/DataCollectors/CLI.hs \
Michele Tartara's avatar
Michele Tartara committed
568
	src/Ganeti/DataCollectors/Diskstats.hs \
Iustin Pop's avatar
Iustin Pop committed
569
	src/Ganeti/DataCollectors/Drbd.hs \
570 571
	src/Ganeti/DataCollectors/InstStatus.hs \
	src/Ganeti/DataCollectors/InstStatusTypes.hs \
Michele Tartara's avatar
Michele Tartara committed
572
	src/Ganeti/DataCollectors/Lv.hs \
Iustin Pop's avatar
Iustin Pop committed
573
	src/Ganeti/DataCollectors/Program.hs \
574
	src/Ganeti/DataCollectors/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
575 576 577 578 579 580 581 582 583 584 585 586 587 588
	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 \
589
	src/Ganeti/HTools/Nic.hs \
Iustin Pop's avatar
Iustin Pop committed
590 591 592
	src/Ganeti/HTools/Node.hs \
	src/Ganeti/HTools/PeerMap.hs \
	src/Ganeti/HTools/Program/Hail.hs \
593
	src/Ganeti/HTools/Program/Harep.hs \
Iustin Pop's avatar
Iustin Pop committed
594 595 596 597 598 599
	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 \
600
	src/Ganeti/HTools/Program/Main.hs \
Iustin Pop's avatar
Iustin Pop committed
601
	src/Ganeti/HTools/Types.hs \
602
	src/Ganeti/Hypervisor/Xen.hs \
603 604
	src/Ganeti/Hypervisor/Xen/XmParser.hs \
	src/Ganeti/Hypervisor/Xen/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
605 606 607 608 609 610
	src/Ganeti/Hash.hs \
	src/Ganeti/JQueue.hs \
	src/Ganeti/JSON.hs \
	src/Ganeti/Jobs.hs \
	src/Ganeti/Logging.hs \
	src/Ganeti/Luxi.hs \
611
	src/Ganeti/Monitoring/Server.hs \
Iustin Pop's avatar
Iustin Pop committed
612 613 614 615 616
	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
617
	src/Ganeti/Query/Cluster.hs \
Iustin Pop's avatar
Iustin Pop committed
618
	src/Ganeti/Query/Common.hs \
619
	src/Ganeti/Query/Export.hs \
Iustin Pop's avatar
Iustin Pop committed
620 621 622 623
	src/Ganeti/Query/Filter.hs \
	src/Ganeti/Query/Group.hs \
	src/Ganeti/Query/Job.hs \
	src/Ganeti/Query/Language.hs \
624
	src/Ganeti/Query/Network.hs \
Iustin Pop's avatar
Iustin Pop committed
625 626 627 628 629 630 631
	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 \
632 633 634 635
	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
636 637
	src/Ganeti/Storage/Lvm/LVParser.hs \
	src/Ganeti/Storage/Lvm/Types.hs \
638
	src/Ganeti/Storage/Utils.hs \
Iustin Pop's avatar
Iustin Pop committed
639 640 641
	src/Ganeti/THH.hs \
	src/Ganeti/Types.hs \
	src/Ganeti/Utils.hs
642 643

HS_TEST_SRCS = \
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661
	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 \
662
	test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs \
663 664 665 666 667 668 669 670 671
	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 \
672
	test/hs/Test/Ganeti/Query/Network.hs \
673 674
	test/hs/Test/Ganeti/Query/Query.hs \
	test/hs/Test/Ganeti/Rpc.hs \
675
	test/hs/Test/Ganeti/Runtime.hs \
676
	test/hs/Test/Ganeti/Ssconf.hs \
677 678 679
	test/hs/Test/Ganeti/Storage/Diskstats/Parser.hs \
	test/hs/Test/Ganeti/Storage/Drbd/Parser.hs \
	test/hs/Test/Ganeti/Storage/Drbd/Types.hs \
Michele Tartara's avatar
Michele Tartara committed
680
	test/hs/Test/Ganeti/Storage/Lvm/LVParser.hs \
681 682 683 684 685 686
	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
687

688
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
689

690
HS_BUILT_SRCS = \
691
	test/hs/Test/Ganeti/TestImports.hs \
Iustin Pop's avatar
Iustin Pop committed
692
	src/Ganeti/Constants.hs \
693
	src/Ganeti/Curl/Internal.hs \
Iustin Pop's avatar
Iustin Pop committed
694
	src/Ganeti/Version.hs
695 696 697
HS_BUILT_SRCS_IN = \
	$(patsubst %,%.in,$(filter-out src/Ganeti/Curl/Internal.hs,$(HS_BUILT_SRCS))) \
	src/Ganeti/Curl/Internal.hsc
698

699 700
HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)

701
$(RUN_IN_TEMPDIR): | stamp-directories
702

703 704 705 706
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
707 708 709 710 711
# 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
712 713
doc/html/index.html doc/man-html/index.html: $(docinput) doc/conf.py \
	configure.ac $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
714
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
715
	doc/css/style.css lib/rapi/connector.py lib/rapi/rlib2.py \
716
	| $(BUILT_PYTHON_SOURCES)
717 718
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
719 720 721 722 723 724
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
725 726 727 728 729 730
## 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.
731 732
	dir=$(dir $@) && \
	@mkdir_p@ $$dir && \
733 734
	PYTHONPATH=. ENABLE_MANPAGES=$(ENABLE_MANPAGES) COPY_DOC=1 \
	$(RUN_IN_TEMPDIR) autotools/sphinx-wrapper $(SPHINX) -q -W -b html \
735
	    -d . \
736 737
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
738
	    -D graphviz_dot="$(DOT)" \
739 740 741
	    -D enable_manpages="$(ENABLE_MANPAGES)" \
	    doc $(CURDIR)/$$dir && \
	rm -f $$dir/.buildinfo $$dir/objects.inv
742 743
	touch $@

744
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
745

746 747
doc/man-html: doc/man-html/index.html

748
doc/install-quick.rst: INSTALL
749
doc/news.rst: NEWS
750
doc/upgrade.rst: UPGRADE
751

752
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
753 754 755 756 757 758 759
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787
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)