I am trying to execute "make debug" on the command line and it will build my driver module with the definition -DDEBUG_OUTPUT, which will lead to compilation of certain sections of code.
In 2.4 make kernel files, this is pretty simple. I simply create a debugging target: target and include "-DDEBUG_OUTPUT" in the arguments to the cc compilation command for this purpose. Easy.
Unfortunately (for me), 2.6 completely changed the way the modules are compiled, and I can ONLY find the trivial "all" and "clean" examples that do not show the addition of custom definitions at compile time.
I tried this:
debug: make -C $(KERNEL_DIR) SUBDIRS='pwd' -DDEBUG_OUTPUT modules
and received a complaint from make.
I also tried:
.PHONY: debug
debug: make -C $(KERNEL_DIR) SUBDIRS='pwd' EXTRA_CFLAGS="$(EXTRA_CFLAGS) -DDEBUG_OUTPUT" modules
but he does not see what EXTRA_CFLAGS contains. I see from the command line output that it appends -D correctly to existing EXTRA_CFLAGS, which includes -I for include dir. However, the driver file will not compile now because it cannot find the include dir ... so it somehow does not see what EXTRA_CFLAGS contains.
source share