Makefile.fpc 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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 iso7185 strings heapmgr consoleio $(CPU_SPECIFIC_COMMON_UNITS) \
  12. # macpas iso7185 strings
  13. dos \
  14. ctypes \
  15. charset cpall \
  16. sysconst
  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 math classes fgl macpas typinfo types rtlconsts getopts lineinfo
  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 stm32f429 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. ifeq ($(SUBARCH),armv7a)
  69. CPU_UNITS=allwinner_a20
  70. endif
  71. endif
  72. ifeq ($(ARCH),avr)
  73. CPU_UNITS=atmega128 atmega8 avrsim
  74. endif
  75. ifeq ($(ARCH),i386)
  76. CPU_SPECIFIC_COMMON_UNITS=sysutils math classes fgl macpas typinfo types rtlconsts getopts lineinfo
  77. CPU_UNITS=multiboot
  78. endif
  79. ifeq ($(ARCH),mipsel)
  80. CPU_SPECIFIC_COMMON_UNITS=sysutils math classes fgl macpas typinfo types rtlconsts getopts lineinfo
  81. ifeq ($(SUBARCH),pic32mx)
  82. CPU_UNITS=pic32mx1xxfxxxb pic32mx2xxfxxxb pic32mx1xxfxxxc pic32mx2xxfxxxc pic32mx1xxfxxxd pic32mx2xxfxxxd pic32mx7x5fxxxl pic32mx7x5fxxxh
  83. endif
  84. endif
  85. # Paths
  86. OBJPASDIR=$(RTL)/objpas
  87. GRAPHDIR=$(INC)/graph
  88. [rules]
  89. # .NOTPARALLEL:
  90. # Get the system independent include file names.
  91. # This will set the following variables :
  92. # SYSINCNAMES
  93. include $(INC)/makefile.inc
  94. SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
  95. # Get the processor dependent include file names.
  96. # This will set the following variables :
  97. # CPUINCNAMES
  98. include $(PROCINC)/makefile.cpu
  99. SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
  100. # Put system unit dependencies together.
  101. SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
  102. #
  103. # Loaders
  104. #
  105. startup$(OEXT) : $(CPU_TARGET)/startup.s
  106. $(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)startup$(OEXT) $(CPU_TARGET)/startup.s -mabi=32 -march=pic32mx -mtune=pic32mx -W -EL -msym32
  107. #
  108. # Base Units (System, strings, os-dependent-base-unit)
  109. #
  110. $(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp $(SYSDEPS) $(INC)/softfpu.pp
  111. $(COMPILER) -Us -Sg $(SYSTEMUNIT).pp $(REDIR)
  112. uuchar$(PPUEXT): $(INC)/uuchar.pp $(SYSTEMUNIT)$(PPUEXT)
  113. $(COMPILER) $<
  114. objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
  115. $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp $(REDIR)
  116. strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc \
  117. $(PROCINC)/strings.inc $(PROCINC)/stringss.inc \
  118. $(SYSTEMUNIT)$(PPUEXT)
  119. $(COMPILER) $<
  120. #
  121. # System Dependent Units
  122. #
  123. #ports$(PPUEXT) : ports.pas objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  124. $(COMPILER) $<
  125. #doscalls$(PPUEXT) : doscalls.pas strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  126. $(COMPILER) $<
  127. consoleio$(PPUEXT) : consoleio.pp $(SYSTEMUNIT)$(PPUEXT)
  128. $(COMPILER) $<
  129. heapmgr$(PPUEXT) : heapmgr.pp $(SYSTEMUNIT)$(PPUEXT)
  130. $(COMPILER) $<
  131. #
  132. # TP7 Compatible RTL Units
  133. #
  134. dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
  135. $(SYSTEMUNIT)$(PPUEXT)
  136. $(COMPILER) $<
  137. #crt$(PPUEXT) : crt.pas $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT)
  138. $(COMPILER) $<
  139. objects$(PPUEXT) : $(INC)/objects.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  140. $(COMPILER) $<
  141. #printer$(PPUEXT) : printer.pas $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT)
  142. $(COMPILER) $<
  143. #graph$(PPUEXT) : graph.pp
  144. $(COMPILER) $<
  145. #
  146. # Delphi Compatible Units
  147. #
  148. sysutils$(PPUEXT) : sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
  149. objpas$(PPUEXT) sysconst$(PPUEXT) heapmgr$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  150. $(COMPILER) -Fi$(OBJPASDIR)/sysutils sysutils.pp
  151. classes$(PPUEXT) : classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
  152. sysutils$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT) types$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  153. $(COMPILER) -Fi$(OBJPASDIR)/classes classes.pp
  154. typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT) sysutils$(PPUEXT) rtlconsts$(PPUEXT)
  155. $(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp $(REDIR)
  156. math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  157. $(COMPILER) $(OBJPASDIR)/math.pp $(REDIR)
  158. varutils$(PPUEXT) : $(OBJPASDIR)/cvarutil.inc $(OBJPASDIR)/varutils.inc \
  159. $(OBJPASDIR)/varutilh.inc varutils.pp $(SYSTEMUNIT)$(PPUEXT)
  160. $(COMPILER) -I$(OBJPASDIR) varutils.pp $(REDIR)
  161. fmtbcd$(PPUEXT) : $(OBJPASDIR)/fmtbcd.pp objpas$(PPUEXT) sysutils$(PPUEXT) variants$(PPUEXT) classes$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  162. $(COMPILER) $(OBJPASDIR)/fmtbcd.pp
  163. types$(PPUEXT) : $(OBJPASDIR/types.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  164. $(COMPILER) $(OBJPASDIR)/types.pp
  165. rtlconsts$(PPUEXT) : $(OBJPASDIR)/rtlconsts.pp $(SYSTEMUNIT)$(PPUEXT)
  166. $(COMPILER) $(OBJPASDIR)/rtlconsts.pp
  167. sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  168. $(COMPILER) $(OBJPASDIR)/sysconst.pp
  169. fgl$(PPUEXT): $(OBJPASDIR)/fgl.pp objpas$(PPUEXT) types$(PPUEXT) system$(PPUEXT) sysutils$(PPUEXT)
  170. $(COMPILER) -Sg $(OBJPASDIR)/fgl.pp $(REDIR)
  171. dateutil$(PPUEXT) : $(OBJPASDIR)/dateutil.pp $(SYSTEMUNIT)$(PPUEXT)
  172. $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/dateutil.pp
  173. #
  174. # Mac Pascal Model
  175. #
  176. macpas$(PPUEXT) : $(INC)/macpas.pp objpas$(PPUEXT) math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  177. $(COMPILER) $(INC)/macpas.pp $(REDIR)
  178. #
  179. # Other system-independent RTL Units
  180. #
  181. ucomplex$(PPUEXT): $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  182. $(COMPILER) $<
  183. getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
  184. $(COMPILER) $<
  185. heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
  186. $(COMPILER) -Sg $(INC)/heaptrc.pp $(REDIR)
  187. lineinfo$(PPUEXT) : $(INC)/lineinfo.pp strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  188. $(COMPILER) $(INC)/lineinfo.pp
  189. charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
  190. $(COMPILER) $<
  191. cpall$(PPUEXT): $(RTL)/charmaps/cpall.pas system$(PPUEXT) charset$(PPUEXT)
  192. $(COMPILER) -Fu$(INC) -Fi$(RTL)/charmaps $(RTL)/charmaps/cpall.pas
  193. iso7185$(PPUEXT) : $(INC)/iso7185.pp $(SYSTEMUNIT)$(PPUEXT)
  194. $(COMPILER) $(INC)/iso7185.pp
  195. #
  196. # Unit specific rules
  197. #
  198. define CPU_UNITS_RULE
  199. $(1)$(PPUEXT): $(ARCH)/$(1).pp $(SYSTEMUNIT)$(PPUEXT)
  200. endef
  201. $(foreach unit,$(CPU_UNITS),$(eval $(call CPU_UNITS_RULE,$(unit))))
  202. $(addsuffix $(PPUEXT),$(CPU_UNITS)):
  203. $(COMPILER) $<
  204. #
  205. # Other $(SYSTEMUNIT)-dependent RTL Units
  206. #
  207. errors$(PPUEXT) : $(UNIXINC)/errors.pp strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  208. $(COMPILER) $(UNIXINC)/errors.pp
  209. callspec$(PPUEXT) : $(INC)/callspec.pp $(SYSTEMUNIT)$(PPUEXT)
  210. $(COMPILER) $(INC)/callspec.pp
  211. cmem$(PPUEXT) : $(INC)/cmem.pp $(SYSTEMUNIT)$(PPUEXT)
  212. $(COMPILER) $(INC)/cmem.pp
  213. cthreads$(PPUEXT) : $(UNIXINC)/cthreads.pp $(SYSTEMUNIT)$(PPUEXT) unix$(PPUEXT) sysutils$(PPUEXT) baseunix$(PPUEXT) initc$(PPUEXT) dl$(PPUEXT)
  214. $(COMPILER) $(UNIXINC)/cthreads.pp
  215. cwstring$(PPUEXT) : $(UNIXINC)/cwstring.pp $(SYSTEMUNIT)$(PPUEXT) sysutils$(PPUEXT) baseunix$(PPUEXT) unix$(PPUEXT) unixtype$(PPUEXT) ctypes$(PPUEXT) dynlibs$(PPUEXT) unixcp$(PPUEXT)
  216. $(COMPILER) $(UNIXINC)/cwstring.pp
  217. ctypes$(PPUEXT) : $(INC)/ctypes.pp $(SYSTEMUNIT)$(PPUEXT)
  218. $(COMPILER) $(INC)/ctypes.pp
  219. fpcylix$(PPUEXT) : fpcylix.pp cthreads$(PPUEXT) cwstring$(PPUEXT) dynlibs$(PPUEXT) objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  220. $(COMPILER) fpcylix.pp