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', |
Brian Silverman | 14fd0fb | 2014-01-14 21:42:01 -0800 | [diff] [blame] | 18 | # 'executable' for linux and 'static_library' for the cRIO |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 19 | # Useful for targets that should either be an executable or get compiled into |
| 20 | # a .out file depending on the current platform. |
| 21 | # 'aos_target': platform-dependent, |
| 22 | }, |
| 23 | 'conditions': [ |
| 24 | ['OS=="crio"', { |
| 25 | 'make_global_settings': [ |
Brian Silverman | a67ecc7 | 2013-09-28 13:53:53 -0700 | [diff] [blame] | 26 | ['CC', '<!(readlink -f <(AOS)/build/crio_cc)'], |
| 27 | ['CXX', '<!(readlink -f <(AOS)/build/crio_cxx)'], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 28 | ], |
| 29 | 'variables': { |
| 30 | 'aos_target': 'static_library', |
| 31 | }, |
| 32 | }, { |
Brian Silverman | 41abe01 | 2014-02-08 18:25:02 -0800 | [diff] [blame^] | 33 | 'conditions': [ |
| 34 | ['PLATFORM!="linux-amd64"', { |
| 35 | 'make_global_settings': [ |
| 36 | ['CC', '<!(which arm-linux-gnueabihf-gcc-4.7)'], |
| 37 | ['CXX', '<!(which arm-linux-gnueabihf-g++-4.7)'], |
| 38 | ], |
| 39 | }, |
| 40 | ], |
Brian Silverman | 63cf241 | 2013-11-17 05:44:36 -0800 | [diff] [blame] | 41 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 42 | 'variables': { |
| 43 | 'aos_target': 'executable', |
| 44 | }, |
| 45 | } |
| 46 | ], |
| 47 | ], |
| 48 | 'target_defaults': { |
| 49 | 'defines': [ |
| 50 | '__STDC_FORMAT_MACROS', |
| 51 | '_FORTIFY_SOURCE=2', |
Brian Silverman | 6137a50 | 2013-04-22 15:41:36 -0700 | [diff] [blame] | 52 | '__STDC_CONSTANT_MACROS', |
| 53 | '__STDC_LIMIT_MACROS', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 54 | ], |
| 55 | 'ldflags': [ |
| 56 | '-pipe', |
| 57 | ], |
| 58 | 'cflags': [ |
| 59 | '-pipe', |
| 60 | |
| 61 | '-Wall', |
| 62 | '-Wextra', |
| 63 | '-Wswitch-enum', |
| 64 | '-Wpointer-arith', |
| 65 | '-Wstrict-aliasing=2', |
| 66 | '-Wcast-qual', |
| 67 | '-Wcast-align', |
| 68 | '-Wwrite-strings', |
| 69 | '-Wtype-limits', |
| 70 | '-Wsign-compare', |
| 71 | '-Wformat=2', |
| 72 | '-Werror', |
Brian Silverman | 9ba2bc4 | 2013-03-17 14:18:33 -0700 | [diff] [blame] | 73 | |
| 74 | '-ggdb3', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 75 | ], |
| 76 | 'cflags_c': [ |
| 77 | '-std=gnu99', |
| 78 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 79 | 'include_dirs': [ |
| 80 | '<(DEPTH)', |
| 81 | ], |
| 82 | 'conditions': [ |
| 83 | ['DEBUG=="yes"', { |
| 84 | 'cflags': [ |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 85 | '-O0', |
| 86 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 87 | }, { |
| 88 | 'cflags': [ |
| 89 | '-O3', |
| 90 | ], |
Brian Silverman | efb993f | 2013-08-30 19:52:57 -0700 | [diff] [blame] | 91 | 'ldflags': [ |
| 92 | '-O3', |
| 93 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 94 | 'conditions': [['OS=="crio"', { |
| 95 | 'cflags': [ |
| 96 | '-fstrength-reduce', |
| 97 | '-fno-builtin', |
| 98 | '-fno-strict-aliasing', |
| 99 | ], |
Brian Silverman | 41abe01 | 2014-02-08 18:25:02 -0800 | [diff] [blame^] | 100 | }], |
| 101 | ['PLATFORM=="linux"', { |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 102 | 'cflags': [ |
Brian Silverman | c432132 | 2013-11-18 17:38:39 -0800 | [diff] [blame] | 103 | '-mcpu=cortex-a8', |
Brian Silverman | 4620361 | 2013-11-19 18:01:41 -0800 | [diff] [blame] | 104 | '-mfpu=neon', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 105 | |
Brian Silverman | 9d1165c | 2013-09-01 16:46:29 -0700 | [diff] [blame] | 106 | '-fstack-protector-all', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 107 | ], |
Brian Silverman | 41abe01 | 2014-02-08 18:25:02 -0800 | [diff] [blame^] | 108 | }], |
| 109 | ['PLATFORM=="linux-amd64"', { |
| 110 | 'cflags': [ |
| 111 | '-march=atom', |
| 112 | '-mfpmath=sse', |
| 113 | |
| 114 | '-fstack-protector-all', |
| 115 | ], |
| 116 | }], |
| 117 | ] |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 118 | } |
| 119 | ], |
| 120 | ['OS=="crio"', { |
| 121 | 'target_conditions': [ |
| 122 | ['_type=="shared_library"', { |
| 123 | 'ldflags': [ |
| 124 | '-r', |
| 125 | '-nostdlib', |
| 126 | '-Wl,-X', |
| 127 | ], |
| 128 | } |
| 129 | ], |
| 130 | ], |
| 131 | 'ldflags': [ |
Brian Silverman | 1579fc1 | 2013-04-22 15:41:55 -0700 | [diff] [blame] | 132 | '-mcpu=603e', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 133 | '-mstrict-align', |
| 134 | '-mlongcall', |
| 135 | ], |
| 136 | 'cflags': [ |
Brian Silverman | 1579fc1 | 2013-04-22 15:41:55 -0700 | [diff] [blame] | 137 | # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both |
| 138 | # have MPC603e cores according to Freescale docs. |
| 139 | '-mcpu=603e', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 140 | '-mstrict-align', |
| 141 | '-mlongcall', |
Brian Silverman | 823f324 | 2013-11-17 13:20:22 -0800 | [diff] [blame] | 142 | '-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/', |
| 143 | '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/', |
| 144 | '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/', |
| 145 | '-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] | 146 | '-isystem', '<(WIND_BASE)/target/h', |
| 147 | '-isystem', '<(WIND_BASE)/target/h/wrn/coreip', |
| 148 | ], |
Brian Silverman | 6e20668 | 2013-08-31 11:43:35 -0700 | [diff] [blame] | 149 | 'cflags_cc': [ |
| 150 | '-std=gnu++0x', |
| 151 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 152 | 'defines': [ |
| 153 | 'CPU=PPC603', |
| 154 | 'TOOL_FAMILY=gnu', |
| 155 | 'TOOL=gnu', |
| 156 | '_WRS_KERNEL', |
| 157 | '__PPC__', |
| 158 | # This tells eigen to not do anything with alignment at all. See |
| 159 | # <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for |
| 160 | # details. It really doesn't like to work without this. |
| 161 | 'EIGEN_DONT_ALIGN', |
| 162 | # prevent the vxworks system headers from being dumb and #defining min and max |
| 163 | 'NOMINMAX', |
| 164 | ], |
| 165 | }, { |
| 166 | 'variables': { |
| 167 | 'no_rsync%': 0, |
| 168 | }, |
| 169 | 'target_conditions': [ |
| 170 | # default to putting outputs into rsync_dir |
| 171 | ['no_rsync==0 and _type!="static_library"', { |
| 172 | 'product_dir': '<(rsync_dir)', |
| 173 | }, |
| 174 | ], |
| 175 | ['_type=="loadable_module"', { |
| 176 | 'product_dir': '<(so_dir)', |
| 177 | } |
| 178 | ], |
| 179 | ['_type=="loadable_module" or _type=="shared_library"', { |
| 180 | 'ldflags': [ |
| 181 | # Support loading other shared objects that are in the same directory but not |
| 182 | # the shared object load path. Required for using the swig-generated libs. |
| 183 | '-Wl,-rpath=\\$$ORIGIN', |
| 184 | ], |
| 185 | } |
| 186 | ], |
| 187 | ], |
| 188 | 'ldflags': [ |
| 189 | '-pthread', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 190 | ], |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 191 | 'cflags': [ |
| 192 | '-pthread', |
Brian Silverman | 6e20668 | 2013-08-31 11:43:35 -0700 | [diff] [blame] | 193 | |
| 194 | '-Wunused-local-typedefs', |
| 195 | |
| 196 | # Give macro stack traces when they blow up. |
Brian Silverman | 86db2a5 | 2013-09-14 15:32:25 -0700 | [diff] [blame] | 197 | # TODO(brians): Re-enable this once they fix the bug where it |
| 198 | # sometimes doesn't show you the top-most (aka most useful) |
| 199 | # line of code. |
| 200 | #'-ftrack-macro-expansion', |
Brian Silverman | 6e20668 | 2013-08-31 11:43:35 -0700 | [diff] [blame] | 201 | ], |
| 202 | 'cflags_cc': [ |
| 203 | '-std=gnu++11', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 204 | ], |
| 205 | 'defines': [ |
Brian Silverman | efb993f | 2013-08-30 19:52:57 -0700 | [diff] [blame] | 206 | '_FILE_OFFSET_BITS=64', |
brians | 343bc11 | 2013-02-10 01:53:46 +0000 | [diff] [blame] | 207 | ], |
| 208 | 'libraries': [ |
| 209 | '-lm', |
| 210 | '-lrt', |
| 211 | ], |
| 212 | } |
| 213 | ] |
| 214 | ], |
| 215 | }, |
| 216 | } |