After reading the first few chapters of Managing Projects with GNU Make, I've come up with my first non-trivial Makefile
all: libTest.a
libTest.a : Test.o MWE.o Test.dlink.o MWE.dlink.o
nvcc -ccbin g++ -m64 -gencode arch=compute_30,code=sm_30 -lib -o $@ $^
%.a : %.dlink.o %.o
nvcc -ccbin g++ -m64 -gencode arch=compute_30,code=sm_30 -lib -o $@ $^
%.dlink.o : %.o
nvcc -ccbin g++ -m64 -gencode arch=compute_30,code=sm_30 -dlink -o $@ $<
%.o: %.cu
nvcc -ccbin g++ -m64 -gencode arch=compute_30,code=sm_30 -dc -o $@ -c $<
clean:
rm -f *.o *.dlink.o
This Makefile works but I really don't like specifying the intermediate files Test.o MWE.o Test.dlink.o MWE.dlink.o
as prerequisites to libTest
. I'd rather specify the input files Test.cu
and MWE.cu
or better still the wildcard %.u
.