This commit is contained in:
Araq 2013-03-18 01:41:09 +01:00
commit 8281bd9f0f
2 changed files with 29 additions and 28 deletions

View file

@ -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)