Makefile.am 58.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
# Helper function to strip src/ and test/hs/ from a list
strip_hsroot = $(patsubst src/%,%,$(patsubst test/hs/%,%,$(1)))

20 21 22
# Use bash in order to be able to use pipefail
SHELL=/bin/bash

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

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

58 59 60
# Delete output file if an error occurred while building it
.DELETE_ON_ERROR:

61
HS_DIRS = \
Iustin Pop's avatar
Iustin Pop committed
62 63 64 65 66
	src \
	src/Ganeti \
	src/Ganeti/Block \
	src/Ganeti/Block/Drbd \
	src/Ganeti/Confd \
67
	src/Ganeti/Curl \
Iustin Pop's avatar
Iustin Pop committed
68 69 70 71
	src/Ganeti/DataCollectors \
	src/Ganeti/HTools \
	src/Ganeti/HTools/Backend \
	src/Ganeti/HTools/Program \
72 73
	src/Ganeti/Hypervisor \
	src/Ganeti/Hypervisor/Xen \
74
	src/Ganeti/Monitoring \
Iustin Pop's avatar
Iustin Pop committed
75
	src/Ganeti/Query \
76 77 78 79 80 81 82 83
	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 \
84 85
	test/hs/Test/Ganeti/Hypervisor \
	test/hs/Test/Ganeti/Hypervisor/Xen \
86
	test/hs/Test/Ganeti/Query
87

88 89 90
# Haskell directories without the roots (src, test/hs)
HS_DIRS_NOROOT = $(filter-out src,$(filter-out test/hs,$(HS_DIRS)))

91
DIRS = \
92
	$(HS_DIRS) \
93 94 95
	autotools \
	daemons \
	devel \
96
	devel/data \
97
	doc \
98
	doc/css \
99
	doc/examples \
100
	doc/examples/gnt-debug \
Iustin Pop's avatar
Iustin Pop committed
101
	doc/examples/hooks \
102 103 104
	test/data/htools \
	test/data/htools/rapi \
	test/hs/shelltests \
105
	lib \
106
	lib/build \
Iustin Pop's avatar
Iustin Pop committed
107
	lib/client \
108
	lib/confd \
109
	lib/http \
110
	lib/hypervisor \
111
	lib/impexpd \
Michael Hanselmann's avatar
Michael Hanselmann committed
112
	lib/masterd \
113
	lib/rapi \
114
	lib/server \
115
	lib/tools \
116
	lib/utils \
117
	lib/watcher \
118 119 120 121
	man \
	qa \
	test \
	test/data \
122
	test/data/bdev-rbd \
Agata Murawska's avatar
Agata Murawska committed
123
	test/data/ovfdata \
Agata Murawska's avatar
Agata Murawska committed
124
	test/data/ovfdata/other \
Iustin Pop's avatar
Iustin Pop committed
125
	test/py \
126 127
	tools

128
ALL_APIDOC_HS_DIRS = \
129
	$(APIDOC_HS_DIR) \
130
	$(patsubst %,$(APIDOC_HS_DIR)/%,$(call strip_hsroot,$(HS_DIRS_NOROOT)))
131 132 133 134 135

BUILDTIME_DIR_AUTOCREATE = \
	scripts \
	$(APIDOC_DIR) \
	$(ALL_APIDOC_HS_DIRS) \
Iustin Pop's avatar
Iustin Pop committed
136
	$(APIDOC_PY_DIR) \
137 138
	$(COVERAGE_DIR) \
	$(COVERAGE_HS_DIR) \
Iustin Pop's avatar
Iustin Pop committed
139
	$(COVERAGE_PY_DIR) \
140
	.hpc
141 142 143

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
144 145
	doc/html \
	doc/man-html
146 147 148 149

DIRCHECK_EXCLUDE = \
	$(BUILDTIME_DIRS) \
	ganeti-[0-9]*.[0-9]*.[0-9]* \
Iustin Pop's avatar
Iustin Pop committed
150
	doc/html/_* \
151
	doc/man-html/_* \
Iustin Pop's avatar
Iustin Pop committed
152
	autom4te.cache
153

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

169
maintainer-clean-local:
170
	rm -rf $(BUILDTIME_DIRS)
171

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

Iustin Pop's avatar
Iustin Pop committed
205
GENERATED_FILES = \
Iustin Pop's avatar
Iustin Pop committed
206
	$(built_base_sources) \
207 208 209
	$(BUILT_PYTHON_SOURCES) \
	$(PYTHON_BOOTSTRAP)

210
HS_GENERATED_FILES =
211
if WANT_HTOOLS
212
HS_GENERATED_FILES += $(HS_PROGS)
213
if ENABLE_CONFD
214
HS_GENERATED_FILES += src/hconfd src/ganeti-confd
215
endif
216 217 218 219

if ENABLE_MOND
HS_GENERATED_FILES += src/ganeti-mond
endif
220 221
endif

222
built_base_sources = \
223 224
	stamp-directories \
	stamp-srclinks
225

226
built_python_base_sources = \
227
	lib/_autoconf.py \
228 229 230 231
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
232
	lib/_generated_rpc.py
233

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

238 239 240 241 242
# 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 \
243
	doc/examples/ganeti-master-role.ocf \
244
	doc/examples/ganeti-node-role.ocf \
245 246 247
	doc/examples/gnt-config-backup \
	doc/examples/hooks/ipsec

248 249 250
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

251
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
252
	lib/build/__init__.py \
Iustin Pop's avatar
Iustin Pop committed
253 254
	lib/build/shell_example_lexer.py \
	lib/build/sphinx_ext.py
255

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

295
client_PYTHON = \
296
	lib/client/__init__.py \
297
	lib/client/gnt_backup.py \
298
	lib/client/gnt_cluster.py \
299
	lib/client/gnt_debug.py \
300
	lib/client/gnt_group.py \
301
	lib/client/gnt_instance.py \
302
	lib/client/gnt_job.py \
303
	lib/client/gnt_node.py \
304
	lib/client/gnt_network.py \
305 306
	lib/client/gnt_os.py \
	lib/client/gnt_storage.py
307

308 309 310
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
311
	lib/hypervisor/hv_chroot.py \
312
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
313
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
314
	lib/hypervisor/hv_lxc.py \
315 316
	lib/hypervisor/hv_xen.py

317 318
rapi_PYTHON = \
	lib/rapi/__init__.py \
319
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
320
	lib/rapi/client.py \
321
	lib/rapi/client_utils.py \
322
	lib/rapi/connector.py \
323 324
	lib/rapi/rlib2.py \
	lib/rapi/testutils.py
325

326
http_PYTHON = \
327
	lib/http/__init__.py \
328
	lib/http/auth.py \
329 330
	lib/http/client.py \
	lib/http/server.py
331

Guido Trotter's avatar
Guido Trotter committed
332
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
333
	lib/confd/__init__.py \
334
	lib/confd/client.py
335

Michael Hanselmann's avatar
Michael Hanselmann committed
336
masterd_PYTHON = \
337
	lib/masterd/__init__.py \
René Nussbaumer's avatar
René Nussbaumer committed
338
	lib/masterd/iallocator.py \
339
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
340

341 342 343
impexpd_PYTHON = \
	lib/impexpd/__init__.py

344
watcher_PYTHON = \
345
	lib/watcher/__init__.py \
346 347
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
348

349
server_PYTHON = \
350
	lib/server/__init__.py \
351
	lib/server/masterd.py \
352 353
	lib/server/noded.py \
	lib/server/rapi.py
354

355 356
pytools_PYTHON = \
	lib/tools/__init__.py \
357
	lib/tools/burnin.py \
358
	lib/tools/ensure_dirs.py \
Michael Hanselmann's avatar
Michael Hanselmann committed
359
	lib/tools/node_cleanup.py \
360
	lib/tools/node_daemon_setup.py \
361
	lib/tools/prepare_node_join.py
362

363
utils_PYTHON = \
364
	lib/utils/__init__.py \
365
	lib/utils/algo.py \
366
	lib/utils/filelock.py \
367
	lib/utils/hash.py \
368
	lib/utils/io.py \
369
	lib/utils/log.py \
370
	lib/utils/lvm.py \
371
	lib/utils/mlock.py \
372
	lib/utils/nodesetup.py \
373
	lib/utils/process.py \
374
	lib/utils/retry.py \
375
	lib/utils/text.py \
376 377
	lib/utils/wrapper.py \
	lib/utils/x509.py
378

379 380 381
docinput = \
	doc/conf.py \
	doc/css/style.css \
382
	doc/admin.rst \
Iustin Pop's avatar
Iustin Pop committed
383
	doc/cluster-merge.rst \
384
	doc/design-2.0.rst \
385
	doc/design-2.1.rst \
386
	doc/design-2.2.rst \
Guido Trotter's avatar
Guido Trotter committed
387
	doc/design-2.3.rst \
388
	doc/design-2.4.rst \
389
	doc/design-2.5.rst \
390
	doc/design-2.6.rst \
391
	doc/design-2.7.rst \
Iustin Pop's avatar
Iustin Pop committed
392 393 394
	doc/design-autorepair.rst \
	doc/design-bulk-create.rst \
	doc/design-chained-jobs.rst \
Tsachy Shacham's avatar
Tsachy Shacham committed
395
	doc/design-cpu-pinning.rst \
Iustin Pop's avatar
Iustin Pop committed
396 397
	doc/design-draft.rst \
	doc/design-htools-2.3.rst \
398
	doc/design-http-server.rst \
399
	doc/design-impexp2.rst \
400
	doc/design-lu-generated-jobs.rst \
401
	doc/design-linuxha.rst \
402
	doc/design-multi-reloc.rst \
403
	doc/design-network.rst \
404
	doc/design-node-add.rst \
Iustin Pop's avatar
Iustin Pop committed
405
	doc/design-oob.rst \
406
	doc/design-ovf-support.rst \
407
	doc/design-opportunistic-locking.rst \
Iustin Pop's avatar
Iustin Pop committed
408 409 410
	doc/design-partitioned.rst \
	doc/design-query-splitting.rst \
	doc/design-query2.rst \
411
	doc/design-reason-trail.rst \
412
	doc/design-resource-model.rst \
413
	doc/design-restricted-commands.rst \
414
	doc/design-shared-storage.rst \
415
	doc/design-monitoring-agent.rst \
416
	doc/design-virtual-clusters.rst \
Iustin Pop's avatar
Iustin Pop committed
417
	doc/design-x509-ca.rst \
418
	doc/design-hroller.rst \
419
	doc/design-storagespace.rst \
420
	doc/devnotes.rst \
421
	doc/glossary.rst \
422
	doc/hooks.rst \
423
	doc/iallocator.rst \
424
	doc/index.rst \
425
	doc/install-quick.rst \
426
	doc/install.rst \
427
	doc/locking.rst \
428
	doc/manpages-disabled.rst \
429
	doc/move-instance.rst \
Iustin Pop's avatar
Iustin Pop committed
430
	doc/news.rst \
431
	doc/ovfconverter.rst \
432
	doc/rapi.rst \
433
	doc/security.rst \
434
	doc/upgrade.rst \
435
	doc/virtual-cluster.rst \
Iustin Pop's avatar
Iustin Pop committed
436
	doc/walkthrough.rst
Michael Hanselmann's avatar
Michael Hanselmann committed
437

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

441 442 443 444 445 446
# 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

447
# Haskell programs to be compiled by "make really-all"
448
HS_COMPILE_PROGS= \
449
	src/ganeti-mond \
450 451 452 453 454 455
	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)

456
HS_BIN_ROLES = harep hbal hscan hspace hinfo hcheck hroller
457
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
458

459 460
HS_ALL_PROGS = \
	$(HS_PROGS) \
461 462
	test/hs/hpc-htools \
	test/hs/hpc-mon-collector \
Iustin Pop's avatar
Iustin Pop committed
463
	test/hs/htest \
464
	$(HS_COMPILE_PROGS)
465

466
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
467
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
468

469
HFLAGS = \
Iustin Pop's avatar
Iustin Pop committed
470
	-O -Wall -Werror -isrc \
471 472 473 474
	-fwarn-monomorphism-restriction \
	-fwarn-tabs \
	$(GHC_BYVERSION_FLAGS)

475
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
476
HEXTRA =
Iustin Pop's avatar
Iustin Pop committed
477
# internal extra flags (used for test/hs/htest mainly)
478
HEXTRA_INT =
479
# exclude options for coverage reports
480
HPCEXCL = --exclude Main \
481
	--exclude Ganeti.Constants \
482
	--exclude Ganeti.HTools.QC \
Iustin Pop's avatar
Iustin Pop committed
483
	--exclude Ganeti.THH \
484
	--exclude Ganeti.Version \
485
	--exclude Test.Ganeti.Attoparsec \
486
	--exclude Test.Ganeti.TestCommon \
487 488
	--exclude Test.Ganeti.TestHTools \
	--exclude Test.Ganeti.TestHelper \
489
	--exclude Test.Ganeti.TestImports \
Iustin Pop's avatar
Iustin Pop committed
490
	$(patsubst src.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
491

492
HS_LIB_SRCS = \
Iustin Pop's avatar
Iustin Pop committed
493 494 495 496 497 498 499 500 501 502
	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 \
503
	src/Ganeti/Curl/Multi.hs \
Iustin Pop's avatar
Iustin Pop committed
504 505 506 507
	src/Ganeti/Daemon.hs \
	src/Ganeti/DataCollectors/CLI.hs \
	src/Ganeti/DataCollectors/Drbd.hs \
	src/Ganeti/DataCollectors/Program.hs \
508
	src/Ganeti/DataCollectors/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
	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 \
526
	src/Ganeti/HTools/Program/Harep.hs \
Iustin Pop's avatar
Iustin Pop committed
527 528 529 530 531 532
	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 \
533
	src/Ganeti/HTools/Program/Main.hs \
Iustin Pop's avatar
Iustin Pop committed
534
	src/Ganeti/HTools/Types.hs \
535 536
	src/Ganeti/Hypervisor/Xen/XmParser.hs \
	src/Ganeti/Hypervisor/Xen/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
537 538 539 540 541 542
	src/Ganeti/Hash.hs \
	src/Ganeti/JQueue.hs \
	src/Ganeti/JSON.hs \
	src/Ganeti/Jobs.hs \
	src/Ganeti/Logging.hs \
	src/Ganeti/Luxi.hs \
543
	src/Ganeti/Monitoring/Server.hs \
Iustin Pop's avatar
Iustin Pop committed
544 545 546 547 548 549
	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 \
550
	src/Ganeti/Query/Export.hs \
Iustin Pop's avatar
Iustin Pop committed
551 552 553 554
	src/Ganeti/Query/Filter.hs \
	src/Ganeti/Query/Group.hs \
	src/Ganeti/Query/Job.hs \
	src/Ganeti/Query/Language.hs \
555
	src/Ganeti/Query/Network.hs \
Iustin Pop's avatar
Iustin Pop committed
556 557 558 559 560 561 562 563 564 565
	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
566 567

HS_TEST_SRCS = \
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587
	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 \
588
	test/hs/Test/Ganeti/Hypervisor/Xen/XmParser.hs \
589 590 591 592 593 594 595 596 597
	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 \
598
	test/hs/Test/Ganeti/Query/Network.hs \
599 600
	test/hs/Test/Ganeti/Query/Query.hs \
	test/hs/Test/Ganeti/Rpc.hs \
601
	test/hs/Test/Ganeti/Runtime.hs \
602 603 604 605 606 607 608
	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
609

610
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
611

612
HS_BUILT_SRCS = \
613
	test/hs/Test/Ganeti/TestImports.hs \
Iustin Pop's avatar
Iustin Pop committed
614
	src/Ganeti/Constants.hs \
615
	src/Ganeti/Curl/Internal.hs \
Iustin Pop's avatar
Iustin Pop committed
616
	src/Ganeti/Version.hs
617 618 619
HS_BUILT_SRCS_IN = \
	$(patsubst %,%.in,$(filter-out src/Ganeti/Curl/Internal.hs,$(HS_BUILT_SRCS))) \
	src/Ganeti/Curl/Internal.hsc
620

621 622
HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)

623
$(RUN_IN_TEMPDIR): | stamp-directories
624

625 626 627 628
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
629 630 631 632 633
# 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
634 635
doc/html/index.html doc/man-html/index.html: $(docinput) doc/conf.py \
	configure.ac $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
636
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
637
	doc/css/style.css lib/rapi/connector.py lib/rapi/rlib2.py \
638
	| $(BUILT_PYTHON_SOURCES)
639 640
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
641 642 643 644 645 646
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
647 648 649 650 651 652
## 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.
653 654
	dir=$(dir $@) && \
	@mkdir_p@ $$dir && \
655 656
	PYTHONPATH=. ENABLE_MANPAGES=$(ENABLE_MANPAGES) COPY_DOC=1 \
	$(RUN_IN_TEMPDIR) autotools/sphinx-wrapper $(SPHINX) -q -W -b html \
657
	    -d . \
658 659
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
660
	    -D graphviz_dot="$(DOT)" \
661 662 663
	    -D enable_manpages="$(ENABLE_MANPAGES)" \
	    doc $(CURDIR)/$$dir && \
	rm -f $$dir/.buildinfo $$dir/objects.inv
664 665
	touch $@

666
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
667

668 669
doc/man-html: doc/man-html/index.html

670
doc/install-quick.rst: INSTALL
671
doc/news.rst: NEWS
672
doc/upgrade.rst: UPGRADE
673

674
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
675 676 677 678 679 680 681
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709
doc/manpages-enabled.rst: Makefile | $(built_base_sources)
	{ echo '.. This file is automatically generated, do not edit!'; \
	  echo ''; \
	  echo 'Man pages'; \
	  echo '========='; \
	  echo; \
	  echo '.. toctree::'; \
	  echo '   :maxdepth: 1'; \
	  echo; \
	  for i in $(notdir $(mandocrst)); do \
	    echo "   $$i"; \
	  done | LC_ALL=C sort; \
	} > $@

doc/man-%.rst: man/%.gen Makefile $(REPLACE_VARS_SED) | $(built_base_sources)
if MANPAGES_IN_DOC
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  echo "$*"; \
	  echo '=========================================='; \
	  tail -n +3 $< | sed -f $(REPLACE_VARS_SED); \
	} > $@
else
	echo 'Man pages in documentation were disabled at configure time' >&2; \
	exit 1;
endif

710 711 712 713
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	doc/html \
714
	$(BUILT_EXAMPLES) \
715
	doc/examples/bash_completion \
716
	doc/examples/bash_completion-debug \
717
	$(manhtml)
718

719 720 721 722
if MANPAGES_IN_DOC
noinst_DATA += doc/man-html
endif

723
gnt_scripts = \
724 725 726
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
727
	scripts/gnt-group \
728 729
	scripts/gnt-instance \
	scripts/gnt-job \
730
	scripts/gnt-network \
731
	scripts/gnt-node \
732 733
	scripts/gnt-os \
	scripts/gnt-storage
734

735
PYTHON_BOOTSTRAP_SBIN = \
736
	daemons/ganeti-masterd \
737
	daemons/ganeti-noded \
738
	daemons/ganeti-rapi \
Iustin Pop's avatar
Iustin Pop committed
739
	daemons/ganeti-watcher \
740
	$(gnt_scripts)
741

742 743
PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
744
	tools/burnin \
745
	tools/ensure-dirs \
Michael Hanselmann's avatar
Michael Hanselmann committed
746
	tools/node-cleanup \
747
	tools/node-daemon-setup \
748
	tools/prepare-node-join
749

750
qa_scripts = \
751
	qa/__init__.py \
752 753 754 755 756 757
	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
758
	qa/qa_group.py \
759
	qa/qa_instance.py \
760
	qa/qa_job.py \
761 762 763 764 765 766
	qa/qa_node.py \
	qa/qa_os.py \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

767 768
bin_SCRIPTS =
if WANT_HTOOLS
769
bin_SCRIPTS += $(HS_BIN_PROGS)
770 771
install-exec-hook:
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
772 773
# FIXME: this is a hardcoded logic, instead of auto-resolving
	$(LN_S) -f ../../../bin/htools \
Iustin Pop's avatar
Iustin Pop committed
774
	  $(DESTDIR)$(iallocatorsdir)/hail
775
	for role in $(HS_BIN_ROLES); do \
Iustin Pop's avatar
Iustin Pop committed
776
	  $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
777
	done
778 779
endif

780
$(HS_ALL_PROGS): %: %.hs $(HS_LIBTESTBUILT_SRCS) Makefile
781
	@if [ "$(notdir $@)" = "test" ] && [ "$(HS_NODEV)" ]; then \
782 783
	  echo "Error: cannot run unittests without the development" \
	       " libraries (see devnotes.rst)" 1>&2; \
784
	  exit 1; \
785
	fi
Iustin Pop's avatar
Iustin Pop committed
786 787
	@rm -f $(notdir $@).tix
	$(GHC) --make \
Iustin Pop's avatar
Iustin Pop committed
788
	  $(HFLAGS) \
789
	  $(HS_PARALLEL3) $(HS_REGEX_PCRE) \
Iustin Pop's avatar
Iustin Pop committed
790
	  -osuf $(notdir $@).o -hisuf $(notdir $@).hi \
791
	  $(HEXTRA) $(HEXTRA_INT) $@
792 793
	@touch "$@"

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

797
# we compile the hpc-htools binary with the program coverage
798
test/hs/hpc-htools: HEXTRA_INT=-fhpc
799

800
# we compile the hpc-mon-collector binary with the program coverage
801
test/hs/hpc-mon-collector: HEXTRA_INT=-fhpc
802

803
# test dependency
804
test/hs/offline-tests.sh: test/hs/hpc-htools test/hs/hpc-mon-collector
805

806 807 808 809 810 811
# 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
812 813 814 815
	@if [ -z "$(TARGET)" ]; then \
	  echo "You need to define TARGET when running this rule" 1>&2; \
	  exit 1; \
	fi