Makefile 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. #
  2. # $Id$
  3. #
  4. # make all test
  5. # and printout errors
  6. all : info
  7. tests : clean all_compilations
  8. cont_tests : all_compilations
  9. ifdef DJGPP
  10. EXEEXT=.exe
  11. getreturncode :
  12. redir -ea $(FILE).log -oa $(FILE).log getret $(COMMAND)
  13. cp retcode $(FILE).$(RESEXT)
  14. else
  15. EXEEXT=
  16. getreturncode :
  17. getret $(COMMAND) > $(FILE).log 2>$(FILE).log
  18. cp retcode $(FILE).$(RESEXT)
  19. @echo "Return code of $(FILE) is $(cat retcode)"
  20. endif
  21. # retcode should be between 0 and 255
  22. # 256 is for halt
  23. # 512+doserror if doserror<>0
  24. # 1024 RESFILE does not exist
  25. # 2048 RESFILE is not set
  26. ifndef RESFILE
  27. RETVAL=2048
  28. else
  29. ifeq ($(wildcard $(RESFILE)*),$(RESFILE))
  30. RETVAL=$(shell cat $(RESFILE))
  31. else
  32. RETVAL=1024
  33. endif
  34. endif
  35. ifeq ($(RETVAL),0)
  36. testsuccess:
  37. @echo "Test for $(FILE) success (compiles)"
  38. @echo "Test for $(FILE) success (compiles)" >>log
  39. else
  40. testsuccess:
  41. @echo "Test for $(FILE) fails (does not compile) error $(RETVAL)"
  42. @echo "Test for $(FILE) fails (does not compile) error $(RETVAL)" >>log
  43. @echo $(FILE) >> ts_fail
  44. @echo $(FILE) >> faillist
  45. endif
  46. ifdef EXCFILE
  47. ifeq ($(wildcard $(EXCFILE)*),$(EXCFILE))
  48. EXERETVAL:=$(shell cat $(EXCFILE))
  49. else
  50. EXERETVAL=$(EXCFILE) does not exist
  51. endif
  52. else
  53. EXERETVAL=No EXCFILE variable defined
  54. endif
  55. ifeq ($(EXERETVAL),0)
  56. testexecsuccess:
  57. @echo "Test for exec $(FILE) success (runs without error)"
  58. @echo "Test for $(FILE) success (runs without error)" >>log
  59. else
  60. testexecsuccess:
  61. @echo "Test for exec $(FILE) fails exec error $(EXERETVAL)"
  62. @echo "Test for exec $(FILE) fails exec error $(EXERETVAL)" >>log
  63. endif
  64. ifeq ($(wildcard $(FILE)$(EXEEXT)),$(FILE)$(EXEEXT))
  65. testexec:
  66. @echo "Testing $(FILE)$(EXEEXT)"
  67. ifdef NOREDIR
  68. getret $(FILE)$(EXEEXT)
  69. else
  70. ifdef DJGPP
  71. redir -e $(FILE).elg -o $(FILE).elg getret $(FILE)$(EXEEXT)
  72. else
  73. getret $(FILE)$(EXEEXT) > $(FILE).elg 2>$(FILE).elg
  74. endif
  75. endif
  76. cp -f retcode $(FILE).exc
  77. $(MAKE) testexecsuccess 'FILE=$(FILE)' 'EXCFILE=$(FILE).exc'
  78. else
  79. testexec:
  80. @echo "No exefile $(FILE)$(EXEEXT)"
  81. @echo $(FILE) >> faillist
  82. endif
  83. test_exc :
  84. @echo $(wildcard $(FILE).exc*)
  85. @echo xx$(wildcard $(EXCFILE)*)xx xx$(EXCFILE)xx
  86. cat $(FILE).exc
  87. ifneq ($(RETVAL),0)
  88. testfail:
  89. @echo "Test for $(FILE) success (does not compile) error $(RETVAL)"
  90. @echo "Test for $(FILE) success (does not compile) error $(RETVAL)" >> log
  91. else
  92. testfail:
  93. @echo "Test for $(FILE) fails (does compile and should not)"
  94. @echo "Test for $(FILE) fails (does compile and should not)" >> log
  95. @echo $(FILE) >> tf_fail
  96. @echo $(FILE) >> faillist
  97. endif
  98. ifndef PP
  99. PP=ppc386
  100. else
  101. export PP
  102. endif
  103. ifndef OPT
  104. OPT=
  105. endif
  106. ifdef FILE
  107. OPTFILE=$(wildcard $(FILE).opt)
  108. endif
  109. ifdef OPTFILE
  110. override OPT+=$(OPTFILE)
  111. endif
  112. ifndef FILE
  113. FILE=ts00001.pp
  114. endif
  115. testone :
  116. $(MAKE) getreturncode 'COMMAND=$(PP) $(OPT) $(FILE).pp' 'RESEXT=$(RESEXT)' 'FILE=$(FILE)'
  117. %.res : %.pp
  118. $(MAKE) testone 'FILE=$*' 'RESEXT=res'
  119. $(MAKE) testsuccess 'FILE=$*' 'RESFILE=$*.res'
  120. %.ref : %.pp
  121. $(MAKE) testone 'FILE=$*' 'RESEXT=ref'
  122. $(MAKE) testfail 'FILE=$*' 'RESFILE=$*.ref'
  123. # exec log files
  124. # creates two files
  125. # *.elg log file
  126. # *.exc exicode of program
  127. %.elg : %.res
  128. $(MAKE) testexec 'FILE=$*'
  129. %.eli : %.res
  130. $(MAKE) testexec 'FILE=$*' 'NOREDIR=YES'
  131. allts : $(patsubst %.pp,%.res,$(wildcard ts*.pp))
  132. alltbs : $(patsubst %.pp,%.res,$(wildcard tbs*.pp))
  133. alltest : $(patsubst %.pp,%.res,$(wildcard test*.pp))
  134. alltesi : $(patsubst %.pp,%.res,$(wildcard tesi*.pp))
  135. alltis : $(patsubst %.pp,%.res,$(wildcard tis*.pp))
  136. alltf : $(patsubst %.pp,%.ref,$(wildcard tf*.pp))
  137. alltbf : $(patsubst %.pp,%.ref,$(wildcard tbf*.pp))
  138. allto : $(patsubst %.pp,%.res,$(wildcard to*.pp))
  139. ifndef TS_FAIL_LIST
  140. ifeq ($(wildcard ts_fail*),ts_fail)
  141. TS_FAIL_LIST=$(shell cat ts_fail)
  142. export TS_FAIL_LIST
  143. endif
  144. endif
  145. ifndef TF_FAIL_LIST
  146. ifeq ($(wildcard tf_fail*),tf_fail)
  147. TF_FAIL_LIST=$(shell cat tf_fail)
  148. export TF_FAIL_LIST
  149. endif
  150. endif
  151. clean_fail :
  152. -rm -f $(addsuffix .res,$(TS_FAIL_LIST))
  153. -rm -f $(addsuffix .ref,$(TF_FAIL_LIST))
  154. -rm log
  155. again : clean_fail $(addsuffix .res,$(TS_FAIL_LIST)) $(addsuffix .ref,$(TF_FAIL_LIST))
  156. grep fails log
  157. all_compilations : allts alltbs alltf alltbf allto alltest alltesi alltis
  158. grep fails log
  159. allexec : alltsexec alltbsexec alltestexec
  160. grep "fails exec" log
  161. alltestexec: $(patsubst %.pp,%.elg,$(wildcard test*.pp))
  162. # these test are interactive
  163. # no redirection !!!
  164. alltesiexec: $(patsubst %.pp,%.eli,$(wildcard test*.pp))
  165. alltsexec: $(patsubst %.pp,%.elg,$(wildcard ts*.pp))
  166. alltbsexec: $(patsubst %.pp,%.elg,$(wildcard tbs*.pp))
  167. alltisexec: $(patsubst %.pp,%.eli,$(wildcard tis*.pp))
  168. clean :
  169. -rm -f *.re* *.o *.ppu *.log *.elg *.exc t*.exe log faillist ts_fail tf_fail
  170. -rm -f ppas.sh ppas.bat retcode
  171. ifndef DJGPP
  172. -rm -f $(patsubst %.pp,%,$(wildcard *.pp))
  173. endif
  174. info :
  175. @echo This Makefile allows to test the compiler
  176. @echo compilation of 'ts*.pp' should succeed
  177. @echo compilation of 'tf*.pp' should fail
  178. @echo compilation of 'test*.pp' should succeed
  179. @echo 'to*.pp' files should also compile
  180. @echo simply run \'make tests\' to test all compilation
  181. @echo run \'make allexec\' to test also if the executables
  182. @echo created behave like the should
  183. @echo run \'make tesiexec\' to test executables
  184. @echo that require interactive mode
  185. #
  186. # $Log$
  187. # Revision 1.6 1999-10-13 12:42:09 pierre
  188. # * small fixes for win32
  189. #
  190. # Revision 1.5 1999/09/19 11:48:18 peter
  191. # * remove ppas and retcode
  192. #
  193. # Revision 1.4 1999/09/19 11:23:06 peter
  194. # * clean also the executables under linux
  195. #
  196. # Revision 1.3 1999/06/01 13:27:27 peter
  197. # * updates for linux
  198. #
  199. # Revision 1.2 1999/06/01 00:06:14 peter
  200. # * linux fixes
  201. #
  202. # Revision 1.1 1999/01/25 20:23:04 peter
  203. # * linux updates
  204. #
  205. # Revision 1.12 1999/01/19 18:01:43 pierre
  206. # local change removed
  207. #
  208. # Revision 1.11 1999/01/19 17:34:01 pierre
  209. # several modifications
  210. #
  211. # Revision 1.10 1999/01/15 17:41:58 pierre
  212. # + new bugs converted
  213. #
  214. # Revision 1.9 1998/11/10 11:13:07 pierre
  215. # * more tests
  216. #
  217. # Revision 1.8 1998/10/28 09:52:26 pierre
  218. # * see readme.txt
  219. #
  220. # Revision 1.7 1998/10/22 16:41:11 pierre
  221. # * added two small tests
  222. # iocheck inside iocheck
  223. # enums inside objects
  224. #
  225. # Revision 1.6 1998/10/22 14:35:40 pierre
  226. # + added allexec tests if executables compiled
  227. # don't return with an error code
  228. # * some changes in test files for dos
  229. #
  230. # Revision 1.5 1998/10/21 16:24:16 pierre
  231. # + tests to check if filename exists
  232. #
  233. # Revision 1.4 1998/10/21 12:14:30 pierre
  234. # * stupid error removing getret.exe each time
  235. #
  236. # Revision 1.3 1998/10/21 12:12:09 pierre
  237. # Log inserted
  238. #