Makefile.fpc 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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. ifneq ($(wildcard utils),)
  150. NOUTILSTARGETS=embedded gba $(BuildOnlyBaseCPUs)
  151. ifeq ($(findstring $(OS_TARGET),$(NOUTILSTARGETS)),)
  152. UTILS=1
  153. endif
  154. endif
  155. [rules]
  156. .NOTPARALLEL:
  157. # These values can change
  158. unexport FPC_VERSION FPC_COMPILERINFO OS_SOURCE
  159. # Only process directories that really exists
  160. override TARGET_DIRS:=$(wildcard $(TARGET_DIRS))
  161. #####################################################################
  162. # Main targets
  163. #####################################################################
  164. .PHONY: help
  165. help:
  166. @$(ECHO)
  167. @$(ECHO) Targets
  168. @$(ECHO) all Alias for build
  169. @$(ECHO) build Build a new compiler and all packages
  170. @$(ECHO) install Install newly build files
  171. @$(ECHO) zipinstall Create zip/tar of installed files
  172. @$(ECHO) singlezipinstall Alias for zipinstall
  173. @$(ECHO)
  174. @exit
  175. #####################################################################
  176. # Dependencies
  177. #####################################################################
  178. #######################################
  179. # Compiler
  180. #######################################
  181. .PHONY: compiler_cycle
  182. compiler_cycle:
  183. $(MAKE) -C compiler cycle
  184. ##########################################################################
  185. # Packaging
  186. ##########################################################################
  187. BUILDSTAMP=build-stamp.$(FULL_TARGET)
  188. .PHONY: all clean distclean build buildbase install installbase installother zipinstallbase zipinstallotherzipinstall singlezipinstall
  189. ifeq ($(findstring $(CPU_TARGET),$(BuildOnlyBaseCPUs)),)
  190. all: build
  191. install: installall
  192. else
  193. all: buildbase
  194. install: installbase
  195. endif
  196. clean: $(addsuffix _distclean,$(TARGET_DIRS))
  197. -$(DEL) build-stamp.*
  198. -$(DEL) base.build-stamp.*
  199. distclean: clean
  200. build: $(BUILDSTAMP)
  201. $(BUILDSTAMP):
  202. # create new compiler
  203. $(MAKE) compiler_cycle RELEASE=1
  204. # clean
  205. $(MAKE) rtl_clean $(CLEANOPTS)
  206. $(MAKE) packages_clean $(CLEANOPTS)
  207. ifdef UTILS
  208. $(MAKE) utils_clean $(CLEANOPTS)
  209. endif
  210. ifdef IDE
  211. $(MAKE) ide_clean $(CLEANOPTS)
  212. $(MAKE) installer_clean $(CLEANOPTS)
  213. endif
  214. # build everything
  215. $(MAKE) rtl_$(ALLTARGET) $(BUILDOPTS)
  216. $(MAKE) packages_$(ALLTARGET) $(BUILDOPTS)
  217. ifdef UTILS
  218. $(MAKE) utils_all $(BUILDOPTS)
  219. endif
  220. ifdef IDE
  221. $(MAKE) ide_all $(BUILDOPTS)
  222. $(MAKE) installer_all $(BUILDOPTS)
  223. endif
  224. $(ECHOREDIR) Build > $(BUILDSTAMP)
  225. buildbase: base.$(BUILDSTAMP)
  226. base.$(BUILDSTAMP):
  227. # create new compiler
  228. $(MAKE) compiler_cycle RELEASE=1
  229. # clean
  230. $(MAKE) rtl_clean $(CLEANOPTS)
  231. # build everything
  232. $(MAKE) rtl_$(ALLTARGET) $(BUILDOPTS)
  233. $(ECHOREDIR) Build > base.$(BUILDSTAMP)
  234. installbase: base.$(BUILDSTAMP)
  235. # create dirs
  236. $(MKDIR) $(INSTALL_BASEDIR)
  237. $(MKDIR) $(INSTALL_BINDIR)
  238. # install compiler+rtl
  239. $(MAKE) compiler_$(INSTALLTARGET) $(INSTALLOPTS)
  240. $(MAKE) rtl_$(INSTALLTARGET) $(INSTALLOPTS)
  241. installother:
  242. $(MAKE) packages_$(INSTALLTARGET) $(INSTALLOPTS)
  243. ifdef UTILS
  244. $(MAKE) utils_$(INSTALLTARGET) $(INSTALLOPTS)
  245. endif
  246. ifdef IDE
  247. $(MAKE) ide_$(INSTALLTARGET) $(BUILDOPTS)
  248. endif
  249. zipinstallbase:
  250. $(MAKE) fpc_zipinstall ZIPTARGET=installbase ZIPNAME=base $(INSTALLOPTS)
  251. zipinstallother:
  252. $(MAKE) packages_zip$(INSTALLTARGET) $(INSTALLOPTS) ZIPPREFIX=$(PKGUNITSPRE)
  253. ifdef UTILS
  254. $(MAKE) utils_zip$(INSTALLTARGET) $(INSTALLOPTS)
  255. endif
  256. ifdef IDE
  257. $(MAKE) ide_zip$(INSTALLTARGET) $(INSTALLOPTS)
  258. endif
  259. installall: $(BUILDSTAMP)
  260. $(MAKE) installbase $(INSTALLOPTS)
  261. ifeq ($(findstring $(CPU_TARGET), $(BuildOnlyBaseCPUs)),)
  262. $(MAKE) installother $(INSTALLOPTS)
  263. endif
  264. singlezipinstall: zipinstall
  265. zipinstall: $(BUILDSTAMP)
  266. $(MAKE) fpc_zipinstall ZIPTARGET=install FULLZIPNAME=fpc-$(PACKAGE_VERSION).$(TARGETSUFFIX) $(INSTALLOPTS)
  267. ##########################################################################
  268. # Cross installation (installation of cross compiler and units)
  269. ##########################################################################
  270. .PHONY: crossall crossinstall crosszipinstall crosssinglezipinstall
  271. crossall:
  272. $(MAKE) all CROSSINSTALL=1
  273. crossinstall:
  274. $(MAKE) install CROSSINSTALL=1
  275. crosszipinstall:
  276. $(MAKE) zipinstall CROSSINSTALL=1
  277. crosssinglezipinstall:
  278. $(MAKE) fpc_zipinstall ZIPTARGET=crossinstall ZIPNAME=fpc $(INSTALLOPTS)