Skip to content

Commit 7d21cc2

Browse files
refacktargos
authored andcommitted
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 <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
1 parent aae0ece commit 7d21cc2

File tree

4 files changed

+62
-71
lines changed

4 files changed

+62
-71
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: 48 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291
'sources': [
292292
'tools/msvs/genfiles/node_perfctr_provider.rc',
293293
],
294-
}]
294+
}],
295295
],
296296
}],
297297
],
@@ -308,16 +308,11 @@
308308
'product_name': '<(node_core_target_name)-win',
309309
}],
310310
],
311-
},
311+
}, # node_core_target_name
312312
{
313313
'target_name': '<(node_lib_target_name)',
314314
'type': '<(node_intermediate_lib_type)',
315315
'product_name': '<(node_core_target_name)',
316-
317-
'dependencies': [
318-
'node_js2c#host',
319-
],
320-
321316
'includes': [
322317
'node.gypi'
323318
],
@@ -463,7 +458,6 @@
463458
'<@(library_files)',
464459
# node.gyp is added to the project by default.
465460
'common.gypi',
466-
'<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
467461
],
468462

469463
'variables': {
@@ -610,15 +604,9 @@
610604
'src/tls_wrap.h'
611605
],
612606
}],
613-
],
614-
},
615-
{
616-
'target_name': 'mkssldef',
617-
'type': 'none',
618-
# TODO(bnoordhuis) Make all platforms export the same list of symbols.
619-
# Teach mkssldef.py to generate linker maps that UNIX linkers understand.
620-
'conditions': [
621607
[ 'use_openssl_def==1', {
608+
# TODO(bnoordhuis) Make all platforms export the same list of symbols.
609+
# Teach mkssldef.py to generate linker maps that UNIX linkers understand.
622610
'variables': {
623611
'mkssldef_flags': [
624612
# Categories to export.
@@ -648,6 +636,7 @@
648636
'deps/openssl/openssl/util/libssl.num',
649637
],
650638
'outputs': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'],
639+
'process_outputs_as_sources': 1,
651640
'action': [
652641
'python',
653642
'tools/mkssldef.py',
@@ -660,9 +649,41 @@
660649
],
661650
}],
662651
],
663-
},
664-
# generate ETW header and resource files
652+
'actions': [
653+
{
654+
'action_name': 'node_js2c',
655+
'process_outputs_as_sources': 1,
656+
'inputs': [
657+
'<@(library_files)',
658+
'tools/check_macros.py'
659+
],
660+
'outputs': [
661+
'<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
662+
],
663+
'conditions': [
664+
[ 'node_use_dtrace=="false" and node_use_etw=="false"', {
665+
'inputs': [ 'src/notrace_macros.py' ]
666+
}],
667+
[ 'node_use_perfctr=="false"', {
668+
'inputs': [ 'src/noperfctr_macros.py' ]
669+
}],
670+
[ 'node_debug_lib=="false"', {
671+
'inputs': [ 'tools/nodcheck_macros.py' ]
672+
}],
673+
[ 'node_debug_lib=="true"', {
674+
'inputs': [ 'tools/dcheck_macros.py' ]
675+
}]
676+
],
677+
'action': [
678+
'python', 'tools/js2c.py',
679+
'<@(_outputs)',
680+
'<@(_inputs)', 'config.gypi',
681+
],
682+
},
683+
],
684+
}, # node_lib_target_name
665685
{
686+
# generate ETW header and resource files
666687
'target_name': 'node_etw',
667688
'type': 'none',
668689
'conditions': [
@@ -681,9 +702,9 @@
681702
]
682703
} ]
683704
]
684-
},
685-
# generate perf counter header and resource files
705+
}, # node_etw
686706
{
707+
# generate perf counter header and resource files
687708
'target_name': 'node_perfctr',
688709
'type': 'none',
689710
'conditions': [
@@ -705,46 +726,7 @@
705726
],
706727
} ]
707728
]
708-
},
709-
{
710-
'target_name': 'node_js2c',
711-
'type': 'none',
712-
'toolsets': ['host'],
713-
'actions': [
714-
{
715-
'action_name': 'node_js2c',
716-
'process_outputs_as_sources': 1,
717-
'inputs': [
718-
'<@(library_files)',
719-
'./config.gypi',
720-
'tools/check_macros.py'
721-
],
722-
'outputs': [
723-
'<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
724-
],
725-
'conditions': [
726-
[ 'node_use_dtrace=="false" and node_use_etw=="false"', {
727-
'inputs': [ 'src/notrace_macros.py' ]
728-
}],
729-
[ 'node_use_perfctr=="false"', {
730-
'inputs': [ 'src/noperfctr_macros.py' ]
731-
}],
732-
[ 'node_debug_lib=="false"', {
733-
'inputs': [ 'tools/nodcheck_macros.py' ]
734-
}],
735-
[ 'node_debug_lib=="true"', {
736-
'inputs': [ 'tools/dcheck_macros.py' ]
737-
}]
738-
],
739-
'action': [
740-
'python',
741-
'tools/js2c.py',
742-
'<@(_outputs)',
743-
'<@(_inputs)',
744-
],
745-
},
746-
],
747-
}, # end node_js2c
729+
}, # node_perfctr
748730
{
749731
'target_name': 'node_dtrace_header',
750732
'type': 'none',
@@ -772,7 +754,7 @@
772754
]
773755
} ],
774756
]
775-
},
757+
}, # node_dtrace_header
776758
{
777759
'target_name': 'node_dtrace_provider',
778760
'type': 'none',
@@ -807,7 +789,7 @@
807789
],
808790
}],
809791
]
810-
},
792+
}, # node_dtrace_provider
811793
{
812794
'target_name': 'node_dtrace_ustack',
813795
'type': 'none',
@@ -855,7 +837,7 @@
855837
]
856838
} ],
857839
]
858-
},
840+
}, # node_dtrace_ustack
859841
{
860842
'target_name': 'specialize_node_d',
861843
'type': 'none',
@@ -881,7 +863,7 @@
881863
],
882864
} ],
883865
]
884-
},
866+
}, # specialize_node_d
885867
{
886868
# When using shared lib to build executable in Windows, in order to avoid
887869
# filename collision, the executable name is node-win.exe. Need to rename
@@ -909,7 +891,7 @@
909891
],
910892
} ],
911893
]
912-
},
894+
}, # rename_node_bin_win
913895
{
914896
'target_name': 'cctest',
915897
'type': 'executable',
@@ -918,7 +900,6 @@
918900
'<(node_lib_target_name)',
919901
'rename_node_bin_win',
920902
'deps/gtest/gtest.gyp:gtest',
921-
'node_js2c#host',
922903
'node_dtrace_header',
923904
'node_dtrace_ustack',
924905
'node_dtrace_provider',
@@ -979,7 +960,7 @@
979960
'type': 'none',
980961
}],
981962
],
982-
}
963+
}, # cctest
983964
], # end targets
984965

985966
'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)