Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jun 2003 11:37:14 +0300
From:      Ruslan Ermilov <ru@freebsd.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        David Schultz <dschultz@OCF.Berkeley.EDU>
Subject:   Re: Per-source CFLAGS
Message-ID:  <20030622083714.GD99674@sunbay.com>
In-Reply-To: <20030622180851.K55800@gamplex.bde.org>
References:  <20030622005124.GA59673@HAL9000.homeunix.com> <20030622035258.GB60460@HAL9000.homeunix.com> <20030622180851.K55800@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--AkbCVLjbJ9qUtAXD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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.
>=20
> >From POSIX.1-200x-draft7.txt:
>=20
> % 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 $@ $<
>=20
> This leaves little scope for modifying the default rules.
>=20
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=3D	${CFLAGS} -DFOO


Cheers,
--=20
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software Ltd,
ru@FreeBSD.org		FreeBSD committer

--AkbCVLjbJ9qUtAXD
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+9Wq6Ukv4P6juNwoRApwXAJ40ttjhe6+nuLfil2gC/MeRK5r8ggCfUDZn
HZqwKWaN0OF9XbC8T1b7Mk0=
=zxou
-----END PGP SIGNATURE-----

--AkbCVLjbJ9qUtAXD--



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