Makefile.am 56.8 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
67
68
69
70
71
	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 \
72
73
74
75
76
77
78
79
80
	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
81

82
83
84
# Haskell directories without the roots (src, test/hs)
HS_DIRS_NOROOT = $(filter-out src,$(filter-out test/hs,$(HS_DIRS)))

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

121
ALL_APIDOC_HS_DIRS = \
122
	$(APIDOC_HS_DIR) \
123
	$(patsubst %,$(APIDOC_HS_DIR)/%,$(call strip_hsroot,$(HS_DIRS_NOROOT)))
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
	doc/html \
	doc/man-html
139
140
141
142

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

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

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

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

Iustin Pop's avatar
Iustin Pop committed
195
GENERATED_FILES = \
Iustin Pop's avatar
Iustin Pop committed
196
	$(built_base_sources) \
197
198
199
	$(BUILT_PYTHON_SOURCES) \
	$(PYTHON_BOOTSTRAP)

200
HS_GENERATED_FILES =
201
if WANT_HTOOLS
202
HS_GENERATED_FILES += $(HS_PROGS)
203
if ENABLE_CONFD
204
HS_GENERATED_FILES += src/hconfd src/ganeti-confd
205
206
207
endif
endif

208
built_base_sources = \
209
210
	stamp-directories \
	stamp-srclinks
211

212
built_python_base_sources = \
213
	lib/_autoconf.py \
214
215
216
217
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
218
	lib/_generated_rpc.py
219

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

224
225
226
227
228
# 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 \
229
	doc/examples/ganeti-master-role.ocf \
230
	doc/examples/ganeti-node-role.ocf \
231
232
233
	doc/examples/gnt-config-backup \
	doc/examples/hooks/ipsec

234
235
236
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

237
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
238
	lib/build/__init__.py \
Iustin Pop's avatar
Iustin Pop committed
239
240
	lib/build/shell_example_lexer.py \
	lib/build/sphinx_ext.py
241

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

281
client_PYTHON = \
282
	lib/client/__init__.py \
283
	lib/client/gnt_backup.py \
284
	lib/client/gnt_cluster.py \
285
	lib/client/gnt_debug.py \
286
	lib/client/gnt_group.py \
287
	lib/client/gnt_instance.py \
288
	lib/client/gnt_job.py \
289
	lib/client/gnt_node.py \
290
	lib/client/gnt_network.py \
291
292
	lib/client/gnt_os.py \
	lib/client/gnt_storage.py
293

294
295
296
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
297
	lib/hypervisor/hv_chroot.py \
298
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
299
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
300
	lib/hypervisor/hv_lxc.py \
301
302
	lib/hypervisor/hv_xen.py

303
304
rapi_PYTHON = \
	lib/rapi/__init__.py \
305
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
306
	lib/rapi/client.py \
307
	lib/rapi/client_utils.py \
308
	lib/rapi/connector.py \
309
310
	lib/rapi/rlib2.py \
	lib/rapi/testutils.py
311

312
http_PYTHON = \
313
	lib/http/__init__.py \
314
	lib/http/auth.py \
315
316
	lib/http/client.py \
	lib/http/server.py
317

Guido Trotter's avatar
Guido Trotter committed
318
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
319
	lib/confd/__init__.py \
320
	lib/confd/client.py
321

Michael Hanselmann's avatar
Michael Hanselmann committed
322
masterd_PYTHON = \
323
	lib/masterd/__init__.py \
René Nussbaumer's avatar
René Nussbaumer committed
324
	lib/masterd/iallocator.py \
325
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
326

327
328
329
impexpd_PYTHON = \
	lib/impexpd/__init__.py

330
watcher_PYTHON = \
331
	lib/watcher/__init__.py \
332
333
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
334

335
server_PYTHON = \
336
	lib/server/__init__.py \
337
	lib/server/masterd.py \
338
339
	lib/server/noded.py \
	lib/server/rapi.py
340

341
342
pytools_PYTHON = \
	lib/tools/__init__.py \
343
	lib/tools/burnin.py \
344
	lib/tools/ensure_dirs.py \
Michael Hanselmann's avatar
Michael Hanselmann committed
345
	lib/tools/node_cleanup.py \
346
	lib/tools/node_daemon_setup.py \
347
	lib/tools/prepare_node_join.py
348

349
utils_PYTHON = \
350
	lib/utils/__init__.py \
351
	lib/utils/algo.py \
352
	lib/utils/filelock.py \
353
	lib/utils/hash.py \
354
	lib/utils/io.py \
355
	lib/utils/log.py \
356
	lib/utils/lvm.py \
357
	lib/utils/mlock.py \
358
	lib/utils/nodesetup.py \
359
	lib/utils/process.py \
360
	lib/utils/retry.py \
361
	lib/utils/text.py \
362
363
	lib/utils/wrapper.py \
	lib/utils/x509.py
364

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

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

424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
# 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
439
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck hroller
440
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
441

442
443
HS_ALL_PROGS = \
	$(HS_PROGS) \
444
445
	test/hs/hpc-htools \
	test/hs/hpc-mon-collector \
Iustin Pop's avatar
Iustin Pop committed
446
	test/hs/htest \
447
	$(HS_COMPILE_PROGS)
448

449
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
450
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
451

452
HFLAGS = \
Iustin Pop's avatar
Iustin Pop committed
453
	-O -Wall -Werror -isrc \
454
455
456
457
	-fwarn-monomorphism-restriction \
	-fwarn-tabs \
	$(GHC_BYVERSION_FLAGS)

458
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
459
HEXTRA =
Iustin Pop's avatar
Iustin Pop committed
460
# internal extra flags (used for test/hs/htest mainly)
461
HEXTRA_INT =
462
# exclude options for coverage reports
463
HPCEXCL = --exclude Main \
464
	--exclude Ganeti.Constants \
465
	--exclude Ganeti.HTools.QC \
Iustin Pop's avatar
Iustin Pop committed
466
	--exclude Ganeti.THH \
467
	--exclude Ganeti.Version \
468
	--exclude Test.Ganeti.Attoparsec \
469
	--exclude Test.Ganeti.TestCommon \
470
471
	--exclude Test.Ganeti.TestHTools \
	--exclude Test.Ganeti.TestHelper \
472
	--exclude Test.Ganeti.TestImports \
Iustin Pop's avatar
Iustin Pop committed
473
	$(patsubst src.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
474

475
HS_LIB_SRCS = \
Iustin Pop's avatar
Iustin Pop committed
476
477
478
479
480
481
482
483
484
485
486
487
488
489
	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 \
490
	src/Ganeti/DataCollectors/Types.hs \
Iustin Pop's avatar
Iustin Pop committed
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
	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 \
514
	src/Ganeti/HTools/Program/Main.hs \
Iustin Pop's avatar
Iustin Pop committed
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
	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
542
543

HS_TEST_SRCS = \
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
572
573
574
	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 \
575
	test/hs/Test/Ganeti/Runtime.hs \
576
577
578
579
580
581
582
	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
583

584
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
585

586
HS_BUILT_SRCS = \
587
	test/hs/Test/Ganeti/TestImports.hs \
Iustin Pop's avatar
Iustin Pop committed
588
589
	src/Ganeti/Constants.hs \
	src/Ganeti/Version.hs
590
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
591

592
593
HS_LIBTESTBUILT_SRCS = $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS)

594
$(RUN_IN_TEMPDIR): | stamp-directories
595

596
597
598
599
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
600
601
602
603
604
# 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
605
606
doc/html/index.html doc/man-html/index.html: $(docinput) doc/conf.py \
	configure.ac $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
607
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
608
	doc/css/style.css \
609
	| $(BUILT_PYTHON_SOURCES)
610
611
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
612
613
614
615
616
617
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
618
619
620
621
622
623
## 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.
624
625
	dir=$(dir $@) && \
	@mkdir_p@ $$dir && \
626
627
	PYTHONPATH=. ENABLE_MANPAGES=$(ENABLE_MANPAGES) COPY_DOC=1 \
	$(RUN_IN_TEMPDIR) autotools/sphinx-wrapper $(SPHINX) -q -W -b html \
628
	    -d . \
629
630
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
631
	    -D graphviz_dot="$(DOT)" \
632
633
634
	    -D enable_manpages="$(ENABLE_MANPAGES)" \
	    doc $(CURDIR)/$$dir && \
	rm -f $$dir/.buildinfo $$dir/objects.inv
635
636
	touch $@

637
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
638

639
640
doc/man-html: doc/man-html/index.html

641
doc/install-quick.rst: INSTALL
642
doc/news.rst: NEWS
643
doc/upgrade.rst: UPGRADE
644

645
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
646
647
648
649
650
651
652
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
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

681
682
683
684
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	doc/html \
685
	$(BUILT_EXAMPLES) \
686
	doc/examples/bash_completion \
687
	doc/examples/bash_completion-debug \
688
	$(manhtml)
689

690
691
692
693
if MANPAGES_IN_DOC
noinst_DATA += doc/man-html
endif

694
gnt_scripts = \
695
696
697
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
698
	scripts/gnt-group \
699
700
	scripts/gnt-instance \
	scripts/gnt-job \
701
	scripts/gnt-network \
702
	scripts/gnt-node \
703
704
	scripts/gnt-os \
	scripts/gnt-storage
705

706
PYTHON_BOOTSTRAP_SBIN = \
707
	daemons/ganeti-masterd \
708
	daemons/ganeti-noded \
709
	daemons/ganeti-rapi \
Iustin Pop's avatar
Iustin Pop committed
710
	daemons/ganeti-watcher \
711
	$(gnt_scripts)
712

713
714
PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
715
	tools/burnin \
716
	tools/ensure-dirs \
Michael Hanselmann's avatar
Michael Hanselmann committed
717
	tools/node-cleanup \
718
	tools/node-daemon-setup \
719
	tools/prepare-node-join
720

721
qa_scripts = \
722
	qa/__init__.py \
723
724
725
726
727
728
	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
729
	qa/qa_group.py \
730
	qa/qa_instance.py \
731
	qa/qa_job.py \
732
733
734
735
736
737
	qa/qa_node.py \
	qa/qa_os.py \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

738
739
bin_SCRIPTS =
if WANT_HTOOLS
740
bin_SCRIPTS += $(HS_BIN_PROGS)
741
742
install-exec-hook:
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
743
744
# FIXME: this is a hardcoded logic, instead of auto-resolving
	$(LN_S) -f ../../../bin/htools \
Iustin Pop's avatar
Iustin Pop committed
745
	  $(DESTDIR)$(iallocatorsdir)/hail
746
	for role in $(HS_BIN_ROLES); do \
Iustin Pop's avatar
Iustin Pop committed
747
	  $(LN_S) -f htools $(DESTDIR)$(bindir)/$$role ; \
748
	done
749
750
endif

751
$(HS_ALL_PROGS): %: %.hs $(HS_LIBTESTBUILT_SRCS) Makefile
752
	@if [ "$(notdir $@)" = "test" ] && [ "$(HS_NODEV)" ]; then \
753
754
	  echo "Error: cannot run unittests without the development" \
	       " libraries (see devnotes.rst)" 1>&2; \
755
	  exit 1; \
756
	fi
Iustin Pop's avatar
Iustin Pop committed
757
758
	@rm -f $(notdir $@).tix
	$(GHC) --make \
Iustin Pop's avatar
Iustin Pop committed
759
	  $(HFLAGS) \
760
	  $(HS_NOCURL) $(HS_PARALLEL3) $(HS_REGEX_PCRE) \
Iustin Pop's avatar
Iustin Pop committed
761
	  -osuf $(notdir $@).o -hisuf $(notdir $@).hi \
762
	  $(HEXTRA) $(HEXTRA_INT) $@
763
764
	@touch "$@"

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

768
# we compile the hpc-htools binary with the program coverage
769
test/hs/hpc-htools: HEXTRA_INT=-fhpc
770

771
# we compile the hpc-mon-collector binary with the program coverage
772
test/hs/hpc-mon-collector: HEXTRA_INT=-fhpc
773

774
# test dependency
775
test/hs/offline-tests.sh: test/hs/hpc-htools test/hs/hpc-mon-collector
776

777
778
779
780
781
782
# 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
783
784
785
786
	@if [ -z "$(TARGET)" ]; then \
	  echo "You need to define TARGET when running this rule" 1>&2; \
	  exit 1; \
	fi
787
	$(MAKE) $(AM_MAKEFLAGS) clean
Iustin Pop's avatar
Iustin Pop committed
788
	$(MAKE) $(AM_MAKEFLAGS) $(TARGET) HEXTRA="-osuf o"
789
	rm -f $(HS_ALL_PROGS)
790
	$(MAKE) $(AM_MAKEFLAGS) hs-prof-quick
791
792

hs-prof-quick:
Iustin Pop's avatar
Iustin Pop committed
793
794
795
796
797
	@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"
798

799
800
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
801

802
nodist_sbin_SCRIPTS = \
803
	$(PYTHON_BOOTSTRAP_SBIN) \
804
	daemons/ganeti-cleaner
805

806
if ENABLE_CONFD
Iustin Pop's avatar
Iustin Pop committed
807
src/ganeti-confd: src/hconfd
808
809
	cp -f $< $@

Iustin Pop's avatar
Iustin Pop committed
810
nodist_sbin_SCRIPTS += src/ganeti-confd
811
812
endif

813
python_scripts = \
814
815
	tools/cfgshell \
	tools/cfgupgrade \
816
	tools/cfgupgrade12 \
817
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
818
	tools/confd-client \
819
	tools/fmtjson \
Iustin Pop's avatar
Iustin Pop committed
820
	tools/lvmstrap \
821
	tools/move-instance \
822
	tools/ovfconverter \
Michael Hanselmann's avatar
Michael Hanselmann committed
823
	tools/sanitize-config
824

825
dist_tools_SCRIPTS = \
826
	$(python_scripts) \
Guido Trotter's avatar
Guido Trotter committed
827
	tools/burnin \
828
	tools/kvm-console-wrapper \
Iustin Pop's avatar
Iustin Pop committed
829
	tools/master-ip-setup \
830
	tools/xen-console-wrapper
831

Michael Hanselmann's avatar
Michael Hanselmann committed
832
833
834
nodist_tools_python_scripts = \
	tools/node-cleanup

835
nodist_tools_SCRIPTS = \
Michael Hanselmann's avatar
Michael Hanselmann committed
836
	$(nodist_tools_python_scripts) \
837
	tools/users-setup \
838
839
	tools/vcluster-setup

840
pkglib_python_scripts = \
841
842
	daemons/import-export \
	tools/check-cert-expired
843

844
nodist_pkglib_python_scripts = \
845
	tools/ensure-dirs \
846
	tools/node-daemon-setup \
847
	tools/prepare-node-join
848

849
myexeclib_SCRIPTS = \
850
	daemons/daemon-util \
851
	tools/kvm-ifup \
852
	$(pkglib_python_scripts) \