版本1:
MODULE := test
ifneq ($(KERNELRELEASE),)
$(MODULE)-objs := version.o func.o
obj-m := $(MODULE).o
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
all:
$(MAKE) -C $(KERNELDIR) M=$(PWD)
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko* *.mod.c .tmp_versions modules.order Module.symvers
endif
版本2:
ifeq ($(KERNELRELEASE),)
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
modules_install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko* *.mod.c .tmp_versions modules.order Module.symvers
.PHONY: modules modules_install clean
else
MODULE_NAME := test
RESMAIN_CORE_OBJS := version.o
RESMAIN_GLUE_OBJS := func.o
$(MODULE_NAME)-objs := $(RESMAIN_GLUE_OBJS) $(RESMAIN_CORE_OBJS)
obj-m := test.o
endif
Makefile.txtMakefile2.txt
阅读(720) | 评论(0) | 转发(0) |