summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2005-05-20 15:01:21 (GMT)
committerKen Martin <ken.martin@kitware.com>2005-05-20 15:01:21 (GMT)
commit60bcce7fa2956d3017666cd8805979b40ef1523b (patch)
treed81e589ffe9ef2a5abe72e00d1cc4451648d607c /Source/cmLocalUnixMakefileGenerator3.cxx
parentdb3d2038934eb7defe05a76b5f417781082714de (diff)
downloadCMake-60bcce7fa2956d3017666cd8805979b40ef1523b.zip
CMake-60bcce7fa2956d3017666cd8805979b40ef1523b.tar.gz
CMake-60bcce7fa2956d3017666cd8805979b40ef1523b.tar.bz2
ENH: added help target and made custom commands execute in start output directory
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx48
1 files changed, 46 insertions, 2 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index a0d9ca7..f5cf7cf 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -645,7 +645,10 @@ cmLocalUnixMakefileGenerator3
temp = relativeObj;
temp += ".provides.build";
std::vector<std::string> r_commands;
- r_commands.push_back(this->GetRecursiveMakeCall("build.make",temp.c_str()));
+ std::string tgtMakefileName = this->GetRelativeTargetDirectory(target);
+ tgtMakefileName += "/build.make";
+ r_commands.push_back(this->GetRecursiveMakeCall(tgtMakefileName.c_str(),
+ temp.c_str()));
p_depends.clear();
p_depends.push_back(objectRequires);
this->WriteMakeRule(ruleFileStream, 0,
@@ -2514,6 +2517,8 @@ cmLocalUnixMakefileGenerator3
const cmCustomCommand& cc)
{
// TODO: Convert outputs/dependencies (arguments?) to relative paths.
+
+ std::vector<std::string> commands1;
// Add each command line to the set of commands.
for(cmCustomCommandLines::const_iterator cl = cc.GetCommandLines().begin();
@@ -2523,7 +2528,7 @@ cmLocalUnixMakefileGenerator3
const cmCustomCommandLine& commandLine = *cl;
std::string cmd = commandLine[0];
cmSystemTools::ReplaceString(cmd, "/./", "/");
- cmd = this->Convert(cmd.c_str(),HOME_OUTPUT);
+ cmd = this->Convert(cmd.c_str(),START_OUTPUT);
if(cmd.find("/") == cmd.npos &&
commandLine[0].find("/") != cmd.npos)
{
@@ -2536,6 +2541,45 @@ cmLocalUnixMakefileGenerator3
cmd += " ";
cmd += cmSystemTools::EscapeSpaces(commandLine[j].c_str());
}
+
+ commands1.push_back(cmd);
+ }
+
+ // stick this group of commands into a cd of the proper path
+ // Build the jump-and-build command list.
+ if(m_WindowsShell)
+ {
+ // On Windows we must perform each step separately and then jump
+ // back because the shell keeps the working directory between
+ // commands.
+ std::string cmd = "cd ";
+ cmd += this->ConvertToOutputForExisting(m_Makefile->GetStartOutputDirectory());
+ commands.push_back(cmd);
+
+ // push back the custom commands
+ commands.insert(commands.end(), commands1.begin(), commands1.end());
+
+ // Jump back to the home directory.
+ cmd = "cd ";
+ cmd += this->ConvertToOutputForExisting(m_Makefile->GetHomeOutputDirectory());
+ commands.push_back(cmd);
+ }
+ else
+ {
+ // On UNIX we must construct a single shell command to jump and
+ // build because make resets the directory between each command.
+ std::string cmd = "cd ";
+ cmd += this->ConvertToOutputForExisting(m_Makefile->GetStartOutputDirectory());
+
+ // add the commands
+ unsigned int i;
+ for (i = 0; i < commands1.size(); ++i)
+ {
+ cmd += " && ";
+ cmd += commands1[i];
+ }
+
+ // Add the command as a single line.
commands.push_back(cmd);
}
}