From 6dd4a077c0fd2bcd964dd6195b80fef66b5e4c3b Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sun, 30 Sep 2018 13:44:55 -0400 Subject: [PATCH 1/4] build: reduce chance of unneeded rebuild Run `node_js2c` and `mkssldef` as actions and not as targets makes sure they are run only once, just before processing the rest of `node_lib`. This helps `make` based dependency change detection be more accurate. Add comments with tagrget names for readability. Use `process_outputs_as_sources` for automatic inclution of outputs. PR-URL: https://github.com/nodejs/node/pull/23156 Reviewed-By: Richard Lau Reviewed-By: Joyee Cheung --- Makefile | 4 +-- common.gypi | 4 +-- node.gyp | 89 +++++++++++++++++++++-------------------------------- node.gypi | 10 ++++++ 4 files changed, 49 insertions(+), 58 deletions(-) diff --git a/Makefile b/Makefile index fea678cf45f134..6b9aa510f2b89c 100644 --- a/Makefile +++ b/Makefile @@ -74,9 +74,9 @@ available-node = \ # BUILDTYPE=Debug builds both release and debug builds. If you want to compile # just the debug build, run `make -C out BUILDTYPE=Debug` instead. ifeq ($(BUILDTYPE),Release) -all: out/Makefile $(NODE_EXE) ## Default target, builds node in out/Release/node. +all: $(NODE_EXE) ## Default target, builds node in out/Release/node. else -all: out/Makefile $(NODE_EXE) $(NODE_G_EXE) +all: $(NODE_EXE) $(NODE_G_EXE) endif .PHONY: help diff --git a/common.gypi b/common.gypi index 46711ac76dbb63..af06295a850173 100644 --- a/common.gypi +++ b/common.gypi @@ -22,6 +22,8 @@ 'node_tag%': '', 'uv_library%': 'static_library', + 'clang%': 0, + 'openssl_fips%': '', # Default to -O0 for debug builds. @@ -91,8 +93,6 @@ }], ['OS=="mac"', { 'clang%': 1, - }, { - 'clang%': 0, }], ], }, diff --git a/node.gyp b/node.gyp index e1adf8cd12e30b..c7e55c3ddb0a6a 100644 --- a/node.gyp +++ b/node.gyp @@ -288,7 +288,7 @@ 'sources': [ 'tools/msvs/genfiles/node_etw_provider.rc' ], - }] + }], ], }], ], @@ -305,16 +305,11 @@ 'product_name': '<(node_core_target_name)-win', }], ], - }, + }, # node_core_target_name { 'target_name': '<(node_lib_target_name)', 'type': '<(node_intermediate_lib_type)', 'product_name': '<(node_core_target_name)', - - 'dependencies': [ - 'node_js2c#host', - ], - 'includes': [ 'node.gypi' ], @@ -460,7 +455,6 @@ '<@(library_files)', # node.gyp is added to the project by default. 'common.gypi', - '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc', ], 'variables': { @@ -618,15 +612,9 @@ 'src/tls_wrap.h' ], }], - ], - }, - { - 'target_name': 'mkssldef', - 'type': 'none', - # TODO(bnoordhuis) Make all platforms export the same list of symbols. - # Teach mkssldef.py to generate linker maps that UNIX linkers understand. - 'conditions': [ [ '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. 'variables': { 'mkssldef_flags': [ # Categories to export. @@ -656,6 +644,7 @@ 'deps/openssl/openssl/util/libssl.num', ], 'outputs': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'], + 'process_outputs_as_sources': 1, 'action': [ 'python', 'tools/mkssldef.py', @@ -668,39 +657,12 @@ ], }], ], - }, - # generate ETW header and resource files - { - 'target_name': 'node_etw', - 'type': 'none', - 'conditions': [ - [ 'node_use_etw=="true"', { - 'actions': [ - { - 'action_name': 'node_etw', - 'inputs': [ 'src/res/node_etw_provider.man' ], - 'outputs': [ - 'tools/msvs/genfiles/node_etw_provider.rc', - 'tools/msvs/genfiles/node_etw_provider.h', - 'tools/msvs/genfiles/node_etw_providerTEMP.BIN', - ], - 'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ] - } - ] - } ] - ] - }, - { - 'target_name': 'node_js2c', - 'type': 'none', - 'toolsets': ['host'], 'actions': [ { 'action_name': 'node_js2c', 'process_outputs_as_sources': 1, 'inputs': [ '<@(library_files)', - './config.gypi', 'tools/check_macros.py' ], 'outputs': [ @@ -718,14 +680,34 @@ }] ], 'action': [ - 'python', - 'tools/js2c.py', + 'python', 'tools/js2c.py', '<@(_outputs)', - '<@(_inputs)', + '<@(_inputs)', 'config.gypi', ], }, ], - }, # end node_js2c + }, # node_lib_target_name + { + # generate ETW header and resource files + 'target_name': 'node_etw', + 'type': 'none', + 'conditions': [ + [ 'node_use_etw=="true"', { + 'actions': [ + { + 'action_name': 'node_etw', + 'inputs': [ 'src/res/node_etw_provider.man' ], + 'outputs': [ + 'tools/msvs/genfiles/node_etw_provider.rc', + 'tools/msvs/genfiles/node_etw_provider.h', + 'tools/msvs/genfiles/node_etw_providerTEMP.BIN', + ], + 'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ] + } + ] + } ] + ] + }, # node_etw { 'target_name': 'node_dtrace_header', 'type': 'none', @@ -753,7 +735,7 @@ ] } ], ] - }, + }, # node_dtrace_header { 'target_name': 'node_dtrace_provider', 'type': 'none', @@ -788,7 +770,7 @@ ], }], ] - }, + }, # node_dtrace_provider { 'target_name': 'node_dtrace_ustack', 'type': 'none', @@ -836,7 +818,7 @@ ] } ], ] - }, + }, # node_dtrace_ustack { 'target_name': 'specialize_node_d', 'type': 'none', @@ -862,7 +844,7 @@ ], } ], ] - }, + }, # specialize_node_d { # When using shared lib to build executable in Windows, in order to avoid # filename collision, the executable name is node-win.exe. Need to rename @@ -890,7 +872,7 @@ ], } ], ] - }, + }, # rename_node_bin_win { 'target_name': 'cctest', 'type': 'executable', @@ -899,7 +881,6 @@ '<(node_lib_target_name)', 'rename_node_bin_win', 'deps/gtest/gtest.gyp:gtest', - 'node_js2c#host', 'node_dtrace_header', 'node_dtrace_ustack', 'node_dtrace_provider', @@ -957,7 +938,7 @@ 'type': 'none', }], ], - } + }, # cctest ], # end targets 'conditions': [ diff --git a/node.gypi b/node.gypi index db29084335be50..fe133039d3d43a 100644 --- a/node.gypi +++ b/node.gypi @@ -24,6 +24,16 @@ }, 'force_load%': '<(force_load)', }, + # Putting these explicitly here so not to be dependant on common.gypi. + 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ], + 'xcode_settings': { + 'WARNING_CFLAGS': [ + '-Wall', + '-Wendif-labels', + '-W', + '-Wno-unused-parameter', + ], + }, 'conditions': [ [ 'node_shared=="false"', { 'msvs_settings': { From 375e16eef20f4538c172d9b27a133df1ccca1569 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Thu, 27 Sep 2018 10:45:24 -0400 Subject: [PATCH 2/4] build: encapsulate node/inspector gyp scafolding PR-URL: https://github.com/nodejs/node/pull/23156 Reviewed-By: Richard Lau Reviewed-By: Joyee Cheung --- node.gyp | 195 +----------------------------- src/inspector/node_inspector.gypi | 149 +++++++++++++++++++++++ 2 files changed, 150 insertions(+), 194 deletions(-) create mode 100644 src/inspector/node_inspector.gypi diff --git a/node.gyp b/node.gyp index c7e55c3ddb0a6a..baae954d1587ca 100644 --- a/node.gyp +++ b/node.gyp @@ -491,40 +491,7 @@ 'product_name': 'node_base', }], [ 'v8_enable_inspector==1', { - 'defines': [ - 'HAVE_INSPECTOR=1', - ], - 'sources': [ - 'src/inspector_agent.cc', - 'src/inspector_io.cc', - 'src/inspector_js_api.cc', - 'src/inspector_socket.cc', - 'src/inspector_socket_server.cc', - 'src/inspector/main_thread_interface.cc', - 'src/inspector/worker_inspector.cc', - 'src/inspector/node_string.cc', - 'src/inspector/worker_agent.cc', - 'src/inspector/tracing_agent.cc', - 'src/inspector_agent.h', - 'src/inspector_io.h', - 'src/inspector_socket.h', - 'src/inspector_socket_server.h', - 'src/inspector/main_thread_interface.h', - 'src/inspector/worker_inspector.h', - 'src/inspector/node_string.h', - 'src/inspector/worker_agent.h', - 'src/inspector/tracing_agent.h', - '<@(node_inspector_generated_sources)' - ], - 'dependencies': [ - 'node_protocol_generated_sources#host', - 'v8_inspector_compress_protocol_json#host', - ], - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)/include', # for inspector - '<(SHARED_INTERMEDIATE_DIR)', - '<(SHARED_INTERMEDIATE_DIR)/src', # for inspector - ], + 'includes' : [ 'src/inspector/node_inspector.gypi' ], }, { 'defines': [ 'HAVE_INSPECTOR=0' ] }], @@ -989,165 +956,5 @@ }, ] }], # end aix section - [ 'v8_enable_inspector==1', { - 'variables': { - 'protocol_path': 'tools/inspector_protocol', - 'node_inspector_path': 'src/inspector', - 'node_inspector_generated_sources': [ - '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/Forward.h', - '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/Protocol.cpp', - '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/Protocol.h', - '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/NodeWorker.cpp', - '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/NodeWorker.h', - '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/NodeTracing.cpp', - '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/NodeTracing.h', - ], - 'node_protocol_files': [ - '<(protocol_path)/lib/Allocator_h.template', - '<(protocol_path)/lib/Array_h.template', - '<(protocol_path)/lib/Collections_h.template', - '<(protocol_path)/lib/DispatcherBase_cpp.template', - '<(protocol_path)/lib/DispatcherBase_h.template', - '<(protocol_path)/lib/ErrorSupport_cpp.template', - '<(protocol_path)/lib/ErrorSupport_h.template', - '<(protocol_path)/lib/Forward_h.template', - '<(protocol_path)/lib/FrontendChannel_h.template', - '<(protocol_path)/lib/Maybe_h.template', - '<(protocol_path)/lib/Object_cpp.template', - '<(protocol_path)/lib/Object_h.template', - '<(protocol_path)/lib/Parser_cpp.template', - '<(protocol_path)/lib/Parser_h.template', - '<(protocol_path)/lib/Protocol_cpp.template', - '<(protocol_path)/lib/ValueConversions_h.template', - '<(protocol_path)/lib/Values_cpp.template', - '<(protocol_path)/lib/Values_h.template', - '<(protocol_path)/templates/Exported_h.template', - '<(protocol_path)/templates/Imported_h.template', - '<(protocol_path)/templates/TypeBuilder_cpp.template', - '<(protocol_path)/templates/TypeBuilder_h.template', - '<(protocol_path)/CodeGenerator.py', - ] - }, - 'targets': [ - { - 'target_name': 'prepare_protocol_json', - 'type': 'none', - 'toolsets': ['host'], - 'copies': [ - { - 'files': [ - '<(node_inspector_path)/node_protocol_config.json', - '<(node_inspector_path)/node_protocol.pdl' - ], - 'destination': '<(SHARED_INTERMEDIATE_DIR)', - } - ], - 'actions': [ - { - 'action_name': 'convert_node_protocol_to_json', - 'inputs': [ - '<(SHARED_INTERMEDIATE_DIR)/node_protocol.pdl', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/node_protocol.json', - ], - 'action': [ - 'python', - 'tools/inspector_protocol/ConvertProtocolToJSON.py', - '<@(_inputs)', - '<@(_outputs)', - ], - }, - ] - }, - { - 'target_name': 'node_protocol_generated_sources', - 'type': 'none', - 'toolsets': ['host'], - 'dependencies': ['prepare_protocol_json'], - 'actions': [ - { - 'action_name': 'node_protocol_generated_sources', - 'inputs': [ - '<(SHARED_INTERMEDIATE_DIR)/node_protocol_config.json', - '<(SHARED_INTERMEDIATE_DIR)/node_protocol.json', - '<@(node_protocol_files)', - ], - 'outputs': [ - '<@(node_inspector_generated_sources)', - ], - 'action': [ - 'python', - '<(protocol_path)/CodeGenerator.py', - '--jinja_dir', '<@(protocol_path)/..', - '--output_base', '<(SHARED_INTERMEDIATE_DIR)/src/', - '--config', '<(SHARED_INTERMEDIATE_DIR)/node_protocol_config.json', - ], - 'message': 'Generating node protocol sources from protocol json', - }, - ] - }, - { - 'target_name': 'v8_inspector_compress_protocol_json', - 'type': 'none', - 'toolsets': ['host'], - 'copies': [ - { - 'destination': '<(SHARED_INTERMEDIATE_DIR)', - 'files': ['deps/v8/src/inspector/js_protocol.pdl'] - } - ], - 'actions': [ - { - 'action_name': 'v8_inspector_convert_protocol_to_json', - 'inputs': [ - '<(SHARED_INTERMEDIATE_DIR)/js_protocol.pdl', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/js_protocol.json', - ], - 'action': [ - 'python', - 'tools/inspector_protocol/ConvertProtocolToJSON.py', - '<@(_inputs)', - '<@(_outputs)', - ], - }, - { - 'action_name': 'concatenate_protocols', - 'inputs': [ - '<(SHARED_INTERMEDIATE_DIR)/js_protocol.json', - '<(SHARED_INTERMEDIATE_DIR)/node_protocol.json', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/concatenated_protocol.json', - ], - 'action': [ - 'python', - 'tools/inspector_protocol/ConcatenateProtocols.py', - '<@(_inputs)', - '<@(_outputs)', - ], - }, - { - 'action_name': 'v8_inspector_compress_protocol_json', - 'process_outputs_as_sources': 1, - 'inputs': [ - '<(SHARED_INTERMEDIATE_DIR)/concatenated_protocol.json', - ], - 'outputs': [ - '<(SHARED_INTERMEDIATE_DIR)/v8_inspector_protocol_json.h', - ], - 'action': [ - 'python', - 'tools/compress_json.py', - '<@(_inputs)', - '<@(_outputs)', - ], - }, - ], - }, - ] - }] ], # end conditions block } diff --git a/src/inspector/node_inspector.gypi b/src/inspector/node_inspector.gypi new file mode 100644 index 00000000000000..aea4de894fbe99 --- /dev/null +++ b/src/inspector/node_inspector.gypi @@ -0,0 +1,149 @@ +{ + 'variables': { + 'protocol_tool_path': '../../tools/inspector_protocol', + 'node_inspector_path': '../../src/inspector', + 'node_inspector_generated_sources': [ + '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/Forward.h', + '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/Protocol.cpp', + '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/Protocol.h', + '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/NodeWorker.cpp', + '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/NodeWorker.h', + '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/NodeTracing.cpp', + '<(SHARED_INTERMEDIATE_DIR)/src/node/inspector/protocol/NodeTracing.h', + ], + 'node_protocol_files': [ + '<(protocol_tool_path)/lib/Allocator_h.template', + '<(protocol_tool_path)/lib/Array_h.template', + '<(protocol_tool_path)/lib/Collections_h.template', + '<(protocol_tool_path)/lib/DispatcherBase_cpp.template', + '<(protocol_tool_path)/lib/DispatcherBase_h.template', + '<(protocol_tool_path)/lib/ErrorSupport_cpp.template', + '<(protocol_tool_path)/lib/ErrorSupport_h.template', + '<(protocol_tool_path)/lib/Forward_h.template', + '<(protocol_tool_path)/lib/FrontendChannel_h.template', + '<(protocol_tool_path)/lib/Maybe_h.template', + '<(protocol_tool_path)/lib/Object_cpp.template', + '<(protocol_tool_path)/lib/Object_h.template', + '<(protocol_tool_path)/lib/Parser_cpp.template', + '<(protocol_tool_path)/lib/Parser_h.template', + '<(protocol_tool_path)/lib/Protocol_cpp.template', + '<(protocol_tool_path)/lib/ValueConversions_h.template', + '<(protocol_tool_path)/lib/Values_cpp.template', + '<(protocol_tool_path)/lib/Values_h.template', + '<(protocol_tool_path)/templates/Exported_h.template', + '<(protocol_tool_path)/templates/Imported_h.template', + '<(protocol_tool_path)/templates/TypeBuilder_cpp.template', + '<(protocol_tool_path)/templates/TypeBuilder_h.template', + '<(protocol_tool_path)/CodeGenerator.py', + ] + }, + 'defines': [ + 'HAVE_INSPECTOR=1', + ], + 'sources': [ + '../../src/inspector_agent.cc', + '../../src/inspector_io.cc', + '../../src/inspector_agent.h', + '../../src/inspector_io.h', + '../../src/inspector_js_api.cc', + '../../src/inspector_socket.cc', + '../../src/inspector_socket.h', + '../../src/inspector_socket_server.cc', + '../../src/inspector_socket_server.h', + '../../src/inspector/main_thread_interface.cc', + '../../src/inspector/main_thread_interface.h', + '../../src/inspector/node_string.cc', + '../../src/inspector/node_string.h', + '../../src/inspector/tracing_agent.cc', + '../../src/inspector/tracing_agent.h', + '../../src/inspector/worker_agent.cc', + '../../src/inspector/worker_agent.h', + '../../src/inspector/worker_inspector.cc', + '../../src/inspector/worker_inspector.h', + ], + 'include_dirs': [ + '<(SHARED_INTERMEDIATE_DIR)/include', # for inspector + '<(SHARED_INTERMEDIATE_DIR)', + '<(SHARED_INTERMEDIATE_DIR)/src', # for inspector + ], + 'copies': [ + { + 'files': [ + '<(node_inspector_path)/node_protocol_config.json', + '<(node_inspector_path)/node_protocol.pdl' + ], + 'destination': '<(SHARED_INTERMEDIATE_DIR)', + } + ], + 'actions': [ + { + 'action_name': 'convert_node_protocol_to_json', + 'inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/node_protocol.pdl', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/node_protocol.json', + ], + 'action': [ + 'python', + 'tools/inspector_protocol/ConvertProtocolToJSON.py', + '<@(_inputs)', + '<@(_outputs)', + ], + }, + { + 'action_name': 'node_protocol_generated_sources', + 'process_outputs_as_sources': 0, + 'inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/node_protocol_config.json', + '<(SHARED_INTERMEDIATE_DIR)/node_protocol.json', + '<@(node_protocol_files)', + ], + 'outputs': [ + '<@(node_inspector_generated_sources)', + ], + 'process_outputs_as_sources': 1, + 'action': [ + 'python', + 'tools/inspector_protocol/CodeGenerator.py', + '--jinja_dir', '<@(protocol_tool_path)/..', + '--output_base', '<(SHARED_INTERMEDIATE_DIR)/src/', + '--config', '<(SHARED_INTERMEDIATE_DIR)/node_protocol_config.json', + ], + 'message': 'Generating node protocol sources from protocol json', + }, + { + 'action_name': 'concatenate_protocols', + 'inputs': [ + '../../deps/v8/src/inspector/js_protocol.json', + '<(SHARED_INTERMEDIATE_DIR)/node_protocol.json', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/concatenated_protocol.json', + ], + 'action': [ + 'python', + 'tools/inspector_protocol/ConcatenateProtocols.py', + '<@(_inputs)', + '<@(_outputs)', + ], + }, + { + 'action_name': 'v8_inspector_compress_protocol_json', + 'process_outputs_as_sources': 0, + 'inputs': [ + '<(SHARED_INTERMEDIATE_DIR)/concatenated_protocol.json', + ], + 'outputs': [ + '<(SHARED_INTERMEDIATE_DIR)/v8_inspector_protocol_json.h', + ], + 'process_outputs_as_sources': 1, + 'action': [ + 'python', + 'tools/compress_json.py', + '<@(_inputs)', + '<@(_outputs)', + ], + }, + ], +} From 731a72f3871cf177c683ee82d0a28523aa67d683 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Thu, 27 Sep 2018 10:53:10 -0400 Subject: [PATCH 3/4] tools,gyp: cosmetic change to GYP `make` generator outputs Puts the compilation target upfront for easy reading. PR-URL: https://github.com/nodejs/node/pull/23156 Reviewed-By: Richard Lau Reviewed-By: Joyee Cheung --- tools/gyp/pylib/gyp/generator/make.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/gyp/pylib/gyp/generator/make.py b/tools/gyp/pylib/gyp/generator/make.py index 5870ed67be5fe2..e98d93ab233ff8 100644 --- a/tools/gyp/pylib/gyp/generator/make.py +++ b/tools/gyp/pylib/gyp/generator/make.py @@ -147,7 +147,7 @@ def CalculateGeneratorInputInfo(params): # special "figure out circular dependencies" flags around the entire # input list during linking. quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group +cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group # We support two kinds of shared objects (.so): # 1) shared_library, which is just bundling together many dependent libraries @@ -166,10 +166,10 @@ def CalculateGeneratorInputInfo(params): # - Set SONAME to the library filename so our binaries don't reference # the local, absolute paths used on the link command-line. quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) +cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) +cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) """ LINK_COMMANDS_MAC = """\ @@ -360,10 +360,10 @@ def CalculateGeneratorInputInfo(params): # - quiet_cmd_foo is the brief-output summary of the command. quiet_cmd_cc = CC($(TOOLSET)) $@ -cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< +cmd_cc = $(CC.$(TOOLSET)) -o $@ $< $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c quiet_cmd_cxx = CXX($(TOOLSET)) $@ -cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +cmd_cxx = $(CXX.$(TOOLSET)) -o $@ $< $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c %(extra_commands)s quiet_cmd_touch = TOUCH $@ cmd_touch = touch $@ @@ -1756,7 +1756,7 @@ def WriteMakeRule(self, outputs, inputs, actions=None, comment=None, cmddigest = hashlib.sha1(command if command else self.target).hexdigest() intermediate = "%s.intermediate" % (cmddigest) self.WriteLn('%s: %s' % (' '.join(outputs), intermediate)) - self.WriteLn('\t%s' % '@:'); + self.WriteLn('\t%s' % '@:') self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate)) self.WriteLn('%s: %s%s' % (intermediate, ' '.join(inputs), force_append)) From 5d8373a498a50b1387464391402ef22636439303 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Fri, 28 Sep 2018 20:06:15 -0400 Subject: [PATCH 4/4] tools,gyp: don't force build actions with multiple outputs Don't add `force_append` (FORCE_DO_CMD) to the intermediate sentinal. Adding it makes the action run alway, even when there are no changes. (refack): AFAICT because `*.intermediate` files don't have build rules. PR-URL: https://github.com/nodejs/node/pull/23156 Reviewed-By: Richard Lau Reviewed-By: Joyee Cheung --- tools/gyp/pylib/gyp/generator/make.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/gyp/pylib/gyp/generator/make.py b/tools/gyp/pylib/gyp/generator/make.py index e98d93ab233ff8..585dee4bd85689 100644 --- a/tools/gyp/pylib/gyp/generator/make.py +++ b/tools/gyp/pylib/gyp/generator/make.py @@ -1758,8 +1758,10 @@ def WriteMakeRule(self, outputs, inputs, actions=None, comment=None, self.WriteLn('%s: %s' % (' '.join(outputs), intermediate)) self.WriteLn('\t%s' % '@:') self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate)) - self.WriteLn('%s: %s%s' % - (intermediate, ' '.join(inputs), force_append)) + # Don't add `force_append` (FORCE_DO_CMD) to the intermediate sentinal. + # Adding it makes the action run alway, even when there are no changes. + # (refack): AFAICT because `*.intermediate` files don't have build rules. + self.WriteLn('%s: %s' % (intermediate, ' '.join(inputs))) actions.insert(0, '$(call do_cmd,touch)') if actions: