| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: directive-ifmake.mk,v 1.3 2020/08/29 19:07:32 rillig Exp $ | | 1 | # $NetBSD: directive-ifmake.mk,v 1.4 2020/08/30 14:25:45 rillig Exp $ |
2 | # | | 2 | # |
3 | # Tests for the .ifmake directive, which provides a shortcut for asking | | 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. | | 4 | # whether a certain target is requested to be made from the command line. |
5 | | | 5 | |
6 | # This is the most basic form. | | 6 | # This is the most basic form. |
7 | .ifmake first | | 7 | .ifmake first |
8 | .info ok: positive condition works | | 8 | .info ok: positive condition works |
9 | .else | | 9 | .else |
10 | .warning positive condition fails | | 10 | .warning positive condition fails |
11 | .endif | | 11 | .endif |
12 | | | 12 | |
13 | # The not operator works as expected. | | 13 | # The not operator works as expected. |
14 | # An alternative interpretation were that this condition is asking whether | | 14 | # An alternative interpretation were that this condition is asking whether |
| @@ -31,15 +31,25 @@ | | | @@ -31,15 +31,25 @@ |
31 | .ifmake first && second | | 31 | .ifmake first && second |
32 | .info ok: both mentioned | | 32 | .info ok: both mentioned |
33 | .else | | 33 | .else |
34 | .warning && does not work as expected | | 34 | .warning && does not work as expected |
35 | .endif | | 35 | .endif |
36 | | | 36 | |
37 | # Negation also works in complex conditions. | | 37 | # Negation also works in complex conditions. |
38 | .ifmake first && !unmentioned | | 38 | .ifmake first && !unmentioned |
39 | .info ok: only those mentioned | | 39 | .info ok: only those mentioned |
40 | .else | | 40 | .else |
41 | .warning && with ! does not work as expected | | 41 | .warning && with ! does not work as expected |
42 | .endif | | 42 | .endif |
43 | | | 43 | |
44 | first second unmentioned: | | 44 | # Using the .MAKEFLAGS special dependency target, arbitrary command |
| | | 45 | # line options can be added at parse time. This means that it is |
| | | 46 | # possible to extend the targets to be made. |
| | | 47 | .MAKEFLAGS: late-target |
| | | 48 | .ifmake late-target |
| | | 49 | .info Targets can even be added at parse time. |
| | | 50 | .else |
| | | 51 | .info No, targets cannot be added at parse time anymore. |
| | | 52 | .endif |
| | | 53 | |
| | | 54 | first second unmentioned late-target: |
45 | : $@ | | 55 | : $@ |