3 $description = "Test GNU make's archive management features.";
6 This only works on systems that support it.";
8 # If this instance of make doesn't support archives, skip it
9 exists $FEATURES{archives} or return -1;
11 # Create some .o files to work with
12 utouch(-60, qw(a1.o a2.o a3.o));
14 # Some versions of ar print different things on creation. Find out.
15 my $created = `ar rv libxx.a a1.o 2>&1`;
17 # Some versions of ar print different things on add. Find out.
18 my $add = `ar rv libxx.a a2.o 2>&1`;
19 $add =~ s/a2\.o/#OBJECT#/g;
21 # Some versions of ar print different things on replacement. Find out.
22 my $repl = `ar rv libxx.a a2.o 2>&1`;
23 $repl =~ s/a2\.o/#OBJECT#/g;
28 run_make_test('all: libxx.a(a1.o)',
29 '', "ar rv libxx.a a1.o\n$created");
31 # Multiple .o's. Add a new one to the existing library
32 ($_ = $add) =~ s/#OBJECT#/a2.o/g;
33 run_make_test('all: libxx.a(a1.o a2.o)',
34 '', "ar rv libxx.a a2.o\n$_");
36 # Touch one of the .o's so it's rebuilt
38 ($_ = $repl) =~ s/#OBJECT#/a1.o/g;
39 run_make_test(undef, '', "ar rv libxx.a a1.o\n$_");
42 run_make_test('all: libxx.a(*.o)',
43 '', "#MAKE#: Nothing to be done for 'all'.\n");
45 # Touch one of the .o's so it's rebuilt
47 ($_ = $repl) =~ s/#OBJECT#/a1.o/g;
48 run_make_test(undef, '', "ar rv libxx.a a1.o\n$_");
50 # Use both wildcards and simple names
52 ($_ = $add) =~ s/#OBJECT#/a3.o/g;
53 $_ .= "ar rv libxx.a a2.o\n";
54 ($_ .= $repl) =~ s/#OBJECT#/a2.o/g;
55 run_make_test('all: libxx.a(a3.o *.o)', '',
56 "ar rv libxx.a a3.o\n$_");
58 # Check whitespace handling
60 ($_ = $repl) =~ s/#OBJECT#/a2.o/g;
61 run_make_test('all: libxx.a( a3.o *.o )', '',
62 "ar rv libxx.a a2.o\n$_");
64 rmfiles(qw(a1.o a2.o a3.o libxx.a));
66 # Check non-archive targets
67 # See Savannah bug #37878
70 foo(bar).baz: ; @echo '$@'
72 '', "foo(bar).baz\n");
74 # Check renaming of archive targets.
75 # See Savannah bug #38442
77 mkdir('artest', 0777);
84 (%): %.vhd ; @cd $(DIR) && touch $(*F) && $(AR) $(ARFLAGS) $@ $(*F) >/dev/null 2>&1 && rm $(*F)
89 run_make_test(undef, '', "#MAKE#: Nothing to be done for 'default'.\n");
92 remove_directory_tree('artest');
94 # This tells the test driver that the perl test script executed properly.