tunghathanh / gyp

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

The Makefile generator produces inconsistent paths for RULE_INPUT_PATH and RULE_INPUT_DIRNAME #357

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Setup:

$ mkdir src
$ touch src/test.ttt
$ cat >test.gyp <<EOF
{
  'targets': [
    {
      'target_name': 'test',
      'type': 'none',
      'sources': [
        'src/test.ttt',
      ],
      'rules': [
        {
          'rule_name': 'gentest',
          'extension': 'ttt',
          'outputs': [
            'test.tt2',
          ],
          'action': [ 
            './test.sh',
            '<(RULE_INPUT_DIRNAME)',
            '\$\$(dirname <(RULE_INPUT_PATH))',
          ], 
        }
      ],
    },
  ],
}
EOF
$ cat >test.sh <<EOF
#!/bin/bash

test "\$1" == "\$2"
EOF
$ chmod 700 test.sh

2. Try the gyp file under ninja:

$ GYP_GENERATORS=ninja gyp test.gyp --toplevel-dir=`pwd`
$ ninja -v -C out/Default test

3. Try the gyp file under make:

$ rm -fr out
$ GYP_GENERATORS=make gyp test.gyp --toplevel-dir=`pwd`
$ make V=1

What is the expected output? What do you see instead?

The two versions should have a consistent result, since both rely on the same 
variables RULE_INPUT_PATH and RULE_INPUT_DIRNAME in the gyp file. Either both 
should fail or both should succeed.

Instead, the gyp version works, since the ninja generator gives a relative 
pathname for both RULE_INPUT_PATH and RULE_INPUT_DIRNAME. But the makefile 
version fails, since RULE_INPUT_PATH is the absolute path to the file, and 
RULE_INPUT_DIRNAME is the relative dir name.

What version of the product are you using? On what operating system?

git commit 172357f39 (I just pulled from the repo) on Ubuntu Linux.

Please provide any additional information below.

It looks like the ninja generator is wrong: according to 
https://code.google.com/p/gyp/wiki/GypLanguageSpecification#Rules, 
RULE_INPUT_PATH is supposed to be the "full path" (which I assume means 
"absolute path"), but it's not under the ninja generator.

Original issue reported on code.google.com by tmroe...@chromium.org on 20 Jul 2013 at 2:43