Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / native_client / src / trusted / service_runtime / service_runtime.gyp
1 # -*- gyp -*-
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 {
7   'includes': [
8     '../../../build/common.gypi',
9   ],
10   'target_defaults': {
11     'variables':{
12       'target_base': 'none',
13     },
14     'target_conditions': [
15       ['target_base=="sel"', {
16         'sources': [
17           'dyn_array.c',
18           'elf_util.c',
19           'load_file.c',
20           'nacl_all_modules.c',
21           'nacl_app_thread.c',
22           'nacl_bootstrap_channel_error_reporter.c',
23           'nacl_copy.c',
24           'nacl_desc_effector_ldr.c',
25           'nacl_desc_postmessage.c',
26           'nacl_error_gio.c',
27           'nacl_error_log_hook.c',
28           'nacl_globals.c',
29           'nacl_kernel_service.c',
30           'nacl_resource.c',
31           'nacl_reverse_host_interface.c',
32           'nacl_reverse_quota_interface.c',
33           'nacl_runtime_host_interface.c',
34           'nacl_secure_service.c',
35           'nacl_signal_common.c',
36           'nacl_stack_safety.c',
37           'nacl_syscall_common.c',
38           'nacl_syscall_hook.c',
39           'nacl_syscall_list.c',
40           'nacl_text.c',
41           'nacl_valgrind_hooks.c',
42           'name_service/name_service.c',
43           'sel_addrspace.c',
44           'sel_ldr.c',
45           'sel_ldr_standard.c',
46           'sel_ldr_thread_interface.c',
47           # TODO(mseaborn): Move sel_main_chrome.c to the
48           # "sel_main_chrome" library once Chromium is changed to
49           # depend on that rather than on "sel".
50           'sel_main_chrome.c',
51           'sel_main_common.c',
52           'sel_mem.c',
53           'sel_qualify.c',
54           'sel_validate_image.c',
55           'sys_exception.c',
56           'sys_fdio.c',
57           'sys_filename.c',
58           'sys_futex.c',
59           'sys_imc.c',
60           'sys_list_mappings.c',
61           'sys_memory.c',
62           'sys_parallel_io.c',
63           'sys_random.c',
64           'thread_suspension_common.c',
65           'thread_suspension_unwind.c',
66         ],
67         'include_dirs': [
68           # For generated header files from the x86-64 validator,
69           # e.g. nacl_disallows.h.
70           '<(SHARED_INTERMEDIATE_DIR)',
71         ],
72         'conditions': [
73             ['OS=="mac"', {
74               'sources': [
75                 'osx/crash_filter.c',
76                 'osx/mach_exception_handler.c',
77                 'osx/mach_thread_map.c',
78                 'osx/nacl_ldt.c',
79                 'osx/nacl_thread_nice.c',
80                 'osx/outer_sandbox.c',
81                 'osx/thread_suspension.c',
82                 'posix/addrspace_teardown.c',
83                 'posix/sel_memory.c',
84                 'posix/x86/sel_segments.c',
85               ],
86               'actions': [
87                 {
88                   'action_name': 'mig_exc_generation',
89                   'variables': {
90                     'gen_dir': '<(INTERMEDIATE_DIR)/native_client/src/trusted/service_runtime',
91                   },
92                   'inputs': [
93                     'osx/run_mig.py',
94                     '$(SDKROOT)/usr/include/mach/exc.defs',
95                   ],
96                   'outputs': [
97                     '<(gen_dir)/nacl_exc.h',
98                     '<(gen_dir)/nacl_exc_server.c',
99                   ],
100                   'process_outputs_as_sources': 1,
101                   'action': [
102                     'python', '<@(_inputs)', '<@(_outputs)',
103                   ],
104                   'message': 'Generating mig plumbing for exc.defs',
105                 },
106               ],
107               'include_dirs': [
108                 '<(INTERMEDIATE_DIR)',
109               ],
110             }],
111             ['OS=="win"', {
112               'sources': [
113                 'win/addrspace_teardown.c',
114                 'win/debug_exception_handler.c',
115                 'win/debug_exception_handler_standalone.c',
116                 'win/nacl_ldt.c',
117                 'win/nacl_thread_nice.c',
118                 'win/sel_memory.c',
119                 'win/sel_segments.c',
120                 'win/thread_handle_map.c',
121               ],
122             }],
123             # TODO(gregoryd): move arm-specific stuff into a separate gyp file.
124             ['target_arch=="arm"', {
125               'sources': [
126                 'arch/arm/nacl_app.c',
127                 'arch/arm/nacl_switch_to_app_arm.c',
128                 'arch/arm/sel_rt.c',
129                 'arch/arm/nacl_tls.c',
130                 'arch/arm/sel_ldr_arm.c',
131                 'arch/arm/sel_addrspace_arm.c',
132                 'arch/arm/nacl_switch.S',
133                 'arch/arm/nacl_syscall.S',
134                 'arch/arm/tramp_arm.S',
135                 'linux/nacl_signal_arm.c',
136               ],
137             }],
138             ['target_arch=="mipsel"', {
139               'sources': [
140                 'arch/mips/nacl_app.c',
141                 'arch/mips/nacl_switch.S',
142                 'arch/mips/nacl_switch_to_app_mips.c',
143                 'arch/mips/nacl_syscall.S',
144                 'arch/mips/nacl_tls.c',
145                 'arch/mips/sel_addrspace_mips.c',
146                 'arch/mips/sel_ldr_mips.c',
147                 'arch/mips/sel_rt.c',
148                 'arch/mips/tramp_mips.S',
149                 'linux/nacl_signal_mips.c',
150               ],
151             }],
152             ['OS=="linux" or OS=="android"', {
153               'sources': [
154                 'linux/nacl_bootstrap_args.c',
155                 'linux/nacl_thread_nice.c',
156                 'linux/r_debug.c',
157                 'linux/reserved_at_zero.c',
158                 'linux/thread_suspension.c',
159                 'posix/addrspace_teardown.c',
160                 'posix/sel_memory.c',
161               ],
162               'conditions': [
163                 ['target_arch=="ia32" or target_arch=="x64"', {
164                   'sources': [
165                     'linux/x86/nacl_ldt.c',
166                     'posix/x86/sel_segments.c',
167                   ],
168                 }],
169                 ['target_arch=="arm"', {
170                   'sources': [
171                     'linux/arm/sel_segments.c',
172                   ],
173                 }],
174                 ['target_arch=="mipsel"', {
175                   'sources': [
176                     'linux/mips/sel_segments.c',
177                   ],
178                 }],
179               ],
180             }],
181             ['<(os_posix)==1', {
182               'sources': [
183                 'posix/nacl_signal_stack.c',
184                 'posix/nacl_syscall_impl.c',
185                 'posix/sel_addrspace_posix.c',
186                ],
187             }],
188             ['OS=="win"', {
189               'sources': [
190                 'win/nacl_signal_stack.c',
191                 'win/nacl_syscall_impl.c',
192                 'win/sel_addrspace_win.c',
193                 'win/thread_suspension.c',
194                 'win/vm_hole.c',
195               ],
196             }],
197             ['OS!="win"', {
198               'sources': [
199                 'generic/vm_hole.c',
200               ],
201             }],
202           ],
203         }],
204       ],
205    },
206   'targets': [
207     {
208       'target_name': 'sel',
209       'type': 'static_library',
210       'variables': {
211         'target_base': 'sel',
212       },
213       'dependencies': [
214         'env_cleanser',
215         'nacl_error_code',
216         '<(DEPTH)/native_client/src/shared/gio/gio.gyp:gio',
217         '<(DEPTH)/native_client/src/shared/platform/platform.gyp:platform',
218         '<(DEPTH)/native_client/src/shared/srpc/srpc.gyp:nonnacl_srpc',
219         '<(DEPTH)/native_client/src/trusted/debug_stub/debug_stub.gyp:debug_stub',
220         '<(DEPTH)/native_client/src/trusted/desc/desc.gyp:nrd_xfer',
221         '<(DEPTH)/native_client/src/trusted/desc_cacheability/desc_cacheability.gyp:desc_cacheability',
222         '<(DEPTH)/native_client/src/trusted/fault_injection/fault_injection.gyp:nacl_fault_inject',
223         '<(DEPTH)/native_client/src/trusted/interval_multiset/interval_multiset.gyp:nacl_interval',
224         '<(DEPTH)/native_client/src/trusted/perf_counter/perf_counter.gyp:nacl_perf_counter',
225         '<(DEPTH)/native_client/src/trusted/platform_qualify/platform_qualify.gyp:platform_qual_lib',
226         '<(DEPTH)/native_client/src/trusted/manifest_name_service_proxy/manifest_name_service_proxy.gyp:manifest_proxy',
227         '<(DEPTH)/native_client/src/trusted/simple_service/simple_service.gyp:simple_service',
228         '<(DEPTH)/native_client/src/trusted/threading/threading.gyp:thread_interface',
229         '<(DEPTH)/native_client/src/trusted/validator/validator.gyp:validation_cache',
230         '<(DEPTH)/native_client/src/trusted/validator/validator.gyp:validators',
231       ],
232       'conditions': [
233         ['target_arch=="arm"', {
234           'dependencies': [
235             '<(DEPTH)/native_client/src/trusted/validator_arm/validator_arm.gyp:ncvalidate_arm_v2',
236           ],
237         }],
238         ['target_arch=="mipsel"', {
239           'dependencies': [
240             '<(DEPTH)/native_client/src/trusted/validator_mips/validator_mips.gyp:ncvalidate_mips',
241           ],
242         }],
243         ['target_arch=="ia32" or target_arch=="x64"', {
244           'dependencies': [
245             'arch/x86/service_runtime_x86.gyp:service_runtime_x86_common',
246           ],
247         }],
248         ['target_arch == "ia32"', {
249           'dependencies': [
250             'arch/x86_32/service_runtime_x86_32.gyp:service_runtime_x86_32',
251             '<(DEPTH)/native_client/src/trusted/validator_x86/validator_x86.gyp:nccopy_x86_32',
252           ],
253         }],
254         ['target_arch == "x64"', {
255           'dependencies': [
256             'arch/x86_64/service_runtime_x86_64.gyp:service_runtime_x86_64',
257             '<(DEPTH)/native_client/src/trusted/validator_x86/validator_x86.gyp:nccopy_x86_64',
258           ],
259         }],
260         ['OS=="linux" or OS=="FreeBSD" or OS=="android"', {
261           'dependencies': [
262             'nacl_signal',
263           ],
264         }],
265       ],
266     }, {
267       'target_name': 'nacl_error_code',
268       'type': 'static_library',
269       'sources': [
270         'nacl_error_code.c',
271       ],
272     }, {
273       'target_name': 'env_cleanser',
274       'type': 'static_library',
275       'sources': [
276         'env_cleanser.c',
277       ],
278     }, {
279       'target_name': 'sel_main_chrome',
280       'type': 'none',
281       'dependencies': [
282         'sel',
283       ],
284     }, {
285       'target_name': 'sel_main',
286       'type': 'static_library',
287       'sources': [
288         'sel_main.c',
289       ],
290       'dependencies': [
291         'sel',
292       ],
293     }, {
294       'target_name': 'sel_ldr',
295       'type': 'executable',
296       'dependencies': [
297         'sel_main',
298         '<(DEPTH)/native_client/src/shared/platform/platform.gyp:platform',
299       ],
300       'sources': [
301         'nacl_test_injection_main.c',
302         'force_cpp.cc',
303       ],
304       'conditions': [
305         ['OS=="linux" or OS=="android"', {
306           'dependencies': [
307             'linux/nacl_bootstrap.gyp:nacl_helper_bootstrap',
308           ],
309           'ldflags': [
310             '-pie',
311           ],
312         }],
313       ],
314     },
315   ],
316   'conditions': [
317     ['OS=="win" and target_arch=="ia32"', {
318       'targets': [
319         {
320           'target_name': 'sel64',
321           'type': 'static_library',
322           'variables': {
323             'target_base': 'sel',
324             'win_target': 'x64',
325           },
326           'dependencies': [
327             'env_cleanser64',
328             'nacl_error_code64',
329             '<(DEPTH)/native_client/src/shared/gio/gio.gyp:gio64',
330             '<(DEPTH)/native_client/src/shared/srpc/srpc.gyp:nonnacl_srpc64',
331             '<(DEPTH)/native_client/src/trusted/debug_stub/debug_stub.gyp:debug_stub64',
332             '<(DEPTH)/native_client/src/trusted/desc/desc.gyp:nrd_xfer64',
333             '<(DEPTH)/native_client/src/trusted/desc_cacheability/desc_cacheability.gyp:desc_cacheability64',
334             '<(DEPTH)/native_client/src/trusted/fault_injection/fault_injection.gyp:nacl_fault_inject64',
335             '<(DEPTH)/native_client/src/trusted/interval_multiset/interval_multiset.gyp:nacl_interval64',
336             '<(DEPTH)/native_client/src/trusted/perf_counter/perf_counter.gyp:nacl_perf_counter64',
337             '<(DEPTH)/native_client/src/trusted/platform_qualify/platform_qualify.gyp:platform_qual_lib64',
338             '<(DEPTH)/native_client/src/trusted/manifest_name_service_proxy/manifest_name_service_proxy.gyp:manifest_proxy64',
339             '<(DEPTH)/native_client/src/trusted/simple_service/simple_service.gyp:simple_service64',
340             '<(DEPTH)/native_client/src/trusted/threading/threading.gyp:thread_interface64',
341             '<(DEPTH)/native_client/src/trusted/validator_x86/validator_x86.gyp:nccopy_x86_64',
342             '<(DEPTH)/native_client/src/trusted/validator/validator.gyp:validation_cache64',
343             '<(DEPTH)/native_client/src/trusted/validator/validator.gyp:validators64',
344             'arch/x86/service_runtime_x86.gyp:service_runtime_x86_common64',
345             'arch/x86_64/service_runtime_x86_64.gyp:service_runtime_x86_64',
346           ],
347         }, {
348           'target_name': 'nacl_error_code64',
349           'type': 'static_library',
350           'variables': {
351             'win_target': 'x64',
352           },
353           'sources': [
354             'nacl_error_code.c',
355           ],
356         },
357         {
358           'target_name': 'env_cleanser64',
359           'type': 'static_library',
360           'variables': {
361             'win_target': 'x64',
362           },
363           'sources': [
364             'env_cleanser.c',
365           ],
366         },
367         {
368           'target_name': 'sel_main_chrome64',
369           'type': 'none',
370           'variables': {
371             'win_target': 'x64',
372           },
373           'dependencies': [
374             'sel64',
375           ],
376         },
377         {
378           'target_name': 'sel_main64',
379           'type': 'static_library',
380           'sources': [
381             'sel_main.c',
382           ],
383           'dependencies': [
384             'sel64',
385           ],
386           'variables': {
387             'win_target': 'x64',
388           },
389         },
390         {
391           'target_name': 'sel_ldr64',
392           'type': 'executable',
393           'variables': {
394             'win_target': 'x64',
395           },
396           'dependencies': [
397             'sel_main64',
398             '<(DEPTH)/native_client/src/shared/platform/platform.gyp:platform64',
399           ],
400           'sources': [
401             'nacl_test_injection_main.c',
402           ],
403         },
404       ],
405     }],
406     ['OS=="linux" or OS=="FreeBSD" or OS=="android"', {
407       'targets': [
408         {
409           # This has to be an independent target in order to benefit from
410           # specific flags.
411           'target_name': 'nacl_signal',
412           'type': 'static_library',
413           'conditions': [
414             ['target_arch=="ia32"', {
415               # nacl_signal.c needs to be compiled without the stack
416               # protector on i386.
417               # See https://code.google.com/p/nativeclient/issues/detail?id=3581.
418               'cflags!': [
419                 '-fstack-protector',
420                 '-fstack-protector-all',
421               ],
422               'cflags': [
423                 '-fno-stack-protector',
424               ],
425             }],
426           ],
427           'sources': [
428             'linux/nacl_signal.c',
429           ],
430         },
431       ],
432     }],
433   ],
434 }