1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906
|
# -*-perl-*-
$description = "Test proper behavior of MAKEFLAGS";
$details = "DETAILS";
# Normal flags aren't prefixed with "-"
run_make_test(q!
all: ; @echo /$(MAKEFLAGS)/
!,
'-e -r -R', '/erR/');
# Long arguments mean everything is prefixed with "-"
run_make_test(q!
all: ; @echo /$(MAKEFLAGS)/
!,
'--no-print-directory -e -r -R --trace', "#MAKEFILE#:2: update target 'all' due to: target does not exist
echo /erR --trace --no-print-directory/
/erR --trace --no-print-directory/");
# Recursive invocations of make should accumulate MAKEFLAGS values.
# Savannah bug #2216
run_make_test(q!
MSG = Fails
.RECIPEPREFIX = >
all:
> @echo '$@: MAKEFLAGS=$(MAKEFLAGS)'
> @MSG=Works $(MAKE) -e -f #MAKEFILE# jump
jump:
> @echo '$@ $(MSG): MAKEFLAGS=$(MAKEFLAGS)'
> @$(MAKE) -f #MAKEFILE# print
print:
> @echo '$@ $(MSG): MAKEFLAGS=$(MAKEFLAGS)'
.PHONY: all jump print
!,
'--no-print-directory',
'all: MAKEFLAGS= --no-print-directory
jump Works: MAKEFLAGS=e --no-print-directory
print Works: MAKEFLAGS=e --no-print-directory');
# Ensure MAKEFLAGS updates are handled immediately rather than later
mkdir('foo', 0777);
mkdir('bar', 0777);
run_make_test(q!
$(info MAKEFLAGS=$(MAKEFLAGS))
$(info INCLUDE_DIRS=$(.INCLUDE_DIRS))
MAKEFLAGS += -Ibar
$(info MAKEFLAGS=$(MAKEFLAGS))
$(info INCLUDE_DIRS=$(.INCLUDE_DIRS))
.PHONY: all
all: ; @echo 'MAKEFLAGS=$(MAKEFLAGS)' "\$$MAKEFLAGS=$$MAKEFLAGS"
!,
'-I- -Ifoo', 'MAKEFLAGS= -I- -Ifoo
INCLUDE_DIRS=foo
MAKEFLAGS= -I- -Ifoo -Ibar
INCLUDE_DIRS=foo bar
MAKEFLAGS= -I- -Ifoo -Ibar $MAKEFLAGS= -I- -Ifoo -Ibar');
rmdir('foo');
rmdir('bar');
# Test that command line switches are all present in MAKEFLAGS.
# sv 62514.
my @opts;
my @flavors;
# Simple flags.
@opts = ('i', 'k', 'n', 'q', 'r', 's', 'w', 'd');
exists $FEATURES{'check-symlink'} and push @opts, 'L';
@flavors = ('=', ':=', ':::=', '+=-');
for my $fl (@flavors) {
for my $opt (@opts) {
run_make_test("
MAKEFLAGS${fl}B
all:; \$(info makeflags='\$(MAKEFLAGS)')
", "-$opt", "/makeflags='B$opt'/");
}
}
# Strawberry Perl's exec()--or something!--appears to replace all /tmp with the
# user's %TEMP% value so we can't use that for -I testing. Make a directory.
mkdir('localtmp', 0777);
# Switches which carry arguments.
@opts = (' -Ilocaltmp', ' -Onone', ' --debug=b', ' -l2.5');
for my $fl (@flavors) {
for my $opt (@opts) {
run_make_test("
MAKEFLAGS${fl}B
all:; \$(info makeflags='\$(MAKEFLAGS)')
", "$opt", "/makeflags='B$opt'/");
}
}
# Long options which take no arguments.
# sv 62514.
@opts = (' --no-print-directory', ' --warn-undefined-variables', ' --trace');
for my $fl (@flavors) {
for my $opt (@opts) {
run_make_test("
MAKEFLAGS${fl}B
all:; \$(info makeflags='\$(MAKEFLAGS)')
", "$opt", "/makeflags='B$opt'/");
}
}
# Test that make filters out duplicates.
# Each option is specified in the makefile, env and on the command line.
@opts = (' -Ilocaltmp', ' -Onone', ' --debug=b', ' -l2.5');
for my $fl (@flavors) {
for my $opt (@opts) {
$ENV{'MAKEFLAGS'} = $opt;
run_make_test("
MAKEFLAGS${fl}B $opt
all:; \$(info makeflags='\$(MAKEFLAGS)')
", "$opt", "/makeflags='B$opt'/");
}
}
# Test that make filters out duplicates.
# Each option is specified in the makefile, env and on the command line.
# decode_switches reallocates when the number of parameters in sl->list exceeds 5.
# This test exercises the realloc branch.
for my $fl (@flavors) {
$ENV{'MAKEFLAGS'} = '-I1 -Onone --debug=b -l2.5 -I2 -I3 -I4 -I5 -I6 -I2 -I2';
run_make_test("
MAKEFLAGS${fl}B -I1 -Onone --debug=b -l2.5 -I2 -I3 -I4 -I5 -I6 -I2 -I2
all:; \$(info makeflags='\$(MAKEFLAGS)')
",
'-I1 -Onone --debug=b -l2.5 -I2 -I3 -I4 -I5 -I6',
"/makeflags='B -I1 -I2 -I3 -I4 -I5 -I6 -l2.5 -Onone --debug=b'/");
}
# A mix of multiple flags from env, the makefile and command line.
# Skip -L since it's not available everywhere
for my $fl (@flavors) {
$ENV{'MAKEFLAGS'} = 'ikB --no-print-directory --warn-undefined-variables --trace';
run_make_test("
MAKEFLAGS${fl}iknqrswd -Ilocaltmp -Ilocaltmp -Onone -Onone -l2.5 -l2.5
all:; \$(info makeflags='\$(MAKEFLAGS)')
",
'-Onone -l2.5 -l2.5 -Onone -Ilocaltmp -iknqrswd -i -n -s -k -Ilocaltmp',
"/makeflags='Bdiknqrsw -Ilocaltmp -l2.5 -Onone --trace --warn-undefined-variables'/");
}
# Verify MAKEFLAGS are all available to shell function at parse time.
for my $fl (@flavors) {
my $answer = 'Biknqrs -Ilocaltmp -l2.5 -Onone --no-print-directory --warn-undefined-variables';
$ENV{'MAKEFLAGS'} = 'ikB --no-print-directory --warn-undefined-variables';
run_make_test("
MAKEFLAGS${fl}iknqrsw -Ilocaltmp -Ilocaltmp -Onone -Onone -l2.5 -l2.5 --no-print-directory
\$(info at parse time '\$(MAKEFLAGS)')
XX := \$(shell echo \"\$\$MAKEFLAGS\")
all:; \$(info at build time makeflags='\$(XX)')
",
'-Onone -l2.5 -l2.5 -Onone -Ilocaltmp -iknqrs -i -n -s -k -Ilocaltmp',
"at parse time '$answer'
at build time makeflags='$answer'");
}
# Verify MAKEFLAGS and command line definitions are all available to shell function at parse time.
for my $fl (@flavors) {
$ENV{'MAKEFLAGS'} = 'ikB --no-print-directory --warn-undefined-variables';
my $answer = 'Biknqrs -Ilocaltmp -l2.5 -Onone --no-print-directory --warn-undefined-variables -- hello=world';
run_make_test("
MAKEFLAGS${fl}iknqrsw -Ilocaltmp -Ilocaltmp -Onone -Onone -l2.5 -l2.5 --no-print-directory
\$(info at parse time '\$(MAKEFLAGS)')
XX := \$(shell echo \"\$\$MAKEFLAGS\")
all:; \$(info at build time makeflags='\$(XX)')
",
'-Onone -l2.5 -l2.5 -Onone -Ilocaltmp -iknqrs -i -n -s -k -Ilocaltmp hello=world',
"at parse time '$answer'
at build time makeflags='$answer'");
}
# Verify that command line arguments are included in MAKEFLAGS
run_make_test(q!
all: ; @echo $(MAKEFLAGS)
!,
'-e FOO=bar -r -R', 'erR -- FOO=bar');
# Long arguments mean everything is prefixed with "-"
run_make_test(q!
all: ; @echo /$(MAKEFLAGS)/
!,
'--no-print-directory -e -r -R --trace FOO=bar',
"#MAKEFILE#:2: update target 'all' due to: target does not exist
echo /erR --trace --no-print-directory -- FOO=bar/
/erR --trace --no-print-directory -- FOO=bar/");
# sv 63347.
# Verify that command line arguments are included in MAKEFLAGS
# when makefiles are parsed.
my $answer = 'erR -- hello:=world FOO=bar';
run_make_test(q!
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, '-e FOO=bar -r -R hello:=world',
"$answer
$answer
#MAKE#: 'all' is up to date.\n");
# sv 63347.
# Same as above, with makefile setting the value of the same variables as
# defined on the cli.
$answer = 'erR -- hello:=world FOO=bar';
run_make_test(q!
$(info $(MAKEFLAGS))
FOO=moon
hello:=moon
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, '-e FOO=bar -r -R hello:=world',
"$answer
$answer
$answer
#MAKE#: 'all' is up to date.\n");
# sv 63347.
# Same as above, with makefile overriding the value of cli definition.
$answer = 'erR -- hello:=world FOO=bar';
run_make_test(q!
$(info $(MAKEFLAGS))
override FOO=moon
override hello:=moon
export hello
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, '-e FOO=bar -r -R hello:=world',
"$answer
$answer
$answer
#MAKE#: 'all' is up to date.\n");
# Same as above, and makefile overrides the value of cli definition.
# resets MAKEOVERRIDES.
$answer = 'rR -- hello:=world FOO=bar';
run_make_test(q!
$(info $(MAKEFLAGS))
override FOO=moon
override hello:=moon
export hello
$(info $(MAKEFLAGS))
MAKEOVERRIDES=
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, 'FOO=bar -r -R hello:=world',
"$answer
$answer
rR -- \nrR
#MAKE#: 'all' is up to date.\n");
# sv 63347.
# MAKEFLAGS set is env and makefile sets MAKEFLAGS and there is a command
# line definition.
$answer = ' -- bye=moon hello=world';
$ENV{'MAKEFLAGS'} = 'hello=world';
run_make_test(q!
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, 'bye=moon',
" -- bye=moon hello=world
-- bye=moon hello=world
#MAKE#: 'all' is up to date.\n");
# sv 63347.
# Conditional assignment and MAKEFLAGS.
$answer = 'B -- bye=moon hello=world';
$ENV{'MAKEFLAGS'} = 'hello=world';
run_make_test(q!
$(info $(MAKEFLAGS))
MAKEFLAGS?=-k
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, '-B bye=moon',
"$answer
$answer
$answer
#MAKE#: 'all' is up to date.\n");
# sv 63347.
# MAKEFLAGS set is env and makefile sets MAKEFLAGS and there is a command
# line definition.
for my $fl (@flavors) {
my $answer = ' -- bye=moon hello=world';
$ENV{'MAKEFLAGS'} = 'hello=world';
run_make_test("
\$(info \$(MAKEFLAGS))
MAKEFLAGS${fl}R
\$(info \$(MAKEFLAGS))
all:; \$(info \$(MAKEFLAGS))
", 'bye=moon',
"$answer
R$answer
rR$answer
#MAKE#: 'all' is up to date.\n");
}
# sv 63347.
# Test changes introduced by makefiles to MAKEFLAGS.
for my $fl (@flavors) {
my $answer = 'rR --no-print-directory -- hello:=world FOO=bar';
run_make_test(q!
MAKEFLAGS+=--no-print-directory
$(info $(MAKEFLAGS))
MAKEFLAGS+=-k
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, 'FOO=bar -r -R hello:=world',
"$answer
k$answer
k$answer
#MAKE#: 'all' is up to date.\n");
}
# sv 63347.
# Test changes introduced by makefiles to MAKEFLAGS.
# Same as above, but with -e.
for my $fl (@flavors) {
my $answer = 'erR -- hello:=world FOO=bar';
run_make_test(q!
MAKEFLAGS+=--no-print-directory
$(info $(MAKEFLAGS))
MAKEFLAGS+=-k
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, '-e FOO=bar -r -R hello:=world',
"$answer
$answer
$answer
#MAKE#: 'all' is up to date.\n");
}
mkdir('bye', 0777);
create_file('bye/makefile',
'hello=moon
all:; $(info $(hello))');
# sv 63347.
# Test that a cli definition takes precedence over a definition set in
# submake.
run_make_test(q!
v:=$(shell $(MAKE) -C bye --no-print-directory)
all: ; $(info $(v))
!, 'hello=world', "world #MAKE#[1]: 'all' is up to date.\n#MAKE#: 'all' is up to date.");
# Same as above with the shell assignment operator.
run_make_test(q!
v \!= $(MAKE) -C bye --no-print-directory
all: ; $(info $(v))
!, 'hello=world', "world #MAKE#[1]: 'all' is up to date.\n#MAKE#: 'all' is up to date.");
unlink('bye/makefile');
rmdir('bye');
# sv 63347
# Invalid command line variable definition.
run_make_test(q!
all:; $(info $(hello))
!, 'hello=\'$(world\'', "#MAKEFILE#:2: *** unterminated variable reference. Stop.\n", 512);
# sv 63347
# An unused invalid command line variable definition is ignored.
run_make_test(q!
all:; $(info good)
!, 'hello=\'$(world\'', "good\n#MAKE#: 'all' is up to date.\n");
# sv 63537
# Certain switches can be flipped on and off.
# -k/-S, -w/--no-print-directory and -s/--no-silent.
# Test the following aspects of behavior of these switches
# 1. A switch can be enabled or disabled in makefile.
# 2. A switch can be enabled or disabled in env.
# 3. A switch can be enabled or disabled on the command line.
# 4. Command line beats makefile.
# 5. Env beats makefile.
# 6. Command line beats env.
# 7. MAKEFLAGS contains each specified switch at parse and build time.
# 8. If contradicting switches are specified in multiple origins, MAKEFLAGS
# contains the winning switch at parse and build time.
# 9. MAKEFLAGS does not contain the beaten switch.
@flavors = ('=', ':=', ':::=', '+=');
# sv 63537
# -w vs --no-print-directory
# -w on the command line.
run_make_test(q!
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, '-w',
"#MAKE#: Entering directory '#PWD#'
w
w
#MAKE#: 'all' is up to date.
#MAKE#: Leaving directory '#PWD#'\n");
# -w in the env.
$ENV{'MAKEFLAGS'} = '-w';
run_make_test(q!
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, '',
"#MAKE#: Entering directory '#PWD#'
w
w
#MAKE#: 'all' is up to date.
#MAKE#: Leaving directory '#PWD#'\n");
# -w in env, --no-print-directory on the command line.
$ENV{'MAKEFLAGS'} = '-w';
run_make_test(q!
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, '--no-print-directory',
" --no-print-directory
--no-print-directory
#MAKE#: 'all' is up to date.\n");
# --no-print-directory in env, -w on the command line.
$ENV{'MAKEFLAGS'} = '--no-print-directory';
run_make_test(q!
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, '-w',
"#MAKE#: Entering directory '#PWD#'
w
w
#MAKE#: 'all' is up to date.
#MAKE#: Leaving directory '#PWD#'\n");
delete $ENV{'MAKEFLAGS'};
# -w in makefile.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}-w
\$(info \$(MAKEFLAGS))
all:; \$(info \$(MAKEFLAGS))
", '',
"#MAKE#: Entering directory '#PWD#'
w
w
#MAKE#: 'all' is up to date.
#MAKE#: Leaving directory '#PWD#'\n");
}
# sv 63537
# -w in makefile, --no-print-directory on the command line.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}-w
\$(info \$(MAKEFLAGS))
all:; \$(info \$(MAKEFLAGS))
", '--no-print-directory',
" --no-print-directory
--no-print-directory
#MAKE#: 'all' is up to date.\n");
}
mkdir('lib2', 0777);
create_file('lib2/makefile', 'all:; $(info $(MAKEFLAGS))');
# sv 63537
# Default, no -w or --no-print-directory is specified.
run_make_test(q!
all:; $(MAKE) -C lib2
!, '',
"#MAKEPATH# -C lib2
#MAKE#[1]: Entering directory '#PWD#/lib2'
#MAKE#[1]: 'all' is up to date.
#MAKE#[1]: Leaving directory '#PWD#/lib2'\n");
# sv 63537
# --no-print-directory in makefile, -w on the command line.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}--no-print-directory
\$(info \$(MAKEFLAGS))
all:
\t \$(info \$(MAKEFLAGS))
\t \$(MAKE) -C lib2
", '-w',
"#MAKE#: Entering directory '#PWD#'
w
w
#MAKEPATH# -C lib2
#MAKE#[1]: Entering directory '#PWD#/lib2'
w
#MAKE#[1]: 'all' is up to date.
#MAKE#[1]: Leaving directory '#PWD#/lib2'
#MAKE#: Leaving directory '#PWD#'\n");
}
# sv 63537
# --no-print-directory in makefile, -w in the env.
for my $fl (@flavors) {
$ENV{'MAKEFLAGS'} = '-w';
run_make_test("
MAKEFLAGS${fl}--no-print-directory
\$(info \$(MAKEFLAGS))
all:
\t \$(info \$(MAKEFLAGS))
\t \$(MAKE) -C lib2
", '',
"#MAKE#: Entering directory '#PWD#'
w
w
#MAKEPATH# -C lib2
#MAKE#[1]: Entering directory '#PWD#/lib2'
w
#MAKE#[1]: 'all' is up to date.
#MAKE#[1]: Leaving directory '#PWD#/lib2'
#MAKE#: Leaving directory '#PWD#'\n");
}
unlink('lib2/makefile');
rmdir('lib2');
# sv 63537
# -k vs -S.
# -S in env.
$ENV{'MAKEFLAGS'} = '-S';
run_make_test(q!
.RECIPEPREFIX := >
$(info $(MAKEFLAGS))
all: one two
one:
> $(info $(MAKEFLAGS))
> #HELPER# -q fail 1
two:; $(info $@)
!, '',
"S
S
#HELPER# -q fail 1
#MAKE#: *** [#MAKEFILE#:7: one] Error 1", 512);
# -S in env, -k on the command line.
$ENV{'MAKEFLAGS'} = '-S';
run_make_test(q!
.RECIPEPREFIX := >
$(info $(MAKEFLAGS))
all: one two
one:
> $(info $(MAKEFLAGS))
> #HELPER# -q fail 1
two:; $(info $@)
!, '-k',
"k
k
#HELPER# -q fail 1
#MAKE#: *** [#MAKEFILE#:7: one] Error 1
two
#MAKE#: Target 'all' not remade because of errors.", 512);
# -k in env.
$ENV{'MAKEFLAGS'} = '-k';
run_make_test(q!
.RECIPEPREFIX := >
$(info $(MAKEFLAGS))
all: one two
one:
> $(info $(MAKEFLAGS))
> #HELPER# -q fail 1
two:; $(info $@)
!, '',
"k
k
#HELPER# -q fail 1
#MAKE#: *** [#MAKEFILE#:7: one] Error 1
two
#MAKE#: Target 'all' not remade because of errors.", 512);
# -k in env, -S on the command line.
$ENV{'MAKEFLAGS'} = '-k';
run_make_test(q!
.RECIPEPREFIX := >
$(info $(MAKEFLAGS))
all: one two
one:
> $(info $(MAKEFLAGS))
> #HELPER# -q fail 1
two:; $(info $@)
!, '-S',
"S
S
#HELPER# -q fail 1
#MAKE#: *** [#MAKEFILE#:7: one] Error 1", 512);
delete $ENV{'MAKEFLAGS'};
# -k in makefile.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}-k
\$(info \$(MAKEFLAGS))
all: one two
one:
\t \$(info \$(MAKEFLAGS))
\t #HELPER# -q fail 1
two:; \$(info \$@)
", '',
"k
k
#HELPER# -q fail 1
#MAKE#: *** [#MAKEFILE#:7: one] Error 1
two
#MAKE#: Target 'all' not remade because of errors.", 512);
}
# sv 63537
# -k in makefile and -S on the command line.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}-k
\$(info \$(MAKEFLAGS))
all: one two
one:
\t \$(info \$(MAKEFLAGS))
\t #HELPER# -q fail 1
two:; \$(info \$@)
", '-S',
"S
S
#HELPER# -q fail 1
#MAKE#: *** [#MAKEFILE#:7: one] Error 1", 512);
}
# sv 63537
# -k in makefile and -S in the env.
for my $fl (@flavors) {
$ENV{'MAKEFLAGS'} = '-S';
run_make_test("
MAKEFLAGS${fl}-k
\$(info \$(MAKEFLAGS))
all: one two
one:
\t \$(info \$(MAKEFLAGS))
\t #HELPER# -q fail 1
two:; \$(info \$@)
", '',
"S
S
#HELPER# -q fail 1
#MAKE#: *** [#MAKEFILE#:7: one] Error 1", 512);
}
delete $ENV{'MAKEFLAGS'};
# sv 63537
# -S in makefile.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}-S
\$(info \$(MAKEFLAGS))
all: one two
one:
\t \$(info \$(MAKEFLAGS))
\t #HELPER# -q fail 1
two:; \$(info \$@)
", '',
"S
S
#HELPER# -q fail 1
#MAKE#: *** [#MAKEFILE#:7: one] Error 1", 512);
}
# -S in makefile and -k on the command line.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}-S
\$(info \$(MAKEFLAGS))
all: one two
one:
\t \$(info \$(MAKEFLAGS))
\t #HELPER# -q fail 1
two:; \$(info \$@)
", '-k',
"k
k
#HELPER# -q fail 1
#MAKE#: *** [#MAKEFILE#:7: one] Error 1
two
#MAKE#: Target 'all' not remade because of errors.", 512);
}
# sv 63537
# -S in makefile and -k in the env.
for my $fl (@flavors) {
$ENV{'MAKEFLAGS'} = '-k';
run_make_test("
MAKEFLAGS${fl}-S
\$(info \$(MAKEFLAGS))
all: one two
one:
\t \$(info \$(MAKEFLAGS))
\t #HELPER# -q fail 1
two:; \$(info \$@)
", '',
"k
k
#HELPER# -q fail 1
#MAKE#: *** [#MAKEFILE#:7: one] Error 1
two
#MAKE#: Target 'all' not remade because of errors.", 512);
}
# sv 63537
# -s vs --no-silent.
# -s in env.
$ENV{'MAKEFLAGS'} = '-s';
run_make_test(q!
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, '', "s\ns");
# -s in env, --no-silent on the command line.
$ENV{'MAKEFLAGS'} = '-s';
run_make_test(q!
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, '--no-silent',
" --no-silent
--no-silent
#MAKE#: 'all' is up to date.\n");
# --no-silent in env.
$ENV{'MAKEFLAGS'} = '--no-silent';
run_make_test(q!
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, '',
" --no-silent
--no-silent
#MAKE#: 'all' is up to date.\n");
# --no-silent in env, -s on the command line.
$ENV{'MAKEFLAGS'} = '--no-silent';
run_make_test(q!
$(info $(MAKEFLAGS))
all:; $(info $(MAKEFLAGS))
!, '-s', "s\ns");
delete $ENV{'MAKEFLAGS'};
# -s in the makefile.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}-s
\$(info \$(MAKEFLAGS))
all:; \$(info \$(MAKEFLAGS))
", '', "s\ns");
}
# sv 63537
# -s in makefile and --no-silent on the command line.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}-s
\$(info \$(MAKEFLAGS))
all:; \$(info \$(MAKEFLAGS))
", '--no-silent',
" --no-silent
--no-silent
#MAKE#: 'all' is up to date.\n");
}
# sv 63537
# -s in makefile and --no-silent in the env.
for my $fl (@flavors) {
$ENV{'MAKEFLAGS'} = '--no-silent';
run_make_test("
MAKEFLAGS${fl}-s
\$(info \$(MAKEFLAGS))
all:; \$(info \$(MAKEFLAGS))
", '',
" --no-silent
--no-silent
#MAKE#: 'all' is up to date.\n");
}
delete $ENV{'MAKEFLAGS'};
# sv 63537
# --no-silent in makefile.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}--no-silent
\$(info \$(MAKEFLAGS))
all:; \$(info \$(MAKEFLAGS))
", '',
" --no-silent
--no-silent
#MAKE#: 'all' is up to date.\n");
}
# sv 63537
# --no-silent in makefile and -s on the command line.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}--no-silent
\$(info \$(MAKEFLAGS))
all:; \$(info \$(MAKEFLAGS))
", '-s', "s\ns");
}
# sv 63537
# --no-silent in makefile and -s in the env.
for my $fl (@flavors) {
$ENV{'MAKEFLAGS'} = '-s';
run_make_test("
MAKEFLAGS${fl}--no-silent
\$(info \$(MAKEFLAGS))
all:; \$(info \$(MAKEFLAGS))
", '', "s\ns");
}
delete $ENV{'MAKEFLAGS'};
# sv 63537
# Multiple --debug switches from various origins are all combined.
# Because run_make_test regex matching facility does not allow to match against
# multiple lines, run the test twice. During the first run match the output of
# --debug=b, during the second run match the output of --debug=-j.
#
# --debug=b in makefile.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}--debug=b
hello:; touch \$@
.PHONY: hello
", '', "/Updating makefiles/");
}
# --debug=b in makefile, --debug=j on the command line.
# Test for --debug=j output.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}--debug=b
hello:; touch \$@
.PHONY: hello
", '--debug=j', "/Putting child/");
}
# --debug=b in makefile, --debug=j on the command line.
# Test for --debug=b output.
for my $fl (@flavors) {
run_make_test("
MAKEFLAGS${fl}--debug=b
hello:; touch \$@
.PHONY: hello
", '--debug=j', "/Updating makefiles/");
}
# --debug=j in makefile, --debug=b on the command line.
# Test that MAKEFLAGS contains --debug=b.
run_make_test(q!
MAKEFLAGS=--debug=j
$(info makeflags=$(MAKEFLAGS))
hello:; touch $@
.PHONY: hello
!, '--debug=b', "/makeflags= --debug=b/");
# --debug=b in makefile, --debug=j in the env.
# Test for --debug=j output.
for my $fl (@flavors) {
$ENV{'MAKEFLAGS'} = '--debug=j';
run_make_test("
MAKEFLAGS${fl}--debug=b
hello:; touch \$@
.PHONY: hello
", '', "/Putting child/");
}
# --debug=b in makefile, --debug=j in the env.
# Test for --debug=b output.
for my $fl (@flavors) {
$ENV{'MAKEFLAGS'} = '--debug=j';
run_make_test("
MAKEFLAGS${fl}--debug=b
hello:; touch \$@
.PHONY: hello
", '', "/Updating makefiles/");
}
unlink('hello');
rmdir('localtmp');
# This tells the test driver that the perl test script executed properly.
1;
|