v0.90
[apc.git] / mod / Makefile
blob55ec7db2dd9f4fda5cc0c3a8375f2a1a4a54a73f
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. -f'1 2')
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 $(error Only 2.4 and 2.6 kernel series are supported. You have "$(KVERSION)")
19 endif
20 endif
22 itc-objs := itc-mod.o
24 ifdef TOPDIR
25 obj-m := itc.o
26 endif
28 ifdef K24
29 itc.o: $(itc-objs)
30 $(LD) $(EXTRA_LDFLAGS) -o $@ -r $(itc-objs)
32 include $(KDIR)/Rules.make
33 endif
35 $(KDIR)/Makefile:
36 @echo Cannot build module, kernel sources are probably not installed
37 @exit 1
39 $(KDIR)/.config:
40 @echo Cannot build module, kernel is not configured
41 @exit 1
43 itc-build-module:: $(KDIR)/Makefile $(KDIR)/.config
44 $(MAKE) -C $(KDIR) modules SUBDIRS=$(CURDIR) M=$(CURDIR)
46 itc-install-module:: itc-build-module
47 mkdir -p $(OUTDIR)
48 install -m 0400 -o 0 -g 0 itc$(KMOD_SUFFIX) $(OUTDIR)