Makefile.fpc 6.7 KB

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