Skip to content

Commit bba41bf

Browse files
Hakerh400codebytere
authored andcommitted
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: #33136 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent cf82adf commit bba41bf

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ GNUMAKEFLAGS += --no-print-directory
1717
GCOV ?= gcov
1818
PWD = $(CURDIR)
1919
BUILD_WITH ?= make
20+
FIND ?= find
2021

2122
ifdef JOBS
2223
PARALLEL_ARGS = -j $(JOBS)
@@ -168,7 +169,7 @@ uninstall: ## Uninstalls node from $PREFIX (default=/usr/local).
168169
clean: ## Remove build artifacts.
169170
$(RM) -r out/Makefile $(NODE_EXE) $(NODE_G_EXE) out/$(BUILDTYPE)/$(NODE_EXE) \
170171
out/$(BUILDTYPE)/node.exp
171-
@if [ -d out ]; then find out/ -name '*.o' -o -name '*.a' -o -name '*.d' | xargs $(RM) -r; fi
172+
@if [ -d out ]; then $(FIND) out/ -name '*.o' -o -name '*.a' -o -name '*.d' | xargs $(RM) -r; fi
172173
$(RM) -r node_modules
173174
@if [ -d deps/icu ]; then echo deleting deps/icu; $(RM) -r deps/icu; fi
174175
$(RM) test.tap
@@ -1200,7 +1201,7 @@ LINT_MD_NEWER = -newer tools/.mdlintstamp
12001201
endif
12011202

12021203
LINT_MD_TARGETS = doc src lib benchmark test tools/doc tools/icu $(wildcard *.md)
1203-
LINT_MD_FILES = $(shell find $(LINT_MD_TARGETS) -type f \
1204+
LINT_MD_FILES = $(shell $(FIND) $(LINT_MD_TARGETS) -type f \
12041205
! -path '*node_modules*' ! -path 'test/fixtures/*' -name '*.md' \
12051206
$(LINT_MD_NEWER))
12061207
run-lint-md = tools/lint-md.js -q -f --no-stdout $(LINT_MD_FILES)
@@ -1377,7 +1378,7 @@ CONFLICT_RE=^>>>>>>> [0-9A-Fa-f]+|^<<<<<<< [A-Za-z]+
13771378
# Related CI job: node-test-linter
13781379
lint-ci: lint-js-ci lint-cpp lint-py lint-md lint-addon-docs
13791380
@if ! ( grep -IEqrs "$(CONFLICT_RE)" benchmark deps doc lib src test tools ) \
1380-
&& ! ( find . -maxdepth 1 -type f | xargs grep -IEqs "$(CONFLICT_RE)" ); then \
1381+
&& ! ( $(FIND) . -maxdepth 1 -type f | xargs grep -IEqs "$(CONFLICT_RE)" ); then \
13811382
exit 0 ; \
13821383
else \
13831384
echo "" >&2 ; \

configure.py

+4
Original file line numberDiff line numberDiff line change
@@ -1744,6 +1744,10 @@ def make_bin_override():
17441744
if options.use_ninja:
17451745
config['BUILD_WITH'] = 'ninja'
17461746

1747+
# On Windows there is another find.exe in C:\Windows\System32
1748+
if sys.platform == 'win32':
1749+
config['FIND'] = '/usr/bin/find'
1750+
17471751
config_lines = ['='.join((k,v)) for k,v in config.items()]
17481752
# Add a blank string to get a blank line at the end.
17491753
config_lines += ['']

0 commit comments

Comments
 (0)