Re: Per-source CFLAGS
From: Ruslan Ermilov (ru_at_freebsd.org)
Date: 06/22/03
- Previous message: Bruce Evans: "Re: Per-source CFLAGS"
- In reply to: Bruce Evans: "Re: Per-source CFLAGS"
- Next in thread: David Schultz: "Re: Per-source CFLAGS"
- Reply: David Schultz: "Re: Per-source CFLAGS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sun, 22 Jun 2003 11:37:14 +0300 To: Bruce Evans <bde@zeta.org.au>
On Sun, Jun 22, 2003 at 06:23:20PM +1000, Bruce Evans wrote:
[...]
> > > 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.
>
A double suffix rule would be more appropriate here:
23883 DOUBLE SUFFIX RULES
23884 .c.o:
23885 $(CC) $(CFLAGS) -c $<
23886 .f.o:
23887 $(FC) $(FFLAGS) -c $<
23888 .y.o:
23889 $(YACC) $(YFLAGS) $<
23890 $(CC) $(CFLAGS) -c y.tab.c
23891 rm -f y.tab.c
23892 mv y.tab.o $@
Anyway, this only means we should not add the support for
per-source CFLAGS to the %POSIX section of sys.mk.
I still have some concerns with the proposed implementation.
All already existing per-file knobs override the global knob,
and I think that maybe the per-source CFLAGS should behave
the same? Doing it this way is more flexible; you're free
to augment the global CFLAGS by saying
CFLAGS_foo.c= ${CFLAGS} -DFOO
Cheers,
-- Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software Ltd, ru@FreeBSD.org FreeBSD committer
- application/pgp-signature attachment: stored
- Previous message: Bruce Evans: "Re: Per-source CFLAGS"
- In reply to: Bruce Evans: "Re: Per-source CFLAGS"
- Next in thread: David Schultz: "Re: Per-source CFLAGS"
- Reply: David Schultz: "Re: Per-source CFLAGS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]