>> On Mon, Nov 2, 2015 at 7:02 AM, Shiyao Ma <[email protected]> wrote:
>> Hi,
>> Say I am writing a module. Instead of directly compile it into a ko
file, I'd like to see the preprocessed output of that file,
>> similarly the way it's done in gcc -E.

lets say you have a module named shiyao.c the makefile will look similar
to:

-----------------------------------------------------------------------------
obj-m += shiyao.o

KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD       := $(shell pwd)

all:
    $(MAKE) -C $(KERNELDIR) M=$(PWD)

clean:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
-----------------------------------------------------------------------------

change the target all to:

all:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) *shiyao.i*

run make as usual then open shiyao.i in vi(m) or your preferred editor -
done !

Thank's - Aruna
_______________________________________________
Kernelnewbies mailing list
[email protected]
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to