How can I add extra flag variables (like CPPFLAGS) that will apply to all makefiles? Currently, we’re using CPPFLAGS, but that is supposed to be reserved as a user variable and I would like to reserve it. I’d prefer not to use AM_CPPFLAGS because I would like to reserve that for specific Makefile.amS. What I want is something like GLOBAL_CPPFLAGS that I could set in configure.ac and have it applied to everything. It would also be nice if there were a way to explicitly ignore the flag.
I think what I need to do is to write my own make rule, but how would I make that available in all subfolders without copying it into every Makefile.am?
You’re correct in not using
CPPFLAGS. That’s a user variable. What I’d do is something like this:In the root of your source dir, create a file called
common.amand define whatever you need in there:I know you said you didn’t want to use
AM_CPPFLAGS, but hear me out. In your individual subdirectories,include $(top_srcdir)/common.amand extend or overrideAM_CPPFLAGSas needed:If you want to override, use
=instead of+=: