diff options
Diffstat (limited to 'languages/cpp/app_templates/kmod/src-Makefile')
-rw-r--r-- | languages/cpp/app_templates/kmod/src-Makefile | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/languages/cpp/app_templates/kmod/src-Makefile b/languages/cpp/app_templates/kmod/src-Makefile new file mode 100644 index 00000000..92a2b461 --- /dev/null +++ b/languages/cpp/app_templates/kmod/src-Makefile @@ -0,0 +1,30 @@ +TARGET = %{APPNAMELC}-driver +OBJS = %{APPNAMELC}-driver.o +MDIR = drivers/misc + +EXTRA_CFLAGS = -DEXPORT_SYMTAB +CURRENT = $(shell uname -r) +KDIR = /lib/modules/$(CURRENT)/build +PWD = $(shell pwd) +DEST = /lib/modules/$(CURRENT)/kernel/$(MDIR) + +obj-m := $(TARGET).o + +default: + make -C $(KDIR) SUBDIRS=$(PWD) modules + +$(TARGET).o: $(OBJS) + $(LD) $(LD_RFLAG) -r -o $@ $(OBJS) + +ifneq (,$(findstring 2.4.,$(CURRENT))) +install: + su -c "cp -v $(TARGET).o $(DEST) && /sbin/depmod -a" +else +install: + su -c "cp -v $(TARGET).ko $(DEST) && /sbin/depmod -a" +endif + +clean: + -rm -f *.o *.ko .*.cmd .*.flags *.mod.c + +-include $(KDIR)/Rules.make |