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

[Cluster-devel] [RFC/PATCH] Collecting common Makefile snippets



The patch in attachment is just a working example.

The general idea is to start to collect all common Makefile targets into
their own makefile snippets now that most of the Makefiles share lots of common
targets.

Pro:
- It will allow us to change common bits in one place and they will be
automatically propagated all over the tree instead of having to change N Makefiles.
- General Makefiles will be much smaller.
- It will still be possible to special case bits here and there. (from this
example patch you can look at gfs/Makefile and fence/agents/Makefile that are
not touched by the patch).
- It will be possible to override targets in local Makefiles.

Cons:
- When creating new makefiles you need to know which snippets to include.
- When reading a makefile you need to remember what targets are automatically
sourced from a snippet.


Cheers
Fabio

-- 
I'm going to make him an offer he can't refuse.
diff -Naurd redhat-cluster-suite-2.20070823/ccs/Makefile cluster/ccs/Makefile
--- redhat-cluster-suite-2.20070823/ccs/Makefile	2007-05-02 14:51:07.000000000 +0200
+++ cluster/ccs/Makefile	2007-08-27 08:09:38.000000000 +0200
@@ -11,13 +11,6 @@
 ###############################################################################
 
 include ../make/defines.mk
+include ../make/passthrough.mk
 
 SUBDIRS=lib daemon ccs_test ccs_tool man
-
-all: ${SUBDIRS}
-
-%:
-	set -e && \
-	for i in ${SUBDIRS}; do \
-		${MAKE} -C $$i $@; \
-	done
diff -Naurd redhat-cluster-suite-2.20070823/cman/Makefile cluster/cman/Makefile
--- redhat-cluster-suite-2.20070823/cman/Makefile	2007-04-30 13:31:45.000000000 +0200
+++ cluster/cman/Makefile	2007-08-27 08:09:38.000000000 +0200
@@ -12,13 +12,6 @@
 ###############################################################################
 
 include ../make/defines.mk
+include ../make/passthrough.mk
 
 SUBDIRS=lib cman_tool daemon qdisk init.d man
-
-all: ${SUBDIRS}
-
-%:
-	set -e && \
-	for i in ${SUBDIRS}; do \
-		${MAKE} -C $$i $@; \
-	done
diff -Naurd redhat-cluster-suite-2.20070823/dlm/Makefile cluster/dlm/Makefile
--- redhat-cluster-suite-2.20070823/dlm/Makefile	2007-08-23 06:48:19.000000000 +0200
+++ cluster/dlm/Makefile	2007-08-27 08:09:38.000000000 +0200
@@ -10,10 +10,7 @@
 ###############################################################################
 ###############################################################################
 
-SUBDIRS=lib tool man
+include ../make/defines.mk
+include ../make/passthrough.mk
 
-%:
-	set -e && \
-	for i in ${SUBDIRS}; do \
-		${MAKE} -C $$i $@; \
-	done
+SUBDIRS=lib tool man
diff -Naurd redhat-cluster-suite-2.20070823/dlm/tests/Makefile cluster/dlm/tests/Makefile
--- redhat-cluster-suite-2.20070823/dlm/tests/Makefile	2007-08-24 16:10:27.000000000 +0200
+++ cluster/dlm/tests/Makefile	2007-08-27 08:10:07.000000000 +0200
@@ -10,10 +10,7 @@
 ###############################################################################
 ###############################################################################
 
-SUBDIRS=usertest
+include ../../make/defines.mk
+include ../../make/passthrough.mk
 
-%:
-	set -e && \
-	for i in ${SUBDIRS}; do \
-		${MAKE} -C $$i $@; \
-	done
+SUBDIRS=usertest
diff -Naurd redhat-cluster-suite-2.20070823/fence/Makefile cluster/fence/Makefile
--- redhat-cluster-suite-2.20070823/fence/Makefile	2007-04-30 13:31:47.000000000 +0200
+++ cluster/fence/Makefile	2007-08-27 08:09:38.000000000 +0200
@@ -12,13 +12,6 @@
 ###############################################################################
 
 include ../make/defines.mk
+include ../make/passthrough.mk
 
 SUBDIRS=agents fence_node fence_tool fenced man
-
-all: ${SUBDIRS}
-
-%:
-	set -e && \
-	for i in ${SUBDIRS}; do \
-		${MAKE} -C $$i $@; \
-	done
diff -Naurd redhat-cluster-suite-2.20070823/gfs/Makefile cluster/gfs/Makefile
--- redhat-cluster-suite-2.20070823/gfs/Makefile	2007-04-30 13:31:48.000000000 +0200
+++ cluster/gfs/Makefile	2007-08-27 08:04:57.000000000 +0200
@@ -30,4 +30,3 @@
 	if [ "$@" = "uninstall" ]; then \
 		cd ${sbindir}; rm -f mount.gfs umount.gfs; \
 	fi
-		
diff -Naurd redhat-cluster-suite-2.20070823/gfs2/Makefile cluster/gfs2/Makefile
--- redhat-cluster-suite-2.20070823/gfs2/Makefile	2007-04-30 13:31:49.000000000 +0200
+++ cluster/gfs2/Makefile	2007-08-27 08:09:38.000000000 +0200
@@ -12,13 +12,6 @@
 ###############################################################################
 
 include ../make/defines.mk
+include ../make/passthrough.mk
 
 SUBDIRS=libgfs2 convert edit fsck mkfs mount quota tool man init.d
-
-all: ${SUBDIRS}
-
-%:
-	set -e && \
-	for i in ${SUBDIRS}; do \
-		${MAKE} -C $$i $@; \
-	done
diff -Naurd redhat-cluster-suite-2.20070823/gnbd/Makefile cluster/gnbd/Makefile
--- redhat-cluster-suite-2.20070823/gnbd/Makefile	2007-04-30 13:31:51.000000000 +0200
+++ cluster/gnbd/Makefile	2007-08-27 08:09:38.000000000 +0200
@@ -12,13 +12,6 @@
 ###############################################################################
 
 include ../make/defines.mk
+include ../make/passthrough.mk
 
 SUBDIRS=utils client server tools man
-
-all: ${SUBDIRS}
-
-%:
-	set -e && \
-	for i in ${SUBDIRS}; do \
-		${MAKE} -C $$i $@; \
-	done
diff -Naurd redhat-cluster-suite-2.20070823/gnbd/tools/Makefile cluster/gnbd/tools/Makefile
--- redhat-cluster-suite-2.20070823/gnbd/tools/Makefile	2007-04-30 13:31:51.000000000 +0200
+++ cluster/gnbd/tools/Makefile	2007-08-27 08:10:37.000000000 +0200
@@ -12,13 +12,6 @@
 ###############################################################################
 
 include ../../make/defines.mk
+include ../../make/passthrough.mk
 
 SUBDIRS=fence_gnbd gnbd_export gnbd_import
-
-all: ${SUBDIRS}
-
-%:
-	set -e && \
-	for i in ${SUBDIRS}; do \
-		${MAKE} -C $$i $@; \
-	done
diff -Naurd redhat-cluster-suite-2.20070823/group/Makefile cluster/group/Makefile
--- redhat-cluster-suite-2.20070823/group/Makefile	2007-08-23 06:48:20.000000000 +0200
+++ cluster/group/Makefile	2007-08-27 08:09:38.000000000 +0200
@@ -10,10 +10,7 @@
 ###############################################################################
 ###############################################################################
 
-SUBDIRS=lib daemon tool dlm_controld gfs_controld man
+include ../make/defines.mk
+include ../make/passthrough.mk
 
-%:
-	set -e && \
-	for i in ${SUBDIRS}; do \
-		${MAKE} -C $$i $@; \
-	done
+SUBDIRS=lib daemon tool dlm_controld gfs_controld man
diff -Naurd redhat-cluster-suite-2.20070823/make/passthrough.mk cluster/make/passthrough.mk
--- redhat-cluster-suite-2.20070823/make/passthrough.mk	1970-01-01 01:00:00.000000000 +0100
+++ cluster/make/passthrough.mk	2007-08-27 06:48:35.000000000 +0200
@@ -0,0 +1,7 @@
+all: ${SUBDIRS}
+
+%:
+	set -e && \
+	for i in ${SUBDIRS}; do \
+		${MAKE} -C $$i $@; \
+	done
diff -Naurd redhat-cluster-suite-2.20070823/rgmanager/Makefile cluster/rgmanager/Makefile
--- redhat-cluster-suite-2.20070823/rgmanager/Makefile	2007-04-30 13:31:52.000000000 +0200
+++ cluster/rgmanager/Makefile	2007-08-27 08:09:38.000000000 +0200
@@ -12,13 +12,6 @@
 ###############################################################################
 
 include ../make/defines.mk
+include ../make/passthrough.mk
 
 SUBDIRS=src man init.d
-
-all: ${SUBDIRS}
-
-%:
-	set -e && \
-	for i in ${SUBDIRS}; do \
-		${MAKE} -C $$i $@; \
-	done
diff -Naurd redhat-cluster-suite-2.20070823/rgmanager/src/Makefile cluster/rgmanager/src/Makefile
--- redhat-cluster-suite-2.20070823/rgmanager/src/Makefile	2007-04-30 13:31:52.000000000 +0200
+++ cluster/rgmanager/src/Makefile	2007-08-27 08:10:54.000000000 +0200
@@ -12,13 +12,6 @@
 ###############################################################################
 
 include ../../make/defines.mk
+include ../../make/passthrough.mk
 
 SUBDIRS=resources clulib daemons utils
-
-all: ${SUBDIRS}
-
-%:
-	set -e && \
-	for i in ${SUBDIRS}; do \
-		${MAKE} -C $$i $@; \
-	done

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