How do I write a makefile for CUDA?

I have a pile of code that I’m putting together for CUDA compilation. What commands should I run to make them compile and link incrementally like in a makefile?

In other words, I want to distribute my code without having to send out copies of the nVidia makefile from the SDK. How can I roll my own?

Add a rule to your makefile to turn .cu files into .o files (using nvcc), and add -lcuda -lcudart to your link line.

I’m also becoming a fan of cmake with its FindCUDA component.