1616#
1717#
1818
19- export SHELL = cmd
20-
2119ifdef tbb_build_dir
2220 test_dir := $(tbb_build_dir )
2321else
2422 test_dir :=.
2523endif
2624
25+ ifndef rtools
26+ export SHELL = cmd
27+ CMD := cmd /C
28+ SLASH = \\
29+ RM = cmd /C del /Q /F
30+ RD = cmd /C rmdir
31+ MD = cmd /c mkdir
32+ NUL = nul
33+ else
34+ ifneq ($(COMSPEC ), )
35+ # Use comspec env var if present
36+ # Since it represents a full path, quote in case there are some spaces.
37+ CMD := "$(subst \,/,$(COMSPEC))" /C
38+ else
39+ # otherwise rely on cmd being in the path
40+ CMD := cmd /C
41+ endif
42+ export SHELL = sh . exe
43+ SLASH = /
44+ RD = rmdir
45+ MD = mkdir
46+ RM = rm
47+ NUL = /dev /null
48+ endif
49+
2750# A convenience wrapper for calls to detect.js.
2851# $(1) is the full command line for the script, e.g. /minversion icl 12
29- detect_js = $(shell cmd / C "cscript /nologo /E:jscript $(tbb_root)/build/detect.js $(1)" )
52+ detect_js = $(shell $( CMD ) "cscript /nologo /E:jscript $(tbb_root)/build/detect.js $(1)" )
3053
3154# TODO give an error if archs doesn't match
3255ifndef arch
@@ -41,13 +64,7 @@ native_compiler := cl
4164export compiler ?= cl
4265debugger ?= devenv /debugexe
4366
44- CMD = cmd /C
45- CWD = $(shell cmd /C echo %CD %)
46- RM = cmd /C del /Q /F
47- RD = cmd /C rmdir
48- MD = cmd /c mkdir
49- SLASH = \\
50- NUL = nul
67+ CWD = $(shell $(CMD ) echo %CD %)
5168
5269AR = lib
5370AR_OUTPUT_KEY = /out :
@@ -103,8 +120,8 @@ ifneq ($(filter vc8 vc9,$(runtime)),)
103120RML . MANIFEST = tbbmanifest . exe . manifest
104121endif
105122
106- MAKE_VERSIONS = cmd / C cscript /nologo /E :jscript $(subst \, /, $(tbb_root ))/build /version_info_windows . js $(compiler ) $(arch ) $(subst \, /, "$(VERSION_FLAGS)" ) > version_string . ver
107- MAKE_TBBVARS = cmd / C "$(subst /,\,$(tbb_root))\build\generate_tbbvars.bat"
123+ MAKE_VERSIONS = $( CMD ) cscript /nologo /E :jscript $(subst \, /, $(tbb_root ))/build /version_info_windows . js $(compiler ) $(arch ) $(subst \, /, "$(VERSION_FLAGS)" ) > version_string . ver
124+ MAKE_TBBVARS = $( CMD ) "$(subst /,\,$(tbb_root))\build\generate_tbbvars.bat"
108125
109126TEST_LAUNCHER = $(subst /, \, $(tbb_root ))\build \test_launcher . bat $(largs )
110127
0 commit comments