Makefile.am 52.7 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
HS_DIRS = \
Iustin Pop's avatar
Iustin Pop committed
58
59
60
61
62
63
64
65
66
67
	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 \
68
69
70
71
72
73
74
75
76
	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
77

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

229
230
231
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# 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
427
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck hroller
428
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
429

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

437
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
438
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
439

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

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

463
HS_LIB_SRCS = \
Iustin Pop's avatar
Iustin Pop committed
464
465
466
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
	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 \
501
	src/Ganeti/HTools/Program/Main.hs \
Iustin Pop's avatar
Iustin Pop committed
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
	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
529
530

HS_TEST_SRCS = \
531
532
533
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
	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
569

570
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
571

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

578
$(RUN_IN_TEMPDIR): | stamp-directories
579

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

602
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
603

604
doc/install-quick.rst: INSTALL
605
doc/news.rst: NEWS
606
doc/upgrade.rst: UPGRADE
607

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

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

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

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

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

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

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

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

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

698
# we compile the hpc-htools binary with the program coverage
699
test/hs/hpc-htools: HEXTRA_INT=-fhpc
700

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

704
# test dependency
705
test/hs/offline-tests.sh: test/hs/hpc-htools test/hs/hpc-mon-collector
706

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

hs-prof-quick:
Iustin Pop's avatar
Iustin Pop committed
723
724
725
726
727
	@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"
728

729
730
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
731

732
nodist_sbin_SCRIPTS = \
733
	$(PYTHON_BOOTSTRAP_SBIN) \
734
	daemons/ganeti-cleaner
735

736
if ENABLE_CONFD
Iustin Pop's avatar
Iustin Pop committed
737
src/ganeti-confd: src/hconfd
738
739
	cp -f $< $@

Iustin Pop's avatar
Iustin Pop committed
740
nodist_sbin_SCRIPTS += src/ganeti-confd
741
742
endif

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

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

Michael Hanselmann's avatar
Michael Hanselmann committed
762
763
764
nodist_tools_python_scripts = \
	tools/node-cleanup

765
nodist_tools_SCRIPTS = \
Michael Hanselmann's avatar
Michael Hanselmann committed
766
	$(nodist_tools_python_scripts) \
767
768
	tools/vcluster-setup

769
pkglib_python_scripts = \
770
771
	daemons/import-export \
	tools/check-cert-expired
772

773
nodist_pkglib_python_scripts = \
774
	tools/ensure-dirs \
775
	tools/node-daemon-setup \
776
	tools/prepare-node-join
777

778
myexeclib_SCRIPTS = \
779
	daemons/daemon-util \
780
	tools/kvm-ifup \
781
	$(pkglib_python_scripts) \
782
	$(HS_MYEXECLIB_PROGS)
783

784
nodist_myexeclib_SCRIPTS = \
785
786
	$(nodist_pkglib_python_scripts)

787
788
EXTRA_DIST = \
	NEWS \
789
	UPGRADE \
790
	epydoc.conf.in \
Michael Hanselmann's avatar
Michael Hanselmann committed
791
	pylintrc \
792
	autotools/build-bash-completion \
793
	autotools/build-rpc \
794
	autotools/check-header \
795
	autotools/check-imports \
Iustin Pop's avatar
Iustin Pop committed
796
	autotools/check-man-dashes \
797
	autotools/check-man-warnings \
798
	autotools/check-news \
Iustin Pop's avatar
Iustin Pop committed
799
	autotools/check-python-code \
800
	autotools/check-tar \
801
	autotools/check-version \
802
	autotools/convert-constants \
803
	autotools/docpp \
Iustin Pop's avatar
Iustin Pop committed
804
	autotools/gen-py-coverage \
805
	autotools/testrunner \
806
	autotools/wrong-hardcoded-paths \
807
	$(RUN_IN_TEMPDIR) \
808
	daemons/daemon-util.in \
809
	daemons/ganeti-cleaner.in \
810
	$(pkglib_python_scripts) \
811
	devel/upload \
812
	devel/webserver \
Apollon Oikonomopoulos's avatar