Skip to contentSkip to conversation

cluster ./Makefile ./configure ccs/ccs_test/Ma ...

Cluster-devel [email protected] 1 participant 1 message Dec 20, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Changes by: fabbione at sourceware.org 2007-12-20 22:10:05

Modified files:

	.              : Makefile configure 
	ccs/ccs_test   : Makefile 
	ccs/ccs_tool   : Makefile 
	ccs/daemon     : Makefile 
	ccs/lib        : Makefile 
	ccs/man        : Makefile 

cman/cman_tool : Makefile
cman/daemon : Makefile
cman/init.d : Makefile
cman/lib : Makefile
cman/man : Makefile
cman/qdisk : Makefile
cman/tests : Makefile
dlm/lib : Makefile
dlm/man : Makefile
dlm/tests/usertest: Makefile
dlm/tool : Makefile
fence : Makefile
fence/agents/ipmilan: Makefile
fence/agents/manual: Makefile
fence/agents/rackswitch: Makefile
fence/agents/rps10: Makefile
fence/agents/scsi: Makefile
fence/agents/xvm: Makefile
fence/fence_node: Makefile
fence/fence_tool: Makefile
fence/fenced : Makefile
fence/man : Makefile
gfs/gfs_debug : Makefile
gfs/gfs_edit : Makefile
gfs/gfs_fsck : Makefile
gfs/gfs_grow : Makefile
gfs/gfs_jadd : Makefile
gfs/gfs_mkfs : Makefile
gfs/gfs_quota : Makefile
gfs/gfs_tool : Makefile
gfs/init.d : Makefile
gfs/libgfs : Makefile
gfs/man : Makefile
gfs/tests/filecon2: Makefile
gfs2/convert : Makefile
gfs2/edit : Makefile
gfs2/fsck : Makefile
gfs2/init.d : Makefile
gfs2/libgfs2 : Makefile
gfs2/man : Makefile
gfs2/mkfs : Makefile
gfs2/mount : Makefile
gfs2/quota : Makefile
gfs2/tool : Makefile
gnbd/client : Makefile
gnbd/man : Makefile
gnbd/server : Makefile
gnbd/tools/fence_gnbd: Makefile
gnbd/tools/gnbd_export: Makefile
gnbd/tools/gnbd_import: Makefile
gnbd/utils : Makefile
group/daemon : Makefile
group/dlm_controld: Makefile
group/gfs_controld: Makefile
group/lib : Makefile
group/man : Makefile
group/test : Makefile
group/tool : Makefile
make : defines.mk.input fenceperl.mk fencepy.mk
rgmanager/init.d: Makefile
rgmanager/man : Makefile
rgmanager/src/clulib: Makefile
rgmanager/src/daemons: Makefile
rgmanager/src/resources: Makefile
rgmanager/src/utils: Makefile

Log message:
* 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.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/Makefile.diff?cvsroot=cluster&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/configure.diff?cvsroot=cluster&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/ccs_test/Makefile.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/ccs_tool/Makefile.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/daemon/Makefile.diff?cvsroot=cluster&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/lib/Makefile.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/man/Makefile.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/Makefile.diff?cvsroot=cluster&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/Makefile.diff?cvsroot=cluster&r1=1.56&r2=1.57
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/init.d/Makefile.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/lib/Makefile.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/man/Makefile.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/qdisk/Makefile.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/tests/Makefile.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm/lib/Makefile.diff?cvsroot=cluster&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm/man/Makefile.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm/tests/usertest/Makefile.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/dlm/tool/Makefile.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/Makefile.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ipmilan/Makefile.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/manual/Makefile.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/rackswitch/Makefile.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/rps10/Makefile.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/scsi/Makefile.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/Makefile.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fence_node/Makefile.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fence_tool/Makefile.diff?cvsroot=cluster&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/Makefile.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/man/Makefile.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_debug/Makefile.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_edit/Makefile.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_fsck/Makefile.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_grow/Makefile.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_jadd/Makefile.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_mkfs/Makefile.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_quota/Makefile.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/gfs_tool/Makefile.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/init.d/Makefile.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/libgfs/Makefile.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/man/Makefile.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs/tests/filecon2/Makefile.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/convert/Makefile.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/edit/Makefile.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/fsck/Makefile.diff?cvsroot=cluster&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/init.d/Makefile.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/libgfs2/Makefile.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/man/Makefile.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mkfs/Makefile.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/Makefile.diff?cvsroot=cluster&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/quota/Makefile.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/tool/Makefile.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gnbd/client/Makefile.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gnbd/man/Makefile.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gnbd/server/Makefile.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gnbd/tools/fence_gnbd/Makefile.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gnbd/tools/gnbd_export/Makefile.diff?cvsroot=cluster&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gnbd/tools/gnbd_import/Makefile.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gnbd/utils/Makefile.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/Makefile.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/Makefile.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/Makefile.diff?cvsroot=cluster&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/lib/Makefile.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/man/Makefile.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/test/Makefile.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/Makefile.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/make/defines.mk.input.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/make/fenceperl.mk.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/make/fencepy.mk.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/init.d/Makefile.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/man/Makefile.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/Makefile.diff?cvsroot=cluster&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/Makefile.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/Makefile.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/utils/Makefile.diff?cvsroot=cluster&r1=1.19&r2=1.20

Makefile +1 -1
@@ -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
configure +46 -6

118 lines not on this page · raw message

ccs/ccs_test/Makefile +1 -1
@@ -27,7 +27,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)
 
-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
 depends:
ccs/ccs_tool/Makefile +2 -2
@@ -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:
ccs/daemon/Makefile +3 -3
@@ -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}
ccs/lib/Makefile +4 -4
@@ -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} 
ccs/man/Makefile +3 -3
@@ -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
cman/cman_tool/Makefile +1 -1
@@ -28,7 +28,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)
 
-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
 depends:
cman/daemon/Makefile +1 -1
@@ -34,7 +34,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
 
-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
 depends:
cman/init.d/Makefile +1 -1
@@ -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
cman/lib/Makefile +3 -3
@@ -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}
cman/man/Makefile +2 -2
@@ -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
cman/qdisk/Makefile +2 -2
@@ -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:
cman/tests/Makefile +1 -1
@@ -24,7 +24,7 @@
 depends:
 	$(MAKE) -C ../lib all
 
-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
 %: %.o
dlm/lib/Makefile +7 -7
@@ -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}
dlm/man/Makefile +4 -2
@@ -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
dlm/tests/usertest/Makefile +1 -1
@@ -25,7 +25,7 @@
 depends:
 	$(MAKE) -C ../../lib all
 
-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
 %: %.o
dlm/tool/Makefile +4 -3
@@ -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:
fence/Makefile +1 -1
@@ -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
fence/agents/ipmilan/Makefile +1 -1
@@ -25,7 +25,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)
 
-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
 install: all
fence/agents/manual/Makefile +1 -1
@@ -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
fence/agents/rackswitch/Makefile +1 -1
@@ -24,7 +24,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)
 
-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
 install: all
fence/agents/rps10/Makefile +1 -1
@@ -24,7 +24,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)
 
-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
 install: all
fence/agents/scsi/Makefile +9 -9
@@ -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}
fence/agents/xvm/Makefile +2 -2
@@ -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:
fence/fence_node/Makefile +1 -1
@@ -31,7 +31,7 @@
 ${TARGET}: ${OBJS}
 	$(CC) -o $@ $^ $(LDFLAGS)
 
-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
 install: all
fence/fence_tool/Makefile +2 -2
@@ -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
fence/fenced/Makefile +2 -2
@@ -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
fence/man/Makefile +3 -1
@@ -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
gfs/gfs_debug/Makefile +2 -2
@@ -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
gfs/gfs_edit/Makefile +2 -2
@@ -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
gfs/gfs_fsck/Makefile +3 -3
@@ -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}
gfs/gfs_grow/Makefile +2 -2
@@ -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:
gfs/gfs_jadd/Makefile +2 -2
@@ -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:
gfs/gfs_mkfs/Makefile +2 -2
@@ -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:
gfs/gfs_quota/Makefile +2 -2
@@ -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
gfs/gfs_tool/Makefile +2 -2
@@ -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
gfs/init.d/Makefile +1 -1
@@ -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
gfs/libgfs/Makefile +2 -2
@@ -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
gfs/man/Makefile +3 -1
@@ -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
gfs/tests/filecon2/Makefile +1 -1
@@ -21,7 +21,7 @@
 
 all: $(TARGETS)
 
-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
 %: %.o
gfs2/convert/Makefile +2 -2
@@ -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:
gfs2/edit/Makefile +2 -2
@@ -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:
gfs2/fsck/Makefile +3 -3
@@ -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}
gfs2/init.d/Makefile +1 -1
@@ -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
gfs2/libgfs2/Makefile +2 -2
@@ -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
gfs2/man/Makefile +3 -1
@@ -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
gfs2/mkfs/Makefile +6 -5
@@ -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}
gfs2/mount/Makefile +2 -2
@@ -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
gfs2/quota/Makefile +2 -2
@@ -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:
gfs2/tool/Makefile +2 -2
@@ -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:
gnbd/client/Makefile +2 -2
@@ -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
gnbd/man/Makefile +3 -1
@@ -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
gnbd/server/Makefile +2 -2
@@ -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
gnbd/tools/fence_gnbd/Makefile +2 -2
@@ -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
gnbd/tools/gnbd_export/Makefile +3 -3
@@ -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}
gnbd/tools/gnbd_import/Makefile +3 -2
@@ -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
gnbd/utils/Makefile +11 -1
@@ -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:
 
group/daemon/Makefile +2 -2
@@ -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:
group/dlm_controld/Makefile +2 -2
@@ -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:
group/gfs_controld/Makefile +2 -2
@@ -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:
group/lib/Makefile +2 -2
@@ -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
group/man/Makefile +3 -1
@@ -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
group/test/Makefile +1 -1
@@ -16,7 +16,7 @@
 
 all: $(TARGETS)
 
-%.o: %.c
+%.o: $(S)/%.c
 	$(CC) $(CFLAGS) -c -o $@ $<
 
 %: %.o
group/tool/Makefile +2 -2
@@ -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:
make/defines.mk.input +8 -4
@@ -27,10 +27,11 @@
 AR = ar
 RANLIB = ranlib
 
-CFLAGS += @CFLAGS@ -I at 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
 
make/fenceperl.mk +4 -4
@@ -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
make/fencepy.mk +3 -3
@@ -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
rgmanager/init.d/Makefile +1 -1
@@ -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
rgmanager/man/Makefile +3 -1
@@ -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
rgmanager/src/clulib/Makefile +2 -2
@@ -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:
rgmanager/src/daemons/Makefile +3 -3
@@ -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:
rgmanager/src/resources/Makefile +9 -4
@@ -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}
rgmanager/src/utils/Makefile +4 -4
@@ -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: