Problem compliling library with nvcc


I just added cufft into a src of my library (instead of fftw). When I compile, it works fine. I use CFLAGS = -Xcompiler -fopenmp -lgomp -O3 -m64.
All my src are .c except one, let’s say where i added cufft.

I had to add : COMPILE.c= (CC) -c (CFLAGS)
.cu.o: (COMPILE.c) -o @ $<

in the makefile so the .cu is compiled to a .o file.

When i try to compile all my program it returns : /my_lib.a(function20.o): In function function20': function20.c:(.text+0x198): undefined reference to function19’

Compiling the library with -lib or -E doesn’t work : nvcc fatal : More than one compilation phase specified.

So the only solution i see is to rename all the src of the library in .cu files so nvcc will compile them all the same way.

Does anyone has an other solution ??