How to add '-Dxxx' flags in Makefile?

乃宏周 naive231 at gmail.com
Mon Nov 25 03:08:37 EST 2013


My makefile of `kpd.ko` is following:
============================
module_name = kpd
src_sym = kpd_main a38_kpd util
objs = $(addsuffix .o,$(src_sym))
wd = $(shell pwd)

EXTRA_CFLAGS+=-DTEST
ifneq ($(KERNELRELEASE),)

obj-m := $(module_name).o
$(module_name)-objs := $(objs)

else

kver = $(shell uname -r)
kd = ../../linux-2.6.32.8
modules:
$(MAKE) -C $(kd) M=$(wd) $@

clean:
$(MAKE) -C $(kd) M=$(wd) $@

endif
=============================
Everything's fine,but I want to add `-DTEST` to EXTRA_CFLAGS.
Even if I put $(EXTRA_FLAGS) or other macro into `$(MAKE) -C $(kd) M=$(wd)
$@`,
Nothing changed in all building process.

How should I do to insert `-Dxxx` to original Makefile ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20131125/309dc20f/attachment.html 


More information about the Kernelnewbies mailing list