3 $description = "Test the make -k (don't stop on error) option.\n";
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 ...
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
26 kbd.o : kbd.c defs.h command.h
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
36 # END of Contents of 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);
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'.
63 $make_name: Target `edit' not remade because of errors.\n";
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';
81 all: exe1 exe2; @echo making $@
83 exe1 exe2: lib; @echo cp $^ $@
85 lib: foo.o; @echo cp $^ $@
92 &run_make_with_options($makefile2, "-k", &get_logfile, $error_code);
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));