Build NVIDIA kernel module without loading them

I’m trying to run the NVIDIA install script for the latest drivers on a non-GPU box for a custom kernel (for continuous integration). It works if I use apt-get, because it will just build against my custom kernel, but not with the install script. It builds correctly but then at the end, I get “ERROR: Unable to load the kernel module ‘nvidia.ko’”.

Is there a way to build the kernel module without loading it?

cd /usr/src/nvidia-XXX.XX