[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH] Implement objdir support in the build system




Hi guys,

this patch is biggish but extremely simple and it allows to run ./configure on a tree (without touching it) and it will setup a proper tree (mostly symlinks to the original tree) where you can cd and make leaving completely untouched the original source.
I saw at least 2 use cases for this:

1) share the same source (let say for example /usr/src NFS shared) across machines with different arches. 2) build the same source with different options in different trees without conflicts and having issues to sync the source across the trees.

The patch does:

* globally rename BUILDDIR to SRCDIR to reflect what it really is.

* top level configure:
 - add --objdir=/path option (default to current tree - it does not change
   current behaviour if not specified and different from current tree)
 - add a perl subroutine to handle symlinks
 - check and setup /path
 - switch all libdirs to use the objdir directly
 - propagate objdir to make/defines.mk

NOTE: those changes require 2 perl modules that should be available everywhere: Cwd 'abs_path'; and File::Basename;.

NOTE2: you will need to rerun ./configure after applying the patch.

* make/defines.mk.input:
 - suck in OBJDIR from top level configure
 - define THISDIR as a relative path from the top level.
   For example: if PWD /usr/src/cluster/cman/lib, THISDIR will contain
   cman/lib.
 - define S as full path to SRCDIR/THISDIR/

* all Makefiles:
 - convert includes path to use $(S) and always point to the source as
   defined in make/defines.mk.
 - fix all object generation targets to use $(S).
 - fix all install targets to $(S) where required.

* Random cleanup:
 - ccs/daemon/Makefile: do not kill files that are not around.
 - dlm/tool/Makefile: use ${dlmincdir} and $(SRCDIR)/group/dlm_controld/
   instead of relative paths and do not include itself as there are no
   header files. Also use ${dlmlibdir} for linking.
 - fence/Makefile: change build order as this is required to avoid extra
   hacks due to shared C files around.
 - gfs/gfs_fsck/Makefile: fix symlinking to be relative and not absolute
   or the symlink is useless.
 - gfs2/fsck/Makefile: likewise.
 - gfs2/mkfs/Makefile: likewise.
 - gnbd/utils/Makefile: create bits. This is to avoid even more hacks than
   fence/Makefile to cope with shared objects. One day we will need to
   review all of this.

Please apply or ACK or I will apply soonish (read during Xmas holidays).

Thanks
Fabio

Index: Makefile
===================================================================
RCS file: /cvs/cluster/cluster/Makefile,v
retrieving revision 1.32
diff -u -r1.32 Makefile
--- Makefile	1 Oct 2007 03:29:38 -0000	1.32
+++ Makefile	20 Dec 2007 21:34:44 -0000
@@ -33,7 +33,7 @@

 # Fix scripts permissions
 scripts:
-	chmod 755 ${BUILDDIR}/scripts/*.pl ${BUILDDIR}/scripts/define2var
+	chmod 755 ${SRCDIR}/scripts/*.pl ${SRCDIR}/scripts/define2var

 ${SUBDIRS}:
 	[ -n "${without_$ }" ] || ${MAKE} -C $@ all
Index: configure
===================================================================
RCS file: /cvs/cluster/cluster/configure,v
retrieving revision 1.42
diff -u -r1.42 configure
--- configure	20 Dec 2007 04:39:06 -0000	1.42
+++ configure	20 Dec 2007 21:34:44 -0000
@@ -16,7 +16,8 @@
 use warnings;
 use Getopt::Long;
 use POSIX qw(uname);
-
+use Cwd 'abs_path';
+use File::Basename;

 print "\nConfiguring Makefiles for your system...\n";

@@ -36,6 +37,7 @@
 	extracflags => \$extracflags,
 	ldflags => \$ldflags,
 	extraldflags => \$extraldflags,
+	objdir => \$objdir,
 	kernel_build => \$kernel_build,
 	kernel_src => \$kernel_src,
 	module_dir => \$module_dir,
@@ -97,6 +99,7 @@
 		    'extracflags=s',
 		    'ldflags=s',
 		    'extraldflags=s',
+		    'objdir=s',
 		    'kernel_build=s',
 		    'kernel_src=s',
 		    'module_dir=s',
@@ -175,6 +178,7 @@
   print "--extracflags=\tadd extra compiler options to default CFLAGS setting.  (Default: none)\n";
   print "--ldflags=\toverride default LDFLAGS settings.  (Default: none)\n";
   print "--extraldflags=\tadd extra linking options to default LDFLAGS settings.  (Default: none)\n";
+  print "--objdir=\tspecify directory where to store object files.  (Defaults: current build dir)\n";
   print "--kernel_build=\tthe directory containing the kernel object tree you wish to\n\t\tcompile against. (Default: /lib/modules/`uname -r`/build\n\t\tif available or /usr/src/linux as fallback)\n";
   print "--kernel_src=\tthe directory containing the kernel source you wish to\n\t\tcompile against.  (Default: /lib/modules/`uname -r`/source\n\t\tif available or \$kernel_build as fallback)\n";
   print "--incdir=\tthe base directory for include files.  (Default: {prefix}/include)\n";
@@ -280,6 +284,23 @@
   }
 }

+sub symlinks {
+  my $dir = shift;
+  my $pattern = shift;
+  @args = "find $dir -name $pattern";
+  open (IFILE, "@args |");
+  while (<IFILE>) {
+    chomp;
+    s|\./||g;
+    $dirname = dirname($_);
+    $filename = basename($_);
+    system("mkdir -p $objdir/$dirname");
+    symlink("${pwd}/$_","$objdir/$dirname/$filename");
+  }
+  close IFILE;
+  return 0;
+}
+
 $pwd = `pwd`;
 chomp($pwd);

@@ -308,6 +329,24 @@
   $prefix="/usr";
 }

+if (!$objdir) {
+  $objdir="${pwd}";
+} else {
+  $objdir = abs_path( $objdir );
+  if (! -d $objdir) {
+    print "\nSetting up objdir in $objdir\n";
+    mkdir "$objdir";
+    symlinks(".","Makefile");
+    symlinks(".","*.mk");
+    symlinks("gnbd-kernel","*.c");
+    symlinks("gnbd-kernel","*.h");
+    symlinks("gfs-kernel","*.c");
+    symlinks("gfs-kernel","*.h");
+  } else {
+    print "\nFound old objdir in $objdir: no actions taken\n";
+  }
+}
+
 my @un = POSIX::uname();
 if (!$kernel_build) {
   if (-d "/lib/modules/$un[2]/build") {
@@ -345,19 +384,19 @@
   $ccsincdir="${pwd}/ccs/lib";
 }
 if (!$ccslibdir) {
-  $ccslibdir="${pwd}/ccs/lib";
+  $ccslibdir="${objdir}/ccs/lib";
 }
 if (!$cmanincdir) {
   $cmanincdir="${pwd}/cman/lib";
 }
 if (!$cmanlibdir) {
-  $cmanlibdir="${pwd}/cman/lib";
+  $cmanlibdir="${objdir}/cman/lib";
 }
 if (!$dlmincdir) {
   $dlmincdir="${pwd}/dlm/lib";
 }
 if (!$dlmlibdir) {
-  $dlmlibdir="${pwd}/dlm/lib";
+  $dlmlibdir="${objdir}/dlm/lib";
 }
 if (!$volidincdir) {
   $volidincdir="${incdir}";
@@ -492,16 +531,17 @@
 }

 open IFILE, "<make/defines.mk.input" or die "Can't redirect stdin";
-open OFILE, ">make/defines.mk" or die "Can't redirect stdout";
+open OFILE, ">${objdir}/make/defines.mk" or die "Can't redirect stdout";

 print OFILE "# This file was generated by configure from defines.mk.input\n";

 while (<IFILE>) {
   chomp;
-  $_ =~ s/\ BUILDDIR\@/$pwd/;
+  $_ =~ s/\ SRCDIR\@/$pwd/;
   $_ =~ s/\ CC\@/$cc/;
   $_ =~ s/\ CFLAGS\@/$cflags/;
   $_ =~ s/\ LDFLAGS\@/$ldflags/;
+  $_ =~ s/\ OBJDIR\@/$objdir/;
   $_ =~ s/\ KERNEL_BUILD\@/$kernel_build/;
   $_ =~ s/\ KERNEL_SRC\@/$kernel_src/;
   $_ =~ s/\ MODULE_DIR\@/$module_dir/;
Index: ccs/ccs_test/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/ccs/ccs_test/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- ccs/ccs_test/Makefile	28 Aug 2007 04:35:38 -0000	1.9
+++ ccs/ccs_test/Makefile	20 Dec 2007 21:34:44 -0000
@@ -27,7 +27,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: ccs/ccs_tool/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/ccs/ccs_tool/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- ccs/ccs_tool/Makefile	28 Aug 2007 04:35:39 -0000	1.15
+++ ccs/ccs_tool/Makefile	20 Dec 2007 21:34:44 -0000
@@ -22,7 +22,7 @@

 CFLAGS += -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 CFLAGS += -I${ccsincdir} -I${cmanincdir} `xml2-config --cflags`
-CFLAGS += -I../include
+CFLAGS += -I$(S)/../include
 CFLAGS += -I${incdir}

 LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -lccs -lcman
@@ -33,7 +33,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: ccs/daemon/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/ccs/daemon/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- ccs/daemon/Makefile	28 Aug 2007 04:35:39 -0000	1.17
+++ ccs/daemon/Makefile	20 Dec 2007 21:34:44 -0000
@@ -22,7 +22,7 @@

 CFLAGS += -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 CFLAGS += -I${cmanincdir} `xml2-config --cflags`
-CFLAGS += -I. -I../include -I../common
+CFLAGS += -I$(S) -I$(S)/../include -I$(S)/../common
 CFLAGS += -I${incdir}

 LDFLAGS += -L${cmanlibdir} -lcman -L${ccslibdir} -lccs
@@ -33,7 +33,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
@@ -47,6 +47,6 @@
 	${UNINSTALL} ${TARGET} ${sbindir}

 clean:
-	rm -rf *.o ${TARGET} *~ log.c
+	rm -rf *.o ${TARGET} *~

 .PHONY: all ${TARGET}
Index: ccs/lib/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/ccs/lib/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- ccs/lib/Makefile	12 Nov 2007 08:16:59 -0000	1.9
+++ ccs/lib/Makefile	20 Dec 2007 21:34:44 -0000
@@ -19,7 +19,7 @@

 CFLAGS += -D_FILE_OFFSET_BITS=64
 CFLAGS += -fPIC
-CFLAGS += -I../include -I../common
+CFLAGS += -I$(S)/../include -I$(S)/../common
 CFLAGS += -I${incdir}

 all: ${TARGET}
@@ -28,17 +28,17 @@
 	${AR} cr $@ $^
 	${RANLIB} $@

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 log.c:
-	ln -sf ../common/log.c log.c
+	ln -sf $(S)/../common/log.c log.c

 install: all
 	install -d ${libdir}
 	install -m644 ${TARGET} ${libdir}
 	install -d ${incdir}
-	install -m644 ccs.h ${incdir}
+	install -m644 $(S)/ccs.h ${incdir}

 uninstall:
${UNINSTALL} ${TARGET} ${libdir} Index: ccs/man/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/ccs/man/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- ccs/man/Makefile	30 Apr 2007 11:21:59 -0000	1.4
+++ ccs/man/Makefile	20 Dec 2007 21:34:44 -0000
@@ -17,9 +17,9 @@
 	install -d ${mandir}/man5
 	install -d ${mandir}/man7
 	install -d ${mandir}/man8
-	install cluster.conf.5 ${mandir}/man5
-	install ccs.7 ${mandir}/man7
-	install ccsd.8 ccs_test.8 ccs_tool.8 ${mandir}/man8
+	install $(S)/cluster.conf.5 ${mandir}/man5
+	install $(S)/ccs.7 ${mandir}/man7
+	install $(S)/ccsd.8 $(S)/ccs_test.8 $(S)/ccs_tool.8 ${mandir}/man8

 uninstall:
 	${UNINSTALL} cluster.conf.5 ${mandir}/man5
Index: cman/cman_tool/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/cman/cman_tool/Makefile,v
retrieving revision 1.25
diff -u -r1.25 Makefile
--- cman/cman_tool/Makefile	7 Sep 2007 14:21:30 -0000	1.25
+++ cman/cman_tool/Makefile	20 Dec 2007 21:34:44 -0000
@@ -28,7 +28,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: cman/daemon/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/cman/daemon/Makefile,v
retrieving revision 1.56
diff -u -r1.56 Makefile
--- cman/daemon/Makefile	27 Nov 2007 14:54:53 -0000	1.56
+++ cman/daemon/Makefile	20 Dec 2007 21:34:44 -0000
@@ -34,7 +34,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: cman/init.d/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/cman/init.d/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- cman/init.d/Makefile	30 Apr 2007 11:22:01 -0000	1.4
+++ cman/init.d/Makefile	20 Dec 2007 21:34:44 -0000
@@ -20,7 +20,7 @@

 install:
 	install -d ${DESTDIR}/etc/init.d
-	install ${TARGET} ${DESTDIR}/etc/init.d
+	install $(S)/cman $(S)/qdiskd ${DESTDIR}/etc/init.d

 uninstall:
 	${UNINSTALL} ${TARGET} ${DESTDIR}/etc/init.d
Index: cman/lib/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/cman/lib/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- cman/lib/Makefile	28 Aug 2007 04:35:39 -0000	1.11
+++ cman/lib/Makefile	20 Dec 2007 21:34:44 -0000
@@ -19,7 +19,7 @@
 STATICLIB=$(TARGET).a

 CFLAGS += -fPIC
-CFLAGS += -I. -I../daemon
+CFLAGS += -I${cmanincdir} -I$(S)/../daemon
 CFLAGS += -I${incdir}

 all: $(STATICLIB) $(SHAREDLIB)
@@ -33,12 +33,12 @@
 	ln -sf $(TARGET).so.$(RELEASE_MAJOR).$(RELEASE_MINOR) $(TARGET).so
 	ln -sf $(TARGET).so.$(RELEASE_MAJOR).$(RELEASE_MINOR) $(TARGET).so.$(RELEASE_MAJOR)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
 	install -d ${incdir}
-	install $(TARGET).h ${incdir}
+	install $(S)/$(TARGET).h ${incdir}
 	install -d ${libdir}
 	install $(TARGET).a ${libdir}
 	install $(TARGET).so.$(RELEASE_MAJOR).$(RELEASE_MINOR) ${libdir}
Index: cman/man/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/cman/man/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- cman/man/Makefile	15 May 2007 14:37:30 -0000	1.4
+++ cman/man/Makefile	20 Dec 2007 21:34:44 -0000
@@ -20,8 +20,8 @@
 install:
 	install -d ${mandir}/man5
 	install -d ${mandir}/man8
-	install cman.5 qdisk.5 ${mandir}/man5
-	install cman_tool.8 qdiskd.8 mkqdisk.8 ${mandir}/man8
+	install $(S)/cman.5 $(S)/qdisk.5 ${mandir}/man5
+	install $(S)/cman_tool.8 $(S)/qdiskd.8 $(S)/mkqdisk.8 ${mandir}/man8

 uninstall:
 	${UNINSTALL} cman.5 qdisk.5 ${mandir}/man5
Index: cman/qdisk/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/cman/qdisk/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- cman/qdisk/Makefile	28 Aug 2007 04:35:39 -0000	1.13
+++ cman/qdisk/Makefile	20 Dec 2007 21:34:44 -0000
@@ -15,7 +15,7 @@
 CFLAGS += -D_GNU_SOURCE
 CFLAGS += -Werror -Wstrict-prototypes -Wshadow
 CFLAGS += -I${ccsincdir} -I${cmanincdir}
-CFLAGS += -I.
+CFLAGS += -I$(S)
 CFLAGS += -I${incdir}

 EXTRA_LDFLAGS += -L${cmanlibdir} -L${ccslibdir} -lcman -lccs
@@ -50,7 +50,7 @@
 	install -d ${sbindir}
 	install ${TARGET1} ${TARGET2} ${sbindir}

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: cman/tests/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/cman/tests/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- cman/tests/Makefile	29 Aug 2007 02:50:15 -0000	1.9
+++ cman/tests/Makefile	20 Dec 2007 21:34:44 -0000
@@ -24,7 +24,7 @@
 depends:
 	$(MAKE) -C ../lib all

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 %: %.o
Index: dlm/lib/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/dlm/lib/Makefile,v
retrieving revision 1.22
diff -u -r1.22 Makefile
--- dlm/lib/Makefile	28 Aug 2007 04:35:40 -0000	1.22
+++ dlm/lib/Makefile	20 Dec 2007 21:34:44 -0000
@@ -19,7 +19,7 @@
 SHAREDLIB=$(TARGET).so.${RELEASE_MAJOR}.${RELEASE_MINOR} $(TARGET)_lt.so.${RELEASE_MAJOR}.${RELEASE_MINOR}
 STATICLIB=$(TARGET).a $(TARGET)_lt.a

-CFLAGS += -I.
+CFLAGS += -I$(S)
 CFLAGS += -I${incdir}
 CFLAGS += -I$(KERNEL_SRC)/include

@@ -45,24 +45,24 @@
 	ln -sf $(TARGET)_lt.so.$(RELEASE_MAJOR).$(RELEASE_MINOR) $(TARGET)_lt.so
 	ln -sf $(TARGET)_lt.so.$(RELEASE_MAJOR).$(RELEASE_MINOR) $(TARGET)_lt.so.$(RELEASE_MAJOR)

-%_lt.o: %.c
+%_lt.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

-%_lt.po: %.c
+%_lt.po: $(S)/%.c
 	$(CC) $(CFLAGS) -fPIC -c -o $@ $<

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -D_REENTRANT -c -o $@ $<

-%.po: %.c
+%.po: $(S)/%.c
 	$(CC) $(CFLAGS) -fPIC -D_REENTRANT -c -o $@ $<

 install: all
 	install -d ${incdir}
-	install -m644 $(TARGET).h ${incdir}
+	install -m644 $(S)/$(TARGET).h ${incdir}
 	install -d ${libdir}
 	install -d ${DESTDIR}/etc/udev/rules.d
-	install -m644 ../scripts/51-dlm.rules ${DESTDIR}/etc/udev/rules.d
+	install -m644 $(S)/../scripts/51-dlm.rules ${DESTDIR}/etc/udev/rules.d
 	install $(TARGET).a ${libdir}
 	install $(TARGET)_lt.a ${libdir}
 	install $(TARGET).so.$(RELEASE_MAJOR).$(RELEASE_MINOR) ${libdir}
Index: dlm/man/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/dlm/man/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- dlm/man/Makefile	20 Aug 2007 14:30:56 -0000	1.5
+++ dlm/man/Makefile	20 Dec 2007 21:34:44 -0000
@@ -27,9 +27,11 @@

 install:
 	install -d ${mandir}/man3
-	install ${TARGET3} ${mandir}/man3
+	for i in ${TARGET3}; do \
+	 install $(S)/$$i ${mandir}/man3; \
+	done
 	install -d ${mandir}/man8
-	install ${TARGET8} ${mandir}/man8
+	install $(S)/${TARGET8} ${mandir}/man8

 uninstall:
 	${UNINSTALL} ${TARGET3} ${mandir}/man3
Index: dlm/tests/usertest/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/dlm/tests/usertest/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- dlm/tests/usertest/Makefile	28 Aug 2007 04:35:40 -0000	1.13
+++ dlm/tests/usertest/Makefile	20 Dec 2007 21:34:44 -0000
@@ -25,7 +25,7 @@
 depends:
 	$(MAKE) -C ../../lib all

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 %: %.o
Index: dlm/tool/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/dlm/tool/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- dlm/tool/Makefile	28 Aug 2007 04:35:40 -0000	1.4
+++ dlm/tool/Makefile	20 Dec 2007 21:34:44 -0000
@@ -16,17 +16,18 @@

 OBJS=	main.o

-CFLAGS += -I. -I../lib/ -I../../group/dlm_controld/
+CFLAGS += -I${dlmincdir}
+CFLAGS += -I$(SRCDIR)/group/dlm_controld/
 CFLAGS += -I${incdir}

-LDFLAGS += -L../lib -ldlm
+LDFLAGS += -L${dlmlibdir} -ldlm

 all: ${TARGET}

 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 clean:
Index: fence/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/fence/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- fence/Makefile	29 Aug 2007 03:09:54 -0000	1.9
+++ fence/Makefile	20 Dec 2007 21:34:44 -0000
@@ -14,4 +14,4 @@
 include ../make/defines.mk
 include ../make/passthrough.mk

-SUBDIRS=agents fence_node fence_tool fenced man
+SUBDIRS=agents fenced fence_node fence_tool man
Index: fence/agents/ipmilan/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/fence/agents/ipmilan/Makefile,v
retrieving revision 1.8
diff -u -r1.8 Makefile
--- fence/agents/ipmilan/Makefile	30 Aug 2007 18:33:11 -0000	1.8
+++ fence/agents/ipmilan/Makefile	20 Dec 2007 21:34:44 -0000
@@ -25,7 +25,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: fence/agents/manual/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/fence/agents/manual/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- fence/agents/manual/Makefile	3 May 2007 16:55:52 -0000	1.11
+++ fence/agents/manual/Makefile	20 Dec 2007 21:34:44 -0000
@@ -20,7 +20,7 @@
 # Using manual override instead of the binary version.
 # (this version does not require any configuration params
 # in cluster.conf, but fencing must fail first)
-fence_ack_manual: fence_ack_manual.sh
+fence_ack_manual: $(S)/fence_ack_manual.sh
 	cp $< $@

 install: all
Index: fence/agents/rackswitch/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/fence/agents/rackswitch/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- fence/agents/rackswitch/Makefile	22 Aug 2007 08:58:39 -0000	1.6
+++ fence/agents/rackswitch/Makefile	20 Dec 2007 21:34:44 -0000
@@ -24,7 +24,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: fence/agents/rps10/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/fence/agents/rps10/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- fence/agents/rps10/Makefile	22 Aug 2007 08:58:40 -0000	1.6
+++ fence/agents/rps10/Makefile	20 Dec 2007 21:34:44 -0000
@@ -24,7 +24,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: fence/agents/scsi/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/fence/agents/scsi/Makefile,v
retrieving revision 1.14
diff -u -r1.14 Makefile
--- fence/agents/scsi/Makefile	21 Sep 2007 01:07:50 -0000	1.14
+++ fence/agents/scsi/Makefile	20 Dec 2007 21:34:44 -0000
@@ -17,22 +17,22 @@

 all: $(TARGET) $(TARGET)_test

-$(TARGET): $(TARGET).pl
+$(TARGET):
 	: > $(TARGET)
-	awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(TARGET).pl >> $(TARGET)
+	awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(S)/$(TARGET).pl >> $(TARGET)
 	echo "\$$RELEASE_VERSION=\"${RELEASE_VERSION}\";" >> $(TARGET)
-	${DEF2VAR} ${BUILDDIR}/config/copyright.cf perl REDHAT_COPYRIGHT >> $(TARGET)
+	${DEF2VAR} ${SRCDIR}/config/copyright.cf perl REDHAT_COPYRIGHT >> $(TARGET)
 	echo "\$$BUILD_DATE=\"(built `date`)\";" >> $(TARGET)
-	awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(TARGET).pl >> $(TARGET)
+	awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(S)/$(TARGET).pl >> $(TARGET)
 	chmod +x $(TARGET)

-$(TARGET)_test: $(TARGET)_test.pl
+$(TARGET)_test:
 	: > $(TARGET)_test
-	awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(TARGET)_test.pl >> $(TARGET)_test
+	awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(S)/$(TARGET)_test.pl >> $(TARGET)_test
 	echo "\$$RELEASE_VERSION=\"${RELEASE_VERSION}\";" >> $(TARGET)_test
-	${DEF2VAR} ${BUILDDIR}/config/copyright.cf perl REDHAT_COPYRIGHT >> $(TARGET)_test
+	${DEF2VAR} ${SRCDIR}/config/copyright.cf perl REDHAT_COPYRIGHT >> $(TARGET)_test
 	echo "\$$BUILD_DATE=\"(built `date`)\";" >> $(TARGET)_test
-	awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(TARGET)_test.pl >> $(TARGET)_test
+	awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(S)/$(TARGET)_test.pl >> $(TARGET)_test
 	chmod +x $(TARGET)_test

 install: all
@@ -43,7 +43,7 @@
 	if [ ! -d ${DESTDIR}/etc/init.d ]; then \
 		install -d ${DESTDIR}/etc/init.d; \
 	fi
-	install -m755 ${SCRIPT} ${DESTDIR}/etc/init.d
+	install -m755 $(S)/${SCRIPT} ${DESTDIR}/etc/init.d

 uninstall:
 	${UNINSTALL} ${TARGET} ${TARGET}_test ${sbindir}
Index: fence/agents/xvm/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/fence/agents/xvm/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- fence/agents/xvm/Makefile	28 Aug 2007 04:35:40 -0000	1.15
+++ fence/agents/xvm/Makefile	20 Dec 2007 21:34:44 -0000
@@ -60,10 +60,10 @@
 ${TARGET3}: ${OBJS3}
 	$(CC) -o $@ $^ $(XML_LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

-%-standalone.o: %.c
+%-standalone.o: $(S)/%.c
 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<

 clean:
Index: fence/fence_node/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/fence/fence_node/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- fence/fence_node/Makefile	28 Aug 2007 04:35:40 -0000	1.10
+++ fence/fence_node/Makefile	20 Dec 2007 21:34:44 -0000
@@ -31,7 +31,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: fence/fence_tool/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/fence/fence_tool/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- fence/fence_tool/Makefile	28 Aug 2007 04:35:42 -0000	1.17
+++ fence/fence_tool/Makefile	20 Dec 2007 21:34:44 -0000
@@ -20,7 +20,7 @@

 CFLAGS += -D_FILE_OFFSET_BITS=64
 CFLAGS += -I${ccsincdir} -I${cmanincdir}
-CFLAGS += -I../include -I../../group/lib
+CFLAGS += -I$(S)/../include -I$(SRCDIR)/group/lib
 CFLAGS += -I${incdir}

 LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -lccs -lcman
@@ -31,7 +31,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: fence/fenced/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/fence/fenced/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- fence/fenced/Makefile	12 Nov 2007 08:02:11 -0000	1.13
+++ fence/fenced/Makefile	20 Dec 2007 21:34:44 -0000
@@ -23,7 +23,7 @@

 CFLAGS += -D_FILE_OFFSET_BITS=64
 CFLAGS += -I${ccsincdir} -I${cmanincdir}
-CFLAGS += -I. -I../include -I../../group/lib
+CFLAGS += -I$(S) -I$(S)/../include -I$(SRCDIR)/group/lib
 CFLAGS += -I${incdir}

 LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -lccs -lcman
@@ -34,7 +34,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: fence/man/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/fence/man/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- fence/man/Makefile	30 Apr 2007 11:22:11 -0000	1.11
+++ fence/man/Makefile	20 Dec 2007 21:34:44 -0000
@@ -43,7 +43,9 @@

 install:
 	install -d ${mandir}/man8
-	install ${TARGET8} ${mandir}/man8
+	for i in ${TARGET8}; do \
+	 install $(S)/$$i ${mandir}/man8; \
+	done

 uninstall:
 	${UNINSTALL} ${TARGET8} ${mandir}/man8
Index: gfs/gfs_debug/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs/gfs_debug/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- gfs/gfs_debug/Makefile	28 Aug 2007 04:35:42 -0000	1.10
+++ gfs/gfs_debug/Makefile	20 Dec 2007 21:34:44 -0000
@@ -24,7 +24,7 @@

 CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
 CFLAGS += -I${gfskincdir}
-CFLAGS += -I../include
+CFLAGS += -I$(S)/../include
 CFLAGS += -I${incdir}

 all: ${TARGET}
@@ -32,7 +32,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: gfs/gfs_edit/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs/gfs_edit/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- gfs/gfs_edit/Makefile	22 Aug 2007 08:58:43 -0000	1.10
+++ gfs/gfs_edit/Makefile	20 Dec 2007 21:34:44 -0000
@@ -20,7 +20,7 @@

 CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
 CFLAGS += -I${gfskincdir} -I${ncursesincdir}
-CFLAGS += -I../include
+CFLAGS += -I$(S)/../include
 CFLAGS += -I${incdir}

 LDFLAGS += -L${ncurseslibdir} -lncurses
@@ -30,7 +30,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: gfs/gfs_fsck/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs/gfs_fsck/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- gfs/gfs_fsck/Makefile	28 Aug 2007 04:35:42 -0000	1.13
+++ gfs/gfs_fsck/Makefile	20 Dec 2007 21:34:44 -0000
@@ -48,7 +48,7 @@

 CFLAGS += -D_FILE_OFFSET_BITS=64 -DHELPER_PROGRAM
 CFLAGS += -MMD
-CFLAGS += -I../include
+CFLAGS += -I$(S)/../include
 CFLAGS += -I${incdir}

 all: ${TARGET1} ${TARGET2}
@@ -59,7 +59,7 @@
 ${TARGET2}: ${TARGET1}
 	ln -s ${TARGET1} ${TARGET2}

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 test_block_list: block_list.o bitmap.o log.o test_block_list.o
@@ -76,7 +76,7 @@
 		install -d ${sbindir}; \
 	fi
 	install -m755 ${TARGET1} ${sbindir}
-	ln -sf ${sbindir}/${TARGET1} ${sbindir}/${TARGET2}
+	cd ${sbindir}; ln -sf ${TARGET1} ${TARGET2}

 uninstall:
 	${UNINSTALL} ${TARGET1} ${TARGET2} ${sbindir}
Index: gfs/gfs_grow/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs/gfs_grow/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- gfs/gfs_grow/Makefile	22 Aug 2007 08:58:43 -0000	1.11
+++ gfs/gfs_grow/Makefile	20 Dec 2007 21:34:44 -0000
@@ -20,7 +20,7 @@

 CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
 CFLAGS += -I${gfskincdir}
-CFLAGS += -I../include -I../libgfs
+CFLAGS += -I$(S)/../include -I$(S)/../libgfs
 CFLAGS += -I${incdir}

 LDFLAGS += -L../libgfs -lgfs
@@ -30,7 +30,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: gfs/gfs_jadd/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs/gfs_jadd/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- gfs/gfs_jadd/Makefile	22 Aug 2007 08:58:43 -0000	1.11
+++ gfs/gfs_jadd/Makefile	20 Dec 2007 21:34:44 -0000
@@ -20,7 +20,7 @@

 CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
 CFLAGS += -I${gfskincdir}
-CFLAGS += -I../include -I../libgfs
+CFLAGS += -I$(S)/../include -I$(S)/../libgfs
 CFLAGS += -I${incdir}

 LDFLAGS += -L../libgfs -lgfs
@@ -30,7 +30,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: gfs/gfs_mkfs/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs/gfs_mkfs/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- gfs/gfs_mkfs/Makefile	28 Aug 2007 04:35:42 -0000	1.12
+++ gfs/gfs_mkfs/Makefile	20 Dec 2007 21:34:44 -0000
@@ -25,7 +25,7 @@

 CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
 CFLAGS += -I${gfskincdir} -I${volidincdir}
-CFLAGS += -I../include -I../libgfs
+CFLAGS += -I$(S)/../include -I$(S)/../libgfs
 CFLAGS += -I${incdir}

 LDFLAGS += -L${volidlibdir} -lvolume_id
@@ -39,7 +39,7 @@
 ${TARGET2}: ${TARGET1}
 	ln -sf ${TARGET1} ${TARGET2}

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: gfs/gfs_quota/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs/gfs_quota/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- gfs/gfs_quota/Makefile	28 Aug 2007 04:35:42 -0000	1.11
+++ gfs/gfs_quota/Makefile	20 Dec 2007 21:34:44 -0000
@@ -23,7 +23,7 @@

 CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
 CFLAGS += -I${gfskincdir}
-CFLAGS += -I../include
+CFLAGS += -I$(S)/../include
 CFLAGS += -I${incdir}

 all: ${TARGET}
@@ -31,7 +31,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: gfs/gfs_tool/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs/gfs_tool/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- gfs/gfs_tool/Makefile	28 Aug 2007 04:35:43 -0000	1.15
+++ gfs/gfs_tool/Makefile	20 Dec 2007 21:34:44 -0000
@@ -27,7 +27,7 @@

 CFLAGS += -D_FILE_OFFSET_BITS=64
 CFLAGS += -I${gfskincdir}
-CFLAGS += -I../include
+CFLAGS += -I$(S)/../include
 CFLAGS += -I${incdir}

 all: ${TARGET}
@@ -35,7 +35,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: gfs/init.d/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs/init.d/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- gfs/init.d/Makefile	30 Apr 2007 11:22:14 -0000	1.4
+++ gfs/init.d/Makefile	20 Dec 2007 21:34:44 -0000
@@ -20,7 +20,7 @@

 install:
 	install -d ${DESTDIR}/etc/init.d
-	install ${TARGET} ${DESTDIR}/etc/init.d
+	install $(S)/${TARGET} ${DESTDIR}/etc/init.d

 uninstall:
 	${UNINSTALL} ${TARGET} ${DESTDIR}/etc/init.d
Index: gfs/libgfs/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs/libgfs/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- gfs/libgfs/Makefile	12 Nov 2007 08:17:00 -0000	1.11
+++ gfs/libgfs/Makefile	20 Dec 2007 21:34:44 -0000
@@ -19,7 +19,7 @@
 CFLAGS += -D_GNU_SOURCE -DHELPER_PROGRAM
 CFLAGS += -c
 CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I${gfskincdir} -I../include
+CFLAGS += -I${gfskincdir} -I$(S)/../include
 CFLAGS += -I${incdir}

 OBJS=	bio.o \
@@ -44,7 +44,7 @@
 	${AR} cru $@ $^
 	${RANLIB} $@

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: gfs/man/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs/man/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- gfs/man/Makefile	30 Apr 2007 11:22:14 -0000	1.4
+++ gfs/man/Makefile	20 Dec 2007 21:34:44 -0000
@@ -29,7 +29,9 @@

 install:
 	install -d ${mandir}/man8
-	install ${TARGET8} ${mandir}/man8
+	for i in ${TARGET8}; do \
+	 install $(S)/$$i ${mandir}/man8; \
+	done

 uninstall:
 	${UNINSTALL} ${TARGET8} ${mandir}/man8
Index: gfs/tests/filecon2/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs/tests/filecon2/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- gfs/tests/filecon2/Makefile	29 Aug 2007 02:51:38 -0000	1.2
+++ gfs/tests/filecon2/Makefile	20 Dec 2007 21:34:44 -0000
@@ -21,7 +21,7 @@

 all: $(TARGETS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 %: %.o
Index: gfs2/convert/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs2/convert/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- gfs2/convert/Makefile	28 Aug 2007 04:35:43 -0000	1.12
+++ gfs2/convert/Makefile	20 Dec 2007 21:34:45 -0000
@@ -18,7 +18,7 @@

 CFLAGS += -D_FILE_OFFSET_BITS=64 -DHELPER_PROGRAM
 CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I../include -I../libgfs2
+CFLAGS += -I$(S)/../include -I$(S)/../libgfs2
 CFLAGS += -I${incdir}

 LDFLAGS += -L../libgfs2 -lgfs2
@@ -28,7 +28,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: gfs2/edit/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs2/edit/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- gfs2/edit/Makefile	28 Aug 2007 04:35:43 -0000	1.12
+++ gfs2/edit/Makefile	20 Dec 2007 21:34:45 -0000
@@ -22,7 +22,7 @@
 CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
 CFLAGS += -I${ncursesincdir}
 CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I../include -I../libgfs2
+CFLAGS += -I$(S)/../include -I$(S)/../libgfs2
 CFLAGS += -I${incdir}

 LDFLAGS += -L${ncurseslibdir} -lncurses
@@ -33,7 +33,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: gfs2/fsck/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs2/fsck/Makefile,v
retrieving revision 1.16
diff -u -r1.16 Makefile
--- gfs2/fsck/Makefile	28 Aug 2007 04:35:43 -0000	1.16
+++ gfs2/fsck/Makefile	20 Dec 2007 21:34:45 -0000
@@ -37,7 +37,7 @@
 CFLAGS += -D_FILE_OFFSET_BITS=64 -DHELPER_PROGRAM
 CFLAGS += -MMD
 CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I../include -I../libgfs2
+CFLAGS += -I$(S)/../include -I$(S)/../libgfs2
 CFLAGS += -I${incdir}

 LDFLAGS += -L../libgfs2 -lgfs2
@@ -50,7 +50,7 @@
 ${TARGET2}: ${TARGET1}
 	ln -fs ${TARGET1} ${TARGET2}

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
@@ -70,7 +70,7 @@
 		install -d ${sbindir}; \
 	fi
 	install -m755 ${TARGET1} ${sbindir}
-	ln -sf ${sbindir}/${TARGET1} ${sbindir}/${TARGET2}
+	cd ${sbindir}; ln -sf ${TARGET1} ${TARGET2}

 uninstall:
 	${UNINSTALL} ${TARGET1} ${TARGET2} ${sbindir}
Index: gfs2/init.d/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs2/init.d/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- gfs2/init.d/Makefile	30 Apr 2007 11:22:16 -0000	1.4
+++ gfs2/init.d/Makefile	20 Dec 2007 21:34:45 -0000
@@ -20,7 +20,7 @@

 install:
 	install -d ${DESTDIR}/etc/init.d
-	install ${TARGET} ${DESTDIR}/etc/init.d
+	install $(S)/${TARGET} ${DESTDIR}/etc/init.d

 uninstall:
 	${UNINSTALL} ${TARGET} ${DESTDIR}/etc/init.d
Index: gfs2/libgfs2/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs2/libgfs2/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- gfs2/libgfs2/Makefile	12 Nov 2007 08:17:00 -0000	1.13
+++ gfs2/libgfs2/Makefile	20 Dec 2007 21:34:45 -0000
@@ -17,7 +17,7 @@

 CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE
 CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I../include
+CFLAGS += -I$(S)/../include
 CFLAGS += -I${incdir}

 OBJS=	bitmap.o \
@@ -43,7 +43,7 @@
 	${AR} cru $@ $^
 	${RANLIB} $@

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: gfs2/man/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs2/man/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- gfs2/man/Makefile	8 Oct 2007 21:40:32 -0000	1.4
+++ gfs2/man/Makefile	20 Dec 2007 21:34:45 -0000
@@ -31,7 +31,9 @@

 install:
 	install -d ${mandir}/man8
-	install ${TARGET8} ${mandir}/man8
+	for i in ${TARGET8}; do \
+	 install $(S)/$$i ${mandir}/man8; \
+	done

 uninstall:
 	${UNINSTALL} ${TARGET8} ${mandir}/man8
Index: gfs2/mkfs/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs2/mkfs/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- gfs2/mkfs/Makefile	28 Aug 2007 04:35:43 -0000	1.21
+++ gfs2/mkfs/Makefile	20 Dec 2007 21:34:45 -0000
@@ -17,7 +17,7 @@

 CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE
 CFLAGS += -I${KERNEL_SRC}/include/
-CFLAGS += -I../include/ -I../libgfs2/
+CFLAGS += -I$(S)/../include -I$(S)/../libgfs2
 CFLAGS += -I${incdir}

 LDFLAGS += -L${volidlibdir} -lvolume_id
@@ -37,7 +37,7 @@
 ${TARGET4}: ${TARGET1}
 	ln -sf ${TARGET1} ${TARGET4}

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
@@ -45,9 +45,10 @@

 install: all
 	install -m 0755 ${TARGET1} ${sbindir}
-	ln -sf ${sbindir}/${TARGET1} ${sbindir}/${TARGET2}
-	ln -sf ${sbindir}/${TARGET1} ${sbindir}/${TARGET3}
-	ln -sf ${sbindir}/${TARGET1} ${sbindir}/${TARGET4}
+	cd ${sbindir}; \
+	 ln -sf ${TARGET1} ${TARGET2}; \
+	 ln -sf ${TARGET1} ${TARGET3}; \
+	 ln -sf ${TARGET1} ${TARGET4}

 uninstall:
 	${UNINSTALL} ${TARGET1} ${TARGET2} ${TARGET3} ${TARGET4} ${sbindir}
Index: gfs2/mount/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs2/mount/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- gfs2/mount/Makefile	14 Nov 2007 12:33:45 -0000	1.19
+++ gfs2/mount/Makefile	20 Dec 2007 21:34:45 -0000
@@ -26,7 +26,7 @@
 CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 CFLAGS += -I${gfskincdir}
 CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I../include
+CFLAGS += -I$(S)/../include
 CFLAGS += -I${incdir}

 all: ${TARGET1} ${TARGET2}
@@ -37,7 +37,7 @@
 ${TARGET2}: ${SHAREDOBJS} ${OBJS2}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: gfs2/quota/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs2/quota/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- gfs2/quota/Makefile	28 Aug 2007 04:35:44 -0000	1.13
+++ gfs2/quota/Makefile	20 Dec 2007 21:34:45 -0000
@@ -21,7 +21,7 @@

 CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I../include -I../libgfs2/
+CFLAGS += -I$(S)/../include -I$(S)/../libgfs2
 CFLAGS += -I${incdir}

 LDFLAGS += -L../libgfs2 -lgfs2
@@ -31,7 +31,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: gfs2/tool/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gfs2/tool/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- gfs2/tool/Makefile	13 Nov 2007 17:03:41 -0000	1.15
+++ gfs2/tool/Makefile	20 Dec 2007 21:34:45 -0000
@@ -26,7 +26,7 @@

 CFLAGS += -D_FILE_OFFSET_BITS=64
 CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I../include -I../libgfs2/
+CFLAGS += -I$(S)/../include -I$(S)/../libgfs2
 CFLAGS += -I${incdir}

 LDFLAGS += -L../libgfs2 -lgfs2
@@ -36,7 +36,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: gnbd/client/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gnbd/client/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- gnbd/client/Makefile	28 Aug 2007 04:35:44 -0000	1.15
+++ gnbd/client/Makefile	20 Dec 2007 21:34:45 -0000
@@ -26,7 +26,7 @@
 	    ../utils/gnbd_utils.o

 CFLAGS += -I${gnbdkincdir} -I${cmanincdir}
-CFLAGS += -I../include -I../server -I../utils
+CFLAGS += -I$(S)/../include -I$(S)/../server -I$(S)/../utils
 CFLAGS += -I${incdir}

 LDFLAGS += -L${libdir} -L${cmanlibdir} -lcman -ldl -lpthread
@@ -39,7 +39,7 @@
 ${TARGET2}: ${SHAREDOBJS} ${OBJS2}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: gnbd/man/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gnbd/man/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- gnbd/man/Makefile	30 Apr 2007 11:22:18 -0000	1.4
+++ gnbd/man/Makefile	20 Dec 2007 21:34:45 -0000
@@ -26,7 +26,9 @@

 install:
 	install -d ${mandir}/man8
-	install ${TARGET8} ${mandir}/man8
+	for i in ${TARGET8}; do \
+	 install $(S)/$$i ${mandir}/man8; \
+	done

 uninstall:
 	${UNINSTALL} ${TARGET8} ${mandir}/man8
Index: gnbd/server/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gnbd/server/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- gnbd/server/Makefile	28 Aug 2007 04:35:44 -0000	1.15
+++ gnbd/server/Makefile	20 Dec 2007 21:34:45 -0000
@@ -31,7 +31,7 @@

 CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 CFLAGS += -I${gnbdkincdir} -I${cmanincdir}
-CFLAGS += -I../include -I../utils
+CFLAGS += -I$(S)/../include -I$(S)/../utils
 CFLAGS += -I${incdir}

 LDFLAGS+= -L${libdir} -L${cmanlibdir} -lcman -ldl -lpthread
@@ -44,7 +44,7 @@
 ${TARGET2}: ${SHAREDOBJS} ${OBJS2}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: gnbd/tools/fence_gnbd/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gnbd/tools/fence_gnbd/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- gnbd/tools/fence_gnbd/Makefile	22 Aug 2007 08:58:47 -0000	1.6
+++ gnbd/tools/fence_gnbd/Makefile	20 Dec 2007 21:34:45 -0000
@@ -17,7 +17,7 @@

 OBJS= main.o

-CFLAGS += -I../../include -I../../tools/gnbd_import
+CFLAGS += -I$(S)/../../include -I$(S)/../gnbd_import
 CFLAGS += -I${incdir}

 all: ${TARGET}
@@ -25,7 +25,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: gnbd/tools/gnbd_export/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gnbd/tools/gnbd_export/Makefile,v
retrieving revision 1.16
diff -u -r1.16 Makefile
--- gnbd/tools/gnbd_export/Makefile	28 Aug 2007 04:35:44 -0000	1.16
+++ gnbd/tools/gnbd_export/Makefile	20 Dec 2007 21:34:45 -0000
@@ -21,7 +21,7 @@

 CFLAGS += -DDEFAULT_GETUID=\"${sbindir}/gnbd_get_uid\"
 CFLAGS += -I${gnbdkincdir} -I${cmanincdir}
-CFLAGS += -I../../include -I../../server -I../../utils
+CFLAGS += -I$(S)/../../include -I$(S)/../../server -I$(S)/../../utils
 CFLAGS += -I${incdir}

 LDFLAGS += -L${libdir} -L${cmanlibdir} -lcman -ldl -lpthread
@@ -31,7 +31,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

install: all @@ -39,7 +39,7 @@
 		install -d ${sbindir}; \
 	fi
 	install -m755 ${TARGET} ${sbindir}
-	install -m755 gnbd_get_uid ${sbindir}
+	install -m755 $(S)/gnbd_get_uid ${sbindir}

 uninstall:
 	${UNINSTALL} ${TARGET} gnbd_get_uid ${sbindir}
Index: gnbd/tools/gnbd_import/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gnbd/tools/gnbd_import/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- gnbd/tools/gnbd_import/Makefile	28 Aug 2007 04:35:44 -0000	1.13
+++ gnbd/tools/gnbd_import/Makefile	20 Dec 2007 21:34:45 -0000
@@ -21,7 +21,8 @@
 	../../utils/trans.o

 CFLAGS += -I${gnbdkincdir} -I${cmanincdir}
-CFLAGS += -I../../include -I../../client -I../../server -I../../utils
+CFLAGS += -I$(S)/../../include -I$(S)/../../server
+CFLAGS += -I$(S)/../../utils -I$(S)/../../client
 CFLAGS += -I${incdir}

 LDFLAGS += -L${libdir} -L${cmanlibdir} -lcman -ldl -lpthread
@@ -31,7 +32,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: gnbd/utils/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/gnbd/utils/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- gnbd/utils/Makefile	30 Apr 2007 11:22:19 -0000	1.1
+++ gnbd/utils/Makefile	20 Dec 2007 21:34:45 -0000
@@ -13,7 +13,17 @@

 include ../../make/defines.mk

-all:
+SHAREDOBJS= member_cman.o \
+	    trans.o \
+	    gnbd_utils.o
+
+CFLAGS += -I${cmanincdir}
+CFLAGS += -I$(S)/../include
+
+all: ${SHAREDOBJS}
+
+%.o: $(S)/%.c
+	$(CC) $(CFLAGS) -c -o $@ $<

 install:

Index: group/daemon/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/group/daemon/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- group/daemon/Makefile	28 Aug 2007 04:35:44 -0000	1.21
+++ group/daemon/Makefile	20 Dec 2007 21:34:45 -0000
@@ -21,7 +21,7 @@
 	main.o

 CFLAGS += -I${cmanincdir} -I${openaisincdir}
-CFLAGS += -I. -I../include/ -I../lib/
+CFLAGS += -I$(S) -I$(S)/../include/ -I$(S)/../lib/
 CFLAGS += -I${incdir}

 LDFLAGS += -L${cmanlibdir} -L${openaislibdir} -L${libdir} -lcman -lcpg
@@ -31,7 +31,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 clean:
Index: group/dlm_controld/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/group/dlm_controld/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- group/dlm_controld/Makefile	28 Aug 2007 04:35:45 -0000	1.12
+++ group/dlm_controld/Makefile	20 Dec 2007 21:34:45 -0000
@@ -22,7 +22,7 @@

 CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${dlmincdir} -I${openaisincdir}
 CFLAGS += -I${KERNEL_SRC}/include/
-CFLAGS += -I../../group/lib/ -I../include/
+CFLAGS += -I$(S)/../lib/ -I$(S)/../include/
 CFLAGS += -I${incdir}

 LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -L${dlmlibdir} -lccs -lcman -ldlm
@@ -34,7 +34,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: group/gfs_controld/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/group/gfs_controld/Makefile,v
retrieving revision 1.14
diff -u -r1.14 Makefile
--- group/gfs_controld/Makefile	28 Aug 2007 04:35:45 -0000	1.14
+++ group/gfs_controld/Makefile	20 Dec 2007 21:34:45 -0000
@@ -23,7 +23,7 @@

 CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${openaisincdir}
 CFLAGS += -I${KERNEL_SRC}/include/
-CFLAGS += -I../include/ -I../lib/
+CFLAGS += -I$(S)/../lib/ -I$(S)/../include/
 CFLAGS += -I${incdir}

 LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -lcman -lccs
@@ -37,7 +37,7 @@
 	$(CC) -o $@ $^ $(LDFLAGS)


-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: group/lib/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/group/lib/Makefile,v
retrieving revision 1.8
diff -u -r1.8 Makefile
--- group/lib/Makefile	12 Nov 2007 08:17:00 -0000	1.8
+++ group/lib/Makefile	20 Dec 2007 21:34:45 -0000
@@ -16,7 +16,7 @@
 STATICLIB=$(TARGET).a

 CFLAGS += -fPIC
-CFLAGS += -I. -I../daemon
+CFLAGS += -I$(S) -I$(S)/../daemon
 CFLAGS += -I${incdir}

 all: $(STATICLIB)
@@ -25,7 +25,7 @@
 	${AR} r $@ $^
 	${RANLIB} $@

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 install: all
Index: group/man/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/group/man/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- group/man/Makefile	17 Aug 2007 18:52:27 -0000	1.1
+++ group/man/Makefile	20 Dec 2007 21:34:45 -0000
@@ -24,7 +24,9 @@

 install:
 	install -d ${mandir}/man8
-	install ${TARGET8} ${mandir}/man8
+	for i in ${TARGET8}; do \
+	 install $(S)/$$i ${mandir}/man8; \
+	done

 uninstall:
 	${UNINSTALL} ${TARGET8} ${mandir}/man8
Index: group/test/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/group/test/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- group/test/Makefile	29 Aug 2007 02:52:45 -0000	1.3
+++ group/test/Makefile	20 Dec 2007 21:34:45 -0000
@@ -16,7 +16,7 @@

 all: $(TARGETS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 %: %.o
Index: group/tool/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/group/tool/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- group/tool/Makefile	28 Aug 2007 04:35:45 -0000	1.11
+++ group/tool/Makefile	20 Dec 2007 21:34:45 -0000
@@ -16,7 +16,7 @@

 OBJS=	main.o

-CFLAGS += -I. -I../lib/ -I../daemon/
+CFLAGS += -I$(S) -I$(S)/../daemon/ -I$(S)/../lib/
 CFLAGS += -I${incdir}

 LDFLAGS += -L../lib -lgroup
@@ -26,7 +26,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:
Index: make/defines.mk.input
===================================================================
RCS file: /cvs/cluster/cluster/make/defines.mk.input,v
retrieving revision 1.8
diff -u -r1.8 defines.mk.input
--- make/defines.mk.input	7 Dec 2007 00:53:44 -0000	1.8
+++ make/defines.mk.input	20 Dec 2007 21:34:45 -0000
@@ -27,10 +27,11 @@
 AR = ar
 RANLIB = ranlib

-CFLAGS += @CFLAGS@ -I BUILDDIR@/config
+CFLAGS += @CFLAGS@ -I SRCDIR@/config
 LDFLAGS += @LDFLAGS@

-BUILDDIR = @BUILDDIR@
+SRCDIR = @SRCDIR@
+OBJDIR = @OBJDIR@

 KERNEL_BUILD = @KERNEL_BUILD@
 KERNEL_SRC = @KERNEL_SRC@
@@ -76,6 +77,9 @@
 without_gnbd ?= @DISABLE_GNBD@
 without_rgmanager ?= @DISABLE_RGMANAGER@

-UNINSTALL = @BUILDDIR@/scripts/uninstall.pl
-DEF2VAR = @BUILDDIR@/scripts/define2var
+THISDIR = $(shell echo $(CURDIR) | sed -e 's|$(OBJDIR)/||g')
+S=$(SRCDIR)/$(THISDIR)
+
+UNINSTALL = @SRCDIR@/scripts/uninstall.pl
+DEF2VAR = @SRCDIR@/scripts/define2var

Index: make/fenceperl.mk
===================================================================
RCS file: /cvs/cluster/cluster/make/fenceperl.mk,v
retrieving revision 1.1
diff -u -r1.1 fenceperl.mk
--- make/fenceperl.mk	30 Aug 2007 18:40:37 -0000	1.1
+++ make/fenceperl.mk	20 Dec 2007 21:34:45 -0000
@@ -13,13 +13,13 @@

 all: $(TARGET)

-$(TARGET): $(TARGET).pl
+$(TARGET):
 	: > $(TARGET)
-	awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(TARGET).pl >> $(TARGET)
+	awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(S)/$(TARGET).pl >> $(TARGET)
 	echo "\$$RELEASE_VERSION=\"${RELEASE_VERSION}\";" >> $(TARGET)
-	${DEF2VAR} ${BUILDDIR}/config/copyright.cf perl REDHAT_COPYRIGHT >> $(TARGET)
+	${DEF2VAR} ${SRCDIR}/config/copyright.cf perl REDHAT_COPYRIGHT >> $(TARGET)
 	echo "\$$BUILD_DATE=\"(built `date`)\";" >> $(TARGET)
-	awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(TARGET).pl >> $(TARGET)
+	awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(S)/$(TARGET).pl >> $(TARGET)
 	chmod +x $(TARGET)

 install: all
Index: make/fencepy.mk
===================================================================
RCS file: /cvs/cluster/cluster/make/fencepy.mk,v
retrieving revision 1.1
diff -u -r1.1 fencepy.mk
--- make/fencepy.mk	30 Aug 2007 18:41:31 -0000	1.1
+++ make/fencepy.mk	20 Dec 2007 21:34:45 -0000
@@ -2,11 +2,11 @@

 $(TARGET):
 	: > $(TARGET)
-	awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(TARGET).py >> $(TARGET)
+	awk "{print}(\$$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $(S)/$(TARGET).py >> $(TARGET)
 	echo "RELEASE_VERSION=\"${RELEASE_VERSION}\";" >> $(TARGET)
-	${DEF2VAR} ${BUILDDIR}/config/copyright.cf sh REDHAT_COPYRIGHT >> $(TARGET)
+	${DEF2VAR} ${SRCDIR}/config/copyright.cf sh REDHAT_COPYRIGHT >> $(TARGET)
 	echo "BUILD_DATE=\"(built `date`)\";" >> $(TARGET)
-	awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(TARGET).py >> $(TARGET)
+	awk -v p=0 "(\$$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $(S)/$(TARGET).py >> $(TARGET)
 	chmod +x $(TARGET)

 install: all
Index: rgmanager/init.d/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/rgmanager/init.d/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- rgmanager/init.d/Makefile	30 Apr 2007 11:22:22 -0000	1.3
+++ rgmanager/init.d/Makefile	20 Dec 2007 21:34:45 -0000
@@ -22,7 +22,7 @@

 install:
 	install -d ${DESTDIR}/etc/init.d
-	install ${TARGET} ${DESTDIR}/etc/init.d
+	install $(S)/${TARGET} ${DESTDIR}/etc/init.d

 uninstall:
 	${UNINSTALL} ${TARGET} ${DESTDIR}/etc/init.d
Index: rgmanager/man/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/rgmanager/man/Makefile,v
retrieving revision 1.6
diff -u -r1.6 Makefile
--- rgmanager/man/Makefile	30 Apr 2007 11:22:22 -0000	1.6
+++ rgmanager/man/Makefile	20 Dec 2007 21:34:45 -0000
@@ -24,7 +24,9 @@

 install:
 	install -d ${mandir}/man8
-	install ${TARGETS} ${mandir}/man8
+	for i in ${TARGET8}; do \
+	 install $(S)/$$i ${mandir}/man8; \
+	done

 uninstall:
 	${UNINSTALL} ${TARGETS} ${mandir}/man8
Index: rgmanager/src/clulib/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/rgmanager/src/clulib/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- rgmanager/src/clulib/Makefile	30 Nov 2007 21:36:28 -0000	1.19
+++ rgmanager/src/clulib/Makefile	20 Dec 2007 21:34:45 -0000
@@ -27,7 +27,7 @@

 CFLAGS += -Werror -Wstrict-prototypes -Wshadow -fPIC -D_GNU_SOURCE
 CFLAGS += -I${cmanincdir} -I${dlmincdir}
-CFLAGS += -I../../include
+CFLAGS += -I$(S)/../../include
 CFLAGS += -I${incdir}

LDFLAGS += -L${cmanlibdir} -lcman @@ -51,7 +51,7 @@
 ${TARGET3}: ${OBJS3} ${TARGET1}
 	$(CC) -o $@ $^ $(LDFLAGS)

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 clean:
Index: rgmanager/src/daemons/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/rgmanager/src/daemons/Makefile,v
retrieving revision 1.26
diff -u -r1.26 Makefile
--- rgmanager/src/daemons/Makefile	7 Dec 2007 00:53:44 -0000	1.26
+++ rgmanager/src/daemons/Makefile	20 Dec 2007 21:34:45 -0000
@@ -56,7 +56,7 @@
 CFLAGS += -Werror -Wstrict-prototypes -Wshadow -fPIC
 CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${dlmincdir}
 CFLAGS += `xml2-config --cflags` -I${readlineincdir} -I${slangincdir}
-CFLAGS += -I../../include
+CFLAGS += -I$(S)/../../include
 CFLAGS += -I${incdir}

 EXTRA_CFLAGS += -DNO_CCS
@@ -110,10 +110,10 @@
 check: rg_test
 	cd tests && ./runtests.sh

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

-%-noccs.o: %.c
+%-noccs.o: $(S)/%.c
 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<

 depends:
Index: rgmanager/src/resources/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/rgmanager/src/resources/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- rgmanager/src/resources/Makefile	30 Nov 2007 21:36:29 -0000	1.21
+++ rgmanager/src/resources/Makefile	20 Dec 2007 21:34:45 -0000
@@ -36,10 +36,15 @@
 	echo ${sbindir}
 	install -d ${sharedir}
 	install -d ${sharedir}/utils
-	install $(RESOURCES) ${sharedir}
-	install -m 644 $(TARGETS) ${sharedir}
-	install $(UTIL_TARGETS) ${sharedir}/utils
-	install -m 644 $(METADATA) ${sharedir}
+	for i in $(RESOURCES); do \
+	 install $(S)/$$i ${sharedir}; \
+	done
+	for i in $(TARGETS) $(METADATA); do \
+	 install -m 644 $(S)/$$i ${sharedir}; \
+	done
+	for i in $(UTIL_TARGETS); do \
+	 install $(S)/$$i ${sharedir}/utils; \
+	done

 uninstall:
 	${UNINSTALL} ${TARGETS} ${METADATA} ${UTIL_TARGETS} ${sharedir}
Index: rgmanager/src/utils/Makefile
===================================================================
RCS file: /cvs/cluster/cluster/rgmanager/src/utils/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- rgmanager/src/utils/Makefile	28 Aug 2007 04:35:47 -0000	1.19
+++ rgmanager/src/utils/Makefile	20 Dec 2007 21:34:45 -0000
@@ -23,7 +23,7 @@

 CFLAGS += -Werror -Wstrict-prototypes -Wshadow -fPIC -D_GNU_SOURCE
 CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${dlmincdir} -I${ncursesincdir}
-CFLAGS += -I../../include
+CFLAGS += -I$(S)/../../include
 CFLAGS += -I${incdir}

 LDFLAGS += -L${libdir} -L${ccslibdir} -L${cmanlibdir} -L${ncurseslibdir}
@@ -47,11 +47,11 @@
 ${TARGET5}: ${TARGET5:=.o}
 	$(CC) -o $@ $^ $(LDFLAGS)

-${TARGET6}: ${TARGET6}.sh
-	cp ${TARGET6}.sh ${TARGET6}
+${TARGET6}:
+	cp $(S)/${TARGET6}.sh ${TARGET6}
 	chmod 755 ${TARGET6}

-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<

 depends:

--
I'm going to make him an offer he can't refuse.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]