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)
23 # By stuffing this hear we avoid using
24 # this hackery on modpost, the 2nd section of module building.
26 # This hack lets us put our include path first than the kernel's
27 # when building our compat modules. Your own makefile would look
29 NOSTDINC_FLAGS := -I$(M)/include/ \
30 -include $(M)/include/linux/compat-2.6.h \
32 -DCOMPAT_BASE_TREE="\"$(COMPAT_BASE_TREE)\"" \
33 -DCOMPAT_BASE_TREE_VERSION="\"$(COMPAT_BASE_TREE_VERSION)\"" \
34 -DCOMPAT_PROJECT="\"Generic kernel\"" \
35 -DCOMPAT_VERSION="\"$(COMPAT_VERSION)\""
39 # to check config and compat autoconf
40 export COMPAT_CONFIG=.config
41 export COMPAT_AUTOCONF=include/linux/compat_autoconf.h
44 # Recursion lets us ensure we get this file included.
45 # Trick is to run make -C $(PWD) modules later.
46 -include $(PWD)/$(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) \
60 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean
65 @$(PWD)/scripts/gen-compat-config.sh > $(PWD)/$(COMPAT_CONFIG)
66 @$(PWD)/scripts/gen-compat-autoconf.sh $(COMPAT_CONFIG) > $(PWD)/$(COMPAT_AUTOCONF)
67 @$(MAKE) -C $(PWD) modules
72 $(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean
74 clean-files := Module.symvers modules.order Module.markers compat/modules.order
75 clean-files += modules $(COMPAT_CONFIG) $(COMPAT_AUTOCONF)
77 .PHONY: all install clean