diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-02-21 20:55:20 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-02-21 20:55:20 (GMT) |
commit | 3c748ec5ad0898298b6f368b23a13b2eba0eb54e (patch) | |
tree | 8b96f3193a8da8e118700c92212f99634a661fd9 /Source/cmUnixMakefileGenerator.cxx | |
parent | 49fa9d8b61fcdf4f62c9a9e5f59bd24ef7f3ca7f (diff) | |
download | CMake-3c748ec5ad0898298b6f368b23a13b2eba0eb54e.zip CMake-3c748ec5ad0898298b6f368b23a13b2eba0eb54e.tar.gz CMake-3c748ec5ad0898298b6f368b23a13b2eba0eb54e.tar.bz2 |
ENH: add a virtual CreateMakeVariable to shorten makefile variables for borland make
Diffstat (limited to 'Source/cmUnixMakefileGenerator.cxx')
-rw-r--r-- | Source/cmUnixMakefileGenerator.cxx | 85 |
1 files changed, 44 insertions, 41 deletions
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index f3b0487..0a5aa8b 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -363,36 +363,36 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout) std::vector<cmSourceFile> classes = l->second.GetSourceFiles(); if (classes.begin() != classes.end()) { - fout << l->first << "_SRC_OBJS = "; - for(std::vector<cmSourceFile>::iterator i = classes.begin(); - i != classes.end(); i++) - { - if(!i->IsAHeaderFileOnly()) - { - std::string outExt(this->GetOutputExtension(i->GetSourceExtension().c_str())); - if(outExt.size()) - { - fout << "\\\n" << this->ConvertToNativePath(i->GetSourceName().c_str()) - << outExt.c_str() << " "; - } - } - } - fout << "\n\n"; - fout << l->first << "_SRC_OBJS_QUOTED = "; - for(std::vector<cmSourceFile>::iterator i = classes.begin(); - i != classes.end(); i++) - { - if(!i->IsAHeaderFileOnly()) - { - std::string outExt(this->GetOutputExtension(i->GetSourceExtension().c_str())); - if(outExt.size()) - { - fout << "\\\n\"" << this->ConvertToNativePath(i->GetSourceName().c_str()) - << outExt.c_str() << "\" "; - } - } - } - fout << "\n\n"; + fout << this->CreateMakeVariable(l->first.c_str(), "_SRC_OBJS") << " = "; + for(std::vector<cmSourceFile>::iterator i = classes.begin(); + i != classes.end(); i++) + { + if(!i->IsAHeaderFileOnly()) + { + std::string outExt(this->GetOutputExtension(i->GetSourceExtension().c_str())); + if(outExt.size()) + { + fout << "\\\n" << this->ConvertToNativePath(i->GetSourceName().c_str()) + << outExt.c_str() << " "; + } + } + } + fout << "\n\n"; + fout << this->CreateMakeVariable(l->first.c_str(), "_SRC_OBJS_QUOTED") << " = "; + for(std::vector<cmSourceFile>::iterator i = classes.begin(); + i != classes.end(); i++) + { + if(!i->IsAHeaderFileOnly()) + { + std::string outExt(this->GetOutputExtension(i->GetSourceExtension().c_str())); + if(outExt.size()) + { + fout << "\\\n\"" << this->ConvertToNativePath(i->GetSourceName().c_str()) + << outExt.c_str() << "\" "; + } + } + } + fout << "\n\n"; } } fout << "CLEAN_OBJECT_FILES = "; @@ -402,7 +402,8 @@ void cmUnixMakefileGenerator::OutputTargetRules(std::ostream& fout) std::vector<cmSourceFile> classes = l->second.GetSourceFiles(); if (classes.begin() != classes.end()) { - fout << "$(" << l->first << "_SRC_OBJS) "; + fout << "$(" << this->CreateMakeVariable(l->first.c_str(), "_SRC_OBJS") + << ") "; } } fout << "\n\n"; @@ -600,8 +601,8 @@ void cmUnixMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout, { std::string target = m_LibraryOutputPath + "lib" + name + "$(SHLIB_SUFFIX)"; std::string depend = "$("; - depend += name; - depend += "_SRC_OBJS) $(" + std::string(name) + "_DEPEND_LIBS)"; + depend += this->CreateMakeVariable(name, "_SRC_OBJS"); + depend += ") $(" + this->CreateMakeVariable(name, "_DEPEND_LIBS") + ")"; std::string command = "$(RM) lib"; command += name; command += "$(SHLIB_SUFFIX)"; @@ -609,7 +610,7 @@ void cmUnixMakefileGenerator::OutputSharedLibraryRule(std::ostream& fout, "$(CMAKE_SHLIB_BUILD_FLAGS) $(CMAKE_CXX_FLAGS) -o \\\n"; command2 += "\t "; command2 += m_LibraryOutputPath + "lib" + std::string(name) + "$(SHLIB_SUFFIX) \\\n"; - command2 += "\t $(" + std::string(name) + "_SRC_OBJS) "; + command2 += "\t $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") "; std::strstream linklibs; this->OutputLinkLibraries(linklibs, name, t); linklibs << std::ends; @@ -635,13 +636,14 @@ void cmUnixMakefileGenerator::OutputModuleLibraryRule(std::ostream& fout, { std::string target = m_LibraryOutputPath + "lib" + std::string(name) + "$(MODULE_SUFFIX)"; std::string depend = "$("; - depend += std::string(name) + "_SRC_OBJS) $(" + std::string(name) + "_DEPEND_LIBS)"; + depend += this->CreateMakeVariable(name, "_SRC_OBJS") + + ") $(" + this->CreateMakeVariable(name, "_DEPEND_LIBS") + ")"; std::string command = "$(RM) lib" + std::string(name) + "$(MODULE_SUFFIX)"; std::string command2 = "$(CMAKE_CXX_COMPILER) $(CMAKE_MODULE_LINK_FLAGS) " "$(CMAKE_MODULE_BUILD_FLAGS) $(CMAKE_CXX_FLAGS) -o \\\n"; command2 += "\t "; command2 += m_LibraryOutputPath + "lib" + std::string(name) + "$(MODULE_SUFFIX) \\\n"; - command2 += "\t $(" + std::string(name) + "_SRC_OBJS) "; + command2 += "\t $(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") "; std::strstream linklibs; this->OutputLinkLibraries(linklibs, std::string(name).c_str(), t); linklibs << std::ends; @@ -668,13 +670,13 @@ void cmUnixMakefileGenerator::OutputStaticLibraryRule(std::ostream& fout, { std::string target = m_LibraryOutputPath + "lib" + std::string(name) + ".a"; std::string depend = "$("; - depend += std::string(name) + "_SRC_OBJS)"; + depend += this->CreateMakeVariable(name, "_SRC_OBJS") + ")"; std::string command = "$(CMAKE_AR) $(CMAKE_AR_ARGS) "; command += m_LibraryOutputPath; command += "lib"; command += name; command += ".a $("; - command += std::string(name) + "_SRC_OBJS)"; + command += this->CreateMakeVariable(name, "_SRC_OBJS") + ")"; std::string command2 = "$(CMAKE_RANLIB) "; command2 += m_LibraryOutputPath; command2 += "lib"; @@ -702,10 +704,11 @@ void cmUnixMakefileGenerator::OutputExecutableRule(std::ostream& fout, { std::string target = m_ExecutableOutputPath + name; std::string depend = "$("; - depend += std::string(name) + "_SRC_OBJS) $(" + std::string(name) + "_DEPEND_LIBS)"; + depend += this->CreateMakeVariable(name, "_SRC_OBJS") + + ") $(" + this->CreateMakeVariable(name, "_DEPEND_LIBS") + ")"; std::string command = "$(CMAKE_CXX_COMPILER) $(CMAKE_SHLIB_LINK_FLAGS) $(CMAKE_CXX_FLAGS) "; - command += "$(" + std::string(name) + "_SRC_OBJS) "; + command += "$(" + this->CreateMakeVariable(name, "_SRC_OBJS") + ") "; std::strstream linklibs; this->OutputLinkLibraries(linklibs, 0, t); linklibs << std::ends; @@ -785,7 +788,7 @@ void cmUnixMakefileGenerator::OutputDependLibs(std::ostream& fout) || (l->second.GetType() == cmTarget::EXECUTABLE) || (l->second.GetType() == cmTarget::WIN32_EXECUTABLE)) { - fout << l->first << "_DEPEND_LIBS = "; + fout << this->CreateMakeVariable(l->first.c_str(), "_DEPEND_LIBS") << " = "; // A library should not depend on itself! emitted.insert(l->first); |