Ignore:
Timestamp:
Mar 14, 2018, 10:28:10 PM (7 years ago)
Author:
bird
Message:

kmk: Merged in changes from GNU make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6 / https://git.savannah.gnu.org/git/make.git).

Location:
trunk/src/kmk
Files:
21 edited
8 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk

  • trunk/src/kmk/tests/scripts/features/conditionals

    r969 r3140  
    142142              'success');
    143143
     144# SV 47960 : ensure variable assignments in non-taken legs don't cause problems
     145run_make_test('
     146ifneq ($(FOO),yes)
     147target:
     148else
     149BAR = bar
     150target:
     151endif
     152        @echo one
     153',
     154              '', "one\n");
     155
    144156
    145157# This tells the test driver that the perl test script executed properly.
    1461581;
     159
     160### Local Variables:
     161### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
     162### End:
  • trunk/src/kmk/tests/scripts/features/default_names

    r1937 r3140  
    1111close(MAKEFILE);
    1212
    13 # DOS/WIN32 platforms preserve case, but Makefile is the same file as makefile.
    14 # Just test what we can here (avoid Makefile versus makefile test).
    15 # bird: made this generic, darwin is also defaulting to case insensitive fs.
     13# Create another makefile called "makefile"
     14open(MAKEFILE,"> makefile");
     15print MAKEFILE "SECOND: ; \@echo It chose makefile\n";
     16close(MAKEFILE);
    1617
    17 if ($port_type eq 'UNIX' && !$case_insensitive_fs) {
    18   # Create another makefile called "makefile"
    19   open(MAKEFILE,"> makefile");
    20   print MAKEFILE "SECOND: ; \@echo It chose makefile\n";
    21   close(MAKEFILE);
     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
     21my $case_sensitive = 0;
     22if (! -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);
    2228}
    2329
    24 # Create another makefile called "Makefile"
    25 open(MAKEFILE,"> Makefile");
    26 print MAKEFILE "THIRD: ; \@echo It chose Makefile\n";
    27 close(MAKEFILE);
     30run_make_with_options("","",&get_logfile);
     31compare_output("It chose GNUmakefile\n",&get_logfile(1));
     32unlink($makefile);
    2833
     34run_make_with_options("","",&get_logfile);
     35compare_output("It chose makefile\n",&get_logfile(1));
     36unlink("makefile");
    2937
    30 &run_make_with_options("","",&get_logfile);
    31 &compare_output("It chose GNUmakefile\n",&get_logfile(1));
    32 unlink $makefile;
    33 
    34 if ($port_type eq 'UNIX' && !$case_insensitive_fs) {
    35   &run_make_with_options("","",&get_logfile);
    36   &compare_output("It chose makefile\n",&get_logfile(1));
    37   unlink "makefile";
     38if ($case_sensitive) {
     39    run_make_with_options("","",&get_logfile);
     40    compare_output("It chose Makefile\n",&get_logfile(1));
     41    unlink("Makefile");
    3842}
    3943
    40 &run_make_with_options("","",&get_logfile);
    41 &compare_output("It chose Makefile\n",&get_logfile(1));
    42 unlink "Makefile";
     441;
  • trunk/src/kmk/tests/scripts/features/double_colon

    r969 r3140  
    152152unlink('result','one','two');
    153153
     154# TEST 10: SV 33399 : check for proper backslash handling
     155
     156run_make_test('
     157a\ xb :: ; @echo one
     158a\ xb :: ; @echo two
     159',
     160              '', "one\ntwo\n");
     161
     162# Test 11: SV 44742 : All double-colon rules should be run in parallel build.
     163
     164run_make_test('result :: 01
     165        @echo update
     166        @touch $@
     167result :: 02
     168        @echo update
     169        @touch $@
     170result :: 03
     171        @echo update
     172        @touch $@
     173result :: 04
     174        @echo update
     175        @touch $@
     176result :: 05
     177        @echo update
     178        @touch $@
     17901 02 03 04 05:
     180        @touch 01 02 03 04 05
     181',
     182              '-j10 result', "update\nupdate\nupdate\nupdate\nupdate\n");
     183
     184unlink('result', '01', '02', '03', '04', '05');
     185
     186# Test 12: SV 44742 : Double-colon rules with parallelism
     187
     188run_make_test('
     189root: all
     190        echo root
     191all::
     192        echo all_one
     193all:: 3
     194        echo all_two
     195%:
     196        sleep $*
     197',
     198              '-rs -j2 1 2 root', "all_one\nall_two\nroot\n");
     199
     200# SV 47995 : Parallel double-colon rules with FORCE
     201
     202run_make_test('
     203all:: ; @echo one
     204
     205all:: joe ; @echo four
     206
     207joe: FORCE ; touch joe-is-forced
     208
     209FORCE:
     210',
     211              '-j5', "one\ntouch joe-is-forced\nfour\n");
     212
     213unlink('joe-is-forced');
     214
    154215# This tells the test driver that the perl test script executed properly.
    1552161;
     217
     218### Local Variables:
     219### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
     220### End:
  • trunk/src/kmk/tests/scripts/features/errors

    r969 r3140  
    3131              ."\t-$rm_command cleanit\n"
    3232              ."\t$rm_command foo\n"
    33               ."clean2: \n"
     33              ."clean2: \n"
    3434              ."\t$rm_command cleanit\n"
    3535              ."\t$rm_command foo\n";
     
    4343unlink("cleanit");
    4444$cleanit_error = `sh -c "$rm_command cleanit 2>&1"`;
     45chomp $cleanit_error;
    4546$delete_error_code = $? >> 8;
    4647
     
    4849# -------
    4950
    50 $answer = "$rm_command cleanit\n"
    51          . $cleanit_error
    52          ."$make_name: [clean] Error $delete_error_code (ignored)\n"
    53          ."$rm_command foo\n";
     51$answer = "$rm_command cleanit
     52$cleanit_error
     53$make_name: [$makefile:2: clean] Error $delete_error_code (ignored)
     54$rm_command foo\n";
    5455
    5556&run_make_with_options($makefile,"",&get_logfile);
     
    7576# -------
    7677
    77 $answer = "$rm_command cleanit\n"
    78          . $cleanit_error
    79          ."$make_name: [clean2] Error $delete_error_code (ignored)\n"
    80          ."$rm_command foo\n";
     78$answer = "$rm_command cleanit
     79$cleanit_error
     80$make_name: [$makefile:5: clean2] Error $delete_error_code (ignored)
     81$rm_command foo\n";
    8182
    8283&run_make_with_options($makefile,"clean2 -i",&get_logfile);
     
    9091}
    9192
     93# Test that error line offset works
     94
     95run_make_test(q!
     96all:
     97        @echo hi
     98        @echo there
     99        @exit 1
     100!,
     101              '', "hi\nthere\n#MAKE#: *** [#MAKEFILE#:5: all] Error 1", 512);
     102
    921031;
     104
     105### Local Variables:
     106### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
     107### End:
  • trunk/src/kmk/tests/scripts/features/escape

    r1938 r3140  
    33
    44$details = "\
    5 Make sure that escaping of `:' works in target names.
     5Make sure that escaping of ':' works in target names.
    66Make sure escaping of whitespace works in target names.
    7 Make sure that escaping of '#' works.";
    8 
    9 
    10 close(MAKEFILE);
     7Make sure that escaping of '#' works.
     8Make sure that backslash before non-special characters are kept.";
    119
    1210
     
    2725run_make_test(undef,
    2826              'path=pre:',
    29               "#MAKEFILE#:2: *** target pattern contains no `%' (target `foo').  Stop.",
     27              "#MAKEFILE#:2: *** target pattern contains no '%' (target 'foo').  Stop.",
    3028              512);
    3129
     
    4038run_make_test(undef,
    4139              "'path=pre\\\\:'",
    42               "#MAKEFILE#:2: *** target pattern contains no `%' (target `foo').  Stop.",
     40              "#MAKEFILE#:2: *** target pattern contains no '%'  (target 'foo').  Stop.",
    4341              512);
    4442
     
    5553              'foo#bar.ext = (foo#bar.ext)');
    5654
     55# Test escaped colons in prerequisites
     56# Quoting of backslashes in q!! is kind of messy.
     57# Solaris sh does not properly handle backslashes even in '' so just
     58# check the output make prints, not what the shell interprets.
     59run_make_test(q!
     60foo: foo\\:bar foo\\\\\\:bar foo\\\\\\\\\\:bar
     61foo foo\\:bar foo\\\\\\:bar foo\\\\\\\\\\:bar: ; : '$@'
     62!,
     63              '', ": 'foo:bar'\n: 'foo\\:bar'\n: 'foo\\\\:bar'\n: 'foo'\n");
     64
     65# Test backslash before non-special chars: should be kept as-is
     66
     67run_make_test(q!
     68all: ..\foo
     69.DEFAULT: ; : '$@'
     70!,
     71              '', ": '..\\foo'\n");
     72
    5773# This tells the test driver that the perl test script executed properly.
    58741;
  • trunk/src/kmk/tests/scripts/features/include

    r2591 r3140  
    11#                                     -*-mode: perl; rm-trailing-spaces: nil-*-
    22
    3 $description = "Test various forms of the GNU make `include' command.";
     3$description = "Test various forms of the GNU make 'include' command.";
    44
    55$details = "\
     
    6161',
    6262   '',
    63    "#MAKE#: *** No rule to make target `foo.mk', needed by `error'.  Stop.\n",
     63   "#MAKE#: *** No rule to make target 'foo.mk', needed by 'error'.  Stop.\n",
    6464   512
    6565  );
     
    129129',
    130130'',
    131 "#MAKE#: *** No rule to make target `baz', needed by `bar'.  Stop.\n",
     131"#MAKE#: *** No rule to make target 'baz', needed by 'bar'.  Stop.\n",
    132132512);
    133133
     
    145145',
    146146'',
    147 "#MAKE#: *** No rule to make target `end', needed by `baz'.  Stop.\n",
     147"#MAKE#: *** No rule to make target 'end', needed by 'baz'.  Stop.\n",
    148148512);
    149149
     
    163163'',
    164164"#MAKEFILE#:2: bar: No such file or directory
    165 #MAKE#: *** No rule to make target `end', needed by `baz'.  Stop.\n",
     165#MAKE#: *** No rule to make target 'end', needed by 'baz'.  Stop.\n",
    166166512);
     167
     168# Test include of make-able file doesn't show an error (Savannah #102)
     169run_make_test(q!
     170.PHONY: default
     171default:; @echo DONE
     172
     173inc1:; echo > $@
     174include inc1
     175include inc2
     176inc2:; echo > $@
     177!,
     178              '', "echo > inc2\necho > inc1\nDONE\n");
     179
     180rmfiles('inc1', 'inc2');
     181
     182# Test include of non-make-able file does show an error (Savannah #102)
     183run_make_test(q!
     184.PHONY: default
     185default:; @echo DONE
     186
     187inc1:; echo > $@
     188include inc1
     189include inc2
     190!,
     191              '', "#MAKEFILE#:7: inc2: No such file or directory\n#MAKE#: *** No rule to make target 'inc2'.  Stop.\n", 512);
     192
     193rmfiles('inc1');
     194
     195# Include same file multiple times
     196
     197run_make_test(q!
     198default:; @echo DEFAULT
     199include inc1
     200inc1:; echo > $@
     201include inc1
     202!,
     203              '', "echo > inc1\nDEFAULT\n");
     204
     205rmfiles('inc1');
     206
     207# Included file has a prerequisite that fails to build
     208
     209run_make_test(q!
     210default:; @echo DEFAULT
     211include inc1
     212inc1: foo; echo > $@
     213foo:; exit 1
     214!,
     215              '', "exit 1\n#MAKEFILE#:3: inc1: No such file or directory\n#MAKE#: *** [#MAKEFILE#:5: foo] Error 1\n", 512);
     216
     217rmfiles('inc1');
     218
     219# Included file has a prerequisite we don't know how to build
     220
     221run_make_test(q!
     222default:; @echo DEFAULT
     223include inc1
     224inc1: foo; echo > $@
     225!,
     226              '', "#MAKEFILE#:3: inc1: No such file or directory\n#MAKE#: *** No rule to make target 'foo', needed by 'inc1'.  Stop.\n", 512);
     227
     228rmfiles('inc1');
     229
     230# include a directory
    167231
    168232if ($all_tests) {
     
    173237foo: ; @echo foo = bar > $@
    174238!,
    175                   '', "#MAKE#: `foo' is up to date.\n");
     239                  '', "#MAKE#: 'foo' is up to date.\n");
    176240    rmfiles('foo');
    177241}
  • trunk/src/kmk/tests/scripts/features/mult_rules

    r969 r3140  
    4848
    4949# 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";
     50$answer = "$make_name: *** No rule to make target 'extra.h', needed by 'foo.o'.  Stop.\n";
    5151
    5252&compare_output($answer,&get_logfile(1));
  • trunk/src/kmk/tests/scripts/features/parallelism

    r2591 r3140  
    42422.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@",
    4343              "-j4",
    44               "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
     44              "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n", 0, 7);
    4545
    4646rmfiles(qw(1.inc 2.inc));
     
    61612.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@",
    6262              "-j4",
    63               "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
     63              "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n", 0, 7);
    6464
    6565rmfiles(qw(1.inc 2.inc));
     
    9292
    9393fail.1 fail.2 fail.3:
    94         \@sleep \$(patsubst fail.%,%,\$\@)
     94        \@$sleep_command \$(patsubst fail.%,%,\$\@)
    9595        \@echo Fail
    9696        \@exit 1
    9797
    9898ok:
    99         \@sleep 4
     99        \@$sleep_command 4
    100100        \@echo Ok done",
    101               '-rR -j5', (!$is_kmk) ? 'Fail
    102 #MAKE#: *** [fail.1] Error 1
     101              '-rR -j5', (!$is_kmk) ? "Fail
     102#MAKE#: *** [#MAKEFILE#:8: fail.1] Error 1
    103103#MAKE#: *** Waiting for unfinished jobs....
    104104Fail
    105 #MAKE#: *** [fail.2] Error 1
    106 Fail
    107 #MAKE#: *** [fail.3] Error 1
    108 Ok done' : 'Fail
     105#MAKE#: *** [#MAKEFILE#:8: fail.2] Error 1
     106Fail
     107#MAKE#: *** [#MAKEFILE#:8: fail.3] Error 1
     108Ok done" : 'Fail
    109109#MAKE#: *** [fail.1] Error 1
    110110The failing command:
     
    155155rmfiles('target');
    156156
    157 # TEST #10: Don't put --jobserver-fds into a re-exec'd MAKEFLAGS.
    158 # We can't test this directly because there's no way a makefile can
    159 # show the value of MAKEFLAGS we were re-exec'd with.  We can intuit it
    160 # by looking for "disabling jobserver mode" warnings; we should only
    161 # get one from the original invocation and none from the re-exec.
    162 # See Savannah bug #18124
     157# TEST #11: Make sure -jN from MAKEFLAGS is processed even when we re-exec
     158# See Savannah bug #33873
     159
     160$extraENV{MAKEFLAGS} = '-j4';
    163161
    164162run_make_test(q!
     163things = thing1 thing2
     164all: $(things)
     165thing1:; @sleep 1; echo '$@ start'; sleep 2; echo '$@ end'
     166thing2:; @echo '$@ start'; sleep 2; echo '$@ end'
    165167-include inc.mk
    166 recur:
    167 #       @echo 'MAKEFLAGS = $(MAKEFLAGS)'
    168         @rm -f inc.mk
    169         @$(MAKE) -j2 -f #MAKEFILE# all
    170 all:
    171 #       @echo 'MAKEFLAGS = $(MAKEFLAGS)'
    172         @echo $@
    173 inc.mk:
    174 #       @echo 'MAKEFLAGS = $(MAKEFLAGS)'
    175         @echo 'FOO = bar' > $@
     168inc.mk: ; @touch $@
    176169!,
    177               '--no-print-directory -j2', "#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nall\n");
    178 
     170              '', "thing2 start\nthing1 start\nthing2 end\nthing1 end\n");
     171
     172delete $extraENV{MAKEFLAGS};
    179173rmfiles('inc.mk');
    180174
    181 if ($all_tests) {
    182     # Implicit files aren't properly recreated during parallel builds
    183     # Savannah bug #26864
    184 
    185     # The first run works fine
    186     run_make_test(q!
    187 %.bar: %.x foo.y ; cat $^ > $@
    188 %.x: ; touch $@
    189 foo.y: foo.y.in ; cp $< $@
    190 foo.y.in: ; touch $@
     175# Ensure intermediate/secondary files are not pruned incorrectly.
     176# See Savannah bug #30653
     177
     178utouch(-15, 'file2');
     179utouch(-10, 'file4');
     180utouch(-5,  'file1');
     181
     182run_make_test(q!
     183.INTERMEDIATE: file3
     184file4: file3 ; @mv -f $< $@
     185file3: file2 ; touch $@
     186file2: file1 ; @touch $@
    191187!,
    192                   '-j2 main.bar',
    193                   "touch foo.y.in
    194 touch main.x
    195 cp foo.y.in foo.y
    196 cat main.x foo.y > main.bar
    197 rm main.x");
    198 
    199     # Now we touch the .in file and make sure it still works
    200     touch('foo.y.in');
    201 
    202     run_make_test(undef, '-j2 main.bar', "cp foo.y.in foo.y
    203 touch main.x
    204 cat main.x foo.y > main.bar
    205 rm main.x");
    206 
    207     # Clean up
    208     rmfiles(qw(foo.y foo.y.in main.bar));
    209 }
    210 
    211 if ($all_tests) {
    212     # Jobserver FD handling is messed up in some way.
    213     # Savannah bug #28189
    214     # It doesn't look like that bug anymore but this is the code it runs
    215 
    216     run_make_test(q!
    217 ifdef EXTRA
    218 vpath %.dst /
    219 xxx.dst: ; true
    220 yyy.dst: ; true
    221 endif
    222 
    223 M := $(MAKE)
    224 xx: ; $M --no-print-directory -j2 -f $(MAKEFILE_LIST) xxx.dst yyy.dst EXTRA=1
    225 !,
    226                   '-j2',
    227                   '#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.
    228 true
    229 true
    230 ');
    231 }
     188              '--no-print-directory -j2', "touch file3");
     189
     190rmfiles('file1', 'file2', 'file3', 'file4');
    232191
    233192# Make sure that all jobserver FDs are closed if we need to re-exec the
     
    267226
    2682271;
     228
     229### Local Variables:
     230### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
     231### End:
  • trunk/src/kmk/tests/scripts/features/patspecific_vars

    r2591 r3140  
    8282b%: pattern := good $$t
    8383
    84 global := orginal $$t
     84global := original $$t
    8585
    8686
     
    104104endif
    105105
    106 %z: ; @echo \'pattrn: $a;\'
     106%z: ; @echo \'pattern: $a;\'
    107107
    108108
     
    110110',
    111111'-j1',
    112 'normal: global: orginal $t pattern:  inherit: ;
    113 pattrn: global: orginal $t pattern:  inherit: ;');
     112'normal: global: original $t pattern:  inherit: ;
     113pattern: global: original $t pattern:  inherit: ;');
    114114
    115115
     
    119119'-j1 rec=1',
    120120'normal: global: new $t pattern: good $t inherit: good $t;
    121 pattrn: global: new $t pattern: good $t inherit: good $t;');
     121pattern: global: new $t pattern: good $t inherit: good $t;');
    122122
    123123# TEST #8: override in pattern-specific variables
  • trunk/src/kmk/tests/scripts/features/patternrules

    r2591 r3140  
    112112"dir=$dir",
    113113(!$is_kmk) ?
    114 "#MAKE#: *** [$dir/foo.bar] Error 1" :
     114"#MAKE#: *** [#MAKEFILE#:6: $dir/foo.bar] Error 1":
    115115"#MAKE#: *** [$dir/foo.bar] Error 1" . '
    116116The failing command:
     
    208208!,
    209209              'foo.tex',
    210               "#MAKE#: *** No rule to make target `foo.tex'.  Stop.", 512);
     210              "#MAKE#: *** No rule to make target 'foo.tex'.  Stop.", 512);
    211211
    212212unlink(@f);
     
    227227# This tells the test driver that the perl test script executed properly.
    2282281;
     229
     230### Local Variables:
     231### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
     232### End:
  • trunk/src/kmk/tests/scripts/features/recursion

    r2591 r3140  
    1919              ('CFLAGS=-O -w' . ($parallel_jobs ? ' -j 2' : '')),
    2020              ($vos
    21                ? "#MAKE#: Entering directory `#PWD#'
     21               ? "#MAKE#: Entering directory '#PWD#'
    2222make 'CFLAGS=-O' -f #MAKEFILE# foo
    2323make CFLAGS=-O
     
    2727MAKELEVEL = 0
    2828THE END
    29 #MAKE#: Leaving directory `#PWD#'"
    30                : "#MAKE#: Entering directory `#PWD#'
     29#MAKE#: Leaving directory '#PWD#'"
     30               : "#MAKE#: Entering directory '#PWD#'
    3131#MAKEPATH# -f #MAKEFILE# foo
    32 #MAKE#[1]: Entering directory `#PWD#'
     32#MAKE#[1]: Entering directory '#PWD#'
    3333#MAKEPATH#
    3434MAKELEVEL = 1
    3535#MAKEPATH# -f #MAKEFILE# last
    36 #MAKE#[2]: Entering directory `#PWD#'
     36#MAKE#[2]: Entering directory '#PWD#'
    3737#MAKEPATH#
    3838MAKELEVEL = 2
    3939THE END
    40 #MAKE#[2]: Leaving directory `#PWD#'
    41 #MAKE#[1]: Leaving directory `#PWD#'
    42 #MAKE#: Leaving directory `#PWD#'"));
     40#MAKE#[2]: Leaving directory '#PWD#'
     41#MAKE#[1]: Leaving directory '#PWD#'
     42#MAKE#: Leaving directory '#PWD#'"));
    4343
    4444
  • trunk/src/kmk/tests/scripts/features/reinvoke

    r969 r3140  
    5858# including: this and the previous one test different parts of the code.
    5959
    60 run_make_test(undef, "F=b", "[ -f b ] || echo >> b\nhello\n")
     60run_make_test(undef, 'F=b', "[ -f b ] || echo >> b\nhello\n")
    6161
    6262&rmfiles('a','b','c');
    6363
     64# Ensure command line variables are preserved properly across re-exec
     65# Tests for Savannah bug #30723
     66
     67run_make_test('
     68ifdef RECURSE
     69-include foo30723
     70endif
     71recurse: ; @$(MAKE) -f $(MAKEFILE_LIST) RECURSE=1 test
     72test: ; @echo F.O=$(F.O)
     73foo30723: ; @touch $@
     74',
     75              '--no-print-directory F.O=bar', "F.O=bar\n");
     76
     77unlink('foo30723');
     78
    6479# This tells the test driver that the perl test script executed properly.
    65801;
  • trunk/src/kmk/tests/scripts/features/se_explicit

    r2591 r3140  
    88# bird: Modified this test to use ${PRE} instead of $(PRE) as it failes
    99#       when make is built with NO_ARCHIVES defined.
     10
     11# If we don't support archives then the prerequisite is different
     12my $prereq = exists $FEATURES{'archives'} ? '$' : '$(PRE)';
    1013
    1114run_make_test(q!
     
    2124!,
    2225              '',
    23               "\${PRE}\nbar\$biz\nfoo\$bar : bar\$baz bar\$biz");
     26              "$prereq\nbar\$biz\nfoo\$bar : bar\$baz bar\$biz");
    2427
    2528run_make_test(undef, 'SE=1', "three\nfour\nbariz\nfoo\$bar : baraz bariz");
     
    118121all : $$(eval $$(info test))
    119122!,
    120             '', "test\n#MAKE#: Nothing to be done for `all'.\n");
     123            '', "test\n#MAKE#: Nothing to be done for 'all'.\n");
    121124
    122125# TEST #5: (NEGATIVE) catch eval in a prereq list trying to create new
     
    155158
    156159
    157 # This tells the test driver that the perl test script executed properly.
     160# Allow patsubst shorthand in second expansion context.
     161# Requires the colon to be quoted.  Savannah bug #16545
     162run_make_test(q!
     163.PHONY: foo.bar
     164.SECONDEXPANSION:
     165foo: $$(@\\:%=%.bar); @echo '$^'
     166!,
     167              '', "foo.bar\n");
     168
    1581691;
  • trunk/src/kmk/tests/scripts/features/se_implicit

    r2591 r3140  
    223223              '', "\n");
    224224
     225# Test #10: Test second expansion with second expansion prerequisites
     226# Ensures pattern_search() recurses with SE prereqs.
     227touch('a');
     228run_make_test(q!
     229.SECONDEXPANSION:
     230sim_base_rgg := just_a_name
     231sim_base_src := a
     232sim_base_f := a a a
     233sim_%.f: $${sim_$$*_f}
     234        echo $@
     235sim_%.src: $${sim_$$*_src}
     236        echo $@
     237sim_%: \
     238        $$(if $$(sim_$$*_src),sim_%.src) \
     239        $$(if $$(sim_$$*_f),sim_%.f) \
     240        $$(if $$(sim_$$*_rgg),$$(sim_$$*_rgg).s)
     241        echo $@
     242!,
     243              '-s sim_base', "#MAKE#: *** No rule to make target 'sim_base'.  Stop.", 512);
     244
     245unlink('a');
     246
     247# Ensure that order-only tokens embedded in second expansions are parsed
     248run_make_test(q!
     249.SECONDEXPANSION:
     250PREREQS=p1|p2
     251P2=p2
     252all : foo bar
     253f%o: $$(PREREQS) ; @echo '$@' from '$^' and '$|'
     254b%r: p1|$$(P2)   ; @echo '$@' from '$^' and '$|'
     255p% : ; : $@
     256!,
     257              "", ": p1\n: p2\nfoo from p1 and p2\nbar from p1 and p2\n");
     258
    225259# This tells the test driver that the perl test script executed properly.
    2262601;
  • trunk/src/kmk/tests/scripts/features/targetvars

    r2591 r3140  
    238238run_make_test(undef, 'FOO=C', "C f1\n");
    239239
     240# TEST #19: Conditional variables with command-line settings
     241
     242run_make_test('
     243a: FOO ?= f1
     244a: ; @echo "$(FOO)"
     245',
     246              '', "f1\n");
     247
     248run_make_test(undef, 'FOO=C', "C\n");
     249
    240250# TEST #20: Check for continuation after semicolons
    241251
    242252run_make_test(q!
    243 a: A = 'hello; \
     253a: A = 'hello;\
    244254world'
    245255a: ; @echo $(A)
  • trunk/src/kmk/tests/scripts/features/varnesting

    r969 r3140  
    1 $description = "The following test creates a makefile to ...";
     1#                                                                    -*-perl-*-
     2$description = "Test recursive variables";
    23
    34$details = "";
    45
    5 open(MAKEFILE,"> $makefile");
     6run_make_test('
     7x = variable1
     8variable2 := Hello
     9y = $(subst 1,2,$(x))
     10z = y
     11a := $($($(z)))
     12all:
     13        @echo $(a)
     14',
     15              '', "Hello\n");
    616
    7 # The Contents of the MAKEFILE ...
     17# This tests resetting the value of a variable while expanding it.
     18# You may only see problems with this if you're using valgrind or
     19# some other memory checker that poisons freed memory.
     20# See Savannah patch #7534
    821
    9 print MAKEFILE "x = variable1\n"
    10               ."variable2 := Hello\n"
    11               ."y = \$(subst 1,2,\$(x))\n"
    12               ."z = y\n"
    13               ."a := \$(\$(\$(z)))\n"
    14               ."all: \n"
    15               ."\t\@echo \$(a)\n";
    16 
    17 # END of Contents of MAKEFILE
    18 
    19 close(MAKEFILE);
    20 
    21 &run_make_with_options($makefile,"",&get_logfile);
    22 
    23 # Create the answer to what should be produced by this Makefile
    24 $answer = "Hello\n";
    25 
    26 &compare_output($answer,&get_logfile(1));
     22run_make_test('
     23VARIABLE = $(eval VARIABLE := echo hi)$(VARIABLE)
     24wololo:
     25        @$(VARIABLE)
     26',
     27              '', "hi\n");
    2728
    28291;
  • trunk/src/kmk/tests/scripts/features/vpath

    r2591 r3140  
    7676vpath-d/fail.te:
    7777!,
    78               '', "#MAKE#: Nothing to be done for `default'.\n");
     78              '', "#MAKE#: Nothing to be done for 'default'.\n");
    7979
    8080rmdir('vpath-d');
  • trunk/src/kmk/tests/scripts/features/vpath3

    r2591 r3140  
    1 #                                                                     -*-perl-*-
     1#                                                                    -*-perl-*-
    22
    33$description = "Test the interaction of the -lfoo feature and vpath";
    44$details = "";
    55
    6 open(MAKEFILE,"> $makefile");
     6my @dirs_to_make = qw(a1 b1 a2 b2 b3);
     7for my $d (@dirs_to_make) {
     8    mkdir($d, 0777);
     9}
    710
    8 # The Contents of the MAKEFILE ...
    9 
    10 print MAKEFILE "vpath %.a a1\n";
    11 print MAKEFILE "vpath %.so b1\n";
    12 print MAKEFILE "vpath % a2 b2\n";
    13 print MAKEFILE "vpath % b3\n";
    14 print MAKEFILE "all: -l1 -l2 -l3; \@echo \$^\n";
    15 
    16 # END of Contents of MAKEFILE
    17 
    18 close(MAKEFILE);
    19 
    20 mkdir("a1", 0777);
    21 mkdir("b1", 0777);
    22 mkdir("a2", 0777);
    23 mkdir("b2", 0777);
    24 mkdir("b3", 0777);
    25 
    26 @files_to_touch = ("a1${pathsep}lib1.a",
    27                    "b1${pathsep}lib1.so",
    28                    "a2${pathsep}lib2.a",
    29                    "b2${pathsep}lib2.so",
    30                    "lib3.a",
    31                    "b3${pathsep}lib3.so");
    32 
     11my @files_to_touch = ("a1${pathsep}lib1.a",
     12                      "a1${pathsep}libc.a",
     13                      "b1${pathsep}lib1.so",
     14                      "a2${pathsep}lib2.a",
     15                      "b2${pathsep}lib2.so",
     16                      "lib3.a",
     17                      "b3${pathsep}lib3.so");
    3318&touch(@files_to_touch);
    3419
    35 &run_make_with_options($makefile,"",&get_logfile);
     20my $answer = "a1${pathsep}lib1.a a1${pathsep}libc.a " .
     21             "a2${pathsep}lib2.a lib3.a\n";
     22if ($port_type eq 'VMS-DCL') {
     23    $answer =~ s/ /,/g;
     24}
    3625
    37 # Create the answer to what should be produced by this Makefile
    38 $answer = "a1${pathsep}lib1.a a2${pathsep}lib2.a lib3.a\n";
     26run_make_test('
     27vpath %.h b3
     28vpath %.a a1
     29vpath %.so b1
     30vpath % a2 b2
     31vpath % b3
     32all: -l1 -lc -l2 -l3; @echo $^
     33',
     34              '', $answer);
    3935
    40 if (&compare_output($answer,&get_logfile(1)))
    41 {
    42   unlink @files_to_touch;
    43   rmdir("a1");
    44   rmdir("b1");
    45   rmdir("a2");
    46   rmdir("b2");
    47   rmdir("b3");
     36unlink(@files_to_touch);
     37for my $d (@dirs_to_make) {
     38    rmdir($d);
    4839}
    4940
  • trunk/src/kmk/tests/scripts/features/vpathgpath

    r969 r3140  
    5858push(@touchedfiles, "bar.c");
    5959
    60 $answer = "$make_name: Nothing to be done for `general'.\n";
     60$answer = "$make_name: Nothing to be done for 'general'.\n";
    6161
    6262&compare_output($answer,&get_logfile(1));
  • trunk/src/kmk/tests/scripts/features/vpathplus

    r969 r3140  
    8787$answer = "not creating notarget.c from notarget.d
    8888cat notarget.c > notarget.b 2>/dev/null || exit 1
    89 $make_name: *** [notarget.b] Error 1
     89$make_name: *** [$makefile:16: notarget.b] Error 1
    9090";
    9191
     
    127127
    1281281;
     129
     130### Local Variables:
     131### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
     132### End:
Note: See TracChangeset for help on using the changeset viewer.