Changeset 280 in kBuild for branches/GNU/src/gmake/tests/scripts/features/conditionals
- Timestamp:
- May 16, 2005 4:54:02 PM (20 years ago)
- Location:
- branches/GNU/src/gmake
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/gmake
- Property svn:ignore
-
old new 34 34 README.DOS 35 35 README.W32 36 README.OS2 36 37 aclocal.m4 37 38 autom4te.cache
-
- Property svn:ignore
-
branches/GNU/src/gmake/tests/scripts/features/conditionals
r153 r280 4 4 $details = "Attempt various different flavors of GNU make conditionals."; 5 5 6 open(MAKEFILE,"> $makefile"); 7 8 # The Contents of the MAKEFILE ... 9 10 print MAKEFILE <<'EOMAKE'; 11 objects = foo.obj 6 run_make_test(' 12 7 arg1 = first 13 8 arg2 = second … … 23 18 endif 24 19 25 ifeq '$(arg2)' "$(arg5)"20 ifeq \'$(arg2)\' "$(arg5)" 26 21 @echo arg2 equals arg5 27 22 else … … 29 24 endif 30 25 31 ifneq '$(arg3)' '$(arg4)'26 ifneq \'$(arg3)\' \'$(arg4)\' 32 27 @echo arg3 NOT equal arg4 33 28 else … … 44 39 else 45 40 @echo arg4 is NOT defined 46 endif 47 48 EOMAKE 49 50 close(MAKEFILE); 51 52 &run_make_with_options($makefile,"",&get_logfile,0); 53 54 $answer = "arg1 NOT equal arg2 41 endif', 42 '', 43 'arg1 NOT equal arg2 55 44 arg2 equals arg5 56 45 arg3 NOT equal arg4 57 46 variable is undefined 58 arg4 is defined 59 "; 60 61 &compare_output($answer,&get_logfile(1)); 47 arg4 is defined'); 62 48 63 49 64 50 # Test expansion of variables inside ifdef. 65 51 66 $makefile2 = &get_tmpfile; 67 68 open(MAKEFILE, "> $makefile2"); 69 70 print MAKEFILE <<'EOF'; 71 52 run_make_test(' 72 53 foo = 1 73 54 … … 93 74 endif 94 75 95 all:; @echo DEF=$(DEF) DEF2=$(DEF2) DEF3=$(DEF3) 76 all:; @echo DEF=$(DEF) DEF2=$(DEF2) DEF3=$(DEF3)', 77 '', 78 'DEF=yes DEF2=yes DEF3=yes'); 96 79 97 EOF98 80 99 close(MAKEFILE) 81 # Test all the different "else if..." constructs 100 82 101 &run_make_with_options($makefile2,"",&get_logfile,0); 102 $answer = "DEF=yes DEF2=yes DEF3=yes\n"; 103 &compare_output($answer,&get_logfile(1)); 83 run_make_test(' 84 arg1 = first 85 arg2 = second 86 arg3 = third 87 arg4 = cc 88 arg5 = fifth 89 90 result = 91 92 ifeq ($(arg1),$(arg2)) 93 result += arg1 equals arg2 94 else ifeq \'$(arg2)\' "$(arg5)" 95 result += arg2 equals arg5 96 else ifneq \'$(arg3)\' \'$(arg3)\' 97 result += arg3 NOT equal arg4 98 else ifndef arg5 99 result += variable is undefined 100 else ifdef undefined 101 result += arg4 is defined 102 else 103 result += success 104 endif 105 106 107 all: ; @echo $(result)', 108 '', 109 'success'); 110 111 112 # Test some random "else if..." construct nesting 113 114 run_make_test(' 115 arg1 = first 116 arg2 = second 117 arg3 = third 118 arg4 = cc 119 arg5 = second 120 121 ifeq ($(arg1),$(arg2)) 122 $(info failed 1) 123 else ifeq \'$(arg2)\' "$(arg2)" 124 ifdef undefined 125 $(info failed 2) 126 else 127 $(info success) 128 endif 129 else ifneq \'$(arg3)\' \'$(arg3)\' 130 $(info failed 3) 131 else ifdef arg5 132 $(info failed 4) 133 else ifdef undefined 134 $(info failed 5) 135 else 136 $(info failed 6) 137 endif 138 139 .PHONY: all 140 all: ; @:', 141 '', 142 'success'); 104 143 105 144
Note:
See TracChangeset
for help on using the changeset viewer.