Fwd: problem with external module Makefile linux kernel 2.6

From: Nobin Mathew
Date: Thu May 21 2009 - 10:47:21 EST


Hi,


I am having a strange problem with external module Makefile, with
wildcard and patsubst it is giving issue. but without those it is
working fine.



See the logs for further info. I serached in google, any idea why this
happens. if this is a known issue (or wrong coding) send me a link
expalining why this is happening.



I can see wildcard and patsubst used in core KBUILD Makefiles



[root@RHEL5U3-DL580G4 new]# ls

Makefile  sdirac1.c  sdirac1.h  sdirac2.c  sdirac2.h  sdirac3.c  sdirac3.h

[root@RHEL5U3-DL580G4 new]# cat Makefile

obj-m := dirac.o

dirac-objs = $(patsubst %.c,%.ko,$(wildcard , *.c))

#dirac-objs = sdirac1.o sdirac2.o sdirac3.o



KDIR := /lib/modules/$(shell uname -r)/build





all:

        echo $(dirac-objs)

        make -C $(KDIR) M=`pwd` modules

[root@RHEL5U3-DL580G4 new]# make

echo sdirac1.ko sdirac2.ko sdirac3.ko

sdirac1.ko sdirac2.ko sdirac3.ko

make -C /lib/modules/2.6.18-128.el5PAE/build M=`pwd` modules

make[1]: Entering directory `/usr/src/kernels/2.6.18-128.el5-PAE-i686'

make[2]: *** No rule to make target `/root/Desktop/new/dirac.c',
needed by `/root/Desktop/new/dirac.o'.  Stop.

make[1]: *** [_module_/root/Desktop/new] Error 2

make[1]: Leaving directory `/usr/src/kernels/2.6.18-128.el5-PAE-i686'

make: *** [all] Error 2

[root@RHEL5U3-DL580G4 new]# vim Makefile

####I changed the Makefile Here ######

[root@RHEL5U3-DL580G4 new]# cat Makefile

obj-m := dirac.o

#dirac-objs = $(patsubst %.c,%.ko,$(wildcard , *.c))

dirac-objs = sdirac1.o sdirac2.o sdirac3.o



KDIR := /lib/modules/$(shell uname -r)/build





all:

        echo $(dirac-objs)

        make -C $(KDIR) M=`pwd` modules

[root@RHEL5U3-DL580G4 new]# make

echo sdirac1.o sdirac2.o sdirac3.o

sdirac1.o sdirac2.o sdirac3.o

make -C /lib/modules/2.6.18-128.el5PAE/build M=`pwd` modules

make[1]: Entering directory `/usr/src/kernels/2.6.18-128.el5-PAE-i686'

  CC [M]  /root/Desktop/new/sdirac1.o

  CC [M]  /root/Desktop/new/sdirac2.o

  CC [M]  /root/Desktop/new/sdirac3.o

  LD [M]  /root/Desktop/new/dirac.o

  Building modules, stage 2.

  MODPOST

  CC      /root/Desktop/new/dirac.mod.o

  LD [M]  /root/Desktop/new/dirac.ko

make[1]: Leaving directory `/usr/src/kernels/2.6.18-128.el5-PAE-i686'

[root@RHEL5U3-DL580G4 new]# ls

dirac.ko     dirac.mod.o  Makefile        Module.symvers  sdirac1.h
sdirac2.c  sdirac2.o  sdirac3.h

dirac.mod.c  dirac.o      Module.markers  sdirac1.c       sdirac1.o
sdirac2.h  sdirac3.c  sdirac3.o

[root@RHEL5U3-DL580G4 new]#



Thanks

Nobin Mathew.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/