Makefile.fpc 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. #
  2. # Makefile.fpc for Free Pascal Source Tree
  3. #
  4. [package]
  5. name=fpc
  6. version=2.1.1
  7. [target]
  8. dirs=compiler rtl utils fv 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. # cross compilers uses full cpu_target, not just ppc-suffix.
  53. ifdef CROSSCOMPILE
  54. PPPRE=ppcross
  55. else
  56. PPPRE=ppc
  57. endif
  58. PPNEW=$(BASEDIR)/compiler/$(PPPRE)$(PPSUF)$(SRCEXEEXT)
  59. endif
  60. # Check if install/ subdir is available
  61. ifneq ($(wildcard install),)
  62. CVSINSTALL=install
  63. else
  64. CVSINSTALL=.
  65. endif
  66. # Install target, for snapshots we don't install examples.
  67. # Cross installation only needs the .ppu files
  68. ifdef SNAPSHOT
  69. INSTALLTARGET=install
  70. else
  71. ifdef CROSSINSTALL
  72. INSTALLTARGET=install
  73. else
  74. INSTALLTARGET=distinstall
  75. endif
  76. endif
  77. # All target
  78. ifdef SNAPSHOT
  79. ALLTARGET=all
  80. else
  81. ifndef ALLTARGET
  82. SHAREDTARGETS=
  83. SMARTTARGETS=win32 go32v2 linux freebsd netbsd openbsd netware netwlibc
  84. ifneq ($(findstring $(OS_TARGET),$(SHAREDTARGETS)),)
  85. ALLTARGET=shared
  86. else
  87. ifneq ($(findstring $(OS_TARGET),$(SMARTTARGETS)),)
  88. ALLTARGET=smart
  89. else
  90. ALLTARGET=all
  91. endif
  92. endif
  93. endif
  94. endif
  95. # Prefix for units
  96. ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
  97. PKGUNITSPRE=u
  98. else
  99. PKGUNITSPRE=units-
  100. endif
  101. # Cross compile needs a prefix to not conflict with original packages
  102. ifdef CROSSINSTALL
  103. PKGPRE=$(FULL_TARGET)-
  104. else
  105. PKGPRE=
  106. endif
  107. # Always compile for release
  108. override RELEASE=1
  109. export RELEASE
  110. # We want to have the resulting .zips in the current dir
  111. ifndef DIST_DESTDIR
  112. export DIST_DESTDIR:=$(BASEDIR)
  113. endif
  114. # Temporary path to pack a file
  115. BASEPACKDIR=$(BASEDIR)/basepack
  116. # Newly created fpcmake
  117. ifeq ($(FULL_SOURCE),$(FULL_TARGET))
  118. FPCMAKENEW=$(BASEDIR)/utils/fpcm/fpcmake$(EXEEXT)
  119. else
  120. FPCMAKENEW=fpcmake
  121. endif
  122. # Build/install options
  123. CLEANOPTS=FPC=$(PPNEW)
  124. BUILDOPTS=FPC=$(PPNEW) RELEASE=1
  125. INSTALLOPTS=FPC=$(PPNEW) ZIPDESTDIR=$(BASEDIR) FPCMAKE=$(FPCMAKENEW)
  126. # Not compile FV for following target(s)
  127. ifneq ($(wildcard fv),)
  128. NOFVTARGETS=wince
  129. ifeq ($(findstring $(OS_TARGET),$(NOFVTARGETS)),)
  130. FV=1
  131. endif
  132. endif
  133. # Compile also IDE (check for ide and fv dir)
  134. # Skipped by default for cross compiles, because it depends on libc
  135. ifndef CROSSCOMPILE
  136. ifneq ($(wildcard ide),)
  137. ifneq ($(wildcard fv),)
  138. IDETARGETS=go32v2 win32 linux freebsd os2 emx
  139. ifneq ($(findstring $(OS_TARGET),$(IDETARGETS)),)
  140. IDE=1
  141. endif
  142. endif
  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. # Packages
  176. #######################################
  177. .PHONY: packages_base_all packages_base_smart packages_base_shared \
  178. packages_fcl_all packages_fcl_smart packages_fcl_shared \
  179. packages_extra_all packages_extra_smart packages_extra_shared
  180. packages_base_all:
  181. $(MAKE) -C packages base_all
  182. packages_base_smart:
  183. $(MAKE) -C packages base_smart
  184. packages_base_shared:
  185. $(MAKE) -C packages base_shared
  186. packages_fcl_all:
  187. $(MAKE) -C packages fcl_all
  188. packages_fcl_smart:
  189. $(MAKE) -C packages fcl_smart
  190. packages_fcl_shared:
  191. $(MAKE) -C packages fcl_shared
  192. packages_extra_all:
  193. $(MAKE) -C packages extra_all
  194. packages_extra_smart:
  195. $(MAKE) -C packages extra_smart
  196. packages_extra_shared:
  197. $(MAKE) -C packages extra_shared
  198. ##########################################################################
  199. # Packaging
  200. ##########################################################################
  201. BUILDSTAMP=build-stamp.$(FULL_TARGET)
  202. .PHONY: all clean distclean build install installbase installother zipinstallbase zipinstallotherzipinstall singlezipinstall
  203. all: build
  204. clean: $(addsuffix _distclean,$(TARGET_DIRS))
  205. -$(DEL) build-stamp.*
  206. distclean: clean
  207. build: $(BUILDSTAMP)
  208. $(BUILDSTAMP):
  209. # create new compiler
  210. $(MAKE) compiler_cycle RELEASE=1
  211. # clean
  212. $(MAKE) rtl_clean $(CLEANOPTS)
  213. $(MAKE) packages_clean $(CLEANOPTS)
  214. ifdef FV
  215. $(MAKE) fv_clean $(CLEANOPTS)
  216. endif
  217. $(MAKE) utils_clean $(CLEANOPTS)
  218. ifdef IDE
  219. $(MAKE) ide_clean $(CLEANOPTS)
  220. endif
  221. # build everything
  222. $(MAKE) rtl_$(ALLTARGET) $(BUILDOPTS)
  223. $(MAKE) packages_base_$(ALLTARGET) $(BUILDOPTS)
  224. $(MAKE) packages_fcl_$(ALLTARGET) $(BUILDOPTS)
  225. ifdef FV
  226. $(MAKE) fv_$(ALLTARGET) $(BUILDOPTS)
  227. endif
  228. $(MAKE) packages_extra_$(ALLTARGET) $(BUILDOPTS)
  229. $(MAKE) utils_all $(BUILDOPTS)
  230. ifdef IDE
  231. $(MAKE) ide_all $(BUILDOPTS)
  232. $(MAKE) installer_all $(BUILDOPTS)
  233. endif
  234. $(ECHOREDIR) Build > $(BUILDSTAMP)
  235. installbase:
  236. # create dirs
  237. $(MKDIR) $(INSTALL_BASEDIR)
  238. $(MKDIR) $(INSTALL_BINDIR)
  239. # install compiler+rtl
  240. $(MAKE) compiler_$(INSTALLTARGET) $(INSTALLOPTS)
  241. $(MAKE) rtl_$(INSTALLTARGET) $(INSTALLOPTS)
  242. installother:
  243. $(MAKE) packages_$(INSTALLTARGET) $(INSTALLOPTS)
  244. ifdef FV
  245. $(MAKE) fv_$(INSTALLTARGET) $(INSTALLOPTS)
  246. endif
  247. $(MAKE) utils_$(INSTALLTARGET) $(INSTALLOPTS)
  248. ifdef IDE
  249. $(MAKE) ide_$(INSTALLTARGET) $(BUILDOPTS)
  250. endif
  251. zipinstallbase:
  252. $(MAKE) fpc_zipinstall ZIPTARGET=installbase ZIPNAME=base $(INSTALLOPTS)
  253. zipinstallother:
  254. $(MAKE) packages_zip$(INSTALLTARGET) $(INSTALLOPTS) ZIPPREFIX=$(PKGUNITSPRE)
  255. ifdef FV
  256. $(MAKE) fv_zip$(INSTALLTARGET) $(INSTALLOPTS) ZIPPREFIX=$(PKGUNITSPRE)
  257. endif
  258. $(MAKE) utils_zip$(INSTALLTARGET) $(INSTALLOPTS)
  259. ifdef IDE
  260. $(MAKE) ide_zip$(INSTALLTARGET) $(INSTALLOPTS)
  261. endif
  262. install: $(BUILDSTAMP)
  263. $(MAKE) installbase $(INSTALLOPTS)
  264. $(MAKE) installother $(INSTALLOPTS)
  265. singlezipinstall: zipinstall
  266. zipinstall: $(BUILDSTAMP)
  267. $(MAKE) fpc_zipinstall ZIPTARGET=install FULLZIPNAME=fpc-$(PACKAGE_VERSION).$(TARGETSUFFIX) $(INSTALLOPTS)
  268. ##########################################################################
  269. # Cross installation (installation of cross compiler and units)
  270. ##########################################################################
  271. .PHONY: crossall crossinstall crosszipinstall crosssinglezipinstall
  272. crossall:
  273. $(MAKE) all CROSSINSTALL=1
  274. crossinstall:
  275. $(MAKE) install CROSSINSTALL=1
  276. crosszipinstall:
  277. $(MAKE) zipinstall CROSSINSTALL=1
  278. crosssinglezipinstall:
  279. $(MAKE) fpc_zipinstall ZIPTARGET=crossinstall ZIPNAME=fpc $(INSTALLOPTS)