In Windows 10 version 1703 (Creators Update) WSL supports calling native
Windows binaries from the Bash shell, but it requires using full file
names including extension, e.g. `cl.exe` instead of `cl`.
We also don't have access to `cygpath`, so use a simple regex for
converting the dependencies to Unix paths that `make` can understand.
SYS="WINDOWS"
DEVNULL="NUL"
LDFLAGSCLI="$LDFLAGSCLI -lshell32"
- [ $compiler = GNU ] && RC="${RC-${cross_prefix}windres}" || RC="${RC-rc}"
+ [ $compiler = GNU ] && RC="${RC-${cross_prefix}windres}" || RC="${RC-rc.exe}"
fi
;;
sunos*|solaris*)
DEPMM="${QPRE}MM"
DEPMT="${QPRE}MT"
if [ $compiler_style = MS ]; then
- AR="lib -nologo -out:"
- LD="link -out:"
+ AR="lib.exe -nologo -out:"
+ LD="link.exe -out:"
if [ $compiler = ICL ]; then
AR="xi$AR"
LD="xi$LD"
else
- mslink="$(dirname "$(command -v cl 2>/dev/null)")/link"
+ mslink="$(dirname "$(command -v cl.exe 2>/dev/null)")/link.exe"
[ -x "$mslink" ] && LD="\"$mslink\" -out:"
fi
HAVE_GETOPT_LONG=0
IFS='
'
deps="$(cygpath -u -- $deps)"
+elif grep -q 'Microsoft' /proc/sys/kernel/osrelease 2>/dev/null ; then
+ # Running under WSL. We don't have access to cygpath but since the Windows
+ # file system resides under "/mnt/<drive_letter>/" we can simply replace
+ # "C:" with "/mnt/c". This command uses a GNU extension to sed but that's
+ # available on WSL so we don't need to limit ourselves by what POSIX says.
+ deps="$(printf '%s' "$deps" | sed 's/^\([a-zA-Z]\):/\/mnt\/\L\1/')"
fi
# Escape characters as required to create valid Makefile file names