Makefile.fpc 13 KB

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