diff options
Diffstat (limited to 'cc/builder.go')
-rw-r--r-- | cc/builder.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/cc/builder.go b/cc/builder.go index d6d1a02c..9c9bddd8 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -140,12 +140,14 @@ func TransformSourceToObj(ctx common.AndroidModuleContext, subdir string, srcFil for i, srcFile := range srcFiles { var objFile string - if strings.HasPrefix(srcFile, srcRoot) { - objFile = strings.TrimPrefix(srcFile, srcRoot) - objFile = filepath.Join(objDir, objFile) - } else if strings.HasPrefix(srcFile, intermediatesRoot) { + if strings.HasPrefix(srcFile, intermediatesRoot) { objFile = strings.TrimPrefix(srcFile, intermediatesRoot) objFile = filepath.Join(objDir, "gen", objFile) + } else if strings.HasPrefix(srcFile, srcRoot) { + srcFile, _ = filepath.Rel(srcRoot, srcFile) + objFile = filepath.Join(objDir, srcFile) + } else if srcRoot == "." && srcFile[0] != '/' { + objFile = filepath.Join(objDir, srcFile) } else { ctx.ModuleErrorf("source file %q is not in source directory %q", srcFile, srcRoot) continue |