]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Enable generating relative paths in dependency file in depend mode (#366)
authorPavol Sakac <26042917+pavsa@users.noreply.github.com>
Sun, 31 Mar 2019 11:09:10 +0000 (13:09 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 31 Mar 2019 11:09:10 +0000 (13:09 +0200)
This was previously only done if preprocessor was run.

src/ccache.c
test/suites/depend.bash

index 2a04ce7433bc5af3714ad97294d43ee7f404877a..afc10f86fc5da24fc5c962743d9850c0dd923b0d 100644 (file)
@@ -1040,7 +1040,7 @@ use_relative_paths_in_depfile(const char *depfile)
                cc_log("Base dir not set, skip using relative paths");
                return; // nothing to do
        }
-       if (!has_absolute_include_headers) {
+       if (!has_absolute_include_headers && !conf->depend_mode) {
                cc_log("No absolute path for included files found, skip using relative"
                       " paths");
                return; // nothing to do
index f0e74f2332a61a4ae26f381fff8d71a9432758eb..3d2f2adc1ce41b83988a063f8a041311eae875b9 100644 (file)
@@ -127,6 +127,14 @@ SUITE_depend() {
     expect_stat 'cache miss' 1
     expect_stat 'files in cache' 3
 
+    # -------------------------------------------------------------------------
+    TEST "Dependency file paths converted to relative if CCACHE_BASEDIR specified"
+        
+    CCACHE_DEPEND=1 CCACHE_BASEDIR="`pwd`" $CCACHE_COMPILE $DEPSFLAGS_CCACHE -c "`pwd`/test.c"
+    if grep -q "[^.]/test.c" "test.d"; then
+        test_failed "Dependency file does not contain relative path to test.c"
+    fi
+
     # -------------------------------------------------------------------------
     TEST "stderr from both preprocessor and compiler"