2 $description = "Tests the new VPATH+ functionality added in 3.76.";
6 $VP = "$workdir$pathsep";
8 open(MAKEFILE,"> $makefile");
10 # The Contents of the MAKEFILE ...
12 print MAKEFILE "VPATH = $VP\n";
14 print MAKEFILE <<'EOMAKE';
18 .SUFFIXES: .a .b .c .d
19 .PHONY: general rename notarget intermediate
29 cat $^ > $@ 2>/dev/null || exit 1
33 # General testing info:
38 # Rename testing info:
40 rename: $(VPATH)/foo.c foo.d
42 # Target not made testing info:
45 notarget.c: notarget.d
46 -@echo "not creating $@ from $^"
64 push(@touchedfiles, $_);
68 # Run the general-case test
70 &touchfiles("$VP/foo.d", "$VP/bar.d", "$VP/foo.c", "$VP/bar.c", "foo.b", "bar.d");
72 &run_make_with_options($makefile,"general",&get_logfile);
74 push(@touchedfiles, "bar.c");
76 $answer = "cat bar.d > bar.c
77 cat ${VP}foo.c bar.c > foo.b 2>/dev/null || exit 1
79 &compare_output($answer,&get_logfile(1));
81 # Test rules that don't make the target correctly
83 &touchfiles("$VP/notarget.c", "notarget.b", "notarget.d");
85 &run_make_with_options($makefile,"notarget",&get_logfile,512);
87 $answer = "not creating notarget.c from notarget.d
88 cat notarget.c > notarget.b 2>/dev/null || exit 1
89 $makefile:16: recipe for target 'notarget.b' failed
90 $make_name: *** [notarget.b] Error 1
93 &compare_output($answer,&get_logfile(1));
95 # Test intermediate file handling (part 1)
97 &touchfiles("$VP/inter.d");
99 &run_make_with_options($makefile,"intermediate",&get_logfile);
101 push(@touchedfiles, "inter.a", "inter.b");
103 $answer = "cat ${VP}inter.d > inter.c
104 cat inter.c > inter.b 2>/dev/null || exit 1
105 cat inter.b > inter.a
108 &compare_output($answer,&get_logfile(1));
110 # Test intermediate file handling (part 2)
112 &utouch(-20, "inter.a");
113 &utouch(-10, "$VP/inter.b");
114 &touch("$VP/inter.d");
116 push(@touchedfiles, "$VP/inter.b", "$VP/inter.d");
118 &run_make_with_options($makefile,"intermediate",&get_logfile);
120 $answer = "cat ${VP}inter.d > inter.c
121 cat inter.c > inter.b 2>/dev/null || exit 1
122 cat inter.b > inter.a
125 &compare_output($answer,&get_logfile(1));
127 unlink @touchedfiles unless $keep;