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

Vadim Bendebury vbendeb at chromium.org
Wed Sep 4 20:49:50 CEST 2013


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


More information about the U-Boot mailing list