conditionals 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # -*-perl-*-
  2. $description = "Check GNU make conditionals.";
  3. $details = "Attempt various different flavors of GNU make conditionals.";
  4. open(MAKEFILE,"> $makefile");
  5. # The Contents of the MAKEFILE ...
  6. print MAKEFILE <<'EOMAKE';
  7. objects = foo.obj
  8. arg1 = first
  9. arg2 = second
  10. arg3 = third
  11. arg4 = cc
  12. arg5 = second
  13. all:
  14. ifeq ($(arg1),$(arg2))
  15. @echo arg1 equals arg2
  16. else
  17. @echo arg1 NOT equal arg2
  18. endif
  19. ifeq '$(arg2)' "$(arg5)"
  20. @echo arg2 equals arg5
  21. else
  22. @echo arg2 NOT equal arg5
  23. endif
  24. ifneq '$(arg3)' '$(arg4)'
  25. @echo arg3 NOT equal arg4
  26. else
  27. @echo arg3 equal arg4
  28. endif
  29. ifndef undefined
  30. @echo variable is undefined
  31. else
  32. @echo variable undefined is defined
  33. endif
  34. ifdef arg4
  35. @echo arg4 is defined
  36. else
  37. @echo arg4 is NOT defined
  38. endif
  39. EOMAKE
  40. close(MAKEFILE);
  41. &run_make_with_options($makefile,"",&get_logfile,0);
  42. # Create the answer to what should be produced by this Makefile
  43. $answer = "arg1 NOT equal arg2
  44. arg2 equals arg5
  45. arg3 NOT equal arg4
  46. variable is undefined
  47. arg4 is defined
  48. ";
  49. # COMPARE RESULTS
  50. &compare_output($answer,&get_logfile(1));
  51. # This tells the test driver that the perl test script executed properly.
  52. 1;