blob: 917a8ca7cfbea24f6d314d40bf8b8c783e48a2be [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 Silvermana4aff562014-05-02 17:43:50 -070066 'target_defaults': {
67 'cflags': [
68 # TODO(brians): Always build with this in debug mode?
69 #'-fsanitize=address',
70
71 # TODO(brians): Figure out how to blacklist some bits of other
72 # people's code (ie stdlibc++...) and then have it abort on failure.
73 #'-fsanitize=undefined,integer',
74
75 # TODO(brians): Try and figure out how to get these 2 to work (it
76 # looks like they force using shared libraries which means building
77 # everything with -fPIC).
78 #'-fsanitize=memory',
79 #'-fsanitize=thread',
80 ],
81 'ldflags': [
82 #'-fsanitize=thread',
83 ],
84 },
Brian Silverman79723eb2014-04-21 22:05:11 -070085 },
Brian Silvermana29ebf92014-04-23 13:08:49 -050086 ], ['PLATFORM=="linux-amd64-gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -070087 },
brians343bc112013-02-10 01:53:46 +000088 ],
89 ],
90 'target_defaults': {
91 'defines': [
92 '__STDC_FORMAT_MACROS',
93 '_FORTIFY_SOURCE=2',
Brian Silverman6137a502013-04-22 15:41:36 -070094 '__STDC_CONSTANT_MACROS',
95 '__STDC_LIMIT_MACROS',
brians343bc112013-02-10 01:53:46 +000096 ],
97 'ldflags': [
98 '-pipe',
99 ],
100 'cflags': [
101 '-pipe',
102
103 '-Wall',
104 '-Wextra',
105 '-Wswitch-enum',
106 '-Wpointer-arith',
107 '-Wstrict-aliasing=2',
108 '-Wcast-qual',
109 '-Wcast-align',
110 '-Wwrite-strings',
111 '-Wtype-limits',
112 '-Wsign-compare',
113 '-Wformat=2',
114 '-Werror',
Brian Silverman9ba2bc42013-03-17 14:18:33 -0700115
116 '-ggdb3',
brians343bc112013-02-10 01:53:46 +0000117 ],
118 'cflags_c': [
119 '-std=gnu99',
120 ],
brians343bc112013-02-10 01:53:46 +0000121 'include_dirs': [
122 '<(DEPTH)',
123 ],
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700124 # These have to be here because apparently gyp evaluates target_conditions
125 # even if the target is never used.
126 'variables': {
127 # Set this to 1 to disable rsyncing the file to the target.
128 'no_rsync%': 0,
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700129 # Set this to 1 if this file is a test that should not be run by
Brian Silvermanb3d50542014-04-23 14:28:55 -0500130 # `build.py tests`.
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700131 'is_special_test%': 0,
132 },
brians343bc112013-02-10 01:53:46 +0000133 'conditions': [
134 ['DEBUG=="yes"', {
Brian Silvermanaac705c2014-05-01 18:55:34 -0700135 'defines': [
136 'AOS_DEBUG=1',
137 ],
brians343bc112013-02-10 01:53:46 +0000138 'cflags': [
brians343bc112013-02-10 01:53:46 +0000139 '-O0',
140 ],
brians343bc112013-02-10 01:53:46 +0000141 }, {
Brian Silvermanaac705c2014-05-01 18:55:34 -0700142 'defines': [
143 'AOS_DEBUG=0',
144 ],
brians343bc112013-02-10 01:53:46 +0000145 'cflags': [
Brian Silvermanc2d8e5a2014-05-01 18:33:12 -0700146 # TODO(brians): add -flto
brians343bc112013-02-10 01:53:46 +0000147 '-O3',
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700148 '-fomit-frame-pointer',
brians343bc112013-02-10 01:53:46 +0000149 ],
Brian Silvermanefb993f2013-08-30 19:52:57 -0700150 'ldflags': [
151 '-O3',
152 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500153 'conditions': [['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000154 'cflags': [
155 '-fstrength-reduce',
156 '-fno-builtin',
157 '-fno-strict-aliasing',
158 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800159 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500160 ['ARCHITECTURE=="arm"', {
brians343bc112013-02-10 01:53:46 +0000161 'cflags': [
Brian Silvermanc4321322013-11-18 17:38:39 -0800162 '-mcpu=cortex-a8',
Brian Silverman46203612013-11-19 18:01:41 -0800163 '-mfpu=neon',
brians343bc112013-02-10 01:53:46 +0000164 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800165 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500166 ['ARCHITECTURE=="amd64"', {
Brian Silverman41abe012014-02-08 18:25:02 -0800167 'cflags': [
Brian Silverman41abe012014-02-08 18:25:02 -0800168 '-fstack-protector-all',
169 ],
170 }],
171 ]
brians343bc112013-02-10 01:53:46 +0000172 }
173 ],
Brian Silverman134e5222014-04-27 20:10:05 -0700174 ['PLATFORM=="linux-arm-gcc" and DEBUG=="yes"', {
175 'cflags': [
176 # GCC doesn't like letting us use r7 (which is also the frame
177 # pointer) to pass the syscall number to the kernel even when
178 # it's marked as clobbered.
179 # See <https://bugzilla.mozilla.org/show_bug.cgi?id=633436> for
180 # some more discussion.
181 '-fomit-frame-pointer',
182 ],
183 }
184 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500185 ['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000186 'target_conditions': [
187 ['_type=="shared_library"', {
188 'ldflags': [
189 '-r',
190 '-nostdlib',
191 '-Wl,-X',
192 ],
193 }
194 ],
195 ],
196 'ldflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700197 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000198 '-mstrict-align',
199 '-mlongcall',
200 ],
201 'cflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700202 # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both
203 # have MPC603e cores according to Freescale docs.
204 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000205 '-mstrict-align',
206 '-mlongcall',
Brian Silverman823f3242013-11-17 13:20:22 -0800207 '-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/',
208 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/',
209 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
210 '-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 +0000211 '-isystem', '<(WIND_BASE)/target/h',
212 '-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
213 ],
Brian Silverman6e206682013-08-31 11:43:35 -0700214 'cflags_cc': [
215 '-std=gnu++0x',
216 ],
brians343bc112013-02-10 01:53:46 +0000217 'defines': [
218 'CPU=PPC603',
219 'TOOL_FAMILY=gnu',
220 'TOOL=gnu',
221 '_WRS_KERNEL',
222 '__PPC__',
223# This tells eigen to not do anything with alignment at all. See
224# <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for
225# details. It really doesn't like to work without this.
226 'EIGEN_DONT_ALIGN',
227# prevent the vxworks system headers from being dumb and #defining min and max
228 'NOMINMAX',
229 ],
230 }, {
brians343bc112013-02-10 01:53:46 +0000231 'target_conditions': [
232# default to putting outputs into rsync_dir
233 ['no_rsync==0 and _type!="static_library"', {
234 'product_dir': '<(rsync_dir)',
235 },
236 ],
237 ['_type=="loadable_module"', {
238 'product_dir': '<(so_dir)',
239 }
240 ],
brians343bc112013-02-10 01:53:46 +0000241 ],
242 'ldflags': [
243 '-pthread',
brians343bc112013-02-10 01:53:46 +0000244 ],
brians343bc112013-02-10 01:53:46 +0000245 'cflags': [
246 '-pthread',
Brian Silverman79723eb2014-04-21 22:05:11 -0700247 '-fno-exceptions',
Brian Silverman6e206682013-08-31 11:43:35 -0700248 ],
249 'cflags_cc': [
250 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000251 ],
252 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700253 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000254 ],
255 'libraries': [
256 '-lm',
257 '-lrt',
258 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700259 'conditions': [
Brian Silvermana29ebf92014-04-23 13:08:49 -0500260 ['COMPILER=="gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700261 'cflags': [
262 '-Wunused-local-typedefs',
263 ],
264 },
Brian Silvermana29ebf92014-04-23 13:08:49 -0500265 ], ['COMPILER=="clang"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700266 'cflags': [
267 '-fcolor-diagnostics',
268 ],
269 'defines': [
270 # To work around <http://llvm.org/bugs/show_bug.cgi?id=13530>.
271 '__float128=void',
272 # This tells clang's optimizer the same thing.
273 '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))',
274 ],
275 },
276 ],
277 ],
brians343bc112013-02-10 01:53:46 +0000278 }
279 ]
280 ],
281 },
282}