blob: b04db8d78578be485749e2c6404933738efea8cb [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',
39 '-ccc-gcc-name', 'arm-linux-gnueabihf-gcc',
40 '--sysroot=<(arm-clang-sysroot)',
41
42 #-mhwdiv=arm,thumb
43 ],
44 },
45 'make_global_settings': [
46 ['CC', '<(arm-clang-symlinks)/bin/clang'],
47 ['CXX', '<(arm-clang-symlinks)/bin/clang++'],
48 ],
49 'target_defaults': {
50 'cflags': [
51 '-I<!(realpath -s <(arm-clang-sysroot)/usr/include/c++/4.7.2/)',
52 '-I<!(realpath -s <(arm-clang-sysroot)/usr/include/c++/4.7.2/arm-linux-gnueabihf/)',
53 '<@(platflags)',
54 ],
55 'ldflags': [
56 '<@(platflags)',
57 ],
58 },
Brian Silverman79723eb2014-04-21 22:05:11 -070059 },
60 ], ['PLATFORM=="linux-amd64-clang"', {
61 'make_global_settings': [
62 ['CC', '<!(which clang)'],
63 ['CXX', '<!(which clang++)'],
64 ],
65 },
Brian Silvermana29ebf92014-04-23 13:08:49 -050066 ], ['PLATFORM=="linux-amd64-gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -070067 },
brians343bc112013-02-10 01:53:46 +000068 ],
69 ],
70 'target_defaults': {
71 'defines': [
72 '__STDC_FORMAT_MACROS',
73 '_FORTIFY_SOURCE=2',
Brian Silverman6137a502013-04-22 15:41:36 -070074 '__STDC_CONSTANT_MACROS',
75 '__STDC_LIMIT_MACROS',
brians343bc112013-02-10 01:53:46 +000076 ],
77 'ldflags': [
78 '-pipe',
79 ],
80 'cflags': [
81 '-pipe',
82
83 '-Wall',
84 '-Wextra',
85 '-Wswitch-enum',
86 '-Wpointer-arith',
87 '-Wstrict-aliasing=2',
88 '-Wcast-qual',
89 '-Wcast-align',
90 '-Wwrite-strings',
91 '-Wtype-limits',
92 '-Wsign-compare',
93 '-Wformat=2',
94 '-Werror',
Brian Silverman9ba2bc42013-03-17 14:18:33 -070095
96 '-ggdb3',
brians343bc112013-02-10 01:53:46 +000097 ],
98 'cflags_c': [
99 '-std=gnu99',
100 ],
brians343bc112013-02-10 01:53:46 +0000101 'include_dirs': [
102 '<(DEPTH)',
103 ],
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700104 # These have to be here because apparently gyp evaluates target_conditions
105 # even if the target is never used.
106 'variables': {
107 # Set this to 1 to disable rsyncing the file to the target.
108 'no_rsync%': 0,
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700109 # Set this to 1 if this file is a test that should not be run by
Brian Silvermanb3d50542014-04-23 14:28:55 -0500110 # `build.py tests`.
Brian Silvermand0a52dc2013-09-23 17:55:37 -0700111 'is_special_test%': 0,
112 },
brians343bc112013-02-10 01:53:46 +0000113 'conditions': [
114 ['DEBUG=="yes"', {
115 'cflags': [
brians343bc112013-02-10 01:53:46 +0000116 '-O0',
117 ],
brians343bc112013-02-10 01:53:46 +0000118 }, {
119 'cflags': [
Brian Silvermanb3d50542014-04-23 14:28:55 -0500120 # TODO(brians): -O4 for clang to enable LTO?
brians343bc112013-02-10 01:53:46 +0000121 '-O3',
Brian Silverman2a36ddb2014-04-08 17:07:28 -0700122 '-fomit-frame-pointer',
brians343bc112013-02-10 01:53:46 +0000123 ],
Brian Silvermanefb993f2013-08-30 19:52:57 -0700124 'ldflags': [
125 '-O3',
126 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500127 'conditions': [['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000128 'cflags': [
129 '-fstrength-reduce',
130 '-fno-builtin',
131 '-fno-strict-aliasing',
132 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800133 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500134 ['ARCHITECTURE=="arm"', {
brians343bc112013-02-10 01:53:46 +0000135 'cflags': [
Brian Silvermanc4321322013-11-18 17:38:39 -0800136 '-mcpu=cortex-a8',
Brian Silverman46203612013-11-19 18:01:41 -0800137 '-mfpu=neon',
brians343bc112013-02-10 01:53:46 +0000138 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800139 }],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500140 ['ARCHITECTURE=="amd64"', {
Brian Silverman41abe012014-02-08 18:25:02 -0800141 'cflags': [
Brian Silverman41abe012014-02-08 18:25:02 -0800142 '-fstack-protector-all',
143 ],
144 }],
145 ]
brians343bc112013-02-10 01:53:46 +0000146 }
147 ],
Brian Silverman134e5222014-04-27 20:10:05 -0700148 ['PLATFORM=="linux-arm-gcc" and DEBUG=="yes"', {
149 'cflags': [
150 # GCC doesn't like letting us use r7 (which is also the frame
151 # pointer) to pass the syscall number to the kernel even when
152 # it's marked as clobbered.
153 # See <https://bugzilla.mozilla.org/show_bug.cgi?id=633436> for
154 # some more discussion.
155 '-fomit-frame-pointer',
156 ],
157 }
158 ],
Brian Silvermanb3d50542014-04-23 14:28:55 -0500159 ['PLATFORM=="crio"', {
brians343bc112013-02-10 01:53:46 +0000160 'target_conditions': [
161 ['_type=="shared_library"', {
162 'ldflags': [
163 '-r',
164 '-nostdlib',
165 '-Wl,-X',
166 ],
167 }
168 ],
169 ],
170 'ldflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700171 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000172 '-mstrict-align',
173 '-mlongcall',
174 ],
175 'cflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700176 # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both
177 # have MPC603e cores according to Freescale docs.
178 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000179 '-mstrict-align',
180 '-mlongcall',
Brian Silverman823f3242013-11-17 13:20:22 -0800181 '-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/',
182 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/',
183 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
184 '-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 +0000185 '-isystem', '<(WIND_BASE)/target/h',
186 '-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
187 ],
Brian Silverman6e206682013-08-31 11:43:35 -0700188 'cflags_cc': [
189 '-std=gnu++0x',
190 ],
brians343bc112013-02-10 01:53:46 +0000191 'defines': [
192 'CPU=PPC603',
193 'TOOL_FAMILY=gnu',
194 'TOOL=gnu',
195 '_WRS_KERNEL',
196 '__PPC__',
197# This tells eigen to not do anything with alignment at all. See
198# <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for
199# details. It really doesn't like to work without this.
200 'EIGEN_DONT_ALIGN',
201# prevent the vxworks system headers from being dumb and #defining min and max
202 'NOMINMAX',
203 ],
204 }, {
brians343bc112013-02-10 01:53:46 +0000205 'target_conditions': [
206# default to putting outputs into rsync_dir
207 ['no_rsync==0 and _type!="static_library"', {
208 'product_dir': '<(rsync_dir)',
209 },
210 ],
211 ['_type=="loadable_module"', {
212 'product_dir': '<(so_dir)',
213 }
214 ],
brians343bc112013-02-10 01:53:46 +0000215 ],
216 'ldflags': [
217 '-pthread',
brians343bc112013-02-10 01:53:46 +0000218 ],
brians343bc112013-02-10 01:53:46 +0000219 'cflags': [
220 '-pthread',
Brian Silverman79723eb2014-04-21 22:05:11 -0700221 '-fno-exceptions',
Brian Silverman6e206682013-08-31 11:43:35 -0700222 ],
223 'cflags_cc': [
224 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000225 ],
226 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700227 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000228 ],
229 'libraries': [
230 '-lm',
231 '-lrt',
232 ],
Brian Silverman79723eb2014-04-21 22:05:11 -0700233 'conditions': [
Brian Silvermana29ebf92014-04-23 13:08:49 -0500234 ['COMPILER=="gcc"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700235 'cflags': [
236 '-Wunused-local-typedefs',
237 ],
238 },
Brian Silvermana29ebf92014-04-23 13:08:49 -0500239 ], ['COMPILER=="clang"', {
Brian Silverman79723eb2014-04-21 22:05:11 -0700240 'cflags': [
241 '-fcolor-diagnostics',
242 ],
243 'defines': [
244 # To work around <http://llvm.org/bugs/show_bug.cgi?id=13530>.
245 '__float128=void',
246 # This tells clang's optimizer the same thing.
247 '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))',
248 ],
249 },
250 ],
251 ],
brians343bc112013-02-10 01:53:46 +0000252 }
253 ]
254 ],
255 },
256}