Per-source CFLAGS
Ruslan Ermilov
ru at freebsd.org
Sun Jun 22 01:37:24 PDT 2003
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 at sunbay.com Sunbay Software Ltd,
ru at FreeBSD.org FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20030622/7d998770/attachment.bin
More information about the freebsd-arch
mailing list