summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorPaul Tan <pyokagan@gmail.com>2017-08-18 20:42:16 +0800
committerPaul Tan <pyokagan@gmail.com>2017-08-25 17:45:33 +0800
commit1a50442c13bfc19fe314df0a0fec87dd1b3c5d48 (patch)
treed0577ccbb4c41a498ff3a8332872e2ac13365054 /compiler
parent496716ee9ba659ea33b234a32af5f972cd078aab (diff)
downloadNim-1a50442c13bfc19fe314df0a0fec87dd1b3c5d48.tar.gz
Generate deps file during C compilation
The "genDepend" command was previously taught how to generate a "deps"
file in 4910a87c6 (gendepend improvements; refs #5144). Such a deps file
is useful in integrating the Nim compiler with an external build system
or watch daemon, such that it's possible to only run the Nim compiler
when any of the source files are modified.

It's also useful to generate the deps file in the nimcache directory
during C compilation, without needing to re-run the compilation passes
with "genDepend". This would thus reduce overall project build times.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/main.nim1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/main.nim b/compiler/main.nim
index f662ded1b..76e18a80b 100644
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -77,6 +77,7 @@ proc commandCompileToC(graph: ModuleGraph; cache: IdentCache) =
     let proj = changeFileExt(gProjectFull, "")
     extccomp.callCCompiler(proj)
     extccomp.writeJsonBuildInstructions(proj)
+    writeDepsFile(graph, toGeneratedFile(proj, ""))
 
 proc commandCompileToJS(graph: ModuleGraph; cache: IdentCache) =
   #incl(gGlobalOptions, optSafeCode)