blob: 144bffb39e9496365720a16396872fc336e46473 [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',
Brian Silverman14fd0fb2014-01-14 21:42:01 -080018# 'executable' for linux and 'static_library' for the cRIO
brians343bc112013-02-10 01:53:46 +000019# 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 Silvermana67ecc72013-09-28 13:53:53 -070026 ['CC', '<!(readlink -f <(AOS)/build/crio_cc)'],
27 ['CXX', '<!(readlink -f <(AOS)/build/crio_cxx)'],
brians343bc112013-02-10 01:53:46 +000028 ],
29 'variables': {
30 'aos_target': 'static_library',
31 },
32 }, {
Brian Silverman41abe012014-02-08 18:25:02 -080033 '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 Silverman63cf2412013-11-17 05:44:36 -080041 ],
brians343bc112013-02-10 01:53:46 +000042 'variables': {
43 'aos_target': 'executable',
44 },
45 }
46 ],
47 ],
48 'target_defaults': {
49 'defines': [
50 '__STDC_FORMAT_MACROS',
51 '_FORTIFY_SOURCE=2',
Brian Silverman6137a502013-04-22 15:41:36 -070052 '__STDC_CONSTANT_MACROS',
53 '__STDC_LIMIT_MACROS',
brians343bc112013-02-10 01:53:46 +000054 ],
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 Silverman9ba2bc42013-03-17 14:18:33 -070073
74 '-ggdb3',
brians343bc112013-02-10 01:53:46 +000075 ],
76 'cflags_c': [
77 '-std=gnu99',
78 ],
brians343bc112013-02-10 01:53:46 +000079 'include_dirs': [
80 '<(DEPTH)',
81 ],
82 'conditions': [
83 ['DEBUG=="yes"', {
84 'cflags': [
brians343bc112013-02-10 01:53:46 +000085 '-O0',
86 ],
brians343bc112013-02-10 01:53:46 +000087 }, {
88 'cflags': [
89 '-O3',
90 ],
Brian Silvermanefb993f2013-08-30 19:52:57 -070091 'ldflags': [
92 '-O3',
93 ],
brians343bc112013-02-10 01:53:46 +000094 'conditions': [['OS=="crio"', {
95 'cflags': [
96 '-fstrength-reduce',
97 '-fno-builtin',
98 '-fno-strict-aliasing',
99 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800100 }],
101 ['PLATFORM=="linux"', {
brians343bc112013-02-10 01:53:46 +0000102 'cflags': [
Brian Silvermanc4321322013-11-18 17:38:39 -0800103 '-mcpu=cortex-a8',
Brian Silverman46203612013-11-19 18:01:41 -0800104 '-mfpu=neon',
brians343bc112013-02-10 01:53:46 +0000105
Brian Silverman9d1165c2013-09-01 16:46:29 -0700106 '-fstack-protector-all',
brians343bc112013-02-10 01:53:46 +0000107 ],
Brian Silverman41abe012014-02-08 18:25:02 -0800108 }],
109 ['PLATFORM=="linux-amd64"', {
110 'cflags': [
111 '-march=atom',
112 '-mfpmath=sse',
113
114 '-fstack-protector-all',
115 ],
116 }],
117 ]
brians343bc112013-02-10 01:53:46 +0000118 }
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 Silverman1579fc12013-04-22 15:41:55 -0700132 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000133 '-mstrict-align',
134 '-mlongcall',
135 ],
136 'cflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700137 # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both
138 # have MPC603e cores according to Freescale docs.
139 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000140 '-mstrict-align',
141 '-mlongcall',
Brian Silverman823f3242013-11-17 13:20:22 -0800142 '-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/',
brians343bc112013-02-10 01:53:46 +0000146 '-isystem', '<(WIND_BASE)/target/h',
147 '-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
148 ],
Brian Silverman6e206682013-08-31 11:43:35 -0700149 'cflags_cc': [
150 '-std=gnu++0x',
151 ],
brians343bc112013-02-10 01:53:46 +0000152 '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',
brians343bc112013-02-10 01:53:46 +0000190 ],
brians343bc112013-02-10 01:53:46 +0000191 'cflags': [
192 '-pthread',
Brian Silverman6e206682013-08-31 11:43:35 -0700193
194 '-Wunused-local-typedefs',
195
196 # Give macro stack traces when they blow up.
Brian Silverman86db2a52013-09-14 15:32:25 -0700197 # 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 Silverman6e206682013-08-31 11:43:35 -0700201 ],
202 'cflags_cc': [
203 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000204 ],
205 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700206 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000207 ],
208 'libraries': [
209 '-lm',
210 '-lrt',
211 ],
212 }
213 ]
214 ],
215 },
216}