This commit was manufactured by cvs2svn to create tag
[kbuild-mirror.git] / src / gmake / tests / scripts / options / dash-k
blobfe5689e34ecafdd8eadb463ae740222c0d9153ef
1 #                                                                    -*-perl-*-
3 $description = "Test the make -k (don't stop on error) option.\n";
5 $details = "\
6 The makefile created in this test is a simulation of building
7 a small product.  However, the trick to this one is that one
8 of the dependencies of the main target does not exist.
9 Without the -k option, make would fail immediately and not
10 build any part of the target.  What we are looking for here,
11 is that make builds the rest of the dependencies even though
12 it knows that at the end it will fail to rebuild the main target.";
14 open(MAKEFILE,"> $makefile");
16 # The Contents of the MAKEFILE ...
18 print MAKEFILE <<EOF;
19 VPATH = $workdir
20 edit:  main.o kbd.o commands.o display.o
21 \t\@echo cc -o edit main.o kbd.o commands.o display.o
23 main.o : main.c defs.h
24 \t\@echo cc -c main.c
26 kbd.o : kbd.c defs.h command.h
27 \t\@echo cc -c kbd.c
29 commands.o : command.c defs.h command.h
30 \t\@echo cc -c commands.c
32 display.o : display.c defs.h buffer.h
33 \t\@echo cc -c display.c
34 EOF
36 # END of Contents of MAKEFILE
38 close(MAKEFILE);
41 @files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h",
42                "$workdir${pathsep}command.h",
43                "$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
44                "$workdir${pathsep}buffer.h",
45                "$workdir${pathsep}command.c");
47 &touch(@files_to_touch);
49 if ($vos) {
50   $error_code = 3307;
52 else {
53   $error_code = 512;
56 &run_make_with_options($makefile, "-k", &get_logfile, $error_code);
58 # Create the answer to what should be produced by this Makefile
59 $answer = "cc -c main.c
60 $make_name: *** No rule to make target `kbd.c', needed by `kbd.o'.
61 cc -c commands.c
62 cc -c display.c
63 $make_name: Target `edit' not remade because of errors.\n";
65 # COMPARE RESULTS
67 &compare_output($answer, &get_logfile(1));
69 unlink(@files_to_touch) unless $keep;
72 # TEST 1: Make sure that top-level targets that depend on targets that
73 # previously failed to build, aren't attempted.  Regression for PR/1634.
75 $makefile2 = &get_tmpfile;
77 open(MAKEFILE, "> $makefile2");
78 print MAKEFILE <<'EOF';
79 .SUFFIXES:
81 all: exe1 exe2; @echo making $@
83 exe1 exe2: lib; @echo cp $^ $@
85 lib: foo.o; @echo cp $^ $@
87 foo.o: ; exit 1
88 EOF
90 close(MAKEFILE);
92 &run_make_with_options($makefile2, "-k", &get_logfile, $error_code);
94 $answer = "exit 1
95 $make_name: *** [foo.o] Error 1
96 $make_name: Target `all' not remade because of errors.\n";
98 &compare_output($answer, &get_logfile(1));