Makefile.fpc 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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 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. SMARTTARGETS=win32 go32v2 linux freebsd netbsd openbsd netware netwlibc
  80. ifneq ($(findstring $(OS_TARGET),$(SMARTTARGETS)),)
  81. ALLTARGET=smart
  82. else
  83. ALLTARGET=all
  84. endif
  85. endif
  86. endif
  87. # Prefix for units
  88. ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
  89. PKGUNITSPRE=u
  90. else
  91. PKGUNITSPRE=units-
  92. endif
  93. # Cross compile needs a prefix to not conflict with original packages
  94. ifdef CROSSINSTALL
  95. PKGPRE=$(FULL_TARGET)-
  96. else
  97. PKGPRE=
  98. endif
  99. # Always compile for release
  100. override RELEASE=1
  101. export RELEASE
  102. # We want to have the resulting .zips in the current dir
  103. ifndef DIST_DESTDIR
  104. export DIST_DESTDIR:=$(BASEDIR)
  105. endif
  106. # Temporary path to pack a file
  107. BASEPACKDIR=$(BASEDIR)/basepack
  108. # Newly created fpcmake
  109. ifeq ($(FULL_SOURCE),$(FULL_TARGET))
  110. FPCMAKENEW=$(BASEDIR)/utils/fpcm/fpcmake$(EXEEXT)
  111. else
  112. FPCMAKENEW=fpcmake
  113. endif
  114. # Build/install options
  115. CLEANOPTS=FPC=$(PPNEW)
  116. BUILDOPTS=FPC=$(PPNEW) RELEASE=1
  117. INSTALLOPTS=FPC=$(PPNEW) ZIPDESTDIR=$(BASEDIR) FPCMAKE=$(FPCMAKENEW)
  118. # Compile also IDE (check for ide and fv dir)
  119. # Skipped by default for cross compiles, because it depends on libc
  120. ifndef CROSSCOMPILE
  121. ifneq ($(wildcard ide),)
  122. ifneq ($(wildcard fv),)
  123. IDETARGETS=go32v2 win32 linux freebsd os2 emx
  124. ifneq ($(findstring $(OS_TARGET),$(IDETARGETS)),)
  125. IDE=1
  126. endif
  127. endif
  128. endif
  129. endif
  130. [rules]
  131. # These values can change
  132. unexport FPC_VERSION FPC_COMPILERINFO OS_SOURCE
  133. # Only process directories that really exists
  134. override TARGET_DIRS:=$(wildcard $(TARGET_DIRS))
  135. #####################################################################
  136. # Main targets
  137. #####################################################################
  138. .PHONY: help
  139. help:
  140. @$(ECHO)
  141. @$(ECHO) Targets
  142. @$(ECHO) all Alias for build
  143. @$(ECHO) build Build a new compiler and all packages
  144. @$(ECHO) install Install newly build files
  145. @$(ECHO) zipinstall Create zip/tar of installed files
  146. @$(ECHO) singlezipinstall Alias for zipinstall
  147. @$(ECHO)
  148. @exit
  149. #####################################################################
  150. # Dependencies
  151. #####################################################################
  152. #######################################
  153. # Compiler
  154. #######################################
  155. .PHONY: compiler_cycle
  156. compiler_cycle:
  157. $(MAKE) -C compiler cycle
  158. #######################################
  159. # Packages
  160. #######################################
  161. .PHONY: packages_base_all packages_extra_all \
  162. packages_base_smart packages_extra_smart
  163. packages_base_all:
  164. $(MAKE) -C packages base_all
  165. packages_base_smart:
  166. $(MAKE) -C packages base_smart
  167. packages_extra_all:
  168. $(MAKE) -C packages extra_all
  169. packages_extra_smart:
  170. $(MAKE) -C packages extra_smart
  171. ##########################################################################
  172. # Packaging
  173. ##########################################################################
  174. BUILDSTAMP=build-stamp.$(FULL_TARGET)
  175. .PHONY: all clean distclean build install installbase installother zipinstallbase zipinstallotherzipinstall singlezipinstall
  176. all: build
  177. clean: $(addsuffix _distclean,$(TARGET_DIRS))
  178. $(DEL) build-stamp.*
  179. distclean: clean
  180. build: $(BUILDSTAMP)
  181. $(BUILDSTAMP):
  182. # create new compiler
  183. $(MAKE) compiler_cycle RELEASE=1
  184. # clean
  185. $(MAKE) rtl_clean $(CLEANOPTS)
  186. $(MAKE) packages_clean $(CLEANOPTS)
  187. $(MAKE) fcl_clean $(CLEANOPTS)
  188. $(MAKE) fv_clean $(CLEANOPTS)
  189. $(MAKE) utils_clean $(CLEANOPTS)
  190. ifdef IDE
  191. $(MAKE) ide_clean $(CLEANOPTS)
  192. endif
  193. # build everything
  194. $(MAKE) rtl_$(ALLTARGET) $(BUILDOPTS)
  195. $(MAKE) packages_base_$(ALLTARGET) $(BUILDOPTS)
  196. $(MAKE) fcl_$(ALLTARGET) $(BUILDOPTS)
  197. $(MAKE) fv_$(ALLTARGET) $(BUILDOPTS)
  198. $(MAKE) packages_extra_$(ALLTARGET) $(BUILDOPTS)
  199. $(MAKE) utils_all $(BUILDOPTS)
  200. ifdef IDE
  201. $(MAKE) ide_all $(BUILDOPTS)
  202. $(MAKE) installer_all $(BUILDOPTS)
  203. endif
  204. $(ECHOREDIR) Build > $(BUILDSTAMP)
  205. installbase:
  206. # create dirs
  207. $(MKDIR) $(INSTALL_BASEDIR)
  208. $(MKDIR) $(INSTALL_BINDIR)
  209. # install compiler+rtl
  210. $(MAKE) compiler_$(INSTALLTARGET) $(INSTALLOPTS)
  211. $(MAKE) rtl_$(INSTALLTARGET) $(INSTALLOPTS)
  212. installother:
  213. $(MAKE) packages_$(INSTALLTARGET) $(INSTALLOPTS)
  214. $(MAKE) fcl_$(INSTALLTARGET) $(INSTALLOPTS)
  215. $(MAKE) fv_$(INSTALLTARGET) $(INSTALLOPTS)
  216. $(MAKE) utils_$(INSTALLTARGET) $(INSTALLOPTS)
  217. ifdef IDE
  218. $(MAKE) ide_$(INSTALLTARGET) $(BUILDOPTS)
  219. endif
  220. zipinstallbase:
  221. $(MAKE) fpc_zipinstall ZIPTARGET=installbase ZIPNAME=base $(INSTALLOPTS)
  222. zipinstallother:
  223. $(MAKE) packages_zip$(INSTALLTARGET) $(INSTALLOPTS) ZIPPREFIX=$(PKGUNITSPRE)
  224. $(MAKE) fcl_zip$(INSTALLTARGET) $(INSTALLOPTS) ZIPPREFIX=$(PKGUNITSPRE)
  225. $(MAKE) fv_zip$(INSTALLTARGET) $(INSTALLOPTS) ZIPPREFIX=$(PKGUNITSPRE)
  226. $(MAKE) utils_zip$(INSTALLTARGET) $(INSTALLOPTS)
  227. ifdef IDE
  228. $(MAKE) ide_zip$(INSTALLTARGET) $(INSTALLOPTS)
  229. endif
  230. install: $(BUILDSTAMP)
  231. $(MAKE) installbase $(INSTALLOPTS)
  232. $(MAKE) installother $(INSTALLOPTS)
  233. singlezipinstall: zipinstall
  234. zipinstall: $(BUILDSTAMP)
  235. $(MAKE) fpc_zipinstall ZIPTARGET=install ZIPNAME=fpc-$(PACKAGE_VERSION) $(INSTALLOPTS)
  236. ##########################################################################
  237. # Cross installation (installation of cross compiler and units)
  238. ##########################################################################
  239. .PHONY: crossall crossinstall crosszipinstall crosssinglezipinstall
  240. crossall:
  241. $(MAKE) all CROSSINSTALL=1
  242. crossinstall:
  243. $(MAKE) install CROSSINSTALL=1
  244. crosszipinstall:
  245. $(MAKE) zipinstall CROSSINSTALL=1
  246. crosssinglezipinstall:
  247. $(MAKE) fpc_zipinstall ZIPTARGET=crossinstall ZIPNAME=fpc $(INSTALLOPTS)