public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* Automatic dependency resolution on generated python file
@ 2016-05-23 23:02 Kieran Bingham
  2016-06-20 14:50 ` Michal Marek
  0 siblings, 1 reply; 3+ messages in thread
From: Kieran Bingham @ 2016-05-23 23:02 UTC (permalink / raw)
  To: linux-kbuild, Michal Marek; +Cc: Jan Kiszka

Hi Kbuild / Michal,

I've been working through a problem that Jan has reported whereby if we
modify a file included by our template  for constants.py, the generated
file is not rebuilt.

The rule/cmd [0] to generate the python constants is
cmd_gen_constants_py which uses the $(CPP) with $(c_flags) to create the
output.

One benefit of this is that it already creates the $(depfile) through
the addition of the flags provided by $(c_flags), however as yet it
would seem that my efforts to understand how the $(depfile) gets
included have failed.

From what I can tell, the $(call if_changed...) rule is generating my
targets .constants.py.cmd, but the .d file is not being utilised.

By swapping $(call if_changed, ) to $(call if_changed_dep,...) I can see
that my .constants.py.cmd [1] file now has (apparently) correct
dependency rules being generated. However they still don't take actual
effect. If I 'touch/modify' one of the files I have added to the
#includes, then my target is not rebuilt (I have added
include/linux/kieran.h for testing this specifically without rebuilding
all other objects)

I can see at the bottom of my .constants.py.cmd :
  scripts/gdb/linux/constants.py: $(deps_scripts/gdb/linux/constants.py)
  $(deps_scripts/gdb/linux/constants.py):

which looks like it's doing the right thing to me ... except it's not
actually allowing the rule to run if a dependency is updated.

Is this failing because it is being called from the top Kbuild, as part
of making sure it is built after bounds.h, or is it because I'm not
generating from the builtin rules?

I'm hoping perhaps I've missed a stage or something obvious that will
make this automatic dependency resolution 'just-work' for recreating the
constants file.

-- 
Regards

Kieran Bingham


[0]
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/scripts/gdb/linux/Makefile

[1] http://paste.ubuntu.com/16645481/


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

* Re: Automatic dependency resolution on generated python file
  2016-05-23 23:02 Automatic dependency resolution on generated python file Kieran Bingham
@ 2016-06-20 14:50 ` Michal Marek
  2016-06-21 22:02   ` Kieran Bingham
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Marek @ 2016-06-20 14:50 UTC (permalink / raw)
  To: Kieran Bingham; +Cc: linux-kbuild, Jan Kiszka

On 2016-05-24 01:02, Kieran Bingham wrote:
> Hi Kbuild / Michal,
> 
> I've been working through a problem that Jan has reported whereby if we
> modify a file included by our template  for constants.py, the generated
> file is not rebuilt.
> 
> The rule/cmd [0] to generate the python constants is
> cmd_gen_constants_py which uses the $(CPP) with $(c_flags) to create the
> output.
> 
> One benefit of this is that it already creates the $(depfile) through
> the addition of the flags provided by $(c_flags), however as yet it
> would seem that my efforts to understand how the $(depfile) gets
> included have failed.
> 
> From what I can tell, the $(call if_changed...) rule is generating my
> targets .constants.py.cmd, but the .d file is not being utilised.
> 
> By swapping $(call if_changed, ) to $(call if_changed_dep,...) I can see
> that my .constants.py.cmd [1] file now has (apparently) correct
> dependency rules being generated. However they still don't take actual
> effect. If I 'touch/modify' one of the files I have added to the
> #includes, then my target is not rebuilt (I have added
> include/linux/kieran.h for testing this specifically without rebuilding
> all other objects)

Hi Kieran,

sorry for the late reply. In case this is still relevant: For
if_changed/if_changed_dep to work, you must list the target in the
$(targets) list (without the $(obj) prefix) and add FORCE as a
prerequisite of the rule.

Michal

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

* Re: Automatic dependency resolution on generated python file
  2016-06-20 14:50 ` Michal Marek
@ 2016-06-21 22:02   ` Kieran Bingham
  0 siblings, 0 replies; 3+ messages in thread
From: Kieran Bingham @ 2016-06-21 22:02 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, Jan Kiszka

On 20/06/16 15:50, Michal Marek wrote:
> On 2016-05-24 01:02, Kieran Bingham wrote:
>> Hi Kbuild / Michal,
>>
>> I've been working through a problem that Jan has reported whereby if we
>> modify a file included by our template  for constants.py, the generated
>> file is not rebuilt.
>>
>> The rule/cmd [0] to generate the python constants is
>> cmd_gen_constants_py which uses the $(CPP) with $(c_flags) to create the
>> output.
>>
>> One benefit of this is that it already creates the $(depfile) through
>> the addition of the flags provided by $(c_flags), however as yet it
>> would seem that my efforts to understand how the $(depfile) gets
>> included have failed.
>>
>> From what I can tell, the $(call if_changed...) rule is generating my
>> targets .constants.py.cmd, but the .d file is not being utilised.
>>
>> By swapping $(call if_changed, ) to $(call if_changed_dep,...) I can see
>> that my .constants.py.cmd [1] file now has (apparently) correct
>> dependency rules being generated. However they still don't take actual
>> effect. If I 'touch/modify' one of the files I have added to the
>> #includes, then my target is not rebuilt (I have added
>> include/linux/kieran.h for testing this specifically without rebuilding
>> all other objects)
> 
> Hi Kieran,
> 
> sorry for the late reply.

No problem, still useful!

> In case this is still relevant: For
> if_changed/if_changed_dep to work, you must list the target in the
> $(targets) list (without the $(obj) prefix) and add FORCE as a
> prerequisite of the rule.

Thankyou! - It works!

Now my generate rule is only called when it is supposed to be.

I'll hopefully get this fix sent in with the rest of my series by the
weekend.

> Michal

Thankyou for your support

-- 
Regards

Kieran Bingham

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

end of thread, other threads:[~2016-06-21 22:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-23 23:02 Automatic dependency resolution on generated python file Kieran Bingham
2016-06-20 14:50 ` Michal Marek
2016-06-21 22:02   ` Kieran Bingham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox