Looking for a sample Makefile to compile and link multiple cu and cpp files into a shared module

Looks like compiling and linking multiple .cu and .cpp file into a shared module ( or executable) is still not possible. Tried various nvcc options such as “-dc” “-dlink” to generate the object module and link that with g++ objects. There is always some not found variables.

It’s possible.

https://stackoverflow.com/questions/26147981/nvlink-relocatable-device-code-and-static-device-libraries/26150835#26150835

https://stackoverflow.com/questions/35897002/cuda-nvcc-building-chain-of-libraries/36103566#36103566

https://stackoverflow.com/questions/44953156/cuda-8-0-nvcc-fatal-single-input-file-required-for-a-non-link-phase-when-an-oup/44953725#44953725

https://stackoverflow.com/questions/24510664/cuda-linking-a-shared-library-so-using-separate-files/24561705#24561705

If you want a specific answer, I suggest providing a short, complete (all the source files, and the makefile), specific example, and show the failing compile output.