Hello Benoit, * Benoit Sigoure wrote on Thu, Nov 16, 2006 at 08:03:57AM CET: > > Akim's idea of AM_*FLAGS is that they are not meant to be defined in > configure.ac but in Makefile.ams. His approach is to AC_SUBST([MY_*FLAGS], > [-package-wide-flags]) and then have a common.mk (say at top-level) which > does AM_*FLAGS = $(MY_*FLAGS) and then include that common.mk everywhere it's > required.
Advantages of your approach: - less to type, less to remember, thus less error-prone. Advantages of Akim's approach: - more flexible: when later you find out you need to apply MY_*FLAGS only to a subset of the code, and MYOTHER_*FLAGS to some other subset. You could override the setting in common.mk after including it, or just not include it in all Makefile.am files. - there may be other independent reasons why you would want or need a common.mk that shares code for all or most Makefile.am files. > According to him, defining package-wide AM_*FLAGS could possibly clash with > that already defined in Makefile.ams. If you both substitute it and set it in a Makefile.am, the latter wins (in that Makefile.am, of course). No clash here, but of course the order is important. > He also argues that when defining target_specific_*FLAGS, the > corresponding AM_*FLAGS aren't automatically included. There is no problem with target_CFLAGS = $(AM_CFLAGS) --moreflags $(even_more_flags) Also, the issue is the same for your and his case, so really this isn't an argument until you need a split in the form of AM_CFLAGS = $(A) $(B) target_CFLAGS = $(A) $(something_other_than_B) IMHO it's really a matter of taste. Do whatever fits your project best. I like to avoid per-target flags if I can, because it helps keep the size of Makefile.in down. But that's only a very minor point. Cheers, Ralf