Browse Source

BUG: fix for bug 303 pass makeflags to sub makes

Bill Hoffman 22 years ago
parent
commit
3e2c1f3477

+ 1 - 1
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;
 }

+ 1 - 0
Source/cmGlobalNMakeMakefileGenerator.cxx

@@ -42,6 +42,7 @@ cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator()
   lg->SetMakeSilentFlag("/nologo");
   lg->SetGlobalGenerator(this);
   lg->SetIgnoreLibPrefix(true);
+  lg->SetPassMakeflags(true);
   return lg;
 }
 

+ 11 - 2
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"))
     {

+ 7 - 0
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:
 };