From 6249f1c2d0cabaf7e5bf0b1f9687f440cd490bd3 Mon Sep 17 00:00:00 2001
From: Michele Tartara <mtartara@google.com>
Date: Fri, 4 Jan 2013 09:45:51 +0000
Subject: [PATCH] Fix the installation location of mon-collector

The mon-collector binary was erroneously installed twice: once in
/usr/bin/ and once in /usr/lib/ganeti/.
With this modification, it is now installed in /usr/lib/ganeti/ only,
as intended.

In order to do this in a proper way, some parts of the Makefile.am where
refactored.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 Makefile.am | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 77e5c332b..ea695635d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -409,7 +409,21 @@ docrst = \
 	doc/virtual-cluster.rst \
 	doc/walkthrough.rst
 
-HS_PROGS = src/htools src/mon-collector
+# Haskell programs to be installed in $PREFIX/bin
+HS_BIN_PROGS=src/htools
+
+# Haskell programs to be installed in the MYEXECLIB dir
+HS_MYEXECLIB_PROGS=src/mon-collector
+
+# Haskell programs to compiled but not installed automatically
+# Usually they have their own specific installation rules
+HS_COMPILE_PROGS= \
+	src/hconfd \
+	src/rpc-test
+
+# All Haskell non-test programs to be compiled but not automatically installed
+HS_PROGS = $(HS_BIN_PROGS) $(HS_MYEXECLIB_PROGS)
+
 HS_BIN_ROLES = hbal hscan hspace hinfo hcheck hroller
 HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
 
@@ -418,8 +432,7 @@ HS_ALL_PROGS = \
 	test/hs/hpc-htools \
 	test/hs/hpc-mon-collector \
 	test/hs/htest \
-	src/hconfd \
-	src/rpc-test
+	$(HS_COMPILE_PROGS)
 
 HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
 HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail
@@ -659,7 +672,7 @@ qa_scripts = \
 
 bin_SCRIPTS =
 if WANT_HTOOLS
-bin_SCRIPTS += $(filter-out src/hail,$(HS_PROGS))
+bin_SCRIPTS += $(HS_BIN_PROGS)
 install-exec-hook:
 	@mkdir_p@ $(DESTDIR)$(iallocatorsdir)
 # FIXME: this is a hardcoded logic, instead of auto-resolving
@@ -771,7 +784,7 @@ myexeclib_SCRIPTS = \
 	daemons/daemon-util \
 	tools/kvm-ifup \
 	$(pkglib_python_scripts) \
-	src/mon-collector
+	$(HS_MYEXECLIB_PROGS)
 
 nodist_myexeclib_SCRIPTS = \
 	$(nodist_pkglib_python_scripts)
-- 
GitLab