Makefile.fpc 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. #
  2. # Makefile.fpc for Free Pascal Embedded RTL
  3. #
  4. [package]
  5. main=rtl
  6. [target]
  7. loaders=$(LOADERS)
  8. # not all targets include enough features to build all units so
  9. # the common units which are not compiled for all CPUs are stored in
  10. # CPU_SPECIFIC_COMMON_UNITS
  11. units=$(SYSTEMUNIT) $(CPU_UNITS) uuchar objpas heapmgr consoleio $(CPU_SPECIFIC_COMMON_UNITS)
  12. # macpas iso7185 strings
  13. # dos \
  14. # classes math typinfo varutils fmtbcd \
  15. # charset cpall ucomplex getopts matrix \
  16. # variants types rtlconsts sysconst dateutil
  17. #implicitunits=exeinfo \
  18. # cp1250 cp1251 cp1252 cp1253 cp1254 cp1255 cp1256 cp1257 cp1258 \
  19. # cp437 cp646 cp850 cp856 cp866 cp874 cp932 cp936 cp949 cp950 cp8859_1 cp8859_5 cp8859_2 cp852
  20. #rsts=math rtlconsts varutils typinfo variants classes sysconst dateutil
  21. [require]
  22. nortl=y
  23. [install]
  24. fpcpackage=y
  25. [default]
  26. fpcdir=../..
  27. target=embedded
  28. [compiler]
  29. includedir=$(INC) $(PROCINC)
  30. sourcedir=$(INC) $(PROCINC) $(COMMON) $(ARCH)
  31. [prerules]
  32. RTL=..
  33. INC=$(RTL)/inc
  34. COMMON=$(RTL)/common
  35. PROCINC=$(RTL)/$(CPU_TARGET)
  36. UNITPREFIX=rtl
  37. SYSTEMUNIT=system
  38. override [email protected]
  39. LOADERS=
  40. ifeq ($(ARCH),mipsel)
  41. ifeq ($(SUBARCH),pic32mx)
  42. override LOADERS=startup
  43. endif
  44. endif
  45. ifdef RELEASE
  46. override FPCOPT+=-Ur
  47. endif
  48. CPU_UNITS=
  49. SYSINIT_UNITS=
  50. CPU_SPECIFIC_COMMON_UNITS=
  51. ifeq ($(ARCH),arm)
  52. CPU_SPECIFIC_COMMON_UNITS=sysutils sysconst
  53. ifeq ($(SUBARCH),armv7m)
  54. CPU_UNITS=lm3fury lm3tempest stm32f10x_ld stm32f10x_md stm32f10x_hd stm32f10x_xl stm32f10x_conn stm32f10x_cl lpc13xx lpc1768 lm4f120 xmc4500 cortexm3 cortexm4 # thumb2_bare
  55. endif
  56. ifeq ($(SUBARCH),armv7em)
  57. CPU_UNITS=lm4f120 xmc4500 cortexm3 cortexm4 # thumb2_bare
  58. endif
  59. ifeq ($(SUBARCH),armv4t)
  60. CPU_UNITS=lpc21x4 at91sam7x256 sc32442b
  61. endif
  62. ifeq ($(SUBARCH),armv4)
  63. CPU_UNITS=lpc21x4 at91sam7x256 sc32442b
  64. endif
  65. ifeq ($(SUBARCH),armv6m)
  66. CPU_UNITS=lpc8xx lpc11xx lpc122x stm32f0xx cortexm0
  67. endif
  68. endif
  69. ifeq ($(ARCH),avr)
  70. CPU_UNITS=atmega128
  71. endif
  72. ifeq ($(ARCH),i386)
  73. CPU_UNITS=multiboot
  74. endif
  75. ifeq ($(ARCH),mipsel)
  76. ifeq ($(SUBARCH),pic32mx)
  77. CPU_UNITS=pic32mx1xxfxxxb pic32mx2xxfxxxb pic32mx1xxfxxxc pic32mx2xxfxxxc pic32mx1xxfxxxd pic32mx2xxfxxxd pic32mx7x5fxxxl pic32mx7x5fxxxh
  78. endif
  79. endif
  80. # Paths
  81. OBJPASDIR=$(RTL)/objpas
  82. GRAPHDIR=$(INC)/graph
  83. [rules]
  84. # .NOTPARALLEL:
  85. # Get the system independent include file names.
  86. # This will set the following variables :
  87. # SYSINCNAMES
  88. include $(INC)/makefile.inc
  89. SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
  90. # Get the processor dependent include file names.
  91. # This will set the following variables :
  92. # CPUINCNAMES
  93. include $(PROCINC)/makefile.cpu
  94. SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
  95. # Put system unit dependencies together.
  96. SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
  97. #
  98. # Loaders
  99. #
  100. startup$(OEXT) : $(CPU_TARGET)/startup.s
  101. $(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)startup$(OEXT) $(CPU_TARGET)/startup.s -mabi=32 -march=pic32mx -mtune=pic32mx -W -EL -msym32
  102. #
  103. # Base Units (System, strings, os-dependent-base-unit)
  104. #
  105. $(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp $(SYSDEPS) $(INC)/softfpu.pp
  106. $(COMPILER) -Us -Sg $(SYSTEMUNIT).pp $(REDIR)
  107. uuchar$(PPUEXT): $(INC)/uuchar.pp $(SYSTEMUNIT)$(PPUEXT)
  108. $(COMPILER) $<
  109. objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
  110. $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp $(REDIR)
  111. strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc \
  112. $(PROCINC)/strings.inc $(PROCINC)/stringss.inc \
  113. $(SYSTEMUNIT)$(PPUEXT)
  114. #
  115. # System Dependent Units
  116. #
  117. #ports$(PPUEXT) : ports.pas objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  118. #doscalls$(PPUEXT) : doscalls.pas strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  119. consoleio$(PPUEXT) : consoleio.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  120. $(COMPILER) $<
  121. heapmgr$(PPUEXT) : heapmgr.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  122. $(COMPILER) $<
  123. #
  124. # TP7 Compatible RTL Units
  125. #
  126. dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
  127. $(SYSTEMUNIT)$(PPUEXT)
  128. $(COMPILER) $<
  129. #crt$(PPUEXT) : crt.pas $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT)
  130. objects$(PPUEXT) : $(INC)/objects.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  131. $(COMPILER) $<
  132. #printer$(PPUEXT) : printer.pas $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT)
  133. #graph$(PPUEXT) : graph.pp
  134. #
  135. # Delphi Compatible Units
  136. #
  137. sysutils$(PPUEXT) : sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
  138. objpas$(PPUEXT) sysconst$(PPUEXT) heapmgr$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  139. $(COMPILER) -Fi$(OBJPASDIR)/sysutils sysutils.pp
  140. classes$(PPUEXT) : classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
  141. sysutils$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT) types$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  142. $(COMPILER) -Fi$(OBJPASDIR)/classes classes.pp
  143. typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  144. $(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp $(REDIR)
  145. math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  146. $(COMPILER) $(OBJPASDIR)/math.pp $(REDIR)
  147. varutils$(PPUEXT) : $(OBJPASDIR)/cvarutil.inc $(OBJPASDIR)/varutils.inc \
  148. $(OBJPASDIR)/varutilh.inc varutils.pp $(SYSTEMUNIT)$(PPUEXT)
  149. $(COMPILER) -I$(OBJPASDIR) varutils.pp $(REDIR)
  150. fmtbcd$(PPUEXT) : $(OBJPASDIR)/fmtbcd.pp objpas$(PPUEXT) sysutils$(PPUEXT) variants$(PPUEXT) classes$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  151. $(COMPILER) $(OBJPASDIR)/fmtbcd.pp
  152. types$(PPUEXT) : $(OBJPASDIR/types.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  153. $(COMPILER) $(OBJPASDIR)/types.pp
  154. rtlconsts$(PPUEXT) : $(OBJPASDIR)/rtlconsts.pp $(SYSTEMUNIT)$(PPUEXT)
  155. $(COMPILER) $(OBJPASDIR)/rtlconsts.pp
  156. sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  157. $(COMPILER) $(OBJPASDIR)/sysconst.pp
  158. dateutil$(PPUEXT) : $(OBJPASDIR)/dateutil.pp $(SYSTEMUNIT)$(PPUEXT)
  159. $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/dateutil.pp
  160. #
  161. # Mac Pascal Model
  162. #
  163. macpas$(PPUEXT) : $(INC)/macpas.pp objpas$(PPUEXT) math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  164. $(COMPILER) $(INC)/macpas.pp $(REDIR)
  165. #
  166. # Other system-independent RTL Units
  167. #
  168. ucomplex$(PPUEXT): $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  169. getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
  170. heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
  171. $(COMPILER) -Sg $(INC)/heaptrc.pp $(REDIR)
  172. #lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
  173. charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
  174. cpall$(PPUEXT): $(RTL)/charmaps/cpall.pas system$(PPUEXT) charset$(PPUEXT)
  175. $(COMPILER) -Fu$(INC) -Fi$(RTL)/charmaps $(RTL)/charmaps/cpall.pas
  176. #
  177. # Unit specific rules
  178. #
  179. define CPU_UNITS_RULE
  180. $(1)$(PPUEXT): $(ARCH)/$(1).pp $(SYSTEMUNIT)$(PPUEXT)
  181. endef
  182. $(foreach unit,$(CPU_UNITS),$(eval $(call CPU_UNITS_RULE,$(unit))))
  183. $(addsuffix $(PPUEXT),$(CPU_UNITS)):
  184. $(COMPILER) $<