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