blob: 3ae06b4dceee5863578a87fafd1a34366c8d8692 [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': [
63 ['CC', '<!(which clang)'],
64 ['CXX', '<!(which clang++)'],
65 ],
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"', {
116 'cflags': [
brians343bc112013-02-10 01:53:46 +0000117 '-O0',
118 ],
brians343bc112013-02-10 01:53:46 +0000119 }, {
120 'cflags': [
Brian Silvermanb3d50542014-04-23 14:28:55 -0500121 # TODO(brians): -O4 for clang to enable LTO?
brians343bc112013-02-10 01:53:46 +0000122 '-O3',
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700123 '-fomit-frame-pointer',
brians343bc112013-02-10 01:53:46 +0000124 ],
Brian Silvermanefb993f2013-08-30 19:52:57 -0700125 'ldflags': [
126 '-O3',
127 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500128 'conditions': [['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000129 'cflags': [
130 '-fstrength-reduce',
131 '-fno-builtin',
132 '-fno-strict-aliasing',
133 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800134 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500135 ['ARCHITECTURE=="arm"', {
brians343bc112013-02-10 01:53:46 +0000136 'cflags': [
Brian Silvermanc4321322013-11-18 17:38:39 -0800137 '-mcpu=cortex-a8',
Brian Silverman46203612013-11-19 18:01:41 -0800138 '-mfpu=neon',
brians343bc112013-02-10 01:53:46 +0000139 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800140 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500141 ['ARCHITECTURE=="amd64"', {
Brian Silverman41abe012014-02-08 18:25:02 -0800142 'cflags': [
Brian Silverman41abe012014-02-08 18:25:02 -0800143 '-fstack-protector-all',
144 ],
145 }],
146 ]
brians343bc112013-02-10 01:53:46 +0000147 }
148 ],
Brian Silverman134e5222014-04-27 20:10:05 -0700149 ['PLATFORM=="linux-arm-gcc" and DEBUG=="yes"', {
150 'cflags': [
151 # GCC doesn't like letting us use r7 (which is also the frame
152 # pointer) to pass the syscall number to the kernel even when
153 # it's marked as clobbered.
154 # See <https://bugzilla.mozilla.org/show_bug.cgi?id=633436> for
155 # some more discussion.
156 '-fomit-frame-pointer',
157 ],
158 }
159 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500160 ['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000161 'target_conditions': [
162 ['_type=="shared_library"', {
163 'ldflags': [
164 '-r',
165 '-nostdlib',
166 '-Wl,-X',
167 ],
168 }
169 ],
170 ],
171 'ldflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700172 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000173 '-mstrict-align',
174 '-mlongcall',
175 ],
176 'cflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700177 # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both
178 # have MPC603e cores according to Freescale docs.
179 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000180 '-mstrict-align',
181 '-mlongcall',
Brian Silverman823f3242013-11-17 13:20:22 -0800182 '-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/',
183 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/',
184 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
185 '-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 +0000186 '-isystem', '<(WIND_BASE)/target/h',
187 '-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
188 ],
Brian Silverman6e206682013-08-31 11:43:35 -0700189 'cflags_cc': [
190 '-std=gnu++0x',
191 ],
brians343bc112013-02-10 01:53:46 +0000192 'defines': [
193 'CPU=PPC603',
194 'TOOL_FAMILY=gnu',
195 'TOOL=gnu',
196 '_WRS_KERNEL',
197 '__PPC__',
198# This tells eigen to not do anything with alignment at all. See
199# <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for
200# details. It really doesn't like to work without this.
201 'EIGEN_DONT_ALIGN',
202# prevent the vxworks system headers from being dumb and #defining min and max
203 'NOMINMAX',
204 ],
205 }, {
brians343bc112013-02-10 01:53:46 +0000206 'target_conditions': [
207# default to putting outputs into rsync_dir
208 ['no_rsync==0 and _type!="static_library"', {
209 'product_dir': '<(rsync_dir)',
210 },
211 ],
212 ['_type=="loadable_module"', {
213 'product_dir': '<(so_dir)',
214 }
215 ],
brians343bc112013-02-10 01:53:46 +0000216 ],
217 'ldflags': [
218 '-pthread',
brians343bc112013-02-10 01:53:46 +0000219 ],
brians343bc112013-02-10 01:53:46 +0000220 'cflags': [
221 '-pthread',
Brian Silverman79723eb2014-04-21 22:05:11 -0700222 '-fno-exceptions',
Brian Silverman6e206682013-08-31 11:43:35 -0700223 ],
224 'cflags_cc': [
225 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000226 ],
227 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700228 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000229 ],
230 'libraries': [
231 '-lm',
232 '-lrt',
233 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700234 'conditions': [
Brian Silvermana29ebf92014-04-23 13:08:49 -0500235 ['COMPILER=="gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700236 'cflags': [
237 '-Wunused-local-typedefs',
238 ],
239 },
Brian Silvermana29ebf92014-04-23 13:08:49 -0500240 ], ['COMPILER=="clang"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700241 'cflags': [
242 '-fcolor-diagnostics',
243 ],
244 'defines': [
245 # To work around <http://llvm.org/bugs/show_bug.cgi?id=13530>.
246 '__float128=void',
247 # This tells clang's optimizer the same thing.
248 '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))',
249 ],
250 },
251 ],
252 ],
brians343bc112013-02-10 01:53:46 +0000253 }
254 ]
255 ],
256 },
257}