blob: febed28ec69757ca65e7a53f0956e7ed697fa629 [file] [log] [blame] [edit]
diff --git a/make.h b/make.h
index ea864b4..c6ae5fb 100644
--- a/make.h
+++ b/make.h
@@ -572,2 +572,6 @@ extern int system_np(const char* command, int timeout_milliseconds,
+extern char * getUnixPathCmd(const char *path);
+
+extern char * getWindowsPathCmd(const char *path);
+
#endif /* _MAKE_H_ */
diff --git a/parse.c b/parse.c
index a996c49..ecc84ea 100644
--- a/parse.c
+++ b/parse.c
@@ -2279,8 +2279,21 @@ Parse_include_file(char *file, Boolean isSystem, Boolean depinc, int silent)
/* Actually open the file... */
+#if (defined _WIN32 && ! defined __CYGWIN__)
+ const char *error;
+ char *windowsFullName;
fd = open(fullname, O_RDONLY);
if (fd == -1) {
- if (!silent)
- Parse_Error(PARSE_FATAL, "Cannot open %s", fullname);
- free(fullname);
- return;
+ windowsFullName = Cmd_Exec(getWindowsPathCmd(fullname), &error);
+ if (windowsFullName && strlen(windowsFullName) > 0) {
+ fd = open(windowsFullName, O_RDONLY);
+ }
+ }
+#else
+ fd = open(fullname, O_RDONLY);
+#endif
+ if (fd == -1) {
+ if (!silent) {
+ Parse_Error(PARSE_FATAL, "Cannot open %s", fullname);
+ }
+ free(fullname);
+ return;
}
diff --git a/util.c b/util.c
index 25f4f5e..7fd2768 100644
--- a/util.c
+++ b/util.c
@@ -3032,2 +3032,11 @@ char * getUnixPathCmd(const char *path)
+char * getWindowsPathCmd(const char *path)
+{
+ return str_concat(
+ "cygpath -m", str_concat("\"",
+ str_concat(path, "\"", 0),
+ 0),
+ STR_ADDSPACE);
+}
+
#endif