summaryrefslogtreecommitdiffstats
path: root/misc-modules/Makefile
diff options
context:
space:
mode:
authorJavier Martinez Canillas <martinez.javier@gmail.com>2010-11-27 07:49:17 +0100
committerJavier Martinez Canillas <martinez.javier@gmail.com>2010-11-27 07:49:17 +0100
commitab121f379a3cff458c90e6f480ba4bb68c8733dd (patch)
treea9851af109ee83646d108bc247d03b131461b764 /misc-modules/Makefile
downloadldd3-ab121f379a3cff458c90e6f480ba4bb68c8733dd.tar.gz
Linux Device Drivers 3 examples
Diffstat (limited to 'misc-modules/Makefile')
-rw-r--r--misc-modules/Makefile32
1 files changed, 32 insertions, 0 deletions
diff --git a/misc-modules/Makefile b/misc-modules/Makefile
new file mode 100644
index 0000000..d04d2d6
--- /dev/null
+++ b/misc-modules/Makefile
@@ -0,0 +1,32 @@
+
+# To build modules outside of the kernel tree, we run "make"
+# in the kernel source tree; the Makefile these then includes this
+# Makefile once again.
+# This conditional selects whether we are being included from the
+# kernel Makefile or not.
+ifeq ($(KERNELRELEASE),)
+
+ # Assume the source tree is where the running kernel was built
+ # You should set KERNELDIR in the environment if it's elsewhere
+ KERNELDIR ?= /lib/modules/$(shell uname -r)/build
+ # The current directory is passed to sub-makes as argument
+ PWD := $(shell pwd)
+
+modules:
+ $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
+
+modules_install:
+ $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
+
+clean:
+ rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
+
+.PHONY: modules modules_install clean
+
+else
+ # called from kernel build system: just declare what our modules are
+ obj-m := hello.o hellop.o seq.o jit.o jiq.o sleepy.o complete.o \
+ silly.o faulty.o kdatasize.o kdataalign.o
+endif
+
+