[PATCH 1/2] modernize backfire's Makefile

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

 



- don't rely on non-standard envvar PWD, use make's CURDIR instead
- allow overwriting KERNELDIR
- less repetition by conflating targets
- explicitly differentiate between kbuild and ordinary make part

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
 src/backfire/Makefile |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/backfire/Makefile b/src/backfire/Makefile
index b5d2b3e..bbad91a 100644
--- a/src/backfire/Makefile
+++ b/src/backfire/Makefile
@@ -1,14 +1,17 @@
+# If KERNELRELEASE is defined, we've been invoked from the
+# kernel build system and can use its language
+ifneq ($(KERNELRELEASE),)
 obj-m := backfire.o
 
-all:	modules modules_install
-	@echo Done
+# otherwise we were called directly from the command
+# line; invoke the kernel build system.
+else
+KERNELDIR ?= /lib/modules/$(shell uname -r)/build
 
-modules:
-	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
+modules modules_install clean::
+	make -C $(KERNELDIR) M=$(CURDIR) $@
 
-modules_install:
-	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules_install
+clean::
+	rm -f *.o Module.markers modules.order
 
-clean:
-	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
-	@rm -f *.o Module.markers modules.order
+endif
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux