mirror of
https://git.savannah.gnu.org/git/make.git
synced 2024-12-29 08:09:02 +00:00
73 lines
2.4 KiB
Text
73 lines
2.4 KiB
Text
$description = "The following test creates a makefile to test the -k option.\n"
|
|
."Normally, make gives up immediately if an error happens \n"
|
|
."that make has not been told to ignore. However, if the -k\n"
|
|
."option is specified, make continues to consider the other\n"
|
|
."dependencies of the pending targets.";
|
|
|
|
$details = "The makefile created in this test is a simulation of building \n"
|
|
."a small product. However, the trick to this one is that one \n"
|
|
."of the dependencies of the main target does not exist. \n"
|
|
."Without the -k option, make would fail immediately and not \n"
|
|
."build any part of the target. What we are looking for here, \n"
|
|
."is that make builds the rest of the dependencies even though \n"
|
|
."it knows that at the end it will fail to rebuild the main target.";
|
|
|
|
open(MAKEFILE,"> $makefile");
|
|
|
|
# The Contents of the MAKEFILE ...
|
|
|
|
print MAKEFILE "VPATH = $workdir\n";
|
|
print MAKEFILE "edit: main.o kbd.o commands.o display.o \n";
|
|
print MAKEFILE "\t\@echo cc -o edit main.o kbd.o commands.o display.o \n";
|
|
|
|
print MAKEFILE "main.o : main.c defs.h\n";
|
|
print MAKEFILE "\t\@echo cc -c main.c\n";
|
|
|
|
print MAKEFILE "kbd.o : kbd.c defs.h command.h\n";
|
|
print MAKEFILE "\t\@echo cc -c kbd.c\n";
|
|
|
|
print MAKEFILE "commands.o : command.c defs.h command.h\n";
|
|
print MAKEFILE "\t\@echo cc -c commands.c\n";
|
|
|
|
print MAKEFILE "display.o : display.c defs.h buffer.h\n";
|
|
print MAKEFILE "\t\@echo cc -c display.c\n";
|
|
|
|
# END of Contents of MAKEFILE
|
|
|
|
close(MAKEFILE);
|
|
|
|
|
|
@files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h",
|
|
"$workdir${pathsep}command.h",
|
|
"$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
|
|
"$workdir${pathsep}buffer.h",
|
|
"$workdir${pathsep}command.c");
|
|
|
|
&touch(@files_to_touch);
|
|
|
|
if ($vos)
|
|
{
|
|
$error_code = 3307;
|
|
}
|
|
else
|
|
{
|
|
$error_code = 512;
|
|
}
|
|
|
|
&run_make_with_options($makefile,"-k",&get_logfile,$error_code);
|
|
|
|
# Create the answer to what should be produced by this Makefile
|
|
$answer = "cc -c main.c\n"
|
|
."$make_name: *** No rule to make target `kbd.c', needed by `kbd.o'.\n"
|
|
."cc -c commands.c\n"
|
|
."cc -c display.c\n"
|
|
."$make_name: Target `edit' not remade because of errors.\n";
|
|
|
|
# COMPARE RESULTS
|
|
|
|
if (&compare_output($answer,&get_logfile(1)))
|
|
{
|
|
unlink @files_to_touch;
|
|
}
|
|
|
|
1;
|