mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: Having hard time adding to CFLAGS
Date: Fri, 23 Oct 2015 01:16:04 -0400	[thread overview]
Message-ID: <20151023051604.GF8645@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAK1hOcMgQcju2o129uB3V7PVk7wSbeY_m+T+gv64tjcyAg4rnw@mail.gmail.com>

On Fri, Oct 23, 2015 at 06:53:29AM +0200, Denys Vlasenko wrote:
> On Fri, Oct 23, 2015 at 6:09 AM, Rich Felker <dalias@libc.org> wrote:
> > On Thu, Oct 22, 2015 at 11:02:36PM -0400, Rich Felker wrote:
> >> > the attached patch makes this work, but i
> >> > consider -Os to be not part of 'needed'
> >>
> >> > diff --git a/Makefile b/Makefile
> >> > index 844a017..f713286 100644
> >> > --- a/Makefile
> >> > +++ b/Makefile
> >> > @@ -94,22 +94,22 @@ crt/crt1.o crt/Scrt1.o crt/rcrt1.o src/ldso/dlstart.lo: $(wildcard arch/$(ARCH)/
> >> >
> >> >  crt/rcrt1.o: src/ldso/dlstart.c
> >> >
> >> > -crt/Scrt1.o crt/rcrt1.o: CFLAGS += -fPIC
> >> > +crt/Scrt1.o crt/rcrt1.o: CFLAGS_ALL += -fPIC
> >>
> >> This is the correct fix. I was not aware that make variables set from
> >> the make command line would take precedence over the target-specific
> >> += concatenations. The intent has always been that editing CFLAGS
> >> should not break the build (unless you put really inapproriate stuff
> >> there, of course).
> >
> > I've committed this with one change (omitting the -O3 thing that's
> > really optional) and another related fix.
> >
> > Note however that overriding CFLAGS at make time is still a bad idea.
> > It will suppress all the warning options configure detected and other
> > useful but non-essential things like -fno-unwind-tables and
> > -fno-asynchronous-unwind-tables. We should probably discuss whether
> > this behavior is desirable. We could factor out all of the stuff
> > configure detects into a CFLAGS_AUTO and leave CFLAGS just containing
> > the user-provided options. Opinions?
> 
> Make configure --help warn/explain what would happen if
> make CFLAGS=foo is run.
> 
> Currently, it is confusing. See for yourself:
> 
> 
> Usage: $0 [OPTION]... [VAR=VALUE]... [TARGET]
> 
> To assign environment variables (e.g., CC, CFLAGS...), specify them as
> VAR=VALUE.  See below for descriptions of some of the useful variables.
> ....
> ("ok, I got it. CFLAGS should go to configure's command line!")
> ....
> Some influential environment variables:
>   CC                      C compiler command [detected]
>   CFLAGS                  C compiler flags [-Os -pipe ...]
>   CROSS_COMPILE           prefix for cross compiler and tools [none]
>   LIBCC                   compiler runtime library [detected]
> 
> Use these variables to override the choices made by configure.
> 
> ("What? You just said that CFLAGS should be on command line!
> Now you are saying it should be in the environment!
> What it is?")

The behavior is the same as autoconf: they're accepted either as
environment variables or on the configure command line. Some users do:

	CFLAGS=... ./configure ...

and others do:

	./configure CFLAGS=... ...

Following a principle of least surprise, I've tried to match the
behavior of autoconf-generated configure scripts, which actually has
something resembling a specification outside of the autoconf
implementation:

https://www.gnu.org/prep/standards/html_node/Configuration.html

I can add some language to the help text to make it explicit that
either is accepted.

Rich


  reply	other threads:[~2015-10-23  5:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-22 22:31 Denys Vlasenko
2015-10-22 23:04 ` Josiah Worcester
2015-10-23  0:13   ` Denys Vlasenko
2015-10-22 23:23 ` Szabolcs Nagy
2015-10-23  3:02   ` Rich Felker
2015-10-23  4:09     ` Rich Felker
2015-10-23  4:53       ` Denys Vlasenko
2015-10-23  5:16         ` Rich Felker [this message]
2015-10-23  6:47           ` Denys Vlasenko
2015-10-24 19:37             ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151023051604.GF8645@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).