A simple way to use distinguish between MS Windows and UNIX is the SHELL variable in Make, which has an .exe suffix in Windows, while the suffix is missing in UNIX.
There are certainly some caveats with this approach that I'm not aware of, but at least it has been tested succesfully to indicate MS Windows using UnxUtils make, MinGW make, and MSYS make, and to indicate "non-Windows" using (GNU) make on Linux, and gmake on FreeBSD.
(The Makefile below does not work with BSD make, nor with AIX make, due to its use of Conditionals, which is a GNU make extension - see Conditionals in the GNU manual for details.)
Makefile:
WIN32_SUFFIX = .exe
SHELL_SUFFIX = $(suffix$(SHELL))
target:
ifeq ($(WIN32_SUFFIX), $(SHELL_SUFFIX))
@echo This is MS Windows.else@echo This is not win32.endif
The same Makefile without defining any variables:
target:
ifeq (.exe, $(suffix $(SHELL)))
@echo This is MS Windows.
else
@echo This is not win32.
endif