Re: Equivalent of recursive make with meson/ninja?



On Sat, 2017-02-11 at 12:31 +0100, Sébastien Wilmet wrote:

Hi Sébastien,


With the Autotools, recursive make is very convenient to re-build
only the stuff present in a sub-directory.

And with builddir == srcdir, it's convenient to do things like:
$ cd src/
$ make
$ touch file-that-i-modified.c
$ make

With meson/ninja, everything will end up in one single build.ninja file
(the equivalent to a Makefile).

You'd just do

 touch foo.c
 ninja

and it will only recompile/relink the bits that have changed, and
nothing else. It will be very very fast in most cases.

You can also do:

  touch foo.c
  ninja -C ../build

if you prefer to be in the source dir.

If you haven't got a full build yet and only want to build a single
target without building more than absolutely needed you can also just
do

  ninja -C ../build src/libfoobar.so.1.2.3

or somesuch (tab completion for targets should just work if you have
the right bits installed), but I'd expect that the normal use case is
that you do a full build and then just rebuild when things change.

You'll also notice that 'ninja' is near-instantaneous if there are no
changes, compared to recursive make which can take tens of seconds to
do nothing in that case. (Just as a data point, why the recursive ninja
thing is not really needed.)


I've tried this command in a project using meson:
```
$ meson .
Error during basic setup:

Source and build directories must not be the same. Create a pristine
build directory.
```

So meson doesn't support builddir == srcdir. This is a no-go for me. 

That is correct, and unlikely to change, as I understand it.

For me it was also a bit annoying/hasslesome at the beginning, but I
got used to it very quickly, and it has many advantages too.


And I suppose meson/ninja doesn't support recursive ninja either (and
anyway recursive ninja with builddir != srcdir would not be
convenient).

Recursive ninja doesn't really make sense the way meson/ninja work, and
it's also not needed for what you want to do. Meson supports 'recursive
meson.build' (which is the both-in-one equivalent of configure.ac +
Makefile.am) though.

Cheers
 -Tim



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]