Makefile.am 49 KB
Newer Older
1
2
3
4
5
# Ganeti makefile
# - Indent with tabs only.
# - Keep files sorted; one line per file.
# - Directories in lib/ must have their own *dir variable (see hypervisor).
# - All directories must be listed DIRS.
Michael Hanselmann's avatar
Michael Hanselmann committed
6
# - Use autogen.sh to generate Makefile.in and configure script.
7
8
9
10
11

# Automake doesn't export these variables before version 1.10.
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@

12
13
14
15
16
# Helper values for calling builtin functions
empty :=
space := $(empty) $(empty)
comma := ,

17
18
19
# Use bash in order to be able to use pipefail
SHELL=/bin/bash

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

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

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

57
58
59
HTOOLS_DIRS = \
	htools \
	htools/Ganeti \
Iustin Pop's avatar
Iustin Pop committed
60
	htools/Ganeti/Confd \
61
	htools/Ganeti/HTools \
62
	htools/Ganeti/HTools/Backend \
63
	htools/Ganeti/HTools/Program \
Iustin Pop's avatar
Iustin Pop committed
64
	htools/Ganeti/Query \
Iustin Pop's avatar
Iustin Pop committed
65
66
	htest \
	htest/Test \
67
	htest/Test/Ganeti \
68
	htest/Test/Ganeti/Confd \
69
	htest/Test/Ganeti/HTools \
70
	htest/Test/Ganeti/HTools/Backend \
71
	htest/Test/Ganeti/Query
72

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

106
BUILDTIME_DIR_AUTOCREATE = \
107
	scripts \
108
109
	$(APIDOC_DIR) \
	$(APIDOC_HS_DIR) \
Iustin Pop's avatar
Iustin Pop committed
110
111
112
	$(APIDOC_HS_DIR)/Ganeti \
	$(APIDOC_HS_DIR)/Ganeti/Confd \
	$(APIDOC_HS_DIR)/Ganeti/HTools \
113
	$(APIDOC_HS_DIR)/Ganeti/HTools/Backend \
114
	$(APIDOC_HS_DIR)/Ganeti/HTools/Program \
Iustin Pop's avatar
Iustin Pop committed
115
	$(APIDOC_HS_DIR)/Ganeti/Query \
Iustin Pop's avatar
Iustin Pop committed
116
	$(APIDOC_PY_DIR) \
117
118
	$(COVERAGE_DIR) \
	$(COVERAGE_HS_DIR) \
Iustin Pop's avatar
Iustin Pop committed
119
	$(COVERAGE_PY_DIR) \
120
	.hpc
121
122
123

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
124
125
126
127
128
129
130
	doc/html

DIRCHECK_EXCLUDE = \
	$(BUILDTIME_DIRS) \
	ganeti-[0-9]*.[0-9]*.[0-9]* \
	doc/html/_*

131
132
133
134
135
136
137
138
# 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
139
MAINTAINERCLEANFILES = \
140
	$(docpng) \
141
	$(maninput) \
142
	doc/install-quick.rst \
143
	doc/news.rst \
144
	doc/upgrade.rst \
145
	vcs-version
Iustin Pop's avatar
Iustin Pop committed
146

147
maintainer-clean-local:
148
	rm -rf $(BUILDTIME_DIRS)
149

150
CLEANFILES = \
151
	$(addsuffix /*.py[co],$(DIRS)) \
152
153
	$(addsuffix /*.hi,$(HTOOLS_DIRS)) \
	$(addsuffix /*.o,$(HTOOLS_DIRS)) \
154
	$(PYTHON_BOOTSTRAP) \
155
	epydoc.conf \
Iustin Pop's avatar
Iustin Pop committed
156
	$(REPLACE_VARS_SED) \
157
	$(SHELL_ENV_INIT) \
158
	daemons/daemon-util \
159
	daemons/ganeti-cleaner \
160
	devel/upload \
161
	$(BUILT_EXAMPLES) \
162
	doc/examples/bash_completion \
163
	doc/examples/bash_completion-debug \
164
	lib/_generated_rpc.py \
Iustin Pop's avatar
Iustin Pop committed
165
166
	$(man_MANS) \
	$(manhtml) \
167
	tools/kvm-ifup \
168
	tools/vcluster-setup \
169
	stamp-directories \
170
	stamp-srclinks \
171
	$(nodist_pkgpython_PYTHON) \
172
	$(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
173
	$(HS_BUILT_TEST_HELPERS) \
174
	htools/ganeti-confd \
Iustin Pop's avatar
Iustin Pop committed
175
	.hpc/*.mix htools/*.tix htest/*.tix \
176
	doc/hs-lint.html
177

Iustin Pop's avatar
Iustin Pop committed
178
GENERATED_FILES = \
Iustin Pop's avatar
Iustin Pop committed
179
	$(built_base_sources) \
180
181
182
	$(BUILT_PYTHON_SOURCES) \
	$(PYTHON_BOOTSTRAP)

183
184
185
HTOOLS_GENERATED_FILES =
if WANT_HTOOLS
HTOOLS_GENERATED_FILES += $(HS_PROGS)
186
if ENABLE_CONFD
187
HTOOLS_GENERATED_FILES += htools/hconfd htools/ganeti-confd
188
189
190
endif
endif

191
built_base_sources = \
192
193
	stamp-directories \
	stamp-srclinks
194

195
built_python_base_sources = \
196
	lib/_autoconf.py \
197
198
199
200
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
201
	lib/_generated_rpc.py
202

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

207
208
209
210
211
212
213
214
# 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 \
	doc/examples/gnt-config-backup \
	doc/examples/hooks/ipsec

215
216
217
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

218
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
219
	lib/build/__init__.py \
Iustin Pop's avatar
Iustin Pop committed
220
221
	lib/build/shell_example_lexer.py \
	lib/build/sphinx_ext.py
222

223
224
pkgpython_PYTHON = \
	lib/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
225
	lib/asyncnotifier.py \
226
227
228
229
230
	lib/backend.py \
	lib/bdev.py \
	lib/bootstrap.py \
	lib/cli.py \
	lib/cmdlib.py \
231
	lib/compat.py \
232
233
	lib/config.py \
	lib/constants.py \
234
	lib/daemon.py \
235
	lib/errors.py \
236
	lib/ht.py \
237
	lib/jqueue.py \
238
	lib/jstore.py \
239
240
241
	lib/locking.py \
	lib/luxi.py \
	lib/mcpu.py \
242
	lib/netutils.py \
243
	lib/objects.py \
244
	lib/objectutils.py \
245
	lib/opcodes.py \
246
	lib/ovf.py \
247
	lib/pathutils.py \
248
	lib/qlang.py \
249
	lib/query.py \
250
	lib/rpc.py \
251
	lib/rpc_defs.py \
252
	lib/runtime.py \
253
254
255
	lib/serializer.py \
	lib/ssconf.py \
	lib/ssh.py \
256
	lib/storage.py \
257
	lib/uidpool.py \
258
	lib/vcluster.py \
259
	lib/workerpool.py
260

261
client_PYTHON = \
262
	lib/client/__init__.py \
263
	lib/client/gnt_backup.py \
264
	lib/client/gnt_cluster.py \
265
	lib/client/gnt_debug.py \
266
	lib/client/gnt_group.py \
267
	lib/client/gnt_instance.py \
268
	lib/client/gnt_job.py \
269
	lib/client/gnt_node.py \
270
	lib/client/gnt_os.py
271

272
273
274
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
275
	lib/hypervisor/hv_chroot.py \
276
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
277
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
278
	lib/hypervisor/hv_lxc.py \
279
280
	lib/hypervisor/hv_xen.py

281
282
rapi_PYTHON = \
	lib/rapi/__init__.py \
283
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
284
	lib/rapi/client.py \
285
	lib/rapi/client_utils.py \
286
	lib/rapi/connector.py \
287
288
	lib/rapi/rlib2.py \
	lib/rapi/testutils.py
289

290
http_PYTHON = \
291
	lib/http/__init__.py \
292
	lib/http/auth.py \
293
294
	lib/http/client.py \
	lib/http/server.py
295

Guido Trotter's avatar
Guido Trotter committed
296
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
297
	lib/confd/__init__.py \
298
	lib/confd/client.py
299

Michael Hanselmann's avatar
Michael Hanselmann committed
300
masterd_PYTHON = \
301
	lib/masterd/__init__.py \
René Nussbaumer's avatar
René Nussbaumer committed
302
	lib/masterd/iallocator.py \
303
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
304

305
306
307
impexpd_PYTHON = \
	lib/impexpd/__init__.py

308
watcher_PYTHON = \
309
	lib/watcher/__init__.py \
310
311
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
312

313
server_PYTHON = \
314
	lib/server/__init__.py \
315
	lib/server/masterd.py \
316
317
	lib/server/noded.py \
	lib/server/rapi.py
318

319
320
pytools_PYTHON = \
	lib/tools/__init__.py \
321
322
	lib/tools/ensure_dirs.py \
	lib/tools/prepare_node_join.py
323

324
utils_PYTHON = \
325
	lib/utils/__init__.py \
326
	lib/utils/algo.py \
327
	lib/utils/filelock.py \
328
	lib/utils/hash.py \
329
	lib/utils/io.py \
330
	lib/utils/log.py \
331
	lib/utils/mlock.py \
332
	lib/utils/nodesetup.py \
333
	lib/utils/process.py \
334
	lib/utils/retry.py \
335
	lib/utils/text.py \
336
337
	lib/utils/wrapper.py \
	lib/utils/x509.py
338

Michael Hanselmann's avatar
Michael Hanselmann committed
339
docrst = \
340
	doc/admin.rst \
Iustin Pop's avatar
Iustin Pop committed
341
	doc/cluster-merge.rst \
342
	doc/design-2.0.rst \
343
	doc/design-2.1.rst \
344
	doc/design-2.2.rst \
Guido Trotter's avatar
Guido Trotter committed
345
	doc/design-2.3.rst \
346
	doc/design-2.4.rst \
347
	doc/design-2.5.rst \
348
	doc/design-2.6.rst \
349
	doc/design-2.7.rst \
Iustin Pop's avatar
Iustin Pop committed
350
351
352
	doc/design-autorepair.rst \
	doc/design-bulk-create.rst \
	doc/design-chained-jobs.rst \
Tsachy Shacham's avatar
Tsachy Shacham committed
353
	doc/design-cpu-pinning.rst \
Iustin Pop's avatar
Iustin Pop committed
354
355
	doc/design-draft.rst \
	doc/design-htools-2.3.rst \
356
	doc/design-http-server.rst \
357
	doc/design-impexp2.rst \
358
	doc/design-lu-generated-jobs.rst \
359
	doc/design-linuxha.rst \
360
	doc/design-multi-reloc.rst \
361
	doc/design-network.rst \
Iustin Pop's avatar
Iustin Pop committed
362
	doc/design-oob.rst \
363
	doc/design-ovf-support.rst \
Iustin Pop's avatar
Iustin Pop committed
364
365
366
	doc/design-partitioned.rst \
	doc/design-query-splitting.rst \
	doc/design-query2.rst \
367
	doc/design-remote-commands.rst \
368
	doc/design-resource-model.rst \
369
	doc/design-shared-storage.rst \
370
	doc/design-ssh-setup.rst \
371
	doc/design-monitoring-agent.rst \
372
	doc/design-virtual-clusters.rst \
Iustin Pop's avatar
Iustin Pop committed
373
	doc/design-x509-ca.rst \
374
	doc/devnotes.rst \
375
	doc/glossary.rst \
376
	doc/hooks.rst \
377
	doc/iallocator.rst \
378
	doc/index.rst \
379
	doc/install-quick.rst \
380
	doc/install.rst \
381
	doc/locking.rst \
382
	doc/move-instance.rst \
Iustin Pop's avatar
Iustin Pop committed
383
	doc/news.rst \
384
	doc/ovfconverter.rst \
385
	doc/rapi.rst \
386
	doc/security.rst \
387
	doc/upgrade.rst \
388
	doc/virtual-cluster.rst \
Iustin Pop's avatar
Iustin Pop committed
389
	doc/walkthrough.rst
Michael Hanselmann's avatar
Michael Hanselmann committed
390

391
HS_PROGS = htools/htools
392
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck
393
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
394

395
396
397
398
399
400
401
HS_ALL_PROGS = \
	$(HS_PROGS) \
	htest/hpc-htools \
	htest/test \
	htools/hconfd \
	htools/rpc-test

402
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
403
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=htest/%) htest/hail
404

405
406
HFLAGS = -O -Wall -Werror -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
407
HEXTRA =
Iustin Pop's avatar
Iustin Pop committed
408
# internal extra flags (used for htest/test mainly)
409
HEXTRA_INT =
410
# exclude options for coverage reports
411
HPCEXCL = --exclude Main \
412
	--exclude Ganeti.Constants \
413
	--exclude Ganeti.HTools.QC \
Iustin Pop's avatar
Iustin Pop committed
414
	--exclude Ganeti.THH \
415
	--exclude Ganeti.Version \
416
	--exclude Test.Ganeti.TestCommon \
417
418
	--exclude Test.Ganeti.TestHTools \
	--exclude Test.Ganeti.TestHelper \
419
	--exclude Test.Ganeti.TestImports \
420
	$(patsubst htools.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
421

422
HS_LIB_SRCS = \
Iustin Pop's avatar
Iustin Pop committed
423
424
425
426
427
428
429
430
	htools/Ganeti/BasicTypes.hs \
	htools/Ganeti/Common.hs \
	htools/Ganeti/Compat.hs \
	htools/Ganeti/Confd.hs \
	htools/Ganeti/Confd/Server.hs \
	htools/Ganeti/Confd/Utils.hs \
	htools/Ganeti/Config.hs \
	htools/Ganeti/Daemon.hs \
431
	htools/Ganeti/Errors.hs \
432
433
434
435
436
	htools/Ganeti/HTools/Backend/IAlloc.hs \
	htools/Ganeti/HTools/Backend/Luxi.hs \
	htools/Ganeti/HTools/Backend/Rapi.hs \
	htools/Ganeti/HTools/Backend/Simu.hs \
	htools/Ganeti/HTools/Backend/Text.hs \
437
438
439
440
441
442
443
444
445
	htools/Ganeti/HTools/CLI.hs \
	htools/Ganeti/HTools/Cluster.hs \
	htools/Ganeti/HTools/Container.hs \
	htools/Ganeti/HTools/ExtLoader.hs \
	htools/Ganeti/HTools/Group.hs \
	htools/Ganeti/HTools/Instance.hs \
	htools/Ganeti/HTools/Loader.hs \
	htools/Ganeti/HTools/Node.hs \
	htools/Ganeti/HTools/PeerMap.hs \
446
	htools/Ganeti/HTools/Program.hs \
447
	htools/Ganeti/HTools/Program/Hail.hs \
448
	htools/Ganeti/HTools/Program/Hbal.hs \
449
	htools/Ganeti/HTools/Program/Hcheck.hs \
450
	htools/Ganeti/HTools/Program/Hinfo.hs \
451
	htools/Ganeti/HTools/Program/Hscan.hs \
452
	htools/Ganeti/HTools/Program/Hspace.hs \
Iustin Pop's avatar
Iustin Pop committed
453
	htools/Ganeti/HTools/Types.hs \
454
	htools/Ganeti/Hash.hs \
455
	htools/Ganeti/JSON.hs \
Iustin Pop's avatar
Iustin Pop committed
456
	htools/Ganeti/Jobs.hs \
Iustin Pop's avatar
Iustin Pop committed
457
	htools/Ganeti/Logging.hs \
458
	htools/Ganeti/Luxi.hs \
459
	htools/Ganeti/Objects.hs \
460
	htools/Ganeti/OpCodes.hs \
461
	htools/Ganeti/Path.hs \
462
	htools/Ganeti/Query/Common.hs \
Iustin Pop's avatar
Iustin Pop committed
463
	htools/Ganeti/Query/Filter.hs \
Agata Murawska's avatar
Agata Murawska committed
464
	htools/Ganeti/Query/Group.hs \
465
	htools/Ganeti/Query/Language.hs \
466
	htools/Ganeti/Query/Node.hs \
467
	htools/Ganeti/Query/Query.hs \
468
	htools/Ganeti/Query/Server.hs \
469
	htools/Ganeti/Query/Types.hs \
470
	htools/Ganeti/Rpc.hs \
Iustin Pop's avatar
Iustin Pop committed
471
	htools/Ganeti/Runtime.hs \
Iustin Pop's avatar
Iustin Pop committed
472
	htools/Ganeti/Ssconf.hs \
473
474
	htools/Ganeti/THH.hs \
	htools/Ganeti/Utils.hs
475
476

HS_TEST_SRCS = \
477
	htest/Test/Ganeti/BasicTypes.hs \
Iustin Pop's avatar
Iustin Pop committed
478
	htest/Test/Ganeti/Common.hs \
Iustin Pop's avatar
Iustin Pop committed
479
	htest/Test/Ganeti/Confd/Utils.hs \
Iustin Pop's avatar
Iustin Pop committed
480
	htest/Test/Ganeti/Daemon.hs \
481
	htest/Test/Ganeti/Errors.hs \
482
483
	htest/Test/Ganeti/HTools/Backend/Simu.hs \
	htest/Test/Ganeti/HTools/Backend/Text.hs \
484
485
486
487
488
489
490
491
	htest/Test/Ganeti/HTools/CLI.hs \
	htest/Test/Ganeti/HTools/Cluster.hs \
	htest/Test/Ganeti/HTools/Container.hs \
	htest/Test/Ganeti/HTools/Instance.hs \
	htest/Test/Ganeti/HTools/Loader.hs \
	htest/Test/Ganeti/HTools/Node.hs \
	htest/Test/Ganeti/HTools/PeerMap.hs \
	htest/Test/Ganeti/HTools/Types.hs \
492
493
	htest/Test/Ganeti/JSON.hs \
	htest/Test/Ganeti/Jobs.hs \
494
	htest/Test/Ganeti/Luxi.hs \
495
	htest/Test/Ganeti/Objects.hs \
496
	htest/Test/Ganeti/OpCodes.hs \
Iustin Pop's avatar
Iustin Pop committed
497
	htest/Test/Ganeti/Query/Filter.hs \
498
	htest/Test/Ganeti/Query/Language.hs \
499
	htest/Test/Ganeti/Query/Query.hs \
500
	htest/Test/Ganeti/Rpc.hs \
501
	htest/Test/Ganeti/Ssconf.hs \
502
	htest/Test/Ganeti/THH.hs \
503
504
	htest/Test/Ganeti/TestCommon.hs \
	htest/Test/Ganeti/TestHTools.hs \
505
506
	htest/Test/Ganeti/TestHelper.hs \
	htest/Test/Ganeti/Utils.hs
507

508
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
509

510
511
512
HS_BUILT_SRCS = \
	htest/Test/Ganeti/TestImports.hs \
	htools/Ganeti/Constants.hs \
513
	htools/Ganeti/Version.hs
514
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
515

516
$(RUN_IN_TEMPDIR): | stamp-directories
517

Iustin Pop's avatar
Iustin Pop committed
518
519
520
521
522
# 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
523
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
524
525
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
526
	| $(BUILT_PYTHON_SOURCES)
527
528
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
529
	@mkdir_p@ $(dir $@)
530
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
531
	    -d . \
532
533
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
534
535
536
537
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

538
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
539

540
doc/install-quick.rst: INSTALL
541
doc/news.rst: NEWS
542
doc/upgrade.rst: UPGRADE
543

544
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
545
546
547
548
549
550
551
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

552
docdot = \
553
554
555
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
556

557
docpng = $(patsubst %.dot,%.png,$(docdot))
558

559
560
561
562
563
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	devel/upload \
	doc/html \
564
	$(BUILT_EXAMPLES) \
565
	doc/examples/bash_completion \
566
	doc/examples/bash_completion-debug \
567
	$(manhtml)
568

569
gnt_scripts = \
570
571
572
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
573
	scripts/gnt-group \
574
575
576
577
578
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

579
PYTHON_BOOTSTRAP_SBIN = \
580
	daemons/ganeti-masterd \
581
	daemons/ganeti-noded \
582
	daemons/ganeti-rapi \
Iustin Pop's avatar
Iustin Pop committed
583
	daemons/ganeti-watcher \
584
	$(gnt_scripts)
585

586
587
PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
588
589
	tools/ensure-dirs \
	tools/prepare-node-join
590

591
qa_scripts = \
592
	qa/__init__.py \
593
594
595
596
597
598
	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
599
	qa/qa_group.py \
600
	qa/qa_instance.py \
601
	qa/qa_job.py \
602
603
604
605
606
607
	qa/qa_node.py \
	qa/qa_os.py \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

608
609
bin_SCRIPTS =
if WANT_HTOOLS
610
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
611
612
install-exec-hook:
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
613
614
# FIXME: this is a hardcoded logic, instead of auto-resolving
	$(LN_S) -f ../../../bin/htools \
615
		   $(DESTDIR)$(iallocatorsdir)/hail
616
	for role in $(HS_BIN_ROLES); do \
617
		$(LN_S) -f htools \
618
619
			   $(DESTDIR)$(bindir)/$$role ; \
	done
620
621
endif

622
$(HS_ALL_PROGS): %: %.hs $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS) Makefile
623
624
625
	@if [ "$(notdir $@)" = "test" ] && [ "$(HTOOLS_NODEV)" ]; then \
	  echo "Error: cannot run unittests without the development" \
	       " libraries (see devnotes.rst)" 1>&2; \
626
	  exit 1; \
627
	fi
Iustin Pop's avatar
Iustin Pop committed
628
629
	@rm -f $(notdir $@).tix
	$(GHC) --make \
Iustin Pop's avatar
Iustin Pop committed
630
	  $(HFLAGS) \
631
	  $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) $(HTOOLS_REGEX_PCRE) \
Iustin Pop's avatar
Iustin Pop committed
632
	  -osuf $(notdir $@).o -hisuf $(notdir $@).hi \
633
	  $(HEXTRA) $(HEXTRA_INT) $@
634
635
	@touch "$@"

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

639
# we compile the hpc-htools binary with the program coverage
Iustin Pop's avatar
Iustin Pop committed
640
htest/hpc-htools: HEXTRA_INT=-fhpc
641

642
# test dependency
Iustin Pop's avatar
Iustin Pop committed
643
htest/offline-tests.sh: htest/hpc-htools
644

645
646
647
648
649
650
# 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:
651
652
	$(MAKE) $(AM_MAKEFLAGS) clean
	$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf .o"
653
	rm -f $(HS_ALL_PROGS)
654
	$(MAKE) $(AM_MAKEFLAGS) hs-prof-quick
655
656

hs-prof-quick:
657
	$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf .prof_o -prof -auto-all"
658

659
660
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
661

662
nodist_sbin_SCRIPTS = \
663
	$(PYTHON_BOOTSTRAP_SBIN) \
664
	daemons/ganeti-cleaner
665

666
if ENABLE_CONFD
667
668
669
670
htools/ganeti-confd: htools/hconfd
	cp -f $< $@

nodist_sbin_SCRIPTS += htools/ganeti-confd
671
672
endif

673
python_scripts = \
674
675
676
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
677
	tools/cfgupgrade12 \
678
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
679
	tools/confd-client \
680
	tools/fmtjson \
Iustin Pop's avatar
Iustin Pop committed
681
	tools/lvmstrap \
682
	tools/move-instance \
683
	tools/ovfconverter \
Iustin Pop's avatar
Iustin Pop committed
684
685
	tools/sanitize-config \
	tools/setup-ssh
686

687
dist_tools_SCRIPTS = \
688
	$(python_scripts) \
689
	tools/kvm-console-wrapper \
Iustin Pop's avatar
Iustin Pop committed
690
691
	tools/master-ip-setup \
	tools/xm-console-wrapper
692

693
694
695
nodist_tools_SCRIPTS = \
	tools/vcluster-setup

696
pkglib_python_scripts = \
697
698
	daemons/import-export \
	tools/check-cert-expired
699

700
nodist_pkglib_python_scripts = \
701
702
	tools/ensure-dirs \
	tools/prepare-node-join
703

704
myexeclib_SCRIPTS = \
705
	daemons/daemon-util \
706
	tools/kvm-ifup \
707
	$(pkglib_python_scripts)
708

709
nodist_myexeclib_SCRIPTS = \
710
711
	$(nodist_pkglib_python_scripts)

712
713
EXTRA_DIST = \
	NEWS \
714
	UPGRADE \
715
	epydoc.conf.in \
Michael Hanselmann's avatar
Michael Hanselmann committed
716
	pylintrc \
717
	autotools/build-bash-completion \
718
	autotools/build-rpc \
719
	autotools/check-header \
720
	autotools/check-imports \
Iustin Pop's avatar
Iustin Pop committed
721
	autotools/check-man-dashes \
722
	autotools/check-man-warnings \
723
	autotools/check-news \
Iustin Pop's avatar
Iustin Pop committed
724
	autotools/check-python-code \
725
	autotools/check-tar \
726
	autotools/check-version \
727
	autotools/convert-constants \
728
	autotools/docpp \
729
	autotools/gen-coverage \
730
	autotools/testrunner \
731
	autotools/wrong-hardcoded-paths \
732
	$(RUN_IN_TEMPDIR) \
733
	daemons/daemon-util.in \
734
	daemons/ganeti-cleaner.in \
735
	$(pkglib_python_scripts) \
736
	devel/upload.in \
737
	tools/kvm-ifup.in \
738
	tools/vcluster-setup.in \
739
	$(docdot) \
740
	$(docpng) \
741
742
743
	$(docrst) \
	doc/conf.py \
	doc/html \
744
	$(BUILT_EXAMPLES:%=%.in) \
745
746
	doc/examples/ganeti.default \
	doc/examples/ganeti.default-debug \
Guido Trotter's avatar
Guido Trotter committed
747
	doc/examples/hooks/ethers \
748
749
750
	doc/examples/gnt-debug/README \
	doc/examples/gnt-debug/delay0.json \
	doc/examples/gnt-debug/delay50.json \
751
	test/lockperf.py \
752
753
754
755
	test/testutils.py \
	test/mocks.py \
	$(dist_TESTS) \
	$(TEST_FILES) \
Iustin Pop's avatar
Iustin Pop committed
756
757
	man/footer.rst \
	$(manrst) \
758
	$(maninput) \
Michael Hanselmann's avatar
Michael Hanselmann committed
759
	qa/qa-sample.json \
760
	$(qa_scripts) \
761
	$(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS_IN) \
762
	$(HS_PROG_SRCS) \
763
	htools/lint-hints.hs \
Iustin Pop's avatar
Iustin Pop committed
764
	htest/cli-tests-defs.sh \
Iustin Pop's avatar
Iustin Pop committed
765
766
	htest/offline-test.sh \
	.ghci
767
768

man_MANS = \
769
	man/ganeti-cleaner.8 \
Guido Trotter's avatar
Guido Trotter committed
770
	man/ganeti-confd.8 \
771
	man/ganeti-listrunner.8 \
772
	man/ganeti-masterd.8 \
773
774
	man/ganeti-noded.8 \
	man/ganeti-os-interface.7 \
Iustin Pop's avatar