if 844 B

12345678910111213141516171819202122232425262728293031
  1. # -*-perl-*-
  2. $description = "Test the if function.\n";
  3. $details = "Try various uses of if and ensure they all give the correct
  4. results.\n";
  5. open(MAKEFILE, "> $makefile");
  6. print MAKEFILE <<EOMAKE;
  7. NEQ = \$(subst \$1,,\$2)
  8. all:
  9. \t\@echo \$(if ,true,false)
  10. \t\@echo \$(if ,true,)
  11. \t\@echo \$(if ,true)
  12. \t\@echo \$(if z,true,false)
  13. \t\@echo \$(if z,true,\$(shell echo hi))
  14. \t\@echo \$(if ,\$(shell echo hi),false)
  15. \t\@echo \$(if \$(call NEQ,a,b),true,false)
  16. \t\@echo \$(if \$(call NEQ,a,a),true,false)
  17. \t\@echo \$(if z,true,fal,se) hi
  18. \t\@echo \$(if ,true,fal,se)there
  19. EOMAKE
  20. close(MAKEFILE);
  21. &run_make_with_options($makefile, "", &get_logfile);
  22. $answer = "false\n\n\ntrue\ntrue\nfalse\ntrue\nfalse\ntrue hi\nfal,sethere\n";
  23. &compare_output($answer, &get_logfile(1));
  24. 1;