예제 #1
0
파일: GCC.cs 프로젝트: xobs/cctask
        public bool Compile(string source, string output, string flags, Func <IEnumerable <string>, string, bool> sourceHasChanged)
        {
            // let's get all dependencies
            string gccOutput;
            var    mmargs = string.Format("{1} -MM \"{0}\"", source, flags);

                        #if DEBUG
            Logger.Instance.LogMessage("MM: {0} ({1})", Path.GetFileName(source), mmargs);
                        #endif
            if (!Utilities.RunAndGetOutput(pathToGcc, mmargs, out gccOutput))
            {
                Logger.Instance.LogError(gccOutput);
                return(false);
            }
            var dependencies = ParseGccMmOutput(gccOutput).Union(new [] { source });
            if (!sourceHasChanged(dependencies, flags) && File.Exists(output))
            {
                return(true);
            }

            Directory.CreateDirectory(Path.GetDirectoryName(output));

            var ccargs = string.Format("\"{0}\" {2} -c -o \"{1}\"", source, output, flags);
            Logger.Instance.LogMessage("CC: {0}", Path.GetFileName(source));
                        #if DEBUG
            Logger.Instance.LogMessage("output: {0} flags: {1}", output, ccargs);
                        #endif

            var runWrapper = new RunWrapper(pathToGcc, ccargs);
            return(runWrapper.Run());
        }
예제 #2
0
 public bool Link(IEnumerable<string> objectFiles, string outputFile, string flags)
 {
     var linkerArguments = string.Format("{0} {2} -o \"{1}\"", objectFiles.Select(x => "\"" + x + "\"").Aggregate((x, y) => x + " " + y), outputFile, flags);
     var runWrapper = new RunWrapper(pathToLd, linkerArguments);
     Logger.Instance.LogMessage("LD: {0}", Path.GetFileName(outputFile));
     #if DEBUG
     Logger.Instance.LogMessage(linkerArguments);
     #endif
     return runWrapper.Run();
 }
예제 #3
0
파일: GLD.cs 프로젝트: xobs/cctask
        public bool Link(IEnumerable <string> objectFiles, string outputFile, string flags)
        {
            var linkerArguments = string.Format("{0} {2} -o \"{1}\"", objectFiles.Select(x => "\"" + x + "\"").Aggregate((x, y) => x + " " + y), outputFile, flags);
            var runWrapper      = new RunWrapper(pathToLd, linkerArguments);

            Logger.Instance.LogMessage("LD: {0}", Path.GetFileName(outputFile));
                        #if DEBUG
            Logger.Instance.LogMessage(linkerArguments);
                        #endif
            return(runWrapper.Run());
        }