From 8b887c4462661f82f7dec0b82806ff7aaa6a2153 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 28 Apr 2020 21:34:22 +0200 Subject: [PATCH] build: fix makefile script on windows On Windows there is a program "find.exe" located in C:\Windows\System32, which is usually in the PATH before MSYS version of that program (required for running makefile). The Windows version of the program uses different CLI syntax, which results in errors like "File not found - *node_modules*" This commit specifies the full path to the program, which is also properly handled by MSYS on Windows. PR-URL: https://github.com/nodejs/node/pull/33136 Reviewed-By: Richard Lau Reviewed-By: Ruben Bridgewater Reviewed-By: Ben Noordhuis --- Makefile | 7 ++++--- configure.py | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ca400962a9d8ba..7a6e3d5c32d161 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ GNUMAKEFLAGS += --no-print-directory GCOV ?= gcov PWD = $(CURDIR) BUILD_WITH ?= make +FIND ?= find ifdef JOBS PARALLEL_ARGS = -j $(JOBS) @@ -168,7 +169,7 @@ uninstall: ## Uninstalls node from $PREFIX (default=/usr/local). clean: ## Remove build artifacts. $(RM) -r out/Makefile $(NODE_EXE) $(NODE_G_EXE) out/$(BUILDTYPE)/$(NODE_EXE) \ out/$(BUILDTYPE)/node.exp - @if [ -d out ]; then find out/ -name '*.o' -o -name '*.a' -o -name '*.d' | xargs $(RM) -r; fi + @if [ -d out ]; then $(FIND) out/ -name '*.o' -o -name '*.a' -o -name '*.d' | xargs $(RM) -r; fi $(RM) -r node_modules @if [ -d deps/icu ]; then echo deleting deps/icu; $(RM) -r deps/icu; fi $(RM) test.tap @@ -1204,7 +1205,7 @@ LINT_MD_NEWER = -newer tools/.mdlintstamp endif LINT_MD_TARGETS = doc src lib benchmark test tools/doc tools/icu $(wildcard *.md) -LINT_MD_FILES = $(shell find $(LINT_MD_TARGETS) -type f \ +LINT_MD_FILES = $(shell $(FIND) $(LINT_MD_TARGETS) -type f \ ! -path '*node_modules*' ! -path 'test/fixtures/*' -name '*.md' \ $(LINT_MD_NEWER)) run-lint-md = tools/lint-md.js -q -f --no-stdout $(LINT_MD_FILES) @@ -1383,7 +1384,7 @@ CONFLICT_RE=^>>>>>>> [0-9A-Fa-f]+|^<<<<<<< [A-Za-z]+ # Related CI job: node-test-linter lint-ci: lint-js-ci lint-cpp lint-py lint-md lint-addon-docs @if ! ( grep -IEqrs "$(CONFLICT_RE)" benchmark deps doc lib src test tools ) \ - && ! ( find . -maxdepth 1 -type f | xargs grep -IEqs "$(CONFLICT_RE)" ); then \ + && ! ( $(FIND) . -maxdepth 1 -type f | xargs grep -IEqs "$(CONFLICT_RE)" ); then \ exit 0 ; \ else \ echo "" >&2 ; \ diff --git a/configure.py b/configure.py index a8cdce4d225427..517da8cc232474 100755 --- a/configure.py +++ b/configure.py @@ -1796,6 +1796,10 @@ def make_bin_override(): if options.use_ninja: config['BUILD_WITH'] = 'ninja' +# On Windows there is another find.exe in C:\Windows\System32 +if sys.platform == 'win32': + config['FIND'] = '/usr/bin/find' + config_lines = ['='.join((k,v)) for k,v in config.items()] # Add a blank string to get a blank line at the end. config_lines += ['']