There are several posts about trying to escape characters in a Makefile.
I am interested in escaping the backslash \.
I need to dynamically build a path according to the OS. So, I wrote a condition for that:
OperatingSystem :=
ifeq ($(OS),Windows_NT)
Separator := \
else
Separator := /
endif
Path := c:$(Separator)
This code fails when the OS is Windows since the backslash is not escaped and it expects to have more data on the next line.
Does anyone have an idea how can I overcome this?
I thought about a workaround which in case it is Windows, I will read the environment variable called ProgramFiles and will take the 3rd character out of it. But how can I get a specific character from it?
Thanks,