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.
To view this discussion on the web visit https://groups.google.com/d/msgid/ninja-build/CABiGVV9-ez4NopZdhS9iOkyR2cHO51eyJztb41syYZo7m3mG0w%40mail.gmail.com.
At Google we have quite a number of scripts that generate Ninja depfiles. These have proven difficult for a few reasons.Background: Sometimes you don't know what inputs a build step depends on until you run it. A typical example is C/C++ includes. But we have a lot of scripts that do similar things. Ninja supports two formats: gcc and msvc. But both formats are crufty:
- For GCC format, the output is actually a makefile. Makefile escaping is slightly insane and it also requires that you declare the output file (technically unnecessary from Ninja's perspective) which must match exactly the output of the build step. This is surprisingly difficult and confusing, especially when there are multiple output files (which Make can't express).
- The MSVC format has a line prefix that's actually localized (!) which makes dealing with it difficult.
Long ago I wrote a patch (currently out-of-date I'm sure) to add a new "deps = list" format which is one-literal-file-name-per-line with no escaping, no prefixes, and no output file requirements. This is very easy to generate from a script. Unfortunately, the pull for this patch went nowhere.
This keeps popping up for our projects and I would like to see if there is enough interest in this to get this patch working again.Thanks!Brett
Long ago I wrote a patch (currently out-of-date I'm sure) to add a new "deps = list" format which is one-literal-file-name-per-line with no escaping, no prefixes, and no output file requirements. This is very easy to generate from a script. Unfortunately, the pull for this patch went nowhere.I don't see how this meaningfully improves on deps=msvc. Isn't it basically the same, just with an extra file to deal with (and an extra path to coordinate between the tool and build.ninja), rather than using stdout which is already hooked up everywhere?
That said, one thing I've found slightly annoying is that it only covers *inputs*. Some tools also have dynamically discovered outputs, but neither deps=msvc nor deps=gcc has a way to support runtime-discovered outputs. There is now the dyndeps system, but it only supports preflight processing, so it is cumbersome for usecases where it could just be done as part of running the tool, and sometimes requires duplicating work between the task and dyndeps discovery, wasting precious cycles during the build. Makefile syntax at least has a way to express it, even if ninja isn't able to use it. I suppose deps=msvc could allow something like "msvc_deps_output_prefix=writing file:" as a simple way to communicate both inputs and outputs.