Skip to content

Commit 4e2fa8b

Browse files
committed
build: extract common code from NODE_EXE/_G_EXE
This commit extracts common parts of the NODE_EXE, and NODE_G_EXE recipes into a canned reciepe to reduce some code duplication. PR-URL: #22310 Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 36468ca commit 4e2fa8b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,20 @@ help: ## Print help for targets with comments.
9090
# to check for changes.
9191
.PHONY: $(NODE_EXE) $(NODE_G_EXE)
9292

93+
define build_node_exe
94+
$(MAKE) -C out BUILDTYPE=$1 V=$(V)
9395
# The -r/-L check stops it recreating the link if it is already in place,
9496
# otherwise $(NODE_EXE) being a .PHONY target means it is always re-run.
9597
# Without the check there is a race condition between the link being deleted
9698
# and recreated which can break the addons build when running test-ci
9799
# See comments on the build-addons target for some more info
100+
if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/$1/$(NODE_EXE) $@; fi
101+
endef
98102
$(NODE_EXE): config.gypi out/Makefile
99-
$(MAKE) -C out BUILDTYPE=Release V=$(V)
100-
if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Release/$(NODE_EXE) $@; fi
103+
@$(call build_node_exe,"Release")
101104

102105
$(NODE_G_EXE): config.gypi out/Makefile
103-
$(MAKE) -C out BUILDTYPE=Debug V=$(V)
104-
if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Debug/$(NODE_EXE) $@; fi
106+
@$(call build_node_exe,"Debug")
105107

106108
CODE_CACHE_DIR ?= out/$(BUILDTYPE)/obj/gen
107109
CODE_CACHE_FILE ?= $(CODE_CACHE_DIR)/node_code_cache.cc

0 commit comments

Comments
 (0)