Eh?
[apc.git] / mod3 / Makefile
blobfd53d980135b6f443e60bea25ee2cfa02106d14d
1 .PHONY: itc-all itc-build-module itc-install-module
3 itc-all:: itc-build-module
5 KVERSION ?= $(shell uname -r)
6 KDIR ?= /lib/modules/$(KVERSION)/build
7 OUTDIR ?= /lib/modules/$(KVERSION)/misc
9 MM := $(shell echo $(KVERSION) | cut -d. -f1,2)
10 MM := 3.0
11 ifeq ($(MM),2.4)
12 KMOD_SUFFIX := .o
13 K24 := defined
14 else
15 ifeq ($(MM),2.6)
16 KMOD_SUFFIX := .ko
17 else
18 ifneq ($(MM),3.0)
19 $(error Only 2.4, 2.6, 3.0 kernel series are supported. You have "$(MM)")
20 endif
21 endif
22 endif
24 itc-objs := itc-mod.o
26 hack := $(shell $(CC) -print-search-dirs | sed -n 's;^install: \(.*\);\1include;p;q')
27 export CPATH:=${CPATH}:${hack}
29 obj-m := itc.o
31 ifdef K24
32 itc.o: $(itc-objs)
33 $(LD) $(EXTRA_LDFLAGS) -o $@ -r $(itc-objs)
35 include $(KDIR)/Rules.make
36 endif
38 $(KDIR)/Makefile:
39 @echo Cannot build module, kernel sources are probably not installed
40 @exit 1
42 $(KDIR)/.config:
43 @echo Cannot build module, kernel is not configured
44 @exit 1
46 itc-build-module:: $(KDIR)/Makefile $(KDIR)/.config
47 $(MAKE) -C $(KDIR) modules SUBDIRS=$(CURDIR) M=$(CURDIR)
49 itc-install-module:: itc-build-module
50 mkdir -p $(OUTDIR)
51 install -m 0400 -o 0 -g 0 itc$(KMOD_SUFFIX) $(OUTDIR)