Makefile.fpc 7.4 KB

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