1 #ifndef MAKEFILE_GENERATOR
12 static define app = ((GuiApplication)__thisModule);
15 bool eString_PathInsideOfMore(char * path, char * of, char * pathRest)
17 if(!path[0] || !of[0])
18 return false; // What to do here? Ever used?
21 char ofPart[MAX_FILENAME], ofRest[MAX_LOCATION];
22 char pathPart[MAX_FILENAME]; //, pathRest[MAX_LOCATION];
24 strcpy(pathRest, path);
25 for(; ofRest[0] && pathRest[0];)
27 SplitDirectory(ofRest, ofPart, ofRest);
28 SplitDirectory(pathRest, pathPart, pathRest);
29 if(fstrcmp(pathPart, ofPart))
32 if(!ofRest[0] && !pathRest[0])
34 else if(!pathRest[0]) // not inside of, it's the other way around
40 enum NodeTypes { project, file, folder, resources, folderOpen };
43 genFile, ewsFile, epjFile, folder, openFolder, ecFile, ehFile,
44 cFile, hFile, cppFile, hppFile, textFile, webFile, pictureFile, soundFile,
45 archiveFile, packageFile, opticalMediaImageFile, mFile;
47 NodeIcons ::SelectFileIcon(char * filePath)
50 if(filePath && filePath[0])
52 char extension[MAX_EXTENSION];
53 GetExtension(filePath, extension);
56 if(!strcmpi(extension, WorkspaceExtension))
58 else if(!strcmpi(extension, ProjectExtension))
60 else if(!strcmpi(extension, "ec"))
62 else if(!strcmpi(extension, "eh"))
64 else if(!strcmpi(extension, "cpp") || !strcmpi(extension, "cc") ||
65 !strcmpi(extension, "cxx"))
67 else if(!strcmpi(extension, "hpp") || !strcmpi(extension, "hh") ||
68 !strcmpi(extension, "hxx"))
70 else if(!strcmpi(extension, "c"))
72 else if(!strcmpi(extension, "h"))
74 else if(!strcmpi(extension, "m"))
76 else if(!strcmpi(extension, "txt") || !strcmpi(extension, "text") ||
77 !strcmpi(extension, "nfo") || !strcmpi(extension, "info"))
79 else if(!strcmpi(extension, "htm") || !strcmpi(extension, "html") ||
80 !strcmpi(extension, "css") || !strcmpi(extension, "php") ||
81 !strcmpi(extension, "js"))
83 else if(!strcmpi(extension, "bmp") || !strcmpi(extension, "pcx") ||
84 !strcmpi(extension, "jpg") || !strcmpi(extension, "jpeg") ||
85 !strcmpi(extension, "gif") || !strcmpi(extension, "png") ||
86 !strcmpi(extension, "ico"))
88 else if(!strcmpi(extension, "wav") || !strcmpi(extension, "mp3") ||
89 !strcmpi(extension, "ogg") || !strcmpi(extension, "snd"))
91 else if(!strcmpi(extension, "ear") || !strcmpi(extension, "7z") ||
92 !strcmpi(extension, "rar") || !strcmpi(extension, "zip") ||
93 !strcmpi(extension, "gz") || !strcmpi(extension, "bz2") ||
94 !strcmpi(extension, "tar") || !strcmpi(extension, "arj") ||
95 !strcmpi(extension, "lza") || !strcmpi(extension, "lzh") ||
96 !strcmpi(extension, "cpio") || !strcmpi(extension, "z"))
98 else if(!strcmpi(extension, "cab") || !strcmpi(extension, "deb") ||
99 !strcmpi(extension, "rpm"))
101 else if(!strcmpi(extension, "iso") || !strcmpi(extension, "mds") ||
102 !strcmpi(extension, "cue") || !strcmpi(extension, "bin") ||
103 !strcmpi(extension, "ccd") || !strcmpi(extension, "bwt") ||
104 !strcmpi(extension, "cdi") || !strcmpi(extension, "nrg"))
105 icon = opticalMediaImageFile;
113 icon = genFile; // tocheck: error icon?
117 NodeIcons ::SelectNodeIcon(NodeTypes type)
136 #define SELECTION_COLOR Color { 10, 36, 106 }
142 // this is so not working, why!
144 // return result was not even executed (did not step on while debugging)
145 class TwoStrings : struct
165 class ProjectNode : ListItem
170 set { return { fileName = value }; }
171 // TOCHECK: Is this isset necessary at all?
172 isset { return nodeType == file && !options && !configurations && !platforms && !files; }
174 property String folder
179 if(strchr(value, '/'))
181 char p[MAX_LOCATION];
182 char n[MAX_FILENAME];
183 GetLastDirectory(value, n);
184 StripLastDirectory(value, p);
185 name = CopyString(n);
186 path = CopyString(p);
189 name = CopyString(value);
193 // TOCHECK: Non Reentrant
194 static char insidePath[MAX_LOCATION];
196 strcpy(insidePath, (parent.type == project) ? "" : parent.path);
197 PathCatSlash(insidePath, name);
199 if(!fstrcmp(path, insidePath))
203 strcpy(insidePath, path);
204 if(!insidePath[0]) strcpy(insidePath, ".");
205 PathCatSlash(insidePath, name);
209 isset { return nodeType == folder; }
211 property String fileName
216 if(strchr(value, '/'))
218 char p[MAX_LOCATION];
219 char n[MAX_FILENAME];
220 GetLastDirectory(value, n);
221 StripLastDirectory(value, p);
222 name = CopyValidateMakefilePath(n);
223 path = CopyValidateMakefilePath(p);
226 name = CopyValidateMakefilePath(value);
230 // TOCHECK: Non Reentrant
231 static char insidePath[MAX_LOCATION];
233 strcpy(insidePath, (parent.type == project) ? "" : parent.path);
234 if(!fstrcmp(path, insidePath))
238 strcpy(insidePath, path);
239 if(!insidePath[0]) strcpy(insidePath, ".");
240 PathCatSlash(insidePath, name);
244 isset { return nodeType == file && (options || configurations || platforms); }
247 LinkList<ProjectNode> files;
248 property ProjectOptions options
250 get { return project ? project.options : options; }
251 set { if(project) { delete project.options; project.options = value; } else { delete options; options = value; } }
252 isset { ProjectOptions options = project ? project.options : this.options; return options && !options.isEmpty; }
254 property Array<PlatformOptions> platforms
256 get { return project ? project.platforms : platforms; }
259 if(project) { project.platforms = value; }
262 if(platforms) { platforms.Free(); delete platforms; }
265 List<PlatformOptions> empty { };
266 Iterator<PlatformOptions> it { value };
268 for(p : platforms; !p.options || p.options.isEmpty) empty.Add(p);
269 for(p : empty; it.Find(p)) platforms.Delete(it.pointer);
276 Array<PlatformOptions> platforms = project ? project.platforms : this.platforms;
281 if(p.options && !p.options.isEmpty)
288 property List<ProjectConfig> configurations
290 get { return project ? project.configurations : configurations; }
295 if(project.configurations)
297 project.configurations.Free();
298 delete project.configurations;
300 project.configurations = value;
304 if(configurations) { configurations.Free(); delete configurations; }
307 List<ProjectConfig> empty { };
308 Iterator<ProjectConfig> it { value };
309 configurations = value;
310 for(c : configurations)
312 bool somethingSet = c.options && !c.options.isEmpty;
313 // TODO: Implement isset keyword
314 if(!somethingSet && c.platforms && c.platforms.count)
318 if(p.options && !p.options.isEmpty)
328 for(c : empty; it.Find(c)) configurations.Delete(it.pointer);
335 if(!parent) return true;
338 for(c : configurations)
340 bool somethingSet = c.options && !c.options.isEmpty;
341 if(!somethingSet && c.platforms && c.platforms.count)
345 if(p.options && !p.options.isEmpty)
360 ProjectOptions options;
361 Array<PlatformOptions> platforms;
362 List<ProjectConfig> configurations;
363 ProjectNodeType nodeType;
368 // This holds the absolute path of the .epj for the project topnode (without the filename)
369 // It holds a relative path to the topNode (project) for other nodes (folders and files)
370 // For folders, it includes the folder it refers to. If there is a name difference between the
371 // file system folder and the grouping folder of the project view, it maps to that folder.
381 // This is only set for Top Nodes
384 ProjectConfig GetMatchingNodeConfig(ProjectConfig prjConfig)
386 ProjectConfig nodeConfig = null;
387 if(property::configurations && prjConfig)
389 const char * configName = prjConfig.name;
390 for(cfg : property::configurations)
392 if(!strcmpi(cfg.name, configName))
402 // For makefile generation:
403 bool GetECFLAGS(ProjectConfig prjConfig)
405 ProjectConfig config = GetMatchingNodeConfig(prjConfig);
406 ProjectOptions options = property::options;
407 SetBool memoryGuard = localMemoryGuard;
408 String defaultNameSpace = localDefaultNameSpace;
409 SetBool strictNameSpaces = localStrictNameSpaces;
410 SetBool noLineNumbers = localNoLineNumbers;
412 if(memoryGuard || defaultNameSpace || strictNameSpaces || noLineNumbers)
414 else if(parent.parent)
415 return parent.GetECFLAGS(prjConfig);
420 bool GetMemoryGuard(ProjectConfig prjConfig)
422 ProjectConfig config = GetMatchingNodeConfig(prjConfig);
423 ProjectOptions options = property::options;
424 SetBool memoryGuard = localMemoryGuard;
428 return parent.GetMemoryGuard(prjConfig);
430 return memoryGuard == true;
433 String GetDefaultNameSpace(ProjectConfig prjConfig)
435 ProjectConfig config = GetMatchingNodeConfig(prjConfig);
436 ProjectOptions options = property::options;
437 String defaultNameSpace = localDefaultNameSpace;
438 if(!defaultNameSpace)
441 return parent.GetDefaultNameSpace(prjConfig);
443 return defaultNameSpace;
446 bool GetStrictNameSpaces(ProjectConfig prjConfig)
448 ProjectConfig config = GetMatchingNodeConfig(prjConfig);
449 ProjectOptions options = property::options;
450 SetBool strictNameSpaces = localStrictNameSpaces;
451 if(!strictNameSpaces)
454 return parent.GetStrictNameSpaces(prjConfig);
456 return strictNameSpaces == true;
459 bool GetNoLineNumbers(ProjectConfig prjConfig)
461 ProjectConfig config = GetMatchingNodeConfig(prjConfig);
462 ProjectOptions options = property::options;
463 SetBool noLineNumbers = localNoLineNumbers;
467 return parent.GetNoLineNumbers(prjConfig);
469 return noLineNumbers == true;
472 property ProjectNode root { get { ProjectNode n; for(n = this; n.parent; n = n.parent); return n; } }
474 property bool containsFile
483 if(child.type == file ||
484 ((child.type == folder || child.type == folderOpen) && child.containsFile))
497 char * GetFullFilePath(char * buffer)
501 strcpy(buffer, root.path);
502 PathCatSlash(buffer, path);
503 PathCatSlash(buffer, name);
508 char * GetFileSysMatchingPath(char * buffer)
512 ProjectNode n, root = this.root;
513 for(n = this; n && (n.type == folder || n.type == project); n = n.parent)
515 strcpy(buffer, root.path);
517 PathCatSlash(buffer, n.path);
518 if(FileExists(buffer).isDirectory)
521 if(!(n && (n.type == folder || n.type == project)))
527 void CollectPerFileAndDirOptions(ProjectConfig prjConfig, Array<String> perFilePreprocessorDefs, Array<DirPath> perFileIncludeDirs)
529 ProjectNode node = null;
530 ProjectConfig config = GetMatchingNodeConfig(prjConfig);
531 List<ProjectNode> nodeStack { };
533 for(node = this; node && node.parent; node = node.parent)
536 // Should we reverse this stack to give priority to the per-file includes? Does the following technique already reverse?
538 // TODO: Check how to fix duplication of following options when configuration is made per-config-per-file
539 while((node = nodeStack.lastIterator.data))
541 ProjectConfig config = GetMatchingNodeConfig(prjConfig);
542 ProjectOptions nodeOptions = node.property::options;
543 if(nodeOptions && nodeOptions.preprocessorDefinitions)
545 for(def : nodeOptions.preprocessorDefinitions)
546 perFilePreprocessorDefs.Add(CopyString(def));
548 if(config && config.options && config.options.preprocessorDefinitions)
550 for(def : config.options.preprocessorDefinitions)
551 perFilePreprocessorDefs.Add(CopyString(def));
553 if(nodeOptions && nodeOptions.includeDirs)
555 for(dir : nodeOptions.includeDirs)
556 perFileIncludeDirs.Add(CopySystemPath(dir));
558 if(config && config.options && config.options.includeDirs)
560 for(dir : config.options.includeDirs)
561 perFileIncludeDirs.Add(CopySystemPath(dir));
563 nodeStack.lastIterator.Remove();
569 property Project project
573 ProjectNode n = this;
574 while(n && n.type != project) n = n.parent;
575 return n ? (*&n.project) : null;
579 void RenameConfig(char * oldName, char * newName)
583 for(f : files; (f.configurations || f.files)) { f.RenameConfig(oldName, newName); }
585 if(property::configurations)
587 for(c : property::configurations; !strcmp(c.name, oldName))
590 c.name = CopyString(newName);
595 void DeleteConfig(ProjectConfig configToDelete)
599 for(f : files; (f.configurations || f.files)) { f.DeleteConfig(configToDelete); }
601 if(property::configurations)
603 Iterator<ProjectConfig> c { property::configurations };
606 ProjectConfig config = c.data;
607 if(!strcmp(configToDelete.name, config.name))
614 if(!property::configurations.count)
615 property::configurations = null;
621 ProjectNode backupNode { };
625 backupNode.files = { };
626 for(f : files) backupNode.files.Add(f.Backup());
628 if(property::options)
629 backupNode.options = property::options.Copy();
631 if(property::platforms)
633 backupNode.platforms = { };
634 for(p : property::platforms)
635 backupNode.platforms.Add(p.Copy());
638 if(property::configurations)
640 backupNode.configurations = { };
641 for(c : property::configurations)
642 backupNode.configurations.Add(c.Copy());
647 void Revert(ProjectNode backupNode)
651 Iterator<ProjectNode> it { backupNode.files };
659 property::options = backupNode.options ? backupNode.options.Copy() : null;
660 if(backupNode.platforms)
662 Array<PlatformOptions> platforms { };
663 property::platforms = platforms;
665 for(p : backupNode.platforms)
666 platforms.Add(p.Copy());
668 if(backupNode.configurations)
670 List<ProjectConfig> configurations { };
671 property::configurations = configurations;
672 for(c : backupNode.configurations)
673 configurations.Add(c.Copy());
677 void FixupNode(char * parentPath)
683 else if(nodeType == file)
688 path = CopyString((parent.type == folder || parent.type == resources) ? parentPath : "");
691 else if(nodeType == folder)
697 char temp[MAX_LOCATION];
698 strcpy(temp, (parent.type == folder || parent.type == resources) ? parentPath : "");
699 PathCatSlash(temp, name);
700 path = CopyString(temp);
704 indent = parent ? parent.indent + 1 : 0;
707 icon = NodeIcons::SelectFileIcon(name);
709 icon = NodeIcons::SelectNodeIcon(type);
718 parentPath[0] = '\0';
719 else if(type == resources || type == folder)
720 strcpy(parentPath, path);
722 f.FixupNode(parentPath);
727 char * OnGetString(char * tempString, void * fieldData, bool * needClass)
731 // TOCHECK: Called from JSON writer
732 if(nodeType == file && !property::options && !property::configurations && !property::platforms && name)
734 strcpy(tempString, "\"");
735 strcat(tempString, property::fileName);
736 strcat(tempString, "\"");
743 // TOCHECK: Called from ProjectView rendering
744 return name ? name : "";
757 if(!project && platforms)
762 if(!project && configurations)
764 configurations.Free();
765 delete configurations;
768 /////////////////////////////
774 property bool isInResources
779 for(node = this; node; node = node.parent)
781 if(node.type == resources)
788 TwoStrings GetPlatformSpecificFu(ProjectConfig prjConfig)
790 TwoStrings result { a = CopyString(""), b = CopyString("") };
791 // note: unknown platform is for common
792 Map<Platform, SetBool> exclusionInfo { };
793 MapNode<Platform, SetBool> mn;
798 CollectExclusionInfo(exclusionInfo, prjConfig);
799 common = exclusionInfo[unknown];
801 Map<Platform, SetBool> cleaned { };
802 SetBool opposite = common == true ? false : true;
803 for(mn = exclusionInfo.root.minimum; mn; mn = mn.next)
805 if(mn.key == unknown || mn.value == opposite)
806 cleaned[mn.key] = mn.value;
808 delete exclusionInfo;
809 exclusionInfo = cleaned;
812 if(exclusionInfo.count > 1)
814 if(exclusionInfo.count > 2)
817 len = strlen(exp) + strlen("$(if $(or ");
818 exp = renew exp char[len+1];
819 strcat(exp, "$(if $(or ");
822 for(mn = exclusionInfo.root.minimum; mn; mn = mn.next)
824 if(mn.key != unknown)
826 char * comma = mn.next ? "," : "";
828 var = PlatformToMakefileVariable(mn.key);
831 len = strlen(exp) + strlen("$(") + strlen(var) + strlen(")") + strlen(comma);
832 exp = renew exp char[len+1];
842 len = strlen(exp) + strlen("),");
843 exp = renew exp char[len+1];
847 if(exclusionInfo.root.minimum.key != unknown)
848 var = PlatformToMakefileVariable(exclusionInfo.root.minimum.key);
850 var = PlatformToMakefileVariable(exclusionInfo.root.minimum.next.key);
853 len = strlen(exp) + strlen("$(if $(") + strlen(var) + strlen("),");
854 exp = renew exp char[len+1];
855 strcat(exp, "$(if $(");
862 exp = common == true ? result.b : result.a;
863 len = strlen(exp) + strlen(",");
864 exp = renew exp char[len+1];
866 if(common == true) result.b = exp; else result.a = exp;
869 len = strlen(exp) + strlen(")");
870 exp = renew exp char[len+1];
874 delete exclusionInfo;
879 bool GetIsExcluded(ProjectConfig prjConfig)
882 // note: unknown platform is for common
883 Map<Platform, SetBool> exclusionInfo { };
884 CollectExclusionInfo(exclusionInfo, prjConfig);
885 if(exclusionInfo.count == 0)
887 else if(exclusionInfo.count == 1)
888 result = exclusionInfo.root.minimum.value == true;
891 SetBool check = exclusionInfo.root.minimum.value;
892 MapNode<Platform, SetBool> mn;
893 for(mn = exclusionInfo.root.minimum; mn; mn = mn.next)
895 if(check != mn.value)
898 if(!mn) // all are same
899 result = check == true;
903 delete exclusionInfo;
907 void CollectExclusionInfo(Map<Platform, SetBool> output, ProjectConfig prjConfig)
909 // note: unknown platform is for common
911 ProjectConfig config = GetMatchingNodeConfig(prjConfig);
912 ProjectOptions options = property::options;
913 Array<PlatformOptions> platforms = property::platforms;
914 List<ProjectConfig> configurations = property::configurations;
917 parent.CollectExclusionInfo(output, prjConfig);
919 output[unknown] = unset;
921 if(options && options.excludeFromBuild)
922 output[unknown] = options.excludeFromBuild;
924 if(config && config.options && config.options.excludeFromBuild)
925 output[unknown] = config.options.excludeFromBuild;
931 if(p.options.excludeFromBuild && (platform = p.name))
932 output[platform] = p.options.excludeFromBuild;
935 if(config && config.platforms)
937 for(p : config.platforms)
939 if(p.options.excludeFromBuild && (platform = p.name))
940 output[platform] = p.options.excludeFromBuild;
948 parent.EnsureVisible();
949 row.collapsed = false;
955 parent.files.Delete(this);
958 ProjectNode Find(char * name, bool includeResources)
960 ProjectNode result = null;
965 if(includeResources || child.type != resources)
967 if(child.type != folder && child.name && !strcmpi(child.name, name))
972 result = child.Find(name, includeResources);
981 ProjectNode FindWithPath(char * name, bool includeResources)
983 ProjectNode result = null;
988 if(includeResources || child.type != resources)
990 char path[MAX_LOCATION];
991 strcpy(path, child.path);
992 if(child.type != folder && child.name)
994 PathCatSlash(path, child.name);
995 if(!strcmpi(path, name))
1001 result = child.FindWithPath(name, includeResources);
1010 ProjectNode FindByFullPath(char * path, bool includeResources)
1012 ProjectNode result = null;
1017 if(includeResources || child.type != resources)
1019 if(child.type != folder && child.name)
1021 char p[MAX_LOCATION];
1022 child.GetFullFilePath(p);
1023 if(!strcmpi(p, path))
1029 result = child.FindByFullPath(path, includeResources);
1038 ProjectNode FindSpecial(char * name, bool recursive, bool includeResources, bool includeFolders)
1040 ProjectNode result = null;
1045 if(includeResources || child.type != resources)
1047 if((includeFolders || child.type != folder) && child.name && !strcmpi(child.name, name))
1053 result = child.FindSpecial(name, recursive, includeResources, includeFolders);
1062 ProjectNode FindSameNameConflict(char * name, bool includeResources,
1063 Map<Platform, SetBool> exclusionInfo, ProjectConfig prjConfig)
1065 ProjectNode result = null;
1066 Map<Platform, SetBool> compareExclusion { };
1067 SetBool common, commonComp;
1068 SetBool actual, actualComp;
1073 if(includeResources || child.type != resources)
1075 if(child.type != folder && child.name && !strcmpi(child.name, name))
1077 child.CollectExclusionInfo(compareExclusion, prjConfig);
1078 common = exclusionInfo[unknown];
1079 commonComp = compareExclusion[unknown];
1080 if(exclusionInfo.count == 1 && compareExclusion.count == 1)
1082 if(!(common == true || commonComp == true))
1091 for(platform = (Platform)1; platform < Platform::enumSize; platform++)
1094 actualComp = commonComp;
1095 if(exclusionInfo[platform] != unset)
1096 actual = exclusionInfo[platform];
1097 if(compareExclusion[platform] != unset)
1098 actualComp = compareExclusion[platform];
1099 if(!(actual == true || actualComp == true))
1107 compareExclusion.Free();
1110 result = child.FindSameNameConflict(name, includeResources, exclusionInfo, prjConfig);
1114 compareExclusion.Free();
1116 delete compareExclusion;
1120 ProjectNode Add(Project project, char * filePath, ProjectNode after, NodeTypes type, NodeIcons icon, bool checkIfExists)
1122 ProjectNode node = null;
1123 char temp[MAX_LOCATION];
1124 Map<Platform, SetBool> exclusionInfo { };
1126 GetLastDirectory(filePath, temp);
1127 //if(!checkIfExists || !project.topNode.Find(temp, false))
1129 // TOCHECK: Shouldn't this apply either for all configs or none?
1130 CollectExclusionInfo(exclusionInfo, project.config);
1131 if(!checkIfExists || !project.topNode.FindSameNameConflict(temp, false, exclusionInfo, project.config))
1133 // Do the check for folder in the same parent or resource files only here
1134 if(type == folder || !checkIfExists)
1138 if(node.name && !strcmpi(node.name, temp))
1143 node = ProjectNode { parent = this, indent = indent + 1, type = type, icon = icon, name = CopyString(temp) };
1147 node.nodeType = folder;
1153 StripLastDirectory(filePath, temp);
1154 MakePathRelative(temp, project.topNode.path, temp);
1155 node.path = CopyUnixPath(temp);
1157 node.nodeType = file;
1161 strcpy(temp, (type == NodeTypes::project) ? "" : path);
1162 PathCatSlash(temp, node.name);
1163 node.path = CopyString(temp);
1165 files.Insert(after, node);
1167 delete exclusionInfo;
1171 #ifndef MAKEFILE_GENERATOR
1172 void OnDisplay(Surface surface, int x, int y, int width, ProjectView projectView, Alignment alignment, DataDisplayFlags displayFlags)
1174 char label[MAX_FILENAME];
1180 bool showConfig = true;
1185 projectView = ide.projectView;
1188 bmp = projectView.icons[icon].bitmap;
1189 xStart = /*indent * indent + */x + (bmp ? (bmp.width + 5) : 0);
1191 GetLastDirectory(name, label);
1192 if(!showConfig || projectView.drawingInProjectSettingsDialogHeader)
1194 if(projectView.drawingInProjectSettingsDialogHeader || (type == project && info))
1196 if(projectView.projectSettingsDialog && projectView.projectSettingsDialog.buildTab)
1199 addendum = projectView.projectSettingsDialog.buildTab.selectedConfigName;
1200 if(strlen(addendum))
1202 strcat(label, " (");
1203 strcat(label, addendum);
1206 addendum = projectView.projectSettingsDialog.buildTab.selectedPlatformName;
1207 if(strlen(addendum))
1209 strcat(label, " (");
1210 strcat(label, addendum);
1216 else if(!projectView.drawingInProjectSettingsDialog)
1219 strcat(label, " *");
1220 if(type == project && info)
1222 int len = strlen(info) + 4;
1223 char * more = new char[len];
1224 sprintf(more, " (%s)", info);
1225 strcat(label, more);
1229 len = strlen(label);
1233 if(type == folder || type == folderOpen)
1234 surface.SetForeground(yellow);
1238 surface.TextOpacity(false);
1239 surface.TextExtent(label, len, &w, &h);
1242 // Draw the current row stipple
1243 if(displayFlags.selected)
1244 //surface.Area(xStart - 1, y, xStart - 1, y + h - 1);
1245 //surface.Area(xStart + w - 1, y, xStart + w + 1, y + h - 1);
1246 surface.Area(xStart - 3, y, xStart + w + 1, y + h - 1);
1248 surface.WriteTextDots(alignment, xStart, y + 2, width, label, len);
1252 if(displayFlags.current)
1254 if(displayFlags.active)
1256 surface.LineStipple(0x5555);
1257 if(displayFlags.selected)
1258 surface.SetForeground(projectView.fileList.stippleColor);
1260 surface.SetForeground(projectView.fileList.foreground);
1264 surface.SetForeground(SELECTION_COLOR);
1266 surface.Rectangle(xStart - 3, y, xStart + w + 1, y + h - 1);
1267 surface.LineStipple(0);
1272 surface.SetForeground(white);
1273 surface.Blit(bmp, x /*+ indent * indent*/,y,0,0, bmp.width, bmp.height);
1279 int OnCompare(ProjectNode b)
1282 if(type == b.type /*|| type >= TYPE_DRIVE*/)
1283 result = strcmpi(name, b.name);
1286 if(type == folder && b.type == file) result = -1;
1287 else if(type == file && b.type == folder) result = 1;
1292 bool ContainsFilesWithExtension(char * extension)
1296 char ext[MAX_EXTENSION];
1297 GetExtension(name, ext);
1298 if(!fstrcmp(ext, extension))
1303 bool needed = false;
1305 if(child.ContainsFilesWithExtension(extension))
1311 void GenFileFlags(File f, Project project, ProjectConfig prjConfig)
1313 ProjectNode node = null;
1314 List<ProjectNode> nodeStack { };
1316 for(node = this; node && node.parent; node = node.parent)
1317 nodeStack.Add(node);
1319 // Should we reverse this stack to give priority to the per-file includes?
1321 while((node = nodeStack.lastIterator.data))
1323 ProjectOptions nodeOptions = node.property::options;
1324 ProjectConfig config = node.GetMatchingNodeConfig(prjConfig);
1325 if(nodeOptions && nodeOptions.preprocessorDefinitions)
1326 OutputListOption(f, "D", nodeOptions.preprocessorDefinitions, inPlace, false);
1327 if(config && config.options && config.options.preprocessorDefinitions)
1328 OutputListOption(f, "D", config.options.preprocessorDefinitions, inPlace, false);
1329 if(nodeOptions && nodeOptions.includeDirs)
1330 OutputListOption(f, "I", nodeOptions.includeDirs, inPlace, true);
1331 if(config && config.options && config.options.includeDirs)
1332 OutputListOption(f, "I", config.options.includeDirs, inPlace, true);
1334 nodeStack.lastIterator.Remove();
1339 void GenMakefileGetNameCollisionInfo(Map<String, NameCollisionInfo> namesInfo, ProjectConfig prjConfig)
1343 char extension[MAX_EXTENSION];
1344 GetExtension(name, extension);
1345 if(!strcmpi(extension, "ec") || !strcmpi(extension, "c") ||
1346 !strcmpi(extension, "cpp") || !strcmpi(extension, "cc") ||
1347 !strcmpi(extension, "cxx") || !strcmpi(extension, "m"))
1349 char moduleName[MAX_FILENAME];
1350 NameCollisionInfo info;
1351 ReplaceSpaces(moduleName, name);
1352 StripExtension(moduleName);
1353 info = namesInfo[moduleName];
1355 info = NameCollisionInfo { };
1356 info.count++; // += 1; unless this is for a bug?
1357 if(!strcmpi(extension, "ec"))
1359 else if(!strcmpi(extension, "c"))
1361 else if(!strcmpi(extension, "cpp"))
1363 else if(!strcmpi(extension, "cc"))
1365 else if(!strcmpi(extension, "cxx"))
1367 else if(!strcmpi(extension, "m"))
1369 namesInfo[moduleName] = info;
1376 if(child.type != resources && (child.type == folder || !child.GetIsExcluded(prjConfig)))
1377 child.GenMakefileGetNameCollisionInfo(namesInfo, prjConfig);
1382 int GenMakefilePrintNode(File f, Project project, GenMakefilePrintTypes printType,
1383 Map<String, NameCollisionInfo> namesInfo, Array<String> items,
1384 ProjectConfig prjConfig)
1390 TwoStrings ts = GetPlatformSpecificFu(prjConfig);
1391 char moduleName[MAX_FILENAME];
1392 char extension[MAX_EXTENSION];
1393 GetExtension(name, extension);
1394 if(printType == resources)
1397 char tempPath[MAX_LOCATION];
1398 char modulePath[MAX_LOCATION];
1401 if(eString_PathInsideOfMore(path, project.resNode.path, tempPath))
1404 PathCatSlash(tempPath, name);
1409 strcpy(tempPath, path);
1410 PathCatSlash(tempPath, name);
1412 ReplaceSpaces(modulePath, tempPath);
1413 sprintf(s, "%s%s%s%s", ts.a, useRes ? "$(RES)" : "", modulePath, ts.b);
1414 items.Add(CopyString(s));
1416 else if(printType == sources)
1418 if(!strcmpi(extension, "c") || !strcmpi(extension, "cpp") ||
1419 !strcmpi(extension, "cc") || !strcmpi(extension, "cxx") ||
1420 !strcmpi(extension, "m"))
1422 char modulePath[MAX_LOCATION];
1424 ReplaceSpaces(modulePath, path);
1425 ReplaceSpaces(moduleName, name);
1426 sprintf(s, "%s%s%s%s%s", ts.a, modulePath, path[0] ? SEPS : "", moduleName, ts.b);
1427 items.Add(CopyString(s));
1430 else if(printType == eCsources)
1432 if(!strcmpi(extension, "ec"))
1434 char modulePath[MAX_LOCATION];
1436 ReplaceUnwantedMakeChars(modulePath, path);
1437 ReplaceUnwantedMakeChars(moduleName, name);
1438 sprintf(s, "%s%s%s%s%s", ts.a, modulePath, path[0] ? SEPS : "", moduleName, ts.b);
1439 items.Add(CopyString(s));
1442 else if(!strcmpi(extension, "c") || !strcmpi(extension, "cpp") ||
1443 !strcmpi(extension, "cc") || !strcmpi(extension, "cxx") ||
1444 !strcmpi(extension, "m"))
1446 if(printType == objects)
1449 NameCollisionInfo info;
1450 ReplaceSpaces(moduleName, name);
1451 StripExtension(moduleName);
1452 info = namesInfo[moduleName];
1453 collision = info ? info.IsExtensionColliding(extension) : false;
1454 sprintf(s, "%s$(OBJ)%s%s%s.o%s", ts.a, moduleName, collision ? "." : "", collision ? extension : "", ts.b);
1455 items.Add(CopyString(s));
1458 else if(!strcmpi(extension, "ec"))
1460 ReplaceSpaces(moduleName, name);
1461 StripExtension(moduleName);
1462 if(printType == objects)
1465 if(printType == objects)
1466 sprintf(s, "%s$(OBJ)%s.o%s", ts.a, moduleName, ts.b);
1467 else if(printType == cObjects)
1468 sprintf(s, "%s$(OBJ)%s.c%s", ts.a, moduleName, ts.b);
1469 else if(printType == symbols)
1470 sprintf(s, "%s$(OBJ)%s.sym%s", ts.a, moduleName, ts.b);
1471 else if(printType == imports)
1472 sprintf(s, "%s$(OBJ)%s.imp%s", ts.a, moduleName, ts.b);
1474 items.Add(CopyString(s));
1482 if(child.type != resources && (child.type == folder || !child.GetIsExcluded(prjConfig)))
1483 count += child.GenMakefilePrintNode(f, project, printType, namesInfo, items, prjConfig);
1489 void GenMakefilePrintSymbolRules(File f, Project project, CompilerConfig compiler,
1490 ProjectConfig prjConfig, Map<Platform, bool> parentExcludedPlatforms)
1493 Array<Platform> platforms = GetPlatformsArrayFromExcluisionInfo(prjConfig);
1494 //ProjectNode child;
1495 //char objDir[MAX_LOCATION];
1496 //ReplaceSpaces(objDir, config.objDir.dir);
1498 //eSystem_Log("Printing Symbol Rules\n");
1501 char extension[MAX_EXTENSION];
1502 char modulePath[MAX_LOCATION];
1503 char moduleName[MAX_FILENAME];
1505 GetExtension(name, extension);
1506 if(!strcmpi(extension, "ec"))
1511 ReplaceSpaces(moduleName, name);
1512 StripExtension(moduleName);
1514 ReplaceSpaces(modulePath, path);
1515 if(modulePath[0]) strcat(modulePath, SEPS);
1518 // *** Dependency command ***
1519 sprintf(command, "gcc -MT $(OBJ)%s.o -MM %s%s.%s", moduleName,
1520 modulePath, moduleName, extension);
1522 // System Includes (from global settings)
1523 for(item : compiler.dirs[Includes])
1525 strcat(command, " -isystem ");
1526 if(strchr(item, ' '))
1528 strcat(command, "\"");
1529 strcat(command, item);
1530 strcat(command, "\"");
1533 strcat(command, item);
1536 for(item : project.includeDirs)
1538 strcat(command, " -I");
1539 if(strchr(item, ' '))
1541 strcat(command, "\"");
1542 strcat(command, item);
1543 strcat(command, "\"");
1546 strcat(command, item);
1548 for(item : project.preprocessorDefs)
1550 strcat(command, " -D");
1551 strcat(command, item);
1555 if((dep = DualPipeOpen(PipeOpenMode { output = 1, error = 1, input = 2 }, command)))
1558 bool firstLine = true;
1561 // To do some time: auto save external dependencies?
1564 if(dep.GetLine(line, sizeof(line)-1))
1568 char * colon = strstr(line, ":");
1569 if(strstr(line, "No such file") || strstr(line, ",") || (colon && strstr(colon+1, ":")))
1583 // If we failed to generate dependencies...
1587 OpenRulesPlatformExclusionIfs(f, &ifCount, platforms[0], parentExcludedPlatforms, null);
1588 f.Printf("$(OBJ)%s.sym: %s%s.%s\n",
1589 moduleName, modulePath, moduleName, extension);
1595 f.Printf("\t$(ECP) %s%s.%s %s.sym\n\n",
1596 modulePath, moduleName, extension, moduleName);
1599 f.Printf("\t$(ECP)");
1600 // Give priority to file flags
1601 GenFileFlags(f, project, prjConfig);
1603 f.Printf(" $(CECFLAGS)");
1604 if(GetECFLAGS(prjConfig))
1606 if(GetMemoryGuard(prjConfig))
1607 f.Printf(" -memguard");
1608 if(GetStrictNameSpaces(prjConfig))
1609 f.Printf(" -strictns");
1611 char * s = GetDefaultNameSpace(prjConfig);
1613 f.Printf(" -defaultns %s", s);
1617 f.Printf(" $(ECFLAGS)");
1618 f.Printf(" $(CFLAGS)");
1620 f.Printf(" -c %s%s.%s -o $(OBJ)%s.sym\n\n",
1621 modulePath, moduleName, extension, moduleName);
1622 CloseRulesPlatformExclusionIfs(f, ifCount);
1627 bool needed = false;
1628 if(ContainsFilesWithExtension("ec"))
1632 if(child.type != resources && (child.type == folder || !child.GetIsExcluded(prjConfig)))
1641 Map<Platform, bool> excludedPlatforms { };
1642 for(mn : parentExcludedPlatforms) if(mn) excludedPlatforms[&mn] = true;
1643 for(platform : platforms)
1645 OpenRulesPlatformExclusionIfs(f, &ifCount, platform, parentExcludedPlatforms, excludedPlatforms);
1648 if(child.type != resources && (child.type == folder || !child.GetIsExcluded(prjConfig)))
1649 child.GenMakefilePrintSymbolRules(f, project, compiler, prjConfig, excludedPlatforms);
1652 CloseRulesPlatformExclusionIfs(f, ifCount);
1653 delete excludedPlatforms;
1659 void GenMakefilePrintPrepecsRules(File f, Project project, CompilerConfig compiler,
1660 ProjectConfig prjConfig, Map<Platform, bool> parentExcludedPlatforms)
1663 ProjectConfig config = GetMatchingNodeConfig(prjConfig);
1664 Array<Platform> platforms = GetPlatformsArrayFromExcluisionInfo(prjConfig);
1665 //ProjectNode child;
1666 //char objDir[MAX_LOCATION];
1667 //ReplaceSpaces(objDir, config.objDir.dir);
1669 //eSystem_Log("Printing Symbol Rules\n");
1672 char extension[MAX_EXTENSION];
1673 char modulePath[MAX_LOCATION];
1674 char moduleName[MAX_FILENAME];
1676 GetExtension(name, extension);
1677 if(!strcmpi(extension, "ec"))
1682 ReplaceSpaces(moduleName, name);
1683 StripExtension(moduleName);
1685 ReplaceSpaces(modulePath, path);
1686 if(modulePath[0]) strcat(modulePath, SEPS);
1688 OpenRulesPlatformExclusionIfs(f, &ifCount, platforms[0], parentExcludedPlatforms, null);
1689 f.Printf("$(OBJ)%s$(EC): %s%s.%s\n",
1690 moduleName, modulePath, moduleName, extension);
1691 //$(CPP) -x c -E ../extras/gui/controls/DirectoriesBox.ec -o $(OBJ)DirectoriesBox$(EC)
1692 /*f.Printf("\t$(CPP) %s%s.%s %s$(S)\n\n",
1693 modulePath, moduleName, extension, moduleName);*/
1695 f.Printf("\t$(CPP)");
1696 // Give priority to file flags
1697 GenFileFlags(f, project, prjConfig);
1699 /*f.Printf(" $(CECFLAGS)");
1700 if(GetECFLAGS(prjConfig))
1702 if(GetMemoryGuard(prjConfig))
1703 f.Printf(" -memguard");
1704 if(GetStrictNameSpaces(prjConfig))
1705 f.Printf(" -strictns");
1707 char * s = GetDefaultNameSpace(prjConfig);
1709 f.Printf(" -defaultns %s", s);
1713 f.Printf(" $(ECFLAGS)");*/
1714 f.Printf(" $(CFLAGS)");
1716 f.Printf(" -x c -E %s%s.%s -o $(OBJ)%s$(EC)\n\n",
1717 modulePath, moduleName, extension, moduleName);
1718 CloseRulesPlatformExclusionIfs(f, ifCount);
1723 bool needed = false;
1724 if(ContainsFilesWithExtension("ec"))
1728 if(child.type != resources && (child.type == folder || !child.GetIsExcluded(prjConfig)))
1737 Map<Platform, bool> excludedPlatforms { };
1738 for(mn : parentExcludedPlatforms) if(mn) excludedPlatforms[&mn] = true;
1739 for(platform : platforms)
1741 OpenRulesPlatformExclusionIfs(f, &ifCount, platform, parentExcludedPlatforms, excludedPlatforms);
1744 if(child.type != resources && (child.type == folder || !child.GetIsExcluded(prjConfig)))
1745 child.GenMakefilePrintPrepecsRules(f, project, compiler, prjConfig, excludedPlatforms);
1748 CloseRulesPlatformExclusionIfs(f, ifCount);
1749 delete excludedPlatforms;
1755 void GenMakefilePrintCObjectRules(File f, Project project, CompilerConfig compiler,
1756 ProjectConfig prjConfig, Map<Platform, bool> parentExcludedPlatforms)
1759 ProjectConfig config = GetMatchingNodeConfig(prjConfig);
1760 Array<Platform> platforms = GetPlatformsArrayFromExcluisionInfo(prjConfig);
1761 //ProjectNode child;
1762 //char objDir[MAX_LOCATION];
1763 //ReplaceSpaces(objDir, config.objDir.dir);
1764 //eSystem_Log("Printing C Object Rules\n");
1767 char extension[MAX_EXTENSION];
1768 char modulePath[MAX_LOCATION];
1769 char moduleName[MAX_FILENAME];
1771 GetExtension(name, extension);
1772 if(!strcmpi(extension, "ec"))
1777 ReplaceSpaces(moduleName, name);
1778 StripExtension(moduleName);
1780 ReplaceSpaces(modulePath, path);
1781 if(modulePath[0]) strcat(modulePath, SEPS);
1784 // *** Dependency command ***
1785 sprintf(command, "gcc -MT $(OBJ)%s.o -MM %s%s.%s",
1786 moduleName, modulePath, moduleName, extension);
1788 // System Includes (from global settings)
1789 for(item : compiler.dirs[Includes])
1791 strcat(command, " -isystem ");
1792 if(strchr(item, ' '))
1794 strcat(command, "\"");
1795 strcat(command, item);
1796 strcat(command, "\"");
1799 strcat(command, item);
1802 for(item : config.includeDirs)
1804 strcat(command, " -I");
1805 if(strchr(item, ' '))
1807 strcat(command, "\"");
1808 strcat(command, item);
1809 strcat(command, "\"");
1812 strcat(command, item);
1814 for(item : config.preprocessorDefs)
1816 strcat(command, " -D");
1817 strcat(command, item);
1821 if((dep = DualPipeOpen(PipeOpenMode { output = 1, error = 1, input = 2 }, command)))
1825 bool firstLine = true;
1827 // To do some time: auto save external dependencies?
1830 if(dep.GetLine(line, sizeof(line)-1))
1834 char * colon = strstr(line, ":");
1835 if(strstr(line, "No such file") || strstr(line, ",") || (colon && strstr(colon+1, ":")))
1849 // If we failed to generate dependencies...
1852 /* COMMENTED OUT FOR NOW
1853 f.Printf("$(OBJ)%s.c: %s%s.%s $(Symbols)\n",
1854 moduleName, modulePath, moduleName, extension);
1857 OpenRulesPlatformExclusionIfs(f, &ifCount, platforms[0], parentExcludedPlatforms, null);
1858 f.Printf("$(OBJ)%s.c: %s%s.%s $(OBJ)%s.sym | $(SYMBOLS)\n",
1859 moduleName, modulePath, moduleName, extension, moduleName);
1865 f.Printf("\t$(ECC) %s%s.%s $(OBJ)%s.c\n\n",
1866 modulePath, moduleName, extension, moduleName);
1869 f.Printf("\t$(ECC)");
1870 // Give priority to file flags
1871 GenFileFlags(f, project, prjConfig);
1872 if(GetECFLAGS(prjConfig))
1874 f.Printf("%s $(CECFLAGS)", GetNoLineNumbers(prjConfig) ? " -nolinenumbers" : "");
1875 if(GetMemoryGuard(prjConfig))
1876 f.Printf(" -memguard");
1877 if(GetStrictNameSpaces(prjConfig))
1878 f.Printf(" -strictns");
1880 char * s = GetDefaultNameSpace(prjConfig);
1882 f.Printf(" -defaultns %s", s);
1886 f.Printf(" $(CECFLAGS) $(ECFLAGS)");
1887 f.Printf(" $(CFLAGS) $(FVISIBILITY)");
1889 f.Printf(" -c %s%s.%s -o $(OBJ)%s.c -symbols $(OBJ)\n\n",
1890 modulePath, moduleName, extension, moduleName);
1891 CloseRulesPlatformExclusionIfs(f, ifCount);
1896 bool needed = false;
1897 if(ContainsFilesWithExtension("ec"))
1901 if(child.type != resources && (child.type == folder || !child.GetIsExcluded(prjConfig)))
1910 Map<Platform, bool> excludedPlatforms { };
1911 for(mn : parentExcludedPlatforms) if(mn) excludedPlatforms[&mn] = true;
1912 for(platform : platforms)
1914 OpenRulesPlatformExclusionIfs(f, &ifCount, platform, parentExcludedPlatforms, excludedPlatforms);
1917 if(child.type != resources && (child.type == folder || !child.GetIsExcluded(prjConfig)))
1918 child.GenMakefilePrintCObjectRules(f, project, compiler, prjConfig, excludedPlatforms);
1921 CloseRulesPlatformExclusionIfs(f, ifCount);
1922 delete excludedPlatforms;
1928 void GenMakefilePrintObjectRules(File f, Project project,
1929 Map<String, NameCollisionInfo> namesInfo,
1930 CompilerConfig compiler, ProjectConfig prjConfig,
1931 Map<Platform, bool> parentExcludedPlatforms)
1934 ProjectConfig config = GetMatchingNodeConfig(prjConfig);
1935 Array<Platform> platforms = GetPlatformsArrayFromExcluisionInfo(prjConfig);
1936 //ProjectNode child;
1937 //char objDir[MAX_LOCATION];
1938 //ReplaceSpaces(objDir, config.objDir.dir);
1939 //eSystem_Log("Printing Object Rules\n");
1943 char extension[MAX_EXTENSION];
1944 char modulePath[MAX_LOCATION];
1945 char moduleName[MAX_FILENAME];
1947 GetExtension(name, extension);
1948 /*if(!strcmpi(extension, "c") || !strcmpi(extension, "cpp") ||
1949 !strcmpi(extension, "ec") || !strcmpi(extension, "cc") ||
1950 !strcmpi(extension, "cxx"))*/
1951 if(!strcmpi(extension, "c") || !strcmpi(extension, "cpp") ||
1952 !strcmpi(extension, "cc") || !strcmpi(extension, "cxx") ||
1953 !strcmpi(extension, "m") || !strcmpi(extension, "ec"))
1957 NameCollisionInfo info;
1959 ReplaceSpaces(moduleName, name);
1960 StripExtension(moduleName);
1962 info = namesInfo[moduleName];
1963 collision = info ? info.IsExtensionColliding(extension) : false;
1965 ReplaceSpaces(modulePath, path);
1966 if(modulePath[0]) strcat(modulePath, SEPS);
1968 // *** Dependency command ***
1969 if(!strcmpi(extension, "ec"))
1970 sprintf(command, "%s -MT $(OBJ)%s.o -MM $(OBJ)%s.c", compiler.ccCommand, moduleName, moduleName);
1972 sprintf(command, "%s -MT $(OBJ)%s.o -MM %s%s.%s", compiler.ccCommand, moduleName, modulePath, moduleName, extension);
1974 if(!strcmpi(extension, "ec"))
1975 f.Printf("$(OBJ)%s.o: $(OBJ)%s.c\n", moduleName, moduleName);
1979 // System Includes (from global settings)
1980 for(item : compiler.dirs[includes])
1982 strcat(command, " -isystem ");
1983 if(strchr(item, ' '))
1985 strcat(command, "\"");
1986 strcat(command, item);
1987 strcat(command, "\"");
1990 strcat(command, item);
1993 for(item : config.includeDirs)
1995 strcat(command, " -I");
1996 if(strchr(item, ' '))
1998 strcat(command, "\"");
1999 strcat(command, item);
2000 strcat(command, "\"");
2003 strcat(command, item);
2005 for(item : config.preprocessorDefs)
2007 strcat(command, " -D");
2008 strcat(command, item);
2012 if((dep = DualPipeOpen(PipeOpenMode { output = 1, error = 1, input = 2 }, command)))
2015 bool firstLine = true;
2018 // To do some time: auto save external dependencies?
2022 if(dep.GetLine(line, sizeof(line)-1))
2026 char * colon = strstr(line, ":");
2027 if(strstr(line, "No such file") || strstr(line, ",") || (colon && strstr(colon+1, ":")))
2041 // If we failed to generate dependencies...
2045 OpenRulesPlatformExclusionIfs(f, &ifCount, platforms[0], parentExcludedPlatforms, null);
2047 /*if(!strcmpi(extension, "ec"))
2048 f.Printf("$(OBJ)%s.o: $(OBJ)%s.c\n", moduleName, moduleName);
2050 f.Printf("$(OBJ)%s%s%s.o: %s%s.%s\n", moduleName,
2051 collision ? "." : "", collision ? extension : "", modulePath, moduleName, extension);
2057 f.Printf("\t$(CC)");
2058 // Give priority to file flags
2059 GenFileFlags(f, project, prjConfig);
2061 f.Printf(" $(CFLAGS)");
2063 if(!strcmpi(extension, "ec"))
2064 f.Printf(" $(FVISIBILITY) -c $(OBJ)%s.c -o $(OBJ)%s.o\n\n", moduleName, moduleName);
2066 f.Printf(" -c %s%s.%s -o $(OBJ)%s%s%s.o\n\n",
2067 modulePath, moduleName, !strcmpi(extension, "ec") ? "c" : extension, moduleName,
2068 collision ? "." : "", collision ? extension : "");
2069 CloseRulesPlatformExclusionIfs(f, ifCount);
2074 bool needed = false;
2077 if(child.type != resources && (child.type == folder || !child.GetIsExcluded(prjConfig)))
2085 Map<Platform, bool> excludedPlatforms { };
2086 for(mn : parentExcludedPlatforms) if(mn) excludedPlatforms[&mn] = true;
2087 for(platform : platforms)
2089 OpenRulesPlatformExclusionIfs(f, &ifCount, platform, parentExcludedPlatforms, excludedPlatforms);
2092 if(child.type != resources && (child.type == folder || !child.GetIsExcluded(prjConfig)))
2093 child.GenMakefilePrintObjectRules(f, project, namesInfo, compiler, prjConfig, excludedPlatforms);
2096 CloseRulesPlatformExclusionIfs(f, ifCount);
2097 delete excludedPlatforms;
2103 void GenMakefileAddResources(File f, String resourcesPath, ProjectConfig prjConfig)
2110 //Iterator<ProjectNode> i { files };
2111 //Iterator<ProjectNode> prev { files };
2112 //for(child : files)
2114 for(c = 0; c < files.count; c++)
2116 ProjectNode child = files[c];
2117 TwoStrings ts = child.GetPlatformSpecificFu(prjConfig);
2120 if(child.type == file && !child.GetIsExcluded(prjConfig) && !(count > 0 && ts))
2123 char tempPath[MAX_LOCATION];
2124 char resPath[MAX_LOCATION];
2128 // $(EAR) aw%s --- /*quiet ? "q" : */""
2130 f.Printf("\t%s$(EAR) aw $(TARGET)", ts.a);
2133 if(eString_PathInsideOfMore(child.path, resourcesPath, tempPath))
2136 PathCatSlash(tempPath, child.name);
2141 strcpy(tempPath, child.path);
2142 PathCatSlash(tempPath, child.name);
2144 ReplaceSpaces(resPath, tempPath);
2145 if(strchr(tempPath, ' '))
2149 f.Printf(" %s%s%s%s", quotes, useRes ? "$(RES)" : "", tempPath, quotes);
2152 if(count == 10 || (count > 0 && (ts || !child.next)))
2154 char path[MAX_LOCATION] = "", temp[MAX_LOCATION];
2157 for(parent = this; parent.type == folder; parent = parent.parent)
2160 strcpy(path, parent.name);
2167 f.Printf(" \"%s\"%s\n", path, ts.b);
2179 if(child.type == folder)
2180 child.GenMakefileAddResources(f, resourcesPath, prjConfig);
2185 Array<Platform> GetPlatformsArrayFromExcluisionInfo(ProjectConfig prjConfig)
2187 Array<Platform> platforms { };
2188 Map<Platform, SetBool> exclusionInfo { };
2189 CollectExclusionInfo(exclusionInfo, prjConfig);
2190 if(exclusionInfo[unknown] == true && exclusionInfo.count > 1)
2191 for(mn : exclusionInfo; mn == false)
2194 platforms.Add(unknown);
2195 delete exclusionInfo;
2200 class NameCollisionInfo
2210 bool IsExtensionColliding(char * extension)
2213 if(count > 1 && ((!strcmpi(extension, "c") && ec) ||
2214 (!strcmpi(extension, "cpp") && (ec || c)) ||
2215 (!strcmpi(extension, "cc") && (ec || c || cpp)) ||
2216 (!strcmpi(extension, "cxx") && (ec || c || cpp || cc)) ||
2217 !strcmpi(extension, "m")))
2225 static inline void OpenRulesPlatformExclusionIfs(File f, int * ifCount, Platform platform,
2226 Map<Platform, bool> parentExcludedPlatforms, Map<Platform, bool> excludedPlatforms)
2228 if(platform != unknown && !parentExcludedPlatforms[platform])
2230 if(*ifCount) // we really need a if defined(a) || defined(b) here
2231 f.Printf("else\n"); // instead of repeating the rules for each platform
2233 f.Printf("ifdef %s\n\n", PlatformToMakefileVariable(platform)); //
2234 if(excludedPlatforms)
2235 excludedPlatforms[platform] = true;
2239 static inline void CloseRulesPlatformExclusionIfs(File f, int ifCount)
2244 for(c = 0; c < ifCount; c++)
2245 f.Printf("endif\n");