[Buildroot] [RFC] makefile ?= behavior

Yann E. MORIN yann.morin.1998 at free.fr
Tue Dec 3 18:23:16 UTC 2013


Matthew, All,

On 2013-12-03 12:12 -0600, Matthew Weber spake thusly:
> I'd like to make sure I'm not loosing it :-)
> 
> So I have the package smcroute(https://github.com/troglobit/smcroute) (new 
> package not yet in buildroot) and it is autotools based.  I do a configure 
> with all the toolchain info and it sets up the Makefile to have the 
> following CC definition.  This is the only location in the package 
> Makefiles that set CC.
>     CC ?= /opt/linux/linaro4.7/usr/bin/arm-linux-gnueabihf-gcc 

That's because it's not a complete autotools-based package: the
configure is from autoconf, but the Makefile is hand-written, so you
won't be able to use the autotools-package infrastructure.

Instead, use the generic-package infrastructure, and provide the
adequate CONFIGURE_CMDS, BUILD_CMDS and INSTALL_TARGET_CMDS.

> I believe that the ?= should just be a =, but in what cases would the ?= 
> actually work?  I'm trying to put the story together to convince someone 
> that believes it's just a environment issue...

?= means to assign the value if it is not already set.

When you switch to generic-package, you have those variables available
to pass to configure and make:
    TARGET_CONFIGURE_OPTS
    TARGET_MAKE_ENV

Those variables are defined in package/Makefile.in and contain the
necessary definitions for CC et al.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'


More information about the buildroot mailing list