LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* External module Makefile with generated C file
@ 2007-01-27 18:15 Arnaldo Carvalho de Melo
  2007-01-27 18:30 ` Jan Engelhardt
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2007-01-27 18:15 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kernel

Sam,

      I'm trying to create a external module that involves generating 
one of the source files needed for
the module, I'm using this Makefile:

[acme@filo ctracer_example]$ cat Makefile
obj-m := ctracer.o

ctracer-y := ctracer_methods.o ctracer_jprobe.o

CLASS=sock
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

default:
        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
        rm -f *.mod.c *.ko *.o ctracer_methods.c

# Files generated that shall be removed upon make clean
clean-files := ctracer_methods.c

ctracer_methods.o: ctracer_methods.c

ctracer_methods.c:
        ctracer /usr/lib/debug/lib/modules/$(shell uname -r)/vmlinux 
$(CLASS) > ctracer_methods.c

[acme@filo ctracer_example]$

But I get this as the result:

[acme@filo ctracer_example]$ make
make -C /lib/modules/2.6.19-1.2895.fc6/build 
SUBDIRS=/home/acme/git/pahole/ctracer_example modules
make[1]: Entering directory `/usr/src/kernels/2.6.19-1.2895.fc6-i686'
make[2]: *** No rule to make target 
`/home/acme/git/pahole/ctracer_example/ctracer_methods.o', needed by 
`/home/acme/git/pahole/ctracer_example/ctracer.o'.  Stop.
make[1]: *** [_module_/home/acme/git/pahole/ctracer_example] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.19-1.2895.fc6-i686'
make: *** [default] Error 2
[acme@filo ctracer_example]$

What is the stupid thing I'm doing? :-)

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: External module Makefile with generated C file
  2007-01-27 18:15 External module Makefile with generated C file Arnaldo Carvalho de Melo
@ 2007-01-27 18:30 ` Jan Engelhardt
  2007-01-27 18:42   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Engelhardt @ 2007-01-27 18:30 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Sam Ravnborg, linux-kernel


> ctracer_methods.o: ctracer_methods.c

$(obj)/ctracer_methods.o: $(src)/ctracer_methods.c

$(src)/ctracer_methods.c:
  ...



I don't know if $(obj) or $(src) is the right thing, but something along
these lines is required for OOT.

	-`J'
-- 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: External module Makefile with generated C file
  2007-01-27 18:30 ` Jan Engelhardt
@ 2007-01-27 18:42   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2007-01-27 18:42 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Sam Ravnborg, linux-kernel

Jan Engelhardt wrote:
>> ctracer_methods.o: ctracer_methods.c
>>     
>
> $(obj)/ctracer_methods.o: $(src)/ctracer_methods.c
>
> $(src)/ctracer_methods.c:
>   ...
>
>
>
> I don't know if $(obj) or $(src) is the right thing, but something along
> these lines is required for OOT.
>   

Thanks, that did the trick, resulting Makefile:

obj-m := ctracer.o

ctracer-y := ctracer_methods.o ctracer_jprobe.o

# Files generated that shall be removed upon make clean
clean-files := ctracer_methods.c

CLASS=sock
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

default:
        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
        rm -f *.mod.c *.ko *.o ctracer_methods.c

$(obj)/ctracer_methods.o: ctracer_methods.c

$(src)/ctracer_methods.c:
        ctracer /usr/lib/debug/lib/modules/$(shell uname -r)/vmlinux 
$(CLASS) > $@

- Arnaldo



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-27 18:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-27 18:15 External module Makefile with generated C file Arnaldo Carvalho de Melo
2007-01-27 18:30 ` Jan Engelhardt
2007-01-27 18:42   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).