Per-source CFLAGS
Bruce Evans
bde at zeta.org.au
Sun Jun 22 01:23:29 PDT 2003
On Sat, 21 Jun 2003, David Schultz wrote:
> On Sun, Jun 22, 2003, Bruce Evans wrote:
> > For this, you really want per-file WARNS, since among other reasons
> > compiler-dependent flags shouldn't be put in individual Makefiles.
> > ...
> > Do you need to turn off all warnings or just ones for non-broken
> > precedence and a few other non-broken things? gcc doesn't give
>
> In this case, we really do want to ignore all the warnings. This
> is vendor code, written in a style that makes it easiest for the
> author to maintain.
But not necessarily easiest for us to maintain. We enable some
warnings for lots of things under contrib although most things
under contrib are not FreeBSD-warning clean. I realize that gdtoa
is special since it is compiled as part of libc.
> It so happens that -w is a de facto (if not
> de jura) standard; it is supported by the GNU, Intel, and Sun C
> compilers at least.
It's not de-jure in POSIX (c99).
> > > # SINGLE SUFFIX RULES
> > > .c:
> > > - ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC}
> > > + ${CC} ${CFLAGS} ${CFLAGS_${.IMPSRC}} ${LDFLAGS} \
> > > + -o ${.TARGET} ${.IMPSRC}
> > > ...
> >
> > Some rules are specified by POSIX, so they can't be changed. I don't
> > see how ${CFLAGS} can be per-file directly, so the POSIX spec seems to
> > be actively opposed to per-file CFLAGS.
>
> ??? You mean we can't add a variable that will normally expand to
> nil? This seems like a compatible change, unless you're worried
> about someone's makefile breaking because they defined
> CFLAGS_foo.c to mean something else.
>From POSIX.1-200x-draft7.txt:
% 23836 Default Rules
% 23837 The default rules for make shall achieve results that are the same as if the following were used.
% ...
% 23864 SINGLE SUFFIX RULES
% 23865 .c:
% 23866 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
This leaves little scope for modifying the default rules.
Bruce
More information about the freebsd-arch
mailing list