Skip to content

Commit db723a1

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.
1 parent 95b0e2c commit db723a1

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
@@ -78,18 +78,20 @@ help: ## Print help for targets with comments.
7878
# to check for changes.
7979
.PHONY: $(NODE_EXE) $(NODE_G_EXE)
8080

81+
define build_node_exe
82+
$(MAKE) -C out BUILDTYPE=$1 V=$(V)
8183
# The -r/-L check stops it recreating the link if it is already in place,
8284
# otherwise $(NODE_EXE) being a .PHONY target means it is always re-run.
8385
# Without the check there is a race condition between the link being deleted
8486
# and recreated which can break the addons build when running test-ci
8587
# See comments on the build-addons target for some more info
88+
if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/$1/$(NODE_EXE) $@; fi
89+
endef
8690
$(NODE_EXE): config.gypi out/Makefile
87-
$(MAKE) -C out BUILDTYPE=Release V=$(V)
88-
if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Release/$(NODE_EXE) $@; fi
91+
@$(call build_node_exe,"Release")
8992

9093
$(NODE_G_EXE): config.gypi out/Makefile
91-
$(MAKE) -C out BUILDTYPE=Debug V=$(V)
92-
if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Debug/$(NODE_EXE) $@; fi
94+
@$(call build_node_exe,"Debug")
9395

9496
CODE_CACHE_DIR ?= out/$(BUILDTYPE)/obj/gen
9597
CODE_CACHE_FILE ?= $(CODE_CACHE_DIR)/node_code_cache.cc

0 commit comments

Comments
 (0)