Re: CFLAGS and other flag variables

Sébastien Hinderer <[email protected]> Tue, 16 Jul 2024 15:47:53 +0200
Newsgroups gmane.comp.gnu.make.general
Message-ID <ZpZ6CfVz-pqQV08v@jnana>
Hello,

I'd say to keep all your C compiler flags in a separate variable,
MY_CFLAGS, say.

Then your rule shoudlmention the two variables, e.g.:

%.o: %.c
        $(CC) $(MY_CFLAGS) $(CFLAGS) -c $<

In this way, users can specify the CFLAGS they want without risking to
accidentally override something the build  system wants. And at the same
timethey have the lastword.

Same goesfor CPPFLAGS, LDFLAGS etc.

hth,

Seb.