From 3e2c1f347701155f2713ab144f3c7b3cf00d8aca Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 28 Oct 2003 11:06:06 -0500 Subject: [PATCH] BUG: fix for bug 303 pass makeflags to sub makes --- Source/cmGlobalBorlandMakefileGenerator.cxx | 2 +- Source/cmGlobalNMakeMakefileGenerator.cxx | 1 + Source/cmLocalUnixMakefileGenerator.cxx | 13 +++++++++++-- Source/cmLocalUnixMakefileGenerator.h | 7 +++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index cc384da8b..685721962 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -55,7 +55,7 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator() lg->SetIncludeDirective("!include"); lg->SetWindowsShell(true); lg->SetMakefileVariableSize(32); - + lg->SetPassMakeflags(true); lg->SetGlobalGenerator(this); return lg; } diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 8615dd5a1..ccba3a449 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -42,6 +42,7 @@ cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator() lg->SetMakeSilentFlag("/nologo"); lg->SetGlobalGenerator(this); lg->SetIgnoreLibPrefix(true); + lg->SetPassMakeflags(true); return lg; } diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx index b596b80e5..f444c410f 100644 --- a/Source/cmLocalUnixMakefileGenerator.cxx +++ b/Source/cmLocalUnixMakefileGenerator.cxx @@ -31,6 +31,7 @@ cmLocalUnixMakefileGenerator::cmLocalUnixMakefileGenerator() m_IncludeDirective = "include"; m_MakefileVariableSize = 0; m_IgnoreLibPrefix = false; + m_PassMakeflags = false; } cmLocalUnixMakefileGenerator::~cmLocalUnixMakefileGenerator() @@ -232,6 +233,14 @@ void cmLocalUnixMakefileGenerator::OutputMakefile(const char* file, std::string checkCache = m_Makefile->GetHomeOutputDirectory(); checkCache += "/cmake.check_cache"; checkCache = cmSystemTools::ConvertToOutputPath(checkCache.c_str()); + // most unix makes will pass the command line flags to make down + // to sub invoked makes via an environment variable. However, some + // makes do not support that, so you have to pass the flags explicitly + const char* allRule = "$(MAKE) $(MAKESILENT) all"; + if(m_PassMakeflags) + { + allRule = "$(MAKE) $(MAKESILENT) -$(MAKEFLAGS) all"; + } // Set up the default target as the VERY first target, so that make with no arguments will run it this-> OutputMakeRule(fout, @@ -241,8 +250,8 @@ void cmLocalUnixMakefileGenerator::OutputMakefile(const char* file, "$(MAKE) $(MAKESILENT) cmake.depends", "$(MAKE) $(MAKESILENT) cmake.check_depends", "$(MAKE) $(MAKESILENT) -f cmake.check_depends", - "$(MAKE) $(MAKESILENT) all"); - + allRule); + // Generation of SILENT target must be after default_target. if(!m_Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")) { diff --git a/Source/cmLocalUnixMakefileGenerator.h b/Source/cmLocalUnixMakefileGenerator.h index 6e16a2c52..2bbb9d390 100644 --- a/Source/cmLocalUnixMakefileGenerator.h +++ b/Source/cmLocalUnixMakefileGenerator.h @@ -80,6 +80,12 @@ public: ///! If ignore lib prefix is true, then do not strip lib from the name of a library. void SetIgnoreLibPrefix(bool s) { m_IgnoreLibPrefix = s; } + /** + * If true, then explicitly pass MAKEFLAGS on the make all target for makes + * that do not use environment variables. + * + */ + void SetPassMakeflags(bool s){m_PassMakeflags = s;} protected: void AddDependenciesToSourceFile(cmDependInformation const*info, @@ -227,6 +233,7 @@ protected: std::string m_ExecutableOutputPath; std::string m_LibraryOutputPath; bool m_WindowsShell; + bool m_PassMakeflags; private: };