[PATCH 1/2] Allowing "configure" run from folders other than ".", by adding VPATH support

Doron Tsur <[email protected]>
Newsgroups gmane.linux.keepalived.devel
Message-ID <[email protected]>
Tests:
.../keepalived/configure --prefix=/usr/local && make && make
DESTDIR=/builds/keepalived_install install
Reviewed by: Itai Baz <[email protected]>
Signed-off-by: Doron Tsur <[email protected]>
---
 genhash/Makefile.in                |    6 ++++--
 keepalived/Makefile.in             |   19 +++++++++++--------
 keepalived/check/Makefile.in       |    4 +++-
 keepalived/core/Makefile.in        |    4 +++-
 keepalived/libipvs-2.6/Makefile.in |    2 ++
 keepalived/vrrp/Makefile.in        |    4 +++-
 lib/Makefile.in                    |    2 ++
 7 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/genhash/Makefile.in b/genhash/Makefile.in
index d41b392..98b6610 100644
--- a/genhash/Makefile.in
+++ b/genhash/Makefile.in
@@ -2,6 +2,8 @@
 #
 # Copyright (C) 2001-2012 Alexandre Cassen, <[email protected]>
 
+VPATH = @srcdir@
+
 EXEC = genhash
 BIN  = ../bin
 
@@ -13,7 +15,7 @@ datarootdir = @datarootdir@
 
 CC = @CC@
 STRIP = @STRIP@
-INCLUDES = -I../lib
+INCLUDES = -I@srcdir@/../lib -I../lib
 CFLAGS = @CFLAGS@ @CPPFLAGS@ $(INCLUDES) \
 	 -Wall -Wunused -Wstrict-prototypes
 LDFLAGS = @LIBS@ @LDFLAGS@
@@ -46,7 +48,7 @@ install:
 	install -d $(DESTDIR)$(bindir)
 	install -m 755 $(BIN)/$(EXEC) $(DESTDIR)$(bindir)/
 	install -d $(DESTDIR)$(mandir)/man1
-	install -m 644 ../doc/man/man1/genhash.1 $(DESTDIR)$(mandir)/man1
+	install -m 644 @srcdir@/../doc/man/man1/genhash.1 $(DESTDIR)$(mandir)/man1
 
 mrproper: clean distclean
 	rm -f config.*
diff --git a/keepalived/Makefile.in b/keepalived/Makefile.in
index cabcc5f..c7dfe70 100644
--- a/keepalived/Makefile.in
+++ b/keepalived/Makefile.in
@@ -5,7 +5,7 @@
 # Copyright (C) 2001-2012 Alexandre Cassen, <[email protected]>
 
 EXEC      = keepalived
-BIN       = ../bin
+BIN       = @top_builddir@/bin
 KERNEL    = @KERN@
 IPVS_FLAG = @IPVS_SUPPORT@
 VRRP_FLAG = @VRRP_SUPPORT@
@@ -41,7 +41,7 @@ ifeq ($(IPVS_FLAG),_WITH_LVS_)
   endif
 endif
 
-all:
+all: $(BIN)
 	@set -e; \
 	for i in $(SUBDIRS); do \
 	$(MAKE) -C $$i || exit 1; done && \
@@ -51,6 +51,9 @@ all:
 	@echo ""
 	@echo "Make complete"
 
+$(BIN):
+	mkdir -p $@
+
 debug:
 	@set -e; \
 	for i in $(SUBDIRS); do \
@@ -97,13 +100,13 @@ install:
 	install -d $(DESTDIR)$(sbindir)
 	install -m 700 $(BIN)/$(EXEC) $(DESTDIR)$(sbindir)/
 	install -d $(DESTDIR)$(init_dir)
-	install -m 755 etc/init.d/keepalived.init $(DESTDIR)$(init_dir)/keepalived
+	install -m 755 @srcdir@/etc/init.d/keepalived.init $(DESTDIR)$(init_dir)/keepalived
 	install -d $(DESTDIR)$(sysconf_dir)
-	install -m 755 etc/init.d/keepalived.sysconfig $(DESTDIR)$(sysconf_dir)/keepalived
+	install -m 755 @srcdir@/etc/init.d/keepalived.sysconfig $(DESTDIR)$(sysconf_dir)/keepalived
 	install -d $(DESTDIR)$(sysconfdir)/keepalived/samples
-	install -m 644 etc/keepalived/keepalived.conf $(DESTDIR)$(sysconfdir)/keepalived/
-	install -m 644 ../doc/samples/* $(DESTDIR)$(sysconfdir)/keepalived/samples/
+	install -m 644 @srcdir@/etc/keepalived/keepalived.conf $(DESTDIR)$(sysconfdir)/keepalived/
+	install -m 644 @srcdir@/../doc/samples/* $(DESTDIR)$(sysconfdir)/keepalived/samples/
 	install -d $(DESTDIR)$(mandir)/man5
 	install -d $(DESTDIR)$(mandir)/man8
-	install -m 644 ../doc/man/man5/keepalived.conf.5 $(DESTDIR)$(mandir)/man5
-	install -m 644 ../doc/man/man8/keepalived.8 $(DESTDIR)$(mandir)/man8
+	install -m 644 @srcdir@/../doc/man/man5/keepalived.conf.5 $(DESTDIR)$(mandir)/man5
+	install -m 644 @srcdir@/../doc/man/man8/keepalived.8 $(DESTDIR)$(mandir)/man8
diff --git a/keepalived/check/Makefile.in b/keepalived/check/Makefile.in
index 6a0470d..0777718 100644
--- a/keepalived/check/Makefile.in
+++ b/keepalived/check/Makefile.in
@@ -4,9 +4,11 @@
 #
 # Copyright (C) 2001-2012 Alexandre Cassen, <[email protected]>
 
+VPATH = @srcdir@
+
 CC	 = @CC@
 SNMP_FLAG = @SNMP_SUPPORT@
-INCLUDES = -I../include -I../../lib
+INCLUDES = -I@srcdir@/../include -I@srcdir@/../../lib -I../../lib
 CFLAGS	 = @CFLAGS@ @CPPFLAGS@ $(INCLUDES) \
 	   -Wall -Wunused -Wstrict-prototypes
 DEFS	 = -D@KERN@ -D@IPVS_SUPPORT@ -D@IPVS_SYNCD@ -D@VRRP_SUPPORT@ -D@SNMP_SUPPORT@ @DFLAGS@
diff --git a/keepalived/core/Makefile.in b/keepalived/core/Makefile.in
index fd081e9..77014bb 100644
--- a/keepalived/core/Makefile.in
+++ b/keepalived/core/Makefile.in
@@ -4,9 +4,11 @@
 #
 # Copyright (C) 2001-2012 Alexandre Cassen, <[email protected]>
 
+VPATH = @srcdir@
+
 CC	 = @CC@
 SNMP_FLAG = @SNMP_SUPPORT@
-INCLUDES = -I../include -I../../lib
+INCLUDES = -I@srcdir@/../include -I../../lib -I@srcdir@/../../lib
 CFLAGS	 = @CFLAGS@ @CPPFLAGS@ $(INCLUDES) \
 	   -Wall -Wunused -Wstrict-prototypes
 DEFS	 = -D@KERN@ -D@IPVS_SUPPORT@ -D@VRRP_SUPPORT@ -D@SNMP_SUPPORT@ @DFLAGS@
diff --git a/keepalived/libipvs-2.6/Makefile.in b/keepalived/libipvs-2.6/Makefile.in
index 14cfa95..a3e6e03 100644
--- a/keepalived/libipvs-2.6/Makefile.in
+++ b/keepalived/libipvs-2.6/Makefile.in
@@ -1,5 +1,7 @@
 # Makefile for libipvs
 
+VPATH = @srcdir@
+
 CC		= @CC@
 CFLAGS		= @CFLAGS@ @CPPFLAGS@ -D@USE_NL@ -Wall -Wunused
 
diff --git a/keepalived/vrrp/Makefile.in b/keepalived/vrrp/Makefile.in
index 51c2694..7d95097 100644
--- a/keepalived/vrrp/Makefile.in
+++ b/keepalived/vrrp/Makefile.in
@@ -4,9 +4,11 @@
 #
 # Copyright (C) 2001-2012 Alexandre Cassen, <[email protected]>
 
+VPATH = @srcdir@
+
 CC	 = @CC@
 SNMP_FLAG = @SNMP_SUPPORT@
-INCLUDES = -I../include -I../../lib
+INCLUDES = -I@srcdir@/../include -I@srcdir@/../../lib -I../../lib
 CFLAGS	 = @CFLAGS@ @CPPFLAGS@ $(INCLUDES) \
 	   -Wall -Wunused -Wstrict-prototypes
 DEFS	 = -D@KERN@ -D@IPVS_SUPPORT@ -D@IPVS_SYNCD@ -D@VRRP_VMAC@ -D@SNMP_SUPPORT@ @DFLAGS@
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 9eb929e..dba06fd 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -4,6 +4,8 @@
 #
 # Copyright (C) 2001-2011 Alexandre Cassen, <[email protected]>
 
+VPATH = @srcdir@
+
 CC	 = @CC@
 INCLUDES = -I.
 CFLAGS	 = @CFLAGS@ $(INCLUDES) \
-- 
1.7.1


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.