blob: 9dc2f5104994f1d527a4288766f34cb520af92bc [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': [
20 ['OS=="crio"', {
21 '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 Silverman41abe012014-02-08 18:25:02 -080026 'conditions': [
27 ['PLATFORM!="linux-amd64"', {
28 'make_global_settings': [
29 ['CC', '<!(which arm-linux-gnueabihf-gcc-4.7)'],
30 ['CXX', '<!(which arm-linux-gnueabihf-g++-4.7)'],
31 ],
32 },
33 ],
Brian Silverman63cf2412013-11-17 05:44:36 -080034 ],
brians343bc112013-02-10 01:53:46 +000035 }
36 ],
37 ],
38 'target_defaults': {
39 'defines': [
40 '__STDC_FORMAT_MACROS',
41 '_FORTIFY_SOURCE=2',
Brian Silverman6137a502013-04-22 15:41:36 -070042 '__STDC_CONSTANT_MACROS',
43 '__STDC_LIMIT_MACROS',
brians343bc112013-02-10 01:53:46 +000044 ],
45 'ldflags': [
46 '-pipe',
47 ],
48 'cflags': [
49 '-pipe',
50
51 '-Wall',
52 '-Wextra',
53 '-Wswitch-enum',
54 '-Wpointer-arith',
55 '-Wstrict-aliasing=2',
56 '-Wcast-qual',
57 '-Wcast-align',
58 '-Wwrite-strings',
59 '-Wtype-limits',
60 '-Wsign-compare',
61 '-Wformat=2',
62 '-Werror',
Brian Silverman9ba2bc42013-03-17 14:18:33 -070063
64 '-ggdb3',
brians343bc112013-02-10 01:53:46 +000065 ],
66 'cflags_c': [
67 '-std=gnu99',
68 ],
brians343bc112013-02-10 01:53:46 +000069 'include_dirs': [
70 '<(DEPTH)',
71 ],
Brian Silvermand0a52dc2013-09-23 17:55:37 -070072 # These have to be here because apparently gyp evaluates target_conditions
73 # even if the target is never used.
74 'variables': {
75 # Set this to 1 to disable rsyncing the file to the target.
76 'no_rsync%': 0,
Brian Silverman2a36ddb2014-04-08 17:07:28 -070077 # Set this to 1 if this file is a test that should not be run by
Brian Silvermand0a52dc2013-09-23 17:55:37 -070078 # `build.sh tests`.
79 'is_special_test%': 0,
80 },
brians343bc112013-02-10 01:53:46 +000081 'conditions': [
82 ['DEBUG=="yes"', {
83 'cflags': [
brians343bc112013-02-10 01:53:46 +000084 '-O0',
85 ],
brians343bc112013-02-10 01:53:46 +000086 }, {
87 'cflags': [
88 '-O3',
Brian Silverman2a36ddb2014-04-08 17:07:28 -070089 '-fomit-frame-pointer',
brians343bc112013-02-10 01:53:46 +000090 ],
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 Silverman41abe012014-02-08 18:25:02 -0800106 }],
107 ['PLATFORM=="linux-amd64"', {
108 'cflags': [
109 '-march=atom',
110 '-mfpmath=sse',
111
112 '-fstack-protector-all',
113 ],
114 }],
115 ]
brians343bc112013-02-10 01:53:46 +0000116 }
117 ],
118 ['OS=="crio"', {
119 'target_conditions': [
120 ['_type=="shared_library"', {
121 'ldflags': [
122 '-r',
123 '-nostdlib',
124 '-Wl,-X',
125 ],
126 }
127 ],
128 ],
129 'ldflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700130 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000131 '-mstrict-align',
132 '-mlongcall',
133 ],
134 'cflags': [
Brian Silverman1579fc12013-04-22 15:41:55 -0700135 # The Freescale MPC5200B (cRIO-FRC) and MPC5125 (cRIO-FRC II) both
136 # have MPC603e cores according to Freescale docs.
137 '-mcpu=603e',
brians343bc112013-02-10 01:53:46 +0000138 '-mstrict-align',
139 '-mlongcall',
Brian Silverman823f3242013-11-17 13:20:22 -0800140 '-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/',
141 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/vxworks-6.3/target/h/',
142 '-isystem', '<(aos_abs)/../output/downloaded/gccdist/WindRiver/gnu/3.4.4-vxworks-6.3/x86-win32/include/c++/3.4.4/',
143 '-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 +0000144 '-isystem', '<(WIND_BASE)/target/h',
145 '-isystem', '<(WIND_BASE)/target/h/wrn/coreip',
146 ],
Brian Silverman6e206682013-08-31 11:43:35 -0700147 'cflags_cc': [
148 '-std=gnu++0x',
149 ],
brians343bc112013-02-10 01:53:46 +0000150 'defines': [
151 'CPU=PPC603',
152 'TOOL_FAMILY=gnu',
153 'TOOL=gnu',
154 '_WRS_KERNEL',
155 '__PPC__',
156# This tells eigen to not do anything with alignment at all. See
157# <http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html> for
158# details. It really doesn't like to work without this.
159 'EIGEN_DONT_ALIGN',
160# prevent the vxworks system headers from being dumb and #defining min and max
161 'NOMINMAX',
162 ],
163 }, {
brians343bc112013-02-10 01:53:46 +0000164 'target_conditions': [
165# default to putting outputs into rsync_dir
166 ['no_rsync==0 and _type!="static_library"', {
167 'product_dir': '<(rsync_dir)',
168 },
169 ],
170 ['_type=="loadable_module"', {
171 'product_dir': '<(so_dir)',
172 }
173 ],
brians343bc112013-02-10 01:53:46 +0000174 ],
175 'ldflags': [
176 '-pthread',
brians343bc112013-02-10 01:53:46 +0000177 ],
brians343bc112013-02-10 01:53:46 +0000178 'cflags': [
179 '-pthread',
Brian Silverman6e206682013-08-31 11:43:35 -0700180
181 '-Wunused-local-typedefs',
182
183 # Give macro stack traces when they blow up.
Brian Silverman86db2a52013-09-14 15:32:25 -0700184 # TODO(brians): Re-enable this once they fix the bug where it
185 # sometimes doesn't show you the top-most (aka most useful)
186 # line of code.
187 #'-ftrack-macro-expansion',
Brian Silverman6e206682013-08-31 11:43:35 -0700188 ],
189 'cflags_cc': [
190 '-std=gnu++11',
brians343bc112013-02-10 01:53:46 +0000191 ],
192 'defines': [
Brian Silvermanefb993f2013-08-30 19:52:57 -0700193 '_FILE_OFFSET_BITS=64',
brians343bc112013-02-10 01:53:46 +0000194 ],
195 'libraries': [
196 '-lm',
197 '-lrt',
198 ],
199 }
200 ]
201 ],
202 },
203}