blob: 517ea6ce5d9d41720eee9b7963aab65fbf36050e [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 Silvermand3fac732014-05-03 16:03:46 -070018
19 'ccache': '<!(which ccache) ',
brians343bc112013-02-10 01:53:46 +000020 },
21 'conditions': [
Brian Silvermanb3d50542014-04-23 14:28:55 -050022 ['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +000023 'make_global_settings': [
Brian Silvermana67ecc72013-09-28 13:53:53 -070024 ['CC', '<!(readlink -f <(AOS)/build/crio_cc)'],
25 ['CXX', '<!(readlink -f <(AOS)/build/crio_cxx)'],
brians343bc112013-02-10 01:53:46 +000026 ],
brians343bc112013-02-10 01:53:46 +000027 }
Brian Silvermana29ebf92014-04-23 13:08:49 -050028 ], ['PLATFORM=="linux-arm-gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -070029 'make_global_settings': [
Brian Silvermand3fac732014-05-03 16:03:46 -070030 ['CC', '<(ccache)<!(which arm-linux-gnueabihf-gcc-4.7)'],
31 ['CXX', '<(ccache)<!(which arm-linux-gnueabihf-g++-4.7)'],
Brian Silverman79723eb2014-04-21 22:05:11 -070032 ],
33 },
Brian Silvermana29ebf92014-04-23 13:08:49 -050034 ], ['PLATFORM=="linux-arm-clang"', {
Brian Silvermana8c04522014-04-27 20:03:08 -070035 'variables': {
36 'arm-clang-symlinks': '<!(realpath -s <(AOS)/build/arm-clang-symlinks)',
37 'arm-clang-sysroot': '<(arm-clang-symlinks)/sysroot',
38 'platflags': [
39 '-target', 'armv7a-linux-gnueabihf',
40 '-mfloat-abi=hard',
Brian Silvermana8c04522014-04-27 20:03:08 -070041 '--sysroot=<(arm-clang-sysroot)',
42
43 #-mhwdiv=arm,thumb
44 ],
45 },
46 'make_global_settings': [
Brian Silvermand3fac732014-05-03 16:03:46 -070047 ['CC', '<(ccache)<(arm-clang-symlinks)/bin/clang'],
48 ['CXX', '<(ccache)<(arm-clang-symlinks)/bin/clang++'],
Brian Silvermana8c04522014-04-27 20:03:08 -070049 ],
50 'target_defaults': {
51 'cflags': [
Brian Silvermana8c04522014-04-27 20:03:08 -070052 '<@(platflags)',
53 ],
Brian Silverman34d25f22014-05-01 13:30:56 -070054 'cflags_cc': [
55 '-isystem', '<(arm-clang-sysroot)/usr/include/c++/4.7.2',
56 '-isystem', '<(arm-clang-sysroot)/usr/include/c++/4.7.2/arm-linux-gnueabihf',
57 ],
Brian Silvermana8c04522014-04-27 20:03:08 -070058 'ldflags': [
59 '<@(platflags)',
60 ],
61 },
Brian Silverman79723eb2014-04-21 22:05:11 -070062 },
63 ], ['PLATFORM=="linux-amd64-clang"', {
64 'make_global_settings': [
Brian Silvermand3fac732014-05-03 16:03:46 -070065 ['CC', '<(ccache)/opt/clang-3.5/bin/clang'],
66 ['CXX', '<(ccache)/opt/clang-3.5/bin/clang++'],
Brian Silverman79723eb2014-04-21 22:05:11 -070067 ],
Brian Silvermanf0d3c782014-05-02 23:56:32 -070068 },
69 ], ['PLATFORM=="linux-amd64-gcc"', {
Brian Silvermand3fac732014-05-03 16:03:46 -070070 'make_global_settings': [
71 ['CC', '<(ccache)<!(which gcc)'],
72 ['CXX', '<(ccache)<!(which g++)'],
73 ],
Brian Silvermanf0d3c782014-05-02 23:56:32 -070074 },
Brian Silverman47cd6f62014-05-03 10:35:52 -070075 ], ['PLATFORM=="linux-amd64-gcc_4.8"', {
76 'make_global_settings': [
Brian Silvermand3fac732014-05-03 16:03:46 -070077 ['CC', '<(ccache)/opt/clang-3.5/bin/gcc'],
78 ['CXX', '<(ccache)/opt/clang-3.5/bin/g++'],
Brian Silverman47cd6f62014-05-03 10:35:52 -070079 ],
80 },
Brian Silvermanf0d3c782014-05-02 23:56:32 -070081 ], ['SANITIZER!="none"', {
Brian Silvermana4aff562014-05-02 17:43:50 -070082 'target_defaults': {
83 'cflags': [
Brian Silvermanf0d3c782014-05-02 23:56:32 -070084 '-fsanitize=<(SANITIZER)',
Brian Silvermana4aff562014-05-02 17:43:50 -070085 # TODO(brians): Figure out how to blacklist some bits of other
86 # people's code (ie stdlibc++...) and then have it abort on failure.
87 #'-fsanitize=undefined,integer',
Brian Silvermana4aff562014-05-02 17:43:50 -070088 ],
89 'ldflags': [
Brian Silvermanf0d3c782014-05-02 23:56:32 -070090 '-fsanitize=<(SANITIZER)',
Brian Silvermana4aff562014-05-02 17:43:50 -070091 ],
92 },
Brian Silverman79723eb2014-04-21 22:05:11 -070093 },
Brian Silvermana5301e32014-05-03 10:51:49 -070094 ], ['SANITIZER_FPIE!=""', {
Brian Silvermanf0d3c782014-05-02 23:56:32 -070095 'target_defaults': {
96 'cflags': [
Brian Silverman47cd6f62014-05-03 10:35:52 -070097 '-fPIE',
Brian Silvermanf0d3c782014-05-02 23:56:32 -070098 ],
99 'ldflags': [
Brian Silverman47cd6f62014-05-03 10:35:52 -0700100 '-fPIE',
Brian Silvermanf0d3c782014-05-02 23:56:32 -0700101 ],
Brian Silverman47cd6f62014-05-03 10:35:52 -0700102 'link_settings': {
103 'ldflags': [
104 '-pie',
105 ],
106 },
Brian Silvermanf0d3c782014-05-02 23:56:32 -0700107 },
108 },
109 ], ['SANITIZER=="memory"', {
110 'target_defaults': {
111 'cflags': [
112 '-fsanitize-memory-track-origins',
113 ],
114 'ldflags': [
115 '-fsanitize-memory-track-origins',
116 ],
117 },
Brian Silverman79723eb2014-04-21 22:05:11 -0700118 },
brians343bc112013-02-10 01:53:46 +0000119 ],
120 ],
121 'target_defaults': {
122 'defines': [
123 '__STDC_FORMAT_MACROS',
124 '_FORTIFY_SOURCE=2',
Brian Silverman6137a502013-04-22 15:41:36 -0700125 '__STDC_CONSTANT_MACROS',
126 '__STDC_LIMIT_MACROS',
brians343bc112013-02-10 01:53:46 +0000127 ],
128 'ldflags': [
129 '-pipe',
130 ],
131 'cflags': [
132 '-pipe',
133
134 '-Wall',
135 '-Wextra',
136 '-Wswitch-enum',
137 '-Wpointer-arith',
138 '-Wstrict-aliasing=2',
139 '-Wcast-qual',
140 '-Wcast-align',
141 '-Wwrite-strings',
142 '-Wtype-limits',
143 '-Wsign-compare',
144 '-Wformat=2',
145 '-Werror',
Brian Silverman9ba2bc42013-03-17 14:18:33 -0700146
147 '-ggdb3',
brians343bc112013-02-10 01:53:46 +0000148 ],
149 'cflags_c': [
150 '-std=gnu99',
151 ],
brians343bc112013-02-10 01:53:46 +0000152 'include_dirs': [
153 '<(DEPTH)',
154 ],
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700155 # These have to be here because apparently gyp evaluates target_conditions
156 # even if the target is never used.
157 'variables': {
158 # Set this to 1 to disable rsyncing the file to the target.
159 'no_rsync%': 0,
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700160 # Set this to 1 if this file is a test that should not be run by
Brian Silvermanb3d50542014-04-23 14:28:55 -0500161 # `build.py tests`.
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700162 'is_special_test%': 0,
163 },
brians343bc112013-02-10 01:53:46 +0000164 'conditions': [
165 ['DEBUG=="yes"', {
Brian Silvermanaac705c2014-05-01 18:55:34 -0700166 'defines': [
167 'AOS_DEBUG=1',
168 ],
Brian Silverman266811f2014-05-03 22:48:04 -0700169 'conditions': [['SANITIZER=="none"', {
170 'cflags': [
171 '-O0',
172 ],
173 }, {
174 'cflags': [
175 '-O1',
176 ],
177 }]],
brians343bc112013-02-10 01:53:46 +0000178 }, {
Brian Silvermanaac705c2014-05-01 18:55:34 -0700179 'defines': [
180 'AOS_DEBUG=0',
181 ],
brians343bc112013-02-10 01:53:46 +0000182 'cflags': [
Brian Silvermanc2d8e5a2014-05-01 18:33:12 -0700183 # TODO(brians): add -flto
brians343bc112013-02-10 01:53:46 +0000184 '-O3',
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700185 '-fomit-frame-pointer',
brians343bc112013-02-10 01:53:46 +0000186 ],
Brian Silvermanefb993f2013-08-30 19:52:57 -0700187 'ldflags': [
188 '-O3',
189 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500190 'conditions': [['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000191 'cflags': [
192 '-fstrength-reduce',
193 '-fno-builtin',
194 '-fno-strict-aliasing',
195 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800196 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500197 ['ARCHITECTURE=="arm"', {
brians343bc112013-02-10 01:53:46 +0000198 'cflags': [
Brian Silvermanc4321322013-11-18 17:38:39 -0800199 '-mcpu=cortex-a8',
Brian Silverman46203612013-11-19 18:01:41 -0800200 '-mfpu=neon',
brians343bc112013-02-10 01:53:46 +0000201 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800202 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500203 ['ARCHITECTURE=="amd64"', {
Brian Silverman41abe012014-02-08 18:25:02 -0800204 'cflags': [
Brian Silverman41abe012014-02-08 18:25:02 -0800205 '-fstack-protector-all',
206 ],
207 }],
208 ]
brians343bc112013-02-10 01:53:46 +0000209 }
210 ],
Brian Silverman47cd6f62014-05-03 10:35:52 -0700211 ['OS=="linux" and ARCHITECTURE=="arm" and COMPILER=="gcc" and DEBUG=="yes"', {
Brian Silverman134e5222014-04-27 20:10:05 -0700212 'cflags': [
213 # GCC doesn't like letting us use r7 (which is also the frame
214 # pointer) to pass the syscall number to the kernel even when
215 # it's marked as clobbered.
216 # See <https://bugzilla.mozilla.org/show_bug.cgi?id=633436> for
217 # some more discussion.
218 '-fomit-frame-pointer',
219 ],
220 }
221 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500222 ['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000223 'target_conditions': [
224 ['_type=="shared_library"', {
225 'ldflags': [
226 '-r',
227 '-nostdlib',
228 '-Wl,-X',
229 ],
230 }
231 ],
232 ],
233 'ldflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700234 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000235 '-mstrict-align',
236 '-mlongcall',
237 ],
238 'cflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700239 # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both
240 # have MPC603e cores according to Freescale docs.
241 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000242 '-mstrict-align',
243 '-mlongcall',
Brian Silverman823f3242013-11-17 13:20:22 -0800244 '-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/',
245 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/',
246 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
247 '-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 +0000248 '-isystem', '<(WIND_BASE)/target/h',
249 '-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
250 ],
Brian Silverman6e206682013-08-31 11:43:35 -0700251 'cflags_cc': [
252 '-std=gnu++0x',
253 ],
brians343bc112013-02-10 01:53:46 +0000254 'defines': [
255 'CPU=PPC603',
256 'TOOL_FAMILY=gnu',
257 'TOOL=gnu',
258 '_WRS_KERNEL',
259 '__PPC__',
260# This tells eigen to not do anything with alignment at all. See
261# <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for
262# details. It really doesn't like to work without this.
263 'EIGEN_DONT_ALIGN',
264# prevent the vxworks system headers from being dumb and #defining min and max
265 'NOMINMAX',
266 ],
267 }, {
brians343bc112013-02-10 01:53:46 +0000268 'target_conditions': [
269# default to putting outputs into rsync_dir
270 ['no_rsync==0 and _type!="static_library"', {
271 'product_dir': '<(rsync_dir)',
272 },
273 ],
274 ['_type=="loadable_module"', {
275 'product_dir': '<(so_dir)',
276 }
277 ],
brians343bc112013-02-10 01:53:46 +0000278 ],
279 'ldflags': [
280 '-pthread',
brians343bc112013-02-10 01:53:46 +0000281 ],
brians343bc112013-02-10 01:53:46 +0000282 'cflags': [
283 '-pthread',
Brian Silverman79723eb2014-04-21 22:05:11 -0700284 '-fno-exceptions',
Brian Silverman6e206682013-08-31 11:43:35 -0700285 ],
286 'cflags_cc': [
287 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000288 ],
289 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700290 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000291 ],
292 'libraries': [
293 '-lm',
294 '-lrt',
295 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700296 'conditions': [
Brian Silvermana29ebf92014-04-23 13:08:49 -0500297 ['COMPILER=="gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700298 'cflags': [
299 '-Wunused-local-typedefs',
300 ],
Brian Silvermanf0d3c782014-05-02 23:56:32 -0700301 'defines': [
302 '__has_feature(n)=0'
303 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700304 },
Brian Silvermana29ebf92014-04-23 13:08:49 -0500305 ], ['COMPILER=="clang"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700306 'cflags': [
307 '-fcolor-diagnostics',
308 ],
309 'defines': [
310 # To work around <http://llvm.org/bugs/show_bug.cgi?id=13530>.
311 '__float128=void',
312 # This tells clang's optimizer the same thing.
313 '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))',
314 ],
315 },
316 ],
317 ],
brians343bc112013-02-10 01:53:46 +0000318 }
319 ]
320 ],
321 },
322}