- Enhance .POSIX to set -e when invoking shells, as demanded by a
[make.git] / tests / scripts / functions / sort
blobd472102d265dce32af5c07d8bc78d7bc80616862
1 $description = "The following test creates a makefile to verify\n"
2               ."the ability of make to sort lists of object. Sort\n"
3               ."will also remove any duplicate entries. This will also\n"
4               ."be tested.";
6 $details = "The make file is built with a list of object in a random order\n"
7           ."and includes some duplicates. Make should sort all of the elements\n"
8           ."remove all duplicates\n";
10 open(MAKEFILE,"> $makefile");
12 # The Contents of the MAKEFILE ...
14 print MAKEFILE "foo := moon_light days \n"
15               ."foo1:= jazz\n"
16               ."bar := captured \n"
17               ."bar2 = boy end, has rise A midnight \n"
18               ."bar3:= \$(foo)\n"
19               ."s1  := _by\n"
20               ."s2  := _and_a\n"
21               ."t1  := \$(addsuffix \$(s1), \$(bar) )\n"
22               ."t2  := \$(addsuffix \$(s2), \$(foo1) )\n" 
23               ."t3  := \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \n"
24               ."t4  := \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \n"
25               ."t5  := \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \n"
26               ."t6  := \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \n"
27               ."t7  := \$(t6) \$(t6) \$(t6) \n"
28               ."p1  := \$(addprefix \$(foo1), \$(s2) )\n"
29               ."blank:= \n"
30               ."all:\n"
31               ."\t\@echo \$(sort \$(bar2) \$(foo)  \$(addsuffix \$(s1), \$(bar) ) \$(t2) \$(bar2) \$(bar3))\n"
32               ."\t\@echo \$(sort \$(blank) \$(foo) \$(bar2) \$(t1) \$(p1) )\n"
33               ."\t\@echo \$(sort \$(foo) \$(bar2) \$(t1) \$(t4) \$(t5) \$(t7) \$(t6) )\n";
36 # END of Contents of MAKEFILE
38 close(MAKEFILE);
40 &run_make_with_options($makefile,"",&get_logfile);
42 # Create the answer to what should be produced by this Makefile
43 $answer = "A boy captured_by days end, has jazz_and_a midnight moon_light rise\n"
44          ."A boy captured_by days end, has jazz_and_a midnight moon_light rise\n"
45          ."A boy captured_by days end, has jazz_and_a midnight moon_light rise\n";
47 &compare_output($answer,&get_logfile(1));