blob: b0b9ec74134eb6e747956a436f0c0057932e02a2 [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 ],
brians343bc112013-02-10 01:53:46 +0000169 'cflags': [
brians343bc112013-02-10 01:53:46 +0000170 '-O0',
171 ],
brians343bc112013-02-10 01:53:46 +0000172 }, {
Brian Silvermanaac705c2014-05-01 18:55:34 -0700173 'defines': [
174 'AOS_DEBUG=0',
175 ],
brians343bc112013-02-10 01:53:46 +0000176 'cflags': [
Brian Silvermanc2d8e5a2014-05-01 18:33:12 -0700177 # TODO(brians): add -flto
brians343bc112013-02-10 01:53:46 +0000178 '-O3',
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700179 '-fomit-frame-pointer',
brians343bc112013-02-10 01:53:46 +0000180 ],
Brian Silvermanefb993f2013-08-30 19:52:57 -0700181 'ldflags': [
182 '-O3',
183 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500184 'conditions': [['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000185 'cflags': [
186 '-fstrength-reduce',
187 '-fno-builtin',
188 '-fno-strict-aliasing',
189 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800190 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500191 ['ARCHITECTURE=="arm"', {
brians343bc112013-02-10 01:53:46 +0000192 'cflags': [
Brian Silvermanc4321322013-11-18 17:38:39 -0800193 '-mcpu=cortex-a8',
Brian Silverman46203612013-11-19 18:01:41 -0800194 '-mfpu=neon',
brians343bc112013-02-10 01:53:46 +0000195 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800196 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500197 ['ARCHITECTURE=="amd64"', {
Brian Silverman41abe012014-02-08 18:25:02 -0800198 'cflags': [
Brian Silverman41abe012014-02-08 18:25:02 -0800199 '-fstack-protector-all',
200 ],
201 }],
202 ]
brians343bc112013-02-10 01:53:46 +0000203 }
204 ],
Brian Silverman47cd6f62014-05-03 10:35:52 -0700205 ['OS=="linux" and ARCHITECTURE=="arm" and COMPILER=="gcc" and DEBUG=="yes"', {
Brian Silverman134e5222014-04-27 20:10:05 -0700206 'cflags': [
207 # GCC doesn't like letting us use r7 (which is also the frame
208 # pointer) to pass the syscall number to the kernel even when
209 # it's marked as clobbered.
210 # See <https://bugzilla.mozilla.org/show_bug.cgi?id=633436> for
211 # some more discussion.
212 '-fomit-frame-pointer',
213 ],
214 }
215 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500216 ['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000217 'target_conditions': [
218 ['_type=="shared_library"', {
219 'ldflags': [
220 '-r',
221 '-nostdlib',
222 '-Wl,-X',
223 ],
224 }
225 ],
226 ],
227 'ldflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700228 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000229 '-mstrict-align',
230 '-mlongcall',
231 ],
232 'cflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700233 # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both
234 # have MPC603e cores according to Freescale docs.
235 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000236 '-mstrict-align',
237 '-mlongcall',
Brian Silverman823f3242013-11-17 13:20:22 -0800238 '-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/',
239 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/',
240 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
241 '-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 +0000242 '-isystem', '<(WIND_BASE)/target/h',
243 '-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
244 ],
Brian Silverman6e206682013-08-31 11:43:35 -0700245 'cflags_cc': [
246 '-std=gnu++0x',
247 ],
brians343bc112013-02-10 01:53:46 +0000248 'defines': [
249 'CPU=PPC603',
250 'TOOL_FAMILY=gnu',
251 'TOOL=gnu',
252 '_WRS_KERNEL',
253 '__PPC__',
254# This tells eigen to not do anything with alignment at all. See
255# <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for
256# details. It really doesn't like to work without this.
257 'EIGEN_DONT_ALIGN',
258# prevent the vxworks system headers from being dumb and #defining min and max
259 'NOMINMAX',
260 ],
261 }, {
brians343bc112013-02-10 01:53:46 +0000262 'target_conditions': [
263# default to putting outputs into rsync_dir
264 ['no_rsync==0 and _type!="static_library"', {
265 'product_dir': '<(rsync_dir)',
266 },
267 ],
268 ['_type=="loadable_module"', {
269 'product_dir': '<(so_dir)',
270 }
271 ],
brians343bc112013-02-10 01:53:46 +0000272 ],
273 'ldflags': [
274 '-pthread',
brians343bc112013-02-10 01:53:46 +0000275 ],
brians343bc112013-02-10 01:53:46 +0000276 'cflags': [
277 '-pthread',
Brian Silverman79723eb2014-04-21 22:05:11 -0700278 '-fno-exceptions',
Brian Silverman6e206682013-08-31 11:43:35 -0700279 ],
280 'cflags_cc': [
281 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000282 ],
283 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700284 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000285 ],
286 'libraries': [
287 '-lm',
288 '-lrt',
289 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700290 'conditions': [
Brian Silvermana29ebf92014-04-23 13:08:49 -0500291 ['COMPILER=="gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700292 'cflags': [
293 '-Wunused-local-typedefs',
294 ],
Brian Silvermanf0d3c782014-05-02 23:56:32 -0700295 'defines': [
296 '__has_feature(n)=0'
297 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700298 },
Brian Silvermana29ebf92014-04-23 13:08:49 -0500299 ], ['COMPILER=="clang"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700300 'cflags': [
301 '-fcolor-diagnostics',
302 ],
303 'defines': [
304 # To work around <http://llvm.org/bugs/show_bug.cgi?id=13530>.
305 '__float128=void',
306 # This tells clang's optimizer the same thing.
307 '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))',
308 ],
309 },
310 ],
311 ],
brians343bc112013-02-10 01:53:46 +0000312 }
313 ]
314 ],
315 },
316}