Makefile.fpc 12 KB

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