Makefile.fpc 6.9 KB

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