在windows上的makefile中查找环境

在windows上的makefile中查找环境,makefile,Makefile,如果我在posix shell(msys/cygwin)或windowscmdshell中运行,如何签入makefile?以下内容对我有效: ifeq ($(shell echo %OS%),%OS%) $(info Running in a POSIX shell) else $(info Running in a Windows cmd shell) endif 您可以用在DOS环境中定义的任何标准环境变量替换%OS%

如果我在posix shell(
msys
/
cygwin
)或windows
cmd
shell中运行,如何签入makefile?

以下内容对我有效:

ifeq ($(shell echo %OS%),%OS%)
$(info Running in a POSIX shell)
else
$(info Running in a Windows cmd shell)
endif
您可以用在DOS环境中定义的任何标准环境变量替换
%OS%