Makefile.fpc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. #
  2. # Makefile.fpc for Free Pascal Source Tree
  3. #
  4. [package]
  5. name=fpc
  6. version=1.0.5
  7. [target]
  8. dirs=compiler rtl utils fcl fv packages ide
  9. [install]
  10. fpcpackage=y
  11. [default]
  12. fpcdir=.
  13. rule=help
  14. [prerules]
  15. override FPCDIR:=$(BASEDIR)
  16. export FPCDIR
  17. # Check if install/ subdir is available
  18. ifneq ($(wildcard install),)
  19. CVSINSTALL=install
  20. else
  21. CVSINSTALL=.
  22. endif
  23. # Install target
  24. ifdef SNAPSHOT
  25. INSTALLTARGET=install
  26. else
  27. INSTALLTARGET=distinstall
  28. endif
  29. # All target
  30. ifdef SNAPSHOT
  31. ALLTARGET=all
  32. else
  33. ifndef ALLTARGET
  34. ifeq ($(OS_TARGET),win32)
  35. ALLTARGET=smart
  36. else
  37. ifeq ($(OS_TARGET),go32v2)
  38. ALLTARGET=smart
  39. else
  40. ifeq ($(OS_TARGET),linux)
  41. ALLTARGET=smart
  42. else
  43. ifeq ($(OS_TARGET),freebsd)
  44. ALLTARGET=smart
  45. else
  46. ALLTARGET=all
  47. endif
  48. endif
  49. endif
  50. endif
  51. endif
  52. endif
  53. # Stop with an error?
  54. ifdef SNAPSHOT
  55. NOSTOP=-
  56. else
  57. NOSTOP=
  58. endif
  59. # Prefix for units
  60. ifeq ($(OS_TARGET),linux)
  61. PKGPRE=units
  62. else
  63. ifeq ($(OS_TARGET),freebsd)
  64. PKGPRE=units
  65. else
  66. PKGPRE=u
  67. endif
  68. endif
  69. # Always compile for release
  70. override RELEASE=1
  71. export RELEASE
  72. # We want to have the resulting .zips in the current dir
  73. ifndef DIST_DESTDIR
  74. export DIST_DESTDIR:=$(BASEDIR)
  75. endif
  76. # Temporary path to pack a file
  77. BASEPACKDIR=$(BASEDIR)/basepack
  78. # Use new ppc386
  79. PPNEW=$(BASEDIR)/compiler/ppc386$(EXEEXT)
  80. # Don't use ppufiles for win32 becuase of commandline length problems
  81. ifneq ($(OS_TARGET),win32)
  82. PPUFILESNEW=$(BASEDIR)/compiler/utils/ppufiles$(EXEEXT)
  83. endif
  84. # Build/install options
  85. BUILDOPTS=FPC=$(PPNEW) RELEASE=1
  86. INSTALLOPTS=FPC=$(PPNEW) ZIPDESTDIR=$(BASEDIR)
  87. ifdef PPUFILESNEW
  88. override INSTALLOPTS+=PPUFILES=$(PPUFILESNEW)
  89. endif
  90. # Compile also IDE (check for ide and fv dir)
  91. ifneq ($(wildcard ide),)
  92. ifneq ($(wildcard fv),)
  93. ifeq ($(OS_TARGET),go32v2)
  94. IDE=1
  95. endif
  96. ifeq ($(OS_TARGET),win32)
  97. IDE=1
  98. endif
  99. ifeq ($(OS_TARGET),linux)
  100. IDE=1
  101. endif
  102. endif
  103. endif
  104. [rules]
  105. # These values can change
  106. unexport FPC_VERSION OS_SOURCE
  107. # Only process directories that really exists
  108. override TARGET_DIRS:=$(wildcard $(TARGET_DIRS))
  109. #####################################################################
  110. # Main targets
  111. #####################################################################
  112. .PHONY: help checkfpcdir
  113. help:
  114. @$(ECHO)
  115. @$(ECHO) Directory targets:
  116. @$(ECHO)
  117. @$(ECHO) $(TARGET_DIRS)
  118. @$(ECHO)
  119. @$(ECHO) Packing targets are:
  120. @$(ECHO)
  121. @$(ECHO) go32v2zip,win32zip,linuxzip,freebsdzip,sourcezip,os2zip
  122. @$(ECHO)
  123. @exit
  124. #####################################################################
  125. # Dependencies
  126. #####################################################################
  127. #######################################
  128. # Compiler
  129. #######################################
  130. .PHONY: compiler_cycle
  131. compiler_cycle:
  132. $(MAKE) -C compiler cycle
  133. #######################################
  134. # IDE
  135. #######################################
  136. .PHONY: ide_comp ide_full
  137. ide_comp:
  138. $(MAKE) -C compiler ppuclean
  139. $(MAKE) -C ide full
  140. # Look if libgdb.a is available then use fullgdb
  141. LIBGDB:=$(strip $(wildcard packages/gdbint/libgdb/$(OS_TARGET)/libgdb.a))
  142. ifneq ($(LIBGDB),)
  143. ide_full:
  144. $(MAKE) -C compiler ppuclean
  145. $(MAKE) -C ide fullgdb
  146. else
  147. ide_full:
  148. $(MAKE) -C compiler ppuclean
  149. $(MAKE) -C ide full
  150. endif
  151. #######################################
  152. # Install targets
  153. #######################################
  154. demo_install:
  155. $(MAKE) -C $(CVSINSTALL)/demo sourceinstall
  156. man_install:
  157. $(MAKE) -C $(CVSINSTALL)/man installman
  158. doc_install:
  159. $(MAKE) -C $(CVSINSTALL)/doc installdoc
  160. #######################################
  161. # Packaging targets
  162. #######################################
  163. idezips: ide_fullzip ide_fullgdbzip optcompinstall optcompzip
  164. ide_compzip:
  165. $(MAKE) compiler_clean
  166. $(MAKE) ide_clean
  167. $(MAKE) ide_full
  168. $(MAKE) -C ide/text zipinstall ZIPNAME=ide-comp-$(PACKAGESUFFIX)
  169. ide_fullgdbzip:
  170. $(MAKE) ide_clean
  171. $(MAKE) ide_fullgdb
  172. $(MAKE) -C ide/text zipinstall ZIPNAME=ide-full-$(PACKAGESUFFIX)
  173. optcompinstall:
  174. $(MAKE) compiler_cycle OPT=-dNEWOPTIMIZATIONS
  175. $(MAKE) compiler_install
  176. $(MAKE) rtl_install
  177. optcompzip:
  178. $(MAKE) fpc_zipinstall PACKAGENAME=optcomp ZIPTARGET=optcompinstall
  179. ##########################################################################
  180. # Install
  181. ##########################################################################
  182. .PHONY: installer installersrc
  183. INSTALLERBUILDDIR=fpinst
  184. installer:
  185. $(COPYTREE) $(CVSINSTALL)/fpinst $(INSTALLERBUILDDIR)
  186. $(MAKE) -C $(INSTALLERBUILDDIR) all RELEASE=1
  187. $(MOVE) $(INSTALLERBUILDDIR)/install.exe .
  188. ifdef UPXPROG
  189. -$(UPXPROG) install.exe
  190. endif
  191. $(DELTREE) $(INSTALLERBUILDDIR)
  192. installersrc:
  193. $(COPYTREE) $(CVSINSTALL)/fpinst $(INSTALLERBUILDDIR)
  194. $(MAKE) -C $(INSTALLERBUILDDIR) zipsourceinstall
  195. $(DELTREE) $(INSTALLERBUILDDIR)
  196. ##########################################################################
  197. # Packaging
  198. ##########################################################################
  199. .PHONY: all clean distclean build install installbase zipinstall zipinstallbase zipinstallfcl \
  200. zipinstallpackages
  201. all: build
  202. clean: $(addsuffix _distclean,$(TARGET_DIRS))
  203. $(DEL) build-stamp.$(OS_TARGET)
  204. distclean: clean
  205. build: build-stamp.$(OS_TARGET)
  206. build-stamp.$(OS_TARGET):
  207. # create new compiler
  208. $(MAKE) compiler_cycle
  209. # clean
  210. $(MAKE) rtl_clean
  211. $(MAKE) packages_clean
  212. $(MAKE) fcl_clean
  213. $(MAKE) utils_clean
  214. ifdef IDE
  215. $(MAKE) fv_clean
  216. $(MAKE) ide_clean
  217. endif
  218. # build everything
  219. $(MAKE) rtl_$(ALLTARGET) $(BUILDOPTS)
  220. $(MAKE) packages_$(ALLTARGET) $(BUILDOPTS)
  221. $(MAKE) fcl_$(ALLTARGET) $(BUILDOPTS)
  222. $(MAKE) utils_all $(BUILDOPTS)
  223. ifdef IDE
  224. $(MAKE) ide_full $(BUILDOPTS)
  225. endif
  226. $(ECHOREDIR) Build > build-stamp.$(OS_TARGET)
  227. installbase: build-stamp.$(OS_TARGET)
  228. # create dirs
  229. $(MKDIR) $(INSTALL_BASEDIR)
  230. $(MKDIR) $(INSTALL_DOCDIR)
  231. $(MKDIR) $(INSTALL_BINDIR)
  232. ifndef SNAPSHOT
  233. # readme & whatsnew and docs
  234. $(COPY) $(CVSINSTALL)/doc/*.txt $(CVSINSTALL)/doc/copying* $(CVSINSTALL)/doc/faq.* $(INSTALL_DOCDIR)
  235. # bingo32 (cwsdpmi,wmemu387.dxe)
  236. ifeq ($(OS_TARGET),go32v2)
  237. $(COPY) $(CVSINSTALL)/bingo32/* $(INSTALL_BINDIR)
  238. endif
  239. # binw32 (cygwin1.dll)
  240. ifeq ($(OS_TARGET),win32)
  241. $(COPY) $(CVSINSTALL)/binw32/* $(INSTALL_BINDIR)
  242. endif
  243. # manpages for linux
  244. ifeq ($(OS_TARGET),linux)
  245. $(MAKE) -C $(CVSINSTALL)/man installman
  246. endif
  247. ifeq ($(OS_TARGET),freebsd)
  248. $(MAKE) -C $(CVSINSTALL)/man installman
  249. endif
  250. endif
  251. # install generated things
  252. $(MAKE) compiler_$(INSTALLTARGET) $(INSTALLOPTS)
  253. $(MAKE) rtl_$(INSTALLTARGET) $(INSTALLOPTS)
  254. install: build-stamp.$(OS_TARGET)
  255. $(MAKE) installbase $(INSTALLOPTS)
  256. $(MAKE) packages_$(INSTALLTARGET) $(INSTALLOPTS)
  257. $(MAKE) fcl_$(INSTALLTARGET) $(INSTALLOPTS)
  258. $(MAKE) utils_$(INSTALLTARGET) $(INSTALLOPTS)
  259. ifdef IDE
  260. $(NOSTOP)$(MAKE) ide_$(INSTALLTARGET) $(BUILDOPTS)
  261. endif
  262. zipinstall: build-stamp.$(OS_TARGET)
  263. $(MAKE) fpc_zipinstall ZIPTARGET=installbase ZIPNAME=base$(ZIPSUFFIX) $(INSTALLOPTS)
  264. $(MAKE) packages_zip$(INSTALLTARGET) $(INSTALLOPTS) ZIPPREFIX=$(PKGPRE)
  265. $(MAKE) fcl_zip$(INSTALLTARGET) $(INSTALLOPTS) ZIPPREFIX=$(PKGPRE)
  266. $(MAKE) utils_zip$(INSTALLTARGET) $(INSTALLOPTS) ZIPNAME=util$(ZIPSUFFIX)
  267. ifdef IDE
  268. $(NOSTOP)$(MAKE) ide_zip$(INSTALLTARGET) $(INSTALLOPTS)
  269. endif
  270. ##########################################################################
  271. # Docs
  272. ##########################################################################
  273. .PHONY: docspdf docs docsrcinstall docsrc
  274. docspdf:
  275. $(MAKE) -C docs pdfinstall
  276. docs:
  277. $(MAKE) fpc_zipinstall ZIPTARGET=docspdf ZIPNAME=docs
  278. docsrcinstall:
  279. $(MAKE) -C docs clean
  280. $(MKDIR) $(INSTALL_SOURCEDIR)
  281. $(COPYTREE) docs $(INSTALL_SOURCEDIR)
  282. docsrc:
  283. $(MAKE) fpc_zipinstall ZIPTARGET=docsrcinstall ZIPNAME=docsrc
  284. ##########################################################################
  285. # Demos
  286. ##########################################################################
  287. .PHONY: demozip
  288. demozip:
  289. $(MAKE) -C $(CVSINSTALL)/demo zipsourceinstall ZIPNAME=demo
  290. ##########################################################################
  291. # Source targets
  292. ##########################################################################
  293. .PHONY: sourcebase sourcezip
  294. sourcebase:
  295. # base Makefiles needed for sources
  296. $(MKDIR) $(INSTALL_SOURCEDIR)
  297. $(MKDIR) $(INSTALL_SOURCEDIR)/rtl
  298. $(MKDIR) $(INSTALL_SOURCEDIR)/packages
  299. $(COPY) Makefile* $(INSTALL_SOURCEDIR)
  300. $(COPY) rtl/Makefile* $(INSTALL_SOURCEDIR)/rtl
  301. $(COPY) packages/Makefile* $(INSTALL_SOURCEDIR)/packages
  302. sourcezip: distclean
  303. $(MAKE) fpc_zipinstall ZIPTARGET=sourcebase ZIPNAME=basesrc
  304. $(MAKE) compiler_zipsourceinstall
  305. $(MAKE) rtl_zipsourceinstall
  306. $(MAKE) packages_zipsourceinstall
  307. $(MAKE) fcl_zipsourceinstall
  308. $(MAKE) utils_zipsourceinstall
  309. $(MAKE) ide_zipsourceinstall
  310. # $(MAKE) installersrc
  311. # $(MAKE) docsrc
  312. ##########################################################################
  313. # OS targets
  314. ##########################################################################
  315. .PHONY: go32v2 win32 linux freebsd os2 go32v2zip win32zip linuxzip freebsdzip os2zip
  316. go32v2: checkfpcdir
  317. $(MAKE) install OS_TARGET=go32v2
  318. win32: checkfpcdir
  319. $(MAKE) install OS_TARGET=win32
  320. linux: checkfpcdir
  321. $(MAKE) install OS_TARGET=linux
  322. freebsd: checkfpcdir
  323. $(MAKE) install OS_TARGET=freebsd
  324. os2: checkfpcdir
  325. $(MAKE) install OS_TARGET=os2
  326. go32v2zip: checkfpcdir
  327. $(MAKE) zipinstall OS_TARGET=go32v2
  328. win32zip: checkfpcdir
  329. $(MAKE) zipinstall OS_TARGET=win32
  330. linuxzip: checkfpcdir
  331. $(MAKE) zipinstall OS_TARGET=linux
  332. freebsdzip : checkfpcdir
  333. $(MAKE) zipinstall OS_TARGET=freebsd
  334. os2zip: checkfpcdir
  335. $(MAKE) zipinstall OS_TARGET=os2
  336. ##########################################################################
  337. # Debian / RPM
  338. ##########################################################################
  339. .PHONY: debcopy deb rpmcopy rpm
  340. DEBSRCDIR:=/usr/src/fpc-$(FPC_VERSION)
  341. debcopy: distclean
  342. rm -rf $(DEBSRCDIR)
  343. install -d $(DEBSRCDIR)
  344. $(COPYTREE) compiler $(DEBSRCDIR)
  345. $(COPYTREE) rtl $(DEBSRCDIR)
  346. $(COPYTREE) fcl $(DEBSRCDIR)
  347. $(COPYTREE) packages $(DEBSRCDIR)
  348. $(COPYTREE) utils $(DEBSRCDIR)
  349. $(COPYTREE) demo $(DEBSRCDIR)
  350. $(COPYTREE) logs $(DEBSRCDIR)
  351. $(COPYTREE) docs $(DEBSRCDIR)
  352. $(COPYTREE) Makefile* $(DEBSRCDIR)
  353. $(COPYTREE) $(CVSINSTALL)/debian $(DEBSRCDIR)
  354. $(COPYTREE) $(CVSINSTALL)/man $(DEBSRCDIR)
  355. $(COPYTREE) $(CVSINSTALL)/doc $(DEBSRCDIR)
  356. find $(DEBSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
  357. chmod 755 $(DEBSRCDIR)/debian/rules
  358. deb: checkfpcdir debcopy
  359. cd $(DEBSRCDIR) ; debian/rules binary
  360. REDHATDIR=/usr/src/redhat
  361. RPMSOURCESDIR:=$(REDHATDIR)/SOURCES
  362. RPMSPECDIR:=$(REDHATDIR)/SPECS
  363. RPMSRCDIR:=$(RPMSOURCESDIR)/fpc
  364. DOCSRCDIR:=$(RPMSOURCESDIR)/fpcdoc
  365. rpmcopy: distclean
  366. install -d $(REDHATDIR)
  367. install -d $(RPMSPECDIR)
  368. install -d $(RPMSOURCESDIR)
  369. # fpc.rpm
  370. rm -rf $(RPMSRCDIR)
  371. cp $(CVSINSTALL)/fpc.spec $(RPMSPECDIR)/fpc-$(FPC_VERSION).spec
  372. install -d $(RPMSRCDIR)
  373. $(COPYTREE) compiler $(RPMSRCDIR)
  374. $(COPYTREE) rtl $(RPMSRCDIR)
  375. $(COPYTREE) fcl $(RPMSRCDIR)
  376. $(COPYTREE) packages $(RPMSRCDIR)
  377. $(COPYTREE) utils $(RPMSRCDIR)
  378. $(COPYTREE) demo $(RPMSRCDIR)
  379. $(COPYTREE) logs $(RPMSRCDIR)
  380. $(COPYTREE) Makefile* $(RPMSRCDIR)
  381. $(COPYTREE) $(CVSINSTALL)/man $(RPMSRCDIR)
  382. $(COPYTREE) $(CVSINSTALL)/doc $(RPMSRCDIR)
  383. find $(RPMSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
  384. cd $(RPMSRCDIR) ; tar cvz * > $(RPMSOURCESDIR)/fpc-$(FPC_VERSION)-src.tar.gz
  385. # fpc-docs.rpm
  386. rm -rf $(DOCSRCDIR)
  387. cp $(CVSINSTALL)/fpc-docs.spec $(RPMSPECDIR)/fpc-docs-$(FPC_VERSION).spec
  388. install -d $(DOCSRCDIR)
  389. $(COPYTREE) docs $(DOCSRCDIR)
  390. find $(DOCSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
  391. cd $(DOCSRCDIR) ; tar cvz * > $(RPMSOURCESDIR)/fpc-docs-$(FPC_VERSION)-src.tar.gz
  392. rpm: checkfpcdir rpmcopy
  393. cd $(RPMSPECDIR) ; rpm --nodeps -ba fpc-$(FPC_VERSION).spec
  394. cd $(RPMSPECDIR) ; rpm --nodeps -ba fpc-docs-$(FPC_VERSION).spec