| 1 | $description = "\
|
|---|
| 2 | The following test creates a makefile to test the presence
|
|---|
| 3 | of multiple rules for one target. One file can be the
|
|---|
| 4 | target of several rules if at most one rule has commands;
|
|---|
| 5 | the other rules can only have dependencies.";
|
|---|
| 6 |
|
|---|
| 7 | $details = "\
|
|---|
| 8 | The makefile created in this test contains two hardcoded rules
|
|---|
| 9 | for foo.o and bar.o. It then gives another multiple target rule
|
|---|
| 10 | with the same names as above but adding more dependencies.
|
|---|
| 11 | Additionally, another variable extradeps is listed as a
|
|---|
| 12 | dependency but is defined to be null. It can however be defined
|
|---|
| 13 | on the make command line as extradeps=extra.h which adds yet
|
|---|
| 14 | another dependency to the targets.";
|
|---|
| 15 |
|
|---|
| 16 | open(MAKEFILE,"> $makefile");
|
|---|
| 17 |
|
|---|
| 18 | # The Contents of the MAKEFILE ...
|
|---|
| 19 |
|
|---|
| 20 | print MAKEFILE <<EOF;
|
|---|
| 21 | objects = foo.o bar.o
|
|---|
| 22 | foo.o : defs.h
|
|---|
| 23 | bar.o : defs.h test.h
|
|---|
| 24 | extradeps =
|
|---|
| 25 | \$(objects) : config.h \$(extradeps)
|
|---|
| 26 | \t\@echo EXTRA EXTRA
|
|---|
| 27 | EOF
|
|---|
| 28 |
|
|---|
| 29 | # END of Contents of MAKEFILE
|
|---|
| 30 |
|
|---|
| 31 | close(MAKEFILE);
|
|---|
| 32 |
|
|---|
| 33 | &touch("defs.h","test.h","config.h");
|
|---|
| 34 |
|
|---|
| 35 | if ($vos)
|
|---|
| 36 | {
|
|---|
| 37 | $error_code = 3307;
|
|---|
| 38 | }
|
|---|
| 39 | else
|
|---|
| 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 |
|
|---|
| 70 | unlink("defs.h","test.h","config.h","extra.h");
|
|---|
| 71 |
|
|---|
| 72 | 1;
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|