patspecific_vars 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # -*-perl-*-
  2. $description = "Test pattern-specific variable settings.";
  3. $details = "\
  4. Create a makefile containing various flavors of pattern-specific variable
  5. settings, override and non-override, and using various variable expansion
  6. rules, semicolon interference, etc.";
  7. open(MAKEFILE,"> $makefile");
  8. print MAKEFILE <<'EOF';
  9. all: one.x two.x three.x
  10. FOO = foo
  11. BAR = bar
  12. BAZ = baz
  13. thr% : override BAZ = three
  14. t%.x: BAR = four
  15. %.x: BAR = two
  16. %.x: override BAZ = three
  17. one.x: override FOO = one
  18. one.x two.x three.x: ; @echo $(FOO) $(BAR) $(BAZ)
  19. four.x: baz ; @echo $(FOO) $(BAR) $(BAZ)
  20. baz: ; @echo $(FOO) $(BAR) $(BAZ)
  21. EOF
  22. close(MAKEFILE);
  23. # TEST #1 -- basics
  24. &run_make_with_options($makefile, "", &get_logfile);
  25. $answer = "one two three\nfoo four baz\nfoo bar three\n";
  26. &compare_output($answer,&get_logfile(1));
  27. # TEST #2 -- try the override feature
  28. &run_make_with_options($makefile, "BAZ=five", &get_logfile);
  29. $answer = "one two three\nfoo four five\nfoo bar three\n";
  30. &compare_output($answer,&get_logfile(1));
  31. # TEST #3 -- make sure patterns are inherited properly
  32. &run_make_with_options($makefile, "four.x", &get_logfile);
  33. $answer = "foo two three\nfoo two three\n";
  34. &compare_output($answer,&get_logfile(1));
  35. 1;