Permalink
Browse files

fixes #257

  • Loading branch information...
1 parent aff3bdb commit 98d602793f1ee6a881a6d512f4cf95b7a83c6a40 @Araq Araq committed Mar 18, 2013
Showing with 29 additions and 28 deletions.
  1. +28 −27 compiler/extccomp.nim
  2. +1 −1 config/nimrod.cfg
View
55 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)
View
2 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.

0 comments on commit 98d6027

Please sign in to comment.