Makefile.am 44.2 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 62
	htools/Ganeti/HTools/Program \
	htools/Ganeti/Query
63

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

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

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
112 113 114 115 116 117 118
	doc/html

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

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

135
maintainer-clean-local:
136
	rm -rf $(BUILDTIME_DIRS)
137

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

Iustin Pop's avatar
Iustin Pop committed
162
GENERATED_FILES = \
Iustin Pop's avatar
Iustin Pop committed
163
	$(built_base_sources) \
164 165 166 167
	$(BUILT_PYTHON_SOURCES) \
	$(PYTHON_BOOTSTRAP)

built_base_sources = \
168 169
	stamp-directories \
	stamp-srclinks
170

171
built_python_base_sources = \
172
	lib/_autoconf.py \
173 174 175 176
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
177
	lib/_generated_rpc.py
178

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

183 184 185 186 187 188 189 190
# 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

191 192 193
nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

194
noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
195
	lib/build/__init__.py \
196 197
	lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py
198

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

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

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

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

263
http_PYTHON = \
264
	lib/http/__init__.py \
265
	lib/http/auth.py \
266 267
	lib/http/client.py \
	lib/http/server.py
268

Guido Trotter's avatar
Guido Trotter committed
269
confd_PYTHON = \
Guido Trotter's avatar
Guido Trotter committed
270
	lib/confd/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
271
	lib/confd/client.py \
272 273
	lib/confd/querylib.py \
	lib/confd/server.py
274

Michael Hanselmann's avatar
Michael Hanselmann committed
275
masterd_PYTHON = \
276 277
	lib/masterd/__init__.py \
	lib/masterd/instance.py
Michael Hanselmann's avatar
Michael Hanselmann committed
278

279 280 281
impexpd_PYTHON = \
	lib/impexpd/__init__.py

282
watcher_PYTHON = \
283
	lib/watcher/__init__.py \
284 285
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
286

287
server_PYTHON = \
288
	lib/server/__init__.py \
289
	lib/server/confd.py \
290
	lib/server/masterd.py \
291 292
	lib/server/noded.py \
	lib/server/rapi.py
293

294 295 296 297
pytools_PYTHON = \
	lib/tools/__init__.py \
	lib/tools/ensure_dirs.py

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

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

358
HS_PROGS = htools/htools
359
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck
360

361
HS_ALL_PROGS = $(HS_PROGS) htools/test htools/hpc-htools htools/hconfd
362
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
363 364
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/%) test/hail

365 366
HFLAGS = -O -Wall -Werror -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
367
HEXTRA =
368 369
# internal extra flags (used for htools/test mainly)
HEXTRA_INT =
370
# exclude options for coverage reports
371
HPCEXCL = --exclude Main \
372
	--exclude Ganeti.Constants \
373 374 375
	--exclude Ganeti.THH \
	--exclude Ganeti.HTools.QC \
	--exclude Ganeti.HTools.QCHelper \
376
	--exclude Ganeti.HTools.Version
377

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

430
HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
431
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
432

433
$(RUN_IN_TEMPDIR): | stamp-directories
434

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

455
doc/html: doc/html/index.html
Iustin Pop's avatar
Iustin Pop committed
456

457
doc/install-quick.rst: INSTALL
458
doc/news.rst: NEWS
459
doc/upgrade.rst: UPGRADE
460

461
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
462 463 464 465 466 467 468
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

469
docdot = \
470 471 472
	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
473

474
docpng = $(patsubst %.dot,%.png,$(docdot))
475

476 477 478 479 480
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	devel/upload \
	doc/html \
481
	$(BUILT_EXAMPLES) \
482 483
	doc/examples/bash_completion \
	$(manhtml)
484

485
gnt_scripts = \
486 487 488
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
489
	scripts/gnt-group \
490 491 492 493 494
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

495
PYTHON_BOOTSTRAP_SBIN = \
496
	daemons/ganeti-masterd \
497
	daemons/ganeti-noded \
498
	daemons/ganeti-watcher \
499
	daemons/ganeti-rapi \
500
	$(gnt_scripts)
501

502 503 504 505
if PY_CONFD
PYTHON_BOOTSTRAP_SBIN += daemons/ganeti-confd
endif

506 507 508 509
PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
	tools/ensure-dirs

510
qa_scripts = \
511
	qa/__init__.py \
512 513 514 515 516 517
	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
518
	qa/qa_group.py \
519
	qa/qa_instance.py \
520
	qa/qa_job.py \
521 522 523 524 525 526
	qa/qa_node.py \
	qa/qa_os.py \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

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

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

562
# for the htools/test binary, we need to enable profiling/coverage
563
htools/test: HEXTRA_INT=-fhpc
564

565 566
# we compile the hpc-htools binary with the program coverage
htools/hpc-htools: HEXTRA_INT=-fhpc
567

568
# test dependency
569
htools/offline-tests.sh: htools/hpc-htools
570

571 572 573 574 575 576
# 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:
577 578
	$(MAKE) $(AM_MAKEFLAGS) clean
	$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf .o"
579
	rm -f $(HS_ALL_PROGS)
580
	$(MAKE) $(AM_MAKEFLAGS) hs-prof-quick
581 582

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

585 586
dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
587

588
nodist_sbin_SCRIPTS = \
589
	$(PYTHON_BOOTSTRAP_SBIN) \
590 591
	daemons/ganeti-cleaner

592 593 594 595
if HS_CONFD
nodist_sbin_SCRIPTS += htools/hconfd
endif

596
python_scripts = \
597 598 599
	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
600
	tools/cfgupgrade12 \
601
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
602
	tools/confd-client \
603
	tools/fmtjson \
Iustin Pop's avatar
Iustin Pop committed
604
	tools/lvmstrap \
605
	tools/move-instance \
606
	tools/ovfconverter \
607
	tools/setup-ssh \
Iustin Pop's avatar
Iustin Pop committed
608
	tools/sanitize-config
609

610
dist_tools_SCRIPTS = \
611
	$(python_scripts) \
612
	tools/kvm-console-wrapper \
613 614
	tools/xm-console-wrapper \
	tools/master-ip-setup
615

616
pkglib_python_scripts = \
617 618
	daemons/import-export \
	tools/check-cert-expired
619

620 621 622
nodist_pkglib_python_scripts = \
	tools/ensure-dirs

623
myexeclib_SCRIPTS = \
624
	daemons/daemon-util \
625
	tools/kvm-ifup \
626
	$(pkglib_python_scripts)
627

628
nodist_myexeclib_SCRIPTS = \
629 630
	$(nodist_pkglib_python_scripts)

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

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

711
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
Iustin Pop's avatar
Iustin Pop committed
712
manhtml = $(patsubst %.rst,%.html,$(manrst))
713
mangen = $(patsubst %.rst,%.gen,$(manrst))
714
maninput = \
715
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
Iustin Pop's avatar
Iustin Pop committed
716
	$(patsubst %.html,%.html.in,$(manhtml)) \
717
	man/footer.man man/footer.html $(mangen)
718 719

TEST_FILES = \
Manuel Franceschini's avatar
Manuel Franceschini committed
720 721 722 723 724
	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 \
725
	test/data/cert1.pem \
726 727 728 729 730 731 732
	test/data/ip-addr-show-dummy0.txt \
	test/data/ip-addr-show-lo-ipv4.txt \
	test/data/ip-addr-show-lo-ipv6.txt \
	test/data/ip-addr-show-lo-oneline-ipv4.txt \
	test/data/ip-addr-show-lo-oneline-ipv6.txt \
	test/data/ip-addr-show-lo-oneline.txt \
	test/data/ip-addr-show-lo.txt \
733
	test/data/proc_drbd8.txt \
734
	test/data/proc_drbd80-emptyline.txt \
735
	test/data/proc_drbd83.txt \