linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: do not add srctree to sysroot relative includes
@ 2016-08-16 11:40 Lars Persson
  2016-08-16 11:59 ` Michal Marek
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Persson @ 2016-08-16 11:40 UTC (permalink / raw)
  To: mmarek; +Cc: linux-kernel, arnd, Lars Persson

We need to filter out also -I=/path to allow sysroot relative
include paths in the makefiles of external modules.

Signed-off-by: Lars Persson <larper@axis.com>
---
 scripts/Kbuild.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 1792198..ffe5c6c 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -206,7 +206,7 @@ hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
 # Prefix -I with $(srctree) if it is not an absolute path.
 # skip if -I has no parameter
 addtree = $(if $(patsubst -I%,%,$(1)), \
-$(if $(filter-out -I/% -I./% -I../%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1)))
+$(if $(filter-out -I/% -I./% -I../% -I=%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1)))
 
 # Find all -I options and call addtree
 flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: do not add srctree to sysroot relative includes
  2016-08-16 11:40 [PATCH] kbuild: do not add srctree to sysroot relative includes Lars Persson
@ 2016-08-16 11:59 ` Michal Marek
  2016-08-16 12:22   ` Lars Persson
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Marek @ 2016-08-16 11:59 UTC (permalink / raw)
  To: Lars Persson; +Cc: linux-kernel, arnd, Lars Persson

On 2016-08-16 13:40, Lars Persson wrote:
> We need to filter out also -I=/path to allow sysroot relative
> include paths in the makefiles of external modules.
> 
> Signed-off-by: Lars Persson <larper@axis.com>
> ---
>  scripts/Kbuild.include | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> index 1792198..ffe5c6c 100644
> --- a/scripts/Kbuild.include
> +++ b/scripts/Kbuild.include
> @@ -206,7 +206,7 @@ hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
>  # Prefix -I with $(srctree) if it is not an absolute path.
>  # skip if -I has no parameter
>  addtree = $(if $(patsubst -I%,%,$(1)), \
> -$(if $(filter-out -I/% -I./% -I../%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1)))
> +$(if $(filter-out -I/% -I./% -I../% -I=%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1)))

Hi Lars,

Two questions: 1) Where is the -I=/... syntax documented? I could not
find it gcc docs. 2) Why do these Makefiles use --sysroot at all? The
kernel does not use any system libraries and the host programs are
compiled for the host architecture.

Michal

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: do not add srctree to sysroot relative includes
  2016-08-16 11:59 ` Michal Marek
@ 2016-08-16 12:22   ` Lars Persson
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Persson @ 2016-08-16 12:22 UTC (permalink / raw)
  To: Michal Marek, Lars Persson; +Cc: linux-kernel, arnd



On 08/16/2016 01:59 PM, Michal Marek wrote:
> On 2016-08-16 13:40, Lars Persson wrote:
>> We need to filter out also -I=/path to allow sysroot relative
>> include paths in the makefiles of external modules.
>>
>> Signed-off-by: Lars Persson <larper@axis.com>
>> ---
>>  scripts/Kbuild.include | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
>> index 1792198..ffe5c6c 100644
>> --- a/scripts/Kbuild.include
>> +++ b/scripts/Kbuild.include
>> @@ -206,7 +206,7 @@ hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
>>  # Prefix -I with $(srctree) if it is not an absolute path.
>>  # skip if -I has no parameter
>>  addtree = $(if $(patsubst -I%,%,$(1)), \
>> -$(if $(filter-out -I/% -I./% -I../%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1)))
>> +$(if $(filter-out -I/% -I./% -I../% -I=%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1)))
>
> Hi Lars,
>
> Two questions: 1) Where is the -I=/... syntax documented? I could not
> find it gcc docs.

You should find this in your gcc manual:
If dir begins with "=", then the "=" will be replaced by the sysroot 
prefix; see --sysroot and -isysroot.


2) Why do these Makefiles use --sysroot at all? The
> kernel does not use any system libraries and the host programs are
> compiled for the host architecture.

One use-case is with the yocto build system. Suppose we have two kernel 
modules A and B. A installs header files into the sysroot that B will 
include.


- Lars

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-16 12:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-16 11:40 [PATCH] kbuild: do not add srctree to sysroot relative includes Lars Persson
2016-08-16 11:59 ` Michal Marek
2016-08-16 12:22   ` Lars Persson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).