Makefile.am 44.4 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

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

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

56 57 58
HTOOLS_DIRS = \
	htools \
	htools/Ganeti \
Iustin Pop's avatar
Iustin Pop committed
59
	htools/Ganeti/Confd \
60
	htools/Ganeti/HTools \
61
	htools/Ganeti/HTools/Program \
Iustin Pop's avatar
Iustin Pop committed
62
	htools/Ganeti/Query \
Iustin Pop's avatar
Iustin Pop committed
63 64 65
	htest \
	htest/Test \
	htest/Test/Ganeti
66

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

99
BUILDTIME_DIR_AUTOCREATE = \
100
	scripts \
101 102 103
	$(APIDOC_DIR) \
	$(APIDOC_PY_DIR) \
	$(APIDOC_HS_DIR) \
Iustin Pop's avatar
Iustin Pop committed
104 105 106
	$(APIDOC_HS_DIR)/Ganeti \
	$(APIDOC_HS_DIR)/Ganeti/Confd \
	$(APIDOC_HS_DIR)/Ganeti/HTools \
107
	$(APIDOC_HS_DIR)/Ganeti/HTools/Program \
108 109 110
	$(COVERAGE_DIR) \
	$(COVERAGE_PY_DIR) \
	$(COVERAGE_HS_DIR) \
111
	.hpc
112 113 114

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
115 116 117 118 119 120 121
	doc/html

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

122 123 124 125 126 127 128 129
# 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
130
MAINTAINERCLEANFILES = \
131
	$(docpng) \
132
	$(maninput) \
133
	doc/install-quick.rst \
134
	doc/news.rst \
135
	doc/upgrade.rst \
136
	vcs-version
Iustin Pop's avatar
Iustin Pop committed
137

138
maintainer-clean-local:
139
	rm -rf $(BUILDTIME_DIRS)
140

141
CLEANFILES = \
142
	$(addsuffix /*.py[co],$(DIRS)) \
143 144
	$(addsuffix /*.hi,$(HTOOLS_DIRS)) \
	$(addsuffix /*.o,$(HTOOLS_DIRS)) \
145
	$(PYTHON_BOOTSTRAP) \
146
	epydoc.conf \
Iustin Pop's avatar
Iustin Pop committed
147
	$(REPLACE_VARS_SED) \
148
	daemons/daemon-util \
149
	daemons/ganeti-cleaner \
150
	devel/upload \
151
	$(BUILT_EXAMPLES) \
152
	doc/examples/bash_completion \
153
	lib/_generated_rpc.py \
Iustin Pop's avatar
Iustin Pop committed
154 155
	$(man_MANS) \
	$(manhtml) \
156
	tools/kvm-ifup \
157
	stamp-directories \
158
	stamp-srclinks \
159
	$(nodist_pkgpython_PYTHON) \
160
	$(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
161
	$(HS_BUILT_TEST_HELPERS) \
Iustin Pop's avatar
Iustin Pop committed
162
	.hpc/*.mix htools/*.tix htest/*.tix \
163
	doc/hs-lint.html
164

Iustin Pop's avatar
Iustin Pop committed
165
GENERATED_FILES = \
Iustin Pop's avatar
Iustin Pop committed
166
	$(built_base_sources) \
167 168 169 170
	$(BUILT_PYTHON_SOURCES) \
	$(PYTHON_BOOTSTRAP)

built_base_sources = \
171 172
	stamp-directories \
	stamp-srclinks
173

174
built_python_base_sources = \
175
	lib/_autoconf.py \
176 177 178 179
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
180
	lib/_generated_rpc.py
181

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

186 187 188 189 190 191 192 193
# 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

194 195 196
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

197
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
198
	lib/build/__init__.py \
199 200
	lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py
201

202 203
pkgpython_PYTHON = \
	lib/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
204
	lib/asyncnotifier.py \
205 206 207 208 209
	lib/backend.py \
	lib/bdev.py \
	lib/bootstrap.py \
	lib/cli.py \
	lib/cmdlib.py \
210
	lib/compat.py \
211 212
	lib/config.py \
	lib/constants.py \
213
	lib/daemon.py \
214
	lib/errors.py \
215
	lib/ht.py \
216
	lib/jqueue.py \
217
	lib/jstore.py \
218 219 220
	lib/locking.py \
	lib/luxi.py \
	lib/mcpu.py \
221
	lib/netutils.py \
222 223
	lib/objects.py \
	lib/opcodes.py \
224
	lib/ovf.py \
225
	lib/qlang.py \
226
	lib/query.py \
227
	lib/rpc.py \
228
	lib/rpc_defs.py \
229
	lib/runtime.py \
230 231 232
	lib/serializer.py \
	lib/ssconf.py \
	lib/ssh.py \
233
	lib/storage.py \
234
	lib/uidpool.py \
235
	lib/workerpool.py
236

237
client_PYTHON = \
238
	lib/client/__init__.py \
239
	lib/client/gnt_backup.py \
240
	lib/client/gnt_cluster.py \
241
	lib/client/gnt_debug.py \
242
	lib/client/gnt_group.py \
243
	lib/client/gnt_instance.py \
244
	lib/client/gnt_job.py \
245
	lib/client/gnt_node.py \
246
	lib/client/gnt_os.py
247

248 249 250
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
251
	lib/hypervisor/hv_chroot.py \
252
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
253
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
254
	lib/hypervisor/hv_lxc.py \
255 256
	lib/hypervisor/hv_xen.py

257 258
rapi_PYTHON = \
	lib/rapi/__init__.py \
259
	lib/rapi/baserlib.py \
David Knowles's avatar
David Knowles committed
260
	lib/rapi/client.py \
261
	lib/rapi/client_utils.py \
262
	lib/rapi/connector.py \
263 264
	lib/rapi/rlib2.py \
	lib/rapi/testutils.py
265

266
http_PYTHON = \
267
	lib/http/__init__.py \
268
	lib/http/auth.py \
269 270
	lib/http/client.py \
	lib/http/server.py
271

Guido Trotter's avatar
Guido Trotter committed
272
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
273
	lib/confd/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
274
	lib/confd/client.py \
275 276
	lib/confd/querylib.py \
	lib/confd/server.py
277

Michael Hanselmann's avatar
Michael Hanselmann committed
278
masterd_PYTHON = \
279 280
	lib/masterd/__init__.py \
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
281

282 283 284
impexpd_PYTHON = \
	lib/impexpd/__init__.py

285
watcher_PYTHON = \
286
	lib/watcher/__init__.py \
287 288
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
289

290
server_PYTHON = \
291
	lib/server/__init__.py \
292
	lib/server/confd.py \
293
	lib/server/masterd.py \
294 295
	lib/server/noded.py \
	lib/server/rapi.py
296

297 298 299 300
pytools_PYTHON = \
	lib/tools/__init__.py \
	lib/tools/ensure_dirs.py

301
utils_PYTHON = \
302
	lib/utils/__init__.py \
303
	lib/utils/algo.py \
304
	lib/utils/filelock.py \
305
	lib/utils/hash.py \
306
	lib/utils/io.py \
307
	lib/utils/log.py \
308
	lib/utils/mlock.py \
309
	lib/utils/nodesetup.py \
310
	lib/utils/process.py \
311
	lib/utils/retry.py \
312
	lib/utils/text.py \
313 314
	lib/utils/wrapper.py \
	lib/utils/x509.py
315

Michael Hanselmann's avatar
Michael Hanselmann committed
316
docrst = \
317
	doc/admin.rst \
318
	doc/design-2.0.rst \
319
	doc/design-2.1.rst \
320
	doc/design-2.2.rst \
Guido Trotter's avatar
Guido Trotter committed
321
	doc/design-2.3.rst \
322
	doc/design-htools-2.3.rst \
323
	doc/design-2.4.rst \
324
	doc/design-2.5.rst \
325
	doc/design-draft.rst \
326
	doc/design-oob.rst \
Tsachy Shacham's avatar
Tsachy Shacham committed
327
	doc/design-cpu-pinning.rst \
328
	doc/design-query2.rst \
329
	doc/design-x509-ca.rst \
330
	doc/design-http-server.rst \
331
	doc/design-impexp2.rst \
332
	doc/design-lu-generated-jobs.rst \
333
	doc/design-multi-reloc.rst \
334
	doc/design-network.rst \
Michael Hanselmann's avatar
Michael Hanselmann committed
335
	doc/design-chained-jobs.rst \
336
	doc/design-ovf-support.rst \
Guido Trotter's avatar
Guido Trotter committed
337
	doc/design-autorepair.rst \
338
	doc/design-resource-model.rst \
339
	doc/cluster-merge.rst \
340
	doc/design-shared-storage.rst \
341
	doc/design-node-state-cache.rst \
342
	doc/design-virtual-clusters.rst \
343
	doc/design-bulk-create.rst \
344
	doc/design-query-splitting.rst \
345
	doc/devnotes.rst \
346
	doc/glossary.rst \
347
	doc/hooks.rst \
348
	doc/iallocator.rst \
349
	doc/index.rst \
350
	doc/install-quick.rst \
351
	doc/install.rst \
352
	doc/locking.rst \
353
	doc/move-instance.rst \
Iustin Pop's avatar
Iustin Pop committed
354
	doc/news.rst \
355
	doc/ovfconverter.rst \
356
	doc/rapi.rst \
357
	doc/security.rst \
358
	doc/upgrade.rst \
Iustin Pop's avatar
Iustin Pop committed
359
	doc/walkthrough.rst
Michael Hanselmann's avatar
Michael Hanselmann committed
360

361
HS_PROGS = htools/htools
362
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck
363

Iustin Pop's avatar
Iustin Pop committed
364
HS_ALL_PROGS = $(HS_PROGS) htest/test htest/hpc-htools htools/hconfd
365
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
366
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=htest/%) htest/hail
367

368 369
HFLAGS = -O -Wall -Werror -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
370
HEXTRA =
Iustin Pop's avatar
Iustin Pop committed
371
# internal extra flags (used for htest/test mainly)
372
HEXTRA_INT =
373
# exclude options for coverage reports
374
HPCEXCL = --exclude Main \
375
	--exclude Ganeti.Constants \
376 377
	--exclude Ganeti.THH \
	--exclude Ganeti.HTools.QC \
378
	--exclude Ganeti.HTools.Version \
Iustin Pop's avatar
Iustin Pop committed
379 380
	--exclude Test.Ganeti.TestHelper \
	$(patsubst htools.%,--exclude Test.%,$(subst /,.,$(patsubst %.hs,%, $(filter-out htest/%,$(HS_LIB_SRCS)))))
381

382
HS_LIB_SRCS = \
383 384
	htools/Ganeti/HTools/CLI.hs \
	htools/Ganeti/HTools/Cluster.hs \
385
	htools/Ganeti/HTools/Compat.hs \
386 387 388 389 390
	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 \
391
	htools/Ganeti/HTools/JSON.hs \
392 393 394 395 396 397 398 399 400 401
	htools/Ganeti/HTools/Loader.hs \
	htools/Ganeti/HTools/Luxi.hs \
	htools/Ganeti/HTools/Node.hs \
	htools/Ganeti/HTools/PeerMap.hs \
	htools/Ganeti/HTools/QC.hs \
	htools/Ganeti/HTools/Rapi.hs \
	htools/Ganeti/HTools/Simu.hs \
	htools/Ganeti/HTools/Text.hs \
	htools/Ganeti/HTools/Types.hs \
	htools/Ganeti/HTools/Utils.hs \
402
	htools/Ganeti/HTools/Program.hs \
403
	htools/Ganeti/HTools/Program/Hail.hs \
404
	htools/Ganeti/HTools/Program/Hbal.hs \
405
	htools/Ganeti/HTools/Program/Hcheck.hs \
406
	htools/Ganeti/HTools/Program/Hinfo.hs \
407
	htools/Ganeti/HTools/Program/Hscan.hs \
408
	htools/Ganeti/HTools/Program/Hspace.hs \
409
	htools/Ganeti/BasicTypes.hs \
410
	htools/Ganeti/Confd.hs \
Iustin Pop's avatar
Iustin Pop committed
411
	htools/Ganeti/Confd/Server.hs \
412
	htools/Ganeti/Confd/Utils.hs \
413
	htools/Ganeti/Config.hs \
414
	htools/Ganeti/Daemon.hs \
415
	htools/Ganeti/Hash.hs \
416
	htools/Ganeti/Jobs.hs \
Iustin Pop's avatar
Iustin Pop committed
417
	htools/Ganeti/Logging.hs \
418
	htools/Ganeti/Luxi.hs \
419
	htools/Ganeti/Objects.hs \
420
	htools/Ganeti/OpCodes.hs \
421
	htools/Ganeti/Query/Common.hs \
Iustin Pop's avatar
Iustin Pop committed
422
	htools/Ganeti/Query/Filter.hs \
423
	htools/Ganeti/Query/Language.hs \
424
	htools/Ganeti/Query/Node.hs \
425
	htools/Ganeti/Query/Query.hs \
426
	htools/Ganeti/Query/Server.hs \
427
	htools/Ganeti/Query/Types.hs \
428
	htools/Ganeti/Rpc.hs \
Iustin Pop's avatar
Iustin Pop committed
429
	htools/Ganeti/Runtime.hs \
Iustin Pop's avatar
Iustin Pop committed
430
	htools/Ganeti/Ssconf.hs \
431
	htools/Ganeti/THH.hs \
Iustin Pop's avatar
Iustin Pop committed
432 433
	htest/Test/Ganeti/TestHelper.hs \
	htest/Test/Ganeti/Objects.hs
434

435

436
HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
437
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
438

439
$(RUN_IN_TEMPDIR): | stamp-directories
440

Iustin Pop's avatar
Iustin Pop committed
441 442 443 444 445
# 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
446
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
447 448
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
449
	| $(BUILT_PYTHON_SOURCES)
450 451
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
452
	@mkdir_p@ $(dir $@)
453
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
454
	    -d . \
455 456
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
457 458 459 460
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

461
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
462

463
doc/install-quick.rst: INSTALL
464
doc/news.rst: NEWS
465
doc/upgrade.rst: UPGRADE
466

467
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
468 469 470 471 472 473 474
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

475
docdot = \
476 477 478
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
479

480
docpng = $(patsubst %.dot,%.png,$(docdot))
481

482 483 484 485 486
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	devel/upload \
	doc/html \
487
	$(BUILT_EXAMPLES) \
488 489
	doc/examples/bash_completion \
	$(manhtml)
490

491
gnt_scripts = \
492 493 494
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
495
	scripts/gnt-group \
496 497 498 499 500
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

501
PYTHON_BOOTSTRAP_SBIN = \
502
	daemons/ganeti-masterd \
503
	daemons/ganeti-noded \
504
	daemons/ganeti-watcher \
505
	daemons/ganeti-rapi \
506
	$(gnt_scripts)
507

508 509 510 511
if PY_CONFD
PYTHON_BOOTSTRAP_SBIN += daemons/ganeti-confd
endif

512 513 514 515
PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
	tools/ensure-dirs

516
qa_scripts = \
517
	qa/__init__.py \
518 519 520 521 522 523
	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
524
	qa/qa_group.py \
525
	qa/qa_instance.py \
526
	qa/qa_job.py \
527 528 529 530 531 532
	qa/qa_node.py \
	qa/qa_os.py \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

533 534
bin_SCRIPTS =
if WANT_HTOOLS
535
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
536 537
install-exec-hook:
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
538 539
# FIXME: this is a hardcoded logic, instead of auto-resolving
	$(LN_S) -f ../../../bin/htools \
540
		   $(DESTDIR)$(iallocatorsdir)/hail
541
	for role in $(HS_BIN_ROLES); do \
542
		$(LN_S) -f htools \
543 544
			   $(DESTDIR)$(bindir)/$$role ; \
	done
545 546 547
if HS_CONFD
	mv $(DESTDIR)$(sbindir)/hconfd $(DESTDIR)$(sbindir)/ganeti-confd
endif
548 549
endif

550
$(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
551 552 553 554
	@if [ -z "$(HTOOLS)" ]; then \
	  echo "Error: htools compilation disabled at configure time" 1>&2 ;\
	  exit 1; \
	fi
Iustin Pop's avatar
Iustin Pop committed
555
	@if [ "$(notdir $@)" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
556 557
	  echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \
	  exit 1; \
558
	fi
Iustin Pop's avatar
Iustin Pop committed
559 560
	@rm -f $(notdir $@).tix
	$(GHC) --make \
Iustin Pop's avatar
Iustin Pop committed
561
	  $(HFLAGS) \
562
	  $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) \
Iustin Pop's avatar
Iustin Pop committed
563
	  -osuf $(notdir $@).o -hisuf $(notdir $@).hi \
564
	  $(HEXTRA) $(HEXTRA_INT) $@
565 566
	@touch "$@"

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

570
# we compile the hpc-htools binary with the program coverage
Iustin Pop's avatar
Iustin Pop committed
571
htest/hpc-htools: HEXTRA_INT=-fhpc
572

573
# test dependency
Iustin Pop's avatar
Iustin Pop committed
574
htest/offline-tests.sh: htest/hpc-htools
575

576 577 578 579 580 581
# 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:
582 583
	$(MAKE) $(AM_MAKEFLAGS) clean
	$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf .o"
584
	rm -f $(HS_ALL_PROGS)
585
	$(MAKE) $(AM_MAKEFLAGS) hs-prof-quick
586 587

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

590 591
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
592

593
nodist_sbin_SCRIPTS = \
594
	$(PYTHON_BOOTSTRAP_SBIN) \
595 596
	daemons/ganeti-cleaner

597 598 599 600
if HS_CONFD
nodist_sbin_SCRIPTS += htools/hconfd
endif

601
python_scripts = \
602 603 604
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
605
	tools/cfgupgrade12 \
606
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
607
	tools/confd-client \
608
	tools/fmtjson \
Iustin Pop's avatar
Iustin Pop committed
609
	tools/lvmstrap \
610
	tools/move-instance \
611
	tools/ovfconverter \
612
	tools/setup-ssh \
Iustin Pop's avatar
Iustin Pop committed
613
	tools/sanitize-config
614

615
dist_tools_SCRIPTS = \
616
	$(python_scripts) \
617
	tools/kvm-console-wrapper \
618 619
	tools/xm-console-wrapper \
	tools/master-ip-setup
620

621
pkglib_python_scripts = \
622 623
	daemons/import-export \
	tools/check-cert-expired
624

625 626 627
nodist_pkglib_python_scripts = \
	tools/ensure-dirs

628
myexeclib_SCRIPTS = \
629
	daemons/daemon-util \
630
	tools/kvm-ifup \
631
	$(pkglib_python_scripts)
632

633
nodist_myexeclib_SCRIPTS = \
634 635
	$(nodist_pkglib_python_scripts)

636 637
EXTRA_DIST = \
	NEWS \
638
	UPGRADE \
639
	epydoc.conf.in \
Michael Hanselmann's avatar
Michael Hanselmann committed
640
	pylintrc \
641
	autotools/build-bash-completion \
642
	autotools/build-rpc \
643
	autotools/check-header \
644
	autotools/check-python-code \
645
	autotools/check-imports \
Iustin Pop's avatar
Iustin Pop committed
646
	autotools/check-man-dashes \
647
	autotools/check-man-warnings \
648
	autotools/check-news \
649
	autotools/check-tar \
650
	autotools/check-version \
651
	autotools/convert-constants \
652
	autotools/docpp \
653
	autotools/gen-coverage \
654
	autotools/testrunner \
655
	autotools/wrong-hardcoded-paths \
656
	$(RUN_IN_TEMPDIR) \
657
	daemons/daemon-util.in \
658
	daemons/ganeti-cleaner.in \
659
	$(pkglib_python_scripts) \
660
	devel/upload.in \
661
	tools/kvm-ifup.in \
662
	$(docdot) \
663
	$(docpng) \
664 665 666
	$(docrst) \
	doc/conf.py \
	doc/html \
667
	$(BUILT_EXAMPLES:%=%.in) \
668 669
	doc/examples/ganeti.default \
	doc/examples/ganeti.default-debug \
Guido Trotter's avatar
Guido Trotter committed
670
	doc/examples/hooks/ethers \
671 672 673
	doc/examples/gnt-debug/README \
	doc/examples/gnt-debug/delay0.json \
	doc/examples/gnt-debug/delay50.json \
674
	test/lockperf.py \
675 676 677 678
	test/testutils.py \
	test/mocks.py \
	$(dist_TESTS) \
	$(TEST_FILES) \
Iustin Pop's avatar
Iustin Pop committed
679 680
	man/footer.rst \
	$(manrst) \
681
	$(maninput) \
Michael Hanselmann's avatar
Michael Hanselmann committed
682
	qa/qa-sample.json \
683
	$(qa_scripts) \
684
	$(HS_LIB_SRCS) $(HS_BUILT_SRCS_IN) \
685
	$(HS_PROG_SRCS) \
686
	htools/lint-hints.hs \
Iustin Pop's avatar
Iustin Pop committed
687 688
	htest/cli-tests-defs.sh \
	htest/offline-test.sh
689 690 691

man_MANS = \
	man/ganeti.7 \
692
	man/ganeti-cleaner.8 \
Guido Trotter's avatar
Guido Trotter committed
693
	man/ganeti-confd.8 \
694
	man/ganeti-listrunner.8 \
695
	man/ganeti-masterd.8 \
696 697
	man/ganeti-noded.8 \
	man/ganeti-os-interface.7 \
698
	man/ganeti-rapi.8 \
699 700 701
	man/ganeti-watcher.8 \
	man/gnt-backup.8 \
	man/gnt-cluster.8 \
702
	man/gnt-debug.8 \
703
	man/gnt-group.8 \
704
	man/gnt-instance.8 \
705
	man/gnt-job.8 \
706
	man/gnt-node.8 \
707 708 709
	man/gnt-os.8 \
	man/hail.1 \
	man/hbal.1 \
Iustin Pop's avatar
Iustin Pop committed
710
	man/hcheck.1 \
René Nussbaumer's avatar
René Nussbaumer committed
711
	man/hinfo.1 \
712
	man/hscan.1 \
Iustin Pop's avatar
Iustin Pop committed
713 714
	man/hspace.1 \
	man/htools.1
715

716
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
Iustin Pop's avatar
Iustin Pop committed
717
manhtml = $(patsubst %.rst,%.html,$(manrst))
718
mangen = $(patsubst %.rst,%.gen,$(manrst))
719
maninput = \
720
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
Iustin Pop's avatar
Iustin Pop committed
721
	$(patsubst %.html,%.html.in,$(manhtml)) \
722
	man/footer.man man/footer.html $(mangen)
723 724

TEST_FILES = \
Manuel Franceschini's avatar
Manuel Franceschini committed
725 726 727 728 729
	test/data/bdev-drbd-8.0.txt \
	test/data/bdev-drbd-8.3.txt \
	test/data/bdev-drbd-disk.txt \
	test/data/bdev-drbd-net-ip4.txt \
	test/data/bdev-drbd-net-ip6.txt \
730
	test/data/cert1.pem \