Update: I now consider this answer to be obsolete. I posted a new perfect solution further down.
If your makefile may be running on non-Cygwin Windows, uname
may not be available. That's awkward, but this is a potential solution. You have to check for Cygwin first to rule it out, because it has WINDOWS in its PATH
environment variable too.
ifneq (,$(findstring /cygdrive/,$(PATH))) UNAME := Cygwinelseifneq (,$(findstring WINDOWS,$(PATH))) UNAME := Windowselse UNAME := $(shell uname -s)endifendif