summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-10-16 13:52:37 (GMT)
committerBrad King <brad.king@kitware.com>2013-10-16 14:43:24 (GMT)
commitdba4962b868c3baa7886dcd3f8b597e971a479a2 (patch)
tree943096ec7f4740e227dbf13e36a912e9e5ec71e3 /Source/cmLocalUnixMakefileGenerator3.cxx
parentc54fb6fede9f84ce66d6b42f02abadf555f78f5e (diff)
downloadCMake-dba4962b868c3baa7886dcd3f8b597e971a479a2.zip
CMake-dba4962b868c3baa7886dcd3f8b597e971a479a2.tar.gz
CMake-dba4962b868c3baa7886dcd3f8b597e971a479a2.tar.bz2
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.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx74
1 files changed, 37 insertions, 37 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 2443583..dc401dc 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1158,27 +1158,25 @@ cmLocalUnixMakefileGenerator3
const std::vector<std::string>& files,
cmTarget& target, const char* filename)
{
+ std::string cleanfile = this->Makefile->GetCurrentOutputDirectory();
+ cleanfile += "/";
+ cleanfile += this->GetTargetDirectory(target);
+ cleanfile += "/cmake_clean";
+ if(filename)
+ {
+ cleanfile += "_";
+ cleanfile += filename;
+ }
+ cleanfile += ".cmake";
+ std::string cleanfilePath = this->Convert(cleanfile.c_str(), FULL);
+ std::ofstream fout(cleanfilePath.c_str());
+ if(!fout)
+ {
+ cmSystemTools::Error("Could not create ", cleanfilePath.c_str());
+ }
if(!files.empty())
{
- std::string cleanfile = this->Makefile->GetCurrentOutputDirectory();
- cleanfile += "/";
- cleanfile += this->GetTargetDirectory(target);
- cleanfile += "/cmake_clean";
- if(filename)
- {
- cleanfile += "_";
- cleanfile += filename;
- }
- cleanfile += ".cmake";
- std::string cleanfilePath = this->Convert(cleanfile.c_str(), FULL);
- std::ofstream fout(cleanfilePath.c_str());
- if(!fout)
- {
- cmSystemTools::Error("Could not create ", cleanfilePath.c_str());
- }
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();
f != files.end(); ++f)
{
@@ -1186,27 +1184,29 @@ cmLocalUnixMakefileGenerator3
fout << " " << this->EscapeForCMake(fc.c_str()) << "\n";
}
fout << ")\n";
- commands.push_back(remove);
-
- // For the main clean rule add per-language cleaning.
- if(!filename)
+ }
+ std::string remove = "$(CMAKE_COMMAND) -P ";
+ remove += this->Convert(cleanfile.c_str(), START_OUTPUT, SHELL);
+ commands.push_back(remove);
+
+ // For the main clean rule add per-language cleaning.
+ if(!filename)
+ {
+ // Get the set of source languages in the target.
+ std::set<cmStdString> languages;
+ target.GetLanguages(languages);
+ fout << "\n"
+ << "# Per-language clean rules from dependency scanning.\n"
+ << "foreach(lang";
+ for(std::set<cmStdString>::const_iterator l = languages.begin();
+ l != languages.end(); ++l)
{
- // Get the set of source languages in the target.
- std::set<cmStdString> languages;
- target.GetLanguages(languages);
- fout << "\n"
- << "# Per-language clean rules from dependency scanning.\n"
- << "foreach(lang";
- for(std::set<cmStdString>::const_iterator l = languages.begin();
- l != languages.end(); ++l)
- {
- fout << " " << *l;
- }
- fout << ")\n"
- << " include(" << this->GetTargetDirectory(target)
- << "/cmake_clean_${lang}.cmake OPTIONAL)\n"
- << "endforeach()\n";
+ fout << " " << *l;
}
+ fout << ")\n"
+ << " include(" << this->GetTargetDirectory(target)
+ << "/cmake_clean_${lang}.cmake OPTIONAL)\n"
+ << "endforeach()\n";
}
}