Re: Compile a particular extension files, with a different compiler

Jan Engelhardt <[email protected]>
Newsgroups gmane.comp.sysutils.automake.general
Message-ID <[email protected]>
On Sunday 2023-03-26 14:33, Labeeb Asari wrote:
>
>Basically : compile .c source files with gcc, .cu files with nvcc and
>finally link them together with gcc.
>
>I've tried adding a rule to handle .cu files differently and it does create
>object files for it separately. However while linking, libtool does not
>include these object files!

I have good success with

```
libsomething_la_SOURCES = cpart.cpp
libsomething_la_LDADD = xx.o

.cu.o:
	# fake compiler command for my case
	g++ -x c++ -c -o $@ $<
```

The only downside is a naggy warning about non-portable use of .o files.
I could live with that..

Getting an .lo file out of it is more complicated (I got an xx.lo but
no .libs/xx.o, which is rather odd.)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.