Makefile.am 50.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
# Use bash in order to be able to use pipefail
SHELL=/bin/bash

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

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

54 55 56
# Delete output file if an error occurred while building it
.DELETE_ON_ERROR:

57 58 59
HTOOLS_DIRS = \
	htools \
	htools/Ganeti \
60 61
	htools/Ganeti/Block \
	htools/Ganeti/Block/Drbd \
Iustin Pop's avatar
Iustin Pop committed
62
	htools/Ganeti/Confd \
63
	htools/Ganeti/HTools \
64
	htools/Ganeti/HTools/Backend \
65
	htools/Ganeti/HTools/Program \
Iustin Pop's avatar
Iustin Pop committed
66
	htools/Ganeti/Query \
Iustin Pop's avatar
Iustin Pop committed
67 68
	htest \
	htest/Test \
69
	htest/Test/Ganeti \
Michele Tartara's avatar
Michele Tartara committed
70 71
	htest/Test/Ganeti/Block \
	htest/Test/Ganeti/Block/Drbd \
72
	htest/Test/Ganeti/Confd \
73
	htest/Test/Ganeti/HTools \
74
	htest/Test/Ganeti/HTools/Backend \
75
	htest/Test/Ganeti/Query
76

77
DIRS = \
Iustin Pop's avatar
Iustin Pop committed
78
	$(HTOOLS_DIRS) \
79 80 81 82 83
	autotools \
	daemons \
	devel \
	doc \
	doc/examples \
84
	doc/examples/gnt-debug \
Iustin Pop's avatar
Iustin Pop committed
85 86 87 88
	doc/examples/hooks \
	htest/data \
	htest/data/rapi \
	htest/shelltests \
89
	lib \
90
	lib/build \
Iustin Pop's avatar
Iustin Pop committed
91
	lib/client \
92
	lib/confd \
93
	lib/http \
94
	lib/hypervisor \
95
	lib/impexpd \
Michael Hanselmann's avatar
Michael Hanselmann committed
96
	lib/masterd \
97
	lib/rapi \
98
	lib/server \
99
	lib/tools \
100
	lib/utils \
101
	lib/watcher \
102 103 104 105
	man \
	qa \
	test \
	test/data \
Agata Murawska's avatar
Agata Murawska committed
106
	test/data/ovfdata \
Agata Murawska's avatar
Agata Murawska committed
107
	test/data/ovfdata/other \
108 109
	tools

110
ALL_APIDOC_HS_DIRS = \
111
	$(APIDOC_HS_DIR) \
Iustin Pop's avatar
Iustin Pop committed
112
	$(APIDOC_HS_DIR)/Ganeti \
113 114
	$(APIDOC_HS_DIR)/Ganeti/Block \
	$(APIDOC_HS_DIR)/Ganeti/Block/Drbd \
Iustin Pop's avatar
Iustin Pop committed
115 116
	$(APIDOC_HS_DIR)/Ganeti/Confd \
	$(APIDOC_HS_DIR)/Ganeti/HTools \
117
	$(APIDOC_HS_DIR)/Ganeti/HTools/Backend \
118
	$(APIDOC_HS_DIR)/Ganeti/HTools/Program \
Iustin Pop's avatar
Iustin Pop committed
119
	$(APIDOC_HS_DIR)/Ganeti/Query
120 121 122 123 124

BUILDTIME_DIR_AUTOCREATE = \
	scripts \
	$(APIDOC_DIR) \
	$(ALL_APIDOC_HS_DIRS) \
Iustin Pop's avatar
Iustin Pop committed
125
	$(APIDOC_PY_DIR) \
126 127
	$(COVERAGE_DIR) \
	$(COVERAGE_HS_DIR) \
Iustin Pop's avatar
Iustin Pop committed
128
	$(COVERAGE_PY_DIR) \
129
	.hpc
130 131 132

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
133 134 135 136 137
	doc/html

DIRCHECK_EXCLUDE = \
	$(BUILDTIME_DIRS) \
	ganeti-[0-9]*.[0-9]*.[0-9]* \
Iustin Pop's avatar
Iustin Pop committed
138 139
	doc/html/_* \
	autom4te.cache
140

141 142 143 144 145 146 147 148
# 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
149
MAINTAINERCLEANFILES = \
150
	$(docpng) \
151
	$(maninput) \
152
	doc/install-quick.rst \
153
	doc/news.rst \
154
	doc/upgrade.rst \
155
	vcs-version
Iustin Pop's avatar
Iustin Pop committed
156

157
maintainer-clean-local:
158
	rm -rf $(BUILDTIME_DIRS)
159

160
CLEANFILES = \
161
	$(addsuffix /*.py[co],$(DIRS)) \
162 163
	$(addsuffix /*.hi,$(HTOOLS_DIRS)) \
	$(addsuffix /*.o,$(HTOOLS_DIRS)) \
164
	$(PYTHON_BOOTSTRAP) \
165
	epydoc.conf \
Iustin Pop's avatar
Iustin Pop committed
166
	$(REPLACE_VARS_SED) \
167
	$(SHELL_ENV_INIT) \
168
	daemons/daemon-util \
169
	daemons/ganeti-cleaner \
170
	$(BUILT_EXAMPLES) \
171
	doc/examples/bash_completion \
172
	doc/examples/bash_completion-debug \
173
	lib/_generated_rpc.py \
Iustin Pop's avatar
Iustin Pop committed
174 175
	$(man_MANS) \
	$(manhtml) \
176
	tools/kvm-ifup \
177
	tools/vcluster-setup \
178
	stamp-directories \
179
	stamp-srclinks \
180
	$(nodist_pkgpython_PYTHON) \
181
	$(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
182
	$(HS_BUILT_TEST_HELPERS) \
183
	htools/ganeti-confd \
Iustin Pop's avatar
Iustin Pop committed
184
	.hpc/*.mix htools/*.tix htest/*.tix \
185
	doc/hs-lint.html
186

Iustin Pop's avatar
Iustin Pop committed
187
GENERATED_FILES = \
Iustin Pop's avatar
Iustin Pop committed
188
	$(built_base_sources) \
189 190 191
	$(BUILT_PYTHON_SOURCES) \
	$(PYTHON_BOOTSTRAP)

192 193 194
HTOOLS_GENERATED_FILES =
if WANT_HTOOLS
HTOOLS_GENERATED_FILES += $(HS_PROGS)
195
if ENABLE_CONFD
196
HTOOLS_GENERATED_FILES += htools/hconfd htools/ganeti-confd
197 198 199
endif
endif

200
built_base_sources = \
201 202
	stamp-directories \
	stamp-srclinks
203

204
built_python_base_sources = \
205
	lib/_autoconf.py \
206 207 208 209
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
210
	lib/_generated_rpc.py
211

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

216 217 218 219 220
# 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 \
221
	doc/examples/ganeti-master-role.ocf \
222
	doc/examples/ganeti-node-role.ocf \
223 224 225
	doc/examples/gnt-config-backup \
	doc/examples/hooks/ipsec

226 227 228
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

229
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
230
	lib/build/__init__.py \
Iustin Pop's avatar
Iustin Pop committed
231 232
	lib/build/shell_example_lexer.py \
	lib/build/sphinx_ext.py
233

234 235
pkgpython_PYTHON = \
	lib/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
236
	lib/asyncnotifier.py \
237 238 239 240 241
	lib/backend.py \
	lib/bdev.py \
	lib/bootstrap.py \
	lib/cli.py \
	lib/cmdlib.py \
242
	lib/compat.py \
243 244
	lib/config.py \
	lib/constants.py \
245
	lib/daemon.py \
246
	lib/errors.py \
247
	lib/ht.py \
248
	lib/jqueue.py \
249
	lib/jstore.py \
250 251 252
	lib/locking.py \
	lib/luxi.py \
	lib/mcpu.py \
253
	lib/netutils.py \
254
	lib/objects.py \
255
	lib/objectutils.py \
256
	lib/opcodes.py \
257
	lib/ovf.py \
258
	lib/pathutils.py \
259
	lib/qlang.py \
260
	lib/query.py \
261
	lib/rpc.py \
262
	lib/rpc_defs.py \
263
	lib/runtime.py \
264 265 266
	lib/serializer.py \
	lib/ssconf.py \
	lib/ssh.py \
267
	lib/storage.py \
268
	lib/uidpool.py \
269
	lib/vcluster.py \
270
	lib/network.py \
271
	lib/workerpool.py
272

273
client_PYTHON = \
274
	lib/client/__init__.py \
275
	lib/client/gnt_backup.py \
276
	lib/client/gnt_cluster.py \
277
	lib/client/gnt_debug.py \
278
	lib/client/gnt_group.py \
279
	lib/client/gnt_instance.py \
280
	lib/client/gnt_job.py \
281
	lib/client/gnt_node.py \
282
	lib/client/gnt_network.py \
283
	lib/client/gnt_os.py
284

285 286 287
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
288
	lib/hypervisor/hv_chroot.py \
289
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
290
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
291
	lib/hypervisor/hv_lxc.py \
292 293
	lib/hypervisor/hv_xen.py

294 295
rapi_PYTHON = \
	lib/rapi/__init__.py \
296
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
297
	lib/rapi/client.py \
298
	lib/rapi/client_utils.py \
299
	lib/rapi/connector.py \
300 301
	lib/rapi/rlib2.py \
	lib/rapi/testutils.py
302

303
http_PYTHON = \
304
	lib/http/__init__.py \
305
	lib/http/auth.py \
306 307
	lib/http/client.py \
	lib/http/server.py
308

Guido Trotter's avatar
Guido Trotter committed
309
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
310
	lib/confd/__init__.py \
311
	lib/confd/client.py
312

Michael Hanselmann's avatar
Michael Hanselmann committed
313
masterd_PYTHON = \
314
	lib/masterd/__init__.py \
René Nussbaumer's avatar
René Nussbaumer committed
315
	lib/masterd/iallocator.py \
316
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
317

318 319 320
impexpd_PYTHON = \
	lib/impexpd/__init__.py

321
watcher_PYTHON = \
322
	lib/watcher/__init__.py \
323 324
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
325

326
server_PYTHON = \
327
	lib/server/__init__.py \
328
	lib/server/masterd.py \
329 330
	lib/server/noded.py \
	lib/server/rapi.py
331

332 333
pytools_PYTHON = \
	lib/tools/__init__.py \
334 335
	lib/tools/ensure_dirs.py \
	lib/tools/prepare_node_join.py
336

337
utils_PYTHON = \
338
	lib/utils/__init__.py \
339
	lib/utils/algo.py \
340
	lib/utils/filelock.py \
341
	lib/utils/hash.py \
342
	lib/utils/io.py \
343
	lib/utils/log.py \
344
	lib/utils/mlock.py \
345
	lib/utils/nodesetup.py \
346
	lib/utils/process.py \
347
	lib/utils/retry.py \
348
	lib/utils/text.py \
349 350
	lib/utils/wrapper.py \
	lib/utils/x509.py
351

Michael Hanselmann's avatar
Michael Hanselmann committed
352
docrst = \
353
	doc/admin.rst \
Iustin Pop's avatar
Iustin Pop committed
354
	doc/cluster-merge.rst \
355
	doc/design-2.0.rst \
356
	doc/design-2.1.rst \
357
	doc/design-2.2.rst \
Guido Trotter's avatar
Guido Trotter committed
358
	doc/design-2.3.rst \
359
	doc/design-2.4.rst \
360
	doc/design-2.5.rst \
361
	doc/design-2.6.rst \
362
	doc/design-2.7.rst \
Iustin Pop's avatar
Iustin Pop committed
363 364 365
	doc/design-autorepair.rst \
	doc/design-bulk-create.rst \
	doc/design-chained-jobs.rst \
Tsachy Shacham's avatar
Tsachy Shacham committed
366
	doc/design-cpu-pinning.rst \
Iustin Pop's avatar
Iustin Pop committed
367 368
	doc/design-draft.rst \
	doc/design-htools-2.3.rst \
369
	doc/design-http-server.rst \
370
	doc/design-impexp2.rst \
371
	doc/design-lu-generated-jobs.rst \
372
	doc/design-linuxha.rst \
373
	doc/design-multi-reloc.rst \
374
	doc/design-network.rst \
375
	doc/design-node-add.rst \
Iustin Pop's avatar
Iustin Pop committed
376
	doc/design-oob.rst \
377
	doc/design-ovf-support.rst \
378
	doc/design-opportunistic-locking.rst \
Iustin Pop's avatar
Iustin Pop committed
379 380 381
	doc/design-partitioned.rst \
	doc/design-query-splitting.rst \
	doc/design-query2.rst \
382
	doc/design-remote-commands.rst \
383
	doc/design-resource-model.rst \
384
	doc/design-shared-storage.rst \
385
	doc/design-monitoring-agent.rst \
386
	doc/design-virtual-clusters.rst \
Iustin Pop's avatar
Iustin Pop committed
387
	doc/design-x509-ca.rst \
388
	doc/devnotes.rst \
389
	doc/glossary.rst \
390
	doc/hooks.rst \
391
	doc/iallocator.rst \
392
	doc/index.rst \
393
	doc/install-quick.rst \
394
	doc/install.rst \
395
	doc/locking.rst \
396
	doc/move-instance.rst \
Iustin Pop's avatar
Iustin Pop committed
397
	doc/news.rst \
398
	doc/ovfconverter.rst \
399
	doc/rapi.rst \
400
	doc/security.rst \
401
	doc/upgrade.rst \
402
	doc/virtual-cluster.rst \
Iustin Pop's avatar
Iustin Pop committed
403
	doc/walkthrough.rst
Michael Hanselmann's avatar
Michael Hanselmann committed
404

405
HS_PROGS = htools/htools
406
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck
407
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
408

409 410 411 412 413 414 415
HS_ALL_PROGS = \
	$(HS_PROGS) \
	htest/hpc-htools \
	htest/test \
	htools/hconfd \
	htools/rpc-test

416
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
417
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=htest/%) htest/hail
418

419 420 421 422 423 424
HFLAGS = \
	-O -Wall -Werror -ihtools \
	-fwarn-monomorphism-restriction \
	-fwarn-tabs \
	$(GHC_BYVERSION_FLAGS)

425
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
426
HEXTRA =
Iustin Pop's avatar
Iustin Pop committed
427
# internal extra flags (used for htest/test mainly)
428
HEXTRA_INT =
429
# exclude options for coverage reports
430
HPCEXCL = --exclude Main \
431
	--exclude Ganeti.Constants \
432
	--exclude Ganeti.HTools.QC \
Iustin Pop's avatar
Iustin Pop committed
433
	--exclude Ganeti.THH \
434
	--exclude Ganeti.Version \
435
	--exclude Test.Ganeti.Attoparsec \
436
	--exclude Test.Ganeti.TestCommon \
437 438
	--exclude Test.Ganeti.TestHTools \
	--exclude Test.Ganeti.TestHelper \
439
	--exclude Test.Ganeti.TestImports \
440
	$(patsubst htools.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
441

442
HS_LIB_SRCS = \
443 444
	htools/Ganeti/Block/Drbd/Types.hs \
	htools/Ganeti/Block/Drbd/Parser.hs \
Iustin Pop's avatar
Iustin Pop committed
445 446 447 448
	htools/Ganeti/BasicTypes.hs \
	htools/Ganeti/Common.hs \
	htools/Ganeti/Compat.hs \
	htools/Ganeti/Confd/Server.hs \
Iustin Pop's avatar
Iustin Pop committed
449
	htools/Ganeti/Confd/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
450 451 452
	htools/Ganeti/Confd/Utils.hs \
	htools/Ganeti/Config.hs \
	htools/Ganeti/Daemon.hs \
453
	htools/Ganeti/Errors.hs \
454 455 456 457 458
	htools/Ganeti/HTools/Backend/IAlloc.hs \
	htools/Ganeti/HTools/Backend/Luxi.hs \
	htools/Ganeti/HTools/Backend/Rapi.hs \
	htools/Ganeti/HTools/Backend/Simu.hs \
	htools/Ganeti/HTools/Backend/Text.hs \
459 460 461 462
	htools/Ganeti/HTools/CLI.hs \
	htools/Ganeti/HTools/Cluster.hs \
	htools/Ganeti/HTools/Container.hs \
	htools/Ganeti/HTools/ExtLoader.hs \
Guido Trotter's avatar
Guido Trotter committed
463
	htools/Ganeti/HTools/Graph.hs \
464 465 466 467 468
	htools/Ganeti/HTools/Group.hs \
	htools/Ganeti/HTools/Instance.hs \
	htools/Ganeti/HTools/Loader.hs \
	htools/Ganeti/HTools/Node.hs \
	htools/Ganeti/HTools/PeerMap.hs \
469
	htools/Ganeti/HTools/Program.hs \
470
	htools/Ganeti/HTools/Program/Hail.hs \
471
	htools/Ganeti/HTools/Program/Hbal.hs \
472
	htools/Ganeti/HTools/Program/Hcheck.hs \
473
	htools/Ganeti/HTools/Program/Hinfo.hs \
474
	htools/Ganeti/HTools/Program/Hscan.hs \
475
	htools/Ganeti/HTools/Program/Hspace.hs \
Iustin Pop's avatar
Iustin Pop committed
476
	htools/Ganeti/HTools/Types.hs \
477
	htools/Ganeti/Hash.hs \
478
	htools/Ganeti/JSON.hs \
Iustin Pop's avatar
Iustin Pop committed
479
	htools/Ganeti/Jobs.hs \
Iustin Pop's avatar
Iustin Pop committed
480
	htools/Ganeti/Logging.hs \
481
	htools/Ganeti/Luxi.hs \
482
	htools/Ganeti/Objects.hs \
483
	htools/Ganeti/OpCodes.hs \
484
	htools/Ganeti/OpParams.hs \
485
	htools/Ganeti/Path.hs \
486
	htools/Ganeti/Query/Common.hs \
Iustin Pop's avatar
Iustin Pop committed
487
	htools/Ganeti/Query/Filter.hs \
Agata Murawska's avatar
Agata Murawska committed
488
	htools/Ganeti/Query/Group.hs \
489
	htools/Ganeti/Query/Language.hs \
490
	htools/Ganeti/Query/Node.hs \
491
	htools/Ganeti/Query/Query.hs \
492
	htools/Ganeti/Query/Server.hs \
493
	htools/Ganeti/Query/Types.hs \
494
	htools/Ganeti/Rpc.hs \
Iustin Pop's avatar
Iustin Pop committed
495
	htools/Ganeti/Runtime.hs \
Iustin Pop's avatar
Iustin Pop committed
496
	htools/Ganeti/Ssconf.hs \
497
	htools/Ganeti/THH.hs \
498
	htools/Ganeti/Types.hs \
499
	htools/Ganeti/Utils.hs
500 501

HS_TEST_SRCS = \
502
	htest/Test/Ganeti/Attoparsec.hs \
503
	htest/Test/Ganeti/BasicTypes.hs \
Michele Tartara's avatar
Michele Tartara committed
504
	htest/Test/Ganeti/Block/Drbd/Parser.hs \
505
	htest/Test/Ganeti/Block/Drbd/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
506
	htest/Test/Ganeti/Common.hs \
Iustin Pop's avatar
Iustin Pop committed
507
	htest/Test/Ganeti/Confd/Utils.hs \
Iustin Pop's avatar
Iustin Pop committed
508
	htest/Test/Ganeti/Daemon.hs \
509
	htest/Test/Ganeti/Errors.hs \
510 511
	htest/Test/Ganeti/HTools/Backend/Simu.hs \
	htest/Test/Ganeti/HTools/Backend/Text.hs \
512 513 514
	htest/Test/Ganeti/HTools/CLI.hs \
	htest/Test/Ganeti/HTools/Cluster.hs \
	htest/Test/Ganeti/HTools/Container.hs \
Guido Trotter's avatar
Guido Trotter committed
515
	htest/Test/Ganeti/HTools/Graph.hs \
516 517 518 519 520
	htest/Test/Ganeti/HTools/Instance.hs \
	htest/Test/Ganeti/HTools/Loader.hs \
	htest/Test/Ganeti/HTools/Node.hs \
	htest/Test/Ganeti/HTools/PeerMap.hs \
	htest/Test/Ganeti/HTools/Types.hs \
521 522
	htest/Test/Ganeti/JSON.hs \
	htest/Test/Ganeti/Jobs.hs \
523
	htest/Test/Ganeti/Luxi.hs \
524
	htest/Test/Ganeti/Objects.hs \
525
	htest/Test/Ganeti/OpCodes.hs \
Iustin Pop's avatar
Iustin Pop committed
526
	htest/Test/Ganeti/Query/Filter.hs \
527
	htest/Test/Ganeti/Query/Language.hs \
528
	htest/Test/Ganeti/Query/Query.hs \
529
	htest/Test/Ganeti/Rpc.hs \
530
	htest/Test/Ganeti/Ssconf.hs \
531
	htest/Test/Ganeti/THH.hs \
532 533
	htest/Test/Ganeti/TestCommon.hs \
	htest/Test/Ganeti/TestHTools.hs \
534
	htest/Test/Ganeti/TestHelper.hs \
535
	htest/Test/Ganeti/Types.hs \
536
	htest/Test/Ganeti/Utils.hs
537

538
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
539

540 541 542
HS_BUILT_SRCS = \
	htest/Test/Ganeti/TestImports.hs \
	htools/Ganeti/Constants.hs \
543
	htools/Ganeti/Version.hs
544
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
545

546
$(RUN_IN_TEMPDIR): | stamp-directories
547

Iustin Pop's avatar
Iustin Pop committed
548 549 550 551 552
# 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
553
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
554 555
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
556
	| $(BUILT_PYTHON_SOURCES)
557 558
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
559
	@mkdir_p@ $(dir $@)
560
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
561
	    -d . \
562 563
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
564 565 566 567
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

568
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
569

570
doc/install-quick.rst: INSTALL
571
doc/news.rst: NEWS
572
doc/upgrade.rst: UPGRADE
573

574
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
575 576 577 578 579 580 581
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

582
docdot = \
583 584 585
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
586

587
docpng = $(patsubst %.dot,%.png,$(docdot))
588

589 590 591 592
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	doc/html \
593
	$(BUILT_EXAMPLES) \
594
	doc/examples/bash_completion \
595
	doc/examples/bash_completion-debug \
596
	$(manhtml)
597

598
gnt_scripts = \
599 600 601
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
602
	scripts/gnt-group \
603 604
	scripts/gnt-instance \
	scripts/gnt-job \
605
	scripts/gnt-network \
606 607 608
	scripts/gnt-node \
	scripts/gnt-os

609
PYTHON_BOOTSTRAP_SBIN = \
610
	daemons/ganeti-masterd \
611
	daemons/ganeti-noded \
612
	daemons/ganeti-rapi \
Iustin Pop's avatar
Iustin Pop committed
613
	daemons/ganeti-watcher \
614
	$(gnt_scripts)
615

616 617
PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
618 619
	tools/ensure-dirs \
	tools/prepare-node-join
620

621
qa_scripts = \
622
	qa/__init__.py \
623 624 625 626 627 628
	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
629
	qa/qa_group.py \
630
	qa/qa_instance.py \
631
	qa/qa_job.py \
632 633 634 635 636 637
	qa/qa_node.py \
	qa/qa_os.py \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

638 639
bin_SCRIPTS =
if WANT_HTOOLS
640
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
641 642
install-exec-hook:
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
643 644
# FIXME: this is a hardcoded logic, instead of auto-resolving
	$(LN_S) -f ../../../bin/htools \
Iustin Pop's avatar
Iustin Pop committed
645
	  $(DESTDIR)$(iallocatorsdir)/hail
646
	for role in $(HS_BIN_ROLES); do \
Iustin Pop's avatar
Iustin Pop committed
647
	  $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
648
	done
649 650
endif

651
$(HS_ALL_PROGS): %: %.hs $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS) Makefile
652 653 654
	@if [ "$(notdir $@)" = "test" ] && [ "$(HTOOLS_NODEV)" ]; then \
	  echo "Error: cannot run unittests without the development" \
	       " libraries (see devnotes.rst)" 1>&2; \
655
	  exit 1; \
656
	fi
Iustin Pop's avatar
Iustin Pop committed
657 658
	@rm -f $(notdir $@).tix
	$(GHC) --make \
Iustin Pop's avatar
Iustin Pop committed
659
	  $(HFLAGS) \
660
	  $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) $(HTOOLS_REGEX_PCRE) \
Iustin Pop's avatar
Iustin Pop committed
661
	  -osuf $(notdir $@).o -hisuf $(notdir $@).hi \
662
	  $(HEXTRA) $(HEXTRA_INT) $@
663 664
	@touch "$@"

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

668
# we compile the hpc-htools binary with the program coverage
Iustin Pop's avatar
Iustin Pop committed
669
htest/hpc-htools: HEXTRA_INT=-fhpc
670

671
# test dependency
Iustin Pop's avatar
Iustin Pop committed
672
htest/offline-tests.sh: htest/hpc-htools
673

674 675 676 677 678 679
# rules for building profiling-enabled versions of the haskell
# programs: hs-prof does the full two-step build, whereas
# hs-prof-quick does only the final rebuild (hs-prof must have been
# run before)
.PHONY: hs-prof hs-prof-quick
hs-prof:
680
	$(MAKE) $(AM_MAKEFLAGS) clean
Iustin Pop's avatar
Iustin Pop committed
681
	$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf o"
682
	rm -f $(HS_ALL_PROGS)
683
	$(MAKE) $(AM_MAKEFLAGS) hs-prof-quick
684 685

hs-prof-quick:
Iustin Pop's avatar
Iustin Pop committed
686
	$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf prof_o -prof -auto-all"
687

688 689
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
690

691
nodist_sbin_SCRIPTS = \
692
	$(PYTHON_BOOTSTRAP_SBIN) \
693
	daemons/ganeti-cleaner
694

695
if ENABLE_CONFD
696 697 698 699
htools/ganeti-confd: htools/hconfd
	cp -f $< $@

nodist_sbin_SCRIPTS += htools/ganeti-confd
700 701
endif

702
python_scripts = \
703 704 705
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
706
	tools/cfgupgrade12 \
707
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
708
	tools/confd-client \
709
	tools/fmtjson \
Iustin Pop's avatar
Iustin Pop committed
710
	tools/lvmstrap \
711
	tools/move-instance \
712
	tools/ovfconverter \
Michael Hanselmann's avatar
Michael Hanselmann committed
713
	tools/sanitize-config
714

715
dist_tools_SCRIPTS = \
716
	$(python_scripts) \
717
	tools/kvm-console-wrapper \
Iustin Pop's avatar
Iustin Pop committed
718
	tools/master-ip-setup \
719
	tools/xen-console-wrapper
720