// The input file is either a .s or a .bc file BuildTask CreateCompileTask(string assembly_name, string infile_path, Abi abi) { var ext = App.FastDev ? "dylib" : "o"; var ofile = Path.ChangeExtension(infile_path, ext); var install_name = string.Empty; if (App.FastDev) { if (dylibs == null) { dylibs = new List <string> (); } dylibs.Add(ofile); install_name = "lib" + Path.GetFileName(assembly_name) + ".dylib"; } else { Target.LinkWith(ofile); } if (Application.IsUptodate(new string [] { infile_path, Driver.CompilerPath }, new string [] { ofile })) { Driver.Log(3, "Target {0} is up-to-date.", ofile); return(null); } else { Application.TryDelete(ofile); // otherwise the next task might not detect that it will have to rebuild. Driver.Log(3, "Target {0} needs to be rebuilt.", ofile); } var compiler_flags = new CompilerFlags() { Target = Target }; BuildTask bitcode_task = null; BuildTask link_task = null; string link_task_input, link_language = ""; if (App.EnableAsmOnlyBitCode) { link_task_input = infile_path + ".ll"; link_language = ""; // linker_flags.Add (" -fembed-bitcode"); bitcode_task = new BitCodeify() { Input = infile_path, OutputFile = link_task_input, Platform = App.Platform, Abi = abi, DeploymentTarget = App.DeploymentTarget, }; } else { link_task_input = infile_path; if (infile_path.EndsWith(".s")) { link_language = "assembler"; } } if (App.FastDev) { compiler_flags.AddFrameworks(Frameworks, WeakFrameworks); compiler_flags.AddLinkWith(LinkWith, ForceLoad); compiler_flags.LinkWithMono(); compiler_flags.LinkWithXamarin(); compiler_flags.AddOtherFlags(LinkerFlags); if (Target.GetEntryPoints().ContainsKey("UIApplicationMain")) { compiler_flags.AddFramework("UIKit"); } } link_task = new LinkTask() { Target = Target, AssemblyName = assembly_name, Abi = abi, InputFile = link_task_input, OutputFile = ofile, InstallName = install_name, CompilerFlags = compiler_flags, SharedLibrary = App.FastDev, Language = link_language, }; if (bitcode_task != null) { bitcode_task.NextTasks = new BuildTask[] { link_task }; return(bitcode_task); } return(link_task); }
// The input file is either a .s or a .bc file BuildTask CreateCompileTask(string assembly_name, string infile_path, Abi abi) { var ext = App.FastDev ? "dylib" : "o"; var ofile = Path.ChangeExtension (infile_path, ext); var install_name = string.Empty; if (App.FastDev) { if (dylibs == null) dylibs = new List<string> (); dylibs.Add (ofile); install_name = "lib" + Path.GetFileName (assembly_name) + ".dylib"; } else { Target.LinkWith (ofile); } if (Application.IsUptodate (new string [] { infile_path, Driver.CompilerPath }, new string [] { ofile })) { Driver.Log (3, "Target {0} is up-to-date.", ofile); return null; } else { Application.TryDelete (ofile); // otherwise the next task might not detect that it will have to rebuild. Driver.Log (3, "Target {0} needs to be rebuilt.", ofile); } var compiler_flags = new CompilerFlags () { Target = Target }; BuildTask bitcode_task = null; BuildTask link_task = null; string link_task_input, link_language = ""; if (App.EnableAsmOnlyBitCode) { link_task_input = infile_path + ".ll"; link_language = ""; // linker_flags.Add (" -fembed-bitcode"); bitcode_task = new BitCodeify () { Input = infile_path, OutputFile = link_task_input, Platform = App.Platform, Abi = abi, DeploymentTarget = App.DeploymentTarget, }; } else { link_task_input = infile_path; if (infile_path.EndsWith (".s")) link_language = "assembler"; } if (App.FastDev) { compiler_flags.AddFrameworks (Frameworks, WeakFrameworks); compiler_flags.AddLinkWith (LinkWith, ForceLoad); compiler_flags.LinkWithMono (); compiler_flags.LinkWithXamarin (); compiler_flags.AddOtherFlags (LinkerFlags); if (Target.GetEntryPoints ().ContainsKey ("UIApplicationMain")) compiler_flags.AddFramework ("UIKit"); } link_task = new LinkTask () { Target = Target, AssemblyName = assembly_name, Abi = abi, InputFile = link_task_input, OutputFile = ofile, InstallName = install_name, CompilerFlags = compiler_flags, SharedLibrary = App.FastDev, Language = link_language, }; if (bitcode_task != null) { bitcode_task.NextTasks = new BuildTask[] { link_task }; return bitcode_task; } return link_task; }