diff options
Diffstat (limited to 'cpp/src')
-rwxr-xr-x | cpp/src/Slice/Preprocessor.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp index f6eb84f5ddb..fb7bef59d16 100755 --- a/cpp/src/Slice/Preprocessor.cpp +++ b/cpp/src/Slice/Preprocessor.cpp @@ -285,6 +285,7 @@ Slice::Preprocessor::printMakefileDependencies(Language lang, const vector<strin { fullIncludePaths.push_back(fullPath(*p)); } + string absoluteFileName = fullPath(_fileName); // // Process each dependency. @@ -294,26 +295,32 @@ Slice::Preprocessor::printMakefileDependencies(Language lang, const vector<strin { end += 4; string file = IceUtilInternal::trim(unprocessed.substr(pos, end - pos)); - if(isAbsolute(file)) { - // - // Transform back full paths generated by mcpp to paths relative to the specified - // include paths. - // - string newFile = file; - for(vector<string>::const_iterator p = fullIncludePaths.begin(); p != fullIncludePaths.end(); ++p) + if(file == absoluteFileName) + { + file = _fileName; + } + else { - if(file.compare(0, p->length(), *p) == 0) + // + // Transform back full paths generated by mcpp to paths relative to the specified + // include paths. + // + string newFile = file; + for(vector<string>::const_iterator p = fullIncludePaths.begin(); p != fullIncludePaths.end(); ++p) { - string s = includePaths[p - fullIncludePaths.begin()] + file.substr(p->length()); - if(isAbsolute(newFile) || s.size() < newFile.size()) + if(file.compare(0, p->length(), *p) == 0) { - newFile = s; + string s = includePaths[p - fullIncludePaths.begin()] + file.substr(p->length()); + if(isAbsolute(newFile) || s.size() < newFile.size()) + { + newFile = s; + } } } + file = newFile; } - file = newFile; } // |