diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 11e89fee03..c97f92f4e4 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -391,33 +391,6 @@ proc resetCompilationLists* = initLinkedList(externalToCompile) initLinkedList(toLink) -proc footprint(filename: string): TCrc32 = - result = crcFromFile(filename) >< - platform.OS[targetOS].name >< - platform.CPU[targetCPU].name >< - extccomp.CC[extccomp.ccompiler].name - -proc externalFileChanged(filename: string): bool = - var crcFile = toGeneratedFile(filename, "crc") - var currentCrc = int(footprint(filename)) - var f: TFile - if open(f, crcFile, fmRead): - var line = newStringOfCap(40) - if not f.readLine(line): line = "0" - close(f) - var oldCrc = parseInt(line) - result = oldCrc != currentCrc - else: - result = true - if result: - if open(f, crcFile, fmWrite): - f.writeln($currentCrc) - close(f) - -proc addExternalFileToCompile*(filename: string) = - if optForceFullMake in gGlobalOptions or externalFileChanged(filename): - appendStr(externalToCompile, filename) - proc addFileToLink*(filename: string) = prependStr(toLink, filename) # BUGFIX: was ``appendStr`` @@ -536,6 +509,34 @@ proc getCompileCFileCmd*(cfilename: string, isExternal = false): string = "nimrod", quoteIfContainsWhite(getPrefixDir()), "lib", quoteIfContainsWhite(libpath)]) +proc footprint(filename: string): TCrc32 = + result = crcFromFile(filename) >< + platform.OS[targetOS].name >< + platform.CPU[targetCPU].name >< + extccomp.CC[extccomp.ccompiler].name >< + getCompileCFileCmd(filename, true) + +proc externalFileChanged(filename: string): bool = + var crcFile = toGeneratedFile(filename, "crc") + var currentCrc = int(footprint(filename)) + var f: TFile + if open(f, crcFile, fmRead): + var line = newStringOfCap(40) + if not f.readLine(line): line = "0" + close(f) + var oldCrc = parseInt(line) + result = oldCrc != currentCrc + else: + result = true + if result: + if open(f, crcFile, fmWrite): + f.writeln($currentCrc) + close(f) + +proc addExternalFileToCompile*(filename: string) = + if optForceFullMake in gGlobalOptions or externalFileChanged(filename): + appendStr(externalToCompile, filename) + proc CompileCFile(list: TLinkedList, script: var PRope, cmds: var TStringSeq, isExternal: bool) = var it = PStrEntry(list.head) diff --git a/config/nimrod.cfg b/config/nimrod.cfg index 776a1aae23..159cbe1bd1 100644 --- a/config/nimrod.cfg +++ b/config/nimrod.cfg @@ -1,5 +1,5 @@ # Configuration file for the Nimrod Compiler. -# (c) 2012 Andreas Rumpf +# (c) 2013 Andreas Rumpf # Feel free to edit the default values as you need.