1$description = "\ 2The following test creates a makefile to test the presence 3of multiple rules for one target. One file can be the 4target of several rules if at most one rule has commands; 5the other rules can only have dependencies."; 6 7$details = "\ 8The makefile created in this test contains two hardcoded rules 9for foo.o and bar.o. It then gives another multiple target rule 10with the same names as above but adding more dependencies. 11Additionally, another variable extradeps is listed as a 12dependency but is defined to be null. It can however be defined 13on the make command line as extradeps=extra.h which adds yet 14another dependency to the targets."; 15 16open(MAKEFILE,"> $makefile"); 17 18# The Contents of the MAKEFILE ... 19 20print MAKEFILE <<EOF; 21objects = foo.o bar.o 22foo.o : defs.h 23bar.o : defs.h test.h 24extradeps = 25\$(objects) : config.h \$(extradeps) 26\t\@echo EXTRA EXTRA 27EOF 28 29# END of Contents of MAKEFILE 30 31close(MAKEFILE); 32 33&touch("defs.h","test.h","config.h"); 34 35if ($vos) 36{ 37 $error_code = 3307; 38} 39else 40{ 41 $error_code = 512; 42} 43 44&run_make_with_options($makefile, 45 "extradeps=extra.h", 46 &get_logfile, 47 $error_code); 48 49# Create the answer to what should be produced by this Makefile 50$answer = "$make_name: *** No rule to make target `extra.h', needed by `foo.o'. Stop.\n"; 51 52&compare_output($answer,&get_logfile(1)); 53 54 55# TEST #2 56# ------- 57 58&touch("extra.h"); 59 60&run_make_with_options($makefile, 61 "extradeps=extra.h", 62 &get_logfile, 63 0); 64 65# Create the answer to what should be produced by this Makefile 66$answer = "EXTRA EXTRA\n"; 67 68&compare_output($answer,&get_logfile(1)); 69 70unlink("defs.h","test.h","config.h","extra.h"); 71 721; 73 74 75 76 77 78 79