我试图重新编译已经有一个Windows端口的应用程序(所以它应该工作)如何强制make来使用bash作为Windows/MSYS2壳
当然,你仍然需要运行./configure
所以你需要MSYS或MSYS2。
配置部分运行良好。现在,当我运行make -n
(所以它显示了规则的执行),我得到:
$ make -n
if test ! -f config.h; then \
rm -f stamp-h1; \
make stamp-h1; \
else :; fi
! was unexpected
make: *** [config.h] Error 255
! was unexpected
是法国的消息的大致翻译(所以它可能会略有不同),但提醒我非常隐蔽的Windows批处理文件消息。所以我想make
使用windows native shell运行它的命令行(这对大多数简单的命令来说不是问题,但不是当它依赖于类似bash的shell时),假设通过使用make调试模式来确认:
$ make -d
GNU Make 3.82
Built for i686-pc-mingw32
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
<I'll spare you that boring part then:>
Invoking recipe from Makefile:164 to update target `config.h'.
Creating temporary batch file C:\msys64\tmp\make11752-1.bat
Batch file contents:
@echo off
if test ! -f config.h; then rm -f stamp-h1; make stamp-h1; else :; fi
从make文档中,make
取en SHELL
env。变量考虑在内。
SHELL
设置为UNIX风格的路径,但我已经试过$ export SHELL="C:/msys64/usr/bin/bash.exe"
改变以反映本地Windows路径(make
可能不知道MSYS2),但无济于事)
那么如何辨别真假make
使用bash
shell而不是Windows shell?
如果导出的变量不起作用,请尝试'make SHELL = bash' - 如果可以在'$ PATH'中找到它,则不需要完整路径。 – o11c
@ o11c已经尝试过。大卫回答说它。我使用的是MinGW(native)版本,而我应该使用MSYS make,MSYS&bash意识到。 –