1 # $NetBSD: directive-ifmake.mk,v 1.8 2020/11/15 20:20:58 rillig Exp $
3 # Tests for the .ifmake directive, which provides a shortcut for asking
4 # whether a certain target is requested to be made from the command line.
6 # TODO: Describe why the shortcut may be useful (if it's useful at all),
7 # instead of sticking to the simple '.if' only.
9 # The targets 'first' and 'second' are passed in on the command line.
11 # This is the most basic form.
13 . info ok: positive condition works
15 . warning positive condition fails
18 # The not operator works as expected.
19 # An alternative interpretation were that this condition is asking whether
20 # the target "!first" was requested. To distinguish this, see the next test.
24 . info ok: negation works
27 # See if the exclamation mark really means "not", or if it is just part of
28 # the target name. Since it means 'not', the two exclamation marks are
29 # effectively ignored, and 'first' is indeed a requested target. If the
30 # exclamation mark were part of the name instead, the name would be '!!first',
31 # and such a target was not requested to be made.
33 . info ok: double negation works
35 . warning double negation fails
38 # Multiple targets can be combined using the && and || operators.
39 .ifmake first && second
40 . info ok: both mentioned
42 . warning && does not work as expected
45 # Negation also works in complex conditions.
46 .ifmake first && !unmentioned
47 . info ok: only those mentioned
49 . warning && with ! does not work as expected
52 # Using the .MAKEFLAGS special dependency target, arbitrary command
53 # line options can be added at parse time. This means that it is
54 # possible to extend the targets to be made.
55 .MAKEFLAGS: late-target
57 . info Targets can even be added at parse time.
59 . info No, targets cannot be added at parse time anymore.
62 # Numbers are interpreted as numbers, no matter whether the directive is
63 # a plain .if or an .ifmake.
72 # A condition that consists of a variable expression only (without any
73 # comparison operator) can be used with .if and the other .ifxxx directives.
81 first second unmentioned late-target: