kenvifire / gyp

Automatically exported from code.google.com/p/gyp
0 stars 0 forks source link

gyp's Makefile generator can't handle RULE_INPUT_NAME as output for a rule #486

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Something I found when testing in v8-standalone which uses gyp in Makefile mode:

If you have a target

        {
            'target_name': 'icu_cnv_base_files',
            'type': 'none',
            'sources': [
                'foo.nrm', 'bar.nrm', 'fie.nrm',
            ],
            'rules': [
                {
                    'rule_name': 'icupkg_nrm',
                    'extension': 'nrm',
                    'outputs': [
                        '<(icu_gen_dir)/<(RULE_INPUT_NAME)',
                    ],
                },
            ],

You get a Makefile with the style:

$icu_gen_dir/$(notdir $<): foo.nrm:
    cmd
...
$icu_gen_dir/$(notdir $<): bar.nrm:
    cmd
...
$icu_gen_dir/$(notdir $<): fie.nrm:
    cmd

$(notdir $<) is supposed to expand to the name of the first prerequisite of a 
target but at least in Make 3.81 (xubuntu 14.10) $< expands to nothing and you 
get warnings about "overriding commands fr target" and "ignoring old commands 
for target" followed by targets that are never executed. 

$< It's often used in commands, so it's possible it was never meant to work in 
a target.

This is implemented in gyp in gyp/pylib/gyp/generator/make.py where 
RULE_INPUT_NAME is an output and is expanded to be the target through an 
explicit expansion to $(notdir $<).

A fix would probably be to do something similar as is already done for 
RULE_INPUT_ROOT and RULE_INPUT_DIRNAME.

I will workaround this in my bug 424192 work since gyp and Make are both 
supposed to go away, but I'm leaving this bug here for reference.

Originally reported as 
https://code.google.com/p/chromium/issues/detail?id=472589 in the Chromium 
project.

Original issue reported on code.google.com by brat...@opera.com on 14 Apr 2015 at 1:17