It's best not to change the makefiles directly as these are auto generated for you by Automake. See GNU Autoconf, Automake and Libtool aka 'The Goat Book' for a good guide to the Autotools.
Instead, you change the way that a project is built via a combination of modifying environment variables...