blob: 334a5e38cd93c7197a457b6dbc32fa7af9f6db2b [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',
brians343bc112013-02-10 01:53:46 +000018 },
19 'conditions': [
Brian Silvermanb3d50542014-04-23 14:28:55 -050020 ['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +000021 'make_global_settings': [
Brian Silvermana67ecc72013-09-28 13:53:53 -070022 ['CC', '<!(readlink -f <(AOS)/build/crio_cc)'],
23 ['CXX', '<!(readlink -f <(AOS)/build/crio_cxx)'],
brians343bc112013-02-10 01:53:46 +000024 ],
brians343bc112013-02-10 01:53:46 +000025 }
Brian Silvermana29ebf92014-04-23 13:08:49 -050026 ], ['PLATFORM=="linux-arm-gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -070027 'make_global_settings': [
28 ['CC', '<!(which arm-linux-gnueabihf-gcc-4.7)'],
29 ['CXX', '<!(which arm-linux-gnueabihf-g++-4.7)'],
30 ],
31 },
Brian Silvermana29ebf92014-04-23 13:08:49 -050032 ], ['PLATFORM=="linux-arm-clang"', {
Brian Silvermana8c04522014-04-27 20:03:08 -070033 'variables': {
34 'arm-clang-symlinks': '<!(realpath -s <(AOS)/build/arm-clang-symlinks)',
35 'arm-clang-sysroot': '<(arm-clang-symlinks)/sysroot',
36 'platflags': [
37 '-target', 'armv7a-linux-gnueabihf',
38 '-mfloat-abi=hard',
Brian Silvermana8c04522014-04-27 20:03:08 -070039 '--sysroot=<(arm-clang-sysroot)',
40
41 #-mhwdiv=arm,thumb
42 ],
43 },
44 'make_global_settings': [
45 ['CC', '<(arm-clang-symlinks)/bin/clang'],
46 ['CXX', '<(arm-clang-symlinks)/bin/clang++'],
47 ],
48 'target_defaults': {
49 'cflags': [
Brian Silvermana8c04522014-04-27 20:03:08 -070050 '<@(platflags)',
51 ],
Brian Silverman34d25f22014-05-01 13:30:56 -070052 'cflags_cc': [
53 '-isystem', '<(arm-clang-sysroot)/usr/include/c++/4.7.2',
54 '-isystem', '<(arm-clang-sysroot)/usr/include/c++/4.7.2/arm-linux-gnueabihf',
55 ],
Brian Silvermana8c04522014-04-27 20:03:08 -070056 'ldflags': [
57 '<@(platflags)',
58 ],
59 },
Brian Silverman79723eb2014-04-21 22:05:11 -070060 },
61 ], ['PLATFORM=="linux-amd64-clang"', {
62 'make_global_settings': [
Brian Silvermandf4adb22014-05-01 17:09:38 -070063 ['CC', '/opt/clang-3.5/bin/clang'],
64 ['CXX', '/opt/clang-3.5/bin/clang++'],
Brian Silverman79723eb2014-04-21 22:05:11 -070065 ],
Brian Silvermanf0d3c782014-05-02 23:56:32 -070066 },
67 ], ['PLATFORM=="linux-amd64-gcc"', {
68 },
69 ], ['SANITIZER!="none"', {
Brian Silvermana4aff562014-05-02 17:43:50 -070070 'target_defaults': {
71 'cflags': [
Brian Silvermanf0d3c782014-05-02 23:56:32 -070072 '-fsanitize=<(SANITIZER)',
Brian Silvermana4aff562014-05-02 17:43:50 -070073 # TODO(brians): Figure out how to blacklist some bits of other
74 # people's code (ie stdlibc++...) and then have it abort on failure.
75 #'-fsanitize=undefined,integer',
Brian Silvermana4aff562014-05-02 17:43:50 -070076 ],
77 'ldflags': [
Brian Silvermanf0d3c782014-05-02 23:56:32 -070078 '-fsanitize=<(SANITIZER)',
Brian Silvermana4aff562014-05-02 17:43:50 -070079 ],
80 },
Brian Silverman79723eb2014-04-21 22:05:11 -070081 },
Brian Silvermanf0d3c782014-05-02 23:56:32 -070082 ], ['SANITIZER_FPIC!=""', {
83 'target_defaults': {
84 'cflags': [
85 '-fPIC',
86 ],
87 'ldflags': [
88 '-fPIC',
89 ],
90 },
91 },
92 ], ['SANITIZER=="memory"', {
93 'target_defaults': {
94 'cflags': [
95 '-fsanitize-memory-track-origins',
96 ],
97 'ldflags': [
98 '-fsanitize-memory-track-origins',
99 ],
100 },
Brian Silverman79723eb2014-04-21 22:05:11 -0700101 },
brians343bc112013-02-10 01:53:46 +0000102 ],
103 ],
104 'target_defaults': {
105 'defines': [
106 '__STDC_FORMAT_MACROS',
107 '_FORTIFY_SOURCE=2',
Brian Silverman6137a502013-04-22 15:41:36 -0700108 '__STDC_CONSTANT_MACROS',
109 '__STDC_LIMIT_MACROS',
brians343bc112013-02-10 01:53:46 +0000110 ],
111 'ldflags': [
112 '-pipe',
113 ],
114 'cflags': [
115 '-pipe',
116
117 '-Wall',
118 '-Wextra',
119 '-Wswitch-enum',
120 '-Wpointer-arith',
121 '-Wstrict-aliasing=2',
122 '-Wcast-qual',
123 '-Wcast-align',
124 '-Wwrite-strings',
125 '-Wtype-limits',
126 '-Wsign-compare',
127 '-Wformat=2',
128 '-Werror',
Brian Silverman9ba2bc42013-03-17 14:18:33 -0700129
130 '-ggdb3',
brians343bc112013-02-10 01:53:46 +0000131 ],
132 'cflags_c': [
133 '-std=gnu99',
134 ],
brians343bc112013-02-10 01:53:46 +0000135 'include_dirs': [
136 '<(DEPTH)',
137 ],
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700138 # These have to be here because apparently gyp evaluates target_conditions
139 # even if the target is never used.
140 'variables': {
141 # Set this to 1 to disable rsyncing the file to the target.
142 'no_rsync%': 0,
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700143 # Set this to 1 if this file is a test that should not be run by
Brian Silvermanb3d50542014-04-23 14:28:55 -0500144 # `build.py tests`.
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700145 'is_special_test%': 0,
146 },
brians343bc112013-02-10 01:53:46 +0000147 'conditions': [
148 ['DEBUG=="yes"', {
Brian Silvermanaac705c2014-05-01 18:55:34 -0700149 'defines': [
150 'AOS_DEBUG=1',
151 ],
brians343bc112013-02-10 01:53:46 +0000152 'cflags': [
brians343bc112013-02-10 01:53:46 +0000153 '-O0',
154 ],
brians343bc112013-02-10 01:53:46 +0000155 }, {
Brian Silvermanaac705c2014-05-01 18:55:34 -0700156 'defines': [
157 'AOS_DEBUG=0',
158 ],
brians343bc112013-02-10 01:53:46 +0000159 'cflags': [
Brian Silvermanc2d8e5a2014-05-01 18:33:12 -0700160 # TODO(brians): add -flto
brians343bc112013-02-10 01:53:46 +0000161 '-O3',
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700162 '-fomit-frame-pointer',
brians343bc112013-02-10 01:53:46 +0000163 ],
Brian Silvermanefb993f2013-08-30 19:52:57 -0700164 'ldflags': [
165 '-O3',
166 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500167 'conditions': [['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000168 'cflags': [
169 '-fstrength-reduce',
170 '-fno-builtin',
171 '-fno-strict-aliasing',
172 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800173 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500174 ['ARCHITECTURE=="arm"', {
brians343bc112013-02-10 01:53:46 +0000175 'cflags': [
Brian Silvermanc4321322013-11-18 17:38:39 -0800176 '-mcpu=cortex-a8',
Brian Silverman46203612013-11-19 18:01:41 -0800177 '-mfpu=neon',
brians343bc112013-02-10 01:53:46 +0000178 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800179 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500180 ['ARCHITECTURE=="amd64"', {
Brian Silverman41abe012014-02-08 18:25:02 -0800181 'cflags': [
Brian Silverman41abe012014-02-08 18:25:02 -0800182 '-fstack-protector-all',
183 ],
184 }],
185 ]
brians343bc112013-02-10 01:53:46 +0000186 }
187 ],
Brian Silverman134e5222014-04-27 20:10:05 -0700188 ['PLATFORM=="linux-arm-gcc" and DEBUG=="yes"', {
189 'cflags': [
190 # GCC doesn't like letting us use r7 (which is also the frame
191 # pointer) to pass the syscall number to the kernel even when
192 # it's marked as clobbered.
193 # See <https://bugzilla.mozilla.org/show_bug.cgi?id=633436> for
194 # some more discussion.
195 '-fomit-frame-pointer',
196 ],
197 }
198 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500199 ['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000200 'target_conditions': [
201 ['_type=="shared_library"', {
202 'ldflags': [
203 '-r',
204 '-nostdlib',
205 '-Wl,-X',
206 ],
207 }
208 ],
209 ],
210 'ldflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700211 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000212 '-mstrict-align',
213 '-mlongcall',
214 ],
215 'cflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700216 # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both
217 # have MPC603e cores according to Freescale docs.
218 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000219 '-mstrict-align',
220 '-mlongcall',
Brian Silverman823f3242013-11-17 13:20:22 -0800221 '-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/',
222 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/',
223 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
224 '-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 +0000225 '-isystem', '<(WIND_BASE)/target/h',
226 '-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
227 ],
Brian Silverman6e206682013-08-31 11:43:35 -0700228 'cflags_cc': [
229 '-std=gnu++0x',
230 ],
brians343bc112013-02-10 01:53:46 +0000231 'defines': [
232 'CPU=PPC603',
233 'TOOL_FAMILY=gnu',
234 'TOOL=gnu',
235 '_WRS_KERNEL',
236 '__PPC__',
237# This tells eigen to not do anything with alignment at all. See
238# <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for
239# details. It really doesn't like to work without this.
240 'EIGEN_DONT_ALIGN',
241# prevent the vxworks system headers from being dumb and #defining min and max
242 'NOMINMAX',
243 ],
244 }, {
brians343bc112013-02-10 01:53:46 +0000245 'target_conditions': [
246# default to putting outputs into rsync_dir
247 ['no_rsync==0 and _type!="static_library"', {
248 'product_dir': '<(rsync_dir)',
249 },
250 ],
251 ['_type=="loadable_module"', {
252 'product_dir': '<(so_dir)',
253 }
254 ],
brians343bc112013-02-10 01:53:46 +0000255 ],
256 'ldflags': [
257 '-pthread',
brians343bc112013-02-10 01:53:46 +0000258 ],
brians343bc112013-02-10 01:53:46 +0000259 'cflags': [
260 '-pthread',
Brian Silverman79723eb2014-04-21 22:05:11 -0700261 '-fno-exceptions',
Brian Silverman6e206682013-08-31 11:43:35 -0700262 ],
263 'cflags_cc': [
264 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000265 ],
266 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700267 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000268 ],
269 'libraries': [
270 '-lm',
271 '-lrt',
272 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700273 'conditions': [
Brian Silvermana29ebf92014-04-23 13:08:49 -0500274 ['COMPILER=="gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700275 'cflags': [
276 '-Wunused-local-typedefs',
277 ],
Brian Silvermanf0d3c782014-05-02 23:56:32 -0700278 'defines': [
279 '__has_feature(n)=0'
280 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700281 },
Brian Silvermana29ebf92014-04-23 13:08:49 -0500282 ], ['COMPILER=="clang"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700283 'cflags': [
284 '-fcolor-diagnostics',
285 ],
286 'defines': [
287 # To work around <http://llvm.org/bugs/show_bug.cgi?id=13530>.
288 '__float128=void',
289 # This tells clang's optimizer the same thing.
290 '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))',
291 ],
292 },
293 ],
294 ],
brians343bc112013-02-10 01:53:46 +0000295 }
296 ]
297 ],
298 },
299}