Makefile.am 52.1 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/DataCollectors \
64
	htools/Ganeti/HTools \
65
	htools/Ganeti/HTools/Backend \
66
	htools/Ganeti/HTools/Program \
Iustin Pop's avatar
Iustin Pop committed
67
	htools/Ganeti/Query \
Iustin Pop's avatar
Iustin Pop committed
68 69
	htest \
	htest/Test \
70
	htest/Test/Ganeti \
Michele Tartara's avatar
Michele Tartara committed
71 72
	htest/Test/Ganeti/Block \
	htest/Test/Ganeti/Block/Drbd \
73
	htest/Test/Ganeti/Confd \
74
	htest/Test/Ganeti/HTools \
75
	htest/Test/Ganeti/HTools/Backend \
76
	htest/Test/Ganeti/Query
77

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

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

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

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
135 136 137 138 139
	doc/html

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

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

159
maintainer-clean-local:
160
	rm -rf $(BUILDTIME_DIRS)
161

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

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

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

202
built_base_sources = \
203 204
	stamp-directories \
	stamp-srclinks
205

206
built_python_base_sources = \
207
	lib/_autoconf.py \
208 209 210 211
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
212
	lib/_generated_rpc.py
213

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

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

228 229 230
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

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

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

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

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

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

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

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

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

320 321 322
impexpd_PYTHON = \
	lib/impexpd/__init__.py

323
watcher_PYTHON = \
324
	lib/watcher/__init__.py \
325 326
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
327

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

334 335
pytools_PYTHON = \
	lib/tools/__init__.py \
336
	lib/tools/ensure_dirs.py \
Michael Hanselmann's avatar
Michael Hanselmann committed
337
	lib/tools/node_cleanup.py \
338
	lib/tools/node_daemon_setup.py \
339
	lib/tools/prepare_node_join.py
340

341
utils_PYTHON = \
342
	lib/utils/__init__.py \
343
	lib/utils/algo.py \
344
	lib/utils/filelock.py \
345
	lib/utils/hash.py \
346
	lib/utils/io.py \
347
	lib/utils/log.py \
348
	lib/utils/lvm.py \
349
	lib/utils/mlock.py \
350
	lib/utils/nodesetup.py \
351
	lib/utils/process.py \
352
	lib/utils/retry.py \
353
	lib/utils/text.py \
354 355
	lib/utils/wrapper.py \
	lib/utils/x509.py
356

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

410
HS_PROGS = htools/htools htools/mon-collector
Guido Trotter's avatar
Guido Trotter committed
411
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck hroller
412
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
413

414 415 416
HS_ALL_PROGS = \
	$(HS_PROGS) \
	htest/hpc-htools \
417
	htest/hpc-mon-collector \
418 419 420 421
	htest/test \
	htools/hconfd \
	htools/rpc-test

422
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
423
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=htest/%) htest/hail
424

425 426 427 428 429 430
HFLAGS = \
	-O -Wall -Werror -ihtools \
	-fwarn-monomorphism-restriction \
	-fwarn-tabs \
	$(GHC_BYVERSION_FLAGS)

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

448
HS_LIB_SRCS = \
449 450
	htools/Ganeti/Block/Drbd/Types.hs \
	htools/Ganeti/Block/Drbd/Parser.hs \
Iustin Pop's avatar
Iustin Pop committed
451 452 453
	htools/Ganeti/BasicTypes.hs \
	htools/Ganeti/Common.hs \
	htools/Ganeti/Compat.hs \
454
	htools/Ganeti/Confd/Client.hs \
Iustin Pop's avatar
Iustin Pop committed
455
	htools/Ganeti/Confd/Server.hs \
Iustin Pop's avatar
Iustin Pop committed
456
	htools/Ganeti/Confd/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
457 458 459
	htools/Ganeti/Confd/Utils.hs \
	htools/Ganeti/Config.hs \
	htools/Ganeti/Daemon.hs \
460
	htools/Ganeti/DataCollectors/CLI.hs \
461 462
	htools/Ganeti/DataCollectors/Drbd.hs \
	htools/Ganeti/DataCollectors/Program.hs \
463
	htools/Ganeti/Errors.hs \
464 465 466 467 468
	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 \
469 470 471 472
	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
473
	htools/Ganeti/HTools/Graph.hs \
474 475 476 477 478
	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 \
479
	htools/Ganeti/HTools/Program.hs \
480
	htools/Ganeti/HTools/Program/Hail.hs \
481
	htools/Ganeti/HTools/Program/Hbal.hs \
482
	htools/Ganeti/HTools/Program/Hcheck.hs \
483
	htools/Ganeti/HTools/Program/Hinfo.hs \
484
	htools/Ganeti/HTools/Program/Hscan.hs \
485
	htools/Ganeti/HTools/Program/Hspace.hs \
Guido Trotter's avatar
Guido Trotter committed
486
	htools/Ganeti/HTools/Program/Hroller.hs \
Iustin Pop's avatar
Iustin Pop committed
487
	htools/Ganeti/HTools/Types.hs \
488
	htools/Ganeti/Hash.hs \
Iustin Pop's avatar
Iustin Pop committed
489
	htools/Ganeti/JQueue.hs \
490
	htools/Ganeti/JSON.hs \
Iustin Pop's avatar
Iustin Pop committed
491
	htools/Ganeti/Jobs.hs \
Iustin Pop's avatar
Iustin Pop committed
492
	htools/Ganeti/Logging.hs \
493
	htools/Ganeti/Luxi.hs \
494
	htools/Ganeti/Network.hs \
495
	htools/Ganeti/Objects.hs \
496
	htools/Ganeti/OpCodes.hs \
497
	htools/Ganeti/OpParams.hs \
498
	htools/Ganeti/Path.hs \
499
	htools/Ganeti/Query/Common.hs \
Iustin Pop's avatar
Iustin Pop committed
500
	htools/Ganeti/Query/Filter.hs \
Agata Murawska's avatar
Agata Murawska committed
501
	htools/Ganeti/Query/Group.hs \
502
	htools/Ganeti/Query/Job.hs \
503
	htools/Ganeti/Query/Language.hs \
504
	htools/Ganeti/Query/Node.hs \
505
	htools/Ganeti/Query/Query.hs \
506
	htools/Ganeti/Query/Server.hs \
507
	htools/Ganeti/Query/Types.hs \
508
	htools/Ganeti/Rpc.hs \
Iustin Pop's avatar
Iustin Pop committed
509
	htools/Ganeti/Runtime.hs \
Iustin Pop's avatar
Iustin Pop committed
510
	htools/Ganeti/Ssconf.hs \
511
	htools/Ganeti/THH.hs \
512
	htools/Ganeti/Types.hs \
513
	htools/Ganeti/Utils.hs
514 515

HS_TEST_SRCS = \
516
	htest/Test/Ganeti/Attoparsec.hs \
517
	htest/Test/Ganeti/BasicTypes.hs \
Michele Tartara's avatar
Michele Tartara committed
518
	htest/Test/Ganeti/Block/Drbd/Parser.hs \
519
	htest/Test/Ganeti/Block/Drbd/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
520
	htest/Test/Ganeti/Common.hs \
521
	htest/Test/Ganeti/Confd/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
522
	htest/Test/Ganeti/Confd/Utils.hs \
Iustin Pop's avatar
Iustin Pop committed
523
	htest/Test/Ganeti/Daemon.hs \
524
	htest/Test/Ganeti/Errors.hs \
525 526
	htest/Test/Ganeti/HTools/Backend/Simu.hs \
	htest/Test/Ganeti/HTools/Backend/Text.hs \
527 528 529
	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
530
	htest/Test/Ganeti/HTools/Graph.hs \
531 532 533 534 535
	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 \
536 537
	htest/Test/Ganeti/JSON.hs \
	htest/Test/Ganeti/Jobs.hs \
Iustin Pop's avatar
Iustin Pop committed
538
	htest/Test/Ganeti/JQueue.hs \
539
	htest/Test/Ganeti/Luxi.hs \
540
	htest/Test/Ganeti/Network.hs \
541
	htest/Test/Ganeti/Objects.hs \
542
	htest/Test/Ganeti/OpCodes.hs \
Iustin Pop's avatar
Iustin Pop committed
543
	htest/Test/Ganeti/Query/Filter.hs \
544
	htest/Test/Ganeti/Query/Language.hs \
545
	htest/Test/Ganeti/Query/Query.hs \
546
	htest/Test/Ganeti/Rpc.hs \
547
	htest/Test/Ganeti/Ssconf.hs \
548
	htest/Test/Ganeti/THH.hs \
549 550
	htest/Test/Ganeti/TestCommon.hs \
	htest/Test/Ganeti/TestHTools.hs \
551
	htest/Test/Ganeti/TestHelper.hs \
552
	htest/Test/Ganeti/Types.hs \
553
	htest/Test/Ganeti/Utils.hs
554

555
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
556

557 558 559
HS_BUILT_SRCS = \
	htest/Test/Ganeti/TestImports.hs \
	htools/Ganeti/Constants.hs \
560
	htools/Ganeti/Version.hs
561
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
562

563
$(RUN_IN_TEMPDIR): | stamp-directories
564

Iustin Pop's avatar
Iustin Pop committed
565 566 567 568 569
# 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
570
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
571 572
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
573
	| $(BUILT_PYTHON_SOURCES)
574 575
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
576
	@mkdir_p@ $(dir $@)
577
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
578
	    -d . \
579 580
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
581 582 583 584
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

585
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
586

587
doc/install-quick.rst: INSTALL
588
doc/news.rst: NEWS
589
doc/upgrade.rst: UPGRADE
590

591
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
592 593 594 595 596 597 598
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

599
docdot = \
600 601 602
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
603

604
docpng = $(patsubst %.dot,%.png,$(docdot))
605

606 607 608 609
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	doc/html \
610
	$(BUILT_EXAMPLES) \
611
	doc/examples/bash_completion \
612
	doc/examples/bash_completion-debug \
613
	$(manhtml)
614

615
gnt_scripts = \
616 617 618
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
619
	scripts/gnt-group \
620 621
	scripts/gnt-instance \
	scripts/gnt-job \
622
	scripts/gnt-network \
623 624 625
	scripts/gnt-node \
	scripts/gnt-os

626
PYTHON_BOOTSTRAP_SBIN = \
627
	daemons/ganeti-masterd \
628
	daemons/ganeti-noded \
629
	daemons/ganeti-rapi \
Iustin Pop's avatar
Iustin Pop committed
630
	daemons/ganeti-watcher \
631
	$(gnt_scripts)
632

633 634
PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
635
	tools/ensure-dirs \
Michael Hanselmann's avatar
Michael Hanselmann committed
636
	tools/node-cleanup \
637
	tools/node-daemon-setup \
638
	tools/prepare-node-join
639

640
qa_scripts = \
641
	qa/__init__.py \
642 643 644 645 646 647
	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
648
	qa/qa_group.py \
649
	qa/qa_instance.py \
650
	qa/qa_job.py \
651 652 653 654 655 656
	qa/qa_node.py \
	qa/qa_os.py \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

657 658
bin_SCRIPTS =
if WANT_HTOOLS
659
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
660 661
install-exec-hook:
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
662 663
# FIXME: this is a hardcoded logic, instead of auto-resolving
	$(LN_S) -f ../../../bin/htools \
Iustin Pop's avatar
Iustin Pop committed
664
	  $(DESTDIR)$(iallocatorsdir)/hail
665
	for role in $(HS_BIN_ROLES); do \
Iustin Pop's avatar
Iustin Pop committed
666
	  $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
667
	done
668 669
endif

670
$(HS_ALL_PROGS): %: %.hs $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS) Makefile
671 672 673
	@if [ "$(notdir $@)" = "test" ] && [ "$(HTOOLS_NODEV)" ]; then \
	  echo "Error: cannot run unittests without the development" \
	       " libraries (see devnotes.rst)" 1>&2; \
674
	  exit 1; \
675
	fi
Iustin Pop's avatar
Iustin Pop committed
676 677
	@rm -f $(notdir $@).tix
	$(GHC) --make \
Iustin Pop's avatar
Iustin Pop committed
678
	  $(HFLAGS) \
679
	  $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) $(HTOOLS_REGEX_PCRE) \
Iustin Pop's avatar
Iustin Pop committed
680
	  -osuf $(notdir $@).o -hisuf $(notdir $@).hi \
681
	  $(HEXTRA) $(HEXTRA_INT) $@
682 683
	@touch "$@"

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

687
# we compile the hpc-htools binary with the program coverage
Iustin Pop's avatar
Iustin Pop committed
688
htest/hpc-htools: HEXTRA_INT=-fhpc
689

690 691 692
# we compile the hpc-mon-collector binary with the program coverage
htest/hpc-mon-collector: HEXTRA_INT=-fhpc

693
# test dependency
694
htest/offline-tests.sh: htest/hpc-htools htest/hpc-mon-collector
695

696 697 698 699 700 701
# 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:
Iustin Pop's avatar
Iustin Pop committed
702 703 704 705
	@if [ -z "$(TARGET)" ]; then \
	  echo "You need to define TARGET when running this rule" 1>&2; \
	  exit 1; \
	fi
706
	$(MAKE) $(AM_MAKEFLAGS) clean
Iustin Pop's avatar
Iustin Pop committed
707
	$(MAKE) $(AM_MAKEFLAGS) $(TARGET) HEXTRA="-osuf o"
708
	rm -f $(HS_ALL_PROGS)
709
	$(MAKE) $(AM_MAKEFLAGS) hs-prof-quick
710 711

hs-prof-quick:
Iustin Pop's avatar
Iustin Pop committed
712 713 714 715 716
	@if [ -z "$(TARGET)" ]; then \
	  echo "You need to define TARGET when running this rule" 1>&2; \
	  exit 1; \
	fi
	$(MAKE) $(AM_MAKEFLAGS) $(TARGET) HEXTRA="-osuf prof_o -prof -auto-all"
717

718 719
dist