]> bbs.cooldavid.org Git - jme.git/blobdiff - Makefile
jme: Cleanup PM operations after using new PM API
[jme.git] / Makefile
index 8116d0439eb558155ca56519e698a30d52a0bf9c..4285fbf4486f0aba793653e19c9bbbdba9e1f399 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,33 +1,60 @@
-
 MODNAME := jme
-TEMPFILES := $(MODNAME).o $(MODNAME).mod.c $(MODNAME).mod.o Module.symvers .$(MODNAME).*.cmd .tmp_versions modules.order
+obj-m := $(MODNAME).o
 
+ifneq ($(KERNELRELEASE),)
+#########################
+# kbuild part of makefile
+#########################
 EXTRA_CFLAGS += -Wall -O3
 #EXTRA_CFLAGS += -DTX_DEBUG
 #EXTRA_CFLAGS += -DREG_DEBUG
 
-obj-m := $(MODNAME).o
+else
+#########################
+# Normal Makefile
+#########################
+TEMPFILES := $(MODNAME).o $(MODNAME).mod.c $(MODNAME).mod.o Module.symvers .$(MODNAME).*.cmd .tmp_versions modules.order Module.markers Modules.symvers
 
-ifeq (,$(BUILD_KERNEL))
-BUILD_KERNEL=$(shell uname -r)
+ifeq (,$(KVER))
+KVER=$(shell uname -r)
 endif
+KSRC ?= /lib/modules/$(KVER)/build
+MINSTDIR ?= /lib/modules/$(KVER)/kernel/drivers/net
 
-KSRC ?= /lib/modules/$(BUILD_KERNEL)/build
-
-all:
-       @$(MAKE) -C $(KSRC) SUBDIRS=$(shell pwd) modules
+all: modules
        @rm -rf $(TEMPFILES)
+modules:
+       @$(MAKE) -C $(KSRC) M=$(shell pwd) modules
 
-checkstack:
-       $(MAKE) -C $(KSRC) SUBDIRS=$(shell pwd) modules
-       objdump -d $(obj-m) | perl $(KSRC)/scripts/checkstack.pl i386
+checkstack: modules
+       objdump -d $(obj-m) | perl $(KSRC)/scripts/checkstack.pl $(shell uname -m)
        @rm -rf $(TEMPFILES)
 
-namespacecheck:
-       $(MAKE) -C $(KSRC) SUBDIRS=$(shell pwd) modules
+namespacecheck: modules
        perl $(KSRC)/scripts/namespace.pl
        @rm -rf $(TEMPFILES)
 
+install: modules
+       install -m 644 $(MODNAME).ko $(MINSTDIR)
+       depmod -a $(KVER)
+
+patch:
+       @/usr/bin/diff -uar -X dontdiff ../../trunc ./ > bc.patch || echo > /dev/null
+
+buildtest:
+       SRCDIRS=`find ~/linux-src -mindepth 1 -maxdepth 1 -type d -name 'linux-*' | sort -r -n`; \
+       for d in $${SRCDIRS}; do \
+               $(MAKE) clean && $(MAKE) -C . KSRC=$${d} modules; \
+               if [ $$? != 0 ]; then \
+                       exit $$?; \
+               fi; \
+       done
+       $(MAKE) clean
+
 clean:
        @rm -rf $(MODNAME).ko $(TEMPFILES)
 
+%::
+       $(MAKE) -C $(KSRC) M=`pwd` $@
+
+endif