VirtualBox

source: kBuild/trunk/src/gmake/tests/scripts/functions/foreach@ 53

Last change on this file since 53 was 53, checked in by bird, 21 years ago

Initial revision

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1# -*-perl-*-
2
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
7test the foreach function.";
8
9$details = "This is a test of the foreach function in gnu make.
10This function starts with a space separated list of
11names and a variable. Each name in the list is subsituted
12into the variable and the given text evaluated. The general
13form of the command is $(foreach var,$list,$text). Several
14types of foreach loops are tested\n";
15
16
17open(MAKEFILE,"> $makefile");
18
19# The Contents of the MAKEFILE ...
20
21# On WIN32 systems, the user's path is found in %Path% ($Path)
22#
23$pathvar = (($port_type eq 'Windows') ? "Path" : "PATH");
24
25print MAKEFILE <<EOF;
26foo = bletch null \@ garf
27null :=
28space = ' '
29auto_var = udef space CC null $pathvar MAKE foo CFLAGS WHITE \@ <
30av = \$(foreach var, \$(auto_var), \$(origin \$(var)) )
31override WHITE := BLACK
32for_var = \$(addsuffix .c,foo \$(null) \$(foo) \$(space) \$(av) )
33fe = \$(foreach var2, \$(for_var),\$(subst .c,.o, \$(var2) ) )
34all: auto for2
35auto :
36\t\@echo \$(av)
37for2:
38\t\@echo \$(fe)
39EOF
40
41close(MAKEFILE);
42
43&run_make_with_options($makefile,
44 "-e WHITE=WHITE CFLAGS=",
45 &get_logfile);
46
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
49foo.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";
50
51&compare_output($answer,&get_logfile(1));
52
531;
Note: See TracBrowser for help on using the repository browser.

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