2
0

Makefile.fpc 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. #
  2. # Makefile.fpc for Free Pascal Source Tree
  3. #
  4. [package]
  5. name=fpc
  6. version=2.7.1
  7. [target]
  8. dirs=compiler rtl utils packages ide installer
  9. [require]
  10. nortl=y
  11. [install]
  12. fpcpackage=y
  13. [default]
  14. fpcdir=.
  15. rule=help
  16. [prerules]
  17. # make versions < 3.77 (OS2 version) are buggy
  18. ifndef inOS2
  19. override FPCDIR:=$(BASEDIR)
  20. export FPCDIR
  21. endif
  22. # Build dir
  23. ifndef BUILDDIR
  24. BUILDDIR=$(BASEDIR)/build
  25. endif
  26. # New ppc386 (or ppc68k if on m68k machine !)
  27. ifndef PPNEW
  28. ifeq ($(CPU_TARGET),m68k)
  29. PPSUF=68k
  30. endif
  31. ifeq ($(CPU_TARGET),i386)
  32. PPSUF=386
  33. endif
  34. ifeq ($(CPU_TARGET),x86_64)
  35. PPSUF=x64
  36. endif
  37. ifeq ($(CPU_TARGET),sparc)
  38. PPSUF=sparc
  39. endif
  40. ifeq ($(CPU_TARGET),powerpc)
  41. PPSUF=ppc
  42. endif
  43. ifeq ($(CPU_TARGET),powerpc64)
  44. PPSUF=ppc64
  45. endif
  46. ifeq ($(CPU_TARGET),alpha)
  47. PPSUF=axp
  48. endif
  49. ifeq ($(CPU_TARGET),arm)
  50. PPSUF=arm
  51. endif
  52. ifeq ($(CPU_TARGET),armeb)
  53. PPSUF=arm
  54. endif
  55. ifeq ($(CPU_TARGET),jvm)
  56. PPSUF=jvm
  57. endif
  58. # cross compilers uses full cpu_target, not just ppc-suffix
  59. # (except if the target cannot run a native compiler)
  60. ifdef CROSSCOMPILE
  61. ifneq ($(CPU_TARGET),jvm)
  62. PPPRE=ppcross
  63. else
  64. PPPRE=ppc
  65. endif
  66. else
  67. PPPRE=ppc
  68. endif
  69. PPNEW=$(BASEDIR)/compiler/$(PPPRE)$(PPSUF)$(SRCEXEEXT)
  70. endif
  71. # Check if install/ subdir is available
  72. ifneq ($(wildcard install),)
  73. CVSINSTALL=install
  74. else
  75. CVSINSTALL=.
  76. endif
  77. # Install target, for snapshots we don't install examples.
  78. # Cross installation only needs the .ppu files
  79. ifdef SNAPSHOT
  80. INSTALLTARGET=install
  81. else
  82. ifdef CROSSINSTALL
  83. INSTALLTARGET=install
  84. else
  85. INSTALLTARGET=distinstall
  86. endif
  87. endif
  88. # All target
  89. ifdef SNAPSHOT
  90. ALLTARGET=all
  91. else
  92. ifndef ALLTARGET
  93. SHAREDTARGETS=
  94. SMARTTARGETS=win32 go32v2 linux freebsd netbsd openbsd netware netwlibc darwin
  95. ifneq ($(findstring $(OS_TARGET),$(SHAREDTARGETS)),)
  96. ALLTARGET=shared
  97. else
  98. ifneq ($(findstring $(OS_TARGET),$(SMARTTARGETS)),)
  99. ALLTARGET=smart
  100. else
  101. ALLTARGET=all
  102. endif
  103. endif
  104. endif
  105. endif
  106. # Prefix for units
  107. ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
  108. PKGUNITSPRE=u
  109. else
  110. PKGUNITSPRE=units-
  111. endif
  112. # Cross compile needs a prefix to not conflict with original packages
  113. ifdef CROSSINSTALL
  114. PKGPRE=$(FULL_TARGET)-
  115. else
  116. PKGPRE=
  117. endif
  118. # Always compile for release
  119. override RELEASE=1
  120. export RELEASE
  121. # We want to have the resulting .zips in the current dir
  122. ifndef DIST_DESTDIR
  123. export DIST_DESTDIR:=$(BASEDIR)
  124. endif
  125. # Temporary path to pack a file
  126. BASEPACKDIR=$(BASEDIR)/basepack
  127. # Newly created fpcmake
  128. ifeq ($(FULL_SOURCE),$(FULL_TARGET))
  129. FPCMAKENEW=$(BASEDIR)/utils/fpcm/fpcmake$(EXEEXT)
  130. else
  131. FPCMAKENEW=fpcmake
  132. endif
  133. # Build/install options
  134. CLEANOPTS=FPC=$(PPNEW)
  135. BUILDOPTS=FPC=$(PPNEW) RELEASE=1
  136. INSTALLOPTS=FPC=$(PPNEW) ZIPDESTDIR=$(BASEDIR) FPCMAKE=$(FPCMAKENEW)
  137. # Compile also IDE (check for ide and fv dir)
  138. # Skipped by default for cross compiles, because it depends on libc
  139. ifndef CROSSCOMPILE
  140. ifneq ($(wildcard ide),)
  141. IDETARGETS=go32v2 win32 win64 linux freebsd os2 emx beos haiku
  142. ifneq ($(findstring $(OS_TARGET),$(IDETARGETS)),)
  143. IDE=1
  144. endif
  145. endif
  146. endif
  147. # CPU targets for which we only build the compiler/rtl
  148. BuildOnlyBaseCPUs=jvm
  149. [rules]
  150. .NOTPARALLEL:
  151. # These values can change
  152. unexport FPC_VERSION FPC_COMPILERINFO OS_SOURCE
  153. # Only process directories that really exists
  154. override TARGET_DIRS:=$(wildcard $(TARGET_DIRS))
  155. #####################################################################
  156. # Main targets
  157. #####################################################################
  158. .PHONY: help
  159. help:
  160. @$(ECHO)
  161. @$(ECHO) Targets
  162. @$(ECHO) all Alias for build
  163. @$(ECHO) build Build a new compiler and all packages
  164. @$(ECHO) install Install newly build files
  165. @$(ECHO) zipinstall Create zip/tar of installed files
  166. @$(ECHO) singlezipinstall Alias for zipinstall
  167. @$(ECHO)
  168. @exit
  169. #####################################################################
  170. # Dependencies
  171. #####################################################################
  172. #######################################
  173. # Compiler
  174. #######################################
  175. .PHONY: compiler_cycle
  176. compiler_cycle:
  177. $(MAKE) -C compiler cycle
  178. ##########################################################################
  179. # Packaging
  180. ##########################################################################
  181. BUILDSTAMP=build-stamp.$(FULL_TARGET)
  182. .PHONY: all clean distclean build buildbase install installbase installother zipinstallbase zipinstallotherzipinstall singlezipinstall
  183. ifeq ( $findstring($CPU_TAGET,$BuildOnlyBaseCPUs),)
  184. all: build
  185. install: installall
  186. else
  187. all: buildbase
  188. install: installbase
  189. endif
  190. clean: $(addsuffix _distclean,$(TARGET_DIRS))
  191. -$(DEL) build-stamp.*
  192. -$(DEL) base.build-stamp.*
  193. distclean: clean
  194. build: $(BUILDSTAMP)
  195. $(BUILDSTAMP):
  196. # create new compiler
  197. $(MAKE) compiler_cycle RELEASE=1
  198. # clean
  199. $(MAKE) rtl_clean $(CLEANOPTS)
  200. $(MAKE) packages_clean $(CLEANOPTS)
  201. $(MAKE) utils_clean $(CLEANOPTS)
  202. ifdef IDE
  203. $(MAKE) ide_clean $(CLEANOPTS)
  204. $(MAKE) installer_clean $(CLEANOPTS)
  205. endif
  206. # build everything
  207. $(MAKE) rtl_$(ALLTARGET) $(BUILDOPTS)
  208. $(MAKE) packages_$(ALLTARGET) $(BUILDOPTS)
  209. $(MAKE) utils_all $(BUILDOPTS)
  210. ifdef IDE
  211. $(MAKE) ide_all $(BUILDOPTS)
  212. $(MAKE) installer_all $(BUILDOPTS)
  213. endif
  214. $(ECHOREDIR) Build > $(BUILDSTAMP)
  215. buildbase: base.$(BUILDSTAMP)
  216. base.$(BUILDSTAMP):
  217. # create new compiler
  218. $(MAKE) compiler_cycle RELEASE=1
  219. # clean
  220. $(MAKE) rtl_clean $(CLEANOPTS)
  221. # build everything
  222. $(MAKE) rtl_$(ALLTARGET) $(BUILDOPTS)
  223. $(ECHOREDIR) Build > base.$(BUILDSTAMP)
  224. installbase: base.$(BUILDSTAMP)
  225. # create dirs
  226. $(MKDIR) $(INSTALL_BASEDIR)
  227. $(MKDIR) $(INSTALL_BINDIR)
  228. # install compiler+rtl
  229. $(MAKE) compiler_$(INSTALLTARGET) $(INSTALLOPTS)
  230. $(MAKE) rtl_$(INSTALLTARGET) $(INSTALLOPTS)
  231. installother:
  232. $(MAKE) packages_$(INSTALLTARGET) $(INSTALLOPTS)
  233. $(MAKE) utils_$(INSTALLTARGET) $(INSTALLOPTS)
  234. ifdef IDE
  235. $(MAKE) ide_$(INSTALLTARGET) $(BUILDOPTS)
  236. endif
  237. zipinstallbase:
  238. $(MAKE) fpc_zipinstall ZIPTARGET=installbase ZIPNAME=base $(INSTALLOPTS)
  239. zipinstallother:
  240. $(MAKE) packages_zip$(INSTALLTARGET) $(INSTALLOPTS) ZIPPREFIX=$(PKGUNITSPRE)
  241. $(MAKE) utils_zip$(INSTALLTARGET) $(INSTALLOPTS)
  242. ifdef IDE
  243. $(MAKE) ide_zip$(INSTALLTARGET) $(INSTALLOPTS)
  244. endif
  245. installall: $(BUILDSTAMP)
  246. $(MAKE) installbase $(INSTALLOPTS)
  247. ifeq ( $(findstring($CPU_TARGET, BuildOnlyBaseCPUs)),)
  248. $(MAKE) installother $(INSTALLOPTS)
  249. endif
  250. singlezipinstall: zipinstall
  251. zipinstall: $(BUILDSTAMP)
  252. $(MAKE) fpc_zipinstall ZIPTARGET=install FULLZIPNAME=fpc-$(PACKAGE_VERSION).$(TARGETSUFFIX) $(INSTALLOPTS)
  253. ##########################################################################
  254. # Cross installation (installation of cross compiler and units)
  255. ##########################################################################
  256. .PHONY: crossall crossinstall crosszipinstall crosssinglezipinstall
  257. crossall:
  258. $(MAKE) all CROSSINSTALL=1
  259. crossinstall:
  260. $(MAKE) install CROSSINSTALL=1
  261. crosszipinstall:
  262. $(MAKE) zipinstall CROSSINSTALL=1
  263. crosssinglezipinstall:
  264. $(MAKE) fpc_zipinstall ZIPTARGET=crossinstall ZIPNAME=fpc $(INSTALLOPTS)