Skip to contentSkip to conversation

Change CFLAGS for a certain package

Buildroot mikmik 2 participants 2 messages Sep 21, 2017

lore
Share & tools
lore

mikmik

author
#0 lore raw

I have a generic-package 'hello' contains hello.c and Makefile. In the mk file I want to build HELLO_CONFIGURE_OPTS just as TARGET_CONFIGURE_OPTS but change only CFLAGS to my desired CFLAGS for hello (say just '-g').

Right now, I used sed on TARGET_CONFIGURE_OPTS and replaced CFLAGS. It works.
But there isn't a more easy or intuitive way to replace some variables on TARGET_CONFIGURE_OPTS?

Thanks in advance.

--
Sent from: http://buildroot-busybox.2317881.n4.nabble.com/

#1 lore raw
Quoted 9 lines · mikmik

I have a generic-package 'hello' contains hello.c and Makefile. In the mk file I want to build HELLO_CONFIGURE_OPTS just as TARGET_CONFIGURE_OPTS but change only CFLAGS to my desired CFLAGS for hello (say just '-g').

Right now, I used sed on TARGET_CONFIGURE_OPTS and replaced CFLAGS. It works.
But there isn't a more easy or intuitive way to replace some variables on TARGET_CONFIGURE_OPTS?

For almost all options, you can just override them by specifying the additional
option later. For example, if CFLAGS contains "-g -g0" then you don't get debugging info. So, you can always just append to cflags:

HELLO_CONFIGURE_OPTS += CFLAGS="$(TARGET_CFLAGS) -g"

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF