diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-09-23 14:18:21 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-10-02 00:48:12 +0530 |
commit | 9d1aeebc27c5077ede5f47463e66f184529c03f0 (patch) | |
tree | 38963a79e5aa2308df9c28fcb0b4761ed10cb611 /mesonbuild/backend/ninjabackend.py | |
parent | e713aca1d13116a1b951925f5e7d86532a0ed305 (diff) | |
download | meson-9d1aeebc27c5077ede5f47463e66f184529c03f0.zip meson-9d1aeebc27c5077ede5f47463e66f184529c03f0.tar.gz meson-9d1aeebc27c5077ede5f47463e66f184529c03f0.tar.bz2 |
ninja: Don't add every CustomTarget to 'all'
Otherwise they are built regardless of whether they are actually used by
anything else. Only build them if they're going to be installed or
always-built.
Ideally, we should also do this with all BuildTargets, and provide
a mechanism for people to specify which targets they want built with
'all', and a way for people to add them to custom targets.. Without
this, things like tests and examples are *always* built with no way to
turn that off.
For now, we just do this because it also with tests that check for
dependency issues. Including all CustomTargets in `all` results in
dangling targets to also be built, which hides the problem and makes it
racy.
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index b54fc75..930d37f 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1920,8 +1920,16 @@ rule FORTRAN_DEP_HACK elem.write(outfile) def generate_ending(self, outfile): - targetlist = [self.get_target_filename(t) for t in self.build.get_targets().values()\ - if not isinstance(t, build.RunTarget)] + targetlist = [] + for t in self.build.get_targets().values(): + # RunTargets are meant to be invoked manually + if isinstance(t, build.RunTarget): + continue + # CustomTargets that aren't installed should only be built if they + # are used by something else or are meant to be always built + if isinstance(t, build.CustomTarget) and not (t.install or t.build_always): + continue + targetlist.append(self.get_target_filename(t)) elem = NinjaBuildElement(self.all_outputs, 'all', 'phony', targetlist) elem.write(outfile) |