Makefile.fpc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. #
  2. # Makefile.fpc for Free Pascal units, which participates in the tests
  3. #
  4. [target]
  5. [install]
  6. fpcpackage=y
  7. [clean]
  8. units = erroru popuperr ptest
  9. [compiler]
  10. targetdir=$(TARGETSUFFIX)
  11. [default]
  12. fpcdir=../..
  13. [rules]
  14. .NOTPARALLEL:
  15. .PHONY: rtl extra fpcunit packages all clean distclean clean_ctest
  16. .PHONY: cleanrtl distcleanrtl
  17. .PHONY: cleanfpcunit distcleanfpcunit
  18. .PHONY: cleanpackages distcleanpackages
  19. TESTOPT:=-n -FE$(COMPILER_TARGETDIR) -T$(OS_TARGET) $(OPT)
  20. ifeq ($(CPU_TARGET),armeb)
  21. override TESTOPT+=-Cb
  22. endif
  23. ifneq ($(BINUTILSPREFIX),)
  24. override TESTOPT+=-XP$(BINUTILSPREFIX) -Xc
  25. endif
  26. ifeq ($(OS_TARGET),msdos)
  27. override TESTOPT+=-CX
  28. endif
  29. TESTCOMPILER:=$(FPC) $(TESTOPT)
  30. ifdef CROSSCOMPILE
  31. override CROSSOPT:=$(OPT)
  32. override OPT=
  33. override BUILDFULLNATIVE=
  34. endif
  35. #############################
  36. # RTL
  37. #
  38. DUMMYINSTALLDIR=$(BASEDIR)/tmp
  39. INSTALLOPT=INSTALL_PREFIX=$(DUMMYINSTALLDIR) INSTALL_UNITDIR=$(BASEDIR)/$(COMPILER_TARGETDIR)
  40. rtl-stamp.$(FULL_TARGET):
  41. ifneq ($(inOS2),)
  42. $(MAKE) -C ../../rtl all "OPT=$(OPT) -n" "CROSSOPT=$(CROSSOPT)"
  43. else
  44. $(MAKE) -C ../../rtl all 'OPT=$(OPT) -n' 'CROSSOPT=$(CROSSOPT)'
  45. endif
  46. $(MAKE) -C ../../rtl install $(INSTALLOPT) OPT= CROSSOPT=
  47. $(ECHO) Compiled > rtl-stamp.$(FULL_TARGET)
  48. cleanrtl:
  49. $(DELTREE) $(COMPILER_TARGETDIR)
  50. $(DELTREE) $(DUMMYINSTALLDIR)
  51. -$(DEL) rtl-stamp.$(FULL_TARGET)
  52. distcleanrtl: cleanrtl
  53. rtl : rtl-stamp.$(FULL_TARGET)
  54. #############################
  55. # FPCUnit
  56. #
  57. DUMMYINSTALLDIR=$(BASEDIR)/tmp
  58. INSTALLOPT=INSTALL_PREFIX=$(DUMMYINSTALLDIR) INSTALL_UNITDIR=$(BASEDIR)/$(COMPILER_TARGETDIR)
  59. FPCUNITDIR=$(FPCDIR)/packages/fcl-fpcunit/src
  60. fpcunit-stamp.$(FULL_TARGET):
  61. ifneq ($(OS_TARGET),msdos)
  62. ifneq ($(CPU_TARGET),avr)
  63. ifneq ($(CPU_TARGET),jvm)
  64. $(TESTCOMPILER) -Fu$(BASEDIR)/$(COMPILER_TARGETDIR) $(FPCUNITDIR)/testutils
  65. $(TESTCOMPILER) -Fu$(BASEDIR)/$(COMPILER_TARGETDIR) $(FPCUNITDIR)/fpcunit
  66. endif
  67. endif
  68. endif
  69. $(ECHO) Compiled > fpcunit-stamp.$(FULL_TARGET)
  70. cleanfpcunit:
  71. $(DELTREE) $(COMPILER_TARGETDIR)
  72. $(DELTREE) $(DUMMYINSTALLDIR)
  73. -$(DEL) fpcunit-stamp.$(FULL_TARGET)
  74. distcleanfpcunit: cleanfpcunit
  75. $(MAKE) -C $(FPCUNITDIR)/.. clean
  76. fpcunit : fpcunit-stamp.$(FULL_TARGET)
  77. #############################
  78. # Packages
  79. #
  80. DUMMYINSTALLDIR=$(BASEDIR)/tmp
  81. INSTALLOPT=INSTALL_PREFIX=$(DUMMYINSTALLDIR) INSTALL_UNITDIR=$(BASEDIR)/$(COMPILER_TARGETDIR)
  82. PACKAGESDIR=$(FPCDIR)/packages
  83. packages-stamp.$(FULL_TARGET):
  84. ifneq ($(inOS2),)
  85. $(MAKE) -C ../../packages all "OPT=$(OPT) -n" "CROSSOPT=$(CROSSOPT)"
  86. else
  87. $(MAKE) -C ../../packages all 'OPT=$(OPT) -n' 'CROSSOPT=$(CROSSOPT)'
  88. endif
  89. $(MAKE) -C ../../packages install $(INSTALLOPT) OPT= CROSSOPT=
  90. $(ECHO) Compiled > packages-stamp.$(FULL_TARGET)
  91. cleanpackages:
  92. $(DELTREE) $(COMPILER_TARGETDIR)
  93. $(DELTREE) $(DUMMYINSTALLDIR)
  94. -$(DEL) packages-stamp.$(FULL_TARGET)
  95. distcleanpackages: cleanpackages
  96. packages : packages-stamp.$(FULL_TARGET)
  97. #############################
  98. # Extra units
  99. #
  100. erroru$(PPUEXT) : erroru.pp
  101. $(TESTCOMPILER) erroru.pp
  102. ptest$(PPUEXT) : ../test/cg/ptest.pp
  103. ifneq ($(OS_TARGET),msdos)
  104. $(TESTCOMPILER) ../test/cg/ptest.pp
  105. endif
  106. popuperr$(PPUEXT) : popuperr.pp
  107. $(TESTCOMPILER) popuperr.pp
  108. ifdef CCOMPILER
  109. ctest: ../test/cg/obj/ctest.c
  110. $(CCOMPILER) -c -o ../test/cg/obj/$(OS_TARGET)/$(CPU_TARGET)/ctest.o ../test/cg/obj/ctest.c
  111. else
  112. ctest:
  113. @$(ECHO) "No C compiler found"
  114. @exit 1
  115. endif
  116. extra : erroru$(PPUEXT) ptest$(PPUEXT) popuperr$(PPUEXT)
  117. #####################################################################
  118. # PPU testing targets
  119. #####################################################################
  120. PPULIST:=$(wildcard */*.ppu) $(wildcard units/*/*.ppu)
  121. PPULOGLIST:=$(subst .ppu,.log-ppu,$(PPULIST))
  122. RMPPULOGLIST:=$(subst .ppu,.rm-log-ppu,$(PPULIST))
  123. .PHONY : ppulogs cleanppulogs testppudump $(RMPPULOGLIST)
  124. ppulogs : $(PPULOGLIST)
  125. vpath %.ppu $(ALLPPUDIRS)
  126. vpath %.log-ppu $(ALLPPUDIRS)
  127. vpath %.rm-log-ppu $(ALLPPUDIRS)
  128. %.log-ppu : %.ppu ../../compiler/utils/ppudump$(EXEEXT)
  129. ..$(PATHSEP)..$(PATHSEP)compiler$(PATHSEP)utils$(PATHSEP)ppudump -VA -M $< > $@
  130. %.rm-log-ppu : %.ppu ../../compiler/utils/ppudump$(EXEEXT)
  131. -$(RMPROG) $<
  132. ../../compiler/utils/ppudump$(EXEEXT):
  133. $(MAKE) -C $(COMPILERDIR)/utils ppudump$(EXEEXT)
  134. ppuinfo :
  135. echo PPU list is "$(PPULIST)"
  136. echo PPULOG list is "$(PPULOGLIST)"
  137. cleanppulogs : $(RMPPULOGLIST)
  138. testppudump :
  139. $(MAKE) cleanppulogs ppulogs
  140. #############################
  141. # Main rules
  142. #
  143. ifdef QUICKTEST
  144. all : rtl fpcunit extra
  145. else
  146. all : rtl fpcunit packages extra
  147. endif
  148. STAMPFILES=$(wildcard *stamp*)
  149. TEMPDIRS=$(wildcard $(MAKEFILETARGETS) tmp)
  150. clean : cleanrtl cleanall cleanfpcunit cleanpackages
  151. distclean : clean distcleanrtl distcleanfpcunit distcleanpackages
  152. -$(DELTREE) $(TEMPDIRS)
  153. -$(DELTREE) $(BASEDIR)/units
  154. -$(DEL) $(STAMPFILES)
  155. clean_ctest :
  156. -$(DEL) ../test/cg/obj/$(OS_TARGET)/$(CPU_TARGET)/ctest.o