Makefile.am 52.9 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_REFERENCES = $(top_srcdir)/autotools/check-man-references
27
CHECK_MAN_WARNINGS = $(top_srcdir)/autotools/check-man-warnings
28
CHECK_VERSION = $(top_srcdir)/autotools/check-version
29
CHECK_NEWS = $(top_srcdir)/autotools/check-news
30
CHECK_IMPORTS = $(top_srcdir)/autotools/check-imports
31
DOCPP = $(top_srcdir)/autotools/docpp
32
REPLACE_VARS_SED = autotools/replace_vars.sed
33
CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
34
BUILD_RPC = $(top_srcdir)/autotools/build-rpc
35
SHELL_ENV_INIT = autotools/shell-env-init
36

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

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

58
HS_DIRS = \
Iustin Pop's avatar
Iustin Pop committed
59 60 61 62 63 64 65 66 67 68
	src \
	src/Ganeti \
	src/Ganeti/Block \
	src/Ganeti/Block/Drbd \
	src/Ganeti/Confd \
	src/Ganeti/DataCollectors \
	src/Ganeti/HTools \
	src/Ganeti/HTools/Backend \
	src/Ganeti/HTools/Program \
	src/Ganeti/Query \
69 70 71 72 73 74 75 76 77
	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 \
	test/hs/Test/Ganeti/Query
78

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

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

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

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
138 139 140 141 142
	doc/html

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

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

161
maintainer-clean-local:
162
	rm -rf $(BUILDTIME_DIRS)
163

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

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

196
HS_GENERATED_FILES =
197
if WANT_HTOOLS
198
HS_GENERATED_FILES += $(HS_PROGS)
199
if ENABLE_CONFD
200
HS_GENERATED_FILES += src/hconfd src/ganeti-confd
201 202 203
endif
endif

204
built_base_sources = \
205 206
	stamp-directories \
	stamp-srclinks
207

208
built_python_base_sources = \
209
	lib/_autoconf.py \
210 211 212 213
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
214
	lib/_generated_rpc.py
215

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

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

230 231 232
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

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

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

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

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

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

308
http_PYTHON = \
309
	lib/http/__init__.py \
310
	lib/http/auth.py \
311 312
	lib/http/client.py \
	lib/http/server.py
313

Guido Trotter's avatar
Guido Trotter committed
314
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
315
	lib/confd/__init__.py \
316
	lib/confd/client.py
317

Michael Hanselmann's avatar
Michael Hanselmann committed
318
masterd_PYTHON = \
319
	lib/masterd/__init__.py \
René Nussbaumer's avatar
René Nussbaumer committed
320
	lib/masterd/iallocator.py \
321
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
322

323 324 325
impexpd_PYTHON = \
	lib/impexpd/__init__.py

326
watcher_PYTHON = \
327
	lib/watcher/__init__.py \
328 329
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
330

331
server_PYTHON = \
332
	lib/server/__init__.py \
333
	lib/server/masterd.py \
334 335
	lib/server/noded.py \
	lib/server/rapi.py
336

337 338
pytools_PYTHON = \
	lib/tools/__init__.py \
339
	lib/tools/ensure_dirs.py \
Michael Hanselmann's avatar
Michael Hanselmann committed
340
	lib/tools/node_cleanup.py \
341
	lib/tools/node_daemon_setup.py \
342
	lib/tools/prepare_node_join.py
343

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

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

415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
# Haskell programs to be installed in $PREFIX/bin
HS_BIN_PROGS=src/htools

# Haskell programs to be installed in the MYEXECLIB dir
HS_MYEXECLIB_PROGS=src/mon-collector

# Haskell programs to compiled but not installed automatically
# Usually they have their own specific installation rules
HS_COMPILE_PROGS= \
	src/hconfd \
	src/rpc-test

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

Guido Trotter's avatar
Guido Trotter committed
430
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck hroller
431
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
432

433 434
HS_ALL_PROGS = \
	$(HS_PROGS) \
435 436
	test/hs/hpc-htools \
	test/hs/hpc-mon-collector \
Iustin Pop's avatar
Iustin Pop committed
437
	test/hs/htest \
438
	$(HS_COMPILE_PROGS)
439

440
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
441
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
442

443
HFLAGS = \
Iustin Pop's avatar
Iustin Pop committed
444
	-O -Wall -Werror -isrc \
445 446 447 448
	-fwarn-monomorphism-restriction \
	-fwarn-tabs \
	$(GHC_BYVERSION_FLAGS)

449
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
450
HEXTRA =
Iustin Pop's avatar
Iustin Pop committed
451
# internal extra flags (used for test/hs/htest mainly)
452
HEXTRA_INT =
453
# exclude options for coverage reports
454
HPCEXCL = --exclude Main \
455
	--exclude Ganeti.Constants \
456
	--exclude Ganeti.HTools.QC \
Iustin Pop's avatar
Iustin Pop committed
457
	--exclude Ganeti.THH \
458
	--exclude Ganeti.Version \
459
	--exclude Test.Ganeti.Attoparsec \
460
	--exclude Test.Ganeti.TestCommon \
461 462
	--exclude Test.Ganeti.TestHTools \
	--exclude Test.Ganeti.TestHelper \
463
	--exclude Test.Ganeti.TestImports \
Iustin Pop's avatar
Iustin Pop committed
464
	$(patsubst src.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
465

466
HS_LIB_SRCS = \
Iustin Pop's avatar
Iustin Pop committed
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503
	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 \
	src/Ganeti/Daemon.hs \
	src/Ganeti/DataCollectors/CLI.hs \
	src/Ganeti/DataCollectors/Drbd.hs \
	src/Ganeti/DataCollectors/Program.hs \
	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 \
	src/Ganeti/HTools/Node.hs \
	src/Ganeti/HTools/PeerMap.hs \
	src/Ganeti/HTools/Program/Hail.hs \
	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 \
504
	src/Ganeti/HTools/Program/Main.hs \
Iustin Pop's avatar
Iustin Pop committed
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531
	src/Ganeti/HTools/Types.hs \
	src/Ganeti/Hash.hs \
	src/Ganeti/JQueue.hs \
	src/Ganeti/JSON.hs \
	src/Ganeti/Jobs.hs \
	src/Ganeti/Logging.hs \
	src/Ganeti/Luxi.hs \
	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 \
	src/Ganeti/Query/Filter.hs \
	src/Ganeti/Query/Group.hs \
	src/Ganeti/Query/Job.hs \
	src/Ganeti/Query/Language.hs \
	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
532 533

HS_TEST_SRCS = \
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571
	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 \
	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 \
	test/hs/Test/Ganeti/Query/Query.hs \
	test/hs/Test/Ganeti/Rpc.hs \
	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
572

573
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
574

575
HS_BUILT_SRCS = \
576
	test/hs/Test/Ganeti/TestImports.hs \
Iustin Pop's avatar
Iustin Pop committed
577 578
	src/Ganeti/Constants.hs \
	src/Ganeti/Version.hs
579
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
580

581
$(RUN_IN_TEMPDIR): | stamp-directories
582

Iustin Pop's avatar
Iustin Pop committed
583 584 585 586 587
# 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
588
doc/html/index.html: $(docinput) doc/conf.py configure.ac \
589 590
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
591
	doc/css/style.css \
592
	| $(BUILT_PYTHON_SOURCES)
593 594
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
595
	@mkdir_p@ $(dir $@)
596
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
597
	    -d . \
598 599
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
600
	    -D graphviz_dot="$(DOT)" \
601
	    $(abs_top_builddir)/doc $(CURDIR)/doc/html
602 603 604
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

605
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
606

607
doc/install-quick.rst: INSTALL
608
doc/news.rst: NEWS
609
doc/upgrade.rst: UPGRADE
610

611
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
612 613 614 615 616 617 618
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

619 620 621 622
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	doc/html \
623
	$(BUILT_EXAMPLES) \
624
	doc/examples/bash_completion \
625
	doc/examples/bash_completion-debug \
626
	$(manhtml)
627

628
gnt_scripts = \
629 630 631
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
632
	scripts/gnt-group \
633 634
	scripts/gnt-instance \
	scripts/gnt-job \
635
	scripts/gnt-network \
636
	scripts/gnt-node \
637 638
	scripts/gnt-os \
	scripts/gnt-storage
639

640
PYTHON_BOOTSTRAP_SBIN = \
641
	daemons/ganeti-masterd \
642
	daemons/ganeti-noded \
643
	daemons/ganeti-rapi \
Iustin Pop's avatar
Iustin Pop committed
644
	daemons/ganeti-watcher \
645
	$(gnt_scripts)
646

647 648
PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
649
	tools/ensure-dirs \
Michael Hanselmann's avatar
Michael Hanselmann committed
650
	tools/node-cleanup \
651
	tools/node-daemon-setup \
652
	tools/prepare-node-join
653

654
qa_scripts = \
655
	qa/__init__.py \
656 657 658 659 660 661
	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
662
	qa/qa_group.py \
663
	qa/qa_instance.py \
664
	qa/qa_job.py \
665 666 667 668 669 670
	qa/qa_node.py \
	qa/qa_os.py \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

671 672
bin_SCRIPTS =
if WANT_HTOOLS
673
bin_SCRIPTS += $(HS_BIN_PROGS)
674 675
install-exec-hook:
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
676 677
# FIXME: this is a hardcoded logic, instead of auto-resolving
	$(LN_S) -f ../../../bin/htools \
Iustin Pop's avatar
Iustin Pop committed
678
	  $(DESTDIR)$(iallocatorsdir)/hail
679
	for role in $(HS_BIN_ROLES); do \
Iustin Pop's avatar
Iustin Pop committed
680
	  $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
681
	done
682 683
endif

684
$(HS_ALL_PROGS): %: %.hs $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS) Makefile
685
	@if [ "$(notdir $@)" = "test" ] && [ "$(HS_NODEV)" ]; then \
686 687
	  echo "Error: cannot run unittests without the development" \
	       " libraries (see devnotes.rst)" 1>&2; \
688
	  exit 1; \
689
	fi
Iustin Pop's avatar
Iustin Pop committed
690 691
	@rm -f $(notdir $@).tix
	$(GHC) --make \
Iustin Pop's avatar
Iustin Pop committed
692
	  $(HFLAGS) \
693
	  $(HS_NOCURL) $(HS_PARALLEL3) $(HS_REGEX_PCRE) \
Iustin Pop's avatar
Iustin Pop committed
694
	  -osuf $(notdir $@).o -hisuf $(notdir $@).hi \
695
	  $(HEXTRA) $(HEXTRA_INT) $@
696 697
	@touch "$@"

Iustin Pop's avatar
Iustin Pop committed
698 699
# for the test/hs/htest binary, we need to enable profiling/coverage
test/hs/htest: HEXTRA_INT=-fhpc -itest/hs
700

701
# we compile the hpc-htools binary with the program coverage
702
test/hs/hpc-htools: HEXTRA_INT=-fhpc
703

704
# we compile the hpc-mon-collector binary with the program coverage
705
test/hs/hpc-mon-collector: HEXTRA_INT=-fhpc
706

707
# test dependency
708
test/hs/offline-tests.sh: test/hs/hpc-htools test/hs/hpc-mon-collector
709

710 711 712 713 714 715
# 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
716 717 718 719
	@if [ -z "$(TARGET)" ]; then \
	  echo "You need to define TARGET when running this rule" 1>&2; \
	  exit 1; \
	fi
720
	$(MAKE) $(AM_MAKEFLAGS) clean
Iustin Pop's avatar
Iustin Pop committed
721
	$(MAKE) $(AM_MAKEFLAGS) $(TARGET) HEXTRA="-osuf o"
722
	rm -f $(HS_ALL_PROGS)
723
	$(MAKE) $(AM_MAKEFLAGS) hs-prof-quick
724 725

hs-prof-quick:
Iustin Pop's avatar
Iustin Pop committed
726 727 728 729 730
	@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"
731

732 733
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
734

735
nodist_sbin_SCRIPTS = \
736
	$(PYTHON_BOOTSTRAP_SBIN) \
737
	daemons/ganeti-cleaner
738

739
if ENABLE_CONFD
Iustin Pop's avatar
Iustin Pop committed
740
src/ganeti-confd: src/hconfd
741 742
	cp -f $< $@

Iustin Pop's avatar
Iustin Pop committed
743
nodist_sbin_SCRIPTS += src/ganeti-confd
744 745
endif

746
python_scripts = \
747 748 749
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
750
	tools/cfgupgrade12 \
751
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
752
	tools/confd-client \
753
	tools/fmtjson \
Iustin Pop's avatar
Iustin Pop committed
754
	tools/lvmstrap \
755
	tools/move-instance \
756
	tools/ovfconverter \
Michael Hanselmann's avatar
Michael Hanselmann committed
757
	tools/sanitize-config
758

759
dist_tools_SCRIPTS = \
760
	$(python_scripts) \
761
	tools/kvm-console-wrapper \
Iustin Pop's avatar
Iustin Pop committed
762
	tools/master-ip-setup \
763
	tools/xen-console-wrapper
764

Michael Hanselmann's avatar
Michael Hanselmann committed
765 766 767
nodist_tools_python_scripts = \
	tools/node-cleanup

768
nodist_tools_SCRIPTS = \
Michael Hanselmann's avatar
Michael Hanselmann committed
769
	$(nodist_tools_python_scripts) \
770 771
	tools/vcluster-setup

772
pkglib_python_scripts = \
773 774
	daemons/import-export \
	tools/check-cert-expired
775

776
nodist_pkglib_python_scripts = \
777
	tools/ensure-dirs \
778
	tools/node-daemon-setup \
779
	tools/prepare-node-join
780

781
myexeclib_SCRIPTS = \
782
	daemons/daemon-util \
783
	tools/kvm-ifup \
784
	$(pkglib_python_scripts) \
785
	$(HS_MYEXECLIB_PROGS)
786

787
nodist_myexeclib_SCRIPTS = \
788 789
	$(nodist_pkglib_python_scripts)

790 791
EXTRA_DIST = \
	NEWS \
792
	UPGRADE \
793
	epydoc.conf.in \
Michael Hanselmann's avatar
Michael Hanselmann committed
794
	pylintrc \
795
	autotools/build-bash-completion \