VirtualBox

Ignore:
Timestamp:
Sep 15, 2006 2:30:32 AM (19 years ago)
Author:
bird
Message:

Load make-3.81/ into vendor/gnumake/current.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/gnumake/current/tests/scripts/functions/foreach

    r53 r501  
    11#                                                                    -*-perl-*-
     2# $Id: foreach,v 1.5 2006/03/10 02:20:46 psmith Exp $
    23
    3 # Updated 6.16.93  variable "MAKE" is default was environment override
    4 # For make 3.63 and above
    5 
    6 $description = "The following test creates a makefile to verify
    7 test the foreach function.";
     4$description = "Test the foreach function.";
    85
    96$details = "This is a test of the foreach function in gnu make.
     
    1512
    1613
    17 open(MAKEFILE,"> $makefile");
     14# TEST 0
    1815
    19 # The Contents of the MAKEFILE ...
     16# Set an environment variable that we can test in the makefile.
     17$extraENV{FOOFOO} = 'foo foo';
    2018
    21 # On WIN32 systems, the user's path is found in %Path% ($Path)
    22 #
    23 $pathvar = (($port_type eq 'Windows') ? "Path" : "PATH");
     19run_make_test("space = ' '".'
     20null :=
     21auto_var = udef space CC null FOOFOO MAKE foo CFLAGS WHITE @ <
     22foo = bletch null @ garf
     23av = $(foreach var, $(auto_var), $(origin $(var)) )
     24override WHITE := BLACK
     25for_var = $(addsuffix .c,foo $(null) $(foo) $(space) $(av) )
     26fe = $(foreach var2, $(for_var),$(subst .c,.o, $(var2) ) )
     27all: auto for2
     28auto : ; @echo $(av)
     29for2: ; @echo $(fe)',
     30              '-e WHITE=WHITE CFLAGS=',
     31              "undefined file default file environment default file command line override automatic automatic
     32foo.o bletch.o null.o @.o garf.o .o    .o undefined.o file.o default.o file.o environment.o default.o file.o command.o line.o override.o automatic.o automatic.o");
    2433
    25 print MAKEFILE <<EOF;
    26 foo = bletch null \@ garf
    27 null :=
    28 space = ' '
    29 auto_var = udef space CC null $pathvar MAKE foo CFLAGS WHITE \@ <
    30 av = \$(foreach var, \$(auto_var), \$(origin \$(var)) )
    31 override WHITE := BLACK
    32 for_var = \$(addsuffix .c,foo \$(null) \$(foo) \$(space) \$(av) )
    33 fe = \$(foreach var2, \$(for_var),\$(subst .c,.o, \$(var2) ) )
    34 all: auto for2
    35 auto :
    36 \t\@echo \$(av)
    37 for2:
    38 \t\@echo \$(fe)
    39 EOF
     34delete $extraENV{FOOFOO};
    4035
    41 close(MAKEFILE);
     36# TEST 1: Test that foreach variables take precedence over global
     37# variables in a global scope (like inside an eval).  Tests bug #11913
    4238
    43 &run_make_with_options($makefile,
    44                       "-e WHITE=WHITE CFLAGS=",
    45                       &get_logfile);
     39run_make_test('
     40.PHONY: all target
     41all: target
    4642
    47 # Create the answer to what should be produced by this Makefile
    48 $answer = "undefined file default file environment default file command line override automatic automatic
    49 foo.o bletch.o null.o @.o garf.o .o    .o undefined.o file.o default.o file.o environment.o default.o file.o command.o line.o override.o automatic.o automatic.o\n";
     43x := BAD
    5044
    51 &compare_output($answer,&get_logfile(1));
     45define mktarget
     46target: x := $(x)
     47target: ; @echo "$(x)"
     48endef
     49
     50x := GLOBAL
     51
     52$(foreach x,FOREACH,$(eval $(value mktarget)))',
     53              '',
     54              'FOREACH');
     55
     56
     57# TEST 2: Check some error conditions.
     58
     59run_make_test('
     60x = $(foreach )
     61y = $x
     62
     63all: ; @echo $y',
     64              '',
     65              "#MAKEFILE#:2: *** insufficient number of arguments (1) to function `foreach'.  Stop.",
     66              512);
     67
     68run_make_test('
     69x = $(foreach )
     70y := $x
     71
     72all: ; @echo $y',
     73              '',
     74              "#MAKEFILE#:2: *** insufficient number of arguments (1) to function `foreach'.  Stop.",
     75              512);
    5276
    53771;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette