On Wed, Sep 7, 2016 at 7:23 AM, David Corvoysier
<
david.co...@gmail.com> wrote:
> I had actually tried generating the build.ninja from my Makefile fragments,
> but for the biggest trees I was stuck with the infamous 'Argument list too
> long' error.
>
> I fixed it today using a response file and updated the benchmark: this
> improves cold start and rebuild quite a lot.
I'm surprised you're encountering this problem on non-Windows. Can
you pastebin your generated build.ninja file somewhere?
> The build.ninja generation seems to be now the bottleneck: Make is
> definitely not the best tool for parsing a tree and generating a file.
One assumption of Ninja (which comes from my experience) is that you
edit source code frequently, but you add or move files infrequently.
In the former case you don't need to regenerate the build.ninja file,
only in the latter, so a slow step to generate build.ninja isn't such
a bad problem.
> I could give python a try, or maybe replace my Makefile fragments by Ninja
> fragments using include or subninja (that's what I did for the CMake
> solution).
>
> The whole point however is to keep these fragments simple: I don't know if I
> can easily simplify the object/subdirs syntax using simple variable
> substitutions based on a set of predefined rules.
I agree that it's convenient to express your build in some
higher-level simple language.
One way to look at Ninja is that you pay for the evaluation of that
higher-level langauge (your fragments) into a concrete build graph
once, at the time you generate the build.ninja, and then subsequent
builds get to reuse that output quickly. So I think your current
design (complex program generates simple build.ninja) matches how I
intended Ninja to be used. Ninja isn't really designed to support
tricky layouts using includes or variable substitutions, though
sometimes they are possible.