FIX: echo pb, make Nmake gen use Unix gen, factorize stuff in Unix gen
This commit is contained in:
parent
9d0a4b8a5f
commit
e455a83969
|
@ -69,6 +69,10 @@ std::string cmNMakeMakefileGenerator::ShortPath(const char* path)
|
||||||
// them back together
|
// them back together
|
||||||
std::string cmNMakeMakefileGenerator::ShortPathCommand(const char* command)
|
std::string cmNMakeMakefileGenerator::ShortPathCommand(const char* command)
|
||||||
{
|
{
|
||||||
|
if (!command)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
if(!strchr(command, ' '))
|
if(!strchr(command, ' '))
|
||||||
{
|
{
|
||||||
return command;
|
return command;
|
||||||
|
@ -248,78 +252,43 @@ void cmNMakeMakefileGenerator::OutputMakeRule(std::ostream& fout,
|
||||||
const char* command3,
|
const char* command3,
|
||||||
const char* command4)
|
const char* command4)
|
||||||
{
|
{
|
||||||
if(!target)
|
std::string short_command;
|
||||||
|
if (command)
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("no target for OutputMakeRule");
|
short_command = ShortPathCommand(command);
|
||||||
return;
|
command = short_command.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string replace;
|
std::string short_command2;
|
||||||
if(comment)
|
if (command2)
|
||||||
{
|
{
|
||||||
replace = comment;
|
short_command2 = ShortPathCommand(command2);
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
command2 = short_command2.c_str();
|
||||||
fout << "#---------------------------------------------------------\n";
|
|
||||||
fout << "# " << comment;
|
|
||||||
fout << "\n#\n";
|
|
||||||
}
|
}
|
||||||
fout << "\n";
|
|
||||||
replace = target;
|
std::string short_command3;
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
if (command3)
|
||||||
replace = this->ConvertToOutputPath(replace.c_str());
|
|
||||||
fout << replace.c_str() << ": ";
|
|
||||||
if(depends)
|
|
||||||
{
|
{
|
||||||
replace = depends;
|
short_command3 = ShortPathCommand(command3);
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
command3 = short_command3.c_str();
|
||||||
fout << replace.c_str();
|
|
||||||
}
|
}
|
||||||
fout << "\n";
|
|
||||||
if(command)
|
std::string short_command4;
|
||||||
|
if (command4)
|
||||||
{
|
{
|
||||||
replace = ShortPathCommand(command);
|
short_command4 = ShortPathCommand(command4);
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
command4 = short_command4.c_str();
|
||||||
if(replace[0] != '-' && replace.find("echo") != 0
|
|
||||||
&& replace.find("$(MAKE)") != 0)
|
|
||||||
{
|
|
||||||
fout << "\t" << "echo " << replace.c_str() << "\n";
|
|
||||||
}
|
|
||||||
fout << "\t" << replace.c_str() << "\n";
|
|
||||||
}
|
}
|
||||||
if(command2)
|
|
||||||
{
|
cmUnixMakefileGenerator::OutputMakeRule(fout,
|
||||||
replace = ShortPathCommand(command2);
|
comment,
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
target,
|
||||||
if(replace[0] != '-' && replace.find("echo") != 0
|
depends,
|
||||||
&& replace.find("$(MAKE)") != 0)
|
command,
|
||||||
{
|
command2,
|
||||||
fout << "\t" << "echo " << replace.c_str() << "\n";
|
command3,
|
||||||
}
|
command4);
|
||||||
fout << "\t" << replace.c_str() << "\n";
|
return;
|
||||||
}
|
|
||||||
if(command3)
|
|
||||||
{
|
|
||||||
replace = ShortPathCommand(command3);
|
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
|
||||||
if(replace[0] != '-' && replace.find("echo") != 0
|
|
||||||
&& replace.find("$(MAKE)") != 0)
|
|
||||||
{
|
|
||||||
fout << "\t" << "echo " << replace.c_str() << "\n";
|
|
||||||
}
|
|
||||||
fout << "\t" << replace.c_str() << "\n";
|
|
||||||
}
|
|
||||||
if(command4)
|
|
||||||
{
|
|
||||||
replace = ShortPathCommand(command4);
|
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
|
||||||
if(replace[0] != '-' && replace.find("echo") != 0
|
|
||||||
&& replace.find("$(MAKE)") != 0)
|
|
||||||
{
|
|
||||||
fout << "\t" << "echo " << replace.c_str() << "\n";
|
|
||||||
}
|
|
||||||
fout << "\t" << replace.c_str() << "\n";
|
|
||||||
}
|
|
||||||
fout << "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -2026,13 +2026,15 @@ void cmUnixMakefileGenerator::OutputMakeRule(std::ostream& fout,
|
||||||
replace = comment;
|
replace = comment;
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
fout << "#---------------------------------------------------------\n";
|
fout << "#---------------------------------------------------------\n";
|
||||||
fout << "# " << comment;
|
fout << "# " << replace;
|
||||||
fout << "\n#\n";
|
fout << "\n#\n";
|
||||||
}
|
}
|
||||||
fout << "\n";
|
fout << "\n";
|
||||||
|
|
||||||
replace = target;
|
replace = target;
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
fout << this->ConvertToOutputPath(replace.c_str()) << ": ";
|
fout << this->ConvertToOutputPath(replace.c_str()) << ": ";
|
||||||
|
|
||||||
if(depends)
|
if(depends)
|
||||||
{
|
{
|
||||||
replace = depends;
|
replace = depends;
|
||||||
|
@ -2040,62 +2042,30 @@ void cmUnixMakefileGenerator::OutputMakeRule(std::ostream& fout,
|
||||||
fout << replace.c_str();
|
fout << replace.c_str();
|
||||||
}
|
}
|
||||||
fout << "\n";
|
fout << "\n";
|
||||||
if(command)
|
|
||||||
|
const char* commands[] = { command, command2, command3, command4 };
|
||||||
|
|
||||||
|
for (int i = 0; i < sizeof(commands) / sizeof(commands[0]); ++i)
|
||||||
{
|
{
|
||||||
replace = command;
|
if(commands[i])
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
|
||||||
if(replace[0] != '-' && replace.find("echo") != 0
|
|
||||||
&& replace.find("$(MAKE)") != 0)
|
|
||||||
{
|
{
|
||||||
std::string echostring = replace;
|
replace = commands[i];
|
||||||
cmSystemTools::ReplaceString(echostring, "\n", "\\n");
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
fout << "\t" << "echo \"" << echostring.c_str() << "\"\n";
|
if(replace[0] != '-' && replace.find("echo") != 0
|
||||||
|
&& replace.find("$(MAKE)") != 0)
|
||||||
|
{
|
||||||
|
std::string echostring = replace;
|
||||||
|
cmSystemTools::ReplaceString(echostring, "\n\t", "\n\techo ");
|
||||||
|
// let's try to see what happens without \"
|
||||||
|
// fout << "\techo \"" << echostring.c_str() << "\"\n";
|
||||||
|
fout << "\techo " << echostring.c_str() << "\n";
|
||||||
|
}
|
||||||
|
fout << "\t" << replace.c_str() << "\n";
|
||||||
}
|
}
|
||||||
fout << "\t" << replace.c_str() << "\n";
|
|
||||||
}
|
|
||||||
if(command2)
|
|
||||||
{
|
|
||||||
replace = command2;
|
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
|
||||||
if(replace[0] != '-' && replace.find("echo") != 0
|
|
||||||
&& replace.find("$(MAKE)") != 0)
|
|
||||||
{
|
|
||||||
std::string echostring = replace;
|
|
||||||
cmSystemTools::ReplaceString(echostring, "\n", "\\n");
|
|
||||||
fout << "\t" << "echo \"" << echostring.c_str() << "\"\n";
|
|
||||||
}
|
|
||||||
fout << "\t" << replace.c_str() << "\n";
|
|
||||||
}
|
|
||||||
if(command3)
|
|
||||||
{
|
|
||||||
replace = command3;
|
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
|
||||||
if(replace[0] != '-' && replace.find("echo") != 0
|
|
||||||
&& replace.find("$(MAKE)") != 0)
|
|
||||||
{
|
|
||||||
std::string echostring = replace;
|
|
||||||
cmSystemTools::ReplaceString(echostring, "\n", "\\n");
|
|
||||||
fout << "\t" << "echo \"" << echostring.c_str() << "\"\n";
|
|
||||||
}
|
|
||||||
fout << "\t" << replace.c_str() << "\n";
|
|
||||||
}
|
|
||||||
if(command4)
|
|
||||||
{
|
|
||||||
replace = command4;
|
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
|
||||||
if(replace[0] != '-' && replace.find("echo") != 0
|
|
||||||
&& replace.find("$(MAKE)") != 0)
|
|
||||||
{
|
|
||||||
std::string echostring = replace;
|
|
||||||
cmSystemTools::ReplaceString(echostring, "\n", "\\n");
|
|
||||||
fout << "\t" << "echo \"" << echostring.c_str() << "\"\n";
|
|
||||||
}
|
|
||||||
fout << "\t" << replace.c_str() << "\n";
|
|
||||||
}
|
}
|
||||||
fout << "\n";
|
fout << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmUnixMakefileGenerator::SetLocal (bool local)
|
void cmUnixMakefileGenerator::SetLocal (bool local)
|
||||||
{
|
{
|
||||||
if (local)
|
if (local)
|
||||||
|
|
Loading…
Reference in New Issue