Is it possible to set CFLAGS to a linux kernel module Makefile?

前端 未结 2 680
执念已碎
执念已碎 2020-12-03 01:41

Eg: a common device module\'s Makefile

obj-m:=jc.o

default:
    $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(shell pwd) modules
clean:
    $(MAKE) -C         


        
2条回答
  •  自闭症患者
    2020-12-03 02:01

    You can also use

    ccflags-y := -O2
    

    This will be applied to all of the source files compiled for your module with the Makefile. This is indirectly documented in the link provided by eepp in Section 4.2

提交回复
热议问题