Home | History | Annotate | Download | only in functions
      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.";
      5 
      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";
      9 
     10 open(MAKEFILE,"> $makefile");
     11 
     12 # The Contents of the MAKEFILE ...
     13 
     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";
     34 
     35 
     36 # END of Contents of MAKEFILE
     37 
     38 close(MAKEFILE);
     39 
     40 &run_make_with_options($makefile,"",&get_logfile);
     41 
     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";
     46 
     47 &compare_output($answer,&get_logfile(1));
     48 
     49 1;
     50 
     51 
     52 
     53 
     54 
     55 
     56