CHECK_MAN = $(top_srcdir)/autotools/check-man
CHECK_VERSION = $(top_srcdir)/autotools/check-version
CHECK_NEWS = $(top_srcdir)/autotools/check-news
+DOCPP = $(top_srcdir)/autotools/docpp
REPLACE_VARS_SED = autotools/replace_vars.sed
+# Note: the variable must be named after the directory + 'dir' suffix
clientdir = $(pkgpythondir)/client
hypervisordir = $(pkgpythondir)/hypervisor
httpdir = $(pkgpythondir)/http
impexpddir = $(pkgpythondir)/impexpd
utilsdir = $(pkgpythondir)/utils
toolsdir = $(pkglibdir)/tools
+iallocatorsdir = $(pkglibdir)/iallocators
docdir = $(datadir)/doc/$(PACKAGE)
# Delete output file if an error occurred while building it
.DELETE_ON_ERROR:
+HTOOLS_DIRS = \
+ htools \
+ htools/Ganeti \
+ htools/Ganeti/HTools
+
DIRS = \
autotools \
daemons \
doc/examples \
doc/examples/hooks \
doc/examples/gnt-debug \
+ $(HTOOLS_DIRS) \
lib \
lib/client \
lib/build \
CLEANFILES = \
$(addsuffix /*.py[co],$(DIRS)) \
+ $(addsuffix /*.hi,$(HTOOLS_DIRS)) \
+ $(addsuffix /*.o,$(HTOOLS_DIRS)) \
$(all_dirfiles) \
$(PYTHON_BOOTSTRAP) \
epydoc.conf \
$(manhtml) \
tools/kvm-ifup \
stamp-srclinks \
- $(nodist_pkgpython_PYTHON)
+ $(nodist_pkgpython_PYTHON) \
+ $(HALLPROGS) $(HSRCS2)
# BUILT_SOURCES should only be used as a dependency on phony targets. Otherwise
# it'll cause the target to rebuild every time.
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-draft.rst \
doc/design-oob.rst \
doc/design-query2.rst \
doc/cluster-merge.rst \
+ doc/design-shared-storage.rst \
doc/devnotes.rst \
doc/glossary.rst \
doc/hooks.rst \
doc/upgrade.rst \
doc/walkthrough.rst
+HPROGS = \
+ htools/hbal \
+ htools/hscan \
+ htools/hail \
+ htools/hspace
+
+HALLPROGS = $(HPROGS) htools/test
+HSRCPROGS = $(patsubst %,%.hs,$(HALLPROGS))
+# we don't add -Werror by default
+HFLAGS = -O -Wall -fwarn-monomorphism-restriction -fwarn-tabs -ihtools
+HEXTRA =
+
+HSRCS = \
+ 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 \
+ 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 \
+ htools/Ganeti/Jobs.hs \
+ htools/Ganeti/Luxi.hs \
+ htools/Ganeti/OpCodes.hs
+
+HSRCS2 = htools/Ganeti/HTools/Version.hs
+HSRCS2IN = $(patsubst %,%.in,$(HSRCS2))
+
$(RUN_IN_TEMPDIR): | $(all_dirfiles)
+# 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/opcodes.py lib/opdoc.py
+ $(RUN_IN_TEMPDIR) lib/build/sphinx_ext.py lib/opcodes.py lib/ht.py \
+ | lib/_autoconf.py
@test -n "$(SPHINX)" || \
{ echo 'sphinx-build' not found during configure; exit 1; }
@mkdir_p@ $(dir $@)
qa/qa_tags.py \
qa/qa_utils.py
+bin_SCRIPTS =
+iallocators_SCRIPTS =
+if WANT_HTOOLS
+bin_SCRIPTS += $(filter-out htools/hail,$(HPROGS))
+iallocators_SCRIPTS += $(filter htools/hail,$(HPROGS))
+endif
+
+$(HALLPROGS): %: %.hs $(HSRCS) $(HSRCS2) Makefile
+ BINARY=$(@:htools/%=%); \
+ $(GHC) --make \
+ $(HFLAGS) $(HEXTRA) $(HTOOLS_NOCURL) \
+ -osuf $$BINARY.o -hisuf $$BINARY.hi \
+ $@
+
dist_sbin_SCRIPTS = \
tools/ganeti-listrunner
autotools/check-news \
autotools/check-tar \
autotools/check-version \
+ autotools/docpp \
autotools/gen-coverage \
autotools/testrunner \
$(RUN_IN_TEMPDIR) \
$(manrst) \
$(maninput) \
qa/qa-sample.json \
- $(qa_scripts)
+ $(qa_scripts) \
+ $(HSRCS) $(HSRCS2IN) \
+ $(HSRCPROGS)
man_MANS = \
man/ganeti.7 \
man/gnt-instance.8 \
man/gnt-job.8 \
man/gnt-node.8 \
- man/gnt-os.8
+ man/gnt-os.8 \
+ man/hail.1 \
+ man/hbal.1 \
+ man/hscan.1 \
+ man/hspace.1
-manrst = $(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS)))
+manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
manhtml = $(patsubst %.rst,%.html,$(manrst))
+mangen = $(patsubst %.rst,%.gen,$(manrst))
maninput = \
- $(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS))) \
+ $(patsubst %.1,%.1.in,$(patsubst %.7,%.7.in,$(patsubst %.8,%.8.in,$(man_MANS)))) \
$(patsubst %.html,%.html.in,$(manhtml)) \
- man/footer.man man/footer.html
+ man/footer.man man/footer.html $(mangen)
TEST_FILES = \
test/data/bdev-drbd-8.0.txt \
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.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/daemon-util_unittest.bash \
test/ganeti-cleaner_unittest.bash \
test/import-export_unittest.bash \
- $(all_python_code)
+ $(all_python_code) \
+ $(HSRCS) $(HSRCPROGS)
check_python_code = \
$(BUILD_BASH_COMPLETION) \
+ $(DOCPP) \
$(all_python_code)
lint_python_code = \
$(dist_tools_SCRIPTS) \
$(pkglib_python_scripts) \
$(BUILD_BASH_COMPLETION) \
+ $(DOCPP) \
$(PYTHON_BOOTSTRAP)
test/daemon-util_unittest.bash: daemons/daemon-util
{ echo 'pandoc' not found during configure; exit 1; }
$(PANDOC) -f rst -t html -o $@ $<
-man/%.7.in man/%.8.in: man/%.rst man/footer.man
+man/%.gen: man/%.rst lib/query.py lib/build/sphinx_ext.py
+ PYTHONPATH=. $(RUN_IN_TEMPDIR) $(CURDIR)/$(DOCPP) < $< > $@
+
+man/%.7.in man/%.8.in man/%.1.in: man/%.gen man/footer.man
@test -n "$(PANDOC)" || \
{ echo 'pandoc' not found during configure; exit 1; }
set -o pipefail ; \
sed -e 's/\\@/@/g' > $@
if test -n "$(MAN_HAS_WARNINGS)"; then $(CHECK_MAN) $@; fi
-man/%.html.in: man/%.rst man/footer.html
+man/%.html.in: man/%.gen man/footer.html
@test -n "$(PANDOC)" || \
{ echo 'pandoc' not found during configure; exit 1; }
set -o pipefail ; \
$(PANDOC) -s -f rst -t html -A man/footer.html $< | \
sed -e 's/\\@/@/g' > $@
+man/%.1: man/%.1.in $(REPLACE_VARS_SED)
+ sed -f $(REPLACE_VARS_SED) < $< > $@
+
man/%.7: man/%.7.in $(REPLACE_VARS_SED)
sed -f $(REPLACE_VARS_SED) < $< > $@
man/%.html: man/%.html.in $(REPLACE_VARS_SED)
sed -f $(REPLACE_VARS_SED) < $< > $@
-epydoc.conf: epydoc.conf.in
- sed -e 's#@MODULES@#$(lint_python_code)#g' < $< > $@
+epydoc.conf: epydoc.conf.in Makefile
+ sed -e 's#@MODULES@#$(strip $(lint_python_code))#g' < $< > $@
vcs-version:
if test -d .git; then \
$(MAKE) vcs-version; \
fi
+htools/Ganeti/HTools/Version.hs: htools/Ganeti/HTools/Version.hs.in vcs-version
+ set -e; \
+ VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
+ sed -e "s/%ver%/$$VCSVER/" < $< > $@
+
lib/_autoconf.py: Makefile vcs-version | lib/.dir
set -e; \
VCSVER=`cat $(abs_top_srcdir)/vcs-version`; \
echo "XEN_INITRD = '$(XEN_INITRD)'"; \
echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
echo "ENABLE_FILE_STORAGE = $(ENABLE_FILE_STORAGE)"; \
+ echo "SHARED_FILE_STORAGE_DIR = '$(SHARED_FILE_STORAGE_DIR)'"; \
+ echo "ENABLE_SHARED_FILE_STORAGE = $(ENABLE_SHARED_FILE_STORAGE)"; \
echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
echo "KVM_PATH = '$(KVM_PATH)'"; \
echo "SOCAT_PATH = '$(SOCAT)'"; \