1 export KMODDIR?= updates/
2 KMODDIR_ARG:= "INSTALL_MOD_DIR=$(KMODDIR)"
3 ifneq ($(origin $(KLIB)), undefined)
4 KMODPATH_ARG:= "INSTALL_MOD_PATH=$(KLIB)"
6 export KLIB:= /lib/modules/$(shell uname -r)
8 export KLIB_BUILD ?= $(KLIB)/build
10 export PWD := $(shell pwd)
12 ifeq ($(KERNELRELEASE),)
13 export COMPAT_BASE_TREE := "linux-next.git"
14 # For this specific tree this is only relevant in
15 # terms of the last time we synched code up with upstream
16 # for internal stuff. For other compatability projects this
17 # would be the git describe of the base tree you are
19 export COMPAT_BASE_TREE_VERSION := "next-20100517"
20 export COMPAT_VERSION := $(shell git describe)
22 # to check config and compat autoconf
23 export COMPAT_CONFIG=$(PWD)/.config
24 export COMPAT_AUTOCONF=$(PWD)/include/linux/compat_autoconf.h
28 # By stuffing this hear we avoid using
29 # this hackery on modpost, the 2nd section of module building.
31 # This hack lets us put our include path first than the kernel's
32 # when building our compat modules. Your own makefile would look
34 NOSTDINC_FLAGS := -I$(M)/include/ \
35 -include $(M)/include/linux/compat-2.6.h \
37 -DCOMPAT_BASE_TREE="\"$(COMPAT_BASE_TREE)\"" \
38 -DCOMPAT_BASE_TREE_VERSION="\"$(COMPAT_BASE_TREE_VERSION)\"" \
39 -DCOMPAT_PROJECT="\"Generic kernel\"" \
40 -DCOMPAT_VERSION="\"$(COMPAT_VERSION)\""
44 # Recursion lets us ensure we get this file included.
45 # Trick is to run make -C $(PWD) modules later.
46 -include $(COMPAT_CONFIG)
52 modules: $(COMPAT_CONFIG) $(COMPAT_AUTOCONF)
53 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
57 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
61 $(COMPAT_AUTOCONF): $(COMPAT_CONFIG)
62 +@$(PWD)/scripts/gen-compat-autoconf.sh $(COMPAT_CONFIG) > $(COMPAT_AUTOCONF)
65 +@$(PWD)/scripts/gen-compat-config.sh > $(COMPAT_CONFIG)
66 @$(MAKE) -C $(PWD) modules
71 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean
73 clean-files := Module.symvers modules.order Module.markers compat/modules.order
74 clean-files += modules $(COMPAT_CONFIG) $(COMPAT_AUTOCONF)
76 .PHONY: all install clean