[Build-common-hackers] CFLAGS_$(flavor)

Emilio Pozuelo Monfort pochu at debian.org
Mon Dec 27 15:40:35 UTC 2010


On 24/12/10 04:01, Jonas Smedegaard wrote:
> On Thu, Dec 23, 2010 at 11:41:36PM +0000, Emilio Pozuelo Monfort wrote:
>> On 23/12/10 22:58, Emilio Pozuelo Monfort wrote:
>>> On 22/12/10 17:58, Jonas Smedegaard wrote:
>>>> On Sun, Dec 19, 2010 at 04:15:35AM +0100, Jonas Smedegaard wrote:
>>>>> On Sun, Dec 19, 2010 at 01:47:48AM +0000, Emilio Pozuelo Monfort wrote:
>>>>>> - Would be useful to be able to specify CFLAGS as CFLAGS_$(flavor), the
>>>>>> same way as we do with DEB_CONFIGURE_FLAGS_$(flavor). Probably other
>>>>>> variables like LDFLAGS, etc.
>>>>>
>>>>> Yes. I'll look into that.
>>>>
>>>> Hmm - did you try already? It might actually accidentally work, due to
>>>> per-flavor and per-package variables being resolved the same way.
>>>
>>> I tried CFLAGS_udeb and it didn't work. I haven't tried CFLAGS_$(udeb) (where
>>> $(udeb) is libvte9-udeb), but I don't see how that would work since CFLAGS
>>> are for the build which is per-flavor.
>>
>> I have just seen what you mean, CFLAGS_$(cdbs_curpkg) in makefile-vars.mk.in:
>>
>> # Derived classes that supply the flags some other way (e.g., configure).
>> # should set this variable to empty.
>> DEB_MAKE_EXTRA_ARGS ?= CFLAGS="$(or $(CFLAGS_$(cdbs_curpkg)),$(CFLAGS))"
>> CXXFLAGS="$(or $(CXXFLAGS_$(cdbs_curpkg)),$(CXXFLAGS))" CPPFLAGS="$(or
>> $(CPPFLAGS_$(cdbs_curpkg)),$(CPPFLAGS))" LDFLAGS="$(or
>> $(LDFLAGS_$(cdbs_curpkg)),$(LDFLAGS))" $(DEB_MAKE_PARALLEL)
>>
>> They are overriden in autotools.mk.in though:
>>
>> # Overriden from makefile-vars.mk.  We pass CFLAGS and friends to
>> # ./configure, so no need to pass them to make.
>> # FIXME: Restructure to allow early override
>> DEB_MAKE_EXTRA_ARGS = $(DEB_MAKE_PARALLEL)
>>
>> Then it just sets them to CFLAGS in autotools-vars.mk.in:
>>
>> DEB_CONFIGURE_SCRIPT_ENV ?= $(call cdbs_set_nondefaultvars,CC CXX)
>> CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)"
>> LDFLAGS="$(LDFLAGS)"
>>
>> It just sets it to $(CFLAGS), without looking at $(CFLAGS_$(cdbs_curpkg)),
>> that's why it doesn't work for me, but doing the CFLAGS = $(if ...) works.
> 
> Ahh.  Thanks for the analysis.  CDBS sure is getting convoluted these days :-P
> 
> 
> 
>> I don't understand how CFLAGS passed to ./configure could relate to
>> $(cdbs_curpkg). As I see it, the ./configure (and make) calls (either in a
>> normal package doing just one call, or with multiple flavors) are completely
>> orthogonal to the packages. Can you explain how they relate and how this works?
> 
> $(cdbs_curpkg) expands to "string after slash of build target" which is also
> used for flavored configure and build targets:
> 
> configure/yourpackage/udeb::
>         CFLAGS="$(CFLAGS_$(string-after-"…ackage/udeb"))" ./configure
> 
> ...which should expand to...
> 
> configure/yourpackage/udeb::
>         CFLAGS="$(CFLAGS_udeb)" ./configure
> 
> 
> But I just rewrote CFLAGS handling earlier today, so maybe it broke in new ways ;-)
> 
> Have a look at the files in git.
> 
> I will too - and see if I can sneak in support for per-flavor CFLAG while still
> support that new non-intrusive CFLAGS handling by default.

I tried with latest git and CFLAGS_udeb didn't work. Maybe we should expand
CFLAGS to CFLAGS_$(cdbs_curpkg) if that's set in autotools-vars.mk

I'll upload gvfs with the CFLAGS = $(if $(findstring...) hack soon, and remove
the hack when we fix it. I've also converted glib2.0 and it works quite well
with 0.4.90, no hacks needed :)



More information about the Build-common-hackers mailing list