LKML Archive mirror
 help / color / mirror / Atom feed
* Dependency issue through subdir's
@ 2016-01-25 11:33 Kieran Bingham
  2016-01-25 13:22 ` Michal Marek
  0 siblings, 1 reply; 4+ messages in thread
From: Kieran Bingham @ 2016-01-25 11:33 UTC (permalink / raw
  To: linux-kbuild, mmarek; +Cc: Jan Kiszka, Lee Jones, Peter Griffin, Linux Kernel


I am having difficulty with dependencies while trying to create an
automatically generated file in linux/scripts/gdb/

This autogenerated file, includes the kernel headers, so that we can
access kernel constants from GDB. As such, I need to parse C-headers
into a python-compatible file.

The commit-diff at :
https://git.linaro.org/people/kieran.bingham/linux.git/commitdiff/26194ca0579ec94b3630f1aac0e985242831aa1c
shows the current implementation.

This is functional on a make -j1 build, however at -j2 and above (from a
clean build), kbuild attempts to generate my file before
include/generated/timeconst.h resulting in the following error:

--- 8< ---
  GEN     scripts/gdb/linux/constants.py
In file included from sources/linux/include/linux/ktime.h:25:0,
                 from /linux/include/linux/rcupdate.h:47,
                 from /linux/include/linux/rbtree.h:34,
                 from /linux/include/linux/mm_types.h:9,
                 from /linux/arch/x86/include/asm/pgtable.h:448,
                 from /linux/scripts/gdb/linux/constants.py.in:16:
sources/linux/include/linux/jiffies.h:10:33: fatal error:
generated/timeconst.h: No such file or directory
--- >8 ---


I have tried to provide a dependency on include/generated/timeconst.h,
however, because scripts/gdb/ is a subdir-y target, it is run through a
submake, and the parent directory targets are not available.


I have also tried to look at how to delay the execution of the
scripts/gdb subdir - but subdir-ym is simply a sorted list, (and using
subdir-m += scripts/gdb didn't help)



I feel like I have the following possible approaches to solving this:


1) Create a 'subdir-late-' target group which builds specifically as
late in the build process as possible


2) Move the code that generates this file to /Kbuild. However I don't
like the idea of putting non-essential generator at the top level build


3) Add #ifndef __GENERATE_CONSTANTS_PY__ across any reference to
generated header files, such as in ktime.h, and define that with my
Preprocessor statement.



Are there any other solutions? I dislike all 3 of the options above ...

I'd appreciate any thoughts here.

--
Regards

Kieran Bingham

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

* Re: Dependency issue through subdir's
  2016-01-25 11:33 Dependency issue through subdir's Kieran Bingham
@ 2016-01-25 13:22 ` Michal Marek
  2016-01-25 16:22   ` Kieran Bingham
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Marek @ 2016-01-25 13:22 UTC (permalink / raw
  To: Kieran Bingham
  Cc: linux-kbuild, Jan Kiszka, Lee Jones, Peter Griffin, Linux Kernel

On 2016-01-25 12:33, Kieran Bingham wrote:
> This is functional on a make -j1 build, however at -j2 and above (from a
> clean build), kbuild attempts to generate my file before
> include/generated/timeconst.h resulting in the following error:
> 
> --- 8< ---
>   GEN     scripts/gdb/linux/constants.py
> In file included from sources/linux/include/linux/ktime.h:25:0,
>                  from /linux/include/linux/rcupdate.h:47,
>                  from /linux/include/linux/rbtree.h:34,
>                  from /linux/include/linux/mm_types.h:9,
>                  from /linux/arch/x86/include/asm/pgtable.h:448,
>                  from /linux/scripts/gdb/linux/constants.py.in:16:
> sources/linux/include/linux/jiffies.h:10:33: fatal error:
> generated/timeconst.h: No such file or directory
> --- >8 ---
[...]
> 2) Move the code that generates this file to /Kbuild. However I don't
> like the idea of putting non-essential generator at the top level build

You can keep the code in scripts/gdb/..., just move it out of $(always)
and have the toplevel Kbuild file call something like

  $(MAKE) $(obj)=scripts/gdb/linux build_constants


> 3) Add #ifndef __GENERATE_CONSTANTS_PY__ across any reference to
> generated header files, such as in ktime.h, and define that with my
> Preprocessor statement.

If you do not need the generated headers, this might be the least evil.
We already have the COMPILE_OFFSETS and __GENERATING_BOUNDS_H defines
for a similar purpose.

Michal

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

* Re: Dependency issue through subdir's
  2016-01-25 13:22 ` Michal Marek
@ 2016-01-25 16:22   ` Kieran Bingham
  2016-01-25 16:25     ` Michal Marek
  0 siblings, 1 reply; 4+ messages in thread
From: Kieran Bingham @ 2016-01-25 16:22 UTC (permalink / raw
  To: Michal Marek
  Cc: linux-kbuild, Jan Kiszka, Lee Jones, Peter Griffin, Linux Kernel

Hi Michal,

Thanks for your fast response!

On 25/01/16 13:22, Michal Marek wrote:
> On 2016-01-25 12:33, Kieran Bingham wrote:
>> This is functional on a make -j1 build, however at -j2 and above (from a
>> clean build), kbuild attempts to generate my file before
>> include/generated/timeconst.h resulting in the following error:
>>
>> --- 8< ---
>>   GEN     scripts/gdb/linux/constants.py
>> In file included from sources/linux/include/linux/ktime.h:25:0,
>>                  from /linux/include/linux/rcupdate.h:47,
>>                  from /linux/include/linux/rbtree.h:34,
>>                  from /linux/include/linux/mm_types.h:9,
>>                  from /linux/arch/x86/include/asm/pgtable.h:448,
>>                  from /linux/scripts/gdb/linux/constants.py.in:16:
>> sources/linux/include/linux/jiffies.h:10:33: fatal error:
>> generated/timeconst.h: No such file or directory
>> --- >8 ---
> [...]
>> 2) Move the code that generates this file to /Kbuild. However I don't
>> like the idea of putting non-essential generator at the top level build
> 
> You can keep the code in scripts/gdb/..., just move it out of $(always)
> and have the toplevel Kbuild file call something like
> 
>   $(MAKE) $(obj)=scripts/gdb/linux build_constants
> 

Looks like this will have to be the path forwards, as it appears I do
need some of the generated headers...

> 
>> 3) Add #ifndef __GENERATE_CONSTANTS_PY__ across any reference to
>> generated header files, such as in ktime.h, and define that with my
>> Preprocessor statement.

Hrm ...
This simply moves the error on to the next generated file :
generated/bounds.h: which unfortunately I do need!

> 
> If you do not need the generated headers, this might be the least evil.
> We already have the COMPILE_OFFSETS and __GENERATING_BOUNDS_H defines
> for a similar purpose.
> 
> Michal
> 

I've got a working patch now for the $(MAKE) version,
however I've had to use $(build)=scripts/gdb/linux build_constants to
make it work.


Thanks again for your help
-- 
Regards

Kieran Bingham

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

* Re: Dependency issue through subdir's
  2016-01-25 16:22   ` Kieran Bingham
@ 2016-01-25 16:25     ` Michal Marek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Marek @ 2016-01-25 16:25 UTC (permalink / raw
  To: Kieran Bingham
  Cc: linux-kbuild, Jan Kiszka, Lee Jones, Peter Griffin, Linux Kernel

On 2016-01-25 17:22, Kieran Bingham wrote:
> I've got a working patch now for the $(MAKE) version,
> however I've had to use $(build)=scripts/gdb/linux build_constants to
> make it work.

$(build)= is the correct syntax, sorry for the confusion.

Michal

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

end of thread, other threads:[~2016-01-25 16:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25 11:33 Dependency issue through subdir's Kieran Bingham
2016-01-25 13:22 ` Michal Marek
2016-01-25 16:22   ` Kieran Bingham
2016-01-25 16:25     ` Michal Marek

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 read-only IMAP folder(s) and NNTP newsgroup(s).