1 | # $Id: must_make 2413 2010-09-11 17:43:04Z bird $ -*-perl-*-
|
---|
2 | ## @file
|
---|
3 | # .MUST_MAKE target variable.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (c) 2008-2010 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 .MUST_MAKE target variable";
|
---|
27 |
|
---|
28 | $details = "The .MUST_MAKE target variable is expanded when make is deciding
|
---|
29 | whether a file needs to be made or not. If it returns a non-empty string,
|
---|
30 | when stripped, it will force the file to be made. If it returns an empty
|
---|
31 | string GNU make decides the normal way. Note that .MUST_MAKE does NOT have
|
---|
32 | to be expanded if make already knows the file needs building. Also, note
|
---|
33 | that for multi target rules it may be invoked for each file.";
|
---|
34 |
|
---|
35 | if ($is_kmk) {
|
---|
36 |
|
---|
37 | # TEST #0 - check to see that it gets called and is made.
|
---|
38 | # -------------------------------------------------------
|
---|
39 | &touch('foobar.1');
|
---|
40 | run_make_test('
|
---|
41 |
|
---|
42 | foobar.1: .MUST_MAKE = $(info mustmake:{@=$@,<=$<})FORCE
|
---|
43 | foobar.1: ;touch $@
|
---|
44 | ',
|
---|
45 | '',
|
---|
46 | 'mustmake:{@=foobar.1,<=}
|
---|
47 | touch foobar.1'
|
---|
48 | );
|
---|
49 | unlink('foobar.1');
|
---|
50 |
|
---|
51 | # TEST #1 - check to see that it gets called and isn't made.
|
---|
52 | # ----------------------------------------------------------
|
---|
53 | &touch('foobar.1');
|
---|
54 | run_make_test('
|
---|
55 |
|
---|
56 | foobar.1: .MUST_MAKE = $(info mustmake:{@=$@,<=$<})
|
---|
57 | foobar.1: ;touch $@
|
---|
58 | ',
|
---|
59 | '',
|
---|
60 | 'mustmake:{@=foobar.1,<=}
|
---|
61 | #MAKE#: `foobar.1\' is up to date.'
|
---|
62 | );
|
---|
63 | unlink('foobar.1');
|
---|
64 |
|
---|
65 | # TEST #2 - check to see that it doesn't get called unnecessary.
|
---|
66 | # --------------------------------------------------------------
|
---|
67 | run_make_test('
|
---|
68 | foobar.1: .MUST_MAKE = $(info mustmake:{@=$@,<=$})FORCE
|
---|
69 | foobar.1: ;@echo making $@
|
---|
70 | ',
|
---|
71 | '',
|
---|
72 | 'making foobar.1');
|
---|
73 |
|
---|
74 | }
|
---|
75 |
|
---|
76 |
|
---|
77 |
|
---|
78 | # Indicate that we're done.
|
---|
79 | 1;
|
---|
80 |
|
---|
81 |
|
---|