Add support for broken SA_RESTART on PTX.
[make/kirr.git] / tests / scripts / features / conditionals
blobab3d9d5aa962f780827eb78f729d223e55bdd989
1 #                                                                    -*-perl-*-
2 $description = "Check GNU make conditionals.";
4 $details = "Attempt various different flavors of GNU make conditionals.";
6 open(MAKEFILE,"> $makefile");
8 # The Contents of the MAKEFILE ...
10 print MAKEFILE <<'EOMAKE';
11 objects = foo.obj
12 arg1 = first
13 arg2 = second
14 arg3 = third
15 arg4 = cc
16 arg5 = second
18 all:
19 ifeq ($(arg1),$(arg2))
20         @echo arg1 equals arg2
21 else
22         @echo arg1 NOT equal arg2
23 endif
25 ifeq '$(arg2)' "$(arg5)"
26         @echo arg2 equals arg5
27 else
28         @echo arg2 NOT equal arg5
29 endif
31 ifneq '$(arg3)' '$(arg4)'
32         @echo arg3 NOT equal arg4
33 else
34         @echo arg3 equal arg4
35 endif
37 ifndef undefined
38         @echo variable is undefined
39 else
40         @echo variable undefined is defined
41 endif
42 ifdef arg4
43         @echo arg4 is defined
44 else
45         @echo arg4 is NOT defined
46 endif
48 EOMAKE
50 close(MAKEFILE);
52 &run_make_with_options($makefile,"",&get_logfile,0);
54 # Create the answer to what should be produced by this Makefile
55 $answer = "arg1 NOT equal arg2
56 arg2 equals arg5
57 arg3 NOT equal arg4
58 variable is undefined
59 arg4 is defined
62 # COMPARE RESULTS
64 &compare_output($answer,&get_logfile(1));
67 # Test expansion of variables inside ifdef.
69 $makefile2 = &get_tmpfile;
71 open(MAKEFILE, "> $makefile2");
73 print MAKEFILE <<'EOF';
75 foo = 1
77 FOO = foo
78 F = f
80 DEF = no
81 DEF2 = no
83 ifdef $(FOO)
84 DEF = yes
85 endif
87 ifdef $(F)oo
88 DEF2 = yes
89 endif
91 all:; @echo DEF=$(DEF) DEF2=$(DEF2)
93 EOF
95 &run_make_with_options($makefile2,"",&get_logfile,0);
96 $answer = "DEF=yes DEF2=yes\n";
97 &compare_output($answer,&get_logfile(1));
100 # This tells the test driver that the perl test script executed properly.