diff mbox

[U-Boot] Compiling certain files with extra compiler flags

Message ID CAC3GErEZ0t8BD5d7UzZm4sk=_stpTZEOqNk+PhMSZRQnSNyE=A@mail.gmail.com
State Not Applicable
Headers show

Commit Message

Vadim Bendebury Sept. 4, 2013, 6:49 p.m. UTC
Does u-boot provide the ability to change compilation options 'on the
fly', say when certain files need to be compiled for symbolic
debugging? I looked but did not find any.

How about something like this:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
$ git diff config.mk
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Then, say I want to have spl_boot.c compiled with extra flags, just
invoking make like this does the trick:

 CPP_spl_boot_c='-O0 -fno-default-inline'  make ...

Or is there a better way?

--vb

Comments

Vadim Bendebury Sept. 5, 2013, 4:50 p.m. UTC | #1
On Wed, Sep 4, 2013 at 8:16 PM, Simon Glass <sjg@google.com> wrote:
> Hi Vadim,
>
> OK I see.
>
> You can do something like this:
>
> CFLAGS_arch/arm/cpu/tegra20-common/warmboot_avp.o += -march=armv4t
>
> (this is used by Tegra)
>
> Regards,
> Simon
>

Ah, this works, thank you, Simon!

--vb

>
> On Wed, Sep 4, 2013 at 8:25 PM, Vadim Bendebury <vbendeb@chromium.org> wrote:
>> this is the tweak
>>
>> ---------- Forwarded message ----------
>> From: Vadim Bendebury <vbendeb@chromium.org>
>> Date: Wed, Sep 4, 2013 at 11:49 AM
>> Subject: Compiling certain files with extra compiler flags
>> To: uboot <u-boot@lists.denx.de>
>>
>>
>> Does u-boot provide the ability to change compilation options 'on the
>> fly', say when certain files need to be compiled for symbolic
>> debugging? I looked but did not find any.
>>
>> How about something like this:
>>
>> vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
>> $ git diff config.mk
>> diff --git a/config.mk b/config.mk
>> index 853e6d8..41cafbb 100644
>> --- a/config.mk
>> +++ b/config.mk
>> @@ -406,7 +406,7 @@ $(obj)%.o:  %.c
>>  ifneq ($(CHECKSRC),0)
>>         $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $<
>>  endif
>> -       $(CC)  $(ALL_CFLAGS) -o $@ $< -c
>> +       $(CC)  $(ALL_CFLAGS) $(CPP_$(subst .,_,$<)) -o $@ $< -c
>>  $(obj)%.i:     %.c
>>         $(CPP) $(ALL_CFLAGS) -o $@ $< -c
>>  $(obj)%.s:     %.c
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>> Then, say I want to have spl_boot.c compiled with extra flags, just
>> invoking make like this does the trick:
>>
>>  CPP_spl_boot_c='-O0 -fno-default-inline'  make ...
>>
>> Or is there a better way?
>>
>> --vb
Simon Glass Sept. 5, 2013, 4:53 p.m. UTC | #2
Hi Vadim,

On Thu, Sep 5, 2013 at 10:50 AM, Vadim Bendebury <vbendeb@chromium.org> wrote:
> On Wed, Sep 4, 2013 at 8:16 PM, Simon Glass <sjg@google.com> wrote:
>> Hi Vadim,
>>
>> OK I see.
>>
>> You can do something like this:
>>
>> CFLAGS_arch/arm/cpu/tegra20-common/warmboot_avp.o += -march=armv4t
>>
>> (this is used by Tegra)
>>
>> Regards,
>> Simon
>>
>
> Ah, this works, thank you, Simon!

Great!

>
> --vb

Regards,
Simon
diff mbox

Patch

diff --git a/config.mk b/config.mk
index 853e6d8..41cafbb 100644
--- a/config.mk
+++ b/config.mk
@@ -406,7 +406,7 @@  $(obj)%.o:  %.c
 ifneq ($(CHECKSRC),0)
        $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $<
 endif
-       $(CC)  $(ALL_CFLAGS) -o $@ $< -c
+       $(CC)  $(ALL_CFLAGS) $(CPP_$(subst .,_,$<)) -o $@ $< -c
 $(obj)%.i:     %.c
        $(CPP) $(ALL_CFLAGS) -o $@ $< -c
 $(obj)%.s:     %.c