Re: [PATCH] build: assign extra flags to ALL_CFLAGS instead of CFLAGS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2017-10-18 at 22:21 +0200, Luc Van Oostenryck wrote:
> On Wed, Oct 18, 2017 at 10:00 PM, Jeff Layton <jlayton@xxxxxxxxxxxxxxx> wrote:
> > On Wed, 2017-10-18 at 21:41 +0200, Luc Van Oostenryck wrote:
> > > On Wed, Oct 18, 2017 at 5:12 PM, Jeff Layton <jlayton@xxxxxxxxxxxxxxx> wrote:
> > > > 
> > > >     The fedora packaging tools want to override $CFLAGS when building
> > > >     sparse, but that fails on a couple of targets.
> > > > 
> > > >     There are a couple of build targets in the makefile that want to add
> > > >     options to $CFLAGS. When we do a build though, we pass $ALL_CFLAGS to
> > > >     the compiler, and that ends up without those extra options, if CFLAGS=
> > > >     was specified on the command line.
> > > > 
> > > >     I'm not sure if this is a recursive variable expansion bug in make, but
> > > 
> > > I think it's just an effect of CFLAGS being then used as a
> > > target-specific variable
> > > 
> > > -- Luc
> > 
> > Ahh ok...so this is probably the correct fix then?
> 
> I guess so but I don't really know how and what you're overriding.
> Something like:
>     make CFLAGS="-O3 -some-others-flags"
> 

Yes, quite similar to that.

Overriding is probably the wrong word. We just want to pass in a
baseline set of CFLAGS and then make can add that on to whatever it likes.

IIUC, the CFLAGS variable is sort of an autotools-ism. We could call it
something else, but that's sort of the bog-standard way that this is
done.

FWIW, the weird bit here is that the ALL_CFLAGS variable gets reexpanded
like you'd expect when you don't pass in CFLAGS on the command line.
It's only when we do that this thing seems to break.

That seems sort of unexpected, IMO, but since we're passing ALL_CFLAGS
to gcc, it makes sense to add these extra options on there in the
makefile.


> To be honest, I don't like much sparse's makefile and I don't see the real need
> for BASIC_CFLAGS & ALL_CFLAGS.
> On the other hand, I understand very well the need for an explicit mechanism for
> adding or changing some CFLAGS's flags
> 

Yeah, even though it's a pretty simple program, using something like
autotools or cmake would give all of this the benefit of better
familiarity for packaging. That also tends to be lower maintenance over
the long haul of a project in my experience.
-- 
Jeff Layton <jlayton@xxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux