Last change
on this file since 281 was 281, checked in by bird, 20 years ago |
This commit was generated by cvs2svn to compensate for changes in r280,
which included commits to RCS files with non-trunk default branches.
|
-
Property svn:eol-style
set to
native
|
File size:
2.3 KB
|
Line | |
---|
1 | # -*-perl-*-
|
---|
2 | $description = "Check GNU make conditionals.";
|
---|
3 |
|
---|
4 | $details = "Attempt various different flavors of GNU make conditionals.";
|
---|
5 |
|
---|
6 | run_make_test('
|
---|
7 | arg1 = first
|
---|
8 | arg2 = second
|
---|
9 | arg3 = third
|
---|
10 | arg4 = cc
|
---|
11 | arg5 = second
|
---|
12 |
|
---|
13 | all:
|
---|
14 | ifeq ($(arg1),$(arg2))
|
---|
15 | @echo arg1 equals arg2
|
---|
16 | else
|
---|
17 | @echo arg1 NOT equal arg2
|
---|
18 | endif
|
---|
19 |
|
---|
20 | ifeq \'$(arg2)\' "$(arg5)"
|
---|
21 | @echo arg2 equals arg5
|
---|
22 | else
|
---|
23 | @echo arg2 NOT equal arg5
|
---|
24 | endif
|
---|
25 |
|
---|
26 | ifneq \'$(arg3)\' \'$(arg4)\'
|
---|
27 | @echo arg3 NOT equal arg4
|
---|
28 | else
|
---|
29 | @echo arg3 equal arg4
|
---|
30 | endif
|
---|
31 |
|
---|
32 | ifndef undefined
|
---|
33 | @echo variable is undefined
|
---|
34 | else
|
---|
35 | @echo variable undefined is defined
|
---|
36 | endif
|
---|
37 | ifdef arg4
|
---|
38 | @echo arg4 is defined
|
---|
39 | else
|
---|
40 | @echo arg4 is NOT defined
|
---|
41 | endif',
|
---|
42 | '',
|
---|
43 | 'arg1 NOT equal arg2
|
---|
44 | arg2 equals arg5
|
---|
45 | arg3 NOT equal arg4
|
---|
46 | variable is undefined
|
---|
47 | arg4 is defined');
|
---|
48 |
|
---|
49 |
|
---|
50 | # Test expansion of variables inside ifdef.
|
---|
51 |
|
---|
52 | run_make_test('
|
---|
53 | foo = 1
|
---|
54 |
|
---|
55 | FOO = foo
|
---|
56 | F = f
|
---|
57 |
|
---|
58 | DEF = no
|
---|
59 | DEF2 = no
|
---|
60 |
|
---|
61 | ifdef $(FOO)
|
---|
62 | DEF = yes
|
---|
63 | endif
|
---|
64 |
|
---|
65 | ifdef $(F)oo
|
---|
66 | DEF2 = yes
|
---|
67 | endif
|
---|
68 |
|
---|
69 |
|
---|
70 | DEF3 = no
|
---|
71 | FUNC = $1
|
---|
72 | ifdef $(call FUNC,DEF)3
|
---|
73 | DEF3 = yes
|
---|
74 | endif
|
---|
75 |
|
---|
76 | all:; @echo DEF=$(DEF) DEF2=$(DEF2) DEF3=$(DEF3)',
|
---|
77 | '',
|
---|
78 | 'DEF=yes DEF2=yes DEF3=yes');
|
---|
79 |
|
---|
80 |
|
---|
81 | # Test all the different "else if..." constructs
|
---|
82 |
|
---|
83 | run_make_test('
|
---|
84 | arg1 = first
|
---|
85 | arg2 = second
|
---|
86 | arg3 = third
|
---|
87 | arg4 = cc
|
---|
88 | arg5 = fifth
|
---|
89 |
|
---|
90 | result =
|
---|
91 |
|
---|
92 | ifeq ($(arg1),$(arg2))
|
---|
93 | result += arg1 equals arg2
|
---|
94 | else ifeq \'$(arg2)\' "$(arg5)"
|
---|
95 | result += arg2 equals arg5
|
---|
96 | else ifneq \'$(arg3)\' \'$(arg3)\'
|
---|
97 | result += arg3 NOT equal arg4
|
---|
98 | else ifndef arg5
|
---|
99 | result += variable is undefined
|
---|
100 | else ifdef undefined
|
---|
101 | result += arg4 is defined
|
---|
102 | else
|
---|
103 | result += success
|
---|
104 | endif
|
---|
105 |
|
---|
106 |
|
---|
107 | all: ; @echo $(result)',
|
---|
108 | '',
|
---|
109 | 'success');
|
---|
110 |
|
---|
111 |
|
---|
112 | # Test some random "else if..." construct nesting
|
---|
113 |
|
---|
114 | run_make_test('
|
---|
115 | arg1 = first
|
---|
116 | arg2 = second
|
---|
117 | arg3 = third
|
---|
118 | arg4 = cc
|
---|
119 | arg5 = second
|
---|
120 |
|
---|
121 | ifeq ($(arg1),$(arg2))
|
---|
122 | $(info failed 1)
|
---|
123 | else ifeq \'$(arg2)\' "$(arg2)"
|
---|
124 | ifdef undefined
|
---|
125 | $(info failed 2)
|
---|
126 | else
|
---|
127 | $(info success)
|
---|
128 | endif
|
---|
129 | else ifneq \'$(arg3)\' \'$(arg3)\'
|
---|
130 | $(info failed 3)
|
---|
131 | else ifdef arg5
|
---|
132 | $(info failed 4)
|
---|
133 | else ifdef undefined
|
---|
134 | $(info failed 5)
|
---|
135 | else
|
---|
136 | $(info failed 6)
|
---|
137 | endif
|
---|
138 |
|
---|
139 | .PHONY: all
|
---|
140 | all: ; @:',
|
---|
141 | '',
|
---|
142 | 'success');
|
---|
143 |
|
---|
144 |
|
---|
145 | # This tells the test driver that the perl test script executed properly.
|
---|
146 | 1;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.