ENH: add silent mode for makefile builds and fix borland and nmake after the depend stuff
This commit is contained in:
parent
384cf0c7f3
commit
b67dc16be6
@ -100,7 +100,7 @@ void cmBorlandMakefileGenerator::OutputMakeVariables(std::ostream& fout)
|
|||||||
"CMAKE_SHLIB_SUFFIX = @CMAKE_SHLIB_SUFFIX@\n"
|
"CMAKE_SHLIB_SUFFIX = @CMAKE_SHLIB_SUFFIX@\n"
|
||||||
"CMAKE_LINKER_FLAGS = @CMAKE_LINKER_FLAGS@ @LINKER_BUILD_FLAGS@\n"
|
"CMAKE_LINKER_FLAGS = @CMAKE_LINKER_FLAGS@ @LINKER_BUILD_FLAGS@\n"
|
||||||
"CMAKE_CXX_FLAGS = -P @CMAKE_CXX_FLAGS@ @BUILD_FLAGS@\n"
|
"CMAKE_CXX_FLAGS = -P @CMAKE_CXX_FLAGS@ @BUILD_FLAGS@\n"
|
||||||
"RM = del";
|
"RM = del\n";
|
||||||
std::string buildType = "CMAKE_CXX_FLAGS_";
|
std::string buildType = "CMAKE_CXX_FLAGS_";
|
||||||
buildType += m_Makefile->GetDefinition("CMAKE_BUILD_TYPE");
|
buildType += m_Makefile->GetDefinition("CMAKE_BUILD_TYPE");
|
||||||
buildType = cmSystemTools::UpperCase(buildType);
|
buildType = cmSystemTools::UpperCase(buildType);
|
||||||
@ -165,100 +165,6 @@ void cmBorlandMakefileGenerator::OutputMakeVariables(std::ostream& fout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmBorlandMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
|
|
||||||
const char* directory,
|
|
||||||
const char* target1,
|
|
||||||
const char* target2)
|
|
||||||
{
|
|
||||||
if(target1)
|
|
||||||
{
|
|
||||||
std::string dir = directory;
|
|
||||||
cmSystemTools::ConvertToWindowsSlashes(dir);
|
|
||||||
fout << "\tif not exist " << cmSystemTools::EscapeSpaces(dir.c_str())
|
|
||||||
<< " "
|
|
||||||
<< "$(MAKE) rebuild_cache\n"
|
|
||||||
<< "\tcd .\\" << directory << "\n"
|
|
||||||
<< "\t$(MAKE) -$(MAKEFLAGS) " << target1 << "\n";
|
|
||||||
}
|
|
||||||
if(target2)
|
|
||||||
{
|
|
||||||
fout << "\t$(MAKE) -$(MAKEFLAGS) " << target2 << "\n";
|
|
||||||
}
|
|
||||||
std::string currentDir = m_Makefile->GetCurrentOutputDirectory();
|
|
||||||
cmSystemTools::ConvertToWindowsSlashes(currentDir);
|
|
||||||
fout << "\tcd " << cmSystemTools::EscapeSpaces(currentDir.c_str()) << "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// This needs to be overriden because nmake requires commands to be quoted
|
|
||||||
// if the are full paths to the executable????
|
|
||||||
|
|
||||||
void cmBorlandMakefileGenerator::OutputMakeRule(std::ostream& fout,
|
|
||||||
const char* comment,
|
|
||||||
const char* target,
|
|
||||||
const char* depends,
|
|
||||||
const char* command,
|
|
||||||
const char* command2,
|
|
||||||
const char* command3,
|
|
||||||
const char* command4)
|
|
||||||
{
|
|
||||||
if(!target)
|
|
||||||
{
|
|
||||||
cmSystemTools::Error("no target for OutputMakeRule");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string replace;
|
|
||||||
if(comment)
|
|
||||||
{
|
|
||||||
replace = comment;
|
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
|
||||||
fout << "#---------------------------------------------------------\n";
|
|
||||||
fout << "# " << comment;
|
|
||||||
fout << "\n#\n";
|
|
||||||
}
|
|
||||||
fout << "\n";
|
|
||||||
replace = target;
|
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
|
||||||
replace = cmSystemTools::EscapeSpaces(replace.c_str());
|
|
||||||
fout << replace.c_str() << ": ";
|
|
||||||
if(depends)
|
|
||||||
{
|
|
||||||
replace = depends;
|
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
|
||||||
fout << replace.c_str();
|
|
||||||
}
|
|
||||||
fout << "\n";
|
|
||||||
const char* startCommand = "\t";
|
|
||||||
const char* endCommand = "\n";
|
|
||||||
if(command)
|
|
||||||
{
|
|
||||||
replace = ShortPathCommand(command);
|
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
|
||||||
fout << startCommand << replace.c_str() << endCommand;
|
|
||||||
}
|
|
||||||
if(command2)
|
|
||||||
{
|
|
||||||
replace = ShortPathCommand(command2);
|
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
|
||||||
fout << startCommand << replace.c_str() << endCommand;
|
|
||||||
}
|
|
||||||
if(command3)
|
|
||||||
{
|
|
||||||
replace = ShortPathCommand(command3);
|
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
|
||||||
fout << startCommand << replace.c_str() << endCommand;
|
|
||||||
}
|
|
||||||
if(command4)
|
|
||||||
{
|
|
||||||
replace = ShortPathCommand(command4);
|
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
|
||||||
fout << startCommand << replace.c_str() << endCommand;
|
|
||||||
}
|
|
||||||
fout << "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cmBorlandMakefileGenerator::
|
cmBorlandMakefileGenerator::
|
||||||
@ -500,13 +406,4 @@ bool cmBorlandMakefileGenerator::SamePath(const char* path1, const char* path2)
|
|||||||
cmSystemTools::LowerCase(ShortPath(path2));
|
cmSystemTools::LowerCase(ShortPath(path2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmBorlandMakefileGenerator::OutputBuildLibraryInDir(std::ostream& fout,
|
|
||||||
const char* path,
|
|
||||||
const char* s,
|
|
||||||
const char* fullpath)
|
|
||||||
{
|
|
||||||
cmNMakeMakefileGenerator::OutputBuildLibraryInDir(fout, path, s, fullpath);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,19 +68,6 @@ public:
|
|||||||
virtual void ComputeSystemInfo();
|
virtual void ComputeSystemInfo();
|
||||||
protected:
|
protected:
|
||||||
virtual void OutputMakeVariables(std::ostream&);
|
virtual void OutputMakeVariables(std::ostream&);
|
||||||
virtual void BuildInSubDirectory(std::ostream& fout,
|
|
||||||
const char* directory,
|
|
||||||
const char* target1,
|
|
||||||
const char* target2);
|
|
||||||
void OutputMakeRule(std::ostream& fout,
|
|
||||||
const char* comment,
|
|
||||||
const char* target,
|
|
||||||
const char* depends,
|
|
||||||
const char* command,
|
|
||||||
const char* command2=0,
|
|
||||||
const char* command3=0,
|
|
||||||
const char* command4=0);
|
|
||||||
|
|
||||||
|
|
||||||
virtual void OutputBuildObjectFromSource(std::ostream& fout,
|
virtual void OutputBuildObjectFromSource(std::ostream& fout,
|
||||||
const char* shortName,
|
const char* shortName,
|
||||||
@ -96,10 +83,6 @@ protected:
|
|||||||
virtual void OutputExecutableRule(std::ostream&, const char* name,
|
virtual void OutputExecutableRule(std::ostream&, const char* name,
|
||||||
const cmTarget &);
|
const cmTarget &);
|
||||||
virtual std::string GetOutputExtension(const char* sourceExtension);
|
virtual std::string GetOutputExtension(const char* sourceExtension);
|
||||||
virtual void OutputBuildLibraryInDir(std::ostream& fout,
|
|
||||||
const char* path,
|
|
||||||
const char* library,
|
|
||||||
const char* fullpath);
|
|
||||||
///! return true if the two paths are the same (checks short paths)
|
///! return true if the two paths are the same (checks short paths)
|
||||||
virtual bool SamePath(const char* path1, const char* path2);
|
virtual bool SamePath(const char* path1, const char* path2);
|
||||||
};
|
};
|
||||||
|
@ -239,14 +239,17 @@ void cmNMakeMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
|
|||||||
{
|
{
|
||||||
std::string dir = directory;
|
std::string dir = directory;
|
||||||
cmSystemTools::ConvertToWindowsSlashes(dir);
|
cmSystemTools::ConvertToWindowsSlashes(dir);
|
||||||
fout << "\tif not exist " << cmSystemTools::EscapeSpaces(dir.c_str())
|
dir = cmSystemTools::EscapeSpaces(dir.c_str());
|
||||||
|
fout << "\tif not exist " << dir
|
||||||
<< " "
|
<< " "
|
||||||
<< "$(MAKE) rebuild_cache\n"
|
<< "$(MAKE) rebuild_cache\n"
|
||||||
<< "\tcd .\\" << directory << "\n"
|
<< "\techo Building " << target1 << " in directory " << directory << "\n"
|
||||||
|
<< "\tcd " << dir << "\n"
|
||||||
<< "\t$(MAKE) -$(MAKEFLAGS) " << target1 << "\n";
|
<< "\t$(MAKE) -$(MAKEFLAGS) " << target1 << "\n";
|
||||||
}
|
}
|
||||||
if(target2)
|
if(target2)
|
||||||
{
|
{
|
||||||
|
fout << "\techo Building " << target2 << " in directory " << directory << "\n";
|
||||||
fout << "\t$(MAKE) -$(MAKEFLAGS) " << target2 << "\n";
|
fout << "\t$(MAKE) -$(MAKEFLAGS) " << target2 << "\n";
|
||||||
}
|
}
|
||||||
std::string currentDir = m_Makefile->GetCurrentOutputDirectory();
|
std::string currentDir = m_Makefile->GetCurrentOutputDirectory();
|
||||||
@ -296,31 +299,33 @@ void cmNMakeMakefileGenerator::OutputMakeRule(std::ostream& fout,
|
|||||||
fout << replace.c_str();
|
fout << replace.c_str();
|
||||||
}
|
}
|
||||||
fout << "\n";
|
fout << "\n";
|
||||||
const char* startCommand = "\t";
|
|
||||||
const char* endCommand = "\n";
|
|
||||||
if(command)
|
if(command)
|
||||||
{
|
{
|
||||||
replace = ShortPathCommand(command);
|
replace = ShortPathCommand(command);
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
fout << startCommand << replace.c_str() << endCommand;
|
fout << "\t" << "echo " << replace.c_str() << "\n";
|
||||||
|
fout << "\t" << replace.c_str() << "\n";
|
||||||
}
|
}
|
||||||
if(command2)
|
if(command2)
|
||||||
{
|
{
|
||||||
replace = ShortPathCommand(command2);
|
replace = ShortPathCommand(command2);
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
fout << startCommand << replace.c_str() << endCommand;
|
fout << "\t" << "echo " << replace.c_str() << "\n";
|
||||||
|
fout << "\t" << replace.c_str() << "\n";
|
||||||
}
|
}
|
||||||
if(command3)
|
if(command3)
|
||||||
{
|
{
|
||||||
replace = ShortPathCommand(command3);
|
replace = ShortPathCommand(command3);
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
fout << startCommand << replace.c_str() << endCommand;
|
fout << "\t" << "echo " << replace.c_str() << "\n";
|
||||||
|
fout << "\t" << replace.c_str() << "\n";
|
||||||
}
|
}
|
||||||
if(command4)
|
if(command4)
|
||||||
{
|
{
|
||||||
replace = ShortPathCommand(command4);
|
replace = ShortPathCommand(command4);
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
fout << startCommand << replace.c_str() << endCommand;
|
fout << "\t" << "echo " << replace.c_str() << "\n";
|
||||||
|
fout << "\t" << replace.c_str() << "\n";
|
||||||
}
|
}
|
||||||
fout << "\n";
|
fout << "\n";
|
||||||
}
|
}
|
||||||
|
@ -972,11 +972,13 @@ void cmUnixMakefileGenerator::BuildInSubDirectory(std::ostream& fout,
|
|||||||
{
|
{
|
||||||
fout << "\t@if test ! -d " << directory
|
fout << "\t@if test ! -d " << directory
|
||||||
<< "; then $(MAKE) rebuild_cache; fi\n"
|
<< "; then $(MAKE) rebuild_cache; fi\n"
|
||||||
"\t@cd " << directory
|
<< "\techo Building " << target1 << " in directory " << directory << "\n"
|
||||||
|
<< "\t@cd " << directory
|
||||||
<< "; $(MAKE) -$(MAKEFLAGS) " << target1 << "\n";
|
<< "; $(MAKE) -$(MAKEFLAGS) " << target1 << "\n";
|
||||||
}
|
}
|
||||||
if(target2)
|
if(target2)
|
||||||
{
|
{
|
||||||
|
fout << "\techo Building " << target2 << " in directory " << directory << "\n";
|
||||||
fout << "\t@cd " << directory
|
fout << "\t@cd " << directory
|
||||||
<< "; $(MAKE) -$(MAKEFLAGS) " << target2 << "\n";
|
<< "; $(MAKE) -$(MAKEFLAGS) " << target2 << "\n";
|
||||||
}
|
}
|
||||||
@ -1029,7 +1031,10 @@ OutputSubDirectoryVars(std::ostream& fout,
|
|||||||
|
|
||||||
fout << "\n";
|
fout << "\n";
|
||||||
last = subdir;
|
last = subdir;
|
||||||
this->BuildInSubDirectory(fout, SubDirectories[i].c_str(),
|
std::string dir = m_Makefile->GetCurrentOutputDirectory();
|
||||||
|
dir += "/";
|
||||||
|
dir += SubDirectories[i];
|
||||||
|
this->BuildInSubDirectory(fout, dir.c_str(),
|
||||||
target1, target2);
|
target1, target2);
|
||||||
}
|
}
|
||||||
fout << "\n\n";
|
fout << "\n\n";
|
||||||
@ -1499,24 +1504,23 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
|
|||||||
"-@ $(RM) $(CLEAN_OBJECT_FILES) $(EXECUTABLES)"
|
"-@ $(RM) $(CLEAN_OBJECT_FILES) $(EXECUTABLES)"
|
||||||
" $(TARGETS)");
|
" $(TARGETS)");
|
||||||
}
|
}
|
||||||
{
|
fout << "# Suppresses display of executed commands\n";
|
||||||
std::string cmake_depends_mark = "@cd ";
|
fout << ".SILENT:\n";
|
||||||
cmake_depends_mark += m_Makefile->GetHomeOutputDirectory();
|
fout << "\n#Rule to build the cmake.depends and Makefile as side effect\n";
|
||||||
cmake_depends_mark += " ; $(MAKE) depend";
|
fout << "cmake.depends_mark: $(CMAKE_MAKEFILE_SOURCES)\n";
|
||||||
this->OutputMakeRule(fout,
|
this->BuildInSubDirectory(fout,
|
||||||
"Rule to build the cmake.depends and Makefile as side effect",
|
m_Makefile->GetHomeOutputDirectory(),
|
||||||
"cmake.depends_mark",
|
"depend", 0);
|
||||||
"$(CMAKE_MAKEFILE_SOURCES) ",
|
|
||||||
cmake_depends_mark.c_str());
|
|
||||||
}
|
|
||||||
this->OutputMakeRule(fout,
|
this->OutputMakeRule(fout,
|
||||||
"Rule to force the build of cmake.depends",
|
"Rule to force the build of cmake.depends",
|
||||||
"depend",
|
"depend",
|
||||||
"$(SUBDIR_DEPEND)",
|
"$(SUBDIR_DEPEND)",
|
||||||
"$(CMAKE_COMMAND) "
|
"$(CMAKE_COMMAND) "
|
||||||
"-S$(CMAKE_CURRENT_SOURCE) -O$(CMAKE_CURRENT_BINARY) "
|
"-S$(CMAKE_CURRENT_SOURCE) -O$(CMAKE_CURRENT_BINARY) "
|
||||||
"-H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)\n"
|
"-H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)",
|
||||||
"\t-@ $(RM) cmake.depends_mark ; echo mark > cmake.depends_mark");
|
"-$(RM) cmake.depends_mark",
|
||||||
|
"echo mark > cmake.depends_mark"
|
||||||
|
);
|
||||||
this->OutputMakeRule(fout,
|
this->OutputMakeRule(fout,
|
||||||
"Rebuild CMakeCache.txt file",
|
"Rebuild CMakeCache.txt file",
|
||||||
"rebuild_cache",
|
"rebuild_cache",
|
||||||
@ -1735,24 +1739,28 @@ void cmUnixMakefileGenerator::OutputMakeRule(std::ostream& fout,
|
|||||||
{
|
{
|
||||||
replace = command;
|
replace = command;
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
|
fout << "\t" << "echo " << replace.c_str() << "\n";
|
||||||
fout << "\t" << replace.c_str() << "\n";
|
fout << "\t" << replace.c_str() << "\n";
|
||||||
}
|
}
|
||||||
if(command2)
|
if(command2)
|
||||||
{
|
{
|
||||||
replace = command2;
|
replace = command2;
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
|
fout << "\t" << "echo " << replace.c_str() << "\n";
|
||||||
fout << "\t" << replace.c_str() << "\n";
|
fout << "\t" << replace.c_str() << "\n";
|
||||||
}
|
}
|
||||||
if(command3)
|
if(command3)
|
||||||
{
|
{
|
||||||
replace = command3;
|
replace = command3;
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
|
fout << "\t" << "echo " << replace.c_str() << "\n";
|
||||||
fout << "\t" << replace.c_str() << "\n";
|
fout << "\t" << replace.c_str() << "\n";
|
||||||
}
|
}
|
||||||
if(command4)
|
if(command4)
|
||||||
{
|
{
|
||||||
replace = command4;
|
replace = command4;
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
|
fout << "\t" << "echo " << replace.c_str() << "\n";
|
||||||
fout << "\t" << replace.c_str() << "\n";
|
fout << "\t" << replace.c_str() << "\n";
|
||||||
}
|
}
|
||||||
fout << "\n";
|
fout << "\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user