VirtualBox

source: kBuild/trunk/src/gmake/tests/scripts/features/conditionals@ 154

Last change on this file since 154 was 154, checked in by bird, 21 years ago

This commit was generated by cvs2svn to compensate for changes in r153,
which included commits to RCS files with non-trunk default branches.

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1# -*-perl-*-
2$description = "Check GNU make conditionals.";
3
4$details = "Attempt various different flavors of GNU make conditionals.";
5
6open(MAKEFILE,"> $makefile");
7
8# The Contents of the MAKEFILE ...
9
10print MAKEFILE <<'EOMAKE';
11objects = foo.obj
12arg1 = first
13arg2 = second
14arg3 = third
15arg4 = cc
16arg5 = second
17
18all:
19ifeq ($(arg1),$(arg2))
20 @echo arg1 equals arg2
21else
22 @echo arg1 NOT equal arg2
23endif
24
25ifeq '$(arg2)' "$(arg5)"
26 @echo arg2 equals arg5
27else
28 @echo arg2 NOT equal arg5
29endif
30
31ifneq '$(arg3)' '$(arg4)'
32 @echo arg3 NOT equal arg4
33else
34 @echo arg3 equal arg4
35endif
36
37ifndef undefined
38 @echo variable is undefined
39else
40 @echo variable undefined is defined
41endif
42ifdef arg4
43 @echo arg4 is defined
44else
45 @echo arg4 is NOT defined
46endif
47
48EOMAKE
49
50close(MAKEFILE);
51
52&run_make_with_options($makefile,"",&get_logfile,0);
53
54$answer = "arg1 NOT equal arg2
55arg2 equals arg5
56arg3 NOT equal arg4
57variable is undefined
58arg4 is defined
59";
60
61&compare_output($answer,&get_logfile(1));
62
63
64# Test expansion of variables inside ifdef.
65
66$makefile2 = &get_tmpfile;
67
68open(MAKEFILE, "> $makefile2");
69
70print MAKEFILE <<'EOF';
71
72foo = 1
73
74FOO = foo
75F = f
76
77DEF = no
78DEF2 = no
79
80ifdef $(FOO)
81DEF = yes
82endif
83
84ifdef $(F)oo
85DEF2 = yes
86endif
87
88
89DEF3 = no
90FUNC = $1
91ifdef $(call FUNC,DEF)3
92 DEF3 = yes
93endif
94
95all:; @echo DEF=$(DEF) DEF2=$(DEF2) DEF3=$(DEF3)
96
97EOF
98
99close(MAKEFILE)
100
101&run_make_with_options($makefile2,"",&get_logfile,0);
102$answer = "DEF=yes DEF2=yes DEF3=yes\n";
103&compare_output($answer,&get_logfile(1));
104
105
106# This tells the test driver that the perl test script executed properly.
1071;
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette