1 | # $Id: if-expr 2023 2008-11-02 05:39:50Z bird $ -*-perl-*-
|
---|
2 | ## @file
|
---|
3 | # $(if-expr expr, if-expand, else-expand)
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (c) 2008 knut st. osmundsen <[email protected]>
|
---|
8 | #
|
---|
9 | # This file is part of kBuild.
|
---|
10 | #
|
---|
11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
12 | # it under the terms of the GNU General Public License as published by
|
---|
13 | # the Free Software Foundation; either version 3 of the License, or
|
---|
14 | # (at your option) any later version.
|
---|
15 | #
|
---|
16 | # kBuild is distributed in the hope that it will be useful,
|
---|
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | # GNU General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with kBuild. If not, see <http://www.gnu.org/licenses/>
|
---|
23 | #
|
---|
24 | #
|
---|
25 |
|
---|
26 | $description = "Tests the \$(if-expr ) function";
|
---|
27 |
|
---|
28 | $details = "A few simple tests, nothing spectacular. More comprehensive testing
|
---|
29 | is preformed by functions/expr and features/ifcond.";
|
---|
30 |
|
---|
31 | if ($is_kmk) {
|
---|
32 |
|
---|
33 | # TEST #0 - check that the feature is present.
|
---|
34 | # --------------------------------------------
|
---|
35 | run_make_test('
|
---|
36 | ifneq ($(if-expr 1+1,1,0),1)
|
---|
37 | $(error sub-test 0 failed)
|
---|
38 | endif
|
---|
39 | .PHONY: all
|
---|
40 | all: ; @:
|
---|
41 | ',
|
---|
42 | '',
|
---|
43 | '');
|
---|
44 |
|
---|
45 | # TEST #1 - basics, the $(expr test checks the rest).
|
---|
46 | # ---------------------------------------------------
|
---|
47 | run_make_test('
|
---|
48 | IF-EXPAND = 7
|
---|
49 | ELSE-EXPAND = -7
|
---|
50 | ifneq ($(if-expr 1==1,$(IF-EXPAND),$(ELSE-EXPAND)),7)
|
---|
51 | $(error sub-test 0 failed)
|
---|
52 | endif
|
---|
53 | ifneq ($(if-expr 1!=1,$(IF-EXPAND),$(ELSE-EXPAND)),-7)
|
---|
54 | $(error sub-test 1 failed)
|
---|
55 | endif
|
---|
56 | .PHONY: all
|
---|
57 | all: ; @:
|
---|
58 | ',
|
---|
59 | '',
|
---|
60 | '');
|
---|
61 |
|
---|
62 | }
|
---|
63 |
|
---|
64 |
|
---|
65 |
|
---|
66 | # Indicate that we're done.
|
---|
67 | 1;
|
---|
68 |
|
---|