X-Git-Url: http://bbs.cooldavid.org/git/?a=blobdiff_plain;f=Makefile;h=435dcfdab3cb60408c8a8000cb2a2534297c7769;hb=62e60959fef32515c8be685177fd42010b54d6c3;hp=edbbdefd4652d62eebfbd934c42c5cc7262b6fa0;hpb=4330c2f2eeef6b8d690560d2666425fa0362109c;p=jme.git diff --git a/Makefile b/Makefile index edbbdef..435dcfd 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,62 @@ - MODNAME := jme -TEMPFILES := $(MODNAME).o $(MODNAME).mod.c $(MODNAME).mod.o Module.symvers .$(MODNAME).*.cmd .tmp_versions -EXTRA_CFLAGS += -Wall -DDEBUG -#EXTRA_CFLAGS += -Wall - obj-m := $(MODNAME).o -ifeq (,$(BUILD_KERNEL)) -BUILD_KERNEL=$(shell uname -r) +ifneq ($(KERNELRELEASE),) +######################### +# kbuild part of makefile +######################### +EXTRA_CFLAGS += -Wall -O3 +#EXTRA_CFLAGS += -DTX_DEBUG +#EXTRA_CFLAGS += -DREG_DEBUG + +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 (,$(KVER)) +KVER=$(shell uname -r) endif +KSRC ?= /lib/modules/$(KVER)/build +MINSTDIR ?= /lib/modules/$(KVER)/kernel/drivers/net + +all: modules + @rm -rf $(TEMPFILES) +modules: + @$(MAKE) -C $(KSRC) M=$(shell pwd) modules -KSRC := /lib/modules/$(BUILD_KERNEL)/build +checkstack: modules + objdump -d $(obj-m) | perl $(KSRC)/scripts/checkstack.pl $(shell uname -m) + @rm -rf $(TEMPFILES) -all: - @$(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`; \ + SRCDIRS="$${SRCDIRS} `find ~/linux-src/centos -mindepth 2 -maxdepth 2 -type d -name 'linux-*' | sort -r -n`"; \ + SRCDIRS="$${SRCDIRS} `find ~/linux-src/fedora -mindepth 2 -maxdepth 2 -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