Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jun 2003 18:23:20 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        David Schultz <dschultz@OCF.Berkeley.EDU>
Cc:        arch@freebsd.org
Subject:   Re: Per-source CFLAGS
Message-ID:  <20030622180851.K55800@gamplex.bde.org>
In-Reply-To: <20030622035258.GB60460@HAL9000.homeunix.com>
References:  <20030622005124.GA59673@HAL9000.homeunix.com> <20030622035258.GB60460@HAL9000.homeunix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030622180851.K55800>