cmGlobalUnixMakefileGenerator3.cxx 41 KB

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