diff options
author | Adam Frisby | 2007-07-11 08:10:25 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-11 08:10:25 +0000 |
commit | e2ff441e31328e60c8bb1d4bb32fa4ac64f91978 (patch) | |
tree | 8405b6cef57b66a58f31a24c859846085d0b81f7 /Prebuild/src/Core/Targets/AutotoolsTarget.cs | |
parent | * Wiping trunk in prep for Sugilite (diff) | |
parent | * Applying dalien's patches from bug#177 and #179 (diff) | |
download | opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.zip opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.gz opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.bz2 opensim-SC-e2ff441e31328e60c8bb1d4bb32fa4ac64f91978.tar.xz |
* Bringing Sugilite in to trunk
Diffstat (limited to 'Prebuild/src/Core/Targets/AutotoolsTarget.cs')
-rw-r--r-- | Prebuild/src/Core/Targets/AutotoolsTarget.cs | 926 |
1 files changed, 926 insertions, 0 deletions
diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs new file mode 100644 index 0000000..2b4a678 --- /dev/null +++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs | |||
@@ -0,0 +1,926 @@ | |||
1 | #region BSD License | ||
2 | /* | ||
3 | |||
4 | Copyright (c) 2004 - 2006 | ||
5 | Matthew Holmes (matthew@wildfiregames.com), | ||
6 | Dan Moorehead (dan05a@gmail.com), | ||
7 | Dave Hudson (jendave@yahoo.com), | ||
8 | C.J. Adams-Collier (cjcollier@colliertech.org), | ||
9 | |||
10 | Redistribution and use in source and binary forms, with or without | ||
11 | modification, are permitted provided that the following conditions are | ||
12 | met: | ||
13 | |||
14 | * Redistributions of source code must retain the above copyright | ||
15 | notice, this list of conditions and the following disclaimer. | ||
16 | |||
17 | * Redistributions in binary form must reproduce the above copyright | ||
18 | notice, this list of conditions and the following disclaimer in the | ||
19 | documentation and/or other materials provided with the distribution. | ||
20 | |||
21 | * The name of the author may not be used to endorse or promote | ||
22 | products derived from this software without specific prior written | ||
23 | permission. | ||
24 | |||
25 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
26 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
28 | DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | ||
29 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
30 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
31 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
32 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
34 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
35 | POSSIBILITY OF SUCH DAMAGE. | ||
36 | |||
37 | */ | ||
38 | #endregion | ||
39 | |||
40 | #region CVS Information | ||
41 | /* | ||
42 | * $Source$ | ||
43 | * $Author: jendave $ | ||
44 | * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $ | ||
45 | * $Revision: 136 $ | ||
46 | */ | ||
47 | #endregion | ||
48 | |||
49 | using System; | ||
50 | using System.Collections; | ||
51 | using System.Collections.Specialized; | ||
52 | using System.IO; | ||
53 | using System.Reflection; | ||
54 | using System.Text; | ||
55 | using System.Text.RegularExpressions; | ||
56 | |||
57 | using Prebuild.Core.Attributes; | ||
58 | using Prebuild.Core.Interfaces; | ||
59 | using Prebuild.Core.Nodes; | ||
60 | using Prebuild.Core.Parse; | ||
61 | using Prebuild.Core.Utilities; | ||
62 | |||
63 | namespace Prebuild.Core.Targets | ||
64 | { | ||
65 | /// <summary> | ||
66 | /// | ||
67 | /// </summary> | ||
68 | [Target("autotools")] | ||
69 | public class AutotoolsTarget : ITarget | ||
70 | { | ||
71 | #region Fields | ||
72 | |||
73 | private Kernel m_Kernel; | ||
74 | |||
75 | #endregion | ||
76 | |||
77 | #region Private Methods | ||
78 | |||
79 | private static string PrependPath(string path) | ||
80 | { | ||
81 | string tmpPath = Helper.NormalizePath(path, '/'); | ||
82 | Regex regex = new Regex(@"(\w):/(\w+)"); | ||
83 | Match match = regex.Match(tmpPath); | ||
84 | if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') | ||
85 | { | ||
86 | tmpPath = Helper.NormalizePath(tmpPath); | ||
87 | } | ||
88 | else | ||
89 | { | ||
90 | tmpPath = Helper.NormalizePath("./" + tmpPath); | ||
91 | } | ||
92 | |||
93 | return tmpPath; | ||
94 | } | ||
95 | |||
96 | private static string BuildReference(SolutionNode solution, ReferenceNode refr) | ||
97 | { | ||
98 | string ret = ""; | ||
99 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | ||
100 | { | ||
101 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | ||
102 | string fileRef = FindFileReference(refr.Name, project); | ||
103 | string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/$(BUILD_DIR)/$(CONFIG)/", refr.Name, "dll"), '/'); | ||
104 | ret += finalPath; | ||
105 | return ret; | ||
106 | } | ||
107 | else | ||
108 | { | ||
109 | ProjectNode project = (ProjectNode)refr.Parent; | ||
110 | string fileRef = FindFileReference(refr.Name, project); | ||
111 | |||
112 | if(refr.Path != null || fileRef != null) | ||
113 | { | ||
114 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; | ||
115 | ret += Path.Combine(project.Path, finalPath); | ||
116 | return ret; | ||
117 | } | ||
118 | |||
119 | try | ||
120 | { | ||
121 | //Assembly assem = Assembly.Load(refr.Name); | ||
122 | //if (assem != null) | ||
123 | //{ | ||
124 | // int index = refr.Name.IndexOf(","); | ||
125 | // if ( index > 0) | ||
126 | // { | ||
127 | // ret += assem.Location; | ||
128 | // //Console.WriteLine("Location1: " + assem.Location); | ||
129 | // } | ||
130 | // else | ||
131 | // { | ||
132 | // ret += (refr.Name + ".dll"); | ||
133 | // //Console.WriteLine("Location2: " + assem.Location); | ||
134 | // } | ||
135 | //} | ||
136 | //else | ||
137 | //{ | ||
138 | int index = refr.Name.IndexOf(","); | ||
139 | if ( index > 0) | ||
140 | { | ||
141 | ret += refr.Name.Substring(0, index) + ".dll"; | ||
142 | //Console.WriteLine("Location3: " + assem.Location); | ||
143 | } | ||
144 | else | ||
145 | { | ||
146 | ret += (refr.Name + ".dll"); | ||
147 | //Console.WriteLine("Location4: " + assem.Location); | ||
148 | } | ||
149 | //} | ||
150 | } | ||
151 | catch (System.NullReferenceException e) | ||
152 | { | ||
153 | e.ToString(); | ||
154 | int index = refr.Name.IndexOf(","); | ||
155 | if ( index > 0) | ||
156 | { | ||
157 | ret += refr.Name.Substring(0, index) + ".dll"; | ||
158 | //Console.WriteLine("Location5: " + assem.Location); | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | ret += (refr.Name + ".dll"); | ||
163 | //Console.WriteLine("Location6: " + assem.Location); | ||
164 | } | ||
165 | } | ||
166 | } | ||
167 | return ret; | ||
168 | } | ||
169 | |||
170 | private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) | ||
171 | { | ||
172 | string ret = ""; | ||
173 | if(solution.ProjectsTable.ContainsKey(refr.Name)) | ||
174 | { | ||
175 | ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; | ||
176 | string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/'); | ||
177 | ret += finalPath; | ||
178 | return ret; | ||
179 | } | ||
180 | else | ||
181 | { | ||
182 | ProjectNode project = (ProjectNode)refr.Parent; | ||
183 | string fileRef = FindFileReference(refr.Name, project); | ||
184 | |||
185 | |||
186 | if(refr.Path != null || fileRef != null) | ||
187 | { | ||
188 | string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; | ||
189 | ret += finalPath; | ||
190 | return ret; | ||
191 | } | ||
192 | |||
193 | try | ||
194 | { | ||
195 | Assembly assem = Assembly.Load(refr.Name); | ||
196 | if (assem != null) | ||
197 | { | ||
198 | ret += ""; | ||
199 | } | ||
200 | else | ||
201 | { | ||
202 | ret += ""; | ||
203 | } | ||
204 | } | ||
205 | catch (System.NullReferenceException e) | ||
206 | { | ||
207 | e.ToString(); | ||
208 | ret += ""; | ||
209 | } | ||
210 | } | ||
211 | return ret; | ||
212 | } | ||
213 | |||
214 | private static string FindFileReference(string refName, ProjectNode project) | ||
215 | { | ||
216 | foreach(ReferencePathNode refPath in project.ReferencePaths) | ||
217 | { | ||
218 | string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); | ||
219 | |||
220 | if(File.Exists(fullPath)) | ||
221 | { | ||
222 | return fullPath; | ||
223 | } | ||
224 | } | ||
225 | |||
226 | return null; | ||
227 | } | ||
228 | |||
229 | /// <summary> | ||
230 | /// Gets the XML doc file. | ||
231 | /// </summary> | ||
232 | /// <param name="project">The project.</param> | ||
233 | /// <param name="conf">The conf.</param> | ||
234 | /// <returns></returns> | ||
235 | public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) | ||
236 | { | ||
237 | if( conf == null ) | ||
238 | { | ||
239 | throw new ArgumentNullException("conf"); | ||
240 | } | ||
241 | if( project == null ) | ||
242 | { | ||
243 | throw new ArgumentNullException("project"); | ||
244 | } | ||
245 | string docFile = (string)conf.Options["XmlDocFile"]; | ||
246 | // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified | ||
247 | // { | ||
248 | // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; | ||
249 | // } | ||
250 | return docFile; | ||
251 | } | ||
252 | |||
253 | /// <summary> | ||
254 | /// Normalizes the path. | ||
255 | /// </summary> | ||
256 | /// <param name="path">The path.</param> | ||
257 | /// <returns></returns> | ||
258 | public static string NormalizePath(string path) | ||
259 | { | ||
260 | if(path == null) | ||
261 | { | ||
262 | return ""; | ||
263 | } | ||
264 | |||
265 | StringBuilder tmpPath; | ||
266 | |||
267 | if (Core.Parse.Preprocessor.GetOS() == "Win32") | ||
268 | { | ||
269 | tmpPath = new StringBuilder(path.Replace('\\', '/')); | ||
270 | tmpPath.Replace("/", @"\\"); | ||
271 | } | ||
272 | else | ||
273 | { | ||
274 | tmpPath = new StringBuilder(path.Replace('\\', '/')); | ||
275 | tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar); | ||
276 | } | ||
277 | return tmpPath.ToString(); | ||
278 | } | ||
279 | |||
280 | private void WriteProject(SolutionNode solution, ProjectNode project) | ||
281 | { | ||
282 | string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); | ||
283 | StreamWriter ss = new StreamWriter(projFile); | ||
284 | ss.NewLine = "\n"; | ||
285 | |||
286 | m_Kernel.CurrentWorkingDirectory.Push(); | ||
287 | Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); | ||
288 | |||
289 | using(ss) | ||
290 | { | ||
291 | ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":"); | ||
292 | ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/"); | ||
293 | foreach(string file in project.Files) | ||
294 | { | ||
295 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | ||
296 | { | ||
297 | ss.Write("\tresgen "); | ||
298 | ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/')); | ||
299 | if (project.Files.GetResourceName(file) != "") | ||
300 | { | ||
301 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/')); | ||
302 | } | ||
303 | else | ||
304 | { | ||
305 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/')); | ||
306 | } | ||
307 | } | ||
308 | } | ||
309 | ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\"); | ||
310 | ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\"); | ||
311 | if (project.References.Count > 0) | ||
312 | { | ||
313 | ss.Write("\t\t/reference:"); | ||
314 | bool firstref = true; | ||
315 | foreach(ReferenceNode refr in project.References) | ||
316 | { | ||
317 | if (firstref) | ||
318 | { | ||
319 | firstref = false; | ||
320 | } | ||
321 | else | ||
322 | { | ||
323 | ss.Write(","); | ||
324 | } | ||
325 | ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/')); | ||
326 | } | ||
327 | ss.WriteLine(" \\"); | ||
328 | } | ||
329 | //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\"); | ||
330 | |||
331 | foreach(string file in project.Files) | ||
332 | { | ||
333 | switch(project.Files.GetBuildAction(file)) | ||
334 | { | ||
335 | case BuildAction.EmbeddedResource: | ||
336 | ss.Write("\t\t/resource:"); | ||
337 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\"); | ||
338 | break; | ||
339 | default: | ||
340 | if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) | ||
341 | { | ||
342 | ss.Write("\t\t/resource:"); | ||
343 | if (project.Files.GetResourceName(file) != "") | ||
344 | { | ||
345 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\"); | ||
346 | } | ||
347 | else | ||
348 | { | ||
349 | ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/') + "," + project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources" + " \\"); | ||
350 | } | ||
351 | } | ||
352 | break; | ||
353 | } | ||
354 | } | ||
355 | |||
356 | foreach(ConfigurationNode conf in project.Configurations) | ||
357 | { | ||
358 | if (conf.Options.KeyFile !="") | ||
359 | { | ||
360 | ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\"); | ||
361 | break; | ||
362 | } | ||
363 | } | ||
364 | foreach(ConfigurationNode conf in project.Configurations) | ||
365 | { | ||
366 | if (conf.Options.AllowUnsafe) | ||
367 | { | ||
368 | ss.WriteLine("\t\t/unsafe \\"); | ||
369 | break; | ||
370 | } | ||
371 | } | ||
372 | if (project.AppIcon != "") | ||
373 | { | ||
374 | ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\"); | ||
375 | } | ||
376 | |||
377 | foreach(ConfigurationNode conf in project.Configurations) | ||
378 | { | ||
379 | ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\"); | ||
380 | break; | ||
381 | } | ||
382 | |||
383 | foreach(ConfigurationNode conf in project.Configurations) | ||
384 | { | ||
385 | if (GetXmlDocFile(project, conf) !="") | ||
386 | { | ||
387 | ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\"); | ||
388 | break; | ||
389 | } | ||
390 | } | ||
391 | foreach(string file in project.Files) | ||
392 | { | ||
393 | switch(project.Files.GetBuildAction(file)) | ||
394 | { | ||
395 | case BuildAction.Compile: | ||
396 | ss.WriteLine("\t\t\\"); | ||
397 | ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file))); | ||
398 | break; | ||
399 | default: | ||
400 | break; | ||
401 | } | ||
402 | } | ||
403 | ss.WriteLine(); | ||
404 | ss.WriteLine(); | ||
405 | |||
406 | if (project.Type == ProjectType.Library) | ||
407 | { | ||
408 | ss.WriteLine("install-data-local:"); | ||
409 | ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\"); | ||
410 | ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;"); | ||
411 | ss.WriteLine(); | ||
412 | ss.WriteLine("uninstall-local:"); | ||
413 | ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\"); | ||
414 | ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;"); | ||
415 | ss.WriteLine(); | ||
416 | } | ||
417 | ss.WriteLine("CLEANFILES = $(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".mdb $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".pdb " + project.AssemblyName + ".xml"); | ||
418 | ss.WriteLine("EXTRA_DIST = \\"); | ||
419 | ss.Write(" $(FILES)"); | ||
420 | foreach(ConfigurationNode conf in project.Configurations) | ||
421 | { | ||
422 | if (conf.Options.KeyFile != "") | ||
423 | { | ||
424 | ss.Write(" \\"); | ||
425 | ss.WriteLine("\t" + conf.Options.KeyFile); | ||
426 | } | ||
427 | break; | ||
428 | } | ||
429 | } | ||
430 | m_Kernel.CurrentWorkingDirectory.Pop(); | ||
431 | } | ||
432 | bool hasLibrary = false; | ||
433 | |||
434 | private void WriteCombine(SolutionNode solution) | ||
435 | { | ||
436 | |||
437 | /* TODO: These vars should be pulled from the prebuild.xml file */ | ||
438 | string releaseVersion = "2.0.0"; | ||
439 | string assemblyVersion = "2.1.0.0"; | ||
440 | string description = | ||
441 | "Tao Framework " + solution.Name + " Binding For .NET"; | ||
442 | |||
443 | hasLibrary = false; | ||
444 | m_Kernel.Log.Write("Creating Autotools make files"); | ||
445 | foreach(ProjectNode project in solution.Projects) | ||
446 | { | ||
447 | if(m_Kernel.AllowProject(project.FilterGroups)) | ||
448 | { | ||
449 | m_Kernel.Log.Write("...Creating makefile: {0}", project.Name); | ||
450 | WriteProject(solution, project); | ||
451 | } | ||
452 | } | ||
453 | |||
454 | m_Kernel.Log.Write(""); | ||
455 | string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); | ||
456 | StreamWriter ss = new StreamWriter(combFile); | ||
457 | ss.NewLine = "\n"; | ||
458 | |||
459 | m_Kernel.CurrentWorkingDirectory.Push(); | ||
460 | Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); | ||
461 | |||
462 | using(ss) | ||
463 | { | ||
464 | foreach(ProjectNode project in solution.ProjectsTableOrder) | ||
465 | { | ||
466 | if (project.Type == ProjectType.Library) | ||
467 | { | ||
468 | hasLibrary = true; | ||
469 | break; | ||
470 | } | ||
471 | } | ||
472 | |||
473 | if (hasLibrary) | ||
474 | { | ||
475 | ss.Write("pkgconfig_in_files = "); | ||
476 | foreach(ProjectNode project in solution.ProjectsTableOrder) | ||
477 | { | ||
478 | if (project.Type == ProjectType.Library) | ||
479 | { | ||
480 | string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in"); | ||
481 | ss.Write(" " + project.Name + ".pc.in "); | ||
482 | StreamWriter sspc = new StreamWriter(combFilepc); | ||
483 | sspc.NewLine = "\n"; | ||
484 | using(sspc) | ||
485 | { | ||
486 | sspc.WriteLine("prefix=@prefix@"); | ||
487 | sspc.WriteLine("exec_prefix=${prefix}"); | ||
488 | sspc.WriteLine("libdir=${exec_prefix}/lib"); | ||
489 | sspc.WriteLine(); | ||
490 | sspc.WriteLine("Name: @PACKAGE_NAME@"); | ||
491 | sspc.WriteLine("Description: @DESCRIPTION@"); | ||
492 | sspc.WriteLine("Version: @ASSEMBLY_VERSION@"); | ||
493 | sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll"); | ||
494 | } | ||
495 | } | ||
496 | } | ||
497 | |||
498 | ss.WriteLine(); | ||
499 | ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig"); | ||
500 | ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)"); | ||
501 | } | ||
502 | ss.WriteLine(); | ||
503 | foreach(ProjectNode project in solution.ProjectsTableOrder) | ||
504 | { | ||
505 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | ||
506 | ss.WriteLine("-include x {0}", | ||
507 | Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"),'/')); | ||
508 | } | ||
509 | ss.WriteLine(); | ||
510 | ss.WriteLine("all: \\"); | ||
511 | ss.Write("\t"); | ||
512 | foreach(ProjectNode project in solution.ProjectsTableOrder) | ||
513 | { | ||
514 | string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | ||
515 | ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " "); | ||
516 | |||
517 | } | ||
518 | ss.WriteLine(); | ||
519 | if (hasLibrary) | ||
520 | { | ||
521 | ss.WriteLine("EXTRA_DIST = \\"); | ||
522 | ss.WriteLine("\t$(pkgconfig_in_files)"); | ||
523 | } | ||
524 | else | ||
525 | { | ||
526 | ss.WriteLine("EXTRA_DIST = "); | ||
527 | } | ||
528 | ss.WriteLine(); | ||
529 | ss.WriteLine("DISTCLEANFILES = \\"); | ||
530 | ss.WriteLine("\tconfigure \\"); | ||
531 | ss.WriteLine("\tMakefile.in \\"); | ||
532 | ss.WriteLine("\taclocal.m4"); | ||
533 | } | ||
534 | combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); | ||
535 | StreamWriter ts = new StreamWriter(combFile); | ||
536 | ts.NewLine = "\n"; | ||
537 | using(ts) | ||
538 | { | ||
539 | if (this.hasLibrary) | ||
540 | { | ||
541 | foreach(ProjectNode project in solution.ProjectsTableOrder) | ||
542 | { | ||
543 | if (project.Type == ProjectType.Library) | ||
544 | { | ||
545 | ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)"); | ||
546 | break; | ||
547 | } | ||
548 | } | ||
549 | } | ||
550 | else | ||
551 | { | ||
552 | ts.WriteLine("AC_INIT(Makefile.am)"); | ||
553 | } | ||
554 | ts.WriteLine("AC_PREREQ(2.53)"); | ||
555 | ts.WriteLine("AC_CANONICAL_SYSTEM"); | ||
556 | |||
557 | ts.WriteLine("PACKAGE_NAME={0}", solution.Name); | ||
558 | ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion); | ||
559 | ts.WriteLine("DESCRIPTION=\"{0}\"", description); | ||
560 | ts.WriteLine("AC_SUBST(DESCRIPTION)"); | ||
561 | ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])"); | ||
562 | |||
563 | ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion); | ||
564 | ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)"); | ||
565 | |||
566 | ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`"); | ||
567 | ts.WriteLine("AC_SUBST(PUBKEY)"); | ||
568 | |||
569 | ts.WriteLine(); | ||
570 | ts.WriteLine("AM_MAINTAINER_MODE"); | ||
571 | ts.WriteLine(); | ||
572 | ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])"); | ||
573 | ts.WriteLine(); | ||
574 | ts.WriteLine("AC_PROG_INSTALL"); | ||
575 | ts.WriteLine(); | ||
576 | ts.WriteLine("MONO_REQUIRED_VERSION=1.1"); | ||
577 | ts.WriteLine(); | ||
578 | ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])"); | ||
579 | ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then"); | ||
580 | ts.WriteLine(" from_cvs=yes"); | ||
581 | ts.WriteLine("else"); | ||
582 | ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then"); | ||
583 | ts.WriteLine(" from_cvs=yes"); | ||
584 | ts.WriteLine(" else"); | ||
585 | ts.WriteLine(" from_cvs=no"); | ||
586 | ts.WriteLine(" fi"); | ||
587 | ts.WriteLine("fi"); | ||
588 | ts.WriteLine(); | ||
589 | ts.WriteLine("AC_MSG_RESULT($from_cvs)"); | ||
590 | ts.WriteLine(); | ||
591 | ts.WriteLine("AC_PATH_PROG(MONO, mono)"); | ||
592 | ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)"); | ||
593 | ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)"); | ||
594 | ts.WriteLine(); | ||
595 | ts.WriteLine("AC_MSG_CHECKING([for mono])"); | ||
596 | ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then"); | ||
597 | ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])"); | ||
598 | ts.WriteLine("dnl else"); | ||
599 | ts.WriteLine(" AC_MSG_RESULT([found])"); | ||
600 | ts.WriteLine("dnl fi"); | ||
601 | ts.WriteLine(); | ||
602 | ts.WriteLine("AC_MSG_CHECKING([for gmcs])"); | ||
603 | ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then"); | ||
604 | ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])"); | ||
605 | ts.WriteLine("dnl else"); | ||
606 | ts.WriteLine(" AC_MSG_RESULT([found])"); | ||
607 | ts.WriteLine("dnl fi"); | ||
608 | ts.WriteLine(); | ||
609 | //ts.WriteLine("AC_MSG_CHECKING([for gacutil])"); | ||
610 | //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then"); | ||
611 | //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])"); | ||
612 | //ts.WriteLine("else"); | ||
613 | //ts.WriteLine(" AC_MSG_RESULT([found])"); | ||
614 | //ts.WriteLine("fi"); | ||
615 | ts.WriteLine(); | ||
616 | ts.WriteLine("AC_SUBST(PATH)"); | ||
617 | ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)"); | ||
618 | ts.WriteLine(); | ||
619 | ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\""); | ||
620 | ts.WriteLine("CSFLAGS=\"\""); | ||
621 | ts.WriteLine("AC_SUBST(CSFLAGS)"); | ||
622 | ts.WriteLine(); | ||
623 | // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)"); | ||
624 | // ts.WriteLine("AC_ARG_ENABLE(sdl,"); | ||
625 | // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],"); | ||
626 | // ts.WriteLine(" [disable_sdl=$disableval],"); | ||
627 | // ts.WriteLine(" [disable_sdl=\"no\"])"); | ||
628 | // ts.WriteLine("AC_MSG_RESULT($disable_sdl)"); | ||
629 | // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then"); | ||
630 | // ts.WriteLine(" AC_DEFINE(FEAT_SDL)"); | ||
631 | // ts.WriteLine("fi"); | ||
632 | ts.WriteLine(); | ||
633 | ts.WriteLine("dnl Find pkg-config"); | ||
634 | ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)"); | ||
635 | ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then"); | ||
636 | ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])"); | ||
637 | ts.WriteLine("fi"); | ||
638 | ts.WriteLine(); | ||
639 | ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)"); | ||
640 | ts.WriteLine("BUILD_DIR=\"bin\""); | ||
641 | ts.WriteLine("AC_SUBST(BUILD_DIR)"); | ||
642 | ts.WriteLine("CONFIG=\"Release\""); | ||
643 | ts.WriteLine("AC_SUBST(CONFIG)"); | ||
644 | ts.WriteLine(); | ||
645 | ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then"); | ||
646 | ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)"); | ||
647 | ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)"); | ||
648 | ts.WriteLine(" if test `uname -s` = \"Darwin\"; then"); | ||
649 | ts.WriteLine(" LIB_PREFIX="); | ||
650 | ts.WriteLine(" LIB_SUFFIX=.dylib"); | ||
651 | ts.WriteLine(" else"); | ||
652 | ts.WriteLine(" LIB_PREFIX=.so"); | ||
653 | ts.WriteLine(" LIB_SUFFIX="); | ||
654 | ts.WriteLine(" fi"); | ||
655 | ts.WriteLine("else"); | ||
656 | ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)"); | ||
657 | ts.WriteLine(" if test x$CSC = \"xno\"; then"); | ||
658 | ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])"); | ||
659 | ts.WriteLine(" else"); | ||
660 | ts.WriteLine(" RUNTIME="); | ||
661 | ts.WriteLine(" LIB_PREFIX="); | ||
662 | ts.WriteLine(" LIB_SUFFIX=.dylib"); | ||
663 | ts.WriteLine(" fi"); | ||
664 | ts.WriteLine("fi"); | ||
665 | ts.WriteLine(); | ||
666 | ts.WriteLine("AC_SUBST(LIB_PREFIX)"); | ||
667 | ts.WriteLine("AC_SUBST(LIB_SUFFIX)"); | ||
668 | ts.WriteLine(); | ||
669 | ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)"); | ||
670 | ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)"); | ||
671 | ts.WriteLine(); | ||
672 | ts.WriteLine("dnl Find monodoc"); | ||
673 | ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0"); | ||
674 | ts.WriteLine("AC_SUBST(MONODOC_REQUIRED_VERSION)"); | ||
675 | ts.WriteLine("PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)"); | ||
676 | ts.WriteLine(); | ||
677 | ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then"); | ||
678 | ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)"); | ||
679 | ts.WriteLine(" if test x$MONODOC = xno; then"); | ||
680 | ts.WriteLine(" enable_monodoc=no"); | ||
681 | ts.WriteLine(" fi"); | ||
682 | ts.WriteLine("else"); | ||
683 | ts.WriteLine(" MONODOC="); | ||
684 | ts.WriteLine("fi"); | ||
685 | ts.WriteLine(); | ||
686 | ts.WriteLine("AC_SUBST(MONODOC)"); | ||
687 | ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")"); | ||
688 | ts.WriteLine(); | ||
689 | ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)"); | ||
690 | ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then"); | ||
691 | ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])"); | ||
692 | ts.WriteLine("fi"); | ||
693 | ts.WriteLine(); | ||
694 | // foreach(ProjectNode project in solution.ProjectsTableOrder) | ||
695 | // { | ||
696 | // if (project.Type == ProjectType.Library) | ||
697 | // { | ||
698 | // } | ||
699 | // } | ||
700 | ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'"); | ||
701 | ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)"); | ||
702 | ts.WriteLine(); | ||
703 | ts.WriteLine("winbuild=no"); | ||
704 | ts.WriteLine("case \"$host\" in"); | ||
705 | ts.WriteLine(" *-*-mingw*|*-*-cygwin*)"); | ||
706 | ts.WriteLine(" winbuild=yes"); | ||
707 | ts.WriteLine(" ;;"); | ||
708 | ts.WriteLine("esac"); | ||
709 | ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)"); | ||
710 | ts.WriteLine(); | ||
711 | // ts.WriteLine("dnl Check for SDL"); | ||
712 | // ts.WriteLine(); | ||
713 | // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])"); | ||
714 | // ts.WriteLine("have_sdl=no"); | ||
715 | // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then"); | ||
716 | // ts.WriteLine(" have_sdl=yes"); | ||
717 | // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`"); | ||
718 | // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`"); | ||
719 | // ts.WriteLine(" #"); | ||
720 | // ts.WriteLine(" # sdl-config sometimes emits an rpath flag pointing at its library"); | ||
721 | // ts.WriteLine(" # installation directory. We don't want this, as it prevents users from"); | ||
722 | // ts.WriteLine(" # linking sdl-viewer against, for example, a locally compiled libGL when a"); | ||
723 | // ts.WriteLine(" # version of the library also exists in SDL's library installation"); | ||
724 | // ts.WriteLine(" # directory, typically /usr/lib."); | ||
725 | // ts.WriteLine(" #"); | ||
726 | // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`"); | ||
727 | // ts.WriteLine("fi"); | ||
728 | // ts.WriteLine("AC_SUBST([SDL_CFLAGS])"); | ||
729 | // ts.WriteLine("AC_SUBST([SDL_LIBS])"); | ||
730 | ts.WriteLine(); | ||
731 | ts.WriteLine("AC_OUTPUT(["); | ||
732 | ts.WriteLine("Makefile"); | ||
733 | // TODO: this does not work quite right. | ||
734 | //ts.WriteLine("Properties/AssemblyInfo.cs"); | ||
735 | foreach(ProjectNode project in solution.ProjectsTableOrder) | ||
736 | { | ||
737 | if (project.Type == ProjectType.Library) | ||
738 | { | ||
739 | ts.WriteLine(project.Name + ".pc"); | ||
740 | } | ||
741 | // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); | ||
742 | // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/')); | ||
743 | } | ||
744 | ts.WriteLine("])"); | ||
745 | ts.WriteLine(); | ||
746 | ts.WriteLine("#po/Makefile.in"); | ||
747 | ts.WriteLine(); | ||
748 | ts.WriteLine("echo \"---\""); | ||
749 | ts.WriteLine("echo \"Configuration summary\""); | ||
750 | ts.WriteLine("echo \"\""); | ||
751 | ts.WriteLine("echo \" * Installation prefix: $prefix\""); | ||
752 | ts.WriteLine("echo \" * compiler: $CSC\""); | ||
753 | ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\""); | ||
754 | ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\""); | ||
755 | ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\""); | ||
756 | ts.WriteLine("echo \" * Public Key: $PUBKEY\""); | ||
757 | ts.WriteLine("echo \"\""); | ||
758 | ts.WriteLine("echo \"---\""); | ||
759 | ts.WriteLine(); | ||
760 | } | ||
761 | |||
762 | ts.NewLine = "\n"; | ||
763 | foreach (ProjectNode project in solution.ProjectsTableOrder) | ||
764 | { | ||
765 | if (project.GenerateAssemblyInfoFile) | ||
766 | { | ||
767 | GenerateAssemblyInfoFile(solution, combFile); | ||
768 | } | ||
769 | } | ||
770 | } | ||
771 | |||
772 | private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile) | ||
773 | { | ||
774 | System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties")); | ||
775 | combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in"); | ||
776 | StreamWriter ai = new StreamWriter(combFile); | ||
777 | |||
778 | using (ai) | ||
779 | { | ||
780 | ai.WriteLine("#region License"); | ||
781 | ai.WriteLine("/*"); | ||
782 | ai.WriteLine("MIT License"); | ||
783 | ai.WriteLine("Copyright (c)2003-2006 Tao Framework Team"); | ||
784 | ai.WriteLine("http://www.taoframework.com"); | ||
785 | ai.WriteLine("All rights reserved."); | ||
786 | ai.WriteLine(""); | ||
787 | ai.WriteLine("Permission is hereby granted, free of charge, to any person obtaining a copy"); | ||
788 | ai.WriteLine("of this software and associated documentation files (the \"Software\"), to deal"); | ||
789 | ai.WriteLine("in the Software without restriction, including without limitation the rights"); | ||
790 | ai.WriteLine("to use, copy, modify, merge, publish, distribute, sublicense, and/or sell"); | ||
791 | ai.WriteLine("copies of the Software, and to permit persons to whom the Software is"); | ||
792 | ai.WriteLine("furnished to do so, subject to the following conditions:"); | ||
793 | ai.WriteLine(""); | ||
794 | ai.WriteLine("The above copyright notice and this permission notice shall be included in all"); | ||
795 | ai.WriteLine("copies or substantial portions of the Software."); | ||
796 | ai.WriteLine(""); | ||
797 | ai.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"); | ||
798 | ai.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"); | ||
799 | ai.WriteLine("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE"); | ||
800 | ai.WriteLine("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER"); | ||
801 | ai.WriteLine("LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,"); | ||
802 | ai.WriteLine("OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE"); | ||
803 | ai.WriteLine("SOFTWARE."); | ||
804 | ai.WriteLine("*/"); | ||
805 | ai.WriteLine("#endregion License"); | ||
806 | ai.WriteLine(""); | ||
807 | ai.WriteLine("using System;"); | ||
808 | ai.WriteLine("using System.Reflection;"); | ||
809 | ai.WriteLine("using System.Runtime.InteropServices;"); | ||
810 | ai.WriteLine("using System.Security;"); | ||
811 | ai.WriteLine("using System.Security.Permissions;"); | ||
812 | ai.WriteLine(""); | ||
813 | ai.WriteLine("[assembly: AllowPartiallyTrustedCallers]"); | ||
814 | ai.WriteLine("[assembly: AssemblyCompany(\"Tao Framework -- http://www.taoframework.com\")]"); | ||
815 | ai.WriteLine("[assembly: AssemblyConfiguration(\"Retail\")]"); | ||
816 | ai.WriteLine("[assembly: AssemblyCopyright(\"Copyright (c)2003-2006 Tao Framework Team. All rights reserved.\")]"); | ||
817 | ai.WriteLine("[assembly: AssemblyCulture(\"\")]"); | ||
818 | ai.WriteLine("[assembly: AssemblyDefaultAlias(\"@PACKAGE_NAME@\")]"); | ||
819 | ai.WriteLine("[assembly: AssemblyDelaySign(false)]"); | ||
820 | ai.WriteLine("[assembly: AssemblyDescription(\"@DESCRIPTION@\")]"); | ||
821 | ai.WriteLine("[assembly: AssemblyFileVersion(\"@ASSEMBLY_VERSION@\")]"); | ||
822 | ai.WriteLine("[assembly: AssemblyInformationalVersion(\"@ASSEMBLY_VERSION@\")]"); | ||
823 | ai.WriteLine("[assembly: AssemblyKeyName(\"\")]"); | ||
824 | ai.WriteLine("[assembly: AssemblyProduct(\"@PACKAGE_NAME@.dll\")]"); | ||
825 | ai.WriteLine("[assembly: AssemblyTitle(\"@DESCRIPTION@\")]"); | ||
826 | ai.WriteLine("[assembly: AssemblyTrademark(\"Tao Framework -- http://www.taoframework.com\")]"); | ||
827 | ai.WriteLine("[assembly: AssemblyVersion(\"@ASSEMBLY_VERSION@\")]"); | ||
828 | ai.WriteLine("[assembly: CLSCompliant(true)]"); | ||
829 | ai.WriteLine("[assembly: ComVisible(false)]"); | ||
830 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]"); | ||
831 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)]"); | ||
832 | ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)]"); | ||
833 | |||
834 | } | ||
835 | //return combFile; | ||
836 | } | ||
837 | |||
838 | private void CleanProject(ProjectNode project) | ||
839 | { | ||
840 | m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); | ||
841 | string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); | ||
842 | Helper.DeleteIfExists(projectFile); | ||
843 | } | ||
844 | |||
845 | private void CleanSolution(SolutionNode solution) | ||
846 | { | ||
847 | m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name); | ||
848 | |||
849 | string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); | ||
850 | Helper.DeleteIfExists(slnFile); | ||
851 | |||
852 | slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in"); | ||
853 | Helper.DeleteIfExists(slnFile); | ||
854 | |||
855 | slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); | ||
856 | Helper.DeleteIfExists(slnFile); | ||
857 | |||
858 | slnFile = Helper.MakeFilePath(solution.FullPath, "configure"); | ||
859 | Helper.DeleteIfExists(slnFile); | ||
860 | |||
861 | slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile"); | ||
862 | Helper.DeleteIfExists(slnFile); | ||
863 | |||
864 | foreach(ProjectNode project in solution.Projects) | ||
865 | { | ||
866 | CleanProject(project); | ||
867 | } | ||
868 | |||
869 | m_Kernel.Log.Write(""); | ||
870 | } | ||
871 | |||
872 | #endregion | ||
873 | |||
874 | #region ITarget Members | ||
875 | |||
876 | /// <summary> | ||
877 | /// Writes the specified kern. | ||
878 | /// </summary> | ||
879 | /// <param name="kern">The kern.</param> | ||
880 | public void Write(Kernel kern) | ||
881 | { | ||
882 | if( kern == null ) | ||
883 | { | ||
884 | throw new ArgumentNullException("kern"); | ||
885 | } | ||
886 | m_Kernel = kern; | ||
887 | foreach(SolutionNode solution in kern.Solutions) | ||
888 | { | ||
889 | WriteCombine(solution); | ||
890 | } | ||
891 | m_Kernel = null; | ||
892 | } | ||
893 | |||
894 | /// <summary> | ||
895 | /// Cleans the specified kern. | ||
896 | /// </summary> | ||
897 | /// <param name="kern">The kern.</param> | ||
898 | public virtual void Clean(Kernel kern) | ||
899 | { | ||
900 | if( kern == null ) | ||
901 | { | ||
902 | throw new ArgumentNullException("kern"); | ||
903 | } | ||
904 | m_Kernel = kern; | ||
905 | foreach(SolutionNode sol in kern.Solutions) | ||
906 | { | ||
907 | CleanSolution(sol); | ||
908 | } | ||
909 | m_Kernel = null; | ||
910 | } | ||
911 | |||
912 | /// <summary> | ||
913 | /// Gets the name. | ||
914 | /// </summary> | ||
915 | /// <value>The name.</value> | ||
916 | public string Name | ||
917 | { | ||
918 | get | ||
919 | { | ||
920 | return "autotools"; | ||
921 | } | ||
922 | } | ||
923 | |||
924 | #endregion | ||
925 | } | ||
926 | } | ||