Skip to content

Commit 58c2446

Browse files
committed
Win32: Determine and use EXEEXT
1 parent b4337b1 commit 58c2446

2 files changed

Lines changed: 36 additions & 31 deletions

File tree

Makefile

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ DESTDIR ?=
77
SIGN ?=
88
PREFIX ?= /usr/local
99

10-
NODE ?= ./node
10+
# Determine EXEEXT
11+
EXEEXT=$(shell $(PYTHON) -c "import sysconfig; print(sysconfig.get_config_var('EXE'))")
12+
13+
NODE ?= ./node$(EXEEXT)
1114

1215
# Default to verbose builds.
1316
# To do quiet/pretty builds, run `make V=` to set V to an empty string,
@@ -23,31 +26,31 @@ endif
2326
# BUILDTYPE=Debug builds both release and debug builds. If you want to compile
2427
# just the debug build, run `make -C out BUILDTYPE=Debug` instead.
2528
ifeq ($(BUILDTYPE),Release)
26-
all: out/Makefile node
29+
all: out/Makefile node$(EXEEXT)
2730
else
28-
all: out/Makefile node node_g
31+
all: out/Makefile node$(EXEEXT) node_g$(EXEEXT)
2932
endif
3033

3134
# The .PHONY is needed to ensure that we recursively use the out/Makefile
3235
# to check for changes.
33-
.PHONY: node node_g
36+
.PHONY: node$(EXEEXT) node_g$(EXEEXT)
3437

3538
ifeq ($(USE_NINJA),1)
36-
node: config.gypi
39+
node$(EXEEXT): config.gypi
3740
$(NINJA) -C out/Release/
38-
ln -fs out/Release/node node
41+
ln -fs out/Release/node$(EXEEXT) $@
3942

40-
node_g: config.gypi
43+
node_g$(EXEEXT): config.gypi
4144
$(NINJA) -C out/Debug/
42-
ln -fs out/Debug/node $@
45+
ln -fs out/Debug/node$(EXEEXT) $@
4346
else
44-
node: config.gypi out/Makefile
47+
node$(EXEEXT): config.gypi out/Makefile
4548
$(MAKE) -C out BUILDTYPE=Release V=$(V)
46-
ln -fs out/Release/node node
49+
ln -fs out/Release/node$(EXEEXT) $@
4750

48-
node_g: config.gypi out/Makefile
51+
node_g$(EXEEXT): config.gypi out/Makefile
4952
$(MAKE) -C out BUILDTYPE=Debug V=$(V)
50-
ln -fs out/Debug/node $@
53+
ln -fs out/Debug/node$(EXEEXT) $@
5154
endif
5255

5356
out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp deps/zlib/zlib.gyp deps/v8/build/toolchain.gypi deps/v8/build/features.gypi deps/v8/tools/gyp/v8.gyp node.gyp config.gypi
@@ -72,15 +75,15 @@ uninstall:
7275
$(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
7376

7477
clean:
75-
-rm -rf out/Makefile node node_g out/$(BUILDTYPE)/node blog.html email.md
78+
-rm -rf out/Makefile node$(EXEEXT) node_g$(EXEEXT) out/$(BUILDTYPE)/node$(EXEEXT) blog.html email.md
7679
-find out/ -name '*.o' -o -name '*.a' | xargs rm -rf
7780
-rm -rf node_modules
7881

7982
distclean:
8083
-rm -rf out
8184
-rm -f config.gypi
8285
-rm -f config.mk
83-
-rm -rf node node_g blog.html email.md
86+
-rm -rf node$(EXEEXT) node_g$(EXEEXT) blog.html email.md
8487
-rm -rf node_modules
8588

8689
test: all
@@ -95,8 +98,8 @@ test-valgrind: all
9598
$(PYTHON) tools/test.py --mode=release --valgrind simple message
9699

97100
test/gc/node_modules/weak/build/Release/weakref.node:
98-
@if [ ! -f node ]; then make all; fi
99-
./node deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
101+
@if [ ! -f node$(EXEEXT) ]; then make all; fi
102+
./node$(EXEEXT) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
100103
--directory="$(shell pwd)/test/gc/node_modules/weak" \
101104
--nodedir="$(shell pwd)"
102105

@@ -146,11 +149,11 @@ test-internet: all
146149
test-debugger: all
147150
$(PYTHON) tools/test.py debugger
148151

149-
test-npm: node
150-
./node deps/npm/test/run.js
152+
test-npm: node$(EXEEXT)
153+
./node$(EXEEXT) deps/npm/test/run.js
151154

152-
test-npm-publish: node
153-
npm_package_config_publishtest=true ./node deps/npm/test/run.js
155+
test-npm-publish: node$(EXEEXT)
156+
npm_package_config_publishtest=true ./node$(EXEEXT) deps/npm/test/run.js
154157

155158
test-addons: test-build
156159
$(PYTHON) tools/test.py --mode=release addons
@@ -174,32 +177,32 @@ website_files = \
174177
out/doc/sh_main.js \
175178
out/doc/sh_javascript.min.js
176179

177-
doc: $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs) tools/doc/ out/doc/changelog.html node
180+
doc: $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs) tools/doc/ out/doc/changelog.html node$(EXEEXT)
178181

179182
$(apidoc_dirs):
180183
mkdir -p $@
181184

182185
out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets/
183186
cp $< $@
184187

185-
out/doc/changelog.html: ChangeLog doc/changelog-head.html doc/changelog-foot.html tools/build-changelog.sh node
188+
out/doc/changelog.html: ChangeLog doc/changelog-head.html doc/changelog-foot.html tools/build-changelog.sh node$(EXEEXT)
186189
bash tools/build-changelog.sh
187190

188191
out/doc/%: doc/%
189192
cp -r $< $@
190193

191-
out/doc/api/%.json: doc/api/%.markdown node
192-
out/Release/node tools/doc/generate.js --format=json $< > $@
194+
out/doc/api/%.json: doc/api/%.markdown node$(EXEEXT)
195+
out/Release/node$(EXEEXT) tools/doc/generate.js --format=json $< > $@
193196

194-
out/doc/api/%.html: doc/api/%.markdown node
195-
out/Release/node tools/doc/generate.js --format=html --template=doc/template.html $< > $@
197+
out/doc/api/%.html: doc/api/%.markdown node$(EXEEXT)
198+
out/Release/node$(EXEEXT) tools/doc/generate.js --format=html --template=doc/template.html $< > $@
196199

197200
email.md: ChangeLog tools/email-footer.md
198201
bash tools/changelog-head.sh | sed 's|^\* #|* \\#|g' > $@
199202
cat tools/email-footer.md | sed -e 's|__VERSION__|'$(VERSION)'|g' >> $@
200203

201204
blog.html: email.md
202-
cat $< | ./node tools/doc/node_modules/.bin/marked > $@
205+
cat $< | ./node$(EXEEXT) tools/doc/node_modules/.bin/marked > $@
203206

204207
website-upload: doc
205208
rsync -r out/doc/ [email protected]:~/web/nodejs.org/
@@ -300,7 +303,7 @@ $(PKG): release-only
300303
--out $(PKG)
301304
SIGN="$(INT_SIGN)" PKG="$(PKG)" bash tools/osx-productsign.sh
302305

303-
$(TARBALL): release-only node doc
306+
$(TARBALL): release-only node$(EXEEXT) doc
304307
git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
305308
mkdir -p $(TARNAME)/doc/api
306309
cp doc/node.1 $(TARNAME)/doc/node.1
@@ -387,9 +390,9 @@ bench-http-simple:
387390
benchmark/http_simple_bench.sh
388391

389392
bench-idle:
390-
./node benchmark/idle_server.js &
393+
./node$(EXEEXT) benchmark/idle_server.js &
391394
sleep 1
392-
./node benchmark/idle_clients.js &
395+
./node$(EXEEXT) benchmark/idle_clients.js &
393396

394397
jslintfix:
395398
PYTHONPATH=tools/closure_linter/ $(PYTHON) tools/closure_linter/closure_linter/fixjsstyle.py --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js

tools/install.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import re
1212
import shutil
1313
import sys
14+
import sysconfig
1415

1516
# set at init time
1617
node_prefix = '/usr/local' # PREFIX variable from Makefile
@@ -127,7 +128,8 @@ def subdir_files(path, dest, action):
127128
action(files, subdir + '/')
128129

129130
def files(action):
130-
action(['out/Release/node'], 'bin/node')
131+
exeext=sysconfig.get_config_var('EXE')
132+
action(['out/Release/node' + exeext], 'bin/node' + exeext)
131133

132134
if 'true' == variables.get('node_use_dtrace'):
133135
action(['out/Release/node.d'], 'lib/dtrace/node.d')

0 commit comments

Comments
 (0)