- result ?= demo
- arch ?= arm
- ifeq ($(arch),arm)
- KERNEDIR:=/home/ubuntu/linux-5.10.61
- else ifeq ($(arch),x86)
- KERNEDIR:=/lib/modules/$(shell uname -r)/build
- else
- echo("arch_error")
- endif
- PWD:=$(shell pwd)
- all:
- make -C $(KERNEDIR) M=$(PWD) modules
- clean:
- make -C $(KERNEDIR) M=$(PWD) clean
- obj-m:=$(result).o
测试现象1:生成x86架构、demo.o
测试现象2:生成arm架构、sss.o