improve cuda version: don't rely on compile-time code generation
cleanup makefile and allow building opencl and cuda in the same library