Home | History | Annotate | Download | only in features
      1 #                                                                    -*-perl-*-
      2 $description = "Tests VPATH+/GPATH functionality.";
      3 
      4 $details = "";
      5 
      6 $VP = "$workdir$pathsep";
      7 
      8 open(MAKEFILE,"> $makefile");
      9 
     10 # The Contents of the MAKEFILE ...
     11 
     12 print MAKEFILE "VPATH = $VP\n";
     13 
     14 print MAKEFILE <<'EOMAKE';
     15 
     16 GPATH = $(VPATH)
     17 
     18 .SUFFIXES: .a .b .c .d
     19 .PHONY: general rename notarget intermediate
     20 
     21 %.a:
     22 %.b:
     23 %.c:
     24 %.d:
     25 
     26 %.a : %.b ; cat $^ > $@
     27 %.b : %.c ; cat $^ > $@
     28 %.c :: %.d ; cat $^ > $@
     29 
     30 # General testing info:
     31 
     32 general: foo.b
     33 foo.b: foo.c bar.c
     34 
     35 EOMAKE
     36 
     37 close(MAKEFILE);
     38 
     39 @touchedfiles = ();
     40 
     41 $off = -500;
     42 
     43 sub touchfiles {
     44   foreach (@_) {
     45     ($f = $_) =~ s,VP/,$VP,g;
     46     &utouch($off, $f);
     47     $off += 10;
     48     push(@touchedfiles, $f);
     49   }
     50 }
     51 
     52 # Run the general-case test
     53 
     54 &touchfiles("VP/foo.d", "VP/bar.d", "VP/foo.c", "VP/bar.c", "foo.b", "bar.d");
     55 
     56 &run_make_with_options($makefile,"general",&get_logfile());
     57 
     58 push(@touchedfiles, "bar.c");
     59 
     60 $answer = "$make_name: Nothing to be done for `general'.\n";
     61 
     62 &compare_output($answer,&get_logfile(1));
     63 
     64 unlink(@touchedfiles) unless $keep;
     65 
     66 1;
     67