Coming from https://gist.github.com/sighingnow/deee806603ec9274fd47#file-makefile-L6, the below works:
ifeq ($(OS), Windows_NT)
IS_WINDOWS = 1
else
IS_WINDOWS = 0
endif
This $(OS)
in a conditional, I can't find docs on it anywhere. What is the story with $(OS)
, and can anyone provide docs on this?
The OS
environment variable is available on Windows systems; see e.g. this list of Windows environment variables.
This conditional...
ifeq ($(OS), Windows_NT)
...is checking if make is running on Windows by looking at the value of the OS
environment variable. If it is equal to Windows_NT
, make sets IS_WINDOWS=1
.
Otherwise, make sets IS_WINDOWS=0
.