summaryrefslogtreecommitdiff
path: root/tests/scripts/features/vpathgpath
blob: 5e6217bfb6d44a53f06548fa8d0f0f155810294b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#                                                                    -*-perl-*-
$description = "Tests VPATH+/GPATH functionality.";

$details = "";

$VP = "$workdir$pathsep";

open(MAKEFILE,"> $makefile");

# The Contents of the MAKEFILE ...

print MAKEFILE "VPATH = $VP\n";

print MAKEFILE <<'EOMAKE';

GPATH = $(VPATH)

.SUFFIXES: .a .b .c .d
.PHONY: general rename notarget intermediate

%.a:
%.b:
%.c:
%.d:

%.a : %.b ; cat $^ > $@
%.b : %.c ; cat $^ > $@
%.c :: %.d ; cat $^ > $@

# General testing info:

general: foo.b
foo.b: foo.c bar.c

EOMAKE

close(MAKEFILE);

@touchedfiles = ();

$off = -500;

sub touchfiles {
  foreach (@_) {
    ($f = $_) =~ s,VP/,$VP,g;
    &utouch($off, $f);
    $off += 10;
    push(@touchedfiles, $f);
  }
}

# Run the general-case test

&touchfiles("VP/foo.d", "VP/bar.d", "VP/foo.c", "VP/bar.c", "foo.b", "bar.d");

&run_make_with_options($makefile,"general",&get_logfile());

push(@touchedfiles, "bar.c");

$answer = "$make_name: Nothing to be done for 'general'.\n";

&compare_output($answer,&get_logfile(1));

unlink(@touchedfiles) unless $keep;

1;