MPWMake 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. # Make file for MPW make.
  2. # To run it, use:
  3. # Make <target> -f MPWMake > Makeout ; Makeout
  4. # where <target> should be replaced with actual make target.
  5. #Possible options:
  6. DOTEST = :utils:DoTest
  7. FPC = ppcppc
  8. #OPT
  9. TEST_FPC = ::compiler:ppcppc
  10. TEST_OS_TARGET = macos
  11. TEST_CPU_TARGET = powerpc
  12. TEST_FULL_TARGET = {TEST_CPU_TARGET}-{TEST_OS_TARGET}
  13. #TEST_OPT
  14. # Target dir where the ppu and binaries are created:
  15. TEST_OUTPUTDIR = :output:{TEST_FULL_TARGET}
  16. TESTSUBDIRS = : :cg: :cg:cdecl: :units:system: :units:dos: :units:crt: :units:objects: :units:strings: :units:sysutils: :units:math:
  17. DIRS = :webtbs: :webtbf: :tbs: :tbf: :test: :test:cg: :test:cg:cdecl: :test:units:system: :test:units:dos: :test:units:crt: :test:units:objects: :test:units:strings: :test:units:sysutils: :test:units:math:
  18. ################################
  19. # Utilities
  20. #
  21. :utils:dotest Ä :utils:dotest.pp :utils:redir.pp
  22. "{FPC}" -WT "{OPT}" -FE:utils: :utils:dotest.pp
  23. :utils:digest Ä :utils:digest.pp
  24. "{FPC}" -WT "{OPT}" -FE:utils: :utils:digest.pp
  25. :utils:fail Ä :utils:fail.pp
  26. "{FPC}" -WT "{OPT}" -FE:utils: :utils:fail.pp
  27. :utils:testfail Ä :utils:testfail.pp
  28. "{FPC}" -WT "{OPT}" -FE:utils: :utils:testfail.pp
  29. utils Ä
  30. Set Exit 0
  31. Set isMade ''
  32. Set isMade :utils:fpcmade.Å > Dev:Null
  33. Set Exit 1
  34. If "{isMade}" == ':utils:fpcmade.powerpc-macos'
  35. #Echo utils macos made
  36. Else If "{isMade}" == ''
  37. #Echo utils not made
  38. Make utilsbuild -f MPWMake > Makeout2 ; Makeout2
  39. Else
  40. #Echo utils made by other
  41. Make clean_utils -f MPWMake > Makeout2 ; Makeout2
  42. Make utilsbuild -f MPWMake > Makeout2 ; Makeout2
  43. End
  44. utilsbuild Ä :utils:dotest :utils:digest :utils:fail :utils:testfail
  45. Echo Compiled > :utils:fpcmade.powerpc-macos
  46. ################################
  47. # Units
  48. #
  49. units Ä
  50. Set TEMP_FPC `Files -f "{TEST_FPC}"`
  51. Directory :units:
  52. Make all -f MPWMake -d FPC={TEMP_FPC} -d OPT={TEST_OPT} > Makeout ; Makeout
  53. Directory ::
  54. ################################
  55. # Copy test environment dependent files ctest.o to test/cg etc
  56. #
  57. copyfiles Ä {TEST_OUTPUTDIR}
  58. Duplicate -y :test:cg:obj:{TEST_OS_TARGET}:{TEST_CPU_TARGET}:ctest.o :test:cg
  59. Set Exit 0
  60. NewFolder {TEST_OUTPUTDIR}:test
  61. NewFolder {TEST_OUTPUTDIR}:test:units
  62. NewFolder {TEST_OUTPUTDIR}:test:units:system
  63. Set Exit 1
  64. Duplicate -y :test:units:system:testÅ.txt {TEST_OUTPUTDIR}:test:units:system
  65. ################################
  66. # Preparation for tests
  67. #
  68. testprep Ä testprep-stamp.{TEST_FULL_TARGET}
  69. testprep-stamp.{TEST_FULL_TARGET} Ä {TEST_OUTPUTDIR} utils units copyfiles
  70. Echo `Date` > testprep-stamp.{TEST_FULL_TARGET}
  71. {TEST_OUTPUTDIR} Ä
  72. Set Exit 0
  73. NewFolder :output
  74. NewFolder {TEST_OUTPUTDIR}
  75. Set Exit 1
  76. ################################
  77. # Dotest options
  78. #
  79. ################################
  80. # Run tests
  81. #
  82. # Because MPW Make lacks some features, it has to be done as below:
  83. #
  84. allexectest allexectbs allexectbf allexecwebtbs allexecwebtbf Ä testprep
  85. (Evaluate "{Targ}" =~ /allexec(Å)¨1/) > Dev:Null
  86. #Assembles, links and run tests of FreePascal
  87. Set testdir ":{¨1}"
  88. #Iterate through tests
  89. If {testdir} == :test
  90. Set subdirlist "{TESTSUBDIRS}"
  91. Else
  92. Set subdirlist :
  93. End
  94. Set Exit 0 # To handle the case, in the for stmt, when there is no match
  95. #
  96. For subdir In {subdirlist}
  97. For sourceWithExt In {testdir}{subdir}tÅ.pp #only test files, which begins with a 't'
  98. Set Exit 1 #Revert error handling
  99. #
  100. (Evaluate "{sourceWithExt}" =~ /(([Â.])*)¨1Å/) > Dev:Null
  101. Set apppath {¨1}
  102. (Evaluate "{apppath}" =~ /Å:([Â:]*)¨1/) > Dev:Null
  103. Set appname {¨1}
  104. #
  105. If NOT "`Exists :output:powerpc-macos{apppath}.elg`"
  106. # Compile and perform the test
  107. Echo Testing: "{apppath}"
  108. :utils:DoTest {DOTESTOPT} -E -X -C{TEST_FPC} "{apppath}.pp"
  109. End
  110. Set Exit 0 # To handle the case, in the for stmt, when there is no match
  111. End
  112. End
  113. Set Exit 1 #Revert error handling
  114. allexectests Ä allexectest allexectbs allexectbf allexecwebtbs allexecwebtbf
  115. ################################
  116. # Clean
  117. #
  118. clean_test Ä
  119. Set Exit 0 # To handle the case, when there is no match
  120. #
  121. Delete -y -i {TEST_OUTPUTDIR}
  122. #
  123. Delete -y -i testÅ.txt Å.tmp core
  124. #Delete -y #TODO shared library extension
  125. Delete -y -i ppas gmon.out testprep-stamp.*
  126. Delete -y -i Å_ppas
  127. #
  128. Set Exit 1 #Revert error handling
  129. clean Ä clean_test
  130. Directory :units
  131. Make clean -f MPWMake > Makeout; Makeout
  132. Directory ::
  133. clean_utils Ä
  134. Set Exit 0 # To handle the case, when there is no match
  135. Delete -y :utils:fpcmade.Å
  136. Delete -y :utils:dotest :utils:digest :utils:fail :utils:testfail
  137. Delete -y :utils:Å.o :utils:Å.ppu :utils:Å.xcoff
  138. Set Exit 1 #Revert error handling
  139. distclean Ä clean clean_utils
  140. cleanall Ä clean clean_utils
  141. # Directory :utils
  142. # Make cleanall -f MPWMake > Makeout; Makeout
  143. # Directory ::
  144. ################################
  145. # Main rules
  146. #
  147. digest Ä utils
  148. :utils:digest {TEST_OUTPUTDIR}:log
  149. all Ä allexectests
  150. full Ä clean allexectests digest