diff options
Diffstat (limited to 'cpp/src/Slice/Preprocessor.cpp')
-rw-r--r-- | cpp/src/Slice/Preprocessor.cpp | 101 |
1 files changed, 52 insertions, 49 deletions
diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp index 88a881b29d1..7feffe9d1c4 100644 --- a/cpp/src/Slice/Preprocessor.cpp +++ b/cpp/src/Slice/Preprocessor.cpp @@ -408,72 +408,75 @@ Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, cons { end += 1; string file = IceUtilInternal::trim(unprocessed.substr(pos, end - pos)); - if(IceUtilInternal::isAbsolutePath(file)) + if(file.rfind(".ice") == file.size() - 4) { - if(file == _fileName) + if(IceUtilInternal::isAbsolutePath(file)) { - file = _shortFileName; - } - else - { - // - // 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 == _fileName) { - if(file.compare(0, p->length(), *p) == 0) + file = _shortFileName; + } + else + { + // + // 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(IceUtilInternal::isAbsolutePath(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(IceUtilInternal::isAbsolutePath(newFile) || s.size() < newFile.size()) + { + newFile = s; + } } } + file = newFile; } - file = newFile; } - } - if(lang == SliceXML) - { - if(result.size() == 0) + if(lang == SliceXML) { - result = " <source name=\"" + file + "\">"; - } - else - { - result += "\n <dependsOn name=\"" + file + "\"/>"; + if(result.size() == 0) + { + result = " <source name=\"" + file + "\">"; + } + else + { + result += "\n <dependsOn name=\"" + file + "\"/>"; + } } - } - else if(lang == JavaScriptJSON) - { - if(sourceFile.empty()) + else if(lang == JavaScriptJSON) { - sourceFile = file; + if(sourceFile.empty()) + { + sourceFile = file; + } + else + { + dependencies.push_back(file); + } } else { - dependencies.push_back(file); - } - } - else - { - // - // Escape spaces in the file name. - // - string::size_type space = 0; - while((space = file.find(" ", space)) != string::npos) - { - file.replace(space, 1, "\\ "); - space += 2; - } + // + // Escape spaces in the file name. + // + string::size_type space = 0; + while((space = file.find(" ", space)) != string::npos) + { + file.replace(space, 1, "\\ "); + space += 2; + } - // - // Add to result - // - result += " \\\n " + file; + // + // Add to result + // + result += " \\\n " + file; + } } pos = end; } |