blob: 9f19cdad685674458d3b2e4f09510616e365c563 [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 ],
66 },
Brian Silvermana29ebf92014-04-23 13:08:49 -050067 ], ['PLATFORM=="linux-amd64-gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -070068 },
brians343bc112013-02-10 01:53:46 +000069 ],
70 ],
71 'target_defaults': {
72 'defines': [
73 '__STDC_FORMAT_MACROS',
74 '_FORTIFY_SOURCE=2',
Brian Silverman6137a502013-04-22 15:41:36 -070075 '__STDC_CONSTANT_MACROS',
76 '__STDC_LIMIT_MACROS',
brians343bc112013-02-10 01:53:46 +000077 ],
78 'ldflags': [
79 '-pipe',
80 ],
81 'cflags': [
82 '-pipe',
83
84 '-Wall',
85 '-Wextra',
86 '-Wswitch-enum',
87 '-Wpointer-arith',
88 '-Wstrict-aliasing=2',
89 '-Wcast-qual',
90 '-Wcast-align',
91 '-Wwrite-strings',
92 '-Wtype-limits',
93 '-Wsign-compare',
94 '-Wformat=2',
95 '-Werror',
Brian Silverman9ba2bc42013-03-17 14:18:33 -070096
97 '-ggdb3',
brians343bc112013-02-10 01:53:46 +000098 ],
99 'cflags_c': [
100 '-std=gnu99',
101 ],
brians343bc112013-02-10 01:53:46 +0000102 'include_dirs': [
103 '<(DEPTH)',
104 ],
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700105 # These have to be here because apparently gyp evaluates target_conditions
106 # even if the target is never used.
107 'variables': {
108 # Set this to 1 to disable rsyncing the file to the target.
109 'no_rsync%': 0,
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700110 # Set this to 1 if this file is a test that should not be run by
Brian Silvermanb3d50542014-04-23 14:28:55 -0500111 # `build.py tests`.
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700112 'is_special_test%': 0,
113 },
brians343bc112013-02-10 01:53:46 +0000114 'conditions': [
115 ['DEBUG=="yes"', {
Brian Silvermanaac705c2014-05-01 18:55:34 -0700116 'defines': [
117 'AOS_DEBUG=1',
118 ],
brians343bc112013-02-10 01:53:46 +0000119 'cflags': [
brians343bc112013-02-10 01:53:46 +0000120 '-O0',
121 ],
brians343bc112013-02-10 01:53:46 +0000122 }, {
Brian Silvermanaac705c2014-05-01 18:55:34 -0700123 'defines': [
124 'AOS_DEBUG=0',
125 ],
brians343bc112013-02-10 01:53:46 +0000126 'cflags': [
Brian Silvermanc2d8e5a2014-05-01 18:33:12 -0700127 # TODO(brians): add -flto
brians343bc112013-02-10 01:53:46 +0000128 '-O3',
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700129 '-fomit-frame-pointer',
brians343bc112013-02-10 01:53:46 +0000130 ],
Brian Silvermanefb993f2013-08-30 19:52:57 -0700131 'ldflags': [
132 '-O3',
133 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500134 'conditions': [['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000135 'cflags': [
136 '-fstrength-reduce',
137 '-fno-builtin',
138 '-fno-strict-aliasing',
139 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800140 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500141 ['ARCHITECTURE=="arm"', {
brians343bc112013-02-10 01:53:46 +0000142 'cflags': [
Brian Silvermanc4321322013-11-18 17:38:39 -0800143 '-mcpu=cortex-a8',
Brian Silverman46203612013-11-19 18:01:41 -0800144 '-mfpu=neon',
brians343bc112013-02-10 01:53:46 +0000145 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800146 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500147 ['ARCHITECTURE=="amd64"', {
Brian Silverman41abe012014-02-08 18:25:02 -0800148 'cflags': [
Brian Silverman41abe012014-02-08 18:25:02 -0800149 '-fstack-protector-all',
150 ],
151 }],
152 ]
brians343bc112013-02-10 01:53:46 +0000153 }
154 ],
Brian Silverman134e5222014-04-27 20:10:05 -0700155 ['PLATFORM=="linux-arm-gcc" and DEBUG=="yes"', {
156 'cflags': [
157 # GCC doesn't like letting us use r7 (which is also the frame
158 # pointer) to pass the syscall number to the kernel even when
159 # it's marked as clobbered.
160 # See <https://bugzilla.mozilla.org/show_bug.cgi?id=633436> for
161 # some more discussion.
162 '-fomit-frame-pointer',
163 ],
164 }
165 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500166 ['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000167 'target_conditions': [
168 ['_type=="shared_library"', {
169 'ldflags': [
170 '-r',
171 '-nostdlib',
172 '-Wl,-X',
173 ],
174 }
175 ],
176 ],
177 'ldflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700178 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000179 '-mstrict-align',
180 '-mlongcall',
181 ],
182 'cflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700183 # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both
184 # have MPC603e cores according to Freescale docs.
185 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000186 '-mstrict-align',
187 '-mlongcall',
Brian Silverman823f3242013-11-17 13:20:22 -0800188 '-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/',
189 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/',
190 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
191 '-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 +0000192 '-isystem', '<(WIND_BASE)/target/h',
193 '-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
194 ],
Brian Silverman6e206682013-08-31 11:43:35 -0700195 'cflags_cc': [
196 '-std=gnu++0x',
197 ],
brians343bc112013-02-10 01:53:46 +0000198 'defines': [
199 'CPU=PPC603',
200 'TOOL_FAMILY=gnu',
201 'TOOL=gnu',
202 '_WRS_KERNEL',
203 '__PPC__',
204# This tells eigen to not do anything with alignment at all. See
205# <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for
206# details. It really doesn't like to work without this.
207 'EIGEN_DONT_ALIGN',
208# prevent the vxworks system headers from being dumb and #defining min and max
209 'NOMINMAX',
210 ],
211 }, {
brians343bc112013-02-10 01:53:46 +0000212 'target_conditions': [
213# default to putting outputs into rsync_dir
214 ['no_rsync==0 and _type!="static_library"', {
215 'product_dir': '<(rsync_dir)',
216 },
217 ],
218 ['_type=="loadable_module"', {
219 'product_dir': '<(so_dir)',
220 }
221 ],
brians343bc112013-02-10 01:53:46 +0000222 ],
223 'ldflags': [
224 '-pthread',
brians343bc112013-02-10 01:53:46 +0000225 ],
brians343bc112013-02-10 01:53:46 +0000226 'cflags': [
227 '-pthread',
Brian Silverman79723eb2014-04-21 22:05:11 -0700228 '-fno-exceptions',
Brian Silverman6e206682013-08-31 11:43:35 -0700229 ],
230 'cflags_cc': [
231 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000232 ],
233 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700234 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000235 ],
236 'libraries': [
237 '-lm',
238 '-lrt',
239 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700240 'conditions': [
Brian Silvermana29ebf92014-04-23 13:08:49 -0500241 ['COMPILER=="gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700242 'cflags': [
243 '-Wunused-local-typedefs',
244 ],
245 },
Brian Silvermana29ebf92014-04-23 13:08:49 -0500246 ], ['COMPILER=="clang"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700247 'cflags': [
248 '-fcolor-diagnostics',
249 ],
250 'defines': [
251 # To work around <http://llvm.org/bugs/show_bug.cgi?id=13530>.
252 '__float128=void',
253 # This tells clang's optimizer the same thing.
254 '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))',
255 ],
256 },
257 ],
258 ],
brians343bc112013-02-10 01:53:46 +0000259 }
260 ]
261 ],
262 },
263}