Makefile: Always create clean target command
Borland Make complains if the phony clean target has no rule to build it. If there are no files to clean, generate and run an empty clean script.
This commit is contained in:
parent
c54fb6fede
commit
dba4962b86
|
@ -1158,8 +1158,6 @@ cmLocalUnixMakefileGenerator3
|
||||||
const std::vector<std::string>& files,
|
const std::vector<std::string>& files,
|
||||||
cmTarget& target, const char* filename)
|
cmTarget& target, const char* filename)
|
||||||
{
|
{
|
||||||
if(!files.empty())
|
|
||||||
{
|
|
||||||
std::string cleanfile = this->Makefile->GetCurrentOutputDirectory();
|
std::string cleanfile = this->Makefile->GetCurrentOutputDirectory();
|
||||||
cleanfile += "/";
|
cleanfile += "/";
|
||||||
cleanfile += this->GetTargetDirectory(target);
|
cleanfile += this->GetTargetDirectory(target);
|
||||||
|
@ -1176,9 +1174,9 @@ cmLocalUnixMakefileGenerator3
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("Could not create ", cleanfilePath.c_str());
|
cmSystemTools::Error("Could not create ", cleanfilePath.c_str());
|
||||||
}
|
}
|
||||||
|
if(!files.empty())
|
||||||
|
{
|
||||||
fout << "file(REMOVE_RECURSE\n";
|
fout << "file(REMOVE_RECURSE\n";
|
||||||
std::string remove = "$(CMAKE_COMMAND) -P ";
|
|
||||||
remove += this->Convert(cleanfile.c_str(), START_OUTPUT, SHELL);
|
|
||||||
for(std::vector<std::string>::const_iterator f = files.begin();
|
for(std::vector<std::string>::const_iterator f = files.begin();
|
||||||
f != files.end(); ++f)
|
f != files.end(); ++f)
|
||||||
{
|
{
|
||||||
|
@ -1186,6 +1184,9 @@ cmLocalUnixMakefileGenerator3
|
||||||
fout << " " << this->EscapeForCMake(fc.c_str()) << "\n";
|
fout << " " << this->EscapeForCMake(fc.c_str()) << "\n";
|
||||||
}
|
}
|
||||||
fout << ")\n";
|
fout << ")\n";
|
||||||
|
}
|
||||||
|
std::string remove = "$(CMAKE_COMMAND) -P ";
|
||||||
|
remove += this->Convert(cleanfile.c_str(), START_OUTPUT, SHELL);
|
||||||
commands.push_back(remove);
|
commands.push_back(remove);
|
||||||
|
|
||||||
// For the main clean rule add per-language cleaning.
|
// For the main clean rule add per-language cleaning.
|
||||||
|
@ -1207,7 +1208,6 @@ cmLocalUnixMakefileGenerator3
|
||||||
<< "/cmake_clean_${lang}.cmake OPTIONAL)\n"
|
<< "/cmake_clean_${lang}.cmake OPTIONAL)\n"
|
||||||
<< "endforeach()\n";
|
<< "endforeach()\n";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue