blob: 4600bb19a9f40e77b290270ed28f3a5e613e28b6 [file] [log] [blame]
kma@webrtc.org93364692012-11-07 22:34:16 +00001# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9# This file is meant to be included into a target to provide an action
10# to generate C header files. These headers include definitions
11# that can be used in ARM assembly files.
12#
13# To use this, create a gyp target with the following form:
14# {
15# 'target_name': 'my_asm_headers_lib',
16# 'type': 'static_library',
17# 'sources': [
18# 'foo.c',
19# 'bar.c',
20# ],
21# 'includes': ['path/to/this/gypi/file'],
22# }
23#
24# The headers are guaranteed to be generated before any
25# source files, even within this target, are compiled.
26#
27# The 'asm_header_dir' variable specifies the path suffix that output
28# files are generated under.
29
30# TODO(kma): port this block from Android into other build systems.
31{
32 'variables': {
kma@webrtc.org93364692012-11-07 22:34:16 +000033 'out_dir': '<(SHARED_INTERMEDIATE_DIR)/<(asm_header_dir)',
34 'process_outputs_as_sources': 1,
kma@webrtc.org9bf0d092013-02-23 04:16:59 +000035 'conditions': [
36 # We only support Android and iOS.
37 ['OS=="android"', {
38 'compiler_to_use':
39 '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <(android_toolchain)/*-gcc)',
40 'compiler_options': '-I<(webrtc_root)/.. -I<@(android_ndk_include) -S',
41 'pattern_to_detect': 'offset_',
42 }],
43 ['OS=="ios"', {
44 'compiler_to_use': 'clang',
45 'compiler_options':
46 '-arch armv7 -I<(webrtc_root)/.. -isysroot $(SDKROOT) -S',
47 'pattern_to_detect': '_offset_',
48 }],
49 ]
kma@webrtc.org93364692012-11-07 22:34:16 +000050 },
51 'rules': [
52 {
53 'rule_name': 'generate_asm_header',
54 'extension': 'c',
55 'inputs': [
wjia@webrtc.org1b790df2012-11-15 00:13:07 +000056 'generate_asm_header.py',
kma@webrtc.org93364692012-11-07 22:34:16 +000057 ],
58 'outputs': [
59 '<(out_dir)/<(RULE_INPUT_ROOT).h',
60 ],
61 'action': [
62 'python',
wjia@webrtc.org1b790df2012-11-15 00:13:07 +000063 '<(webrtc_root)/build/generate_asm_header.py',
kma@webrtc.org9bf0d092013-02-23 04:16:59 +000064 '--compiler=<(compiler_to_use)',
65 '--options=<(compiler_options)',
66 '--pattern=<(pattern_to_detect)',
kma@webrtc.org93364692012-11-07 22:34:16 +000067 '--dir=<(out_dir)',
68 '<(RULE_INPUT_PATH)',
69 ],
70 'message': 'Generating assembly header files',
71 'process_outputs_as_sources': 1,
72 },
73 ],
74 'direct_dependent_settings': {
75 'include_dirs': ['<(out_dir)',],
76 },
77 # This target exports a hard dependency because it generates header files.
78 'hard_dependency': 1,
79}