diff --git a/common.gypi b/common.gypi index c0cb5f4c2d9c91..7b921b1fd63ce0 100644 --- a/common.gypi +++ b/common.gypi @@ -232,7 +232,7 @@ }, { 'msvs_settings': { 'VCCLCompilerTool': { - 'WholeProgramOptimization': 'false' + 'WholeProgramOptimization': 'false' # /GL- }, 'VCLinkerTool': { 'LinkIncremental': 2 # enable incremental linking diff --git a/dtrace.gypi b/dtrace.gypi new file mode 100644 index 00000000000000..d50479a38044a3 --- /dev/null +++ b/dtrace.gypi @@ -0,0 +1,166 @@ +{ + 'conditions': [ + [ 'node_use_dtrace=="true"', { + 'defines': [ 'HAVE_DTRACE=1' ], + 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ], + # + # DTrace is supported on linux, solaris, mac, and bsd. There are + # three object files associated with DTrace support, but they're + # not all used all the time: + # + # node_dtrace.o all configurations + # node_dtrace_ustack.o not supported on mac and linux + # node_dtrace_provider.o All except OS X. "dtrace -G" is not + # used on OS X. + # + # Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not + # actually exist. They're listed here to trick GYP into linking the + # corresponding object files into the final "node" executable. These + # object files are generated by "dtrace -G" using custom actions + # below, and the GYP-generated Makefiles will properly build them when + # needed. + # + 'sources': [ 'src/node_dtrace.cc' ], + 'conditions': [ + [ 'OS=="linux"', { + 'sources': [ + '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header/node_dtrace_provider.o' + ], + }], + [ 'OS!="mac" and OS!="linux"', { + 'sources': [ + 'src/node_dtrace_ustack.cc', + 'src/node_dtrace_provider.cc', + ], + }], + ], + }], + [ 'node_use_dtrace=="true" and OS!="linux"', { + 'actions': [ + { + 'action_name': 'node_dtrace_header', + 'inputs': [ 'src/node_provider.d' ], + 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header/node_provider.h' ], + 'action': [ 'dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)', + '-o', '<@(_outputs)' ] + } + ] + } ], + [ 'node_use_dtrace=="true" and OS=="linux"', { + 'actions': [ + { + 'action_name': 'node_dtrace_header', + 'inputs': [ 'src/node_provider.d' ], + 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header/node_provider.h' ], + 'action': [ 'dtrace', '-h', '-s', '<@(_inputs)', '-o', '<@(_outputs)' ] + }, + ], + }], + [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', { + 'actions': [ + { + 'action_name': 'node_dtrace_provider_o', + 'inputs': [ + '<(obj_dir)/node_base/src/node_dtrace.o', + ], + 'outputs': [ + '<(obj_dir)/node_base/src/node_dtrace_provider.o' + ], + 'action': [ + 'dtrace', + '-G', '-xnolibs', + '-s', 'src/node_provider.d', + '<@(_inputs)', + '-o', '<@(_outputs)', + ] + } + ] + }], + [ 'node_use_dtrace=="true" and OS=="linux"', { + 'actions': [ + { + 'action_name': 'node_dtrace_provider_o', + 'inputs': [ 'src/node_provider.d' ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header/node_dtrace_provider.o' + ], + 'action': [ + 'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)' + ], + }, + ], + }], + [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', { + 'actions': [ + { + 'action_name': 'node_dtrace_ustack_constants', + 'inputs': [ + '<(v8_base)' + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header/v8constants.h' + ], + 'action': [ + 'tools/genv8constants.py', + '<@(_outputs)', + '<@(_inputs)' + ] + }, + { + 'action_name': 'node_dtrace_ustack', + 'inputs': [ + 'src/v8ustack.d', + '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header/v8constants.h' + ], + 'outputs': [ + '<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_ustack.o' + ], + 'conditions': [ + [ 'target_arch=="ia32" or target_arch=="arm"', { + 'action': [ + 'dtrace', + '-32', + '-I<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header', + '-Isrc', + '-C', '-G', + '-s', 'src/v8ustack.d', + '-o', '<@(_outputs)', + ], + }], + [ 'target_arch=="x64"', { + 'action': [ + 'dtrace', + '-64', + '-I<(SHARED_INTERMEDIATE_DIR)/node_dtrace_header', + '-Isrc', + '-C', '-G', + '-s', 'src/v8ustack.d', + '-o', '<@(_outputs)', + ], + }], + ], + }, + ], + }], + [ 'node_use_dtrace=="true"', { + 'actions': [ + { + 'action_name': 'specialize_node_d', + 'inputs': [ + 'src/node.d' + ], + 'outputs': [ + '<(PRODUCT_DIR)/node.d', + ], + 'action': [ + 'tools/specialize_node_d.py', + '<@(_outputs)', + '<@(_inputs)', + '<@(OS)', + '<@(target_arch)', + ], + }, + ], + }], + ] +} diff --git a/node.gyp b/node.gyp index dbd8b8a8d5eafb..7385f5fbb3f38c 100644 --- a/node.gyp +++ b/node.gyp @@ -233,7 +233,10 @@ 'target_name': '<(node_core_target_name)', 'type': 'executable', 'sources': [ - 'src/node_main.cc' + 'src/node_main.cc', + 'src/inspector/node_inspector.gypi', + 'common.gypi', + 'node.gypi', ], 'includes': [ 'node.gypi' @@ -246,36 +249,20 @@ # - "C4244: conversion from 'type1' to 'type2', possible loss of data" # Disabled for `/deps/`, so re-enable for `/src/`. 'msvs_disabled_warnings!': [4244], - 'configurations': { - 'Release': { - 'msvs_settings': { - 'conditions': [ - ['node_with_ltcg=="true"', { - 'VCLinkerTool': { - 'OptimizeReferences': 2, # /OPT:REF - 'EnableCOMDATFolding': 2, # /OPT:ICF - 'AdditionalOptions': [ - '/LTCG:INCREMENTAL', # incremental link-time code generation - ] - } - }, { - 'VCLinkerTool': { - 'LinkIncremental': 2 # enable incremental linking - }, - }], - ] - }, - }, - }, + 'dependencies': [ '<(node_lib_target_name)' ], 'conditions': [ - [ 'node_intermediate_lib_type=="static_library" and node_shared=="true" and OS=="aix"', { - # For AIX, shared lib is linked by static lib and .exp. In the - # case here, the executable needs to link to shared lib. - # Therefore, use 'node_aix_shared' target to generate the - # shared lib and then executable. - 'dependencies': [ 'node_aix_shared' ], + ['node_with_ltcg=="true"', { + 'VCLinkerTool': { + 'OptimizeReferences': 2, # /OPT:REF + 'EnableCOMDATFolding': 2, # /OPT:ICF + 'AdditionalOptions': [ + '/LTCG:INCREMENTAL', # incremental link-time code generation + ] + } }, { - 'dependencies': [ '<(node_lib_target_name)' ], + 'VCLinkerTool': { + 'LinkIncremental': 2 # enable incremental linking + }, }], [ 'node_intermediate_lib_type=="static_library" and node_shared=="false"', { 'xcode_settings': { @@ -362,11 +349,6 @@ 'conditions': [ [ 'node_intermediate_lib_type=="static_library" and node_shared=="false"', { - 'xcode_settings': { - 'OTHER_LDFLAGS': [ - '-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)node_base<(STATIC_LIB_SUFFIX)', - ], - }, 'conditions': [ ['OS!="aix"', { 'ldflags': [ @@ -389,9 +371,6 @@ '@rpath/lib<(node_core_target_name).<(shlib_suffix)' }, }], - ['node_shared=="true" and OS=="aix"', { - 'product_name': 'node_base', - }], [ 'OS=="win"', { 'product_name': 'lib<(node_core_target_name)', 'conditions': [ @@ -405,68 +384,6 @@ }, { 'product_name': '<(node_core_target_name)', }], - [ 'node_use_etw=="true"', { - 'defines': [ 'HAVE_ETW=1' ], - 'dependencies': [ 'node_etw' ], - 'include_dirs': [ - 'src', - 'tools/msvs/genfiles', - '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h - ], - 'sources': [ - 'src/node_win32_etw_provider.h', - 'src/node_win32_etw_provider-inl.h', - 'src/node_win32_etw_provider.cc', - 'src/node_dtrace.cc', - 'tools/msvs/genfiles/node_etw_provider.h', - ], - 'conditions': [ - ['node_intermediate_lib_type != "static_library"', { - 'sources': [ - 'tools/msvs/genfiles/node_etw_provider.rc', - ], - }], - ], - }], - [ 'node_use_dtrace=="true"', { - 'defines': [ 'HAVE_DTRACE=1' ], - 'dependencies': [ - 'node_dtrace_header', - 'specialize_node_d', - ], - 'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ], - # - # DTrace is supported on linux, solaris, mac, and bsd. There are - # three object files associated with DTrace support, but they're - # not all used all the time: - # - # node_dtrace.o all configurations - # node_dtrace_ustack.o not supported on mac and linux - # node_dtrace_provider.o All except OS X. "dtrace -G" is not - # used on OS X. - # - # Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not - # actually exist. They're listed here to trick GYP into linking the - # corresponding object files into the final "node" executable. These - # object files are generated by "dtrace -G" using custom actions - # below, and the GYP-generated Makefiles will properly build them when - # needed. - # - 'sources': [ 'src/node_dtrace.cc' ], - 'conditions': [ - [ 'OS=="linux"', { - 'sources': [ - '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o' - ], - }], - [ 'OS!="mac" and OS!="linux"', { - 'sources': [ - 'src/node_dtrace_ustack.cc', - 'src/node_dtrace_provider.cc', - ] - } - ] ] - } ], [ 'use_openssl_def==1', { # TODO(bnoordhuis) Make all platforms export the same list of symbols. # Teach mkssldef.py to generate linker maps that UNIX linkers understand. @@ -512,42 +429,41 @@ }, ], }], - ], - 'actions': [ - { - 'action_name': 'node_js2c', - 'process_outputs_as_sources': 1, - 'inputs': [ - '<@(library_files)', - 'config.gypi', - 'tools/check_macros.py' - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc', - ], + [ 'OS=="aix" and node_shared=="true"', { + 'variables': {'real_os_name': '