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

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

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

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

20
ACLOCAL_AMFLAGS = -I autotools
21
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
22
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
23
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
24
CHECK_HEADER = $(top_srcdir)/autotools/check-header
Iustin Pop's avatar
Iustin Pop committed
25
CHECK_MAN_DASHES = $(top_srcdir)/autotools/check-man-dashes
26
CHECK_MAN_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/Program \
Iustin Pop's avatar
Iustin Pop committed
63
	htools/Ganeti/Query \
Iustin Pop's avatar
Iustin Pop committed
64
65
	htest \
	htest/Test \
66
	htest/Test/Ganeti \
67
	htest/Test/Ganeti/Confd \
68
	htest/Test/Ganeti/HTools \
69
	htest/Test/Ganeti/Query
70

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

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

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
121
122
123
124
125
126
127
	doc/html

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

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

144
maintainer-clean-local:
145
	rm -rf $(BUILDTIME_DIRS)
146

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

Iustin Pop's avatar
Iustin Pop committed
175
GENERATED_FILES = \
Iustin Pop's avatar
Iustin Pop committed
176
	$(built_base_sources) \
177
178
179
	$(BUILT_PYTHON_SOURCES) \
	$(PYTHON_BOOTSTRAP)

180
181
182
HTOOLS_GENERATED_FILES =
if WANT_HTOOLS
HTOOLS_GENERATED_FILES += $(HS_PROGS)
183
if ENABLE_CONFD
184
HTOOLS_GENERATED_FILES += htools/hconfd htools/ganeti-confd
185
186
187
endif
endif

188
built_base_sources = \
189
190
	stamp-directories \
	stamp-srclinks
191

192
built_python_base_sources = \
193
	lib/_autoconf.py \
194
195
196
197
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
198
	lib/_generated_rpc.py
199

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

204
205
206
207
208
209
210
211
# 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

212
213
214
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

215
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
216
	lib/build/__init__.py \
Iustin Pop's avatar
Iustin Pop committed
217
218
	lib/build/shell_example_lexer.py \
	lib/build/sphinx_ext.py
219

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

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

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

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

287
http_PYTHON = \
288
	lib/http/__init__.py \
289
	lib/http/auth.py \
290
291
	lib/http/client.py \
	lib/http/server.py
292

Guido Trotter's avatar
Guido Trotter committed
293
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
294
	lib/confd/__init__.py \
295
	lib/confd/client.py
296

Michael Hanselmann's avatar
Michael Hanselmann committed
297
masterd_PYTHON = \
298
	lib/masterd/__init__.py \
René Nussbaumer's avatar
René Nussbaumer committed
299
	lib/masterd/iallocator.py \
300
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
301

302
303
304
impexpd_PYTHON = \
	lib/impexpd/__init__.py

305
watcher_PYTHON = \
306
	lib/watcher/__init__.py \
307
308
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
309

310
server_PYTHON = \
311
	lib/server/__init__.py \
312
	lib/server/masterd.py \
313
314
	lib/server/noded.py \
	lib/server/rapi.py
315

316
317
318
319
pytools_PYTHON = \
	lib/tools/__init__.py \
	lib/tools/ensure_dirs.py

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

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

384
HS_PROGS = htools/htools
385
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck
386
HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
387

Iustin Pop's avatar
Iustin Pop committed
388
HS_ALL_PROGS = $(HS_PROGS) htest/test htest/hpc-htools htools/hconfd
389
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
390
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=htest/%) htest/hail
391

392
393
HFLAGS = -O -Wall -Werror -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
394
HEXTRA =
Iustin Pop's avatar
Iustin Pop committed
395
# internal extra flags (used for htest/test mainly)
396
HEXTRA_INT =
397
# exclude options for coverage reports
398
HPCEXCL = --exclude Main \
399
	--exclude Ganeti.Constants \
400
	--exclude Ganeti.HTools.QC \
Iustin Pop's avatar
Iustin Pop committed
401
	--exclude Ganeti.THH \
402
	--exclude Ganeti.Version \
403
	--exclude Test.Ganeti.TestCommon \
404
405
	--exclude Test.Ganeti.TestHTools \
	--exclude Test.Ganeti.TestHelper \
406
	--exclude Test.Ganeti.TestImports \
407
	$(patsubst htools.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(HS_LIB_SRCS))))
408

409
HS_LIB_SRCS = \
Iustin Pop's avatar
Iustin Pop committed
410
411
412
413
414
415
416
417
	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 \
418
419
420
421
422
423
424
425
426
427
428
	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/IAlloc.hs \
	htools/Ganeti/HTools/Instance.hs \
	htools/Ganeti/HTools/Loader.hs \
	htools/Ganeti/HTools/Luxi.hs \
	htools/Ganeti/HTools/Node.hs \
	htools/Ganeti/HTools/PeerMap.hs \
429
	htools/Ganeti/HTools/Program.hs \
430
	htools/Ganeti/HTools/Program/Hail.hs \
431
	htools/Ganeti/HTools/Program/Hbal.hs \
432
	htools/Ganeti/HTools/Program/Hcheck.hs \
433
	htools/Ganeti/HTools/Program/Hinfo.hs \
434
	htools/Ganeti/HTools/Program/Hscan.hs \
435
	htools/Ganeti/HTools/Program/Hspace.hs \
Iustin Pop's avatar
Iustin Pop committed
436
437
438
439
	htools/Ganeti/HTools/Rapi.hs \
	htools/Ganeti/HTools/Simu.hs \
	htools/Ganeti/HTools/Text.hs \
	htools/Ganeti/HTools/Types.hs \
440
	htools/Ganeti/Hash.hs \
441
	htools/Ganeti/JSON.hs \
Iustin Pop's avatar
Iustin Pop committed
442
	htools/Ganeti/Jobs.hs \
Iustin Pop's avatar
Iustin Pop committed
443
	htools/Ganeti/Logging.hs \
444
	htools/Ganeti/Luxi.hs \
445
	htools/Ganeti/Objects.hs \
446
	htools/Ganeti/OpCodes.hs \
447
	htools/Ganeti/Path.hs \
448
	htools/Ganeti/Query/Common.hs \
Iustin Pop's avatar
Iustin Pop committed
449
	htools/Ganeti/Query/Filter.hs \
Agata Murawska's avatar
Agata Murawska committed
450
	htools/Ganeti/Query/Group.hs \
451
	htools/Ganeti/Query/Language.hs \
452
	htools/Ganeti/Query/Node.hs \
453
	htools/Ganeti/Query/Query.hs \
454
	htools/Ganeti/Query/Server.hs \
455
	htools/Ganeti/Query/Types.hs \
456
	htools/Ganeti/Rpc.hs \
Iustin Pop's avatar
Iustin Pop committed
457
	htools/Ganeti/Runtime.hs \
Iustin Pop's avatar
Iustin Pop committed
458
	htools/Ganeti/Ssconf.hs \
459
460
	htools/Ganeti/THH.hs \
	htools/Ganeti/Utils.hs
461
462

HS_TEST_SRCS = \
463
	htest/Test/Ganeti/BasicTypes.hs \
Iustin Pop's avatar
Iustin Pop committed
464
	htest/Test/Ganeti/Common.hs \
Iustin Pop's avatar
Iustin Pop committed
465
	htest/Test/Ganeti/Confd/Utils.hs \
Iustin Pop's avatar
Iustin Pop committed
466
	htest/Test/Ganeti/Daemon.hs \
467
468
469
470
471
472
473
474
475
476
	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/Simu.hs \
	htest/Test/Ganeti/HTools/Text.hs \
	htest/Test/Ganeti/HTools/Types.hs \
477
478
	htest/Test/Ganeti/JSON.hs \
	htest/Test/Ganeti/Jobs.hs \
479
	htest/Test/Ganeti/Luxi.hs \
480
	htest/Test/Ganeti/Objects.hs \
481
	htest/Test/Ganeti/OpCodes.hs \
Iustin Pop's avatar
Iustin Pop committed
482
	htest/Test/Ganeti/Query/Filter.hs \
483
	htest/Test/Ganeti/Query/Language.hs \
484
	htest/Test/Ganeti/Query/Query.hs \
485
	htest/Test/Ganeti/Rpc.hs \
486
487
488
	htest/Test/Ganeti/Ssconf.hs \
	htest/Test/Ganeti/TestCommon.hs \
	htest/Test/Ganeti/TestHTools.hs \
489
490
	htest/Test/Ganeti/TestHelper.hs \
	htest/Test/Ganeti/Utils.hs
491

492
HS_LIBTEST_SRCS = $(HS_LIB_SRCS) $(HS_TEST_SRCS)
493

494
495
496
HS_BUILT_SRCS = \
	htest/Test/Ganeti/TestImports.hs \
	htools/Ganeti/Constants.hs \
497
	htools/Ganeti/Version.hs
498
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
499

500
$(RUN_IN_TEMPDIR): | stamp-directories
501

Iustin Pop's avatar
Iustin Pop committed
502
503
504
505
506
# 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
507
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
508
509
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
510
	| $(BUILT_PYTHON_SOURCES)
511
512
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
513
	@mkdir_p@ $(dir $@)
514
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
515
	    -d . \
516
517
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
518
519
520
521
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

522
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
523

524
doc/install-quick.rst: INSTALL
525
doc/news.rst: NEWS
526
doc/upgrade.rst: UPGRADE
527

528
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
529
530
531
532
533
534
535
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

536
docdot = \
537
538
539
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
540

541
docpng = $(patsubst %.dot,%.png,$(docdot))
542

543
544
545
546
547
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	devel/upload \
	doc/html \
548
	$(BUILT_EXAMPLES) \
549
	doc/examples/bash_completion \
550
	doc/examples/bash_completion-debug \
551
	$(manhtml)
552

553
gnt_scripts = \
554
555
556
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
557
	scripts/gnt-group \
558
559
560
561
562
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

563
PYTHON_BOOTSTRAP_SBIN = \
564
	daemons/ganeti-masterd \
565
	daemons/ganeti-noded \
566
	daemons/ganeti-rapi \
Iustin Pop's avatar
Iustin Pop committed
567
	daemons/ganeti-watcher \
568
	$(gnt_scripts)
569

570
571
572
573
PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
	tools/ensure-dirs

574
qa_scripts = \
575
	qa/__init__.py \
576
577
578
579
580
581
	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
582
	qa/qa_group.py \
583
	qa/qa_instance.py \
584
	qa/qa_job.py \
585
586
587
588
589
590
	qa/qa_node.py \
	qa/qa_os.py \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

591
592
bin_SCRIPTS =
if WANT_HTOOLS
593
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
594
595
install-exec-hook:
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
596
597
# FIXME: this is a hardcoded logic, instead of auto-resolving
	$(LN_S) -f ../../../bin/htools \
598
		   $(DESTDIR)$(iallocatorsdir)/hail
599
	for role in $(HS_BIN_ROLES); do \
600
		$(LN_S) -f htools \
601
602
			   $(DESTDIR)$(bindir)/$$role ; \
	done
603
604
endif

605
$(HS_ALL_PROGS): %: %.hs $(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS) Makefile
606
607
608
	@if [ "$(notdir $@)" = "test" ] && [ "$(HTOOLS_NODEV)" ]; then \
	  echo "Error: cannot run unittests without the development" \
	       " libraries (see devnotes.rst)" 1>&2; \
609
	  exit 1; \
610
	fi
Iustin Pop's avatar
Iustin Pop committed
611
612
	@rm -f $(notdir $@).tix
	$(GHC) --make \
Iustin Pop's avatar
Iustin Pop committed
613
	  $(HFLAGS) \
614
	  $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) $(HTOOLS_REGEX_PCRE) \
Iustin Pop's avatar
Iustin Pop committed
615
	  -osuf $(notdir $@).o -hisuf $(notdir $@).hi \
616
	  $(HEXTRA) $(HEXTRA_INT) $@
617
618
	@touch "$@"

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

622
# we compile the hpc-htools binary with the program coverage
Iustin Pop's avatar
Iustin Pop committed
623
htest/hpc-htools: HEXTRA_INT=-fhpc
624

625
# test dependency
Iustin Pop's avatar
Iustin Pop committed
626
htest/offline-tests.sh: htest/hpc-htools
627

628
629
630
631
632
633
# 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:
634
635
	$(MAKE) $(AM_MAKEFLAGS) clean
	$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf .o"
636
	rm -f $(HS_ALL_PROGS)
637
	$(MAKE) $(AM_MAKEFLAGS) hs-prof-quick
638
639

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

642
643
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
644

645
nodist_sbin_SCRIPTS = \
646
	$(PYTHON_BOOTSTRAP_SBIN) \
647
	daemons/ganeti-cleaner
648

649
if ENABLE_CONFD
650
651
652
653
htools/ganeti-confd: htools/hconfd
	cp -f $< $@

nodist_sbin_SCRIPTS += htools/ganeti-confd
654
655
endif

656
python_scripts = \
657
658
659
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
660
	tools/cfgupgrade12 \
661
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
662
	tools/confd-client \
663
	tools/fmtjson \
Iustin Pop's avatar
Iustin Pop committed
664
	tools/lvmstrap \
665
	tools/move-instance \
666
	tools/ovfconverter \
Iustin Pop's avatar
Iustin Pop committed
667
668
	tools/sanitize-config \
	tools/setup-ssh
669

670
dist_tools_SCRIPTS = \
671
	$(python_scripts) \
672
	tools/kvm-console-wrapper \
Iustin Pop's avatar
Iustin Pop committed
673
674
	tools/master-ip-setup \
	tools/xm-console-wrapper
675

676
677
678
nodist_tools_SCRIPTS = \
	tools/vcluster-setup

679
pkglib_python_scripts = \
680
681
	daemons/import-export \
	tools/check-cert-expired
682

683
684
685
nodist_pkglib_python_scripts = \
	tools/ensure-dirs

686
myexeclib_SCRIPTS = \
687
	daemons/daemon-util \
688
	tools/kvm-ifup \
689
	$(pkglib_python_scripts)
690

691
nodist_myexeclib_SCRIPTS = \
692
693
	$(nodist_pkglib_python_scripts)

694
695
EXTRA_DIST = \
	NEWS \
696
	UPGRADE \
697
	epydoc.conf.in \
Michael Hanselmann's avatar
Michael Hanselmann committed
698
	pylintrc \
699
	autotools/build-bash-completion \
700
	autotools/build-rpc \
701
	autotools/check-header \
702
	autotools/check-imports \
Iustin Pop's avatar
Iustin Pop committed
703
	autotools/check-man-dashes \
704
	autotools/check-man-warnings \
705
	autotools/check-news \
Iustin Pop's avatar
Iustin Pop committed
706
	autotools/check-python-code \
707
	autotools/check-tar \
708
	autotools/check-version \
709
	autotools/convert-constants \
710
	autotools/docpp \
711
	autotools/gen-coverage \
712
	autotools/testrunner \
713
	autotools/wrong-hardcoded-paths \
714
	$(RUN_IN_TEMPDIR) \
715
	daemons/daemon-util.in \
716
	daemons/ganeti-cleaner.in \
717
	$(pkglib_python_scripts) \
718
	devel/upload.in \
719
	tools/kvm-ifup.in \
720
	tools/vcluster-setup.in \
721
	$(docdot) \
722
	$(docpng) \
723
724
725
	$(docrst) \
	doc/conf.py \
	doc/html \
726
	$(BUILT_EXAMPLES:%=%.in) \
727
728
	doc/examples/ganeti.default \
	doc/examples/ganeti.default-debug \
Guido Trotter's avatar
Guido Trotter committed
729
	doc/examples/hooks/ethers \
730
731
732
	doc/examples/gnt-debug/README \
	doc/examples/gnt-debug/delay0.json \
	doc/examples/gnt-debug/delay50.json \
733
	test/lockperf.py \
734
735
736
737
	test/testutils.py \
	test/mocks.py \
	$(dist_TESTS) \
	$(TEST_FILES) \
Iustin Pop's avatar
Iustin Pop committed
738
739
	man/footer.rst \
	$(manrst) \
740
	$(maninput) \
Michael Hanselmann's avatar
Michael Hanselmann committed
741
	qa/qa-sample.json \
742
	$(qa_scripts) \
743
	$(HS_LIBTEST_SRCS) $(HS_BUILT_SRCS_IN) \
744
	$(HS_PROG_SRCS) \
745
	htools/lint-hints.hs \
Iustin Pop's avatar
Iustin Pop committed
746
747
	htest/cli-tests-defs.sh \
	htest/offline-test.sh
748
749

man_MANS = \
750
	man/ganeti-cleaner.8 \
Guido Trotter's avatar
Guido Trotter committed
751
	man/ganeti-confd.8 \
752
	man/ganeti-listrunner.8 \
753
	man/ganeti-masterd.8 \
754
755
	man/ganeti-noded.8 \
	man/ganeti-os-interface.7 \
756
	man/ganeti-rapi.8 \
757
	man/ganeti-watcher.8 \
Iustin Pop's avatar
Iustin Pop committed
758
	man/ganeti.7 \
759
760
	man/gnt-backup.8 \
	man/gnt-cluster.8 \
761
	man/gnt-debug.8 \
762
	man/gnt-group.8 \
763
	man/gnt-instance.8 \
764
	man/gnt-job.8 \
765
	man/gnt-node.8 \
766
767
768
	man/gnt-os.8 \
	man/hail.1 \
	man/hbal.1 \
Iustin Pop's avatar
Iustin Pop committed
769
	man/hcheck.1 \
René Nussbaumer's avatar
René Nussbaumer committed
770
	man/hinfo.1 \
771
	man/hscan.1 \
Iustin Pop's avatar
Iustin Pop committed
772
773
	man/hspace.1 \
	man/htools.1
774

775
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
Iustin Pop's avatar
Iustin Pop committed
776
manhtml = $(patsubst %.rst,%.html,$(manrst))
777
mangen = $(patsubst %.rst,%.gen,$(manrst))
778
maninput = \