Skip to content
Snippets Groups Projects
Makefile.am 43.8 KiB
Newer Older
# 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.
# - Use autogen.sh to generate Makefile.in and configure script.

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

# Helper values for calling builtin functions
empty :=
space := $(empty) $(empty)
comma := ,

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

ACLOCAL_AMFLAGS = -I autotools
BUILD_BASH_COMPLETION = $(top_srcdir)/autotools/build-bash-completion
RUN_IN_TEMPDIR = $(top_srcdir)/autotools/run-in-tempdir
CHECK_PYTHON_CODE = $(top_srcdir)/autotools/check-python-code
CHECK_HEADER = $(top_srcdir)/autotools/check-header
CHECK_MAN_DASHES = $(top_srcdir)/autotools/check-man-dashes
CHECK_MAN_WARNINGS = $(top_srcdir)/autotools/check-man-warnings
CHECK_VERSION = $(top_srcdir)/autotools/check-version
CHECK_NEWS = $(top_srcdir)/autotools/check-news
CHECK_IMPORTS = $(top_srcdir)/autotools/check-imports
DOCPP = $(top_srcdir)/autotools/docpp
REPLACE_VARS_SED = autotools/replace_vars.sed
CONVERT_CONSTANTS = $(top_srcdir)/autotools/convert-constants
BUILD_RPC = $(top_srcdir)/autotools/build-rpc
# Note: these are automake-specific variables, and must be named after
# the directory + 'dir' suffix
clientdir = $(pkgpythondir)/client
hypervisordir = $(pkgpythondir)/hypervisor
httpdir = $(pkgpythondir)/http
masterddir = $(pkgpythondir)/masterd
confddir = $(pkgpythondir)/confd
rapidir = $(pkgpythondir)/rapi
serverdir = $(pkgpythondir)/server
watcherdir = $(pkgpythondir)/watcher
impexpddir = $(pkgpythondir)/impexpd
utilsdir = $(pkgpythondir)/utils
toolsdir = $(pkglibdir)/tools
iallocatorsdir = $(pkglibdir)/iallocators
pytoolsdir = $(pkgpythondir)/tools
docdir = $(datadir)/doc/$(PACKAGE)
myexeclibdir = $(pkglibdir)
# Delete output file if an error occurred while building it
.DELETE_ON_ERROR:

HTOOLS_DIRS = \
	htools \
	htools/Ganeti \
	htools/Ganeti/Confd \
	htools/Ganeti/HTools \
	htools/Ganeti/HTools/Program
DIRS = \
	autotools \
	daemons \
	devel \
	doc \
	doc/examples \
Guido Trotter's avatar
Guido Trotter committed
	doc/examples/hooks \
	doc/examples/gnt-debug \
	$(HTOOLS_DIRS) \
	lib/build \
	lib/http \
	lib/hypervisor \
	lib/masterd \
	lib/tools \
	lib/utils \
	man \
	qa \
	test \
	test/data \
Iustin Pop's avatar
Iustin Pop committed
	test/data/htools \
	test/data/htools/rapi \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/other \
BUILDTIME_DIR_AUTOCREATE = \
	$(APIDOC_DIR) \
	$(APIDOC_PY_DIR) \
	$(APIDOC_HS_DIR) \
	$(APIDOC_HS_DIR)/Ganeti \
	$(APIDOC_HS_DIR)/Ganeti/Confd \
	$(APIDOC_HS_DIR)/Ganeti/HTools \
	$(APIDOC_HS_DIR)/Ganeti/HTools/Program \
	$(COVERAGE_DIR) \
	$(COVERAGE_PY_DIR) \
	$(COVERAGE_HS_DIR) \

BUILDTIME_DIRS = \
	$(BUILDTIME_DIR_AUTOCREATE) \
	doc/html

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

all_dirfiles = $(addsuffix /.dir,$(DIRS) $(BUILDTIME_DIR_AUTOCREATE))
# 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

MAINTAINERCLEANFILES = \
	$(docpng) \
	$(maninput) \
	doc/install-quick.rst \
maintainer-clean-local:
	rm -rf $(BUILDTIME_DIRS)
	$(addsuffix /*.py[co],$(DIRS)) \
	$(addsuffix /*.hi,$(HTOOLS_DIRS)) \
	$(addsuffix /*.o,$(HTOOLS_DIRS)) \
	$(all_dirfiles) \
	$(PYTHON_BOOTSTRAP) \
	autotools/replace_vars.sed \
	daemons/ganeti-cleaner \
	$(BUILT_EXAMPLES) \
	doc/examples/bash_completion \
	lib/_generated_rpc.py \
	$(man_MANS) \
	$(manhtml) \
	tools/kvm-ifup \
	$(nodist_pkgpython_PYTHON) \
	$(HS_ALL_PROGS) $(HS_BUILT_SRCS) \
	$(HS_BUILT_TEST_HELPERS) \
	.hpc/*.mix htools/*.tix \
	doc/hs-lint.html
Iustin Pop's avatar
Iustin Pop committed
# BUILT_SOURCES should only be used as a dependency on phony
# targets. Otherwise it'll cause the target to rebuild every time.
BUILT_SOURCES = \
  $(built_base_sources) \
	$(BUILT_PYTHON_SOURCES) \
	$(PYTHON_BOOTSTRAP)

built_base_sources = \
	ganeti \
	$(all_dirfiles)
built_python_base_sources = \
	lib/_autoconf.py \
	lib/_vcsversion.py

BUILT_PYTHON_SOURCES = \
	$(built_python_base_sources) \
	lib/_generated_rpc.py
# Generating the RPC wrappers depends on many things, so make sure it's built at
# the end of the built sources
lib/_generated_rpc.py: | $(built_base_sources) $(built_python_base_sources)

# 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

nodist_pkgpython_PYTHON = \
	$(BUILT_PYTHON_SOURCES)

noinst_PYTHON = \
Michael Hanselmann's avatar
Michael Hanselmann committed
	lib/build/__init__.py \
	lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py
pkgpython_PYTHON = \
	lib/__init__.py \
	lib/asyncnotifier.py \
	lib/backend.py \
	lib/bdev.py \
	lib/bootstrap.py \
	lib/cli.py \
	lib/cmdlib.py \
	lib/config.py \
	lib/constants.py \
	lib/daemon.py \
	lib/jstore.py \
	lib/locking.py \
	lib/luxi.py \
	lib/mcpu.py \
	lib/netutils.py \
	lib/objects.py \
	lib/opcodes.py \
	lib/ovf.py \
	lib/qlang.py \
	lib/runtime.py \
	lib/serializer.py \
	lib/ssconf.py \
	lib/ssh.py \
	lib/uidpool.py \
	lib/workerpool.py
	lib/client/__init__.py \
	lib/client/gnt_backup.py \
	lib/client/gnt_cluster.py \
	lib/client/gnt_debug.py \
	lib/client/gnt_group.py \
	lib/client/gnt_instance.py \
	lib/client/gnt_job.py \
	lib/client/gnt_node.py \
	lib/client/gnt_os.py
hypervisor_PYTHON = \
	lib/hypervisor/__init__.py \
	lib/hypervisor/hv_base.py \
	lib/hypervisor/hv_chroot.py \
	lib/hypervisor/hv_fake.py \
Guido Trotter's avatar
Guido Trotter committed
	lib/hypervisor/hv_kvm.py \
Iustin Pop's avatar
Iustin Pop committed
	lib/hypervisor/hv_lxc.py \
	lib/hypervisor/hv_xen.py

rapi_PYTHON = \
	lib/rapi/__init__.py \
	lib/rapi/baserlib.py \
	lib/rapi/client.py \
	lib/rapi/connector.py \
	lib/rapi/rlib2.py \
	lib/rapi/testutils.py
http_PYTHON = \
	lib/http/client.py \
	lib/http/server.py
confd_PYTHON = \
	lib/confd/__init__.py \
Guido Trotter's avatar
Guido Trotter committed
	lib/confd/client.py \
	lib/confd/querylib.py \
	lib/confd/server.py
masterd_PYTHON = \
	lib/masterd/__init__.py \
	lib/masterd/instance.py
impexpd_PYTHON = \
	lib/impexpd/__init__.py

watcher_PYTHON = \
	lib/watcher/__init__.py \
	lib/watcher/nodemaint.py \
	lib/watcher/state.py
server_PYTHON = \
	lib/server/__init__.py \
	lib/server/confd.py \
	lib/server/masterd.py \
	lib/server/noded.py \
	lib/server/rapi.py
pytools_PYTHON = \
	lib/tools/__init__.py \
	lib/tools/ensure_dirs.py

utils_PYTHON = \
	lib/utils/__init__.py \
	lib/utils/algo.py \
	lib/utils/mlock.py \
	lib/utils/text.py \
	lib/utils/wrapper.py \
	lib/utils/x509.py
docrst = \
	doc/admin.rst \
	doc/design-2.0.rst \
	doc/design-2.1.rst \
	doc/design-2.2.rst \
	doc/design-2.3.rst \
	doc/design-htools-2.3.rst \
	doc/design-2.4.rst \
	doc/design-2.5.rst \
	doc/design-draft.rst \
	doc/design-oob.rst \
	doc/design-cpu-pinning.rst \
	doc/design-query2.rst \
	doc/design-x509-ca.rst \
	doc/design-http-server.rst \
	doc/design-impexp2.rst \
	doc/design-lu-generated-jobs.rst \
	doc/design-multi-reloc.rst \
	doc/design-network.rst \
	doc/design-chained-jobs.rst \
	doc/design-ovf-support.rst \
	doc/design-resource-model.rst \
	doc/design-shared-storage.rst \
	doc/design-node-state-cache.rst \
	doc/design-virtual-clusters.rst \
	doc/design-query-splitting.rst \
	doc/glossary.rst \
	doc/iallocator.rst \
	doc/index.rst \
	doc/install-quick.rst \
	doc/locking.rst \
	doc/move-instance.rst \
Iustin Pop's avatar
Iustin Pop committed
	doc/news.rst \
	doc/ovfconverter.rst \
	doc/security.rst \
	doc/upgrade.rst \
Iustin Pop's avatar
Iustin Pop committed
	doc/walkthrough.rst
HS_PROGS = htools/htools
HS_BIN_ROLES = hbal hscan hspace hinfo hcheck
HS_ALL_PROGS = $(HS_PROGS) htools/test htools/hpc-htools htools/hconfd
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/%) test/hail

HFLAGS = -O -Wall -Werror -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
# extra flags that can be overriden on the command line (e.g. -Wwarn, etc.)
# internal extra flags (used for htools/test mainly)
HEXTRA_INT =
# exclude options for coverage reports
HPCEXCL = --exclude Main \
	--exclude Ganeti.Constants \
	--exclude Ganeti.THH \
	--exclude Ganeti.HTools.QC \
	--exclude Ganeti.HTools.QCHelper \
	--exclude Ganeti.HTools.Version
	htools/Ganeti/HTools/CLI.hs \
	htools/Ganeti/HTools/Cluster.hs \
	htools/Ganeti/HTools/Compat.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/JSON.hs \
	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/QCHelper.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 \
	htools/Ganeti/HTools/Program.hs \
	htools/Ganeti/HTools/Program/Hail.hs \
	htools/Ganeti/HTools/Program/Hbal.hs \
	htools/Ganeti/HTools/Program/Hcheck.hs \
	htools/Ganeti/HTools/Program/Hinfo.hs \
	htools/Ganeti/HTools/Program/Hscan.hs \
	htools/Ganeti/HTools/Program/Hspace.hs \
	htools/Ganeti/BasicTypes.hs \
	htools/Ganeti/Confd.hs \
	htools/Ganeti/Confd/Server.hs \
	htools/Ganeti/Config.hs \
	htools/Ganeti/Daemon.hs \
	htools/Ganeti/Hash.hs \
	htools/Ganeti/Jobs.hs \
	htools/Ganeti/Logging.hs \
	htools/Ganeti/Luxi.hs \
	htools/Ganeti/Objects.hs \
	htools/Ganeti/OpCodes.hs \
	htools/Ganeti/Runtime.hs \
Iustin Pop's avatar
Iustin Pop committed
	htools/Ganeti/Ssconf.hs \
	htools/Ganeti/THH.hs
HS_BUILT_SRCS = htools/Ganeti/HTools/Version.hs htools/Ganeti/Constants.hs
HS_BUILT_SRCS_IN = $(patsubst %,%.in,$(HS_BUILT_SRCS))
$(RUN_IN_TEMPDIR): | $(all_dirfiles)

Iustin Pop's avatar
Iustin Pop committed
# 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
doc/html/index.html: $(docrst) $(docpng) doc/conf.py configure.ac \
	$(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py \
	lib/build/shell_example_lexer.py lib/opcodes.py lib/ht.py \
	| $(BUILT_PYTHON_SOURCES)
	@test -n "$(SPHINX)" || \
	    { echo 'sphinx-build' not found during configure; exit 1; }
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(SPHINX) -q -W -b html \
	    -D version="$(VERSION_MAJOR).$(VERSION_MINOR)" \
	    -D release="$(PACKAGE_VERSION)" \
	    $(abs_top_srcdir)/doc $(CURDIR)/doc/html
	rm -f doc/html/.buildinfo doc/html/objects.inv
	touch $@

doc/html: doc/html/index.html
doc/install-quick.rst: INSTALL
doc/news.rst: NEWS
doc/upgrade.rst: UPGRADE
doc/install-quick.rst doc/news.rst doc/upgrade.rst:
	set -e; \
	{ echo '.. This file is automatically updated at build time from $<.'; \
	  echo '.. Do not edit.'; \
	  echo; \
	  cat $<; \
	} > $@

	doc/arch-2.0.dot \
	doc/design-2.1-lock-acquire.dot \
	doc/design-2.1-lock-release.dot
docpng = $(patsubst %.dot,%.png,$(docdot))
# Things to build but not to install (add it to EXTRA_DIST if it should be
# distributed)
noinst_DATA = \
	devel/upload \
	doc/html \
	$(BUILT_EXAMPLES) \
	doc/examples/bash_completion \
	$(manhtml)
gnt_scripts = \
	scripts/gnt-backup \
	scripts/gnt-cluster \
	scripts/gnt-debug \
	scripts/gnt-group \
	scripts/gnt-instance \
	scripts/gnt-job \
	scripts/gnt-node \
	scripts/gnt-os

PYTHON_BOOTSTRAP_SBIN = \
	daemons/ganeti-masterd \
	daemons/ganeti-noded \
	daemons/ganeti-watcher \
	daemons/ganeti-rapi \
	$(gnt_scripts)
if PY_CONFD
PYTHON_BOOTSTRAP_SBIN += daemons/ganeti-confd
endif

PYTHON_BOOTSTRAP = \
	$(PYTHON_BOOTSTRAP_SBIN) \
	tools/ensure-dirs

	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
	qa/qa_group.py \
	qa/qa_instance.py \
	qa/qa_job.py \
	qa/qa_node.py \
	qa/qa_os.py \
	qa/qa_rapi.py \
	qa/qa_tags.py \
	qa/qa_utils.py

bin_SCRIPTS =
if WANT_HTOOLS
bin_SCRIPTS += $(filter-out htools/hail,$(HS_PROGS))
install-exec-hook:
	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
# FIXME: this is a hardcoded logic, instead of auto-resolving
	$(LN_S) -f ../../../bin/htools \
		   $(DESTDIR)$(iallocatorsdir)/hail
	for role in $(HS_BIN_ROLES); do \
		$(LN_S) -f htools \
			   $(DESTDIR)$(bindir)/$$role ; \
	done
if HS_CONFD
	mv $(DESTDIR)$(sbindir)/hconfd $(DESTDIR)$(sbindir)/ganeti-confd
endif
$(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
	@if [ -z "$(HTOOLS)" ]; then \
	  echo "Error: htools compilation disabled at configure time" 1>&2 ;\
	  exit 1; \
	fi
	@BINARY=$(@:htools/%=%); \
	if [ "$BINARY" = "test" ] && [ -z "$(GHC_PKG_QUICKCHECK)" ]; then \
	  echo "Error: cannot run unittests without the QuickCheck library (see devnotes.rst)" 1>&2; \
	  exit 1; \
	rm -f $(@:htools/%=%).tix
	BINARY=$(@:htools/%=%); $(GHC) --make \
	  $(HFLAGS) \
	  $(HTOOLS_NOCURL) $(HTOOLS_PARALLEL3) \
	  -osuf $$BINARY.o -hisuf $$BINARY.hi \
	  $(HEXTRA) $(HEXTRA_INT) $@
# for the htools/test binary, we need to enable profiling/coverage
htools/test: HEXTRA_INT=-fhpc -Wwarn -fno-warn-missing-signatures \
	-fno-warn-monomorphism-restriction -fno-warn-orphans \
	-fno-warn-missing-methods -fno-warn-unused-imports

# we compile the hpc-htools binary with the program coverage
htools/hpc-htools: HEXTRA_INT=-fhpc
# test dependency
htools/offline-tests.sh: htools/hpc-htools
# 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:
	$(MAKE) clean
	$(MAKE) $(HS_ALL_PROGS) HEXTRA="-osuf .o"
	rm -f $(HS_ALL_PROGS)
	$(MAKE) hs-prof-quick

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

dist_sbin_SCRIPTS = \
	tools/ganeti-listrunner
nodist_sbin_SCRIPTS = \
	$(PYTHON_BOOTSTRAP_SBIN) \
if HS_CONFD
nodist_sbin_SCRIPTS += htools/hconfd
endif

	tools/burnin \
	tools/cfgshell \
	tools/cfgupgrade \
	tools/cfgupgrade12 \
	tools/cluster-merge \
Iustin Pop's avatar
Iustin Pop committed
	tools/confd-client \
	tools/fmtjson \
	tools/lvmstrap \
	tools/move-instance \
	tools/ovfconverter \
	tools/setup-ssh \
	tools/sanitize-config
dist_tools_SCRIPTS = \
	tools/kvm-console-wrapper \
	tools/xen-console-wrapper \
	tools/master-ip-setup
pkglib_python_scripts = \
	daemons/import-export \
	tools/check-cert-expired
nodist_pkglib_python_scripts = \
	tools/ensure-dirs

myexeclib_SCRIPTS = \
	daemons/daemon-util \
	tools/kvm-ifup \
	$(pkglib_python_scripts)
nodist_myexeclib_SCRIPTS = \
	$(nodist_pkglib_python_scripts)

EXTRA_DIST = \
	NEWS \
Michael Hanselmann's avatar
Michael Hanselmann committed
	pylintrc \
	autotools/build-bash-completion \
	autotools/build-rpc \
	autotools/check-header \
	autotools/check-python-code \
	autotools/check-imports \
	autotools/check-man-dashes \
	autotools/check-man-warnings \
	autotools/check-news \
	autotools/check-tar \
	autotools/check-version \
	autotools/convert-constants \
	autotools/testrunner \
	autotools/wrong-hardcoded-paths \
	$(RUN_IN_TEMPDIR) \
	daemons/ganeti-cleaner.in \
	$(pkglib_python_scripts) \
	devel/upload.in \
	tools/kvm-ifup.in \
	$(docdot) \
	$(docrst) \
	doc/conf.py \
	doc/html \
	$(BUILT_EXAMPLES:%=%.in) \
	doc/examples/ganeti.default \
	doc/examples/ganeti.default-debug \
Guido Trotter's avatar
Guido Trotter committed
	doc/examples/hooks/ethers \
	doc/examples/gnt-debug/README \
	doc/examples/gnt-debug/delay0.json \
	doc/examples/gnt-debug/delay50.json \
	test/lockperf.py \
	test/testutils.py \
	test/mocks.py \
	$(dist_TESTS) \
	$(TEST_FILES) \
	man/footer.rst \
	$(manrst) \
	qa/qa-sample.json \
	$(qa_scripts) \
	$(HS_LIB_SRCS) $(HS_BUILT_SRCS_IN) \
	$(HS_PROG_SRCS) \
	htools/lint-hints.hs \
	htools/cli-tests-defs.sh \
	htools/offline-test.sh

man_MANS = \
	man/ganeti.7 \
	man/ganeti-cleaner.8 \
Guido Trotter's avatar
Guido Trotter committed
	man/ganeti-confd.8 \
	man/ganeti-listrunner.8 \
	man/ganeti-masterd.8 \
	man/ganeti-noded.8 \
	man/ganeti-os-interface.7 \
	man/ganeti-rapi.8 \
	man/ganeti-watcher.8 \
	man/gnt-backup.8 \
	man/gnt-cluster.8 \
	man/gnt-debug.8 \
	man/gnt-group.8 \
	man/gnt-instance.8 \
	man/gnt-os.8 \
	man/hail.1 \
	man/hbal.1 \
	man/hcheck.1 \
René Nussbaumer's avatar
René Nussbaumer committed
	man/hinfo.1 \
	man/hscan.1 \
Iustin Pop's avatar
Iustin Pop committed
	man/hspace.1 \
	man/htools.1
manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
manhtml = $(patsubst %.rst,%.html,$(manrst))
mangen = $(patsubst %.rst,%.gen,$(manrst))
maninput = \
	$(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
Iustin Pop's avatar
Iustin Pop committed
	$(patsubst %.html,%.html.in,$(manhtml)) \
	man/footer.man man/footer.html $(mangen)
Manuel Franceschini's avatar
Manuel Franceschini committed
	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 \
	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 \
	test/data/proc_drbd8.txt \
	test/data/proc_drbd80-emptyline.txt \
	test/data/proc_drbd83.txt \
	test/data/proc_drbd83_sync.txt \
	test/data/proc_drbd83_sync_krnl2.6.39.txt \
	test/data/kvm_1.0_help.txt \
	test/data/kvm_0.15.90_help.txt \
	test/data/kvm_0.12.5_help.txt \
	test/data/kvm_0.9.1_help.txt \
	test/data/sys_drbd_usermode_helper.txt \
Iustin Pop's avatar
Iustin Pop committed
	test/data/htools/hail-alloc-drbd.json \
	test/data/htools/hail-change-group.json \
Iustin Pop's avatar
Iustin Pop committed
	test/data/htools/hail-invalid-reloc.json \
Iustin Pop's avatar
Iustin Pop committed
	test/data/htools/hail-node-evac.json \
	test/data/htools/hail-reloc-drbd.json \
	test/data/htools/hbal-split-insts.data \
	test/data/htools/common-suffix.data \
	test/data/htools/invalid-node.data \
	test/data/htools/missing-resources.data \
	test/data/htools/rapi/groups.json \
	test/data/htools/rapi/info.json \
	test/data/htools/rapi/instances.json \
	test/data/htools/rapi/nodes.json \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/compr_disk.vmdk.gz \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/config.ini \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/corrupted_resources.ovf \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/empty.ini \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/empty.ovf \
	test/data/ovfdata/ganeti.mf \
	test/data/ovfdata/ganeti.ovf \
	test/data/ovfdata/gzip_disk.ovf \
	test/data/ovfdata/new_disk.vmdk \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/no_disk.ini \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/no_disk_in_ref.ovf \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/no_os.ini \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/no_ovf.ova \
	test/data/ovfdata/ova.ova \
	test/data/ovfdata/second_disk.vmdk \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/rawdisk.raw \
	test/data/ovfdata/unsafe_path.ini \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/virtualbox.ovf \
	test/data/ovfdata/wrong_extension.ovd \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/wrong_config.ini \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/wrong_manifest.mf \
	test/data/ovfdata/wrong_manifest.ovf \
	test/data/ovfdata/wrong_ova.ova \
	test/data/ovfdata/wrong_xml.ovf \
Agata Murawska's avatar
Agata Murawska committed
	test/data/ovfdata/other/rawdisk.raw \
	test/data/vgreduce-removemissing-2.02.02.txt \
	test/data/vgreduce-removemissing-2.02.66-fail.txt \
	test/data/vgreduce-removemissing-2.02.66-ok.txt \
	test/data/vgs-missing-pvs-2.02.02.txt \
	test/data/vgs-missing-pvs-2.02.66.txt \
	test/import-export_unittest-helper \
	test/gnt-cli.test \
	test/ganeti-cli.test \
	test/htools-balancing.test \
	test/htools-basic.test \
	test/htools-dynutil.test \
	test/htools-excl.test \
	test/htools-hail.test \
	test/htools-hspace.test \
	test/htools-invalid.test \
	test/htools-multi-group.test \
	test/htools-no-backend.test \
	test/htools-rapi.test \
	test/htools-single-group.test \
	test/htools-text-backend.test
python_tests = \
	doc/examples/rapi_testutils.py \
	test/ganeti.asyncnotifier_unittest.py \
	test/ganeti.backend_unittest.py \
	test/ganeti.bdev_unittest.py \
	test/ganeti.cli_unittest.py \
	test/ganeti.client.gnt_cluster_unittest.py \
	test/ganeti.client.gnt_instance_unittest.py \
	test/ganeti.daemon_unittest.py \
	test/ganeti.cmdlib_unittest.py \
	test/ganeti.compat_unittest.py \
	test/ganeti.confd.client_unittest.py \
	test/ganeti.config_unittest.py \
	test/ganeti.constants_unittest.py \
	test/ganeti.errors_unittest.py \
	test/ganeti.hooks_unittest.py \
	test/ganeti.ht_unittest.py \
	test/ganeti.http_unittest.py \
	test/ganeti.hypervisor_unittest.py \
	test/ganeti.hypervisor.hv_chroot_unittest.py \
	test/ganeti.hypervisor.hv_fake_unittest.py \
	test/ganeti.hypervisor.hv_kvm_unittest.py \
	test/ganeti.hypervisor.hv_lxc_unittest.py \
	test/ganeti.hypervisor.hv_xen_unittest.py \
	test/ganeti.impexpd_unittest.py \
	test/ganeti.jqueue_unittest.py \
	test/ganeti.locking_unittest.py \
	test/ganeti.luxi_unittest.py \
	test/ganeti.masterd.instance_unittest.py \
	test/ganeti.mcpu_unittest.py \
	test/ganeti.netutils_unittest.py \
	test/ganeti.objects_unittest.py \
	test/ganeti.opcodes_unittest.py \
Agata Murawska's avatar
Agata Murawska committed
	test/ganeti.ovf_unittest.py \
	test/ganeti.qlang_unittest.py \
	test/ganeti.query_unittest.py \
	test/ganeti.rapi.baserlib_unittest.py \
	test/ganeti.rapi.client_unittest.py \
	test/ganeti.rapi.resources_unittest.py \
	test/ganeti.rapi.rlib2_unittest.py \
	test/ganeti.rapi.testutils_unittest.py \
	test/ganeti.rpc_unittest.py \
	test/ganeti.runtime_unittest.py \
	test/ganeti.serializer_unittest.py \
	test/ganeti.ssh_unittest.py \
	test/ganeti.storage_unittest.py \
	test/ganeti.tools.ensure_dirs_unittest.py \
	test/ganeti.uidpool_unittest.py \
	test/ganeti.utils.algo_unittest.py \
	test/ganeti.utils.filelock_unittest.py \
	test/ganeti.utils.hash_unittest.py \
	test/ganeti.utils.io_unittest.py \
	test/ganeti.utils.log_unittest.py \
	test/ganeti.utils.mlock_unittest.py \
	test/ganeti.utils.nodesetup_unittest.py \
	test/ganeti.utils.process_unittest.py \
	test/ganeti.utils.retry_unittest.py \
	test/ganeti.utils.text_unittest.py \
	test/ganeti.utils.wrapper_unittest.py \
	test/ganeti.utils.x509_unittest.py \
	test/ganeti.utils_unittest.py \
	test/ganeti.workerpool_unittest.py \
	test/qa.qa_config_unittest.py \
	test/cfgupgrade_unittest.py \
	test/docs_unittest.py \
	test/pycurl_reset_unittest.py \
	test/tempfile_fork_unittest.py
if HAS_FAKEROOT
python_tests += test/ganeti.utils.io_unittest-runasroot.py
endif
haskell_tests = htools/test

dist_TESTS = \
	test/check-cert-expired_unittest.bash \
	test/daemon-util_unittest.bash \
	test/ganeti-cleaner_unittest.bash \
	test/import-export_unittest.bash \
	test/cli-test.bash \
if WANT_HTOOLSTESTS
nodist_TESTS += $(haskell_tests)
dist_TESTS += htools/offline-test.sh
check_SCRIPTS += htools/hpc-htools $(HS_BUILT_TEST_HELPERS)

TESTS = $(dist_TESTS) $(nodist_TESTS)

# Environment for all tests
PLAIN_TESTS_ENVIRONMENT = \
	PYTHONPATH=. \
	TOP_SRCDIR=$(abs_top_srcdir) TOP_BUILDDIR=$(abs_top_builddir) \
	PYTHON=$(PYTHON) FAKEROOT=$(FAKEROOT_PATH) \
	$(RUN_IN_TEMPDIR)

# Environment for tests run by automake
TESTS_ENVIRONMENT = \
	$(PLAIN_TESTS_ENVIRONMENT) $(abs_top_srcdir)/autotools/testrunner
all_python_code = \
	$(pkglib_python_scripts) \
	$(nodist_pkglib_python_scripts) \
	$(python_tests) \
	$(hypervisor_PYTHON) \
	$(rapi_PYTHON) \
	$(server_PYTHON) \
	$(pytools_PYTHON) \
	$(http_PYTHON) \
	$(confd_PYTHON) \
	$(masterd_PYTHON) \
	$(utils_PYTHON) \
	$(watcher_PYTHON) \
	$(noinst_PYTHON) \
	$(qa_scripts)
	man/footer.rst \
	test/check-cert-expired_unittest.bash \
	test/daemon-util_unittest.bash \
	test/ganeti-cleaner_unittest.bash \
	test/import-export_unittest.bash \
	test/cli-test.bash \
	htools/offline-test.sh \
	htools/cli-tests-defs.sh \
	$(all_python_code) \
	$(HS_LIB_SRCS) $(HS_PROG_SRCS)
	$(BUILD_BASH_COMPLETION) \
	$(CHECK_IMPORTS) \
	$(CHECK_HEADER) \
lint_python_code = \
	ganeti/http/server.py \
	$(pkglib_python_scripts) \
	$(BUILD_BASH_COMPLETION) \
	$(CHECK_IMPORTS) \
	$(CHECK_HEADER) \
standalone_python_modules = \
	lib/rapi/client.py \
	tools/ganeti-listrunner

Andrea Spadaccini's avatar
Andrea Spadaccini committed
pep8_python_code = \
	ganeti \
	ganeti/http/server.py \
	$(dist_sbin_SCRIPTS) \
Andrea Spadaccini's avatar
Andrea Spadaccini committed
	$(pkglib_python_scripts) \
	$(BUILD_BASH_COMPLETION) \
	$(CHECK_HEADER) \
Andrea Spadaccini's avatar
Andrea Spadaccini committed
	$(DOCPP) \
	$(PYTHON_BOOTSTRAP) \
	qa

test/daemon-util_unittest.bash: daemons/daemon-util

test/ganeti-cleaner_unittest.bash: daemons/ganeti-cleaner

tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod +x $@

devel/upload: devel/upload.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@
	chmod u+x $@

daemons/%: daemons/%.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@
doc/examples/%: doc/examples/%.in $(REPLACE_VARS_SED)
	sed -f $(REPLACE_VARS_SED) < $< > $@

doc/examples/hooks/%: doc/examples/hooks/%.in $(REPLACE_VARS_SED)
Luca Bigliardi's avatar
Luca Bigliardi committed
	sed -f $(REPLACE_VARS_SED) < $< > $@

doc/examples/bash_completion: $(BUILD_BASH_COMPLETION) $(RUN_IN_TEMPDIR) \
	lib/cli.py $(gnt_scripts) $(client_PYTHON) tools/burnin
	PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(BUILD_BASH_COMPLETION) > $@
doc/%.png: doc/%.dot
	@test -n "$(DOT)" || { echo 'dot' not found during configure; exit 1; }
	$(DOT) -Tpng -o $@ $<

Iustin Pop's avatar
Iustin Pop committed
man/footer.man: man/footer.rst
	@test -n "$(PANDOC)" || \