Hi all,
thank you very much for your work on ninja!
I am using an NodeJS module (ninja-build-gen) to write my configure for a browser extension written in Coffeescript. I am using a command line tool called browserify which concatenates js/coffeescript into single files using a module system. Browserify outputs the dependencies of an input file if you give it the --list
flag. I have managed to write a rule that generates the depfile and one that depends on it.
rule copy
command = cp $in $out
rule browserify_deps
command = echo -n '$target: ' > $out && browserify --debug --extension=".coffee" --transform coffeeify $in --list | tr '\n' ' ' >> $out
rule browserify
command = browserify --debug --extension=".coffee" --transform coffeeify $in -o $out
depfile = $out.d
deps = gcc
build build/chrome/js/main.js: browserify build/.temp-chrome/main.coffee || build/chrome/js/main.js.d
build build/chrome/js/main.js.d: browserify_deps build/.temp-chrome/main.coffee | build/.temp-chrome/main.coffee build/.temp-chrome/fillout.coffee
target = build/chrome/js/main.js
build build/.temp-chrome/main.coffee: copy src/chrome/coffee/main.coffee
build build/.temp-chrome/fillout.coffee: copy src/common/coffee/fillout.coffee
But this doesn’t behave as expected. Firstly this seems to re-run build build/chrome/js/main.js.d
on the second invocation of ninja when no files have changed. Secondly when I touch src/common/fillout.coffee
I need to run ninja twice to get build/chrome/js/main.js
to rebuild. What am I doing wrong here?
Full source of what I am working on.
Cheers,
Kaspar
To bring this information into Ninja requires cooperation. On the Ninja side, the depfile attribute on the build must point to a path where this data is written. (Ninja only supports the limited subset of the Makefile syntax emitted by compilers.) Then the command must know to write dependencies into the depfile path.
Kaspar, I think the way that this is intended to work is with a single build/rule set to generate the output file and the depfile at once.
--
You received this message because you are subscribed to the Google Groups "ninja-build" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ninja-build...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thank you very much for taking a look and trying to get to the root of the issue. I will try and re-create a minimal example. In the meantime you could play with the full source here if you can be bothered (all you would need is to do is install npm and then npm install && export PATH=$PATH:$(pwd)/node_modules/.bin
to be able to run the build).
Here is a paste of the build.coffee and the output from invoking ninja. At the end you can see Ninja has to be invoked twice after the touch.
Cheers,
Kaspar
On 10 August 2015 at 08:43, Evan Martin <mar...@danga.com> wrote:
Though it does make the required folders for you (which is really great, because that is a PITA with Make).
Thinking about the speed some more I guess I do benefit from it quite a lot now since I made a ‘watch’ target like this:
rule loop
command = while true; do ninja -v | grep --invert-match 'ninja: no work to do' && echo '[DONE]'; sleep 0.5s; done;
description = calling 'ninja -v' in a loop, press Ctrl-C to stop
pool = console
build watch: loop
Really love that, no need for weird file watchers in the compilers/concatenators and it will copy the static files as well.