Skip to content

Commit 8b887c4

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 c2aad81 commit 8b887c4

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
@@ -1204,7 +1205,7 @@ LINT_MD_NEWER = -newer tools/.mdlintstamp
12041205
endif
12051206

12061207
LINT_MD_TARGETS = doc src lib benchmark test tools/doc tools/icu $(wildcard *.md)
1207-
LINT_MD_FILES = $(shell find $(LINT_MD_TARGETS) -type f \
1208+
LINT_MD_FILES = $(shell $(FIND) $(LINT_MD_TARGETS) -type f \
12081209
! -path '*node_modules*' ! -path 'test/fixtures/*' -name '*.md' \
12091210
$(LINT_MD_NEWER))
12101211
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]+
13831384
# Related CI job: node-test-linter
13841385
lint-ci: lint-js-ci lint-cpp lint-py lint-md lint-addon-docs
13851386
@if ! ( grep -IEqrs "$(CONFLICT_RE)" benchmark deps doc lib src test tools ) \
1386-
&& ! ( find . -maxdepth 1 -type f | xargs grep -IEqs "$(CONFLICT_RE)" ); then \
1387+
&& ! ( $(FIND) . -maxdepth 1 -type f | xargs grep -IEqs "$(CONFLICT_RE)" ); then \
13871388
exit 0 ; \
13881389
else \
13891390
echo "" >&2 ; \

configure.py

+4
Original file line numberDiff line numberDiff line change
@@ -1796,6 +1796,10 @@ def make_bin_override():
17961796
if options.use_ninja:
17971797
config['BUILD_WITH'] = 'ninja'
17981798

1799+
# On Windows there is another find.exe in C:\Windows\System32
1800+
if sys.platform == 'win32':
1801+
config['FIND'] = '/usr/bin/find'
1802+
17991803
config_lines = ['='.join((k,v)) for k,v in config.items()]
18001804
# Add a blank string to get a blank line at the end.
18011805
config_lines += ['']

0 commit comments

Comments
 (0)