fixes serious regression that was introduced in the handling of .compile pragma

This commit is contained in:
Araq 2017-01-28 20:37:23 +01:00
commit 0c49ee25a9
2 changed files with 12 additions and 10 deletions

View file

@ -658,16 +658,16 @@ proc externalFileChanged(cfile: Cfile): bool =
f.writeLine($currentHash) f.writeLine($currentHash)
close(f) close(f)
proc addExternalFileToCompile*(filename: string) = proc addExternalFileToCompile*(c: var Cfile) =
let c = Cfile(cname: filename, if optForceFullMake notin gGlobalOptions and not externalFileChanged(c):
obj: toObjFile(completeCFilePath(changeFileExt(filename, ""), false)), c.flags.incl CfileFlag.Cached
flags: {CfileFlag.External})
if optForceFullMake in gGlobalOptions or externalFileChanged(c):
toCompile.add(c) toCompile.add(c)
proc addExternalFileToCompile*(c: Cfile) = proc addExternalFileToCompile*(filename: string) =
if optForceFullMake in gGlobalOptions or externalFileChanged(c): var c = Cfile(cname: filename,
toCompile.add(c) obj: toObjFile(completeCFilePath(changeFileExt(filename, ""), false)),
flags: {CfileFlag.External})
addExternalFileToCompile(c)
proc compileCFile(list: CFileList, script: var Rope, cmds: var TStringSeq, proc compileCFile(list: CFileList, script: var Rope, cmds: var TStringSeq,
prettyCmds: var TStringSeq) = prettyCmds: var TStringSeq) =
@ -782,7 +782,7 @@ proc callCCompiler*(projectfile: string) =
it = PStrEntry(it.next) it = PStrEntry(it.next)
for x in toCompile: for x in toCompile:
add(objfiles, ' ') add(objfiles, ' ')
add(objfiles, quoteShell(x.obj)) add(objfiles, x.obj)
linkCmd = getLinkCmd(projectfile, objfiles) linkCmd = getLinkCmd(projectfile, objfiles)
if optCompileOnly notin gGlobalOptions: if optCompileOnly notin gGlobalOptions:

View file

@ -419,8 +419,10 @@ proc processCompile(c: PContext, n: PNode) =
var found = parentDir(n.info.toFullPath) / s var found = parentDir(n.info.toFullPath) / s
for f in os.walkFiles(found): for f in os.walkFiles(found):
let nameOnly = extractFilename(f) let nameOnly = extractFilename(f)
extccomp.addExternalFileToCompile(Cfile(cname: f, var cf = Cfile(cname: f,
obj: dest % nameOnly, flags: {CfileFlag.External})) obj: completeCFilePath(dest % nameOnly),
flags: {CfileFlag.External})
extccomp.addExternalFileToCompile(cf)
else: else:
let s = expectStrLit(c, n) let s = expectStrLit(c, n)
var found = parentDir(n.info.toFullPath) / s var found = parentDir(n.info.toFullPath) / s