OSDN Git Service

resolved conflicts for b8cc54d1 to mnc-dr-dev-plus-aosp
[android-x86/system-bt.git] / build / toolchain / gcc / BUILD.gn
1 #
2 #  Copyright (C) 2015 Google, Inc.
3 #
4 #  Licensed under the Apache License, Version 2.0 (the "License");
5 #  you may not use this file except in compliance with the License.
6 #  You may obtain a copy of the License at:
7 #
8 #  http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #  Unless required by applicable law or agreed to in writing, software
11 #  distributed under the License is distributed on an "AS IS" BASIS,
12 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #  See the License for the specific language governing permissions and
14 #  limitations under the License.
15 #
16 cc = "gcc"
17 cxx = "g++"
18
19 toolchain("gcc") {
20   tool("cc") {
21     depfile = "{{output}}.d"
22     command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
23     depsformat = "gcc"
24     description = "CC {{output}}"
25     outputs = [
26       "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
27     ]
28   }
29
30   tool("cxx") {
31     depfile = "{{output}}.d"
32     command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
33     depsformat = "gcc"
34     description = "CXX {{output}}"
35     outputs = [
36       "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
37     ]
38   }
39
40   tool("alink") {
41     rspfile = "{{output}}.rsp"
42     command = "rm -f {{output}} && ar rcs {{output}} @$rspfile"
43     description = "AR {{target_output_name}}{{output_extension}}"
44     rspfile_content = "{{inputs}}"
45     outputs = [
46       "{{target_out_dir}}/{{target_output_name}}{{output_extension}}",
47     ]
48     default_output_extension = ".a"
49
50     output_prefix = "lib"
51   }
52
53   tool("solink") {
54     soname = "{{target_output_name}}{{output_extension}}"  # e.g. "libfoo.so".
55     rspfile = soname + ".rsp"
56
57     command = "$cxx -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile"
58     rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}"
59
60     description = "SOLINK $soname"
61
62     # Use this for {{output_extension}} expansions unless a target manually
63     # overrides it (in which case {{output_extension}} will be what the target
64     # specifies).
65     default_output_extension = ".so"
66
67     outputs = [
68       soname,
69     ]
70     link_output = soname
71     depend_output = soname
72
73     output_prefix = "lib"
74   }
75
76   tool("link") {
77     outfile = "{{target_output_name}}{{output_extension}}"
78     rspfile = "$outfile.rsp"
79     command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}}"
80     description = "LINK $outfile"
81     rspfile_content = "{{inputs}}"
82     outputs = [
83       outfile,
84     ]
85   }
86
87   tool("stamp") {
88     command = "touch {{output}}"
89     description = "STAMP {{output}}"
90   }
91
92   tool("copy") {
93     command = "cp -af {{source}} {{output}}"
94     description = "COPY {{source}} {{output}}"
95   }
96 }