Makefile.fpc 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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=pic32mx110f016b pic32mx110f016c pic32mx110f016d pic32mx120f032b pic32mx120f032c pic32mx120f032d pic32mx130f064b pic32mx130f064c \
  78. pic32mx130f064d pic32mx150f128b pic32mx150f128c pic32mx150f128d pic32mx170f256b pic32mx170f256d pic32mx210f016b pic32mx210f016c \
  79. pic32mx210f016d pic32mx220f032b pic32mx220f032c pic32mx220f032d pic32mx230f064b pic32mx230f064c pic32mx230f064d pic32mx250f128b \
  80. pic32mx250f128c pic32mx250f128d pic32mx270f256b pic32mx270f256d pic32mx320f032h pic32mx320f064h pic32mx320f128h pic32mx320f128l \
  81. pic32mx330f064h pic32mx330f064l pic32mx340f128h pic32mx340f128l pic32mx340f256h pic32mx340f512h pic32mx350f128h pic32mx350f128l \
  82. pic32mx350f256h pic32mx350f256l pic32mx360f256l pic32mx360f512l pic32mx370f512h pic32mx370f512l pic32mx420f032h pic32mx430f064h \
  83. pic32mx430f064l pic32mx440f128h pic32mx440f128l pic32mx440f256h pic32mx440f512h pic32mx450f128h pic32mx450f128l pic32mx450f256h \
  84. pic32mx450f256l pic32mx460f256l pic32mx460f512l pic32mx470f512h pic32mx470f512l pic32mx534f064h pic32mx534f064l pic32mx564f064h \
  85. pic32mx564f064l pic32mx564f128h pic32mx564f128l pic32mx575f256h pic32mx575f256l pic32mx575f512h pic32mx575f512l pic32mx664f064h \
  86. pic32mx664f064l pic32mx664f128h pic32mx664f128l pic32mx675f256h pic32mx675f256l pic32mx675f512h pic32mx675f512l pic32mx695f512h \
  87. pic32mx695f512l pic32mx764f128h pic32mx764f128l pic32mx775f256h pic32mx775f256l pic32mx775f512h pic32mx775f512l pic32mx795f512h \
  88. pic32mx795f512l
  89. endif
  90. endif
  91. # Paths
  92. OBJPASDIR=$(RTL)/objpas
  93. GRAPHDIR=$(INC)/graph
  94. [rules]
  95. # .NOTPARALLEL:
  96. # Get the system independent include file names.
  97. # This will set the following variables :
  98. # SYSINCNAMES
  99. include $(INC)/makefile.inc
  100. SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
  101. # Get the processor dependent include file names.
  102. # This will set the following variables :
  103. # CPUINCNAMES
  104. include $(PROCINC)/makefile.cpu
  105. SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
  106. # Put system unit dependencies together.
  107. SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
  108. #
  109. # Loaders
  110. #
  111. startup$(OEXT) : $(CPU_TARGET)/startup.s
  112. $(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)startup$(OEXT) $(CPU_TARGET)/startup.s -mabi=32 -march=pic32mx -mtune=pic32mx -W -EL -msym32
  113. #
  114. # Base Units (System, strings, os-dependent-base-unit)
  115. #
  116. $(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp $(SYSDEPS) $(INC)/softfpu.pp
  117. $(COMPILER) -Us -Sg $(SYSTEMUNIT).pp $(REDIR)
  118. uuchar$(PPUEXT): $(INC)/uuchar.pp $(SYSTEMUNIT)$(PPUEXT)
  119. $(COMPILER) $<
  120. objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
  121. $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp $(REDIR)
  122. strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc \
  123. $(PROCINC)/strings.inc $(PROCINC)/stringss.inc \
  124. $(SYSTEMUNIT)$(PPUEXT)
  125. #
  126. # System Dependent Units
  127. #
  128. #ports$(PPUEXT) : ports.pas objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  129. #doscalls$(PPUEXT) : doscalls.pas strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  130. consoleio$(PPUEXT) : consoleio.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  131. $(COMPILER) $<
  132. heapmgr$(PPUEXT) : heapmgr.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  133. $(COMPILER) $<
  134. #
  135. # TP7 Compatible RTL Units
  136. #
  137. dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
  138. $(SYSTEMUNIT)$(PPUEXT)
  139. $(COMPILER) $<
  140. #crt$(PPUEXT) : crt.pas $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT)
  141. objects$(PPUEXT) : $(INC)/objects.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  142. $(COMPILER) $<
  143. #printer$(PPUEXT) : printer.pas $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT)
  144. #graph$(PPUEXT) : graph.pp
  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) $(SYSTEMUNIT)$(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. dateutil$(PPUEXT) : $(OBJPASDIR)/dateutil.pp $(SYSTEMUNIT)$(PPUEXT)
  170. $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/dateutil.pp
  171. #
  172. # Mac Pascal Model
  173. #
  174. macpas$(PPUEXT) : $(INC)/macpas.pp objpas$(PPUEXT) math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  175. $(COMPILER) $(INC)/macpas.pp $(REDIR)
  176. #
  177. # Other system-independent RTL Units
  178. #
  179. ucomplex$(PPUEXT): $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
  180. getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
  181. heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
  182. $(COMPILER) -Sg $(INC)/heaptrc.pp $(REDIR)
  183. #lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
  184. charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
  185. cpall$(PPUEXT): $(RTL)/charmaps/cpall.pas system$(PPUEXT) charset$(PPUEXT)
  186. $(COMPILER) -Fu$(INC) -Fi$(RTL)/charmaps $(RTL)/charmaps/cpall.pas
  187. #
  188. # Unit specific rules
  189. #
  190. define CPU_UNITS_RULE
  191. $(1)$(PPUEXT): $(ARCH)/$(1).pp $(SYSTEMUNIT)$(PPUEXT)
  192. endef
  193. $(foreach unit,$(CPU_UNITS),$(eval $(call CPU_UNITS_RULE,$(unit))))
  194. $(addsuffix $(PPUEXT),$(CPU_UNITS)):
  195. $(COMPILER) $<