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