makefile 5.5 KB

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