Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / tools / gn / example / build / toolchain / BUILD.gn
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 toolchain("gcc") {
6   tool("cc") {
7     depfile = "{{output}}.d"
8     command = "gcc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
9     depsformat = "gcc"
10     description = "CC {{output}}"
11     outputs = [
12       "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
13     ]
14   }
15
16   tool("cxx") {
17     depfile = "{{output}}.d"
18     command = "g++ -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
19     depsformat = "gcc"
20     description = "CXX {{output}}"
21     outputs = [
22       "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
23     ]
24   }
25
26   tool("alink") {
27     rspfile = "{{output}}.rsp"
28     command = "rm -f {{output}} && ar rcs {{output}} @$rspfile"
29     description = "AR {{target_output_name}}{{output_extension}}"
30     rspfile_content = "{{inputs}}"
31     outputs = [
32       "{{target_out_dir}}/{{target_output_name}}{{output_extension}}"
33     ]
34     default_output_extension = ".a"
35     output_prefix = "lib"
36   }
37
38   tool("solink") {
39     soname = "{{target_output_name}}{{output_extension}}"  # e.g. "libfoo.so".
40     rspfile = soname + ".rsp"
41
42     command = "g++ -shared {{ldflags}} -o $soname -Wl,-soname=$soname @$rspfile"
43     rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}"
44
45     description = "SOLINK $soname"
46
47     # Use this for {{output_extension}} expansions unless a target manually
48     # overrides it (in which case {{output_extension}} will be what the target
49     # specifies).
50     default_output_extension = ".so"
51
52     outputs = [
53       soname,
54     ]
55     link_output = soname
56     depend_output = soname
57     output_prefix = "lib"
58   }
59
60   tool("link") {
61     outfile = "{{target_output_name}}{{output_extension}}"
62     rspfile = "$outfile.rsp"
63     command = "g++ {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}}"
64     description = "LINK $outfile"
65     rspfile_content = "{{inputs}}"
66     outputs = [ outfile ]
67   }
68
69   tool("stamp") {
70     command = "touch {{output}}"
71     description = "STAMP {{output}}"
72   }
73
74   tool("copy") {
75     command = "cp -af {{source}} {{output}}"
76     description = "COPY {{source}} {{output}}"
77   }
78 }