From a433409281573d7f344012f19f6f02170e8e2f85 Mon Sep 17 00:00:00 2001
From: Florian Pose <fp@igh-essen.com>
Date: Fri, 2 Jun 2006 09:02:18 +0000
Subject: [PATCH] Consistent Makefiles.

---
 devices/Makefile       | 9 +++++----
 examples/mini/Makefile | 8 +++++---
 examples/msr/Makefile  | 7 ++++---
 examples/rtai/Makefile | 8 +++++---
 master/Makefile        | 9 +++++----
 5 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/devices/Makefile b/devices/Makefile
index 1313545d..f71ca1b7 100644
--- a/devices/Makefile
+++ b/devices/Makefile
@@ -44,7 +44,7 @@ obj-m := ec_8139too.o
 
 ec_8139too-objs := 8139too.o
 
-REV := $(shell svnversion $(src) 2>/dev/null)
+REV := $(shell svnversion $(src) 2>/dev/null || echo "unknown")
 
 EXTRA_CFLAGS = -DEC_REV=$(REV) -DEC_USER=$(USER)
 
@@ -61,13 +61,14 @@ else
 KERNEL := $(shell uname -r)
 endif
 
-KERNELDIR := /lib/modules/$(KERNEL)/build
+KERNEL_DIR := /lib/modules/$(KERNEL)/build
+CURRENT_DIR := $(shell pwd)
 
 modules:
-	$(MAKE) -C $(KERNELDIR) M=`pwd`
+	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR)
 
 clean:
-	$(MAKE) -C $(KERNELDIR) M=`pwd` clean
+	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR) clean
 
 #------------------------------------------------------------------------------
 
diff --git a/examples/mini/Makefile b/examples/mini/Makefile
index 41f93e53..b3dd4d27 100644
--- a/examples/mini/Makefile
+++ b/examples/mini/Makefile
@@ -56,14 +56,16 @@ else
 ifneq ($(wildcard kernel.conf),)
 include kernel.conf
 else
-KERNELDIR := /lib/modules/`uname -r`/build
+KERNEL_DIR := /lib/modules/`uname -r`/build
 endif
 
+CURRENT_DIR := $(shell pwd)
+
 modules:
-	$(MAKE) -C $(KERNELDIR) M=`pwd`
+	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR)
 
 clean:
-	$(MAKE) -C $(KERNELDIR) M=`pwd` clean
+	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR) clean
 
 #----------------------------------------------------------------
 
diff --git a/examples/msr/Makefile b/examples/msr/Makefile
index 704a9699..d84adf8e 100644
--- a/examples/msr/Makefile
+++ b/examples/msr/Makefile
@@ -75,13 +75,14 @@ else
 KERNEL := $(shell uname -r)
 endif
 
-KERNELDIR := /lib/modules/$(KERNEL)/build
+KERNEL_DIR := /lib/modules/$(KERNEL)/build
+CURRENT_DIR := $(shell pwd)
 
 modules:
-	$(MAKE) -C $(KERNELDIR) M=`pwd`
+	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR)
 
 clean:
-	$(MAKE) -C $(KERNELDIR) M=`pwd` clean
+	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR) clean
 
 install:
 	@./install.sh $(MODULE) $(KERNEL)
diff --git a/examples/rtai/Makefile b/examples/rtai/Makefile
index adb83ff7..8e96bc0d 100644
--- a/examples/rtai/Makefile
+++ b/examples/rtai/Makefile
@@ -58,14 +58,16 @@ else
 ifneq ($(wildcard kernel.conf),)
 include kernel.conf
 else
-KERNELDIR := /lib/modules/`uname -r`/build
+KERNEL_DIR := /lib/modules/`uname -r`/build
 endif
 
+CURRENT_DIR := $(shell pwd)
+
 modules:
-	$(MAKE) -C $(KERNELDIR) M=`pwd`
+	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR)
 
 clean:
-	$(MAKE) -C $(KERNELDIR) M=`pwd` clean
+	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR) clean
 
 #------------------------------------------------------------------------------
 
diff --git a/master/Makefile b/master/Makefile
index 7d80768f..a8b0941e 100644
--- a/master/Makefile
+++ b/master/Makefile
@@ -45,7 +45,7 @@ obj-m := ec_master.o
 ec_master-objs := module.o master.o device.o slave.o command.o types.o \
 		domain.o mailbox.o canopen.o ethernet.o debug.o fsm.o
 
-REV := $(shell svnversion $(src) 2>/dev/null)
+REV := $(shell svnversion $(src) 2>/dev/null || echo "unknown")
 
 EXTRA_CFLAGS := -DSVNREV=$(REV) -DUSER=$(USER)
 
@@ -62,13 +62,14 @@ else
 KERNEL := $(shell uname -r)
 endif
 
-KERNELDIR := /lib/modules/$(KERNEL)/build
+KERNEL_DIR := /lib/modules/$(KERNEL)/build
+CURRENT_DIR := $(shell pwd)
 
 modules:
-	$(MAKE) -C $(KERNELDIR) M=`pwd`
+	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR)
 
 clean:
-	$(MAKE) -C $(KERNELDIR) M=`pwd` clean
+	$(MAKE) -C $(KERNEL_DIR) M=$(CURRENT_DIR) clean
 
 #------------------------------------------------------------------------------
 
-- 
GitLab