1# Copyright 2014 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# Rule to extract integer values for each symbol from an object file.
6# The output file name is the input file name with extension replaced with
7# asm or h.
8# The following gyp variables must be set before including this gypi:
9#   output_format, the output format of integer value.
10#   output_dir, the full path where the output file should be created.
11#
12# For example:
13#
14# 'sources': ['a.o', 'b.o'],
15# 'variables': {
16#   'output_format': 'cheader',
17#   'output_dir': 'output',
18# },
19# 'includes': ['obj_int_extract.gypi'],
20#
21# This extracts the symbol from a.o and b.o, and outputs them to a.h and b.h
22# in output directory.
23{
24  'variables': {
25    'conditions': [
26      ['os_posix==1', {
27        'asm_obj_extension': 'o',
28      }],
29      ['OS=="win"', {
30        'asm_obj_extension': 'obj',
31      }],
32      ['output_format=="cheader"', {
33        'output_extension': 'h',
34      }, {
35        'output_extension': 'asm',
36      }],
37    ],
38  },
39  'rules': [
40    {
41      'rule_name': 'obj_int_extract',
42      'extension': '<(asm_obj_extension)',
43      'inputs': [
44        '<(PRODUCT_DIR)/libvpx_obj_int_extract',
45        'obj_int_extract.py',
46      ],
47      'outputs': [
48        '<(output_dir)/<(RULE_INPUT_ROOT).<(output_extension)',
49      ],
50      'action': [
51	'python',
52        '<(DEPTH)/third_party/libvpx/obj_int_extract.py',
53        '-e', '<(PRODUCT_DIR)/libvpx_obj_int_extract',
54        '-f', '<(output_format)',
55        '-b', '<(RULE_INPUT_PATH)',
56        '-o', '<(output_dir)/<(RULE_INPUT_ROOT).<(output_extension)',
57      ],
58      'message': 'Generate assembly offsets <(RULE_INPUT_PATH)',
59    },
60  ],
61}
62