blob: 20df99ba27cf24f421facc2e335eab83c8ae439a [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
Brian Silvermane6bada62014-05-04 16:16:54 -07008# The .gyp file that has targets for the various external libraries.
brians343bc112013-02-10 01:53:46 +00009 'EXTERNALS': '<(AOS)/build/externals.gyp',
Brian Silvermane6bada62014-05-04 16:16:54 -070010# The directory that gets rsynced to the target.
brians343bc112013-02-10 01:53:46 +000011 'rsync_dir': '<(PRODUCT_DIR)/outputs',
Brian Silvermane6bada62014-05-04 16:16:54 -070012# The directory that executables that depend on <(EXTERNALS):gtest get put into.
brians343bc112013-02-10 01:53:46 +000013 'test_dir': '<(PRODUCT_DIR)/tests',
Brian Silvermand3fac732014-05-03 16:03:46 -070014
Brian Silvermane6bada62014-05-04 16:16:54 -070015# Stuck into a variable (with a space on the end) to make disabling it easy.
Brian Silvermand3fac732014-05-03 16:03:46 -070016 'ccache': '<!(which ccache) ',
brians343bc112013-02-10 01:53:46 +000017 },
18 'conditions': [
Brian Silvermanb3d50542014-04-23 14:28:55 -050019 ['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +000020 'make_global_settings': [
Brian Silvermana67ecc72013-09-28 13:53:53 -070021 ['CC', '<!(readlink -f <(AOS)/build/crio_cc)'],
22 ['CXX', '<!(readlink -f <(AOS)/build/crio_cxx)'],
brians343bc112013-02-10 01:53:46 +000023 ],
brians343bc112013-02-10 01:53:46 +000024 }
Brian Silvermana29ebf92014-04-23 13:08:49 -050025 ], ['PLATFORM=="linux-arm-gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -070026 'make_global_settings': [
Brian Silvermand3fac732014-05-03 16:03:46 -070027 ['CC', '<(ccache)<!(which arm-linux-gnueabihf-gcc-4.7)'],
28 ['CXX', '<(ccache)<!(which arm-linux-gnueabihf-g++-4.7)'],
Brian Silverman79723eb2014-04-21 22:05:11 -070029 ],
30 },
Brian Silvermana29ebf92014-04-23 13:08:49 -050031 ], ['PLATFORM=="linux-arm-clang"', {
Brian Silvermana8c04522014-04-27 20:03:08 -070032 'variables': {
33 'arm-clang-symlinks': '<!(realpath -s <(AOS)/build/arm-clang-symlinks)',
34 'arm-clang-sysroot': '<(arm-clang-symlinks)/sysroot',
Brian Silvermane6bada62014-05-04 16:16:54 -070035# Flags that should be passed to all compile/link/etc commands.
Brian Silvermana8c04522014-04-27 20:03:08 -070036 'platflags': [
37 '-target', 'armv7a-linux-gnueabihf',
38 '-mfloat-abi=hard',
Brian Silvermana8c04522014-04-27 20:03:08 -070039 '--sysroot=<(arm-clang-sysroot)',
40
Brian Silvermane6bada62014-05-04 16:16:54 -070041 # TODO(brians): See if it will run with this enabled.
Brian Silvermana8c04522014-04-27 20:03:08 -070042 #-mhwdiv=arm,thumb
43 ],
44 },
45 'make_global_settings': [
Brian Silvermand3fac732014-05-03 16:03:46 -070046 ['CC', '<(ccache)<(arm-clang-symlinks)/bin/clang'],
47 ['CXX', '<(ccache)<(arm-clang-symlinks)/bin/clang++'],
Brian Silvermana8c04522014-04-27 20:03:08 -070048 ],
49 'target_defaults': {
50 'cflags': [
Brian Silvermana8c04522014-04-27 20:03:08 -070051 '<@(platflags)',
52 ],
Brian Silverman34d25f22014-05-01 13:30:56 -070053 'cflags_cc': [
54 '-isystem', '<(arm-clang-sysroot)/usr/include/c++/4.7.2',
55 '-isystem', '<(arm-clang-sysroot)/usr/include/c++/4.7.2/arm-linux-gnueabihf',
56 ],
Brian Silvermana8c04522014-04-27 20:03:08 -070057 'ldflags': [
58 '<@(platflags)',
59 ],
60 },
Brian Silverman79723eb2014-04-21 22:05:11 -070061 },
62 ], ['PLATFORM=="linux-amd64-clang"', {
63 'make_global_settings': [
Brian Silvermand3fac732014-05-03 16:03:46 -070064 ['CC', '<(ccache)/opt/clang-3.5/bin/clang'],
65 ['CXX', '<(ccache)/opt/clang-3.5/bin/clang++'],
Brian Silverman79723eb2014-04-21 22:05:11 -070066 ],
Brian Silvermanf0d3c782014-05-02 23:56:32 -070067 },
68 ], ['PLATFORM=="linux-amd64-gcc"', {
Brian Silvermand3fac732014-05-03 16:03:46 -070069 'make_global_settings': [
Brian Silverman9b7a6842014-05-05 16:19:11 -070070 ['CC', '<(ccache)<!(which gcc-4.7)'],
71 ['CXX', '<(ccache)<!(which g++-4.7)'],
Brian Silvermand3fac732014-05-03 16:03:46 -070072 ],
Brian Silvermanf0d3c782014-05-02 23:56:32 -070073 },
Brian Silverman47cd6f62014-05-03 10:35:52 -070074 ], ['PLATFORM=="linux-amd64-gcc_4.8"', {
75 'make_global_settings': [
Brian Silvermand3fac732014-05-03 16:03:46 -070076 ['CC', '<(ccache)/opt/clang-3.5/bin/gcc'],
77 ['CXX', '<(ccache)/opt/clang-3.5/bin/g++'],
Brian Silverman47cd6f62014-05-03 10:35:52 -070078 ],
79 },
Brian Silvermanf0d3c782014-05-02 23:56:32 -070080 ], ['SANITIZER!="none"', {
Brian Silvermana4aff562014-05-02 17:43:50 -070081 'target_defaults': {
82 'cflags': [
Brian Silvermanf0d3c782014-05-02 23:56:32 -070083 '-fsanitize=<(SANITIZER)',
Brian Silvermana4aff562014-05-02 17:43:50 -070084 # TODO(brians): Figure out how to blacklist some bits of other
85 # people's code (ie stdlibc++...) and then have it abort on failure.
86 #'-fsanitize=undefined,integer',
Brian Silvermana4aff562014-05-02 17:43:50 -070087 ],
88 'ldflags': [
Brian Silvermanf0d3c782014-05-02 23:56:32 -070089 '-fsanitize=<(SANITIZER)',
Brian Silvermana4aff562014-05-02 17:43:50 -070090 ],
91 },
Brian Silverman79723eb2014-04-21 22:05:11 -070092 },
Brian Silvermana5301e32014-05-03 10:51:49 -070093 ], ['SANITIZER_FPIE!=""', {
Brian Silvermanf0d3c782014-05-02 23:56:32 -070094 'target_defaults': {
95 'cflags': [
Brian Silverman47cd6f62014-05-03 10:35:52 -070096 '-fPIE',
Brian Silvermanf0d3c782014-05-02 23:56:32 -070097 ],
98 'ldflags': [
Brian Silverman47cd6f62014-05-03 10:35:52 -070099 '-fPIE',
Brian Silvermanf0d3c782014-05-02 23:56:32 -0700100 ],
Brian Silverman47cd6f62014-05-03 10:35:52 -0700101 'link_settings': {
102 'ldflags': [
103 '-pie',
104 ],
105 },
Brian Silvermanf0d3c782014-05-02 23:56:32 -0700106 },
107 },
108 ], ['SANITIZER=="memory"', {
109 'target_defaults': {
110 'cflags': [
111 '-fsanitize-memory-track-origins',
112 ],
113 'ldflags': [
114 '-fsanitize-memory-track-origins',
115 ],
116 },
Brian Silverman79723eb2014-04-21 22:05:11 -0700117 },
brians343bc112013-02-10 01:53:46 +0000118 ],
119 ],
120 'target_defaults': {
121 'defines': [
122 '__STDC_FORMAT_MACROS',
Brian Silverman6137a502013-04-22 15:41:36 -0700123 '__STDC_CONSTANT_MACROS',
124 '__STDC_LIMIT_MACROS',
Brian Silvermane6bada62014-05-04 16:16:54 -0700125 '_FORTIFY_SOURCE=2',
brians343bc112013-02-10 01:53:46 +0000126 ],
127 'ldflags': [
128 '-pipe',
129 ],
130 'cflags': [
131 '-pipe',
132
133 '-Wall',
134 '-Wextra',
135 '-Wswitch-enum',
136 '-Wpointer-arith',
137 '-Wstrict-aliasing=2',
138 '-Wcast-qual',
139 '-Wcast-align',
140 '-Wwrite-strings',
141 '-Wtype-limits',
142 '-Wsign-compare',
143 '-Wformat=2',
144 '-Werror',
Brian Silverman9ba2bc42013-03-17 14:18:33 -0700145
146 '-ggdb3',
brians343bc112013-02-10 01:53:46 +0000147 ],
148 'cflags_c': [
149 '-std=gnu99',
150 ],
brians343bc112013-02-10 01:53:46 +0000151 'include_dirs': [
152 '<(DEPTH)',
153 ],
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700154 # These have to be here because apparently gyp evaluates target_conditions
155 # even if the target is never used.
156 'variables': {
157 # Set this to 1 to disable rsyncing the file to the target.
158 'no_rsync%': 0,
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700159 # Set this to 1 if this file is a test that should not be run by
Brian Silvermanb3d50542014-04-23 14:28:55 -0500160 # `build.py tests`.
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700161 'is_special_test%': 0,
162 },
brians343bc112013-02-10 01:53:46 +0000163 'conditions': [
164 ['DEBUG=="yes"', {
Brian Silvermanaac705c2014-05-01 18:55:34 -0700165 'defines': [
166 'AOS_DEBUG=1',
167 ],
Brian Silverman266811f2014-05-03 22:48:04 -0700168 'conditions': [['SANITIZER=="none"', {
Brian Silvermane6bada62014-05-04 16:16:54 -0700169 'cflags': [
170 '-O0',
171 ],
172 }, {
173 'cflags': [
174 '-O1',
175 ],
176 }
177 ]],
178 }, { # 'DEBUG=="no"'
Brian Silvermanaac705c2014-05-01 18:55:34 -0700179 'defines': [
180 'AOS_DEBUG=0',
181 ],
brians343bc112013-02-10 01:53:46 +0000182 'cflags': [
183 '-O3',
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700184 '-fomit-frame-pointer',
brians343bc112013-02-10 01:53:46 +0000185 ],
Brian Silvermanefb993f2013-08-30 19:52:57 -0700186 'ldflags': [
187 '-O3',
188 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500189 'conditions': [['PLATFORM=="crio"', {
Brian Silvermane6bada62014-05-04 16:16:54 -0700190# Copied from stuff that I think started with the supplied Makefiles.
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__',
Brian Silvermane6bada62014-05-04 16:16:54 -0700260# Prevent the vxworks system headers from being dumb and #defining min and max.
brians343bc112013-02-10 01:53:46 +0000261 'NOMINMAX',
262 ],
Brian Silvermane6bada62014-05-04 16:16:54 -0700263 }, { # 'PLATFORM!="crio"'
brians343bc112013-02-10 01:53:46 +0000264 'target_conditions': [
Brian Silvermane6bada62014-05-04 16:16:54 -0700265# Default to putting outputs into rsync_dir.
brians343bc112013-02-10 01:53:46 +0000266 ['no_rsync==0 and _type!="static_library"', {
267 'product_dir': '<(rsync_dir)',
268 },
269 ],
brians343bc112013-02-10 01:53:46 +0000270 ],
271 'ldflags': [
272 '-pthread',
brians343bc112013-02-10 01:53:46 +0000273 ],
brians343bc112013-02-10 01:53:46 +0000274 'cflags': [
275 '-pthread',
Brian Silverman6e206682013-08-31 11:43:35 -0700276 ],
277 'cflags_cc': [
278 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000279 ],
280 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700281 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000282 ],
283 'libraries': [
284 '-lm',
285 '-lrt',
286 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700287 'conditions': [
Brian Silvermana29ebf92014-04-23 13:08:49 -0500288 ['COMPILER=="gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700289 'cflags': [
290 '-Wunused-local-typedefs',
291 ],
Brian Silvermanf0d3c782014-05-02 23:56:32 -0700292 'defines': [
293 '__has_feature(n)=0'
294 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700295 },
Brian Silvermana29ebf92014-04-23 13:08:49 -0500296 ], ['COMPILER=="clang"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700297 'cflags': [
298 '-fcolor-diagnostics',
Brian Silvermane6bada62014-05-04 16:16:54 -0700299 '-fmessage-length=80',
Brian Silverman79723eb2014-04-21 22:05:11 -0700300 ],
301 'defines': [
Brian Silverman79723eb2014-04-21 22:05:11 -0700302 # This tells clang's optimizer the same thing.
303 '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))',
304 ],
305 },
306 ],
307 ],
brians343bc112013-02-10 01:53:46 +0000308 }
309 ]
310 ],
311 },
312}