| 1 | # -*-perl-*-
|
|---|
| 2 |
|
|---|
| 3 | $description = "This script tests to make sure that Make looks for
|
|---|
| 4 | default makefiles in the correct order (GNUmakefile,makefile,Makefile)";
|
|---|
| 5 |
|
|---|
| 6 | # Create a makefile called "GNUmakefile"
|
|---|
| 7 | $makefile = "GNUmakefile";
|
|---|
| 8 |
|
|---|
| 9 | open(MAKEFILE,"> $makefile");
|
|---|
| 10 | print MAKEFILE "FIRST: ; \@echo It chose GNUmakefile\n";
|
|---|
| 11 | close(MAKEFILE);
|
|---|
| 12 |
|
|---|
| 13 | # Create another makefile called "makefile"
|
|---|
| 14 | open(MAKEFILE,"> makefile");
|
|---|
| 15 | print MAKEFILE "SECOND: ; \@echo It chose makefile\n";
|
|---|
| 16 | close(MAKEFILE);
|
|---|
| 17 |
|
|---|
| 18 | # DOS/WIN32/MacOSX platforms are case-insensitive / case-preserving, so
|
|---|
| 19 | # Makefile is the same file as makefile. Just test what we can here.
|
|---|
| 20 |
|
|---|
| 21 | my $case_sensitive = 0;
|
|---|
| 22 | if (! -f 'Makefile') {
|
|---|
| 23 | # Create another makefile called "Makefile"
|
|---|
| 24 | $case_sensitive = 1;
|
|---|
| 25 | open(MAKEFILE,"> Makefile");
|
|---|
| 26 | print MAKEFILE "THIRD: ; \@echo It chose Makefile\n";
|
|---|
| 27 | close(MAKEFILE);
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | run_make_with_options("","",&get_logfile);
|
|---|
| 31 | compare_output("It chose GNUmakefile\n",&get_logfile(1));
|
|---|
| 32 | unlink($makefile);
|
|---|
| 33 |
|
|---|
| 34 | run_make_with_options("","",&get_logfile);
|
|---|
| 35 | compare_output("It chose makefile\n",&get_logfile(1));
|
|---|
| 36 | unlink("makefile");
|
|---|
| 37 |
|
|---|
| 38 | if ($case_sensitive) {
|
|---|
| 39 | run_make_with_options("","",&get_logfile);
|
|---|
| 40 | compare_output("It chose Makefile\n",&get_logfile(1));
|
|---|
| 41 | unlink("Makefile");
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | 1;
|
|---|