brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 1 | # 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 Silverman | 14fd0fb | 2014-01-14 21:42:01 -0800 | [diff] [blame] | 10 | # the directory that gets rsynced to the target |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 11 | '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', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 18 | }, |
| 19 | 'conditions': [ |
Brian Silverman | b3d5054 | 2014-04-23 14:28:55 -0500 | [diff] [blame] | 20 | ['PLATFORM=="crio"', { |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 21 | 'make_global_settings': [ |
Brian Silverman | a67ecc7 | 2013-09-28 13:53:53 -0700 | [diff] [blame] | 22 | ['CC', '<!(readlink -f <(AOS)/build/crio_cc)'], |
| 23 | ['CXX', '<!(readlink -f <(AOS)/build/crio_cxx)'], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 24 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 25 | } |
Brian Silverman | a29ebf9 | 2014-04-23 13:08:49 -0500 | [diff] [blame] | 26 | ], ['PLATFORM=="linux-arm-gcc"', { |
Brian Silverman | 79723eb | 2014-04-21 22:05:11 -0700 | [diff] [blame] | 27 | 'make_global_settings': [ |
| 28 | ['CC', '<!(which arm-linux-gnueabihf-gcc-4.7)'], |
| 29 | ['CXX', '<!(which arm-linux-gnueabihf-g++-4.7)'], |
| 30 | ], |
| 31 | }, |
Brian Silverman | a29ebf9 | 2014-04-23 13:08:49 -0500 | [diff] [blame] | 32 | ], ['PLATFORM=="linux-arm-clang"', { |
Brian Silverman | a8c0452 | 2014-04-27 20:03:08 -0700 | [diff] [blame] | 33 | '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 Silverman | a8c0452 | 2014-04-27 20:03:08 -0700 | [diff] [blame] | 39 | '--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 Silverman | a8c0452 | 2014-04-27 20:03:08 -0700 | [diff] [blame] | 50 | '<@(platflags)', |
| 51 | ], |
Brian Silverman | 34d25f2 | 2014-05-01 13:30:56 -0700 | [diff] [blame] | 52 | '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 Silverman | a8c0452 | 2014-04-27 20:03:08 -0700 | [diff] [blame] | 56 | 'ldflags': [ |
| 57 | '<@(platflags)', |
| 58 | ], |
| 59 | }, |
Brian Silverman | 79723eb | 2014-04-21 22:05:11 -0700 | [diff] [blame] | 60 | }, |
| 61 | ], ['PLATFORM=="linux-amd64-clang"', { |
| 62 | 'make_global_settings': [ |
Brian Silverman | df4adb2 | 2014-05-01 17:09:38 -0700 | [diff] [blame] | 63 | ['CC', '/opt/clang-3.5/bin/clang'], |
| 64 | ['CXX', '/opt/clang-3.5/bin/clang++'], |
Brian Silverman | 79723eb | 2014-04-21 22:05:11 -0700 | [diff] [blame] | 65 | ], |
Brian Silverman | f0d3c78 | 2014-05-02 23:56:32 -0700 | [diff] [blame] | 66 | }, |
| 67 | ], ['PLATFORM=="linux-amd64-gcc"', { |
| 68 | }, |
Brian Silverman | 47cd6f6 | 2014-05-03 10:35:52 -0700 | [diff] [blame^] | 69 | ], ['PLATFORM=="linux-amd64-gcc_4.8"', { |
| 70 | 'make_global_settings': [ |
| 71 | ['CC', '/opt/clang-3.5/bin/gcc'], |
| 72 | ['CXX', '/opt/clang-3.5/bin/g++'], |
| 73 | ], |
| 74 | }, |
Brian Silverman | f0d3c78 | 2014-05-02 23:56:32 -0700 | [diff] [blame] | 75 | ], ['SANITIZER!="none"', { |
Brian Silverman | a4aff56 | 2014-05-02 17:43:50 -0700 | [diff] [blame] | 76 | 'target_defaults': { |
| 77 | 'cflags': [ |
Brian Silverman | f0d3c78 | 2014-05-02 23:56:32 -0700 | [diff] [blame] | 78 | '-fsanitize=<(SANITIZER)', |
Brian Silverman | a4aff56 | 2014-05-02 17:43:50 -0700 | [diff] [blame] | 79 | # TODO(brians): Figure out how to blacklist some bits of other |
| 80 | # people's code (ie stdlibc++...) and then have it abort on failure. |
| 81 | #'-fsanitize=undefined,integer', |
Brian Silverman | a4aff56 | 2014-05-02 17:43:50 -0700 | [diff] [blame] | 82 | ], |
| 83 | 'ldflags': [ |
Brian Silverman | f0d3c78 | 2014-05-02 23:56:32 -0700 | [diff] [blame] | 84 | '-fsanitize=<(SANITIZER)', |
Brian Silverman | a4aff56 | 2014-05-02 17:43:50 -0700 | [diff] [blame] | 85 | ], |
| 86 | }, |
Brian Silverman | 79723eb | 2014-04-21 22:05:11 -0700 | [diff] [blame] | 87 | }, |
Brian Silverman | f0d3c78 | 2014-05-02 23:56:32 -0700 | [diff] [blame] | 88 | ], ['SANITIZER_FPIC!=""', { |
| 89 | 'target_defaults': { |
| 90 | 'cflags': [ |
Brian Silverman | 47cd6f6 | 2014-05-03 10:35:52 -0700 | [diff] [blame^] | 91 | '-fPIE', |
Brian Silverman | f0d3c78 | 2014-05-02 23:56:32 -0700 | [diff] [blame] | 92 | ], |
| 93 | 'ldflags': [ |
Brian Silverman | 47cd6f6 | 2014-05-03 10:35:52 -0700 | [diff] [blame^] | 94 | '-fPIE', |
Brian Silverman | f0d3c78 | 2014-05-02 23:56:32 -0700 | [diff] [blame] | 95 | ], |
Brian Silverman | 47cd6f6 | 2014-05-03 10:35:52 -0700 | [diff] [blame^] | 96 | 'link_settings': { |
| 97 | 'ldflags': [ |
| 98 | '-pie', |
| 99 | ], |
| 100 | }, |
Brian Silverman | f0d3c78 | 2014-05-02 23:56:32 -0700 | [diff] [blame] | 101 | }, |
| 102 | }, |
| 103 | ], ['SANITIZER=="memory"', { |
| 104 | 'target_defaults': { |
| 105 | 'cflags': [ |
| 106 | '-fsanitize-memory-track-origins', |
| 107 | ], |
| 108 | 'ldflags': [ |
| 109 | '-fsanitize-memory-track-origins', |
| 110 | ], |
| 111 | }, |
Brian Silverman | 79723eb | 2014-04-21 22:05:11 -0700 | [diff] [blame] | 112 | }, |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 113 | ], |
| 114 | ], |
| 115 | 'target_defaults': { |
| 116 | 'defines': [ |
| 117 | '__STDC_FORMAT_MACROS', |
| 118 | '_FORTIFY_SOURCE=2', |
Brian Silverman | 6137a50 | 2013-04-22 15:41:36 -0700 | [diff] [blame] | 119 | '__STDC_CONSTANT_MACROS', |
| 120 | '__STDC_LIMIT_MACROS', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 121 | ], |
| 122 | 'ldflags': [ |
| 123 | '-pipe', |
| 124 | ], |
| 125 | 'cflags': [ |
| 126 | '-pipe', |
| 127 | |
| 128 | '-Wall', |
| 129 | '-Wextra', |
| 130 | '-Wswitch-enum', |
| 131 | '-Wpointer-arith', |
| 132 | '-Wstrict-aliasing=2', |
| 133 | '-Wcast-qual', |
| 134 | '-Wcast-align', |
| 135 | '-Wwrite-strings', |
| 136 | '-Wtype-limits', |
| 137 | '-Wsign-compare', |
| 138 | '-Wformat=2', |
| 139 | '-Werror', |
Brian Silverman | 9ba2bc4 | 2013-03-17 14:18:33 -0700 | [diff] [blame] | 140 | |
| 141 | '-ggdb3', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 142 | ], |
| 143 | 'cflags_c': [ |
| 144 | '-std=gnu99', |
| 145 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 146 | 'include_dirs': [ |
| 147 | '<(DEPTH)', |
| 148 | ], |
Brian Silverman | d0a52dc | 2013-09-23 17:55:37 -0700 | [diff] [blame] | 149 | # These have to be here because apparently gyp evaluates target_conditions |
| 150 | # even if the target is never used. |
| 151 | 'variables': { |
| 152 | # Set this to 1 to disable rsyncing the file to the target. |
| 153 | 'no_rsync%': 0, |
Brian Silverman | 2a36ddb | 2014-04-08 17:07:28 -0700 | [diff] [blame] | 154 | # Set this to 1 if this file is a test that should not be run by |
Brian Silverman | b3d5054 | 2014-04-23 14:28:55 -0500 | [diff] [blame] | 155 | # `build.py tests`. |
Brian Silverman | d0a52dc | 2013-09-23 17:55:37 -0700 | [diff] [blame] | 156 | 'is_special_test%': 0, |
| 157 | }, |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 158 | 'conditions': [ |
| 159 | ['DEBUG=="yes"', { |
Brian Silverman | aac705c | 2014-05-01 18:55:34 -0700 | [diff] [blame] | 160 | 'defines': [ |
| 161 | 'AOS_DEBUG=1', |
| 162 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 163 | 'cflags': [ |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 164 | '-O0', |
| 165 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 166 | }, { |
Brian Silverman | aac705c | 2014-05-01 18:55:34 -0700 | [diff] [blame] | 167 | 'defines': [ |
| 168 | 'AOS_DEBUG=0', |
| 169 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 170 | 'cflags': [ |
Brian Silverman | c2d8e5a | 2014-05-01 18:33:12 -0700 | [diff] [blame] | 171 | # TODO(brians): add -flto |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 172 | '-O3', |
Brian Silverman | 2a36ddb | 2014-04-08 17:07:28 -0700 | [diff] [blame] | 173 | '-fomit-frame-pointer', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 174 | ], |
Brian Silverman | efb993f | 2013-08-30 19:52:57 -0700 | [diff] [blame] | 175 | 'ldflags': [ |
| 176 | '-O3', |
| 177 | ], |
Brian Silverman | b3d5054 | 2014-04-23 14:28:55 -0500 | [diff] [blame] | 178 | 'conditions': [['PLATFORM=="crio"', { |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 179 | 'cflags': [ |
| 180 | '-fstrength-reduce', |
| 181 | '-fno-builtin', |
| 182 | '-fno-strict-aliasing', |
| 183 | ], |
Brian Silverman | 41abe01 | 2014-02-08 18:25:02 -0800 | [diff] [blame] | 184 | }], |
Brian Silverman | b3d5054 | 2014-04-23 14:28:55 -0500 | [diff] [blame] | 185 | ['ARCHITECTURE=="arm"', { |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 186 | 'cflags': [ |
Brian Silverman | c432132 | 2013-11-18 17:38:39 -0800 | [diff] [blame] | 187 | '-mcpu=cortex-a8', |
Brian Silverman | 4620361 | 2013-11-19 18:01:41 -0800 | [diff] [blame] | 188 | '-mfpu=neon', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 189 | ], |
Brian Silverman | 41abe01 | 2014-02-08 18:25:02 -0800 | [diff] [blame] | 190 | }], |
Brian Silverman | b3d5054 | 2014-04-23 14:28:55 -0500 | [diff] [blame] | 191 | ['ARCHITECTURE=="amd64"', { |
Brian Silverman | 41abe01 | 2014-02-08 18:25:02 -0800 | [diff] [blame] | 192 | 'cflags': [ |
Brian Silverman | 41abe01 | 2014-02-08 18:25:02 -0800 | [diff] [blame] | 193 | '-fstack-protector-all', |
| 194 | ], |
| 195 | }], |
| 196 | ] |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 197 | } |
| 198 | ], |
Brian Silverman | 47cd6f6 | 2014-05-03 10:35:52 -0700 | [diff] [blame^] | 199 | ['OS=="linux" and ARCHITECTURE=="arm" and COMPILER=="gcc" and DEBUG=="yes"', { |
Brian Silverman | 134e522 | 2014-04-27 20:10:05 -0700 | [diff] [blame] | 200 | 'cflags': [ |
| 201 | # GCC doesn't like letting us use r7 (which is also the frame |
| 202 | # pointer) to pass the syscall number to the kernel even when |
| 203 | # it's marked as clobbered. |
| 204 | # See <https://bugzilla.mozilla.org/show_bug.cgi?id=633436> for |
| 205 | # some more discussion. |
| 206 | '-fomit-frame-pointer', |
| 207 | ], |
| 208 | } |
| 209 | ], |
Brian Silverman | b3d5054 | 2014-04-23 14:28:55 -0500 | [diff] [blame] | 210 | ['PLATFORM=="crio"', { |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 211 | 'target_conditions': [ |
| 212 | ['_type=="shared_library"', { |
| 213 | 'ldflags': [ |
| 214 | '-r', |
| 215 | '-nostdlib', |
| 216 | '-Wl,-X', |
| 217 | ], |
| 218 | } |
| 219 | ], |
| 220 | ], |
| 221 | 'ldflags': [ |
Brian Silverman | 1579fc1 | 2013-04-22 15:41:55 -0700 | [diff] [blame] | 222 | '-mcpu=603e', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 223 | '-mstrict-align', |
| 224 | '-mlongcall', |
| 225 | ], |
| 226 | 'cflags': [ |
Brian Silverman | 1579fc1 | 2013-04-22 15:41:55 -0700 | [diff] [blame] | 227 | # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both |
| 228 | # have MPC603e cores according to Freescale docs. |
| 229 | '-mcpu=603e', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 230 | '-mstrict-align', |
| 231 | '-mlongcall', |
Brian Silverman | 823f324 | 2013-11-17 13:20:22 -0800 | [diff] [blame] | 232 | '-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/', |
| 233 | '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/', |
| 234 | '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/', |
| 235 | '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/powerpc-wrs-vxworks/', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 236 | '-isystem', '<(WIND_BASE)/target/h', |
| 237 | '-isystem', '<(WIND_BASE)/target/h/wrn/coreip', |
| 238 | ], |
Brian Silverman | 6e20668 | 2013-08-31 11:43:35 -0700 | [diff] [blame] | 239 | 'cflags_cc': [ |
| 240 | '-std=gnu++0x', |
| 241 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 242 | 'defines': [ |
| 243 | 'CPU=PPC603', |
| 244 | 'TOOL_FAMILY=gnu', |
| 245 | 'TOOL=gnu', |
| 246 | '_WRS_KERNEL', |
| 247 | '__PPC__', |
| 248 | # This tells eigen to not do anything with alignment at all. See |
| 249 | # <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for |
| 250 | # details. It really doesn't like to work without this. |
| 251 | 'EIGEN_DONT_ALIGN', |
| 252 | # prevent the vxworks system headers from being dumb and #defining min and max |
| 253 | 'NOMINMAX', |
| 254 | ], |
| 255 | }, { |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 256 | 'target_conditions': [ |
| 257 | # default to putting outputs into rsync_dir |
| 258 | ['no_rsync==0 and _type!="static_library"', { |
| 259 | 'product_dir': '<(rsync_dir)', |
| 260 | }, |
| 261 | ], |
| 262 | ['_type=="loadable_module"', { |
| 263 | 'product_dir': '<(so_dir)', |
| 264 | } |
| 265 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 266 | ], |
| 267 | 'ldflags': [ |
| 268 | '-pthread', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 269 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 270 | 'cflags': [ |
| 271 | '-pthread', |
Brian Silverman | 79723eb | 2014-04-21 22:05:11 -0700 | [diff] [blame] | 272 | '-fno-exceptions', |
Brian Silverman | 6e20668 | 2013-08-31 11:43:35 -0700 | [diff] [blame] | 273 | ], |
| 274 | 'cflags_cc': [ |
| 275 | '-std=gnu++11', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 276 | ], |
| 277 | 'defines': [ |
Brian Silverman | efb993f | 2013-08-30 19:52:57 -0700 | [diff] [blame] | 278 | '_FILE_OFFSET_BITS=64', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 279 | ], |
| 280 | 'libraries': [ |
| 281 | '-lm', |
| 282 | '-lrt', |
| 283 | ], |
Brian Silverman | 79723eb | 2014-04-21 22:05:11 -0700 | [diff] [blame] | 284 | 'conditions': [ |
Brian Silverman | a29ebf9 | 2014-04-23 13:08:49 -0500 | [diff] [blame] | 285 | ['COMPILER=="gcc"', { |
Brian Silverman | 79723eb | 2014-04-21 22:05:11 -0700 | [diff] [blame] | 286 | 'cflags': [ |
| 287 | '-Wunused-local-typedefs', |
| 288 | ], |
Brian Silverman | f0d3c78 | 2014-05-02 23:56:32 -0700 | [diff] [blame] | 289 | 'defines': [ |
| 290 | '__has_feature(n)=0' |
| 291 | ], |
Brian Silverman | 79723eb | 2014-04-21 22:05:11 -0700 | [diff] [blame] | 292 | }, |
Brian Silverman | a29ebf9 | 2014-04-23 13:08:49 -0500 | [diff] [blame] | 293 | ], ['COMPILER=="clang"', { |
Brian Silverman | 79723eb | 2014-04-21 22:05:11 -0700 | [diff] [blame] | 294 | 'cflags': [ |
| 295 | '-fcolor-diagnostics', |
| 296 | ], |
| 297 | 'defines': [ |
| 298 | # To work around <http://llvm.org/bugs/show_bug.cgi?id=13530>. |
| 299 | '__float128=void', |
| 300 | # This tells clang's optimizer the same thing. |
| 301 | '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))', |
| 302 | ], |
| 303 | }, |
| 304 | ], |
| 305 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 306 | } |
| 307 | ] |
| 308 | ], |
| 309 | }, |
| 310 | } |