Makefile 6.0 KB

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