Fix Makefile so it no longer always link when it is not needed