Skip to content

Commit 6dd4a07

Browse files
committed
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: #23156 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 1a1fe53 commit 6dd4a07

File tree

4 files changed

+49
-58
lines changed

4 files changed

+49
-58
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ available-node = \
7474
# BUILDTYPE=Debug builds both release and debug builds. If you want to compile
7575
# just the debug build, run `make -C out BUILDTYPE=Debug` instead.
7676
ifeq ($(BUILDTYPE),Release)
77-
all: out/Makefile $(NODE_EXE) ## Default target, builds node in out/Release/node.
77+
all: $(NODE_EXE) ## Default target, builds node in out/Release/node.
7878
else
79-
all: out/Makefile $(NODE_EXE) $(NODE_G_EXE)
79+
all: $(NODE_EXE) $(NODE_G_EXE)
8080
endif
8181

8282
.PHONY: help

common.gypi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
'node_tag%': '',
2323
'uv_library%': 'static_library',
2424

25+
'clang%': 0,
26+
2527
'openssl_fips%': '',
2628

2729
# Default to -O0 for debug builds.
@@ -91,8 +93,6 @@
9193
}],
9294
['OS=="mac"', {
9395
'clang%': 1,
94-
}, {
95-
'clang%': 0,
9696
}],
9797
],
9898
},

node.gyp

Lines changed: 35 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@
288288
'sources': [
289289
'tools/msvs/genfiles/node_etw_provider.rc'
290290
],
291-
}]
291+
}],
292292
],
293293
}],
294294
],
@@ -305,16 +305,11 @@
305305
'product_name': '<(node_core_target_name)-win',
306306
}],
307307
],
308-
},
308+
}, # node_core_target_name
309309
{
310310
'target_name': '<(node_lib_target_name)',
311311
'type': '<(node_intermediate_lib_type)',
312312
'product_name': '<(node_core_target_name)',
313-
314-
'dependencies': [
315-
'node_js2c#host',
316-
],
317-
318313
'includes': [
319314
'node.gypi'
320315
],
@@ -460,7 +455,6 @@
460455
'<@(library_files)',
461456
# node.gyp is added to the project by default.
462457
'common.gypi',
463-
'<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
464458
],
465459

466460
'variables': {
@@ -618,15 +612,9 @@
618612
'src/tls_wrap.h'
619613
],
620614
}],
621-
],
622-
},
623-
{
624-
'target_name': 'mkssldef',
625-
'type': 'none',
626-
# TODO(bnoordhuis) Make all platforms export the same list of symbols.
627-
# Teach mkssldef.py to generate linker maps that UNIX linkers understand.
628-
'conditions': [
629615
[ 'use_openssl_def==1', {
616+
# TODO(bnoordhuis) Make all platforms export the same list of symbols.
617+
# Teach mkssldef.py to generate linker maps that UNIX linkers understand.
630618
'variables': {
631619
'mkssldef_flags': [
632620
# Categories to export.
@@ -656,6 +644,7 @@
656644
'deps/openssl/openssl/util/libssl.num',
657645
],
658646
'outputs': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'],
647+
'process_outputs_as_sources': 1,
659648
'action': [
660649
'python',
661650
'tools/mkssldef.py',
@@ -668,39 +657,12 @@
668657
],
669658
}],
670659
],
671-
},
672-
# generate ETW header and resource files
673-
{
674-
'target_name': 'node_etw',
675-
'type': 'none',
676-
'conditions': [
677-
[ 'node_use_etw=="true"', {
678-
'actions': [
679-
{
680-
'action_name': 'node_etw',
681-
'inputs': [ 'src/res/node_etw_provider.man' ],
682-
'outputs': [
683-
'tools/msvs/genfiles/node_etw_provider.rc',
684-
'tools/msvs/genfiles/node_etw_provider.h',
685-
'tools/msvs/genfiles/node_etw_providerTEMP.BIN',
686-
],
687-
'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ]
688-
}
689-
]
690-
} ]
691-
]
692-
},
693-
{
694-
'target_name': 'node_js2c',
695-
'type': 'none',
696-
'toolsets': ['host'],
697660
'actions': [
698661
{
699662
'action_name': 'node_js2c',
700663
'process_outputs_as_sources': 1,
701664
'inputs': [
702665
'<@(library_files)',
703-
'./config.gypi',
704666
'tools/check_macros.py'
705667
],
706668
'outputs': [
@@ -718,14 +680,34 @@
718680
}]
719681
],
720682
'action': [
721-
'python',
722-
'tools/js2c.py',
683+
'python', 'tools/js2c.py',
723684
'<@(_outputs)',
724-
'<@(_inputs)',
685+
'<@(_inputs)', 'config.gypi',
725686
],
726687
},
727688
],
728-
}, # end node_js2c
689+
}, # node_lib_target_name
690+
{
691+
# generate ETW header and resource files
692+
'target_name': 'node_etw',
693+
'type': 'none',
694+
'conditions': [
695+
[ 'node_use_etw=="true"', {
696+
'actions': [
697+
{
698+
'action_name': 'node_etw',
699+
'inputs': [ 'src/res/node_etw_provider.man' ],
700+
'outputs': [
701+
'tools/msvs/genfiles/node_etw_provider.rc',
702+
'tools/msvs/genfiles/node_etw_provider.h',
703+
'tools/msvs/genfiles/node_etw_providerTEMP.BIN',
704+
],
705+
'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ]
706+
}
707+
]
708+
} ]
709+
]
710+
}, # node_etw
729711
{
730712
'target_name': 'node_dtrace_header',
731713
'type': 'none',
@@ -753,7 +735,7 @@
753735
]
754736
} ],
755737
]
756-
},
738+
}, # node_dtrace_header
757739
{
758740
'target_name': 'node_dtrace_provider',
759741
'type': 'none',
@@ -788,7 +770,7 @@
788770
],
789771
}],
790772
]
791-
},
773+
}, # node_dtrace_provider
792774
{
793775
'target_name': 'node_dtrace_ustack',
794776
'type': 'none',
@@ -836,7 +818,7 @@
836818
]
837819
} ],
838820
]
839-
},
821+
}, # node_dtrace_ustack
840822
{
841823
'target_name': 'specialize_node_d',
842824
'type': 'none',
@@ -862,7 +844,7 @@
862844
],
863845
} ],
864846
]
865-
},
847+
}, # specialize_node_d
866848
{
867849
# When using shared lib to build executable in Windows, in order to avoid
868850
# filename collision, the executable name is node-win.exe. Need to rename
@@ -890,7 +872,7 @@
890872
],
891873
} ],
892874
]
893-
},
875+
}, # rename_node_bin_win
894876
{
895877
'target_name': 'cctest',
896878
'type': 'executable',
@@ -899,7 +881,6 @@
899881
'<(node_lib_target_name)',
900882
'rename_node_bin_win',
901883
'deps/gtest/gtest.gyp:gtest',
902-
'node_js2c#host',
903884
'node_dtrace_header',
904885
'node_dtrace_ustack',
905886
'node_dtrace_provider',
@@ -957,7 +938,7 @@
957938
'type': 'none',
958939
}],
959940
],
960-
}
941+
}, # cctest
961942
], # end targets
962943

963944
'conditions': [

node.gypi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424
},
2525
'force_load%': '<(force_load)',
2626
},
27+
# Putting these explicitly here so not to be dependant on common.gypi.
28+
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
29+
'xcode_settings': {
30+
'WARNING_CFLAGS': [
31+
'-Wall',
32+
'-Wendif-labels',
33+
'-W',
34+
'-Wno-unused-parameter',
35+
],
36+
},
2737
'conditions': [
2838
[ 'node_shared=="false"', {
2939
'msvs_settings': {

0 commit comments

Comments
 (0)