• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{
2  'variables': {
3    'v8_use_siphash%': 0,
4    'v8_trace_maps%': 0,
5    'v8_enable_pointer_compression%': 0,
6    'v8_enable_31bit_smis_on_64bit_arch%': 0,
7    'node_use_dtrace%': 'false',
8    'node_use_etw%': 'false',
9    'node_no_browser_globals%': 'false',
10    'node_snapshot_main%': '',
11    'node_use_node_snapshot%': 'false',
12    'node_use_v8_platform%': 'true',
13    'node_use_bundled_v8%': 'true',
14    'node_shared%': 'false',
15    'force_dynamic_crt%': 0,
16    'ossfuzz' : 'false',
17    'node_module_version%': '',
18    'node_shared_brotli%': 'false',
19    'node_shared_zlib%': 'false',
20    'node_shared_http_parser%': 'false',
21    'node_shared_cares%': 'false',
22    'node_shared_libuv%': 'false',
23    'node_shared_nghttp2%': 'false',
24    'node_use_openssl%': 'true',
25    'node_shared_openssl%': 'false',
26    'node_v8_options%': '',
27    'node_enable_v8_vtunejit%': 'false',
28    'node_core_target_name%': 'node',
29    'node_lib_target_name%': 'libnode',
30    'node_intermediate_lib_type%': 'static_library',
31    'node_builtin_modules_path%': '',
32    # We list the deps/ files out instead of globbing them in js2c.py since we
33    # only include a subset of all the files under these directories.
34    # The lengths of their file names combined should not exceed the
35    # Windows command length limit or there would be an error.
36    # See https://docs.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation
37    'library_files': [
38      '<@(node_library_files)',
39    ],
40    'deps_files': [
41      'deps/v8/tools/splaytree.mjs',
42      'deps/v8/tools/codemap.mjs',
43      'deps/v8/tools/consarray.mjs',
44      'deps/v8/tools/csvparser.mjs',
45      'deps/v8/tools/profile.mjs',
46      'deps/v8/tools/profile_view.mjs',
47      'deps/v8/tools/logreader.mjs',
48      'deps/v8/tools/arguments.mjs',
49      'deps/v8/tools/tickprocessor.mjs',
50      'deps/v8/tools/sourcemap.mjs',
51      'deps/v8/tools/tickprocessor-driver.mjs',
52      'deps/acorn/acorn/dist/acorn.js',
53      'deps/acorn/acorn-walk/dist/walk.js',
54      'deps/minimatch/index.js',
55      '<@(node_builtin_shareable_builtins)',
56    ],
57    'node_mksnapshot_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)node_mksnapshot<(EXECUTABLE_SUFFIX)',
58    'conditions': [
59      ['GENERATOR == "ninja"', {
60        'node_text_start_object_path': 'src/large_pages/node_text_start.node_text_start.o'
61      }, {
62        'node_text_start_object_path': 'node_text_start/src/large_pages/node_text_start.o'
63      }],
64      [ 'node_shared=="true"', {
65        'node_target_type%': 'shared_library',
66        'conditions': [
67          ['OS in "aix os400"', {
68            # For AIX, always generate static library first,
69            # It needs an extra step to generate exp and
70            # then use both static lib and exp to create
71            # shared lib.
72            'node_intermediate_lib_type': 'static_library',
73          }, {
74            'node_intermediate_lib_type': 'shared_library',
75          }],
76        ],
77      }, {
78        'node_target_type%': 'executable',
79      }],
80      [ 'OS=="win" and '
81        'node_use_openssl=="true" and '
82        'node_shared_openssl=="false"', {
83        'use_openssl_def%': 1,
84      }, {
85        'use_openssl_def%': 0,
86      }],
87    ],
88  },
89
90  'target_defaults': {
91    # Putting these explicitly here so not to depend on `common.gypi`.
92    # `common.gypi` need to be more general because it is used to build userland native addons.
93    # Refs: https://github.com/nodejs/node-gyp/issues/1118
94    'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
95    'xcode_settings': {
96      'WARNING_CFLAGS': [
97        '-Wall',
98        '-Wendif-labels',
99        '-W',
100        '-Wno-unused-parameter',
101        '-Werror=undefined-inline',
102        '-Werror=extra-semi',
103      ],
104    },
105
106    # Relevant only for x86.
107    # Refs: https://github.com/nodejs/node/pull/25852
108    # Refs: https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers
109    'msvs_settings': {
110      'VCLinkerTool': {
111        'ImageHasSafeExceptionHandlers': 'false',
112      },
113    },
114
115    'conditions': [
116      ['OS in "aix os400"', {
117        'ldflags': [
118          '-Wl,-bnoerrmsg',
119        ],
120      }],
121      ['OS == "linux" and llvm_version != "0.0"', {
122        'libraries': ['-latomic'],
123      }],
124    ],
125  },
126
127  'targets': [
128    {
129      'target_name': 'node_text_start',
130      'type': 'none',
131      'conditions': [
132        [ 'OS in "linux freebsd solaris" and '
133          'target_arch=="x64"', {
134          'type': 'static_library',
135          'sources': [
136            'src/large_pages/node_text_start.S'
137          ]
138        }],
139      ]
140    },
141    {
142      'target_name': '<(node_core_target_name)',
143      'type': 'executable',
144
145      'defines': [
146        'NODE_ARCH="<(target_arch)"',
147        'NODE_PLATFORM="<(OS)"',
148        'NODE_WANT_INTERNALS=1',
149      ],
150
151      'includes': [
152        'node.gypi'
153      ],
154
155      'include_dirs': [
156        'src',
157        'deps/v8/include',
158        'deps/postject'
159      ],
160
161      'sources': [
162        'src/node_main.cc'
163      ],
164
165      'dependencies': [
166        'deps/histogram/histogram.gyp:histogram',
167        'deps/uvwasi/uvwasi.gyp:uvwasi',
168      ],
169
170      'msvs_settings': {
171        'VCLinkerTool': {
172          'GenerateMapFile': 'true', # /MAP
173          'MapExports': 'true', # /MAPINFO:EXPORTS
174          'RandomizedBaseAddress': 2, # enable ASLR
175          'DataExecutionPrevention': 2, # enable DEP
176          'AllowIsolation': 'true',
177          # By default, the MSVC linker only reserves 1 MiB of stack memory for
178          # each thread, whereas other platforms typically allow much larger
179          # stack memory sections. We raise the limit to make it more consistent
180          # across platforms and to support the few use cases that require large
181          # amounts of stack memory, without having to modify the node binary.
182          'StackReserveSize': 0x800000,
183        },
184      },
185
186      # - "C4244: conversion from 'type1' to 'type2', possible loss of data"
187      #   Ususaly safe. Disable for `dep`, enable for `src`
188      'msvs_disabled_warnings!': [4244],
189
190      'conditions': [
191        [ 'error_on_warn=="true"', {
192          'cflags': ['-Werror'],
193          'xcode_settings': {
194            'WARNING_CFLAGS': [ '-Werror' ],
195          },
196        }],
197        [ 'node_intermediate_lib_type=="static_library" and '
198            'node_shared=="true" and OS in "aix os400"', {
199          # For AIX, shared lib is linked by static lib and .exp. In the
200          # case here, the executable needs to link to shared lib.
201          # Therefore, use 'node_aix_shared' target to generate the
202          # shared lib and then executable.
203          'dependencies': [ 'node_aix_shared' ],
204        }, {
205          'dependencies': [ '<(node_lib_target_name)' ],
206          'conditions': [
207            ['OS=="win" and node_shared=="true"', {
208              'dependencies': ['generate_node_def'],
209              'msvs_settings': {
210                'VCLinkerTool': {
211                  'ModuleDefinitionFile': '<(PRODUCT_DIR)/<(node_core_target_name).def',
212                },
213              },
214            }],
215          ],
216        }],
217        [ 'node_intermediate_lib_type=="static_library" and node_shared=="false"', {
218          'xcode_settings': {
219            'OTHER_LDFLAGS': [
220              '-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
221              '-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)',
222            ],
223          },
224          'msvs_settings': {
225            'VCLinkerTool': {
226              'AdditionalOptions': [
227                '/WHOLEARCHIVE:<(node_lib_target_name)<(STATIC_LIB_SUFFIX)',
228                '/WHOLEARCHIVE:<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)',
229              ],
230            },
231          },
232          'conditions': [
233            ['OS != "aix" and OS != "os400" and OS != "mac" and OS != "ios"', {
234              'ldflags': [
235                '-Wl,--whole-archive',
236                '<(obj_dir)/<(STATIC_LIB_PREFIX)<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
237                '<(obj_dir)/tools/v8_gypfiles/<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)',
238                '-Wl,--no-whole-archive',
239              ],
240            }],
241            [ 'OS=="win"', {
242              'sources': [ 'src/res/node.rc' ],
243              'conditions': [
244                [ 'node_use_etw=="true"', {
245                  'sources': [
246                    'tools/msvs/genfiles/node_etw_provider.rc'
247                  ],
248                }],
249              ],
250            }],
251          ],
252        }],
253        [ 'node_shared=="true"', {
254          'xcode_settings': {
255            'OTHER_LDFLAGS': [ '-Wl,-rpath,@loader_path', '-Wl,-rpath,@loader_path/../lib'],
256          },
257          'conditions': [
258            ['OS=="linux"', {
259               'ldflags': [
260                 '-Wl,-rpath,\\$$ORIGIN/../lib'
261               ],
262            }],
263          ],
264        }],
265        [ 'enable_lto=="true"', {
266          'xcode_settings': {
267            'OTHER_LDFLAGS': [
268              # man ld -export_dynamic:
269              # Preserves all global symbols in main executables during LTO.
270              # Without this option, Link Time Optimization is allowed to
271              # inline and remove global functions. This option is used when
272              # a main executable may load a plug-in which requires certain
273              # symbols from the main executable.
274              '-Wl,-export_dynamic',
275            ],
276          },
277        }],
278        ['OS=="win"', {
279          'libraries': [
280            'Dbghelp.lib',
281            'winmm.lib',
282            'Ws2_32.lib',
283          ],
284        }],
285        ['node_with_ltcg=="true"', {
286          'msvs_settings': {
287            'VCCLCompilerTool': {
288              'WholeProgramOptimization': 'true'   # /GL, whole program optimization, needed for LTCG
289            },
290            'VCLibrarianTool': {
291              'AdditionalOptions': [
292                '/LTCG:INCREMENTAL',               # link time code generation
293              ],
294            },
295            'VCLinkerTool': {
296              'OptimizeReferences': 2,             # /OPT:REF
297              'EnableCOMDATFolding': 2,            # /OPT:ICF
298              'LinkIncremental': 1,                # disable incremental linking
299              'AdditionalOptions': [
300                '/LTCG:INCREMENTAL',               # incremental link-time code generation
301              ],
302            }
303          }
304        }, {
305          'msvs_settings': {
306            'VCCLCompilerTool': {
307              'WholeProgramOptimization': 'false'
308            },
309            'VCLinkerTool': {
310              'LinkIncremental': 2                 # enable incremental linking
311            },
312          },
313         }],
314         ['node_use_node_snapshot=="true"', {
315          'dependencies': [
316            'node_mksnapshot',
317          ],
318          'conditions': [
319            ['node_snapshot_main!=""', {
320              'actions': [
321                {
322                  'action_name': 'node_mksnapshot',
323                  'process_outputs_as_sources': 1,
324                  'inputs': [
325                    '<(node_mksnapshot_exec)',
326                    '<(node_snapshot_main)',
327                  ],
328                  'outputs': [
329                    '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc',
330                  ],
331                  'action': [
332                    '<(node_mksnapshot_exec)',
333                    '--build-snapshot',
334                    '<(node_snapshot_main)',
335                    '<@(_outputs)',
336                  ],
337                },
338              ],
339            }, {
340              'actions': [
341                {
342                  'action_name': 'node_mksnapshot',
343                  'process_outputs_as_sources': 1,
344                  'inputs': [
345                    '<(node_mksnapshot_exec)',
346                  ],
347                  'outputs': [
348                    '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc',
349                  ],
350                  'action': [
351                    '<@(_inputs)',
352                    '<@(_outputs)',
353                  ],
354                },
355              ],
356            }],
357          ],
358          }, {
359          'sources': [
360            'src/node_snapshot_stub.cc'
361          ],
362        }],
363        [ 'OS in "linux freebsd" and '
364          'target_arch=="x64"', {
365          'dependencies': [ 'node_text_start' ],
366          'ldflags+': [
367            '<(obj_dir)/<(node_text_start_object_path)'
368          ]
369        }],
370
371        ['node_fipsinstall=="true"', {
372          'variables': {
373            'openssl-cli': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)openssl-cli<(EXECUTABLE_SUFFIX)',
374            'provider_name': 'libopenssl-fipsmodule',
375            'opensslconfig': './deps/openssl/nodejs-openssl.cnf',
376            'conditions': [
377              ['GENERATOR == "ninja"', {
378	        'fipsmodule_internal': '<(PRODUCT_DIR)/lib/<(provider_name).so',
379                'fipsmodule': '<(PRODUCT_DIR)/obj/lib/openssl-modules/fips.so',
380                'fipsconfig': '<(PRODUCT_DIR)/obj/lib/fipsmodule.cnf',
381                'opensslconfig_internal': '<(PRODUCT_DIR)/obj/lib/openssl.cnf',
382             }, {
383	        'fipsmodule_internal': '<(PRODUCT_DIR)/obj.target/deps/openssl/<(provider_name).so',
384                'fipsmodule': '<(PRODUCT_DIR)/obj.target/deps/openssl/lib/openssl-modules/fips.so',
385                'fipsconfig': '<(PRODUCT_DIR)/obj.target/deps/openssl/fipsmodule.cnf',
386                'opensslconfig_internal': '<(PRODUCT_DIR)/obj.target/deps/openssl/openssl.cnf',
387             }],
388            ],
389          },
390          'actions': [
391            {
392              'action_name': 'fipsinstall',
393              'process_outputs_as_sources': 1,
394              'inputs': [
395                '<(fipsmodule_internal)',
396              ],
397              'outputs': [
398                '<(fipsconfig)',
399              ],
400              'action': [
401                '<(openssl-cli)', 'fipsinstall',
402                '-provider_name', '<(provider_name)',
403                '-module', '<(fipsmodule_internal)',
404                '-out', '<(fipsconfig)',
405                #'-quiet',
406              ],
407            },
408            {
409              'action_name': 'copy_fips_module',
410              'inputs': [
411                '<(fipsmodule_internal)',
412              ],
413              'outputs': [
414                '<(fipsmodule)',
415              ],
416              'action': [
417                'python', 'tools/copyfile.py',
418                '<(fipsmodule_internal)',
419                '<(fipsmodule)',
420              ],
421            },
422            {
423              'action_name': 'copy_openssl_cnf_and_include_fips_cnf',
424              'inputs': [ '<(opensslconfig)', ],
425              'outputs': [ '<(opensslconfig_internal)', ],
426              'action': [
427                'python', 'tools/enable_fips_include.py',
428                '<(opensslconfig)',
429                '<(opensslconfig_internal)',
430                '<(fipsconfig)',
431              ],
432            },
433          ],
434         }, {
435           'variables': {
436              'opensslconfig_internal': '<(obj_dir)/deps/openssl/openssl.cnf',
437              'opensslconfig': './deps/openssl/nodejs-openssl.cnf',
438           },
439           'actions': [
440             {
441               'action_name': 'reset_openssl_cnf',
442               'inputs': [ '<(opensslconfig)', ],
443               'outputs': [ '<(opensslconfig_internal)', ],
444               'action': [
445                 '<(python)', 'tools/copyfile.py',
446                 '<(opensslconfig)',
447                 '<(opensslconfig_internal)',
448               ],
449             },
450           ],
451         }],
452      ],
453    }, # node_core_target_name
454    {
455      'target_name': '<(node_lib_target_name)',
456      'type': '<(node_intermediate_lib_type)',
457      'includes': [
458        'node.gypi',
459      ],
460
461      'include_dirs': [
462        'src',
463        'deps/postject',
464        '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
465      ],
466      'dependencies': [
467        'deps/base64/base64.gyp:base64',
468        'deps/googletest/googletest.gyp:gtest_prod',
469        'deps/histogram/histogram.gyp:histogram',
470        'deps/uvwasi/uvwasi.gyp:uvwasi',
471        'deps/simdutf/simdutf.gyp:simdutf',
472        'deps/ada/ada.gyp:ada',
473      ],
474
475      'sources': [
476        'src/api/async_resource.cc',
477        'src/api/callback.cc',
478        'src/api/embed_helpers.cc',
479        'src/api/encoding.cc',
480        'src/api/environment.cc',
481        'src/api/exceptions.cc',
482        'src/api/hooks.cc',
483        'src/api/utils.cc',
484        'src/async_wrap.cc',
485        'src/base_object.cc',
486        'src/cares_wrap.cc',
487        'src/cleanup_queue.cc',
488        'src/connect_wrap.cc',
489        'src/connection_wrap.cc',
490        'src/debug_utils.cc',
491        'src/env.cc',
492        'src/fs_event_wrap.cc',
493        'src/handle_wrap.cc',
494        'src/heap_utils.cc',
495        'src/histogram.cc',
496        'src/js_native_api.h',
497        'src/js_native_api_types.h',
498        'src/js_native_api_v8.cc',
499        'src/js_native_api_v8.h',
500        'src/js_native_api_v8_internals.h',
501        'src/js_stream.cc',
502        'src/json_utils.cc',
503        'src/js_udp_wrap.cc',
504        'src/module_wrap.cc',
505        'src/node.cc',
506        'src/node_api.cc',
507        'src/node_binding.cc',
508        'src/node_blob.cc',
509        'src/node_buffer.cc',
510        'src/node_builtins.cc',
511        'src/node_config.cc',
512        'src/node_constants.cc',
513        'src/node_contextify.cc',
514        'src/node_credentials.cc',
515        'src/node_dir.cc',
516        'src/node_env_var.cc',
517        'src/node_errors.cc',
518        'src/node_external_reference.cc',
519        'src/node_file.cc',
520        'src/node_http_parser.cc',
521        'src/node_http2.cc',
522        'src/node_i18n.cc',
523        'src/node_main_instance.cc',
524        'src/node_messaging.cc',
525        'src/node_metadata.cc',
526        'src/node_options.cc',
527        'src/node_os.cc',
528        'src/node_perf.cc',
529        'src/node_platform.cc',
530        'src/node_postmortem_metadata.cc',
531        'src/node_process_events.cc',
532        'src/node_process_methods.cc',
533        'src/node_process_object.cc',
534        'src/node_realm.cc',
535        'src/node_report.cc',
536        'src/node_report_module.cc',
537        'src/node_report_utils.cc',
538        'src/node_sea.cc',
539        'src/node_serdes.cc',
540        'src/node_shadow_realm.cc',
541        'src/node_snapshotable.cc',
542        'src/node_sockaddr.cc',
543        'src/node_stat_watcher.cc',
544        'src/node_symbols.cc',
545        'src/node_task_queue.cc',
546        'src/node_trace_events.cc',
547        'src/node_types.cc',
548        'src/node_url.cc',
549        'src/node_util.cc',
550        'src/node_v8.cc',
551        'src/node_wasi.cc',
552        'src/node_wasm_web_api.cc',
553        'src/node_watchdog.cc',
554        'src/node_worker.cc',
555        'src/node_zlib.cc',
556        'src/pipe_wrap.cc',
557        'src/process_wrap.cc',
558        'src/signal_wrap.cc',
559        'src/spawn_sync.cc',
560        'src/stream_base.cc',
561        'src/stream_pipe.cc',
562        'src/stream_wrap.cc',
563        'src/string_bytes.cc',
564        'src/string_decoder.cc',
565        'src/tcp_wrap.cc',
566        'src/timers.cc',
567        'src/timer_wrap.cc',
568        'src/tracing/agent.cc',
569        'src/tracing/node_trace_buffer.cc',
570        'src/tracing/node_trace_writer.cc',
571        'src/tracing/trace_event.cc',
572        'src/tracing/traced_value.cc',
573        'src/tty_wrap.cc',
574        'src/udp_wrap.cc',
575        'src/util.cc',
576        'src/uv.cc',
577        # headers to make for a more pleasant IDE experience
578        'src/aliased_buffer.h',
579        'src/aliased_struct.h',
580        'src/aliased_struct-inl.h',
581        'src/async_wrap.h',
582        'src/async_wrap-inl.h',
583        'src/base_object.h',
584        'src/base_object-inl.h',
585        'src/base64.h',
586        'src/base64-inl.h',
587        'src/callback_queue.h',
588        'src/callback_queue-inl.h',
589        'src/cleanup_queue.h',
590        'src/cleanup_queue-inl.h',
591        'src/connect_wrap.h',
592        'src/connection_wrap.h',
593        'src/debug_utils.h',
594        'src/debug_utils-inl.h',
595        'src/env_properties.h',
596        'src/env.h',
597        'src/env-inl.h',
598        'src/handle_wrap.h',
599        'src/histogram.h',
600        'src/histogram-inl.h',
601        'src/js_stream.h',
602        'src/json_utils.h',
603        'src/large_pages/node_large_page.cc',
604        'src/large_pages/node_large_page.h',
605        'src/memory_tracker.h',
606        'src/memory_tracker-inl.h',
607        'src/module_wrap.h',
608        'src/node.h',
609        'src/node_api.h',
610        'src/node_api_types.h',
611        'src/node_binding.h',
612        'src/node_blob.h',
613        'src/node_buffer.h',
614        'src/node_builtins.h',
615        'src/node_constants.h',
616        'src/node_context_data.h',
617        'src/node_contextify.h',
618        'src/node_dir.h',
619        'src/node_errors.h',
620        'src/node_external_reference.h',
621        'src/node_file.h',
622        'src/node_file-inl.h',
623        'src/node_http_common.h',
624        'src/node_http_common-inl.h',
625        'src/node_http2.h',
626        'src/node_http2_state.h',
627        'src/node_i18n.h',
628        'src/node_internals.h',
629        'src/node_main_instance.h',
630        'src/node_mem.h',
631        'src/node_mem-inl.h',
632        'src/node_messaging.h',
633        'src/node_metadata.h',
634        'src/node_mutex.h',
635        'src/node_object_wrap.h',
636        'src/node_options.h',
637        'src/node_options-inl.h',
638        'src/node_perf.h',
639        'src/node_perf_common.h',
640        'src/node_platform.h',
641        'src/node_process.h',
642        'src/node_process-inl.h',
643        'src/node_realm.h',
644        'src/node_realm-inl.h',
645        'src/node_report.h',
646        'src/node_revert.h',
647        'src/node_root_certs.h',
648        'src/node_sea.h',
649        'src/node_shadow_realm.h',
650        'src/node_snapshotable.h',
651        'src/node_snapshot_builder.h',
652        'src/node_sockaddr.h',
653        'src/node_sockaddr-inl.h',
654        'src/node_stat_watcher.h',
655        'src/node_union_bytes.h',
656        'src/node_url.h',
657        'src/node_util.h',
658        'src/node_version.h',
659        'src/node_v8.h',
660        'src/node_v8_platform-inl.h',
661        'src/node_wasi.h',
662        'src/node_watchdog.h',
663        'src/node_worker.h',
664        'src/pipe_wrap.h',
665        'src/req_wrap.h',
666        'src/req_wrap-inl.h',
667        'src/spawn_sync.h',
668        'src/stream_base.h',
669        'src/stream_base-inl.h',
670        'src/stream_pipe.h',
671        'src/stream_wrap.h',
672        'src/string_bytes.h',
673        'src/string_decoder.h',
674        'src/string_decoder-inl.h',
675        'src/string_search.h',
676        'src/tcp_wrap.h',
677        'src/tracing/agent.h',
678        'src/tracing/node_trace_buffer.h',
679        'src/tracing/node_trace_writer.h',
680        'src/tracing/trace_event.h',
681        'src/tracing/trace_event_common.h',
682        'src/tracing/traced_value.h',
683        'src/timer_wrap.h',
684        'src/timer_wrap-inl.h',
685        'src/tty_wrap.h',
686        'src/udp_wrap.h',
687        'src/util.h',
688        'src/util-inl.h',
689        # Dependency headers
690        'deps/v8/include/v8.h',
691        'deps/postject/postject-api.h'
692        # javascript files to make for an even more pleasant IDE experience
693        '<@(library_files)',
694        '<@(deps_files)',
695        # node.gyp is added by default, common.gypi is added for change detection
696        'common.gypi',
697      ],
698
699      'variables': {
700        'openssl_system_ca_path%': '',
701        'openssl_default_cipher_list%': '',
702      },
703
704      'cflags': ['-Werror=unused-result'],
705
706      'defines': [
707        'NODE_ARCH="<(target_arch)"',
708        'NODE_PLATFORM="<(OS)"',
709        'NODE_WANT_INTERNALS=1',
710        # Warn when using deprecated V8 APIs.
711        'V8_DEPRECATION_WARNINGS=1',
712        'NODE_OPENSSL_SYSTEM_CERT_PATH="<(openssl_system_ca_path)"',
713      ],
714
715      # - "C4244: conversion from 'type1' to 'type2', possible loss of data"
716      #   Ususaly safe. Disable for `dep`, enable for `src`
717      'msvs_disabled_warnings!': [4244],
718
719      'conditions': [
720        [ 'openssl_default_cipher_list!=""', {
721          'defines': [
722            'NODE_OPENSSL_DEFAULT_CIPHER_LIST="<(openssl_default_cipher_list)"'
723           ]
724        }],
725        [ 'error_on_warn=="true"', {
726          'cflags': ['-Werror'],
727          'xcode_settings': {
728            'WARNING_CFLAGS': [ '-Werror' ],
729          },
730        }],
731        [ 'node_builtin_modules_path!=""', {
732          'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ]
733        }],
734        [ 'node_shared=="true"', {
735          'sources': [
736            'src/node_snapshot_stub.cc',
737          ]
738        }],
739        [ 'node_shared=="true" and node_module_version!="" and OS!="win"', {
740          'product_extension': '<(shlib_suffix)',
741          'xcode_settings': {
742            'LD_DYLIB_INSTALL_NAME':
743              '@rpath/lib<(node_core_target_name).<(shlib_suffix)'
744          },
745        }],
746        [ 'node_use_node_code_cache=="true"', {
747          'defines': [
748            'NODE_USE_NODE_CODE_CACHE=1',
749          ],
750        }],
751        ['node_shared=="true" and OS in "aix os400"', {
752          'product_name': 'node_base',
753        }],
754        [ 'v8_enable_inspector==1', {
755          'includes' : [ 'src/inspector/node_inspector.gypi' ],
756        }, {
757          'defines': [ 'HAVE_INSPECTOR=0' ]
758        }],
759        [ 'OS=="win"', {
760          'conditions': [
761            [ 'node_intermediate_lib_type!="static_library"', {
762              'sources': [
763                'src/res/node.rc',
764              ],
765            }],
766          ],
767          'libraries': [
768            'Dbghelp',
769            'Psapi',
770            'Winmm',
771            'Ws2_32',
772          ],
773        }],
774        [ 'node_use_etw=="true"', {
775          'defines': [ 'HAVE_ETW=1' ],
776          'dependencies': [ 'node_etw' ],
777          'include_dirs': [
778            'src',
779            'tools/msvs/genfiles',
780            '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
781          ],
782          'sources': [
783            'src/node_win32_etw_provider.h',
784            'src/node_win32_etw_provider-inl.h',
785            'src/node_win32_etw_provider.cc',
786            'src/node_dtrace.h',
787            'src/node_dtrace.cc',
788            'tools/msvs/genfiles/node_etw_provider.h',
789          ],
790          'conditions': [
791            ['node_intermediate_lib_type != "static_library"', {
792              'sources': [
793                'tools/msvs/genfiles/node_etw_provider.rc',
794              ],
795            }],
796          ],
797        }],
798        [ 'node_use_dtrace=="true"', {
799          'defines': [ 'HAVE_DTRACE=1' ],
800          'dependencies': [
801            'node_dtrace_header',
802            'specialize_node_d',
803          ],
804          'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
805          #
806          # DTrace is supported on linux, solaris, mac, and bsd.  There are
807          # three object files associated with DTrace support, but they're
808          # not all used all the time:
809          #
810          #   node_dtrace.o           all configurations
811          #   node_dtrace_ustack.o    not supported on mac and linux
812          #   node_dtrace_provider.o  All except OS X.  "dtrace -G" is not
813          #                           used on OS X.
814          #
815          # Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not
816          # actually exist.  They're listed here to trick GYP into linking the
817          # corresponding object files into the final "node" executable.  These
818          # object files are generated by "dtrace -G" using custom actions
819          # below, and the GYP-generated Makefiles will properly build them when
820          # needed.
821          #
822          'sources': [
823            'src/node_dtrace.h',
824            'src/node_dtrace.cc',
825          ],
826          'conditions': [
827            [ 'OS=="linux"', {
828              'sources': [
829                '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o'
830              ],
831            }],
832            [ 'OS!="mac" and OS!="linux"', {
833              'sources': [
834                'src/node_dtrace_ustack.cc',
835                'src/node_dtrace_provider.cc',
836              ]
837            }
838          ] ]
839        } ],
840        [ 'node_use_openssl=="true"', {
841          'sources': [
842            'src/crypto/crypto_aes.cc',
843            'src/crypto/crypto_bio.cc',
844            'src/crypto/crypto_common.cc',
845            'src/crypto/crypto_dsa.cc',
846            'src/crypto/crypto_hkdf.cc',
847            'src/crypto/crypto_pbkdf2.cc',
848            'src/crypto/crypto_sig.cc',
849            'src/crypto/crypto_timing.cc',
850            'src/crypto/crypto_cipher.cc',
851            'src/crypto/crypto_context.cc',
852            'src/crypto/crypto_ec.cc',
853            'src/crypto/crypto_hmac.cc',
854            'src/crypto/crypto_random.cc',
855            'src/crypto/crypto_rsa.cc',
856            'src/crypto/crypto_spkac.cc',
857            'src/crypto/crypto_util.cc',
858            'src/crypto/crypto_clienthello.cc',
859            'src/crypto/crypto_dh.cc',
860            'src/crypto/crypto_hash.cc',
861            'src/crypto/crypto_keys.cc',
862            'src/crypto/crypto_keygen.cc',
863            'src/crypto/crypto_scrypt.cc',
864            'src/crypto/crypto_tls.cc',
865            'src/crypto/crypto_aes.cc',
866            'src/crypto/crypto_x509.cc',
867            'src/crypto/crypto_bio.h',
868            'src/crypto/crypto_clienthello-inl.h',
869            'src/crypto/crypto_dh.h',
870            'src/crypto/crypto_hmac.h',
871            'src/crypto/crypto_rsa.h',
872            'src/crypto/crypto_spkac.h',
873            'src/crypto/crypto_util.h',
874            'src/crypto/crypto_cipher.h',
875            'src/crypto/crypto_common.h',
876            'src/crypto/crypto_dsa.h',
877            'src/crypto/crypto_hash.h',
878            'src/crypto/crypto_keys.h',
879            'src/crypto/crypto_keygen.h',
880            'src/crypto/crypto_scrypt.h',
881            'src/crypto/crypto_tls.h',
882            'src/crypto/crypto_clienthello.h',
883            'src/crypto/crypto_context.h',
884            'src/crypto/crypto_ec.h',
885            'src/crypto/crypto_hkdf.h',
886            'src/crypto/crypto_pbkdf2.h',
887            'src/crypto/crypto_sig.h',
888            'src/crypto/crypto_random.h',
889            'src/crypto/crypto_timing.h',
890            'src/crypto/crypto_x509.h',
891            'src/node_crypto.cc',
892            'src/node_crypto.h'
893          ],
894        }],
895        [ 'OS in "linux freebsd mac solaris" and '
896          'target_arch=="x64" and '
897          'node_target_type=="executable"', {
898          'defines': [ 'NODE_ENABLE_LARGE_CODE_PAGES=1' ],
899        }],
900        [ 'use_openssl_def==1', {
901          # TODO(bnoordhuis) Make all platforms export the same list of symbols.
902          # Teach mkssldef.py to generate linker maps that UNIX linkers understand.
903          'variables': {
904            'mkssldef_flags': [
905              # Categories to export.
906              '-CAES,BF,BIO,DES,DH,DSA,EC,ECDH,ECDSA,ENGINE,EVP,HMAC,MD4,MD5,'
907              'PSK,RC2,RC4,RSA,SHA,SHA0,SHA1,SHA256,SHA512,SOCK,STDIO,TLSEXT,'
908              'UI,FP_API,TLS1_METHOD,TLS1_1_METHOD,TLS1_2_METHOD,SCRYPT,OCSP,'
909              'NEXTPROTONEG,RMD160,CAST,DEPRECATEDIN_1_1_0,DEPRECATEDIN_1_2_0,'
910              'DEPRECATEDIN_3_0',
911              # Defines.
912              '-DWIN32',
913              # Symbols to filter from the export list.
914              '-X^DSO',
915              '-X^_',
916              '-X^private_',
917              # Base generated DEF on zlib.def
918              '-Bdeps/zlib/win32/zlib.def'
919            ],
920          },
921          'conditions': [
922            ['openssl_is_fips!=""', {
923              'variables': { 'mkssldef_flags': ['-DOPENSSL_FIPS'] },
924            }],
925          ],
926          'actions': [
927            {
928              'action_name': 'mkssldef',
929              'inputs': [
930                'deps/openssl/openssl/util/libcrypto.num',
931                'deps/openssl/openssl/util/libssl.num',
932              ],
933              'outputs': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'],
934              'process_outputs_as_sources': 1,
935              'action': [
936                '<(python)',
937                'tools/mkssldef.py',
938                '<@(mkssldef_flags)',
939                '-o',
940                '<@(_outputs)',
941                '<@(_inputs)',
942              ],
943            },
944          ],
945        }],
946        [ 'debug_nghttp2==1', {
947          'defines': [ 'NODE_DEBUG_NGHTTP2=1' ]
948        }],
949      ],
950      'actions': [
951        {
952          'action_name': 'node_js2c',
953          'process_outputs_as_sources': 1,
954          'inputs': [
955            # Put the code first so it's a dependency and can be used for invocation.
956            'tools/js2c.py',
957            '<@(library_files)',
958            '<@(deps_files)',
959            'config.gypi'
960          ],
961          'outputs': [
962            '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
963          ],
964          'action': [
965            '<(python)',
966            'tools/js2c.py',
967            '--directory',
968            'lib',
969            '--target',
970            '<@(_outputs)',
971            'config.gypi',
972            '<@(deps_files)',
973          ],
974        },
975      ],
976    }, # node_lib_target_name
977    {
978       # generate ETW header and resource files
979      'target_name': 'node_etw',
980      'type': 'none',
981      'conditions': [
982        [ 'node_use_etw=="true"', {
983          'actions': [
984            {
985              'action_name': 'node_etw',
986              'inputs': [ 'src/res/node_etw_provider.man' ],
987              'outputs': [
988                'tools/msvs/genfiles/node_etw_provider.rc',
989                'tools/msvs/genfiles/node_etw_provider.h',
990                'tools/msvs/genfiles/node_etw_providerTEMP.BIN',
991              ],
992              'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ]
993            }
994          ]
995        } ]
996      ]
997    }, # node_etw
998    {
999      'target_name': 'node_dtrace_header',
1000      'type': 'none',
1001      'conditions': [
1002        [ 'node_use_dtrace=="true" and OS!="linux"', {
1003          'actions': [
1004            {
1005              'action_name': 'node_dtrace_header',
1006              'inputs': [ 'src/node_provider.d' ],
1007              'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_provider.h' ],
1008              'action': [ 'dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)',
1009                '-o', '<@(_outputs)' ]
1010            }
1011          ]
1012        } ],
1013        [ 'node_use_dtrace=="true" and OS=="linux"', {
1014          'actions': [
1015            {
1016              'action_name': 'node_dtrace_header',
1017              'inputs': [ 'src/node_provider.d' ],
1018              'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_provider.h' ],
1019              'action': [ 'dtrace', '-h', '-s', '<@(_inputs)',
1020                '-o', '<@(_outputs)' ]
1021            }
1022          ]
1023        } ],
1024      ]
1025    }, # node_dtrace_header
1026    {
1027      'target_name': 'node_dtrace_provider',
1028      'type': 'none',
1029      'conditions': [
1030        [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
1031          'actions': [
1032            {
1033              'action_name': 'node_dtrace_provider_o',
1034              'inputs': [
1035                '<(obj_dir)/<(node_lib_target_name)/src/node_dtrace.o',
1036              ],
1037              'outputs': [
1038                '<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_provider.o'
1039              ],
1040              'action': [ 'dtrace', '-G', '-xnolibs', '-s', 'src/node_provider.d',
1041                '<@(_inputs)', '-o', '<@(_outputs)' ]
1042            }
1043          ]
1044        }],
1045        [ 'node_use_dtrace=="true" and OS=="linux"', {
1046          'actions': [
1047            {
1048              'action_name': 'node_dtrace_provider_o',
1049              'inputs': [ 'src/node_provider.d' ],
1050              'outputs': [
1051                '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o'
1052              ],
1053              'action': [
1054                'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
1055              ],
1056            }
1057          ],
1058        }],
1059      ]
1060    }, # node_dtrace_provider
1061    {
1062      'target_name': 'node_dtrace_ustack',
1063      'type': 'none',
1064      'conditions': [
1065        [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
1066          'actions': [
1067            {
1068              'action_name': 'node_dtrace_ustack_constants',
1069              'inputs': [
1070                '<(obj_dir)/tools/v8_gypfiles/<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)'
1071              ],
1072              'outputs': [
1073                '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
1074              ],
1075              'action': [
1076                'tools/genv8constants.py',
1077                '<@(_outputs)',
1078                '<@(_inputs)'
1079              ]
1080            },
1081            {
1082              'action_name': 'node_dtrace_ustack',
1083              'inputs': [
1084                'src/v8ustack.d',
1085                '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
1086              ],
1087              'outputs': [
1088                '<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_ustack.o'
1089              ],
1090              'conditions': [
1091                [ 'target_arch=="ia32" or target_arch=="arm"', {
1092                  'action': [
1093                    'dtrace', '-32', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc',
1094                    '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
1095                  ]
1096                } ],
1097                [ 'target_arch=="x64"', {
1098                  'action': [
1099                    'dtrace', '-64', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc',
1100                    '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
1101                  ]
1102                } ],
1103              ]
1104            },
1105          ]
1106        } ],
1107      ]
1108    }, # node_dtrace_ustack
1109    {
1110      'target_name': 'specialize_node_d',
1111      'type': 'none',
1112      'conditions': [
1113        [ 'node_use_dtrace=="true"', {
1114          'actions': [
1115            {
1116              'action_name': 'specialize_node_d',
1117              'inputs': [
1118                'src/node.d'
1119              ],
1120              'outputs': [
1121                '<(PRODUCT_DIR)/node.d',
1122              ],
1123              'action': [
1124                'tools/specialize_node_d.py',
1125                '<@(_outputs)',
1126                '<@(_inputs)',
1127                '<@(OS)',
1128                '<@(target_arch)',
1129              ],
1130            },
1131          ],
1132        } ],
1133      ]
1134    }, # specialize_node_d
1135    { # fuzz_url
1136      'target_name': 'fuzz_url',
1137      'type': 'executable',
1138      'dependencies': [
1139        '<(node_lib_target_name)',
1140      ],
1141      'includes': [
1142        'node.gypi'
1143      ],
1144      'include_dirs': [
1145        'src',
1146      ],
1147      'defines': [
1148        'NODE_ARCH="<(target_arch)"',
1149        'NODE_PLATFORM="<(OS)"',
1150        'NODE_WANT_INTERNALS=1',
1151      ],
1152      'sources': [
1153        'src/node_snapshot_stub.cc',
1154        'test/fuzzers/fuzz_url.cc',
1155      ],
1156      'conditions': [
1157        ['OS=="linux"', {
1158          'ldflags': [ '-fsanitize=fuzzer' ]
1159        }],
1160        # Ensure that ossfuzz flag has been set and that we are on Linux
1161        [ 'OS!="linux" or ossfuzz!="true"', {
1162          'type': 'none',
1163        }],
1164      ],
1165    }, # fuzz_url
1166    { # fuzz_env
1167      'target_name': 'fuzz_env',
1168      'type': 'executable',
1169      'dependencies': [
1170        '<(node_lib_target_name)',
1171        'deps/histogram/histogram.gyp:histogram',
1172        'deps/uvwasi/uvwasi.gyp:uvwasi',
1173        'node_dtrace_header',
1174        'node_dtrace_ustack',
1175        'node_dtrace_provider',
1176      ],
1177      'includes': [
1178        'node.gypi'
1179      ],
1180      'include_dirs': [
1181        'src',
1182        'tools/msvs/genfiles',
1183        'deps/v8/include',
1184        'deps/cares/include',
1185        'deps/uv/include',
1186        'deps/uvwasi/include',
1187        'test/cctest',
1188      ],
1189      'defines': [
1190        'NODE_ARCH="<(target_arch)"',
1191        'NODE_PLATFORM="<(OS)"',
1192        'NODE_WANT_INTERNALS=1',
1193      ],
1194      'sources': [
1195        'src/node_snapshot_stub.cc',
1196        'test/fuzzers/fuzz_env.cc',
1197      ],
1198      'conditions': [
1199        ['OS=="linux"', {
1200          'ldflags': [ '-fsanitize=fuzzer' ]
1201        }],
1202        # Ensure that ossfuzz flag has been set and that we are on Linux
1203        [ 'OS!="linux" or ossfuzz!="true"', {
1204          'type': 'none',
1205        }],
1206        # Avoid excessive LTO
1207        ['enable_lto=="true"', {
1208          'ldflags': [ '-fno-lto' ],
1209        }],
1210      ],
1211    }, # fuzz_env
1212    {
1213      'target_name': 'cctest',
1214      'type': 'executable',
1215
1216      'dependencies': [
1217        '<(node_lib_target_name)',
1218        'deps/base64/base64.gyp:base64',
1219        'deps/googletest/googletest.gyp:gtest',
1220        'deps/googletest/googletest.gyp:gtest_main',
1221        'deps/histogram/histogram.gyp:histogram',
1222        'deps/uvwasi/uvwasi.gyp:uvwasi',
1223        'node_dtrace_header',
1224        'node_dtrace_ustack',
1225        'node_dtrace_provider',
1226        'deps/simdutf/simdutf.gyp:simdutf',
1227        'deps/ada/ada.gyp:ada',
1228      ],
1229
1230      'includes': [
1231        'node.gypi'
1232      ],
1233
1234      'include_dirs': [
1235        'src',
1236        'tools/msvs/genfiles',
1237        'deps/v8/include',
1238        'deps/cares/include',
1239        'deps/uv/include',
1240        'deps/uvwasi/include',
1241        'test/cctest',
1242      ],
1243
1244      'defines': [
1245        'NODE_ARCH="<(target_arch)"',
1246        'NODE_PLATFORM="<(OS)"',
1247        'NODE_WANT_INTERNALS=1',
1248      ],
1249
1250      'sources': [
1251        'src/node_snapshot_stub.cc',
1252        'test/cctest/node_test_fixture.cc',
1253        'test/cctest/node_test_fixture.h',
1254        'test/cctest/test_aliased_buffer.cc',
1255        'test/cctest/test_base64.cc',
1256        'test/cctest/test_base_object_ptr.cc',
1257        'test/cctest/test_node_postmortem_metadata.cc',
1258        'test/cctest/test_environment.cc',
1259        'test/cctest/test_linked_binding.cc',
1260        'test/cctest/test_node_api.cc',
1261        'test/cctest/test_per_process.cc',
1262        'test/cctest/test_platform.cc',
1263        'test/cctest/test_report.cc',
1264        'test/cctest/test_json_utils.cc',
1265        'test/cctest/test_sockaddr.cc',
1266        'test/cctest/test_traced_value.cc',
1267        'test/cctest/test_util.cc',
1268      ],
1269
1270      'conditions': [
1271        [ 'node_use_openssl=="true"', {
1272          'defines': [
1273            'HAVE_OPENSSL=1',
1274          ],
1275          'sources': [
1276            'test/cctest/test_crypto_clienthello.cc',
1277            'test/cctest/test_node_crypto.cc',
1278            'test/cctest/test_node_crypto_env.cc',
1279          ]
1280        }],
1281        ['v8_enable_inspector==1', {
1282          'sources': [
1283            'test/cctest/test_inspector_socket.cc',
1284            'test/cctest/test_inspector_socket_server.cc'
1285          ],
1286          'defines': [
1287            'HAVE_INSPECTOR=1',
1288          ],
1289        }, {
1290           'defines': [
1291             'HAVE_INSPECTOR=0',
1292           ]
1293        }],
1294        ['OS=="solaris"', {
1295          'ldflags': [ '-I<(SHARED_INTERMEDIATE_DIR)' ]
1296        }],
1297        # Skip cctest while building shared lib node for Windows
1298        [ 'OS=="win" and node_shared=="true"', {
1299          'type': 'none',
1300        }],
1301        [ 'node_shared=="true"', {
1302          'xcode_settings': {
1303            'OTHER_LDFLAGS': [ '-Wl,-rpath,@loader_path', ],
1304          },
1305        }],
1306        ['OS=="win"', {
1307          'libraries': [
1308            'Dbghelp.lib',
1309            'winmm.lib',
1310            'Ws2_32.lib',
1311          ],
1312        }],
1313        # Avoid excessive LTO
1314        ['enable_lto=="true"', {
1315          'ldflags': [ '-fno-lto' ],
1316        }],
1317      ],
1318    }, # cctest
1319
1320    {
1321      'target_name': 'embedtest',
1322      'type': 'executable',
1323
1324      'dependencies': [
1325        '<(node_lib_target_name)',
1326        'deps/histogram/histogram.gyp:histogram',
1327        'deps/uvwasi/uvwasi.gyp:uvwasi',
1328        'node_dtrace_header',
1329        'node_dtrace_ustack',
1330        'node_dtrace_provider',
1331        'deps/ada/ada.gyp:ada',
1332      ],
1333
1334      'includes': [
1335        'node.gypi'
1336      ],
1337
1338      'include_dirs': [
1339        'src',
1340        'tools/msvs/genfiles',
1341        'deps/v8/include',
1342        'deps/cares/include',
1343        'deps/uv/include',
1344        'deps/uvwasi/include',
1345        'test/embedding',
1346      ],
1347
1348      'sources': [
1349        'src/node_snapshot_stub.cc',
1350        'test/embedding/embedtest.cc',
1351      ],
1352
1353      'conditions': [
1354        ['OS=="solaris"', {
1355          'ldflags': [ '-I<(SHARED_INTERMEDIATE_DIR)' ]
1356        }],
1357        # Skip cctest while building shared lib node for Windows
1358        [ 'OS=="win" and node_shared=="true"', {
1359          'type': 'none',
1360        }],
1361        [ 'node_shared=="true"', {
1362          'xcode_settings': {
1363            'OTHER_LDFLAGS': [ '-Wl,-rpath,@loader_path', ],
1364          },
1365        }],
1366        ['OS=="win"', {
1367          'libraries': [
1368            'Dbghelp.lib',
1369            'winmm.lib',
1370            'Ws2_32.lib',
1371          ],
1372        }],
1373        # Avoid excessive LTO
1374        ['enable_lto=="true"', {
1375          'ldflags': [ '-fno-lto' ],
1376        }],
1377      ],
1378    }, # embedtest
1379
1380    {
1381      'target_name': 'overlapped-checker',
1382      'type': 'executable',
1383
1384      'conditions': [
1385        ['OS=="win"', {
1386          'sources': [
1387            'test/overlapped-checker/main_win.c'
1388          ],
1389        }],
1390        ['OS!="win"', {
1391          'sources': [
1392            'test/overlapped-checker/main_unix.c'
1393          ],
1394        }],
1395        # Avoid excessive LTO
1396        ['enable_lto=="true"', {
1397          'ldflags': [ '-fno-lto' ],
1398        }],
1399      ]
1400    }, # overlapped-checker
1401    {
1402      'target_name': 'node_mksnapshot',
1403      'type': 'executable',
1404
1405      'dependencies': [
1406        '<(node_lib_target_name)',
1407        'deps/histogram/histogram.gyp:histogram',
1408        'deps/uvwasi/uvwasi.gyp:uvwasi',
1409        'deps/ada/ada.gyp:ada',
1410      ],
1411
1412      'includes': [
1413        'node.gypi'
1414      ],
1415
1416      'include_dirs': [
1417        'src',
1418        'tools/msvs/genfiles',
1419        'deps/v8/include',
1420        'deps/cares/include',
1421        'deps/uv/include',
1422        'deps/uvwasi/include',
1423      ],
1424
1425      'defines': [ 'NODE_WANT_INTERNALS=1' ],
1426
1427      'sources': [
1428        'src/node_snapshot_stub.cc',
1429        'tools/snapshot/node_mksnapshot.cc',
1430      ],
1431
1432      'conditions': [
1433        [ 'node_use_openssl=="true"', {
1434          'defines': [
1435            'HAVE_OPENSSL=1',
1436          ],
1437        }],
1438        [ 'node_use_node_code_cache=="true"', {
1439          'defines': [
1440            'NODE_USE_NODE_CODE_CACHE=1',
1441          ],
1442        }],
1443        ['v8_enable_inspector==1', {
1444          'defines': [
1445            'HAVE_INSPECTOR=1',
1446          ],
1447        }],
1448        ['OS=="win"', {
1449          'libraries': [
1450            'Dbghelp.lib',
1451            'winmm.lib',
1452            'Ws2_32.lib',
1453          ],
1454        }],
1455        # Avoid excessive LTO
1456        ['enable_lto=="true"', {
1457          'ldflags': [ '-fno-lto' ],
1458        }],
1459      ],
1460    }, # node_mksnapshot
1461  ], # end targets
1462
1463  'conditions': [
1464    ['OS in "aix os400" and node_shared=="true"', {
1465      'targets': [
1466        {
1467          'target_name': 'node_aix_shared',
1468          'type': 'shared_library',
1469          'product_name': '<(node_core_target_name)',
1470          'ldflags': ['--shared'],
1471          'product_extension': '<(shlib_suffix)',
1472          'includes': [
1473            'node.gypi'
1474          ],
1475          'dependencies': ['<(node_lib_target_name)'],
1476          'include_dirs': [
1477            'src',
1478            'deps/v8/include',
1479          ],
1480          'sources': [
1481            '<@(library_files)',
1482            '<@(deps_files)',
1483            'common.gypi',
1484          ],
1485          'direct_dependent_settings': {
1486            'ldflags': [ '-Wl,-brtl' ],
1487          },
1488        },
1489      ]
1490    }], # end aix section
1491    ['OS=="win" and node_shared=="true"', {
1492     'targets': [
1493       {
1494         'target_name': 'gen_node_def',
1495         'type': 'executable',
1496         'sources': [
1497           'tools/gen_node_def.cc'
1498         ],
1499       },
1500       {
1501         'target_name': 'generate_node_def',
1502         'dependencies': [
1503           'gen_node_def',
1504           '<(node_lib_target_name)',
1505         ],
1506         'type': 'none',
1507         'actions': [
1508           {
1509             'action_name': 'generate_node_def_action',
1510             'inputs': [
1511               '<(PRODUCT_DIR)/<(node_lib_target_name).dll'
1512             ],
1513             'outputs': [
1514               '<(PRODUCT_DIR)/<(node_core_target_name).def',
1515             ],
1516             'action': [
1517               '<(PRODUCT_DIR)/gen_node_def.exe',
1518               '<@(_inputs)',
1519               '<@(_outputs)',
1520             ],
1521           },
1522         ],
1523       },
1524     ],
1525   }], # end win section
1526  ], # end conditions block
1527}
1528