cc_log("Base dir not set, skip using relative paths");
return; // nothing to do
}
- if (!has_absolute_include_headers && !conf->depend_mode) {
+ if (!has_absolute_include_headers) {
cc_log("No absolute path for included files found, skip using relative"
" paths");
return; // nothing to do
if (str_endswith(token, ":") || str_eq(token, "\\")) {
continue;
}
- remember_include_file(x_strdup(token), hash, false, hash);
+ if (!has_absolute_include_headers) {
+ has_absolute_include_headers = is_absolute_path(token);
+ }
+ char *path = make_relative_path(x_strdup(token));
+ remember_include_file(path, hash, false, hash);
}
}
failed();
}
- if (generating_dependencies) {
- use_relative_paths_in_depfile(output_dep);
- }
-
if (conf->depend_mode) {
struct file_hash *object_hash =
object_hash_from_depfile(output_dep, depend_mode_hash);
update_cached_result_globals(object_hash);
}
+ if (generating_dependencies) {
+ use_relative_paths_in_depfile(output_dep);
+ }
+
if (stat(output_obj, &st) != 0) {
cc_log("Compiler didn't produce an object file");
stats_update(STATS_NOOUTPUT);