From 5fb33209f35c6cce7134abd83d6d20c47cdf51c5 Mon Sep 17 00:00:00 2001
From: Florian Pose <fp@igh-essen.com>
Date: Fri, 6 Jan 2006 16:36:03 +0000
Subject: [PATCH] Makefiles verbessert.

---
 Makefile         |  2 +-
 drivers/Makefile | 10 ++++++++--
 mini/Makefile    | 10 ++++++++--
 rt/Makefile      | 12 +++++++++---
 4 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index f73b4864..2b5449f8 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,7 @@ modules:
 
 clean:
 	$(MAKE) -C $(KERNELDIR) M=`pwd` clean
-	rm -rvf */.tmp_versions
+	@rm -rf */.tmp_versions
 
 doc docs:
 	doxygen Doxyfile
diff --git a/drivers/Makefile b/drivers/Makefile
index 0a796c14..a3b2ee33 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -32,11 +32,17 @@ else
 #------------------------------------------------------------------------------
 # Default-Abschnitt
 
+ifneq ($(wildcard ethercat.conf),)
+include ethercat.conf
+else
+KERNELDIR = /lib/modules/`uname -r`/build
+endif
+
 modules:
-	$(MAKE) -C ..
+	$(MAKE) -C $(KERNELDIR) M=`pwd` modules
 
 clean:
-	$(MAKE) -C .. clean
+	$(MAKE) -C $(KERNELDIR) M=`pwd` clean
 
 #------------------------------------------------------------------------------
 
diff --git a/mini/Makefile b/mini/Makefile
index e84525ce..6e4e2863 100644
--- a/mini/Makefile
+++ b/mini/Makefile
@@ -24,11 +24,17 @@ else
 #----------------------------------------------------------------
 # Default-Abschnitt
 
+ifneq ($(wildcard ethercat.conf),)
+include ethercat.conf
+else
+KERNELDIR = /lib/modules/`uname -r`/build
+endif
+
 modules:
-	$(MAKE) -C ..
+	$(MAKE) -C $(KERNELDIR) M=`pwd` modules
 
 clean:
-	$(MAKE) -C .. clean
+	$(MAKE) -C $(KERNELDIR) M=`pwd` clean
 
 #----------------------------------------------------------------
 
diff --git a/rt/Makefile b/rt/Makefile
index e6f71336..56d81399 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -37,11 +37,17 @@ else
 #------------------------------------------------------------------------------
 # Default-Abschnitt
 
-default:
-	$(MAKE) -C ..
+ifneq ($(wildcard ethercat.conf),)
+include ethercat.conf
+else
+KERNELDIR = /lib/modules/`uname -r`/build
+endif
+
+modules:
+	$(MAKE) -C $(KERNELDIR) M=`pwd` modules
 
 clean:
-	$(MAKE) -C .. clean
+	$(MAKE) -C $(KERNELDIR) M=`pwd` clean
 
 #------------------------------------------------------------------------------
 
-- 
GitLab