blob: acc525c05cda28be9f6dbf3680ef597f67d82a6f [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 },
Brian Silverman47cd6f62014-05-03 10:35:52 -070069 ], ['PLATFORM=="linux-amd64-gcc_4.8"', {
70 'make_global_settings': [
71 ['CC', '/opt/clang-3.5/bin/gcc'],
72 ['CXX', '/opt/clang-3.5/bin/g++'],
73 ],
74 },
Brian Silvermanf0d3c782014-05-02 23:56:32 -070075 ], ['SANITIZER!="none"', {
Brian Silvermana4aff562014-05-02 17:43:50 -070076 'target_defaults': {
77 'cflags': [
Brian Silvermanf0d3c782014-05-02 23:56:32 -070078 '-fsanitize=<(SANITIZER)',
Brian Silvermana4aff562014-05-02 17:43:50 -070079 # TODO(brians): Figure out how to blacklist some bits of other
80 # people's code (ie stdlibc++...) and then have it abort on failure.
81 #'-fsanitize=undefined,integer',
Brian Silvermana4aff562014-05-02 17:43:50 -070082 ],
83 'ldflags': [
Brian Silvermanf0d3c782014-05-02 23:56:32 -070084 '-fsanitize=<(SANITIZER)',
Brian Silvermana4aff562014-05-02 17:43:50 -070085 ],
86 },
Brian Silverman79723eb2014-04-21 22:05:11 -070087 },
Brian Silvermanf0d3c782014-05-02 23:56:32 -070088 ], ['SANITIZER_FPIC!=""', {
89 'target_defaults': {
90 'cflags': [
Brian Silverman47cd6f62014-05-03 10:35:52 -070091 '-fPIE',
Brian Silvermanf0d3c782014-05-02 23:56:32 -070092 ],
93 'ldflags': [
Brian Silverman47cd6f62014-05-03 10:35:52 -070094 '-fPIE',
Brian Silvermanf0d3c782014-05-02 23:56:32 -070095 ],
Brian Silverman47cd6f62014-05-03 10:35:52 -070096 'link_settings': {
97 'ldflags': [
98 '-pie',
99 ],
100 },
Brian Silvermanf0d3c782014-05-02 23:56:32 -0700101 },
102 },
103 ], ['SANITIZER=="memory"', {
104 'target_defaults': {
105 'cflags': [
106 '-fsanitize-memory-track-origins',
107 ],
108 'ldflags': [
109 '-fsanitize-memory-track-origins',
110 ],
111 },
Brian Silverman79723eb2014-04-21 22:05:11 -0700112 },
brians343bc112013-02-10 01:53:46 +0000113 ],
114 ],
115 'target_defaults': {
116 'defines': [
117 '__STDC_FORMAT_MACROS',
118 '_FORTIFY_SOURCE=2',
Brian Silverman6137a502013-04-22 15:41:36 -0700119 '__STDC_CONSTANT_MACROS',
120 '__STDC_LIMIT_MACROS',
brians343bc112013-02-10 01:53:46 +0000121 ],
122 'ldflags': [
123 '-pipe',
124 ],
125 'cflags': [
126 '-pipe',
127
128 '-Wall',
129 '-Wextra',
130 '-Wswitch-enum',
131 '-Wpointer-arith',
132 '-Wstrict-aliasing=2',
133 '-Wcast-qual',
134 '-Wcast-align',
135 '-Wwrite-strings',
136 '-Wtype-limits',
137 '-Wsign-compare',
138 '-Wformat=2',
139 '-Werror',
Brian Silverman9ba2bc42013-03-17 14:18:33 -0700140
141 '-ggdb3',
brians343bc112013-02-10 01:53:46 +0000142 ],
143 'cflags_c': [
144 '-std=gnu99',
145 ],
brians343bc112013-02-10 01:53:46 +0000146 'include_dirs': [
147 '<(DEPTH)',
148 ],
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700149 # These have to be here because apparently gyp evaluates target_conditions
150 # even if the target is never used.
151 'variables': {
152 # Set this to 1 to disable rsyncing the file to the target.
153 'no_rsync%': 0,
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700154 # Set this to 1 if this file is a test that should not be run by
Brian Silvermanb3d50542014-04-23 14:28:55 -0500155 # `build.py tests`.
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700156 'is_special_test%': 0,
157 },
brians343bc112013-02-10 01:53:46 +0000158 'conditions': [
159 ['DEBUG=="yes"', {
Brian Silvermanaac705c2014-05-01 18:55:34 -0700160 'defines': [
161 'AOS_DEBUG=1',
162 ],
brians343bc112013-02-10 01:53:46 +0000163 'cflags': [
brians343bc112013-02-10 01:53:46 +0000164 '-O0',
165 ],
brians343bc112013-02-10 01:53:46 +0000166 }, {
Brian Silvermanaac705c2014-05-01 18:55:34 -0700167 'defines': [
168 'AOS_DEBUG=0',
169 ],
brians343bc112013-02-10 01:53:46 +0000170 'cflags': [
Brian Silvermanc2d8e5a2014-05-01 18:33:12 -0700171 # TODO(brians): add -flto
brians343bc112013-02-10 01:53:46 +0000172 '-O3',
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700173 '-fomit-frame-pointer',
brians343bc112013-02-10 01:53:46 +0000174 ],
Brian Silvermanefb993f2013-08-30 19:52:57 -0700175 'ldflags': [
176 '-O3',
177 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500178 'conditions': [['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000179 'cflags': [
180 '-fstrength-reduce',
181 '-fno-builtin',
182 '-fno-strict-aliasing',
183 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800184 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500185 ['ARCHITECTURE=="arm"', {
brians343bc112013-02-10 01:53:46 +0000186 'cflags': [
Brian Silvermanc4321322013-11-18 17:38:39 -0800187 '-mcpu=cortex-a8',
Brian Silverman46203612013-11-19 18:01:41 -0800188 '-mfpu=neon',
brians343bc112013-02-10 01:53:46 +0000189 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800190 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500191 ['ARCHITECTURE=="amd64"', {
Brian Silverman41abe012014-02-08 18:25:02 -0800192 'cflags': [
Brian Silverman41abe012014-02-08 18:25:02 -0800193 '-fstack-protector-all',
194 ],
195 }],
196 ]
brians343bc112013-02-10 01:53:46 +0000197 }
198 ],
Brian Silverman47cd6f62014-05-03 10:35:52 -0700199 ['OS=="linux" and ARCHITECTURE=="arm" and COMPILER=="gcc" and DEBUG=="yes"', {
Brian Silverman134e5222014-04-27 20:10:05 -0700200 'cflags': [
201 # GCC doesn't like letting us use r7 (which is also the frame
202 # pointer) to pass the syscall number to the kernel even when
203 # it's marked as clobbered.
204 # See <https://bugzilla.mozilla.org/show_bug.cgi?id=633436> for
205 # some more discussion.
206 '-fomit-frame-pointer',
207 ],
208 }
209 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500210 ['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000211 'target_conditions': [
212 ['_type=="shared_library"', {
213 'ldflags': [
214 '-r',
215 '-nostdlib',
216 '-Wl,-X',
217 ],
218 }
219 ],
220 ],
221 'ldflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700222 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000223 '-mstrict-align',
224 '-mlongcall',
225 ],
226 'cflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700227 # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both
228 # have MPC603e cores according to Freescale docs.
229 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000230 '-mstrict-align',
231 '-mlongcall',
Brian Silverman823f3242013-11-17 13:20:22 -0800232 '-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/',
233 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/',
234 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
235 '-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 +0000236 '-isystem', '<(WIND_BASE)/target/h',
237 '-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
238 ],
Brian Silverman6e206682013-08-31 11:43:35 -0700239 'cflags_cc': [
240 '-std=gnu++0x',
241 ],
brians343bc112013-02-10 01:53:46 +0000242 'defines': [
243 'CPU=PPC603',
244 'TOOL_FAMILY=gnu',
245 'TOOL=gnu',
246 '_WRS_KERNEL',
247 '__PPC__',
248# This tells eigen to not do anything with alignment at all. See
249# <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for
250# details. It really doesn't like to work without this.
251 'EIGEN_DONT_ALIGN',
252# prevent the vxworks system headers from being dumb and #defining min and max
253 'NOMINMAX',
254 ],
255 }, {
brians343bc112013-02-10 01:53:46 +0000256 'target_conditions': [
257# default to putting outputs into rsync_dir
258 ['no_rsync==0 and _type!="static_library"', {
259 'product_dir': '<(rsync_dir)',
260 },
261 ],
262 ['_type=="loadable_module"', {
263 'product_dir': '<(so_dir)',
264 }
265 ],
brians343bc112013-02-10 01:53:46 +0000266 ],
267 'ldflags': [
268 '-pthread',
brians343bc112013-02-10 01:53:46 +0000269 ],
brians343bc112013-02-10 01:53:46 +0000270 'cflags': [
271 '-pthread',
Brian Silverman79723eb2014-04-21 22:05:11 -0700272 '-fno-exceptions',
Brian Silverman6e206682013-08-31 11:43:35 -0700273 ],
274 'cflags_cc': [
275 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000276 ],
277 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700278 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000279 ],
280 'libraries': [
281 '-lm',
282 '-lrt',
283 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700284 'conditions': [
Brian Silvermana29ebf92014-04-23 13:08:49 -0500285 ['COMPILER=="gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700286 'cflags': [
287 '-Wunused-local-typedefs',
288 ],
Brian Silvermanf0d3c782014-05-02 23:56:32 -0700289 'defines': [
290 '__has_feature(n)=0'
291 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700292 },
Brian Silvermana29ebf92014-04-23 13:08:49 -0500293 ], ['COMPILER=="clang"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700294 'cflags': [
295 '-fcolor-diagnostics',
296 ],
297 'defines': [
298 # To work around <http://llvm.org/bugs/show_bug.cgi?id=13530>.
299 '__float128=void',
300 # This tells clang's optimizer the same thing.
301 '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))',
302 ],
303 },
304 ],
305 ],
brians343bc112013-02-10 01:53:46 +0000306 }
307 ]
308 ],
309 },
310}