change uses of tmpnam to mkstemp/mkdtemp

This lets you successfully run `make warn` on Mac.  Also gets rid of `-L/usr/local/lib/cuda64` if that directory doesn't exist to suppress warnings.