Patchwork [U-Boot,RFC,v2,13/20] sandbox: Add OS dependent layer

login
register
mail settings
Submitter Mike Frysinger
Date Sept. 26, 2011, 9:19 p.m.
Message ID <201109261719.09127.vapier@gentoo.org>
Download mbox | patch
Permalink /patch/116490/
State Not Applicable
Headers show

Comments

Mike Frysinger - Sept. 26, 2011, 9:19 p.m.
On Monday, September 26, 2011 17:04:49 Simon Glass wrote:
> On Sun, Sep 25, 2011 at 10:16 PM, Mike Frysinger wrote:
> > On Friday, September 23, 2011 12:22:15 Simon Glass wrote:
> >> --- a/arch/sandbox/cpu/sandbox/Makefile
> >> +++ b/arch/sandbox/cpu/sandbox/Makefile
> >> 
> >> +# I want to do this, but it doesn't seem to work
> >> +CFLAGS_arch/sandbox/cpu/sandbox/os.o += -I/usr/include
> > 
> > seems to work for me ...
> > CFLAGS_arch/blackfin/lib/board.o = -ffoo
> 
> That is not a -I flag, though. If you try -I I think you will get a
> failure. Looking a bit closer it is because the dependency stuff uses
> CPPFLAGS which doesn't support per file/dir flags.

OK, if it's the dependency step, that's a different story.  untested patch:


-mike
Simon Glass - Sept. 26, 2011, 10:03 p.m.
Hi Mike,

On Mon, Sep 26, 2011 at 2:19 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Monday, September 26, 2011 17:04:49 Simon Glass wrote:
>> On Sun, Sep 25, 2011 at 10:16 PM, Mike Frysinger wrote:
>> > On Friday, September 23, 2011 12:22:15 Simon Glass wrote:
>> >> --- a/arch/sandbox/cpu/sandbox/Makefile
>> >> +++ b/arch/sandbox/cpu/sandbox/Makefile
>> >>
>> >> +# I want to do this, but it doesn't seem to work
>> >> +CFLAGS_arch/sandbox/cpu/sandbox/os.o += -I/usr/include
>> >
>> > seems to work for me ...
>> > CFLAGS_arch/blackfin/lib/board.o = -ffoo
>>
>> That is not a -I flag, though. If you try -I I think you will get a
>> failure. Looking a bit closer it is because the dependency stuff uses
>> CPPFLAGS which doesn't support per file/dir flags.
>
> OK, if it's the dependency step, that's a different story.  untested patch:
>
> --- a/config.mk
> +++ b/config.mk
> @@ -277,6 +277,8 @@
>  BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%))
>  ALL_AFLAGS = $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR))
>  ALL_CFLAGS = $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR))
> +EXTRA_CPPFLAGS = $(CPPFLAGS_$(BCURDIR)/$(@F)) $(CPPFLAGS_$(BCURDIR))
> +ALL_CFLAGS += $(EXTRA_CPPFLAGS)
>  $(obj)%.s:     %.S
>        $(CPP) $(ALL_AFLAGS) -o $@ $<
>  $(obj)%.o:     %.S
> --- a/rules.mk
> +++ b/rules.mk
> @@ -30,7 +30,7 @@
>                @touch $@
>                @for f in $(SRCS); do \
>                        g=`basename $$f | sed -e 's/\(.*\)\.[[:alnum:]_]/\1.o/'`; \
> -                       $(CC) -M $(CPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \
> +                       $(CC) -M $(CPPFLAGS) $(EXTRA_CPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \
>                done
>                @for f in $(HOSTSRCS); do \
>                        g=`basename $$f | sed -e 's/\(.*\)\.[[:alnum:]_]/\1.o/'`; \
>
> -mike
>

Thanks - have been playing with this a bit. The problem is that
rules.mk goes through the files in the directory one by one in a shell
'for' loop, so $(@F) isn't relevant. I am wondering in fact where I
need to replace the dependency file generation with something which
creates separate .deps for each file, and then concats them in a
separate rule.

Regards,
Simon
Simon Glass - Sept. 26, 2011, 11:53 p.m.
On Mon, Sep 26, 2011 at 3:03 PM, Simon Glass <sjg@chromium.org> wrote:
> Hi Mike,
>
> On Mon, Sep 26, 2011 at 2:19 PM, Mike Frysinger <vapier@gentoo.org> wrote:
>> On Monday, September 26, 2011 17:04:49 Simon Glass wrote:
>>> On Sun, Sep 25, 2011 at 10:16 PM, Mike Frysinger wrote:
>>> > On Friday, September 23, 2011 12:22:15 Simon Glass wrote:
>>> >> --- a/arch/sandbox/cpu/sandbox/Makefile
>>> >> +++ b/arch/sandbox/cpu/sandbox/Makefile
>>> >>
>>> >> +# I want to do this, but it doesn't seem to work
>>> >> +CFLAGS_arch/sandbox/cpu/sandbox/os.o += -I/usr/include
>>> >
>>> > seems to work for me ...
>>> > CFLAGS_arch/blackfin/lib/board.o = -ffoo
>>>
>>> That is not a -I flag, though. If you try -I I think you will get a
>>> failure. Looking a bit closer it is because the dependency stuff uses
>>> CPPFLAGS which doesn't support per file/dir flags.
>>
>> OK, if it's the dependency step, that's a different story.  untested patch:
>>
>> --- a/config.mk
>> +++ b/config.mk
>> @@ -277,6 +277,8 @@
>>  BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%))
>>  ALL_AFLAGS = $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR))
>>  ALL_CFLAGS = $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR))
>> +EXTRA_CPPFLAGS = $(CPPFLAGS_$(BCURDIR)/$(@F)) $(CPPFLAGS_$(BCURDIR))
>> +ALL_CFLAGS += $(EXTRA_CPPFLAGS)
>>  $(obj)%.s:     %.S
>>        $(CPP) $(ALL_AFLAGS) -o $@ $<
>>  $(obj)%.o:     %.S
>> --- a/rules.mk
>> +++ b/rules.mk
>> @@ -30,7 +30,7 @@
>>                @touch $@
>>                @for f in $(SRCS); do \
>>                        g=`basename $$f | sed -e 's/\(.*\)\.[[:alnum:]_]/\1.o/'`; \
>> -                       $(CC) -M $(CPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \
>> +                       $(CC) -M $(CPPFLAGS) $(EXTRA_CPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \
>>                done
>>                @for f in $(HOSTSRCS); do \
>>                        g=`basename $$f | sed -e 's/\(.*\)\.[[:alnum:]_]/\1.o/'`; \
>>
>> -mike
>>
>
> Thanks - have been playing with this a bit. The problem is that
> rules.mk goes through the files in the directory one by one in a shell
> 'for' loop, so $(@F) isn't relevant. I am wondering in fact where I
> need to replace the dependency file generation with something which
> creates separate .deps for each file, and then concats them in a
> separate rule.

Just to follow up on this - I was not able to get this to work within
the existing .depend generation, because it happens within a shell
script with no access to make variables. I have added a patch to
change this and will wait for the screams :-)

Regards,
Simon

Patch

--- a/config.mk
+++ b/config.mk
@@ -277,6 +277,8 @@ 
 BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%))
 ALL_AFLAGS = $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR))
 ALL_CFLAGS = $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR))
+EXTRA_CPPFLAGS = $(CPPFLAGS_$(BCURDIR)/$(@F)) $(CPPFLAGS_$(BCURDIR))
+ALL_CFLAGS += $(EXTRA_CPPFLAGS)
 $(obj)%.s:	%.S
 	$(CPP) $(ALL_AFLAGS) -o $@ $<
 $(obj)%.o:	%.S
--- a/rules.mk
+++ b/rules.mk
@@ -30,7 +30,7 @@ 
 		@touch $@
 		@for f in $(SRCS); do \
 			g=`basename $$f | sed -e 's/\(.*\)\.[[:alnum:]_]/\1.o/'`; \
-			$(CC) -M $(CPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \
+			$(CC) -M $(CPPFLAGS) $(EXTRA_CPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \
 		done
 		@for f in $(HOSTSRCS); do \
 			g=`basename $$f | sed -e 's/\(.*\)\.[[:alnum:]_]/\1.o/'`; \