Makefile.fpc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  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. fpcdir=.
  11. rule=help
  12. [prerules]
  13. override FPCDIR:=$(BASEDIR)
  14. export FPCDIR
  15. # Check if install/ subdir is available
  16. ifneq ($(wildcard install),)
  17. CVSINSTALL=install
  18. else
  19. CVSINSTALL=.
  20. endif
  21. # Install target
  22. ifdef SNAPSHOT
  23. INSTALLTARGET=install
  24. else
  25. INSTALLTARGET=distinstall
  26. endif
  27. # All target
  28. ifdef SNAPSHOT
  29. ALLTARGET=all
  30. else
  31. ifndef ALLTARGET
  32. ifeq ($(OS_TARGET),win32)
  33. ALLTARGET=smart
  34. else
  35. ifeq ($(OS_TARGET),go32v2)
  36. ALLTARGET=smart
  37. else
  38. ifeq ($(OS_TARGET),linux)
  39. ALLTARGET=smart
  40. else
  41. ifeq ($(OS_TARGET),freebsd)
  42. ALLTARGET=smart
  43. else
  44. ALLTARGET=all
  45. endif
  46. endif
  47. endif
  48. endif
  49. endif
  50. endif
  51. # Stop with an error?
  52. ifdef SNAPSHOT
  53. NOSTOP=-
  54. else
  55. NOSTOP=
  56. endif
  57. # Prefix for units
  58. ifeq ($(OS_TARGET),linux)
  59. PKGPRE=units
  60. else
  61. ifeq ($(OS_TARGET),freebsd)
  62. PKGPRE=units
  63. else
  64. PKGPRE=u
  65. endif
  66. endif
  67. # Always compile for release
  68. override RELEASE=1
  69. export RELEASE
  70. # We want to have the resulting .zips in the current dir
  71. ifndef DIST_DESTDIR
  72. export DIST_DESTDIR:=$(BASEDIR)
  73. endif
  74. # Temporary path to pack a file
  75. BASEPACKDIR=$(BASEDIR)/basepack
  76. # Use new ppc386
  77. PPNEW=$(BASEDIR)/compiler/ppc386$(EXEEXT)
  78. # Don't use ppufiles for win32 becuase of commandline length problems
  79. ifneq ($(OS_TARGET),win32)
  80. PPUFILESNEW=$(BASEDIR)/utils/ppufiles$(EXEEXT)
  81. endif
  82. # Build/install options
  83. BUILDOPTS=FPC=$(PPNEW) RELEASE=1
  84. INSTALLOPTS=FPC=$(PPNEW) ZIPDESTDIR=$(BASEDIR)
  85. ifdef PPUFILESNEW
  86. override INSTALLOPTS+=PPUFILES=$(PPUFILESNEW)
  87. endif
  88. # Compile also IDE (check for ide and fv dir)
  89. ifneq ($(wildcard ide),)
  90. ifneq ($(wildcard fv),)
  91. ifeq ($(OS_TARGET),go32v2)
  92. IDE=1
  93. endif
  94. ifeq ($(OS_TARGET),win32)
  95. IDE=1
  96. endif
  97. ifeq ($(OS_TARGET),linux)
  98. IDE=1
  99. endif
  100. endif
  101. endif
  102. [rules]
  103. # These values can change
  104. unexport FPC_VERSION OS_SOURCE
  105. # Only process directories that really exists
  106. override TARGET_DIRS:=$(wildcard $(TARGET_DIRS))
  107. #####################################################################
  108. # Main targets
  109. #####################################################################
  110. .PHONY: help checkfpcdir
  111. help:
  112. @echo
  113. @echo Directory targets:
  114. @echo
  115. @echo $(TARGET_DIRS)
  116. @echo
  117. @echo Packing targets are:
  118. @echo
  119. @echo go32v2zip,win32zip,linuxzip,freebsdzip,sourcezip,os2zip
  120. @echo
  121. @exit
  122. #####################################################################
  123. # Dependencies
  124. #####################################################################
  125. #######################################
  126. # Compiler
  127. #######################################
  128. .PHONY: compiler_cycle compiler_fpcexe
  129. compiler_cycle:
  130. $(MAKE) -C compiler cycle
  131. compiler_fpcexe:
  132. $(MAKE) -C compiler fpcexe
  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. ifneq ($(wildcard packages/gdbint/libgdb/$(OS_TARGET)/libgdb.a),)
  142. ide_full:
  143. $(MAKE) -C compiler ppuclean
  144. $(MAKE) -C ide fullgdb
  145. else
  146. ide_full:
  147. $(MAKE) -C compiler ppuclean
  148. $(MAKE) -C ide full
  149. endif
  150. #######################################
  151. # Install targets
  152. #######################################
  153. demo_install:
  154. $(MAKE) -C $(CVSINSTALL)/demo sourceinstall
  155. man_install:
  156. $(MAKE) -C $(CVSINSTALL)/man installman
  157. doc_install:
  158. $(MAKE) -C $(CVSINSTALL)/doc installdoc
  159. #######################################
  160. # Packaging targets
  161. #######################################
  162. idezips: ide_fullzip ide_fullgdbzip optcompinstall optcompzip
  163. ide_compzip:
  164. $(MAKE) compiler_clean
  165. $(MAKE) ide_clean
  166. $(MAKE) ide_full
  167. $(MAKE) -C ide/text zipinstall ZIPNAME=ide-comp-$(PACKAGESUFFIX)
  168. ide_fullgdbzip:
  169. $(MAKE) ide_clean
  170. $(MAKE) ide_fullgdb
  171. $(MAKE) -C ide/text zipinstall ZIPNAME=ide-full-$(PACKAGESUFFIX)
  172. optcompinstall:
  173. $(MAKE) compiler_cycle OPT=-dNEWOPTIMIZATIONS
  174. $(MAKE) compiler_install
  175. $(MAKE) rtl_install
  176. optcompzip:
  177. $(MAKE) fpc_zipinstall PACKAGENAME=optcomp ZIPTARGET=optcompinstall
  178. ##########################################################################
  179. # Install
  180. ##########################################################################
  181. .PHONY: installer installersrc
  182. INSTALLERBUILDDIR=fpinst
  183. installer:
  184. $(COPYTREE) $(CVSINSTALL)/fpinst $(INSTALLERBUILDDIR)
  185. $(MAKE) -C $(INSTALLERBUILDDIR) all RELEASE=1
  186. $(MOVE) $(INSTALLERBUILDDIR)/install.exe .
  187. ifdef UPXPROG
  188. -$(UPXPROG) install.exe
  189. endif
  190. $(DELTREE) $(INSTALLERBUILDDIR)
  191. installersrc:
  192. $(COPYTREE) $(CVSINSTALL)/fpinst $(INSTALLERBUILDDIR)
  193. $(MAKE) -C $(INSTALLERBUILDDIR) zipsourceinstall
  194. $(DELTREE) $(INSTALLERBUILDDIR)
  195. ##########################################################################
  196. # Packaging
  197. ##########################################################################
  198. .PHONY: all clean distclean build install installbase zipinstall zipinstallbase zipinstallfcl \
  199. zipinstallpackages
  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) packages $(DEBSRCDIR)
  352. $(COPYTREE) utils $(DEBSRCDIR)
  353. $(COPYTREE) logs $(DEBSRCDIR)
  354. $(COPYTREE) docs $(DEBSRCDIR)
  355. $(COPYTREE) Makefile* $(DEBSRCDIR)
  356. $(COPYTREE) $(CVSINSTALL)/debian $(DEBSRCDIR)
  357. $(COPYTREE) $(CVSINSTALL)/man $(DEBSRCDIR)
  358. $(COPYTREE) $(CVSINSTALL)/doc $(DEBSRCDIR)
  359. $(COPYTREE) $(CVSINSTALL)/demo $(DEBSRCDIR)
  360. find $(DEBSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
  361. chmod 755 $(DEBSRCDIR)/debian/rules
  362. deb: checkfpcdir debcopy
  363. cd $(DEBSRCDIR) ; debian/rules binary
  364. REDHATDIR=/usr/src/redhat
  365. RPMSOURCESDIR:=$(REDHATDIR)/SOURCES
  366. RPMSPECDIR:=$(REDHATDIR)/SPECS
  367. RPMSRCDIR:=$(RPMSOURCESDIR)/fpc
  368. DOCSRCDIR:=$(RPMSOURCESDIR)/fpcdoc
  369. rpmcopy: distclean
  370. install -d $(REDHATDIR)
  371. install -d $(RPMSPECDIR)
  372. install -d $(RPMSOURCESDIR)
  373. # fpc.rpm
  374. rm -rf $(RPMSRCDIR)
  375. cp $(CVSINSTALL)/fpc.spec $(RPMSPECDIR)/fpc-$(FPC_VERSION).spec
  376. install -d $(RPMSRCDIR)
  377. $(COPYTREE) compiler $(RPMSRCDIR)
  378. $(COPYTREE) rtl $(RPMSRCDIR)
  379. $(COPYTREE) fcl $(RPMSRCDIR)
  380. $(COPYTREE) packages $(RPMSRCDIR)
  381. $(COPYTREE) utils $(RPMSRCDIR)
  382. $(COPYTREE) logs $(RPMSRCDIR)
  383. $(COPYTREE) Makefile* $(RPMSRCDIR)
  384. $(COPYTREE) $(CVSINSTALL)/man $(RPMSRCDIR)
  385. $(COPYTREE) $(CVSINSTALL)/doc $(RPMSRCDIR)
  386. $(COPYTREE) $(CVSINSTALL)/demo $(RPMSRCDIR)
  387. find $(RPMSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
  388. cd $(RPMSRCDIR) ; tar cvz * > $(RPMSOURCESDIR)/fpc-$(FPC_VERSION)-src.tar.gz
  389. # fpc-docs.rpm
  390. rm -rf $(DOCSRCDIR)
  391. cp $(CVSINSTALL)/fpc-docs.spec $(RPMSPECDIR)/fpc-docs-$(FPC_VERSION).spec
  392. install -d $(DOCSRCDIR)
  393. $(COPYTREE) docs $(DOCSRCDIR)
  394. find $(DOCSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
  395. cd $(DOCSRCDIR) ; tar cvz * > $(RPMSOURCESDIR)/fpc-docs-$(FPC_VERSION)-src.tar.gz
  396. rpm: checkfpcdir rpmcopy
  397. cd $(RPMSPECDIR) ; rpm -ba fpc-$(FPC_VERSION).spec
  398. cd $(RPMSPECDIR) ; rpm -ba fpc-docs-$(FPC_VERSION).spec