ERR: LINK_DIR must ot have backslah at end. Fix plus cleanup of some code.

This commit is contained in:
John Biddiscombe 2001-09-08 10:02:45 -04:00
parent ea2690d667
commit 6fcc9d803c
1 changed files with 60 additions and 61 deletions

View File

@ -20,15 +20,16 @@ void cmBorlandMakefileGenerator::GenerateMakefile()
m_LibraryOutputPath = m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH"); m_LibraryOutputPath = m_Makefile->GetDefinition("LIBRARY_OUTPUT_PATH");
if(m_LibraryOutputPath.size()) if(m_LibraryOutputPath.size())
{ {
if(m_LibraryOutputPath[m_LibraryOutputPath.size() -1] != '/') std::string tempLibraryOutputPath = m_LibraryOutputPath;
if(tempLibraryOutputPath[tempLibraryOutputPath.size() -1] != '/')
{ {
m_LibraryOutputPath += "/"; tempLibraryOutputPath += "/";
} }
if(!cmSystemTools::MakeDirectory(m_LibraryOutputPath.c_str())) if(!cmSystemTools::MakeDirectory(tempLibraryOutputPath.c_str()))
{ {
cmSystemTools::Error("Error failed create " cmSystemTools::Error("Error failed create "
"LIBRARY_OUTPUT_PATH directory:", "LIBRARY_OUTPUT_PATH directory:",
m_LibraryOutputPath.c_str()); tempLibraryOutputPath.c_str());
} }
m_Makefile->AddLinkDirectory(m_LibraryOutputPath.c_str()); m_Makefile->AddLinkDirectory(m_LibraryOutputPath.c_str());
} }
@ -39,15 +40,16 @@ void cmBorlandMakefileGenerator::GenerateMakefile()
m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"); m_Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
if(m_ExecutableOutputPath.size()) if(m_ExecutableOutputPath.size())
{ {
if(m_ExecutableOutputPath[m_ExecutableOutputPath.size() -1] != '/') std::string tempExecutableOutputPath = m_ExecutableOutputPath;
if(tempExecutableOutputPath[tempExecutableOutputPath.size() -1] != '/')
{ {
m_ExecutableOutputPath += "/"; tempExecutableOutputPath += "/";
} }
if(!cmSystemTools::MakeDirectory(m_ExecutableOutputPath.c_str())) if(!cmSystemTools::MakeDirectory(tempExecutableOutputPath.c_str()))
{ {
cmSystemTools::Error("Error failed to create " cmSystemTools::Error("Error failed to create "
"EXECUTABLE_OUTPUT_PATH directory:", "EXECUTABLE_OUTPUT_PATH directory:",
m_ExecutableOutputPath.c_str()); tempExecutableOutputPath.c_str());
} }
m_Makefile->AddLinkDirectory(m_ExecutableOutputPath.c_str()); m_Makefile->AddLinkDirectory(m_ExecutableOutputPath.c_str());
} }
@ -119,13 +121,14 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
cmSystemTools::MakeDirectory(i->c_str()); cmSystemTools::MakeDirectory(i->c_str());
} }
} }
std::ostrstream fout; //
std::ofstream fout(file);
// //
// Begin writing to makefile.mak // Begin writing to makefile.mak
// //
fout << "# CMAKE Borland (win32) makefile : Edit with Caution \n\n"; fout << "# CMAKE Borland (win32) makefile : Edit with Caution \n\n";
// //
// Turn on Autodependency chaecking // Turn on Autodependency checking
// //
fout << ".autodepend \n\n"; fout << ".autodepend \n\n";
// //
@ -137,14 +140,21 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
fout << m_Makefile->ExpandVariablesInString(replace); fout << m_Makefile->ExpandVariablesInString(replace);
replace = "BCB = $(BCBBINPATH)/.. \n"; replace = "BCB = $(BCBBINPATH)/.. \n";
fout << m_Makefile->ExpandVariablesInString(replace); fout << m_Makefile->ExpandVariablesInString(replace);
// replace = "OUTDIRLIB = @LIBRARY_OUTPUT_PATH@ \n";
// fout << cmSystemTools::ConvertToWindowsSlashes(m_Makefile->ExpandVariablesInString(replace));
// replace = "OUTDIREXE = @EXECUTABLE_OUTPUT_PATH@ \n";
// fout << m_Makefile->ExpandVariablesInString(replace);
replace = "OUTDIRLIB = "; replace = "OUTDIRLIB = ";
replace += m_LibraryOutputPath; replace += m_LibraryOutputPath;
replace += "\n"; replace += "\n";
fout << cmSystemTools::ConvertToWindowsSlashes(replace); fout << cmSystemTools::ConvertToWindowsSlashes(replace);
replace = "OUTDIREXE = "; replace = "OUTDIREXE = ";
replace += m_ExecutableOutputPath; replace += m_ExecutableOutputPath;
replace += "\n"; replace += "\n";
fout << cmSystemTools::ConvertToWindowsSlashes(replace); fout << cmSystemTools::ConvertToWindowsSlashes(replace);
replace = "USERDEFINES = @DEFS_USER@ \n"; replace = "USERDEFINES = @DEFS_USER@ \n";
fout << m_Makefile->ExpandVariablesInString(replace); fout << m_Makefile->ExpandVariablesInString(replace);
replace = "SYSDEFINES = @DEFS_SYS@ \n"; replace = "SYSDEFINES = @DEFS_SYS@ \n";
@ -187,12 +197,12 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
i!=lfiles.end(); ++i) i!=lfiles.end(); ++i)
{ {
dir = *i; dir = *i;
cmSystemTools::ConvertToWindowsSlashes(dir); // cmSystemTools::ConvertToWindowsSlashes(dir);
fout << " " << dir << " \\\n"; fout << " " << dir << " \\\n";
} }
dir = m_Makefile->GetHomeOutputDirectory(); dir = m_Makefile->GetHomeOutputDirectory();
dir += "/CMakeCache.txt"; dir += "/CMakeCache.txt";
cmSystemTools::ConvertToWindowsSlashes(dir); // cmSystemTools::ConvertToWindowsSlashes(dir);
fout << " " << dir << "\n\n"; fout << " " << dir << "\n\n";
// //
// Output Include paths // Output Include paths
@ -219,15 +229,15 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
if ((l->second.GetType() == cmTarget::STATIC_LIBRARY) if ((l->second.GetType() == cmTarget::STATIC_LIBRARY)
&& l->second.IsInAll()) && l->second.IsInAll())
{ {
fout << " \\\n $(OUTDIRLIB)\\" << l->first.c_str() << ".lib"; fout << " \\\n $(OUTDIRLIB)" << l->first.c_str() << ".lib";
} }
if ((l->second.GetType() == cmTarget::SHARED_LIBRARY) && l->second.IsInAll()) if ((l->second.GetType() == cmTarget::SHARED_LIBRARY) && l->second.IsInAll())
{ {
fout << " \\\n $(OUTDIRLIB)\\" << l->first.c_str() << ".dll"; fout << " \\\n $(OUTDIRLIB)" << l->first.c_str() << ".dll";
} }
if ((l->second.GetType() == cmTarget::MODULE_LIBRARY) && l->second.IsInAll()) if ((l->second.GetType() == cmTarget::MODULE_LIBRARY) && l->second.IsInAll())
{ {
fout << " \\\n $(OUTDIRLIB)\\" << l->first.c_str() << ".bpl"; fout << " \\\n $(OUTDIRLIB)" << l->first.c_str() << ".bpl";
} }
} }
// executables // executables
@ -297,7 +307,7 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
if (tgts.find(l->first)==tgts.end()) if (tgts.find(l->first)==tgts.end())
libname = l->first; libname = l->first;
else else
libname = "$(OUTDIRLIB)\\" + l->first; libname = "$(OUTDIRLIB)" + l->first;
if (libname.find(".bpi")!=std::string::npos) continue; if (libname.find(".bpi")!=std::string::npos) continue;
cmSystemTools::ReplaceString(libname, ".lib", ""); cmSystemTools::ReplaceString(libname, ".lib", "");
libname += ".lib"; libname += ".lib";
@ -329,7 +339,7 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
if (tgts.find(l->first)==tgts.end()) if (tgts.find(l->first)==tgts.end())
libname = l->first; libname = l->first;
else else
libname = "$(OUTDIRLIB)\\" + l->first; libname = "$(OUTDIRLIB)" + l->first;
if (libname.find(".bpi")==std::string::npos) continue; if (libname.find(".bpi")==std::string::npos) continue;
fout << " \\\n " << cmSystemTools::EscapeSpaces(libname.c_str()); fout << " \\\n " << cmSystemTools::EscapeSpaces(libname.c_str());
} }
@ -347,7 +357,7 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
std::string temp = cmSystemTools::EscapeSpaces(d->c_str()); std::string temp = cmSystemTools::EscapeSpaces(d->c_str());
fout << temp << ";"; fout << temp << ";";
} }
fout << "$(OUTDIRLIB)\n\n"; fout << "\n\n";
// //
// The project rule - Build All targets // The project rule - Build All targets
@ -398,18 +408,7 @@ void cmBorlandMakefileGenerator::OutputMakefile(const char* file)
} }
// //
// //
// fout << "\n# End of File\n";
std::ofstream ffout(file);
if (!ffout)
{
cmSystemTools::Error("Error can not open for write: ", file);
return;
}
fout << std::ends;
std::string makefileastext = fout.str();
// cmSystemTools::CleanUpWindowsSlashes(makefileastext);
// makefileastext = StringReplace(makefileastext.c_str(), "¬", "/", TReplaceFlags()<<rfReplaceAll).c_str();
ffout << makefileastext << "\n# End of File\n";
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// output the list of libraries that the executables in this makefile will depend on. // output the list of libraries that the executables in this makefile will depend on.
@ -435,7 +434,7 @@ void cmBorlandMakefileGenerator::OutputDependencies(std::ostream& fout)
const char* cacheValue = m_Makefile->GetDefinition(lib2->first.c_str()); const char* cacheValue = m_Makefile->GetDefinition(lib2->first.c_str());
if (cacheValue) if (cacheValue)
{ {
fout << "\\\n $(OUTDIRLIB)\\" << lib2->first << ".lib "; fout << "\\\n $(OUTDIRLIB)" << lib2->first << ".lib ";
} }
} }
fout << "\n\n"; fout << "\n\n";
@ -470,12 +469,12 @@ void cmBorlandMakefileGenerator::OutputTargets(std::ostream& fout)
{ {
// //
// at the moment, static and shared are treated the same // at the moment, static and shared are treated the same
// WARNING. TLIB fails with Unix style Forward slashes - use $(OUTDIRLIB)\\ // WARNING. TLIB fails with Unix style Forward slashes - use $(OUTDIRLIB)
// WARNING. IMPLIB works better with Forward slashes - use $(OUTDIRLIB)\\ // WARNING. IMPLIB works better with Forward slashes - use $(OUTDIRLIB)
// //
fout << "# this should be a static library \n"; fout << "# this should be a static library \n";
fout << "$(OUTDIRLIB)\\" << l->first << ".lib : ${" << l->first << "_SRC_OBJS} \n"; fout << "$(OUTDIRLIB)" << l->first << ".lib : ${" << l->first << "_SRC_OBJS} \n";
std::string Libname = "$(OUTDIRLIB)\\" + l->first + ".lib"; std::string Libname = "$(OUTDIRLIB)" + l->first + ".lib";
fout << " TLib.exe $(LINKFLAGS_STATIC) /u " << Libname.c_str() << " @&&| \n"; fout << " TLib.exe $(LINKFLAGS_STATIC) /u " << Libname.c_str() << " @&&| \n";
fout << " $? \n"; fout << " $? \n";
fout << "| \n\n"; fout << "| \n\n";
@ -483,19 +482,19 @@ void cmBorlandMakefileGenerator::OutputTargets(std::ostream& fout)
if (l->second.GetType() == cmTarget::SHARED_LIBRARY) if (l->second.GetType() == cmTarget::SHARED_LIBRARY)
{ {
fout << "# this should be a shared (DLL) library \n"; fout << "# this should be a shared (DLL) library \n";
fout << "$(OUTDIRLIB)\\" << l->first << ".dll : ${" << l->first << "_SRC_OBJS} \n"; fout << "$(OUTDIRLIB)" << l->first << ".dll : ${" << l->first << "_SRC_OBJS} \n";
fout << " @ilink32.exe @&&| \n"; fout << " @ilink32.exe @&&| \n";
fout << " -L\"$(BCB)/lib\" -L$(LINK_DIR) $(LINKFLAGS_DLL) $(LINKFLAGS_DEBUG) \"$(BCB)/lib/c0d32.obj\" "; fout << " -L\"$(BCB)/lib\" -L$(LINK_DIR) $(LINKFLAGS_DLL) $(LINKFLAGS_DEBUG) \"$(BCB)/lib/c0d32.obj\" ";
fout << "$(" << l->first << "_SRC_OBJS) "; fout << "$(" << l->first << "_SRC_OBJS) ";
fout << "$(" << l->first << "_LINK_BPI) , $<, $*, "; fout << "$(" << l->first << "_LINK_BPI) , $<, $*, ";
fout << "$(" << l->first << "_LINK_LIB) $(LINK_LIB) \n"; fout << "$(" << l->first << "_LINK_LIB) $(LINK_LIB) \n";
fout << "| \n"; fout << "| \n";
fout << " @implib -w " << "$(OUTDIRLIB)\\" << l->first << ".lib " << "$(OUTDIRLIB)\\" << l->first << ".dll \n\n"; fout << " @implib -w " << "$(OUTDIRLIB)" << l->first << ".lib " << "$(OUTDIRLIB)" << l->first << ".dll \n\n";
} }
if (l->second.GetType() == cmTarget::MODULE_LIBRARY) if (l->second.GetType() == cmTarget::MODULE_LIBRARY)
{ {
fout << "# this should be a Borland Package library \n"; fout << "# this should be a Borland Package library \n";
fout << "$(OUTDIRLIB)\\" << l->first << ".bpl : ${" << l->first << "_SRC_OBJS} \n"; fout << "$(OUTDIRLIB)" << l->first << ".bpl : ${" << l->first << "_SRC_OBJS} \n";
fout << " @ilink32.exe @&&| \n"; fout << " @ilink32.exe @&&| \n";
fout << " -L\"$(BCB)/lib\" -L$(LINK_DIR) $(LINKFLAGS_BPL) $(LINKFLAGS_DEBUG) \"$(BCB)/lib/c0pkg32.obj\" "; fout << " -L\"$(BCB)/lib\" -L$(LINK_DIR) $(LINKFLAGS_BPL) $(LINKFLAGS_DEBUG) \"$(BCB)/lib/c0pkg32.obj\" ";
fout << "$(" << l->first << "_SRC_OBJS) "; fout << "$(" << l->first << "_SRC_OBJS) ";