blob: c45c041b54481db67452fd6a49ebf97af321d707 [file] [log] [blame]
brians343bc112013-02-10 01:53:46 +00001# This file gets passed to gyp with -I so that it gets included everywhere.
2{
3 'variables': {
4 'AOS': '<(DEPTH)/aos',
5# A directory with everything in it ignored from source control.
6 'TMPDIR': '<(DEPTH)/aos/build/temp',
7 'aos_abs': '<!(readlink -f <(DEPTH)/aos)', # for use in non-path contexts
8# the .gyp file that has targets for the various external libraries
9 'EXTERNALS': '<(AOS)/build/externals.gyp',
Brian Silverman14fd0fb2014-01-14 21:42:01 -080010# the directory that gets rsynced to the target
brians343bc112013-02-10 01:53:46 +000011 'rsync_dir': '<(PRODUCT_DIR)/outputs',
12# The directory that loadable_module and shared_library targets get put into
13# There's a target_conditions that puts loadable_modules here and
14# shared_librarys automatically get put here.
15 'so_dir': '<(PRODUCT_DIR)/lib',
16# the directory that executables that depend on <(EXTERNALS):gtest get put into
17 'test_dir': '<(PRODUCT_DIR)/tests',
Brian Silverman79723eb2014-04-21 22:05:11 -070018 'variables': {
19 'conditions': [
20 ['PLATFORM=="linux"', {
21 'compiler': 'gcc',
22 'aos_architecture': 'arm',
23 },
24 ], ['PLATFORM=="linux-amd64-clang"', {
25 'compiler': 'clang',
26 'aos_architecture': 'amd64',
27 },
28 ], ['PLATFORM=="linux-clang"', {
29 'compiler': 'gcc',
30 'aos_architecture': 'arm',
31 },
32 ], ['PLATFORM=="linux-amd64"', {
33 'compiler': 'gcc',
34 'aos_architecture': 'amd64',
35 },
36 ],
37 ],
38 },
39 'aos_architecture%': '<(aos_architecture)',
40 'compiler%': '<(compiler)',
brians343bc112013-02-10 01:53:46 +000041 },
42 'conditions': [
43 ['OS=="crio"', {
44 'make_global_settings': [
Brian Silvermana67ecc72013-09-28 13:53:53 -070045 ['CC', '<!(readlink -f <(AOS)/build/crio_cc)'],
46 ['CXX', '<!(readlink -f <(AOS)/build/crio_cxx)'],
brians343bc112013-02-10 01:53:46 +000047 ],
brians343bc112013-02-10 01:53:46 +000048 }
Brian Silverman79723eb2014-04-21 22:05:11 -070049 ], ['PLATFORM=="linux"', {
50 'make_global_settings': [
51 ['CC', '<!(which arm-linux-gnueabihf-gcc-4.7)'],
52 ['CXX', '<!(which arm-linux-gnueabihf-g++-4.7)'],
53 ],
54 },
55 ], ['PLATFORM=="linux-clang"', {
56 # TODO(brians): Make this one actually work.
57 },
58 ], ['PLATFORM=="linux-amd64-clang"', {
59 'make_global_settings': [
60 ['CC', '<!(which clang)'],
61 ['CXX', '<!(which clang++)'],
62 ],
63 },
64 ], ['PLATFORM=="linux-amd64"', {
65 },
brians343bc112013-02-10 01:53:46 +000066 ],
67 ],
68 'target_defaults': {
69 'defines': [
70 '__STDC_FORMAT_MACROS',
71 '_FORTIFY_SOURCE=2',
Brian Silverman6137a502013-04-22 15:41:36 -070072 '__STDC_CONSTANT_MACROS',
73 '__STDC_LIMIT_MACROS',
brians343bc112013-02-10 01:53:46 +000074 ],
75 'ldflags': [
76 '-pipe',
77 ],
78 'cflags': [
79 '-pipe',
80
81 '-Wall',
82 '-Wextra',
83 '-Wswitch-enum',
84 '-Wpointer-arith',
85 '-Wstrict-aliasing=2',
86 '-Wcast-qual',
87 '-Wcast-align',
88 '-Wwrite-strings',
89 '-Wtype-limits',
90 '-Wsign-compare',
91 '-Wformat=2',
92 '-Werror',
Brian Silverman9ba2bc42013-03-17 14:18:33 -070093
94 '-ggdb3',
brians343bc112013-02-10 01:53:46 +000095 ],
96 'cflags_c': [
97 '-std=gnu99',
98 ],
brians343bc112013-02-10 01:53:46 +000099 'include_dirs': [
100 '<(DEPTH)',
101 ],
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700102 # These have to be here because apparently gyp evaluates target_conditions
103 # even if the target is never used.
104 'variables': {
105 # Set this to 1 to disable rsyncing the file to the target.
106 'no_rsync%': 0,
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700107 # Set this to 1 if this file is a test that should not be run by
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700108 # `build.sh tests`.
109 'is_special_test%': 0,
110 },
brians343bc112013-02-10 01:53:46 +0000111 'conditions': [
112 ['DEBUG=="yes"', {
113 'cflags': [
brians343bc112013-02-10 01:53:46 +0000114 '-O0',
115 ],
brians343bc112013-02-10 01:53:46 +0000116 }, {
117 'cflags': [
118 '-O3',
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700119 '-fomit-frame-pointer',
brians343bc112013-02-10 01:53:46 +0000120 ],
Brian Silvermanefb993f2013-08-30 19:52:57 -0700121 'ldflags': [
122 '-O3',
123 ],
brians343bc112013-02-10 01:53:46 +0000124 'conditions': [['OS=="crio"', {
125 'cflags': [
126 '-fstrength-reduce',
127 '-fno-builtin',
128 '-fno-strict-aliasing',
129 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800130 }],
131 ['PLATFORM=="linux"', {
brians343bc112013-02-10 01:53:46 +0000132 'cflags': [
Brian Silvermanc4321322013-11-18 17:38:39 -0800133 '-mcpu=cortex-a8',
Brian Silverman46203612013-11-19 18:01:41 -0800134 '-mfpu=neon',
brians343bc112013-02-10 01:53:46 +0000135 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800136 }],
137 ['PLATFORM=="linux-amd64"', {
138 'cflags': [
139 '-march=atom',
140 '-mfpmath=sse',
141
142 '-fstack-protector-all',
143 ],
144 }],
145 ]
brians343bc112013-02-10 01:53:46 +0000146 }
147 ],
148 ['OS=="crio"', {
149 'target_conditions': [
150 ['_type=="shared_library"', {
151 'ldflags': [
152 '-r',
153 '-nostdlib',
154 '-Wl,-X',
155 ],
156 }
157 ],
158 ],
159 'ldflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700160 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000161 '-mstrict-align',
162 '-mlongcall',
163 ],
164 'cflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700165 # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both
166 # have MPC603e cores according to Freescale docs.
167 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000168 '-mstrict-align',
169 '-mlongcall',
Brian Silverman823f3242013-11-17 13:20:22 -0800170 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/lib/gcc/powerpc-wrs-vxworks/3.4.4/include/',
171 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/',
172 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
173 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/powerpc-wrs-vxworks/',
brians343bc112013-02-10 01:53:46 +0000174 '-isystem', '<(WIND_BASE)/target/h',
175 '-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
176 ],
Brian Silverman6e206682013-08-31 11:43:35 -0700177 'cflags_cc': [
178 '-std=gnu++0x',
179 ],
brians343bc112013-02-10 01:53:46 +0000180 'defines': [
181 'CPU=PPC603',
182 'TOOL_FAMILY=gnu',
183 'TOOL=gnu',
184 '_WRS_KERNEL',
185 '__PPC__',
186# This tells eigen to not do anything with alignment at all. See
187# <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for
188# details. It really doesn't like to work without this.
189 'EIGEN_DONT_ALIGN',
190# prevent the vxworks system headers from being dumb and #defining min and max
191 'NOMINMAX',
192 ],
193 }, {
brians343bc112013-02-10 01:53:46 +0000194 'target_conditions': [
195# default to putting outputs into rsync_dir
196 ['no_rsync==0 and _type!="static_library"', {
197 'product_dir': '<(rsync_dir)',
198 },
199 ],
200 ['_type=="loadable_module"', {
201 'product_dir': '<(so_dir)',
202 }
203 ],
brians343bc112013-02-10 01:53:46 +0000204 ],
205 'ldflags': [
206 '-pthread',
brians343bc112013-02-10 01:53:46 +0000207 ],
brians343bc112013-02-10 01:53:46 +0000208 'cflags': [
209 '-pthread',
Brian Silverman79723eb2014-04-21 22:05:11 -0700210 '-fno-exceptions',
Brian Silverman6e206682013-08-31 11:43:35 -0700211 ],
212 'cflags_cc': [
213 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000214 ],
215 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700216 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000217 ],
218 'libraries': [
219 '-lm',
220 '-lrt',
221 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700222 'conditions': [
223 ['compiler=="gcc"', {
224 'cflags': [
225 '-Wunused-local-typedefs',
226 ],
227 },
228 ], ['compiler=="clang"', {
229 'cflags': [
230 '-fcolor-diagnostics',
231 ],
232 'defines': [
233 # To work around <http://llvm.org/bugs/show_bug.cgi?id=13530>.
234 '__float128=void',
235 # This tells clang's optimizer the same thing.
236 '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))',
237 ],
238 },
239 ],
240 ],
brians343bc112013-02-10 01:53:46 +0000241 }
242 ]
243 ],
244 },
245}