src/Makefile.am: Only link necessary libraries