Makefile.fpc 7.2 KB

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