cmGlobalUnixMakefileGenerator3.cxx 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator3
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmGlobalUnixMakefileGenerator3.h"
  14. #include "cmLocalUnixMakefileGenerator3.h"
  15. #include "cmMakefile.h"
  16. #include "cmake.h"
  17. #include "cmGeneratedFileStream.h"
  18. #include "cmSourceFile.h"
  19. #include "cmTarget.h"
  20. cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3()
  21. {
  22. // This type of makefile always requires unix style paths
  23. this->ForceUnixPaths = true;
  24. this->FindMakeProgramFile = "CMakeUnixFindMake.cmake";
  25. this->ToolSupportsColor = true;
  26. this->ForceVerboseMakefiles = false;
  27. #ifdef _WIN32
  28. this->UseLinkScript = false;
  29. #else
  30. this->UseLinkScript = true;
  31. #endif
  32. }
  33. void cmGlobalUnixMakefileGenerator3
  34. ::EnableLanguage(std::vector<std::string>const& languages,
  35. cmMakefile *mf,
  36. bool optional)
  37. {
  38. this->cmGlobalGenerator::EnableLanguage(languages, mf, optional);
  39. std::string path;
  40. for(std::vector<std::string>::const_iterator l = languages.begin();
  41. l != languages.end(); ++l)
  42. {
  43. if(*l == "NONE")
  44. {
  45. continue;
  46. }
  47. const char* lang = l->c_str();
  48. std::string langComp = "CMAKE_";
  49. langComp += lang;
  50. langComp += "_COMPILER";
  51. if(!mf->GetDefinition(langComp.c_str()))
  52. {
  53. cmSystemTools::Error(langComp.c_str(),
  54. " not set, after EnableLanguage");
  55. continue;
  56. }
  57. const char* name = mf->GetRequiredDefinition(langComp.c_str());
  58. if(!cmSystemTools::FileIsFullPath(name))
  59. {
  60. path = cmSystemTools::FindProgram(name);
  61. }
  62. else
  63. {
  64. path = name;
  65. }
  66. if((path.size() == 0 || !cmSystemTools::FileExists(path.c_str()))
  67. && (optional==false))
  68. {
  69. std::string message = "your ";
  70. message += lang;
  71. message += " compiler: \"";
  72. message += name;
  73. message += "\" was not found. Please set ";
  74. message += langComp;
  75. message += " to a valid compiler path or name.";
  76. cmSystemTools::Error(message.c_str());
  77. path = name;
  78. }
  79. std::string doc = lang;
  80. doc += " compiler.";
  81. mf->AddCacheDefinition(langComp.c_str(), path.c_str(),
  82. doc.c_str(), cmCacheManager::FILEPATH);
  83. }
  84. }
  85. ///! Create a local generator appropriate to this Global Generator
  86. cmLocalGenerator *cmGlobalUnixMakefileGenerator3::CreateLocalGenerator()
  87. {
  88. cmLocalGenerator* lg = new cmLocalUnixMakefileGenerator3;
  89. lg->SetGlobalGenerator(this);
  90. return lg;
  91. }
  92. //----------------------------------------------------------------------------
  93. void cmGlobalUnixMakefileGenerator3
  94. ::GetDocumentation(cmDocumentationEntry& entry) const
  95. {
  96. entry.name = this->GetName();
  97. entry.brief = "Generates standard UNIX makefiles.";
  98. entry.full =
  99. "A hierarchy of UNIX makefiles is generated into the build tree. Any "
  100. "standard UNIX-style make program can build the project through the "
  101. "default make target. A \"make install\" target is also provided.";
  102. }
  103. //----------------------------------------------------------------------------
  104. void
  105. cmGlobalUnixMakefileGenerator3
  106. ::AddMultipleOutputPair(const char* depender, const char* dependee)
  107. {
  108. MultipleOutputPairsType::value_type p(depender, dependee);
  109. this->MultipleOutputPairs.insert(p);
  110. }
  111. //----------------------------------------------------------------------------
  112. void cmGlobalUnixMakefileGenerator3::Generate()
  113. {
  114. // first do superclass method
  115. this->cmGlobalGenerator::Generate();
  116. // initialize progress
  117. unsigned int i;
  118. unsigned long total = 0;
  119. for (i = 0; i < this->LocalGenerators.size(); ++i)
  120. {
  121. cmLocalUnixMakefileGenerator3 *lg =
  122. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
  123. total += lg->GetNumberOfProgressActions();
  124. }
  125. // write each target's progress.make this loop is done twice. Bascially the
  126. // Generate pass counts all the actions, the first loop below determines
  127. // how many actions have progress updates for each target and writes to
  128. // corrrect variable values for everything except the all targets. The
  129. // second loop actually writes out correct values for the all targets as
  130. // well. This is because the all targets require more information that is
  131. // computed in the first loop.
  132. unsigned long current = 0;
  133. for (i = 0; i < this->LocalGenerators.size(); ++i)
  134. {
  135. cmLocalUnixMakefileGenerator3 *lg =
  136. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
  137. lg->WriteProgressVariables(total,current);
  138. }
  139. for (i = 0; i < this->LocalGenerators.size(); ++i)
  140. {
  141. cmLocalUnixMakefileGenerator3 *lg =
  142. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
  143. lg->WriteAllProgressVariable();
  144. }
  145. // write the main makefile
  146. this->WriteMainMakefile2();
  147. this->WriteMainCMakefile();
  148. }
  149. void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
  150. {
  151. // Open the output file. This should not be copy-if-different
  152. // because the check-build-system step compares the makefile time to
  153. // see if the build system must be regenerated.
  154. std::string makefileName =
  155. this->GetCMakeInstance()->GetHomeOutputDirectory();
  156. makefileName += cmake::GetCMakeFilesDirectory();
  157. makefileName += "/Makefile2";
  158. cmGeneratedFileStream makefileStream(makefileName.c_str());
  159. if(!makefileStream)
  160. {
  161. return;
  162. }
  163. // get a local generator for some useful methods
  164. cmLocalUnixMakefileGenerator3 *lg =
  165. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
  166. // Write the do not edit header.
  167. lg->WriteDisclaimer(makefileStream);
  168. // Write the main entry point target. This must be the VERY first
  169. // target so that make with no arguments will run it.
  170. // Just depend on the all target to drive the build.
  171. std::vector<std::string> depends;
  172. std::vector<std::string> no_commands;
  173. depends.push_back("all");
  174. // Write the rule.
  175. lg->WriteMakeRule(makefileStream,
  176. "Default target executed when no arguments are "
  177. "given to make.",
  178. "default_target",
  179. depends,
  180. no_commands, true);
  181. depends.clear();
  182. // The all and preinstall rules might never have any dependencies
  183. // added to them.
  184. if(this->EmptyRuleHackDepends != "")
  185. {
  186. depends.push_back(this->EmptyRuleHackDepends);
  187. }
  188. // Write and empty all:
  189. lg->WriteMakeRule(makefileStream,
  190. "The main recursive all target", "all",
  191. depends, no_commands, true);
  192. // Write an empty preinstall:
  193. lg->WriteMakeRule(makefileStream,
  194. "The main recursive preinstall target", "preinstall",
  195. depends, no_commands, true);
  196. // Write out the "special" stuff
  197. lg->WriteSpecialTargetsTop(makefileStream);
  198. // write the target convenience rules
  199. unsigned int i;
  200. for (i = 0; i < this->LocalGenerators.size(); ++i)
  201. {
  202. lg =
  203. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
  204. // are any parents excluded
  205. bool exclude = false;
  206. cmLocalGenerator *lg3 = lg;
  207. while (lg3)
  208. {
  209. if (lg3->GetMakefile()->GetPropertyAsBool("EXCLUDE_FROM_ALL"))
  210. {
  211. exclude = true;
  212. break;
  213. }
  214. lg3 = lg3->GetParent();
  215. }
  216. this->WriteConvenienceRules2(makefileStream,lg,exclude);
  217. }
  218. lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
  219. lg->WriteSpecialTargetsBottom(makefileStream);
  220. }
  221. //----------------------------------------------------------------------------
  222. void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
  223. {
  224. // Open the output file. This should not be copy-if-different
  225. // because the check-build-system step compares the makefile time to
  226. // see if the build system must be regenerated.
  227. std::string cmakefileName =
  228. this->GetCMakeInstance()->GetHomeOutputDirectory();
  229. cmakefileName += cmake::GetCMakeFilesDirectory();
  230. cmakefileName += "/Makefile.cmake";
  231. cmGeneratedFileStream cmakefileStream(cmakefileName.c_str());
  232. if(!cmakefileStream)
  233. {
  234. return;
  235. }
  236. std::string makefileName =
  237. this->GetCMakeInstance()->GetHomeOutputDirectory();
  238. makefileName += "/Makefile";
  239. // get a local generator for some useful methods
  240. cmLocalUnixMakefileGenerator3 *lg =
  241. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
  242. // Write the do not edit header.
  243. lg->WriteDisclaimer(cmakefileStream);
  244. // Save the generator name
  245. cmakefileStream
  246. << "# The generator used is:\n"
  247. << "SET(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n";
  248. // for each cmMakefile get its list of dependencies
  249. std::vector<std::string> lfiles;
  250. for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
  251. {
  252. lg =
  253. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
  254. // Get the list of files contributing to this generation step.
  255. lfiles.insert(lfiles.end(),lg->GetMakefile()->GetListFiles().begin(),
  256. lg->GetMakefile()->GetListFiles().end());
  257. }
  258. // Sort the list and remove duplicates.
  259. std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>());
  260. std::vector<std::string>::iterator new_end =
  261. std::unique(lfiles.begin(),lfiles.end());
  262. lfiles.erase(new_end, lfiles.end());
  263. // reset lg to the first makefile
  264. lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
  265. // Build the path to the cache file.
  266. std::string cache = this->GetCMakeInstance()->GetHomeOutputDirectory();
  267. cache += "/CMakeCache.txt";
  268. // Save the list to the cmake file.
  269. cmakefileStream
  270. << "# The top level Makefile was generated from the following files:\n"
  271. << "SET(CMAKE_MAKEFILE_DEPENDS\n"
  272. << " \""
  273. << lg->Convert(cache.c_str(),
  274. cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
  275. for(std::vector<std::string>::const_iterator i = lfiles.begin();
  276. i != lfiles.end(); ++i)
  277. {
  278. cmakefileStream
  279. << " \""
  280. << lg->Convert(i->c_str(), cmLocalGenerator::START_OUTPUT).c_str()
  281. << "\"\n";
  282. }
  283. cmakefileStream
  284. << " )\n\n";
  285. // Build the path to the cache check file.
  286. std::string check = this->GetCMakeInstance()->GetHomeOutputDirectory();
  287. check += cmake::GetCMakeFilesDirectory();
  288. check += "/cmake.check_cache";
  289. // Set the corresponding makefile in the cmake file.
  290. cmakefileStream
  291. << "# The corresponding makefile is:\n"
  292. << "SET(CMAKE_MAKEFILE_OUTPUTS\n"
  293. << " \""
  294. << lg->Convert(makefileName.c_str(),
  295. cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"
  296. << " \""
  297. << lg->Convert(check.c_str(),
  298. cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
  299. // add in all the directory information files
  300. std::string tmpStr;
  301. for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
  302. {
  303. lg =
  304. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
  305. tmpStr = lg->GetMakefile()->GetStartOutputDirectory();
  306. tmpStr += cmake::GetCMakeFilesDirectory();
  307. tmpStr += "/CMakeDirectoryInformation.cmake";
  308. cmakefileStream << " \"" <<
  309. lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
  310. << "\"\n";
  311. const std::vector<std::string>& outfiles =
  312. lg->GetMakefile()->GetOutputFiles();
  313. for(std::vector<std::string>::const_iterator k= outfiles.begin();
  314. k != outfiles.end(); ++k)
  315. {
  316. cmakefileStream << " \"" <<
  317. lg->Convert(k->c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
  318. << "\"\n";
  319. }
  320. }
  321. cmakefileStream << " )\n\n";
  322. this->WriteMainCMakefileLanguageRules(cmakefileStream,
  323. this->LocalGenerators);
  324. if(!this->MultipleOutputPairs.empty())
  325. {
  326. cmakefileStream
  327. << "\n"
  328. << "SET(CMAKE_MULTIPLE_OUTPUT_PAIRS\n";
  329. for(MultipleOutputPairsType::const_iterator pi =
  330. this->MultipleOutputPairs.begin();
  331. pi != this->MultipleOutputPairs.end(); ++pi)
  332. {
  333. cmakefileStream << " \"" << pi->first << "\" \""
  334. << pi->second << "\"\n";
  335. }
  336. cmakefileStream << " )\n\n";
  337. }
  338. }
  339. //----------------------------------------------------------------------------
  340. void cmGlobalUnixMakefileGenerator3::CheckMultipleOutputs(cmMakefile* mf,
  341. bool verbose)
  342. {
  343. // Get the string listing the multiple output pairs.
  344. const char* pairs_string = mf->GetDefinition("CMAKE_MULTIPLE_OUTPUT_PAIRS");
  345. if(!pairs_string)
  346. {
  347. return;
  348. }
  349. // Convert the string to a list and preserve empty entries.
  350. std::vector<std::string> pairs;
  351. cmSystemTools::ExpandListArgument(pairs_string, pairs, true);
  352. for(std::vector<std::string>::const_iterator i = pairs.begin();
  353. i != pairs.end(); ++i)
  354. {
  355. const std::string& depender = *i;
  356. if(++i != pairs.end())
  357. {
  358. const std::string& dependee = *i;
  359. // If the depender is missing then delete the dependee to make
  360. // sure both will be regenerated.
  361. if(cmSystemTools::FileExists(dependee.c_str()) &&
  362. !cmSystemTools::FileExists(depender.c_str()))
  363. {
  364. if(verbose)
  365. {
  366. cmOStringStream msg;
  367. msg << "Deleting primary custom command output \"" << dependee
  368. << "\" because another output \""
  369. << depender << "\" does not exist." << std::endl;
  370. cmSystemTools::Stdout(msg.str().c_str());
  371. }
  372. cmSystemTools::RemoveFile(dependee.c_str());
  373. }
  374. }
  375. }
  376. }
  377. void cmGlobalUnixMakefileGenerator3
  378. ::WriteMainCMakefileLanguageRules(cmGeneratedFileStream& cmakefileStream,
  379. std::vector<cmLocalGenerator *> &lGenerators
  380. )
  381. {
  382. cmLocalUnixMakefileGenerator3 *lg;
  383. // now list all the target info files
  384. cmakefileStream
  385. << "# The set of files whose dependency integrity should be checked:\n";
  386. cmakefileStream
  387. << "SET(CMAKE_DEPEND_INFO_FILES\n";
  388. for (unsigned int i = 0; i < lGenerators.size(); ++i)
  389. {
  390. lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]);
  391. // for all of out targets
  392. for (cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin();
  393. l != lg->GetMakefile()->GetTargets().end(); l++)
  394. {
  395. if((l->second.GetType() == cmTarget::EXECUTABLE) ||
  396. (l->second.GetType() == cmTarget::STATIC_LIBRARY) ||
  397. (l->second.GetType() == cmTarget::SHARED_LIBRARY) ||
  398. (l->second.GetType() == cmTarget::MODULE_LIBRARY) )
  399. {
  400. std::string tname = lg->GetRelativeTargetDirectory(l->second);
  401. tname += "/DependInfo.cmake";
  402. cmSystemTools::ConvertToUnixSlashes(tname);
  403. cmakefileStream << " \"" << tname.c_str() << "\"\n";
  404. }
  405. }
  406. }
  407. cmakefileStream << " )\n";
  408. }
  409. //----------------------------------------------------------------------------
  410. void
  411. cmGlobalUnixMakefileGenerator3
  412. ::WriteDirectoryRule2(std::ostream& ruleFileStream,
  413. cmLocalUnixMakefileGenerator3* lg,
  414. const char* pass, bool check_all,
  415. bool check_relink)
  416. {
  417. // Get the relative path to the subdirectory from the top.
  418. std::string makeTarget = lg->GetMakefile()->GetStartOutputDirectory();
  419. makeTarget += "/";
  420. makeTarget += pass;
  421. // The directory-level rule should depend on the target-level rules
  422. // for all targets in the directory.
  423. std::vector<std::string> depends;
  424. for(cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin();
  425. l != lg->GetMakefile()->GetTargets().end(); ++l)
  426. {
  427. if((l->second.GetType() == cmTarget::EXECUTABLE) ||
  428. (l->second.GetType() == cmTarget::STATIC_LIBRARY) ||
  429. (l->second.GetType() == cmTarget::SHARED_LIBRARY) ||
  430. (l->second.GetType() == cmTarget::MODULE_LIBRARY) ||
  431. (l->second.GetType() == cmTarget::UTILITY))
  432. {
  433. // Add this to the list of depends rules in this directory.
  434. if((!check_all || !l->second.GetPropertyAsBool("EXCLUDE_FROM_ALL")) &&
  435. (!check_relink || l->second.NeedRelinkBeforeInstall()))
  436. {
  437. std::string tname = lg->GetRelativeTargetDirectory(l->second);
  438. tname += "/";
  439. tname += pass;
  440. depends.push_back(tname);
  441. }
  442. }
  443. }
  444. // The directory-level rule should depend on the directory-level
  445. // rules of the subdirectories.
  446. for(std::vector<cmLocalGenerator*>::iterator sdi =
  447. lg->GetChildren().begin(); sdi != lg->GetChildren().end(); ++sdi)
  448. {
  449. cmLocalUnixMakefileGenerator3* slg =
  450. static_cast<cmLocalUnixMakefileGenerator3*>(*sdi);
  451. std::string subdir = slg->GetMakefile()->GetStartOutputDirectory();
  452. subdir += "/";
  453. subdir += pass;
  454. depends.push_back(subdir);
  455. }
  456. // Work-around for makes that drop rules that have no dependencies
  457. // or commands.
  458. if(depends.empty() && this->EmptyRuleHackDepends != "")
  459. {
  460. depends.push_back(this->EmptyRuleHackDepends);
  461. }
  462. // Write the rule.
  463. std::string doc = "Convenience name for \"";
  464. doc += pass;
  465. doc += "\" pass in the directory.";
  466. std::vector<std::string> no_commands;
  467. lg->WriteMakeRule(ruleFileStream, doc.c_str(),
  468. makeTarget.c_str(), depends, no_commands, true);
  469. }
  470. //----------------------------------------------------------------------------
  471. void
  472. cmGlobalUnixMakefileGenerator3
  473. ::WriteDirectoryRules2(std::ostream& ruleFileStream,
  474. cmLocalUnixMakefileGenerator3* lg)
  475. {
  476. // Only subdirectories need these rules.
  477. if(!lg->GetParent())
  478. {
  479. return;
  480. }
  481. // Begin the directory-level rules section.
  482. std::string dir = lg->GetMakefile()->GetStartOutputDirectory();
  483. dir = lg->Convert(dir.c_str(), cmLocalGenerator::HOME_OUTPUT,
  484. cmLocalGenerator::MAKEFILE);
  485. lg->WriteDivider(ruleFileStream);
  486. ruleFileStream
  487. << "# Directory level rules for directory "
  488. << dir << "\n\n";
  489. // Write directory-level rules for "all".
  490. this->WriteDirectoryRule2(ruleFileStream, lg, "all", true, false);
  491. // Write directory-level rules for "clean".
  492. this->WriteDirectoryRule2(ruleFileStream, lg, "clean", false, false);
  493. // Write directory-level rules for "preinstall".
  494. this->WriteDirectoryRule2(ruleFileStream, lg, "preinstall", false, true);
  495. }
  496. std::string cmGlobalUnixMakefileGenerator3
  497. ::GenerateBuildCommand(const char* makeProgram, const char *projectName,
  498. const char* additionalOptions, const char *targetName,
  499. const char* config, bool ignoreErrors, bool fast)
  500. {
  501. // Project name and config are not used yet.
  502. (void)projectName;
  503. (void)config;
  504. std::string makeCommand =
  505. cmSystemTools::ConvertToUnixOutputPath(makeProgram);
  506. // Since we have full control over the invocation of nmake, let us
  507. // make it quiet.
  508. if ( strcmp(this->GetName(), "NMake Makefiles") == 0 )
  509. {
  510. makeCommand += " /NOLOGO ";
  511. }
  512. if ( ignoreErrors )
  513. {
  514. makeCommand += " -i";
  515. }
  516. if ( additionalOptions )
  517. {
  518. makeCommand += " ";
  519. makeCommand += additionalOptions;
  520. }
  521. if ( targetName && strlen(targetName))
  522. {
  523. cmLocalUnixMakefileGenerator3 *lg;
  524. if (this->LocalGenerators.size())
  525. {
  526. lg = static_cast<cmLocalUnixMakefileGenerator3 *>
  527. (this->LocalGenerators[0]);
  528. }
  529. else
  530. {
  531. lg = static_cast<cmLocalUnixMakefileGenerator3 *>
  532. (this->CreateLocalGenerator());
  533. // set the Start directories
  534. lg->GetMakefile()->SetStartDirectory
  535. (this->CMakeInstance->GetStartDirectory());
  536. lg->GetMakefile()->SetStartOutputDirectory
  537. (this->CMakeInstance->GetStartOutputDirectory());
  538. lg->GetMakefile()->MakeStartDirectoriesCurrent();
  539. }
  540. makeCommand += " \"";
  541. std::string tname = targetName;
  542. if(fast)
  543. {
  544. tname += "/fast";
  545. }
  546. tname = lg->Convert(tname.c_str(),cmLocalGenerator::HOME_OUTPUT,
  547. cmLocalGenerator::MAKEFILE);
  548. makeCommand += tname.c_str();
  549. makeCommand += "\"";
  550. if (!this->LocalGenerators.size())
  551. {
  552. delete lg;
  553. }
  554. }
  555. return makeCommand;
  556. }
  557. //----------------------------------------------------------------------------
  558. void
  559. cmGlobalUnixMakefileGenerator3
  560. ::WriteConvenienceRules(std::ostream& ruleFileStream,
  561. std::set<cmStdString> &emitted)
  562. {
  563. std::vector<std::string> depends;
  564. std::vector<std::string> commands;
  565. depends.push_back("cmake_check_build_system");
  566. // write the target convenience rules
  567. unsigned int i;
  568. cmLocalUnixMakefileGenerator3 *lg;
  569. for (i = 0; i < this->LocalGenerators.size(); ++i)
  570. {
  571. lg = static_cast<cmLocalUnixMakefileGenerator3 *>
  572. (this->LocalGenerators[i]);
  573. // for each target Generate the rule files for each target.
  574. cmTargets& targets = lg->GetMakefile()->GetTargets();
  575. for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
  576. {
  577. // Don't emit the same rule twice (e.g. two targets with the same
  578. // simple name)
  579. if(t->second.GetName() &&
  580. strlen(t->second.GetName()) &&
  581. emitted.insert(t->second.GetName()).second &&
  582. // Handle user targets here. Global targets are handled in
  583. // the local generator on a per-directory basis.
  584. ((t->second.GetType() == cmTarget::EXECUTABLE) ||
  585. (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
  586. (t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
  587. (t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
  588. (t->second.GetType() == cmTarget::UTILITY)))
  589. {
  590. // Add a rule to build the target by name.
  591. lg->WriteDivider(ruleFileStream);
  592. ruleFileStream
  593. << "# Target rules for targets named "
  594. << t->second.GetName() << "\n\n";
  595. // Write the rule.
  596. commands.clear();
  597. std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
  598. tmp += "Makefile2";
  599. commands.push_back(lg->GetRecursiveMakeCall
  600. (tmp.c_str(),t->second.GetName()));
  601. depends.clear();
  602. depends.push_back("cmake_check_build_system");
  603. lg->WriteMakeRule(ruleFileStream,
  604. "Build rule for target.",
  605. t->second.GetName(), depends, commands,
  606. true);
  607. // Add a fast rule to build the target
  608. std::string localName = lg->GetRelativeTargetDirectory(t->second);
  609. std::string makefileName;
  610. makefileName = localName;
  611. makefileName += "/build.make";
  612. depends.clear();
  613. commands.clear();
  614. std::string makeTargetName = localName;
  615. makeTargetName += "/build";
  616. localName = t->second.GetName();
  617. localName += "/fast";
  618. commands.push_back(lg->GetRecursiveMakeCall
  619. (makefileName.c_str(), makeTargetName.c_str()));
  620. lg->WriteMakeRule(ruleFileStream, "fast build rule for target.",
  621. localName.c_str(), depends, commands, true);
  622. }
  623. }
  624. }
  625. }
  626. //----------------------------------------------------------------------------
  627. void
  628. cmGlobalUnixMakefileGenerator3
  629. ::WriteConvenienceRules2(std::ostream& ruleFileStream,
  630. cmLocalUnixMakefileGenerator3 *lg,
  631. bool exclude)
  632. {
  633. std::vector<std::string> depends;
  634. std::vector<std::string> commands;
  635. std::string localName;
  636. std::string makeTargetName;
  637. // write the directory level rules for this local gen
  638. this->WriteDirectoryRules2(ruleFileStream,lg);
  639. depends.push_back("cmake_check_build_system");
  640. // for each target Generate the rule files for each target.
  641. cmTargets& targets = lg->GetMakefile()->GetTargets();
  642. for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
  643. {
  644. if (t->second.GetName()
  645. && strlen(t->second.GetName())
  646. && ((t->second.GetType() == cmTarget::EXECUTABLE)
  647. || (t->second.GetType() == cmTarget::STATIC_LIBRARY)
  648. || (t->second.GetType() == cmTarget::SHARED_LIBRARY)
  649. || (t->second.GetType() == cmTarget::MODULE_LIBRARY)
  650. || (t->second.GetType() == cmTarget::UTILITY)))
  651. {
  652. std::string makefileName;
  653. // Add a rule to build the target by name.
  654. localName = lg->GetRelativeTargetDirectory(t->second);
  655. makefileName = localName;
  656. makefileName += "/build.make";
  657. bool needRequiresStep = this->NeedRequiresStep(t->second);
  658. lg->WriteDivider(ruleFileStream);
  659. ruleFileStream
  660. << "# Target rules for target "
  661. << localName << "\n\n";
  662. commands.clear();
  663. if (t->second.GetType() != cmTarget::UTILITY)
  664. {
  665. makeTargetName = localName;
  666. makeTargetName += "/depend";
  667. commands.push_back(lg->GetRecursiveMakeCall
  668. (makefileName.c_str(),makeTargetName.c_str()));
  669. // add requires if we need it for this generator
  670. if (needRequiresStep)
  671. {
  672. makeTargetName = localName;
  673. makeTargetName += "/requires";
  674. commands.push_back(lg->GetRecursiveMakeCall
  675. (makefileName.c_str(),makeTargetName.c_str()));
  676. }
  677. }
  678. makeTargetName = localName;
  679. makeTargetName += "/build";
  680. commands.push_back(lg->GetRecursiveMakeCall
  681. (makefileName.c_str(),makeTargetName.c_str()));
  682. // Write the rule.
  683. localName += "/all";
  684. depends.clear();
  685. std::string progressDir =
  686. lg->GetMakefile()->GetHomeOutputDirectory();
  687. progressDir += cmake::GetCMakeFilesDirectory();
  688. {
  689. cmOStringStream progCmd;
  690. progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
  691. // all target counts
  692. progCmd << lg->Convert(progressDir.c_str(),
  693. cmLocalGenerator::FULL,
  694. cmLocalGenerator::SHELL);
  695. progCmd << " ";
  696. std::vector<int> &progFiles = lg->ProgressFiles[t->first];
  697. for (std::vector<int>::iterator i = progFiles.begin();
  698. i != progFiles.end(); ++i)
  699. {
  700. progCmd << " " << *i;
  701. }
  702. commands.push_back(progCmd.str());
  703. }
  704. progressDir = "Built target ";
  705. progressDir += t->first;
  706. lg->AppendEcho(commands,progressDir.c_str());
  707. this->AppendGlobalTargetDepends(depends,t->second);
  708. lg->WriteMakeRule(ruleFileStream, "All Build rule for target.",
  709. localName.c_str(), depends, commands, true);
  710. // add the all/all dependency
  711. if (!exclude && !t->second.GetPropertyAsBool("EXCLUDE_FROM_ALL"))
  712. {
  713. depends.clear();
  714. depends.push_back(localName);
  715. commands.clear();
  716. lg->WriteMakeRule(ruleFileStream, "Include target in all.",
  717. "all", depends, commands, true);
  718. }
  719. // Write the rule.
  720. commands.clear();
  721. progressDir = lg->GetMakefile()->GetHomeOutputDirectory();
  722. progressDir += cmake::GetCMakeFilesDirectory();
  723. {
  724. // TODO: Convert the total progress count to a make variable.
  725. cmOStringStream progCmd;
  726. progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
  727. // # in target
  728. progCmd << lg->Convert(progressDir.c_str(),
  729. cmLocalGenerator::FULL,
  730. cmLocalGenerator::SHELL);
  731. //
  732. std::set<cmStdString> emitted;
  733. progCmd << " "
  734. << this->GetTargetTotalNumberOfActions(t->second,
  735. emitted);
  736. commands.push_back(progCmd.str());
  737. }
  738. std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
  739. tmp += "Makefile2";
  740. commands.push_back(lg->GetRecursiveMakeCall
  741. (tmp.c_str(),localName.c_str()));
  742. {
  743. cmOStringStream progCmd;
  744. progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
  745. progCmd << lg->Convert(progressDir.c_str(),
  746. cmLocalGenerator::FULL,
  747. cmLocalGenerator::SHELL);
  748. progCmd << " 0";
  749. commands.push_back(progCmd.str());
  750. }
  751. depends.clear();
  752. depends.push_back("cmake_check_build_system");
  753. localName = lg->GetRelativeTargetDirectory(t->second);
  754. localName += "/rule";
  755. lg->WriteMakeRule(ruleFileStream,
  756. "Build rule for subdir invocation for target.",
  757. localName.c_str(), depends, commands, true);
  758. // Add a target with the canonical name (no prefix, suffix or path).
  759. commands.clear();
  760. depends.clear();
  761. depends.push_back(localName);
  762. lg->WriteMakeRule(ruleFileStream, "Convenience name for target.",
  763. t->second.GetName(), depends, commands, true);
  764. // Add rules to prepare the target for installation.
  765. if(!exclude && t->second.NeedRelinkBeforeInstall())
  766. {
  767. localName = lg->GetRelativeTargetDirectory(t->second);
  768. localName += "/preinstall";
  769. depends.clear();
  770. commands.clear();
  771. commands.push_back(lg->GetRecursiveMakeCall
  772. (makefileName.c_str(), localName.c_str()));
  773. lg->WriteMakeRule(ruleFileStream,
  774. "Pre-install relink rule for target.",
  775. localName.c_str(), depends, commands, true);
  776. depends.clear();
  777. depends.push_back(localName);
  778. commands.clear();
  779. lg->WriteMakeRule(ruleFileStream, "Prepare target for install.",
  780. "preinstall", depends, commands, true);
  781. }
  782. // add the clean rule
  783. localName = lg->GetRelativeTargetDirectory(t->second);
  784. makeTargetName = localName;
  785. makeTargetName += "/clean";
  786. depends.clear();
  787. commands.clear();
  788. commands.push_back(lg->GetRecursiveMakeCall
  789. (makefileName.c_str(), makeTargetName.c_str()));
  790. lg->WriteMakeRule(ruleFileStream, "clean rule for target.",
  791. makeTargetName.c_str(), depends, commands, true);
  792. commands.clear();
  793. depends.push_back(makeTargetName);
  794. lg->WriteMakeRule(ruleFileStream, "clean rule for target.",
  795. "clean", depends, commands, true);
  796. }
  797. }
  798. }
  799. //----------------------------------------------------------------------------
  800. int cmGlobalUnixMakefileGenerator3
  801. ::GetTargetTotalNumberOfActions(cmTarget& target,
  802. std::set<cmStdString> &emitted)
  803. {
  804. // do not double count
  805. int result = 0;
  806. if(emitted.insert(target.GetName()).second)
  807. {
  808. cmLocalUnixMakefileGenerator3 *lg =
  809. static_cast<cmLocalUnixMakefileGenerator3 *>
  810. (target.GetMakefile()->GetLocalGenerator());
  811. result = static_cast<int>(lg->ProgressFiles[target.GetName()].size());
  812. std::vector<cmTarget *>& depends = this->GetTargetDepends(target);
  813. std::vector<cmTarget *>::iterator i;
  814. for (i = depends.begin(); i != depends.end(); ++i)
  815. {
  816. result += this->GetTargetTotalNumberOfActions(**i, emitted);
  817. }
  818. }
  819. return result;
  820. }
  821. unsigned long cmGlobalUnixMakefileGenerator3
  822. ::GetNumberOfProgressActionsInAll(cmLocalUnixMakefileGenerator3 *lg)
  823. {
  824. unsigned long result = 0;
  825. // if this is a project
  826. if (!lg->GetParent() ||
  827. strcmp(lg->GetMakefile()->GetProjectName(),
  828. lg->GetParent()->GetMakefile()->GetProjectName()))
  829. {
  830. // use the new project to target map
  831. std::set<cmTarget*> &targets =
  832. this->ProjectToTargetMap[lg->GetMakefile()->GetProjectName()];
  833. std::set<cmTarget*>::iterator t = targets.begin();
  834. for(; t != targets.end(); ++t)
  835. {
  836. cmTarget* target = *t;
  837. cmLocalUnixMakefileGenerator3 *lg3 =
  838. static_cast<cmLocalUnixMakefileGenerator3 *>
  839. (target->GetMakefile()->GetLocalGenerator());
  840. std::vector<int> &progFiles = lg3->ProgressFiles[target->GetName()];
  841. result += static_cast<unsigned long>(progFiles.size());
  842. }
  843. }
  844. // for subdirectories
  845. else
  846. {
  847. std::deque<cmLocalUnixMakefileGenerator3 *> lg3Stack;
  848. lg3Stack.push_back(lg);
  849. std::vector<cmStdString> targetsInAll;
  850. std::set<cmTarget *> targets;
  851. while (lg3Stack.size())
  852. {
  853. cmLocalUnixMakefileGenerator3 *lg3 = lg3Stack.front();
  854. lg3Stack.pop_front();
  855. for(cmTargets::iterator l = lg3->GetMakefile()->GetTargets().begin();
  856. l != lg3->GetMakefile()->GetTargets().end(); ++l)
  857. {
  858. if((l->second.GetType() == cmTarget::EXECUTABLE) ||
  859. (l->second.GetType() == cmTarget::STATIC_LIBRARY) ||
  860. (l->second.GetType() == cmTarget::SHARED_LIBRARY) ||
  861. (l->second.GetType() == cmTarget::MODULE_LIBRARY) ||
  862. (l->second.GetType() == cmTarget::UTILITY))
  863. {
  864. // Add this to the list of depends rules in this directory.
  865. if (!l->second.GetPropertyAsBool("EXCLUDE_FROM_ALL") &&
  866. targets.find(&l->second) == targets.end())
  867. {
  868. std::deque<cmTarget *> activeTgts;
  869. activeTgts.push_back(&(l->second));
  870. // trace depth of target dependencies
  871. while (activeTgts.size())
  872. {
  873. if (targets.find(activeTgts.front()) == targets.end())
  874. {
  875. targets.insert(activeTgts.front());
  876. cmLocalUnixMakefileGenerator3 *lg4 =
  877. static_cast<cmLocalUnixMakefileGenerator3 *>
  878. (activeTgts.front()->GetMakefile()->GetLocalGenerator());
  879. std::vector<int> &progFiles2 =
  880. lg4->ProgressFiles[activeTgts.front()->GetName()];
  881. result += static_cast<unsigned long>(progFiles2.size());
  882. std::vector<cmTarget *> deps2 =
  883. this->GetTargetDepends(*activeTgts.front());
  884. for (std::vector<cmTarget *>::const_iterator di =
  885. deps2.begin(); di != deps2.end(); ++di)
  886. {
  887. activeTgts.push_back(*di);
  888. }
  889. }
  890. activeTgts.pop_front();
  891. }
  892. }
  893. }
  894. }
  895. // The directory-level rule depends on the directory-level
  896. // rules of the subdirectories.
  897. for(std::vector<cmLocalGenerator*>::iterator sdi =
  898. lg3->GetChildren().begin();
  899. sdi != lg3->GetChildren().end(); ++sdi)
  900. {
  901. cmLocalUnixMakefileGenerator3* slg =
  902. static_cast<cmLocalUnixMakefileGenerator3*>(*sdi);
  903. lg3Stack.push_back(slg);
  904. }
  905. }
  906. }
  907. return result;
  908. }
  909. //----------------------------------------------------------------------------
  910. void
  911. cmGlobalUnixMakefileGenerator3
  912. ::AppendGlobalTargetDepends(std::vector<std::string>& depends,
  913. cmTarget& target)
  914. {
  915. // Keep track of dependencies already listed.
  916. std::set<cmStdString> emitted;
  917. // A target should not depend on itself.
  918. emitted.insert(target.GetName());
  919. // Loop over all library dependencies but not for static libs
  920. if (target.GetType() != cmTarget::STATIC_LIBRARY)
  921. {
  922. const cmTarget::LinkLibraryVectorType& tlibs = target.GetLinkLibraries();
  923. for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
  924. lib != tlibs.end(); ++lib)
  925. {
  926. // Don't emit the same library twice for this target.
  927. if(emitted.insert(lib->first).second)
  928. {
  929. // Add this dependency.
  930. this->AppendAnyGlobalDepend(depends, lib->first.c_str(),
  931. emitted, target);
  932. }
  933. }
  934. }
  935. // Loop over all utility dependencies.
  936. const std::set<cmStdString>& tutils = target.GetUtilities();
  937. for(std::set<cmStdString>::const_iterator util = tutils.begin();
  938. util != tutils.end(); ++util)
  939. {
  940. // Don't emit the same utility twice for this target.
  941. if(emitted.insert(*util).second)
  942. {
  943. // Add this dependency.
  944. this->AppendAnyGlobalDepend(depends, util->c_str(), emitted, target);
  945. }
  946. }
  947. }
  948. //----------------------------------------------------------------------------
  949. void
  950. cmGlobalUnixMakefileGenerator3
  951. ::AppendAnyGlobalDepend(std::vector<std::string>& depends, const char* name,
  952. std::set<cmStdString>& emitted, cmTarget &target)
  953. {
  954. cmTarget *result;
  955. cmLocalUnixMakefileGenerator3 *lg3;
  956. // first check the same dir as the current target
  957. lg3 = static_cast<cmLocalUnixMakefileGenerator3 *>
  958. (target.GetMakefile()->GetLocalGenerator());
  959. result = target.GetMakefile()->FindTarget(name, false);
  960. // search each local generator until a match is found
  961. if (!result)
  962. {
  963. result = this->FindTarget(0, name, false);
  964. if (result)
  965. {
  966. lg3 = static_cast<cmLocalUnixMakefileGenerator3 *>
  967. (result->GetMakefile()->GetLocalGenerator());
  968. }
  969. }
  970. // if a match was found then ...
  971. if (result)
  972. {
  973. std::string tgtName = lg3->GetRelativeTargetDirectory(*result);
  974. tgtName += "/all";
  975. depends.push_back(tgtName);
  976. if(result->GetType() == cmTarget::STATIC_LIBRARY)
  977. {
  978. // Since the static library itself does not list dependencies we
  979. // need to chain its dependencies here.
  980. const cmTarget::LinkLibraryVectorType& tlibs
  981. = result->GetLinkLibraries();
  982. for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
  983. lib != tlibs.end(); ++lib)
  984. {
  985. // Don't emit the same library twice for this target.
  986. if(emitted.insert(lib->first).second)
  987. {
  988. // Add this dependency.
  989. this->AppendAnyGlobalDepend(depends, lib->first.c_str(),
  990. emitted, *result);
  991. }
  992. }
  993. }
  994. return;
  995. }
  996. }
  997. //----------------------------------------------------------------------------
  998. void cmGlobalUnixMakefileGenerator3::WriteHelpRule
  999. (std::ostream& ruleFileStream, cmLocalUnixMakefileGenerator3 *lg)
  1000. {
  1001. // add the help target
  1002. std::string path;
  1003. std::vector<std::string> no_depends;
  1004. std::vector<std::string> commands;
  1005. lg->AppendEcho(commands,"The following are some of the valid targets "
  1006. "for this Makefile:");
  1007. lg->AppendEcho(commands,"... all (the default if no target is provided)");
  1008. lg->AppendEcho(commands,"... clean");
  1009. lg->AppendEcho(commands,"... depend");
  1010. // Keep track of targets already listed.
  1011. std::set<cmStdString> emittedTargets;
  1012. // for each local generator
  1013. unsigned int i;
  1014. cmLocalUnixMakefileGenerator3 *lg2;
  1015. for (i = 0; i < this->LocalGenerators.size(); ++i)
  1016. {
  1017. lg2 =
  1018. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
  1019. // for the passed in makefile or if this is the top Makefile wripte out
  1020. // the targets
  1021. if (lg2 == lg || !lg->GetParent())
  1022. {
  1023. // for each target Generate the rule files for each target.
  1024. cmTargets& targets = lg2->GetMakefile()->GetTargets();
  1025. for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
  1026. {
  1027. if((t->second.GetType() == cmTarget::EXECUTABLE) ||
  1028. (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
  1029. (t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
  1030. (t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
  1031. (t->second.GetType() == cmTarget::GLOBAL_TARGET) ||
  1032. (t->second.GetType() == cmTarget::UTILITY))
  1033. {
  1034. if(emittedTargets.insert(t->second.GetName()).second)
  1035. {
  1036. path = "... ";
  1037. path += t->second.GetName();
  1038. lg->AppendEcho(commands,path.c_str());
  1039. }
  1040. }
  1041. }
  1042. std::vector<cmStdString> const& localHelp = lg->GetLocalHelp();
  1043. for(std::vector<cmStdString>::const_iterator o = localHelp.begin();
  1044. o != localHelp.end(); ++o)
  1045. {
  1046. path = "... ";
  1047. path += *o;
  1048. lg->AppendEcho(commands, path.c_str());
  1049. }
  1050. }
  1051. }
  1052. lg->WriteMakeRule(ruleFileStream, "Help Target",
  1053. "help:",
  1054. no_depends, commands, true);
  1055. ruleFileStream << "\n\n";
  1056. }
  1057. bool cmGlobalUnixMakefileGenerator3
  1058. ::NeedRequiresStep(cmTarget const& target)
  1059. {
  1060. std::set<cmStdString> languages;
  1061. target.GetLanguages(languages);
  1062. for(std::set<cmStdString>::const_iterator l = languages.begin();
  1063. l != languages.end(); ++l)
  1064. {
  1065. std::string var = "CMAKE_NEEDS_REQUIRES_STEP_";
  1066. var += *l;
  1067. var += "_FLAG";
  1068. if(target.GetMakefile()->GetDefinition(var.c_str()))
  1069. {
  1070. return true;
  1071. }
  1072. }
  1073. return false;
  1074. }