1# -*-perl-*- 2 3$description = "\ 4This tests random features of the parser that need to be supported, and 5which have either broken at some point in the past or seem likely to 6break."; 7 8run_make_test(" 9# We want to allow both empty commands _and_ commands that resolve to empty. 10EMPTY = 11 12.PHONY: all a1 a2 a3 a4 13all: a1 a2 a3 a4 14 15a1:; 16a2: 17\t 18a3:;\$(EMPTY) 19a4: 20\t\$(EMPTY) 21 22\# Non-empty lines that expand to nothing should also be ignored. 23STR = \# Some spaces 24TAB = \t \# A TAB and some spaces 25 26\$(STR) 27 28\$(STR) \$(TAB)", 29 '', "#MAKE#: Nothing to be done for `all'."); 30 31# TEST 2 32 33# Make sure files without trailing newlines are handled properly. 34# Have to use the old style invocation to test this. 35 36$makefile2 = &get_tmpfile; 37 38open(MAKEFILE, "> $makefile2"); 39print MAKEFILE "all:;\@echo FOO = \$(FOO)\nFOO = foo"; 40close(MAKEFILE); 41 42&run_make_with_options($makefile2,"",&get_logfile); 43$answer = "FOO = foo\n"; 44&compare_output($answer,&get_logfile(1)); 45 46# TEST 3 47 48# Check semicolons in variable references 49 50run_make_test(' 51$(if true,$(info true; true)) 52all: ; @: 53', 54 '', 'true; true'); 55 56# TEST 4 57 58# Check that backslashes in command scripts are handled according to POSIX. 59# Checks Savannah bug # 1332. 60 61# Test the fastpath / no quotes 62run_make_test(' 63all: 64 @echo foo\ 65bar 66 @echo foo\ 67 bar 68 @echo foo\ 69 bar 70 @echo foo\ 71 bar 72 @echo foo \ 73bar 74 @echo foo \ 75 bar 76 @echo foo \ 77 bar 78 @echo foo \ 79 bar 80', 81 '', 'foobar 82foobar 83foo bar 84foo bar 85foo bar 86foo bar 87foo bar 88foo bar'); 89 90# Test the fastpath / single quotes 91run_make_test(" 92all: 93 \@echo 'foo\\ 94bar' 95 \@echo 'foo\\ 96 bar' 97 \@echo 'foo\\ 98 bar' 99 \@echo 'foo\\ 100 bar' 101 \@echo 'foo \\ 102bar' 103 \@echo 'foo \\ 104 bar' 105 \@echo 'foo \\ 106 bar' 107 \@echo 'foo \\ 108 bar' 109", 110 '', 'foo\ 111bar 112foo\ 113bar 114foo\ 115 bar 116foo\ 117 bar 118foo \ 119bar 120foo \ 121bar 122foo \ 123 bar 124foo \ 125 bar'); 126 127# Test the fastpath / double quotes 128run_make_test(' 129all: 130 @echo "foo\ 131bar" 132 @echo "foo\ 133 bar" 134 @echo "foo\ 135 bar" 136 @echo "foo\ 137 bar" 138 @echo "foo \ 139bar" 140 @echo "foo \ 141 bar" 142 @echo "foo \ 143 bar" 144 @echo "foo \ 145 bar" 146', 147 '', 'foobar 148foobar 149foo bar 150foo bar 151foo bar 152foo bar 153foo bar 154foo bar'); 155 156# Test the slow path / no quotes 157run_make_test(' 158all: 159 @echo hi; echo foo\ 160bar 161 @echo hi; echo foo\ 162 bar 163 @echo hi; echo foo\ 164 bar 165 @echo hi; echo foo\ 166 bar 167 @echo hi; echo foo \ 168bar 169 @echo hi; echo foo \ 170 bar 171 @echo hi; echo foo \ 172 bar 173 @echo hi; echo foo \ 174 bar 175', 176 '', 'hi 177foobar 178hi 179foobar 180hi 181foo bar 182hi 183foo bar 184hi 185foo bar 186hi 187foo bar 188hi 189foo bar 190hi 191foo bar'); 192 193# Test the slow path / no quotes. This time we put the slow path 194# determination _after_ the backslash-newline handling. 195run_make_test(' 196all: 197 @echo foo\ 198bar; echo hi 199 @echo foo\ 200 bar; echo hi 201 @echo foo\ 202 bar; echo hi 203 @echo foo\ 204 bar; echo hi 205 @echo foo \ 206bar; echo hi 207 @echo foo \ 208 bar; echo hi 209 @echo foo \ 210 bar; echo hi 211 @echo foo \ 212 bar; echo hi 213', 214 '', 'foobar 215hi 216foobar 217hi 218foo bar 219hi 220foo bar 221hi 222foo bar 223hi 224foo bar 225hi 226foo bar 227hi 228foo bar 229hi'); 230 231# Test the slow path / single quotes 232run_make_test(" 233all: 234 \@echo hi; echo 'foo\\ 235bar' 236 \@echo hi; echo 'foo\\ 237 bar' 238 \@echo hi; echo 'foo\\ 239 bar' 240 \@echo hi; echo 'foo\\ 241 bar' 242 \@echo hi; echo 'foo \\ 243bar' 244 \@echo hi; echo 'foo \\ 245 bar' 246 \@echo hi; echo 'foo \\ 247 bar' 248 \@echo hi; echo 'foo \\ 249 bar' 250", 251 '', 'hi 252foo\ 253bar 254hi 255foo\ 256bar 257hi 258foo\ 259 bar 260hi 261foo\ 262 bar 263hi 264foo \ 265bar 266hi 267foo \ 268bar 269hi 270foo \ 271 bar 272hi 273foo \ 274 bar'); 275 276# Test the slow path / double quotes 277run_make_test(' 278all: 279 @echo hi; echo "foo\ 280bar" 281 @echo hi; echo "foo\ 282 bar" 283 @echo hi; echo "foo\ 284 bar" 285 @echo hi; echo "foo\ 286 bar" 287 @echo hi; echo "foo \ 288bar" 289 @echo hi; echo "foo \ 290 bar" 291 @echo hi; echo "foo \ 292 bar" 293 @echo hi; echo "foo \ 294 bar" 295', 296 '', 'hi 297foobar 298hi 299foobar 300hi 301foo bar 302hi 303foo bar 304hi 305foo bar 306hi 307foo bar 308hi 309foo bar 310hi 311foo bar'); 312 3131; 314