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:
Brad King 2013-10-16 09:52:37 -04:00
parent c54fb6fede
commit dba4962b86
1 changed files with 36 additions and 36 deletions

View File

@ -1157,8 +1157,6 @@ cmLocalUnixMakefileGenerator3
::AppendCleanCommand(std::vector<std::string>& commands, ::AppendCleanCommand(std::vector<std::string>& commands,
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 += "/";
@ -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.
@ -1208,7 +1209,6 @@ cmLocalUnixMakefileGenerator3
<< "endforeach()\n"; << "endforeach()\n";
} }
} }
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void