Makefile 5.8 KB

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