Compiling for sm_20 and sm_30 at the same time?

I’m doing some autotuning for algorithms on both Kepler (Compute 3.0) and Fermi (Compute 2.0). I keep needing to switch my Makefile between this:

CC = nvcc
CCOPTS = -arch=compute_30 -code=sm_30 #Kepler

and this:

CCOPTS = -arch=compute_20 -code=sm_20 #Fermi

Is there a way to compile for both Compute 2.0 and Compute 3.0 in one shot? (I seem to remember seeing this somewhere, but I forgot how it worked.)

-gencode=arch=compute_20,code=“sm_20,compute_20” -gencode=arch=compute_30,code=“sm_30,compute_30”

Thanks! I had to tweak the syntax a little bit; here’s what worked:

-gencode=arch=compute_20,code=sm_20 
-gencode=arch=compute_30,code=sm_30