If it's your policy to run Make without flags or arguments, you can still save yourself some grief by putting the relevant switches in an adjunct file (not under version control) which the makefile will include
.
Parsing source files with Make as you've tried to do is, as you say, both ugly and difficult. And it's a nightmare to maintain. I recommend keeping two versions of definitions.h
under version control in different directories; the same same Make logic that chooses libraries can choose the header file.
I don't know what kind of errors you're getting when your header file is "incompatible" with the libraries, but if the libraries have different interfaces, you may be able to deliberately invoke compiler errors by putting some library-specific calls in the header files. (And if they don't have different interfaces, you seem to have some bad implementation-dependent behavior.)
Finally, if "a few minutes" is too long to wait for such a compiler error, then you must be making such errors pretty often-- you might want to look into your procedures. (Also, if you've modified only one or two files, a build shouldn't take that long-- a daily build, yes, but not the kind you do several times an hour.)