Makefile 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685
  1. #
  2. # Makefile generated by fpcmake v0.99.15 [2000/07/02]
  3. #
  4. defaultrule: help
  5. #####################################################################
  6. # Autodetect OS (Linux or Dos or Windows NT)
  7. # define inlinux when running under linux
  8. # define inWinNT when running under WinNT
  9. #####################################################################
  10. # We need only / in the path
  11. override PATH:=$(subst \,/,$(PATH))
  12. # Search for PWD and determine also if we are under linux
  13. PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
  14. ifeq ($(PWD),)
  15. PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
  16. ifeq ($(PWD),)
  17. nopwd:
  18. @echo You need the GNU utils package to use this Makefile!
  19. @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
  20. @exit
  21. else
  22. inlinux=1
  23. endif
  24. else
  25. PWD:=$(firstword $(PWD))
  26. endif
  27. # Detect NT - NT sets OS to Windows_NT
  28. ifndef inlinux
  29. ifeq ($(OS),Windows_NT)
  30. inWinNT=1
  31. endif
  32. endif
  33. # Detect OS/2 - OS/2 has OS2_SHELL defined
  34. ifndef inlinux
  35. ifndef inWinNT
  36. ifdef OS2_SHELL
  37. inOS2=1
  38. endif
  39. endif
  40. endif
  41. # The extension of executables
  42. ifdef inlinux
  43. EXEEXT=
  44. else
  45. EXEEXT=.exe
  46. endif
  47. # The path which is searched separated by spaces
  48. ifdef inlinux
  49. SEARCHPATH=$(subst :, ,$(PATH))
  50. else
  51. SEARCHPATH=$(subst ;, ,$(PATH))
  52. endif
  53. # Base dir
  54. ifdef PWD
  55. BASEDIR:=$(shell $(PWD))
  56. else
  57. BASEDIR=.
  58. endif
  59. #####################################################################
  60. # FPC version/target Detection
  61. #####################################################################
  62. # What compiler to use ?
  63. ifndef FPC
  64. # Compatibility with old makefiles
  65. ifdef PP
  66. FPC=$(PP)
  67. else
  68. ifdef inOS2
  69. FPC=ppos2
  70. else
  71. FPC=ppc386
  72. endif
  73. endif
  74. endif
  75. override FPC:=$(subst $(EXEEXT),,$(FPC))
  76. override FPC:=$(subst \,/,$(FPC))$(EXEEXT)
  77. # Target OS
  78. ifndef OS_TARGET
  79. OS_TARGET:=$(shell $(FPC) -iTO)
  80. endif
  81. # Source OS
  82. ifndef OS_SOURCE
  83. OS_SOURCE:=$(shell $(FPC) -iSO)
  84. endif
  85. # Target CPU
  86. ifndef CPU_TARGET
  87. CPU_TARGET:=$(shell $(FPC) -iTP)
  88. endif
  89. # Source CPU
  90. ifndef CPU_SOURCE
  91. CPU_SOURCE:=$(shell $(FPC) -iSP)
  92. endif
  93. # FPC version
  94. ifndef FPC_VERSION
  95. FPC_VERSION:=$(shell $(FPC) -iV)
  96. endif
  97. export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
  98. #####################################################################
  99. # Pre Settings
  100. #####################################################################
  101. OLDFPCDIR:=$(FPCDIR)
  102. checkfpcdir:
  103. ifdef OLDFPCDIR
  104. ifneq ($(OLDFPCDIR),)
  105. @echo ---------------------------------------------------------
  106. @echo
  107. @echo You must unset FPCDIR to use this the packaging rules.
  108. @echo
  109. @echo ---------------------------------------------------------
  110. @cantcontinuewithfpcdir
  111. endif
  112. endif
  113. # Check if install/ subdir is available
  114. ifneq ($(wildcard install),)
  115. CVSINSTALL=install
  116. else
  117. CVSINSTALL=.
  118. endif
  119. # All target
  120. ifdef SNAPSHOT
  121. ALLTARGET=all
  122. else
  123. ifndef ALLTARGET
  124. ifeq ($(OS_TARGET),win32)
  125. ALLTARGET=smart
  126. else
  127. ifeq ($(OS_TARGET),go32v2)
  128. ALLTARGET=smart
  129. else
  130. ALLTARGET=all
  131. endif
  132. endif
  133. endif
  134. endif
  135. # Stop with an error?
  136. ifdef SNAPSHOT
  137. NOSTOP=-
  138. else
  139. NOSTOP=
  140. endif
  141. # Prefix for units
  142. ifeq ($(OS_TARGET),linux)
  143. PKGPRE=units
  144. else
  145. PKGPRE=u
  146. endif
  147. # Test dir if none specified
  148. ifndef PREFIXINSTALLDIR
  149. ifdef inlinux
  150. PREFIXINSTALLDIR=/tmp/pptest
  151. else
  152. PREFIXINSTALLDIR=/pptest
  153. endif
  154. endif
  155. # Always compile for release
  156. override RELEASE=1
  157. export RELEASE
  158. # We want to have the resulting .zips in the current dir
  159. ifndef DESTZIPDIR
  160. export DESTZIPDIR:=$(BASEDIR)
  161. endif
  162. # Temporary path to pack a file
  163. BASEPACKDIR=$(BASEDIR)/basepack
  164. # Use new ppc386
  165. PPNEW=$(BASEDIR)/compiler/ppc386$(EXEEXT)
  166. # Don't use ppufiles for win32 becuase of commandline length problems
  167. ifneq ($(OS_TARGET),win32)
  168. PPUFILESNEW=$(BASEDIR)/utils/ppufiles$(EXEEXT)
  169. endif
  170. # Build/install options
  171. BUILDOPTS=FPC=$(PPNEW) RELEASE=1
  172. INSTALLOPTS=FPC=$(PPNEW) ZIPDESTDIR=$(BASEDIR)
  173. ifdef PPUFILESNEW
  174. override INSTALLOPT+=PPUFILES=$(PPUFILESNEW)
  175. endif
  176. # Compile also IDE (check for ide and fv dir)
  177. ifneq ($(wildcard ide),)
  178. ifneq ($(wildcard fv),)
  179. ifeq ($(OS_TARGET),go32v2)
  180. IDE=1
  181. endif
  182. ifeq ($(OS_TARGET),win32)
  183. IDE=1
  184. endif
  185. ifeq ($(OS_TARGET),linux)
  186. IDE=1
  187. endif
  188. endif
  189. endif
  190. #####################################################################
  191. # FPCDIR Setting
  192. #####################################################################
  193. # Test FPCDIR to look if the RTL dir exists
  194. ifdef FPCDIR
  195. override FPCDIR:=$(subst \,/,$(FPCDIR))
  196. ifeq ($(wildcard $(FPCDIR)/rtl),)
  197. ifeq ($(wildcard $(FPCDIR)/units),)
  198. override FPCDIR=wrong
  199. endif
  200. endif
  201. else
  202. override FPCDIR=wrong
  203. endif
  204. # Detect FPCDIR
  205. ifeq ($(FPCDIR),wrong)
  206. ifdef inlinux
  207. override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
  208. ifeq ($(wildcard $(FPCDIR)/units),)
  209. override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
  210. endif
  211. else
  212. override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
  213. override FPCDIR:=$(FPCDIR)/..
  214. ifeq ($(wildcard $(FPCDIR)/rtl),)
  215. ifeq ($(wildcard $(FPCDIR)/units),)
  216. override FPCDIR:=$(FPCDIR)/..
  217. ifeq ($(wildcard $(FPCDIR)/rtl),)
  218. ifeq ($(wildcard $(FPCDIR)/units),)
  219. override FPCDIR=c:/pp
  220. endif
  221. endif
  222. endif
  223. endif
  224. endif
  225. endif
  226. #####################################################################
  227. # User Settings
  228. #####################################################################
  229. # Targets
  230. override DIROBJECTS+=$(wildcard compiler rtl utils fcl api fv packages ide)
  231. # Clean
  232. # Install
  233. ZIPTARGET=install
  234. # Defaults
  235. # Directories
  236. # Packages
  237. # Libraries
  238. #####################################################################
  239. # Shell tools
  240. #####################################################################
  241. # echo
  242. ifndef ECHO
  243. ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
  244. ifeq ($(ECHO),)
  245. ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
  246. ifeq ($(ECHO),)
  247. ECHO:=echo
  248. ECHOE:=echo
  249. else
  250. ECHO:=$(firstword $(ECHO))
  251. ECHOE=$(ECHO) -E
  252. endif
  253. else
  254. ECHO:=$(firstword $(ECHO))
  255. ECHOE=$(ECHO) -E
  256. endif
  257. endif
  258. # To copy pograms
  259. ifndef COPY
  260. COPY:=cp -fp
  261. endif
  262. # Copy a whole tree
  263. ifndef COPYTREE
  264. COPYTREE:=cp -rfp
  265. endif
  266. # To move pograms
  267. ifndef MOVE
  268. MOVE:=mv -f
  269. endif
  270. # Check delete program
  271. ifndef DEL
  272. DEL:=rm -f
  273. endif
  274. # Check deltree program
  275. ifndef DELTREE
  276. DELTREE:=rm -rf
  277. endif
  278. # To install files
  279. ifndef INSTALL
  280. ifdef inlinux
  281. INSTALL:=install -m 644
  282. else
  283. INSTALL:=$(COPY)
  284. endif
  285. endif
  286. # To install programs
  287. ifndef INSTALLEXE
  288. ifdef inlinux
  289. INSTALLEXE:=install -m 755
  290. else
  291. INSTALLEXE:=$(COPY)
  292. endif
  293. endif
  294. # To make a directory.
  295. ifndef MKDIR
  296. ifdef inlinux
  297. MKDIR:=install -m 755 -d
  298. else
  299. MKDIR:=ginstall -m 755 -d
  300. endif
  301. endif
  302. export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
  303. #####################################################################
  304. # Default Tools
  305. #####################################################################
  306. # assembler, redefine it if cross compiling
  307. ifndef AS
  308. AS=as
  309. endif
  310. # linker, but probably not used
  311. ifndef LD
  312. LD=ld
  313. endif
  314. # ppas.bat / ppas.sh
  315. ifdef inlinux
  316. PPAS=ppas.sh
  317. else
  318. ifdef inOS2
  319. PPAS=ppas.cmd
  320. else
  321. PPAS=ppas.bat
  322. endif
  323. endif
  324. # ldconfig to rebuild .so cache
  325. ifdef inlinux
  326. LDCONFIG=ldconfig
  327. else
  328. LDCONFIG=
  329. endif
  330. # ppufiles
  331. ifndef PPUFILES
  332. PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
  333. ifeq ($(PPUFILES),)
  334. PPUFILES=
  335. else
  336. PPUFILES:=$(firstword $(PPUFILES))
  337. endif
  338. endif
  339. export PPUFILES
  340. # Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
  341. # upx uses that one itself (PFV)
  342. ifndef UPXPROG
  343. ifeq ($(OS_TARGET),go32v2)
  344. UPXPROG:=1
  345. endif
  346. ifeq ($(OS_TARGET),win32)
  347. UPXPROG:=1
  348. endif
  349. ifdef UPXPROG
  350. UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(SEARCHPATH))))
  351. ifeq ($(UPXPROG),)
  352. UPXPROG=
  353. else
  354. UPXPROG:=$(firstword $(UPXPROG))
  355. endif
  356. else
  357. UPXPROG=
  358. endif
  359. endif
  360. export UPXPROG
  361. # gdate/date
  362. ifndef DATE
  363. DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
  364. ifeq ($(DATE),)
  365. DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
  366. ifeq ($(DATE),)
  367. DATE=
  368. else
  369. DATE:=$(firstword $(DATE))
  370. endif
  371. else
  372. DATE:=$(firstword $(DATE))
  373. endif
  374. endif
  375. export DATE
  376. ifdef DATE
  377. DATESTR:=$(shell $(DATE) +%Y%m%d)
  378. else
  379. DATESTR=
  380. endif
  381. # ZipProg, you can't use Zip as the var name (PFV)
  382. ifndef ZIPPROG
  383. ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
  384. ifeq ($(ZIPPROG),)
  385. ZIPPROG=
  386. else
  387. ZIPPROG:=$(firstword $(ZIPPROG))
  388. endif
  389. endif
  390. export ZIPPROG
  391. ZIPOPT=-9
  392. ZIPEXT=.zip
  393. # Tar
  394. ifndef TARPROG
  395. TARPROG:=$(strip $(wildcard $(addsuffix /tar$(EXEEXT),$(SEARCHPATH))))
  396. ifeq ($(TARPROG),)
  397. TARPROG=
  398. else
  399. TARPROG:=$(firstword $(TARPROG))
  400. endif
  401. endif
  402. export TARPROG
  403. ifeq ($(USETAR),bz2)
  404. TAROPT=vI
  405. TAREXT=.tar.bz2
  406. else
  407. TAROPT=vz
  408. TAREXT=.tar.gz
  409. endif
  410. #####################################################################
  411. # Default extensions
  412. #####################################################################
  413. # Default needed extensions (Go32v2,Linux)
  414. LOADEREXT=.as
  415. PPLEXT=.ppl
  416. PPUEXT=.ppu
  417. OEXT=.o
  418. ASMEXT=.s
  419. SMARTEXT=.sl
  420. STATICLIBEXT=.a
  421. SHAREDLIBEXT=.so
  422. RSTEXT=.rst
  423. FPCMADE=fpcmade
  424. # Go32v1
  425. ifeq ($(OS_TARGET),go32v1)
  426. PPUEXT=.pp1
  427. OEXT=.o1
  428. ASMEXT=.s1
  429. SMARTEXT=.sl1
  430. STATICLIBEXT=.a1
  431. SHAREDLIBEXT=.so1
  432. FPCMADE=fpcmade.v1
  433. endif
  434. # Go32v2
  435. ifeq ($(OS_TARGET),go32v2)
  436. FPCMADE=fpcmade.dos
  437. endif
  438. # Linux
  439. ifeq ($(OS_TARGET),linux)
  440. FPCMADE=fpcmade.lnx
  441. endif
  442. # Win32
  443. ifeq ($(OS_TARGET),win32)
  444. PPUEXT=.ppw
  445. OEXT=.ow
  446. ASMEXT=.sw
  447. SMARTEXT=.slw
  448. STATICLIBEXT=.aw
  449. SHAREDLIBEXT=.dll
  450. FPCMADE=fpcmade.w32
  451. endif
  452. # OS/2
  453. ifeq ($(OS_TARGET),os2)
  454. PPUEXT=.ppo
  455. ASMEXT=.so2
  456. OEXT=.oo2
  457. SMARTEXT=.so
  458. STATICLIBEXT=.ao2
  459. SHAREDLIBEXT=.dll
  460. FPCMADE=fpcmade.os2
  461. endif
  462. # library prefix
  463. LIBPREFIX=lib
  464. ifeq ($(OS_TARGET),go32v2)
  465. LIBPREFIX=
  466. endif
  467. ifeq ($(OS_TARGET),go32v1)
  468. LIBPREFIX=
  469. endif
  470. # determine which .pas extension is used
  471. ifndef PASEXT
  472. ifdef EXEOBJECTS
  473. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
  474. else
  475. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
  476. endif
  477. ifeq ($(TESTPAS),)
  478. PASEXT=.pp
  479. else
  480. PASEXT=.pas
  481. endif
  482. endif
  483. #####################################################################
  484. # Default Directories
  485. #####################################################################
  486. # set the prefix directory where to install everything
  487. ifndef PREFIXINSTALLDIR
  488. ifdef inlinux
  489. PREFIXINSTALLDIR=/usr
  490. else
  491. PREFIXINSTALLDIR=/pp
  492. endif
  493. endif
  494. export PREFIXINSTALLDIR
  495. # Where to place the resulting zip files
  496. ifndef DESTZIPDIR
  497. DESTZIPDIR:=$(BASEDIR)
  498. endif
  499. export DESTZIPDIR
  500. #####################################################################
  501. # Install Directories
  502. #####################################################################
  503. # set the base directory where to install everything
  504. ifndef BASEINSTALLDIR
  505. ifdef inlinux
  506. BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
  507. else
  508. BASEINSTALLDIR=$(PREFIXINSTALLDIR)
  509. endif
  510. endif
  511. # set the directory where to install the binaries
  512. ifndef BININSTALLDIR
  513. ifdef inlinux
  514. BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
  515. else
  516. BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
  517. endif
  518. endif
  519. # set the directory where to install the units.
  520. ifndef UNITINSTALLDIR
  521. UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)
  522. ifdef UNITSUBDIR
  523. UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)
  524. endif
  525. endif
  526. # Where to install shared libraries
  527. ifndef LIBINSTALLDIR
  528. ifdef inlinux
  529. LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
  530. else
  531. LIBINSTALLDIR=$(UNITINSTALLDIR)
  532. endif
  533. endif
  534. # Where the source files will be stored
  535. ifndef SOURCEINSTALLDIR
  536. ifdef inlinux
  537. SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
  538. else
  539. SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
  540. endif
  541. ifdef SOURCESUBDIR
  542. SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)
  543. endif
  544. endif
  545. # Where the doc files will be stored
  546. ifndef DOCINSTALLDIR
  547. ifdef inlinux
  548. DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
  549. else
  550. DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
  551. endif
  552. endif
  553. # Where to install the examples, under linux we use the doc dir
  554. # because the copytree command will create a subdir itself
  555. ifndef EXAMPLEINSTALLDIR
  556. ifdef inlinux
  557. EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
  558. else
  559. EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
  560. endif
  561. ifdef EXAMPLESUBDIR
  562. EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR)
  563. endif
  564. endif
  565. # Where the some extra (data)files will be stored
  566. ifndef DATAINSTALLDIR
  567. DATAINSTALLDIR=$(BASEINSTALLDIR)
  568. endif
  569. #####################################################################
  570. # Redirection
  571. #####################################################################
  572. ifndef REDIRFILE
  573. REDIRFILE=log
  574. endif
  575. ifdef REDIR
  576. ifndef inlinux
  577. override FPC=redir -eo $(FPC)
  578. endif
  579. # set the verbosity to max
  580. override FPCOPT+=-va
  581. override REDIR:= >> $(REDIRFILE)
  582. endif
  583. #####################################################################
  584. # Standard rules
  585. #####################################################################
  586. debug: $(addsuffix _debug,$(DIROBJECTS))
  587. smart: $(addsuffix _smart,$(DIROBJECTS))
  588. shared: $(addsuffix _shared,$(DIROBJECTS))
  589. showinstall: $(addsuffix _showinstall,$(DIROBJECTS))
  590. cleanall: fpc_cleanall $(addsuffix _cleanall,$(DIROBJECTS))
  591. require: $(addsuffix _require,$(DIROBJECTS))
  592. .PHONY: debug smart shared showinstall cleanall require
  593. #####################################################################
  594. # Zip
  595. #####################################################################
  596. .PHONY: fpc_zipinstall
  597. # Create suffix to add
  598. ifndef PACKAGESUFFIX
  599. PACKAGESUFFIX=$(OS_TARGET)
  600. ifeq ($(OS_TARGET),go32v2)
  601. PACKAGESUFFIX=go32
  602. endif
  603. ifeq ($(OS_TARGET),win32)
  604. PACKAGESUFFIX=w32
  605. endif
  606. endif
  607. # Temporary path to pack a file
  608. ifndef PACKDIR
  609. ifndef inlinux
  610. PACKDIR=$(BASEDIR)/pack_tmp
  611. else
  612. PACKDIR=/tmp/fpc-pack
  613. endif
  614. endif
  615. # Maybe create default zipname from packagename
  616. ifndef ZIPNAME
  617. ifdef PACKAGENAME
  618. ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX)
  619. endif
  620. endif
  621. # Use tar by default under linux
  622. ifndef USEZIP
  623. ifdef inlinux
  624. USETAR=1
  625. endif
  626. endif
  627. fpc_zipinstall:
  628. ifndef ZIPNAME
  629. @$(ECHO) "Please specify ZIPNAME!"
  630. @exit 1
  631. else
  632. $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
  633. ifdef USETAR
  634. $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
  635. cd $(PACKDIR) ; $(TARPROG) c$(TAROPT) --file $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
  636. else
  637. $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
  638. cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)
  639. endif
  640. $(DELTREE) $(PACKDIR)
  641. endif
  642. #####################################################################
  643. # Clean rules
  644. #####################################################################
  645. .PHONY: fpc_clean fpc_cleanall fpc_distclean
  646. ifdef EXTRACLEANUNITS
  647. override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
  648. endif
  649. ifdef CLEANPPUFILES
  650. ifdef PPUFILES
  651. CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
  652. else
  653. CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)))
  654. endif
  655. endif
  656. fpc_clean: $(CLEANTARGET)
  657. ifdef CLEANEXEFILES
  658. -$(DEL) $(CLEANEXEFILES)
  659. endif
  660. ifdef CLEANPPUFILES
  661. -$(DEL) $(CLEANPPUFILES)
  662. endif
  663. ifneq ($(CLEANPPULINKFILES),)
  664. -$(DEL) $(CLEANPPULINKFILES)
  665. endif
  666. ifdef CLEANRSTFILES
  667. -$(DEL) $(CLEANRSTFILES)
  668. endif
  669. ifdef EXTRACLEANFILES
  670. -$(DEL) $(EXTRACLEANFILES)
  671. endif
  672. ifdef LIBNAME
  673. -$(DEL) $(LIBNAME) $(LIBFULLNAME)
  674. endif
  675. -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
  676. fpc_distclean: fpc_clean
  677. fpc_cleanall: $(CLEANTARGET)
  678. ifdef CLEANEXEFILES
  679. -$(DEL) $(CLEANEXEFILES)
  680. endif
  681. -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  682. -$(DELTREE) *$(SMARTEXT)
  683. -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
  684. #####################################################################
  685. # Directories
  686. #####################################################################
  687. OBJECTDIRCOMPILER=1
  688. OBJECTDIRRTL=1
  689. OBJECTDIRUTILS=1
  690. OBJECTDIRFCL=1
  691. OBJECTDIRAPI=1
  692. OBJECTDIRFV=1
  693. OBJECTDIRPACKAGES=1
  694. OBJECTDIRIDE=1
  695. # Dir compiler
  696. ifdef OBJECTDIRCOMPILER
  697. .PHONY: compiler_all compiler_debug compiler_examples compiler_test compiler_smart compiler_shared compiler_showinstall compiler_install compiler_sourceinstall compiler_exampleinstall compiler_zipinstall compiler_zipsourceinstall compiler_zipexampleinstall compiler_clean compiler_distclean compiler_cleanall compiler_require compiler_info
  698. compiler_all:
  699. $(MAKE) -C compiler all
  700. compiler_debug:
  701. $(MAKE) -C compiler debug
  702. compiler_examples:
  703. $(MAKE) -C compiler examples
  704. compiler_test:
  705. $(MAKE) -C compiler test
  706. compiler_smart:
  707. $(MAKE) -C compiler smart
  708. compiler_shared:
  709. $(MAKE) -C compiler shared
  710. compiler_showinstall:
  711. $(MAKE) -C compiler showinstall
  712. compiler_install:
  713. $(MAKE) -C compiler install
  714. compiler_sourceinstall:
  715. $(MAKE) -C compiler sourceinstall
  716. compiler_exampleinstall:
  717. $(MAKE) -C compiler exampleinstall
  718. compiler_zipinstall:
  719. $(MAKE) -C compiler zipinstall
  720. compiler_zipsourceinstall:
  721. $(MAKE) -C compiler zipsourceinstall
  722. compiler_zipexampleinstall:
  723. $(MAKE) -C compiler zipexampleinstall
  724. compiler_clean:
  725. $(MAKE) -C compiler clean
  726. compiler_distclean:
  727. $(MAKE) -C compiler distclean
  728. compiler_cleanall:
  729. $(MAKE) -C compiler cleanall
  730. compiler_require:
  731. $(MAKE) -C compiler require
  732. compiler_info:
  733. $(MAKE) -C compiler info
  734. endif
  735. # Dir rtl
  736. ifdef OBJECTDIRRTL
  737. .PHONY: rtl_all rtl_debug rtl_examples rtl_test rtl_smart rtl_shared rtl_showinstall rtl_install rtl_sourceinstall rtl_exampleinstall rtl_zipinstall rtl_zipsourceinstall rtl_zipexampleinstall rtl_clean rtl_distclean rtl_cleanall rtl_require rtl_info
  738. rtl_all:
  739. $(MAKE) -C rtl all
  740. rtl_debug:
  741. $(MAKE) -C rtl debug
  742. rtl_examples:
  743. $(MAKE) -C rtl examples
  744. rtl_test:
  745. $(MAKE) -C rtl test
  746. rtl_smart:
  747. $(MAKE) -C rtl smart
  748. rtl_shared:
  749. $(MAKE) -C rtl shared
  750. rtl_showinstall:
  751. $(MAKE) -C rtl showinstall
  752. rtl_install:
  753. $(MAKE) -C rtl install
  754. rtl_sourceinstall:
  755. $(MAKE) -C rtl sourceinstall
  756. rtl_exampleinstall:
  757. $(MAKE) -C rtl exampleinstall
  758. rtl_zipinstall:
  759. $(MAKE) -C rtl zipinstall
  760. rtl_zipsourceinstall:
  761. $(MAKE) -C rtl zipsourceinstall
  762. rtl_zipexampleinstall:
  763. $(MAKE) -C rtl zipexampleinstall
  764. rtl_clean:
  765. $(MAKE) -C rtl clean
  766. rtl_distclean:
  767. $(MAKE) -C rtl distclean
  768. rtl_cleanall:
  769. $(MAKE) -C rtl cleanall
  770. rtl_require:
  771. $(MAKE) -C rtl require
  772. rtl_info:
  773. $(MAKE) -C rtl info
  774. endif
  775. # Dir utils
  776. ifdef OBJECTDIRUTILS
  777. .PHONY: utils_all utils_debug utils_examples utils_test utils_smart utils_shared utils_showinstall utils_install utils_sourceinstall utils_exampleinstall utils_zipinstall utils_zipsourceinstall utils_zipexampleinstall utils_clean utils_distclean utils_cleanall utils_require utils_info
  778. utils_all:
  779. $(MAKE) -C utils all
  780. utils_debug:
  781. $(MAKE) -C utils debug
  782. utils_examples:
  783. $(MAKE) -C utils examples
  784. utils_test:
  785. $(MAKE) -C utils test
  786. utils_smart:
  787. $(MAKE) -C utils smart
  788. utils_shared:
  789. $(MAKE) -C utils shared
  790. utils_showinstall:
  791. $(MAKE) -C utils showinstall
  792. utils_install:
  793. $(MAKE) -C utils install
  794. utils_sourceinstall:
  795. $(MAKE) -C utils sourceinstall
  796. utils_exampleinstall:
  797. $(MAKE) -C utils exampleinstall
  798. utils_zipinstall:
  799. $(MAKE) -C utils zipinstall
  800. utils_zipsourceinstall:
  801. $(MAKE) -C utils zipsourceinstall
  802. utils_zipexampleinstall:
  803. $(MAKE) -C utils zipexampleinstall
  804. utils_clean:
  805. $(MAKE) -C utils clean
  806. utils_distclean:
  807. $(MAKE) -C utils distclean
  808. utils_cleanall:
  809. $(MAKE) -C utils cleanall
  810. utils_require:
  811. $(MAKE) -C utils require
  812. utils_info:
  813. $(MAKE) -C utils info
  814. endif
  815. # Dir fcl
  816. ifdef OBJECTDIRFCL
  817. .PHONY: fcl_all fcl_debug fcl_examples fcl_test fcl_smart fcl_shared fcl_showinstall fcl_install fcl_sourceinstall fcl_exampleinstall fcl_zipinstall fcl_zipsourceinstall fcl_zipexampleinstall fcl_clean fcl_distclean fcl_cleanall fcl_require fcl_info
  818. fcl_all:
  819. $(MAKE) -C fcl all
  820. fcl_debug:
  821. $(MAKE) -C fcl debug
  822. fcl_examples:
  823. $(MAKE) -C fcl examples
  824. fcl_test:
  825. $(MAKE) -C fcl test
  826. fcl_smart:
  827. $(MAKE) -C fcl smart
  828. fcl_shared:
  829. $(MAKE) -C fcl shared
  830. fcl_showinstall:
  831. $(MAKE) -C fcl showinstall
  832. fcl_install:
  833. $(MAKE) -C fcl install
  834. fcl_sourceinstall:
  835. $(MAKE) -C fcl sourceinstall
  836. fcl_exampleinstall:
  837. $(MAKE) -C fcl exampleinstall
  838. fcl_zipinstall:
  839. $(MAKE) -C fcl zipinstall
  840. fcl_zipsourceinstall:
  841. $(MAKE) -C fcl zipsourceinstall
  842. fcl_zipexampleinstall:
  843. $(MAKE) -C fcl zipexampleinstall
  844. fcl_clean:
  845. $(MAKE) -C fcl clean
  846. fcl_distclean:
  847. $(MAKE) -C fcl distclean
  848. fcl_cleanall:
  849. $(MAKE) -C fcl cleanall
  850. fcl_require:
  851. $(MAKE) -C fcl require
  852. fcl_info:
  853. $(MAKE) -C fcl info
  854. endif
  855. # Dir api
  856. ifdef OBJECTDIRAPI
  857. .PHONY: api_all api_debug api_examples api_test api_smart api_shared api_showinstall api_install api_sourceinstall api_exampleinstall api_zipinstall api_zipsourceinstall api_zipexampleinstall api_clean api_distclean api_cleanall api_require api_info
  858. api_all:
  859. $(MAKE) -C api all
  860. api_debug:
  861. $(MAKE) -C api debug
  862. api_examples:
  863. $(MAKE) -C api examples
  864. api_test:
  865. $(MAKE) -C api test
  866. api_smart:
  867. $(MAKE) -C api smart
  868. api_shared:
  869. $(MAKE) -C api shared
  870. api_showinstall:
  871. $(MAKE) -C api showinstall
  872. api_install:
  873. $(MAKE) -C api install
  874. api_sourceinstall:
  875. $(MAKE) -C api sourceinstall
  876. api_exampleinstall:
  877. $(MAKE) -C api exampleinstall
  878. api_zipinstall:
  879. $(MAKE) -C api zipinstall
  880. api_zipsourceinstall:
  881. $(MAKE) -C api zipsourceinstall
  882. api_zipexampleinstall:
  883. $(MAKE) -C api zipexampleinstall
  884. api_clean:
  885. $(MAKE) -C api clean
  886. api_distclean:
  887. $(MAKE) -C api distclean
  888. api_cleanall:
  889. $(MAKE) -C api cleanall
  890. api_require:
  891. $(MAKE) -C api require
  892. api_info:
  893. $(MAKE) -C api info
  894. endif
  895. # Dir fv
  896. ifdef OBJECTDIRFV
  897. .PHONY: fv_all fv_debug fv_examples fv_test fv_smart fv_shared fv_showinstall fv_install fv_sourceinstall fv_exampleinstall fv_zipinstall fv_zipsourceinstall fv_zipexampleinstall fv_clean fv_distclean fv_cleanall fv_require fv_info
  898. fv_all:
  899. $(MAKE) -C fv all
  900. fv_debug:
  901. $(MAKE) -C fv debug
  902. fv_examples:
  903. $(MAKE) -C fv examples
  904. fv_test:
  905. $(MAKE) -C fv test
  906. fv_smart:
  907. $(MAKE) -C fv smart
  908. fv_shared:
  909. $(MAKE) -C fv shared
  910. fv_showinstall:
  911. $(MAKE) -C fv showinstall
  912. fv_install:
  913. $(MAKE) -C fv install
  914. fv_sourceinstall:
  915. $(MAKE) -C fv sourceinstall
  916. fv_exampleinstall:
  917. $(MAKE) -C fv exampleinstall
  918. fv_zipinstall:
  919. $(MAKE) -C fv zipinstall
  920. fv_zipsourceinstall:
  921. $(MAKE) -C fv zipsourceinstall
  922. fv_zipexampleinstall:
  923. $(MAKE) -C fv zipexampleinstall
  924. fv_clean:
  925. $(MAKE) -C fv clean
  926. fv_distclean:
  927. $(MAKE) -C fv distclean
  928. fv_cleanall:
  929. $(MAKE) -C fv cleanall
  930. fv_require:
  931. $(MAKE) -C fv require
  932. fv_info:
  933. $(MAKE) -C fv info
  934. endif
  935. # Dir packages
  936. ifdef OBJECTDIRPACKAGES
  937. .PHONY: packages_all packages_debug packages_examples packages_test packages_smart packages_shared packages_showinstall packages_install packages_sourceinstall packages_exampleinstall packages_zipinstall packages_zipsourceinstall packages_zipexampleinstall packages_clean packages_distclean packages_cleanall packages_require packages_info
  938. packages_all:
  939. $(MAKE) -C packages all
  940. packages_debug:
  941. $(MAKE) -C packages debug
  942. packages_examples:
  943. $(MAKE) -C packages examples
  944. packages_test:
  945. $(MAKE) -C packages test
  946. packages_smart:
  947. $(MAKE) -C packages smart
  948. packages_shared:
  949. $(MAKE) -C packages shared
  950. packages_showinstall:
  951. $(MAKE) -C packages showinstall
  952. packages_install:
  953. $(MAKE) -C packages install
  954. packages_sourceinstall:
  955. $(MAKE) -C packages sourceinstall
  956. packages_exampleinstall:
  957. $(MAKE) -C packages exampleinstall
  958. packages_zipinstall:
  959. $(MAKE) -C packages zipinstall
  960. packages_zipsourceinstall:
  961. $(MAKE) -C packages zipsourceinstall
  962. packages_zipexampleinstall:
  963. $(MAKE) -C packages zipexampleinstall
  964. packages_clean:
  965. $(MAKE) -C packages clean
  966. packages_distclean:
  967. $(MAKE) -C packages distclean
  968. packages_cleanall:
  969. $(MAKE) -C packages cleanall
  970. packages_require:
  971. $(MAKE) -C packages require
  972. packages_info:
  973. $(MAKE) -C packages info
  974. endif
  975. # Dir ide
  976. ifdef OBJECTDIRIDE
  977. .PHONY: ide_all ide_debug ide_examples ide_test ide_smart ide_shared ide_showinstall ide_install ide_sourceinstall ide_exampleinstall ide_zipinstall ide_zipsourceinstall ide_zipexampleinstall ide_clean ide_distclean ide_cleanall ide_require ide_info
  978. ide_all:
  979. $(MAKE) -C ide all
  980. ide_debug:
  981. $(MAKE) -C ide debug
  982. ide_examples:
  983. $(MAKE) -C ide examples
  984. ide_test:
  985. $(MAKE) -C ide test
  986. ide_smart:
  987. $(MAKE) -C ide smart
  988. ide_shared:
  989. $(MAKE) -C ide shared
  990. ide_showinstall:
  991. $(MAKE) -C ide showinstall
  992. ide_install:
  993. $(MAKE) -C ide install
  994. ide_sourceinstall:
  995. $(MAKE) -C ide sourceinstall
  996. ide_exampleinstall:
  997. $(MAKE) -C ide exampleinstall
  998. ide_zipinstall:
  999. $(MAKE) -C ide zipinstall
  1000. ide_zipsourceinstall:
  1001. $(MAKE) -C ide zipsourceinstall
  1002. ide_zipexampleinstall:
  1003. $(MAKE) -C ide zipexampleinstall
  1004. ide_clean:
  1005. $(MAKE) -C ide clean
  1006. ide_distclean:
  1007. $(MAKE) -C ide distclean
  1008. ide_cleanall:
  1009. $(MAKE) -C ide cleanall
  1010. ide_require:
  1011. $(MAKE) -C ide require
  1012. ide_info:
  1013. $(MAKE) -C ide info
  1014. endif
  1015. #####################################################################
  1016. # Local Makefile
  1017. #####################################################################
  1018. ifneq ($(wildcard fpcmake.loc),)
  1019. include fpcmake.loc
  1020. endif
  1021. #####################################################################
  1022. # Users rules
  1023. #####################################################################
  1024. # These values can change
  1025. unexport FPC_VERSION OS_SOURCE
  1026. #####################################################################
  1027. # Main targets
  1028. #####################################################################
  1029. .PHONY: help checkfpcdir
  1030. help:
  1031. @echo
  1032. @echo Directory targets:
  1033. @echo
  1034. @echo $(DIROBJECTS)
  1035. @echo
  1036. @echo Packing targets are:
  1037. @echo
  1038. @echo go32v2zip,win32zip,linuxzip,sourcezip
  1039. @echo
  1040. @exit
  1041. #####################################################################
  1042. # Dependencies
  1043. #####################################################################
  1044. #######################################
  1045. # Compiler
  1046. #######################################
  1047. .PHONY: compiler_cycle
  1048. compiler_cycle:
  1049. $(MAKE) -C compiler cycle
  1050. #######################################
  1051. # IDE
  1052. #######################################
  1053. .PHONY: ide_comp ide_full
  1054. ide_comp:
  1055. $(MAKE) -C compiler ppuclean
  1056. $(MAKE) -C ide full
  1057. # Look if libgdb.a is available then use fullgdb
  1058. ifneq ($(wildcard packages/gdbint/libgdb/$(OS_TARGET)/libgdb.a),)
  1059. ide_full:
  1060. $(MAKE) -C compiler ppuclean
  1061. $(MAKE) -C ide fullgdb
  1062. else
  1063. ide_full:
  1064. $(MAKE) -C compiler ppuclean
  1065. $(MAKE) -C ide full
  1066. endif
  1067. #######################################
  1068. # Install targets
  1069. #######################################
  1070. demo_install:
  1071. $(MAKE) -C $(CVSINSTALL)/demo sourceinstall
  1072. man_install:
  1073. $(MAKE) -C $(CVSINSTALL)/man installman
  1074. doc_install:
  1075. $(MAKE) -C $(CVSINSTALL)/doc installdoc
  1076. #######################################
  1077. # Packaging targets
  1078. #######################################
  1079. idezips: ide_fullzip ide_fullgdbzip optcompinstall optcompzip
  1080. ide_compzip:
  1081. $(MAKE) compiler_clean
  1082. $(MAKE) ide_clean
  1083. $(MAKE) ide_full
  1084. $(MAKE) -C ide/text zipinstall ZIPNAME=ide-comp-$(PACKAGESUFFIX)
  1085. ide_fullgdbzip:
  1086. $(MAKE) ide_clean
  1087. $(MAKE) ide_fullgdb
  1088. $(MAKE) -C ide/text zipinstall ZIPNAME=ide-full-$(PACKAGESUFFIX)
  1089. optcompinstall:
  1090. $(MAKE) compiler_cycle OPT=-dNEWOPTIMIZATIONS
  1091. $(MAKE) compiler_install
  1092. $(MAKE) rtl_install
  1093. optcompzip:
  1094. $(MAKE) fpc_zipinstall PACKAGENAME=optcomp ZIPTARGET=optcompinstall
  1095. ##########################################################################
  1096. # Install
  1097. ##########################################################################
  1098. .PHONY: installer installersrc
  1099. INSTALLERBUILDDIR=fpinst
  1100. installer:
  1101. $(COPYTREE) $(CVSINSTALL)/fpinst $(INSTALLERBUILDDIR)
  1102. $(MAKE) -C $(INSTALLERBUILDDIR) all RELEASE=1
  1103. $(MOVE) $(INSTALLERBUILDDIR)/install.exe .
  1104. ifdef UPXPROG
  1105. -$(UPXPROG) install.exe
  1106. endif
  1107. $(DELTREE) $(INSTALLERBUILDDIR)
  1108. installersrc:
  1109. $(COPYTREE) $(CVSINSTALL)/fpinst $(INSTALLERBUILDDIR)
  1110. $(MAKE) -C $(INSTALLERBUILDDIR) zipsourceinstall
  1111. $(DELTREE) $(INSTALLERBUILDDIR)
  1112. ##########################################################################
  1113. # Packaging
  1114. ##########################################################################
  1115. .PHONY: all clean distclean build install installbase zipinstall zipinstallbase zipinstallfcl \
  1116. zipinstallpackages
  1117. export RELEASE DESTZIPDIR
  1118. all: build
  1119. clean: $(addsuffix _distclean,$(DIROBJECTS))
  1120. $(DEL) build-stamp.$(OS_TARGET)
  1121. distclean: clean
  1122. build: build-stamp.$(OS_TARGET)
  1123. build-stamp.$(OS_TARGET):
  1124. # create new compiler
  1125. ifeq ($(OS_TARGET),win32)
  1126. -$(MAKE) compiler_cycle
  1127. else
  1128. $(MAKE) compiler_cycle
  1129. endif
  1130. # clean
  1131. $(MAKE) rtl_clean
  1132. $(MAKE) api_clean
  1133. $(MAKE) fcl_clean
  1134. $(MAKE) packages_clean
  1135. $(MAKE) utils_clean
  1136. ifdef IDE
  1137. $(MAKE) fv_clean
  1138. $(MAKE) ide_clean
  1139. endif
  1140. # build everything
  1141. $(MAKE) rtl_$(ALLTARGET) $(BUILDOPTS)
  1142. $(MAKE) api_$(ALLTARGET) $(BUILDOPTS)
  1143. $(MAKE) fcl_$(ALLTARGET) $(BUILDOPTS)
  1144. $(MAKE) packages_$(ALLTARGET) $(BUILDOPTS)
  1145. $(MAKE) utils_all $(BUILDOPTS)
  1146. ifdef IDE
  1147. -$(MAKE) ide_full $(BUILDOPTS)
  1148. endif
  1149. $(ECHO) Build > build-stamp.$(OS_TARGET)
  1150. installbase: build-stamp.$(OS_TARGET)
  1151. # create dirs
  1152. $(MKDIR) $(BASEINSTALLDIR)
  1153. $(MKDIR) $(DOCINSTALLDIR)
  1154. $(MKDIR) $(BININSTALLDIR)
  1155. ifndef SNAPSHOT
  1156. # readme & whatsnew and docs
  1157. $(COPY) $(CVSINSTALL)/doc/*.txt $(CVSINSTALL)/doc/copying* $(CVSINSTALL)/doc/faq.* $(DOCINSTALLDIR)
  1158. # bingo32 (cwsdpmi,wmemu387.dxe)
  1159. ifeq ($(OS_TARGET),go32v2)
  1160. $(COPY) $(CVSINSTALL)/bingo32/* $(BININSTALLDIR)
  1161. endif
  1162. # binw32 (cygwin1.dll)
  1163. ifeq ($(OS_TARGET),win32)
  1164. $(COPY) $(CVSINSTALL)/binw32/* $(BININSTALLDIR)
  1165. endif
  1166. # manpages for linux
  1167. ifeq ($(OS_TARGET),linux)
  1168. $(MAKE) -C $(CVSINSTALL)/man installman
  1169. endif
  1170. endif
  1171. # install generated things
  1172. $(MAKE) compiler_install $(INSTALLOPTS)
  1173. $(MAKE) rtl_install $(INSTALLOPTS)
  1174. install: build-stamp.$(OS_TARGET)
  1175. $(MAKE) installbase $(INSTALLOPTS)
  1176. $(MAKE) utils_install $(INSTALLOPTS)
  1177. $(MAKE) api_install $(INSTALLOPTS)
  1178. $(MAKE) fcl_install $(INSTALLOPTS)
  1179. $(MAKE) packages_install $(INSTALLOPTS)
  1180. ifdef IDE
  1181. $(NOSTOP)$(MAKE) ide_install $(BUILDOPTS)
  1182. endif
  1183. # install examples
  1184. ifndef SNAPSHOT
  1185. $(MAKE) fcl_exampleinstall $(INSTALLOPTS)
  1186. $(MAKE) api_exampleinstall $(INSTALLOPTS)
  1187. $(MAKE) packages_exampleinstall $(INSTALLOPTS)
  1188. endif
  1189. zipinstall: build-stamp.$(OS_TARGET)
  1190. $(MAKE) fpc_zipinstall ZIPTARGET=installbase PACKAGENAME=base $(INSTALLOPTS)
  1191. $(MAKE) utils_zipinstall $(INSTALLOPTS)
  1192. $(MAKE) api_zipinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
  1193. $(MAKE) fcl_zipinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
  1194. $(MAKE) packages_zipinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
  1195. ifdef IDE
  1196. $(NOSTOP)$(MAKE) ide_zipinstall $(INSTALLOPTS)
  1197. endif
  1198. ifndef SNAPSHOT
  1199. $(MAKE) fcl_zipexampleinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
  1200. $(MAKE) api_zipexampleinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
  1201. $(MAKE) packages_zipexampleinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
  1202. endif
  1203. ##########################################################################
  1204. # Docs
  1205. ##########################################################################
  1206. .PHONY: docspdf docs docsrcinstall docsrc
  1207. docspdf:
  1208. $(MAKE) -C docs pdfinstall
  1209. docs:
  1210. $(MAKE) fpc_zipinstall ZIPTARGET=docspdf ZIPNAME=docs
  1211. docsrcinstall:
  1212. $(MAKE) -C docs clean
  1213. $(MKDIR) $(SOURCEINSTALLDIR)
  1214. $(COPYTREE) docs $(SOURCEINSTALLDIR)
  1215. docsrc:
  1216. $(MAKE) fpc_zipinstall ZIPTARGET=docsrcinstall ZIPNAME=docsrc
  1217. ##########################################################################
  1218. # Demos
  1219. ##########################################################################
  1220. .PHONY: demozip
  1221. demozip:
  1222. $(MAKE) -C $(CVSINSTALL)/demo zipsourceinstall ZIPNAME=demo
  1223. ##########################################################################
  1224. # Source targets
  1225. ##########################################################################
  1226. .PHONY: sourcebase sourcezip
  1227. sourcebase:
  1228. # base Makefiles needed for sources
  1229. $(MKDIR) $(SOURCEINSTALLDIR)
  1230. $(MKDIR) $(SOURCEINSTALLDIR)/rtl
  1231. $(MKDIR) $(SOURCEINSTALLDIR)/packages
  1232. $(COPY) Makefile* $(SOURCEINSTALLDIR)
  1233. $(COPY) rtl/Makefile* $(SOURCEINSTALLDIR)/rtl
  1234. $(COPY) packages/Makefile* $(SOURCEINSTALLDIR)/packages
  1235. sourcezip:
  1236. $(MAKE) fpc_zipinstall ZIPTARGET=sourcebase ZIPNAME=basesrc
  1237. $(MAKE) compiler_zipsourceinstall
  1238. $(MAKE) rtl_zipsourceinstall
  1239. $(MAKE) api_zipsourceinstall
  1240. $(MAKE) fcl_zipsourceinstall
  1241. $(MAKE) packages_zipsourceinstall
  1242. $(MAKE) utils_zipsourceinstall
  1243. $(MAKE) ide_zipsourceinstall
  1244. # $(MAKE) installersrc
  1245. # $(MAKE) docsrc
  1246. ##########################################################################
  1247. # OS targets
  1248. ##########################################################################
  1249. .PHONY: go32v2 win32 linux go32v2zip win32zip linuxzip
  1250. go32v2: checkfpcdir
  1251. $(MAKE) install OS_TARGET=go32v2
  1252. win32: checkfpcdir
  1253. $(MAKE) install OS_TARGET=win32
  1254. linux: checkfpcdir
  1255. $(MAKE) install OS_TARGET=linux
  1256. go32v2zip: checkfpcdir
  1257. $(MAKE) zipinstall OS_TARGET=go32v2
  1258. win32zip: checkfpcdir
  1259. $(MAKE) zipinstall OS_TARGET=win32
  1260. linuxzip: checkfpcdir
  1261. $(MAKE) zipinstall OS_TARGET=linux
  1262. ##########################################################################
  1263. # Debian / RPM
  1264. ##########################################################################
  1265. .PHONY: debcopy deb rpmcopy rpm
  1266. DEBSRCDIR:=/usr/src/fpc-$(FPC_VERSION)
  1267. debcopy: distclean
  1268. rm -rf $(DEBSRCDIR)
  1269. install -d $(DEBSRCDIR)
  1270. $(COPYTREE) compiler $(DEBSRCDIR)
  1271. $(COPYTREE) rtl $(DEBSRCDIR)
  1272. $(COPYTREE) fcl $(DEBSRCDIR)
  1273. $(COPYTREE) api $(DEBSRCDIR)
  1274. $(COPYTREE) packages $(DEBSRCDIR)
  1275. $(COPYTREE) utils $(DEBSRCDIR)
  1276. $(COPYTREE) logs $(DEBSRCDIR)
  1277. $(COPYTREE) docs $(DEBSRCDIR)
  1278. $(COPYTREE) base/Makefile* $(DEBSRCDIR)
  1279. $(COPYTREE) $(CVSINSTALL)/debian $(DEBSRCDIR)
  1280. $(COPYTREE) $(CVSINSTALL)/man $(DEBSRCDIR)
  1281. $(COPYTREE) $(CVSINSTALL)/doc $(DEBSRCDIR)
  1282. $(COPYTREE) $(CVSINSTALL)/demo $(DEBSRCDIR)
  1283. find $(DEBSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
  1284. chmod 755 $(DEBSRCDIR)/debian/rules
  1285. deb: checkfpcdir debcopy
  1286. cd $(DEBSRCDIR) ; debian/rules binary
  1287. REDHATDIR=/usr/src/redhat
  1288. RPMSOURCESDIR:=$(REDHATDIR)/SOURCES
  1289. RPMSPECDIR:=$(REDHATDIR)/SPECS
  1290. RPMSRCDIR:=$(RPMSOURCESDIR)/fpc
  1291. DOCSRCDIR:=$(RPMSOURCESDIR)/fpcdoc
  1292. rpmcopy: distclean
  1293. install -d $(REDHATDIR)
  1294. install -d $(RPMSPECDIR)
  1295. install -d $(RPMSOURCESDIR)
  1296. # fpc.rpm
  1297. rm -rf $(RPMSRCDIR)
  1298. cp $(CVSINSTALL)/fpc-$(FPC_VERSION).spec $(RPMSPECDIR)
  1299. install -d $(RPMSRCDIR)
  1300. $(COPYTREE) compiler $(RPMSRCDIR)
  1301. $(COPYTREE) rtl $(RPMSRCDIR)
  1302. $(COPYTREE) fcl $(RPMSRCDIR)
  1303. $(COPYTREE) api $(RPMSRCDIR)
  1304. $(COPYTREE) packages $(RPMSRCDIR)
  1305. $(COPYTREE) utils $(RPMSRCDIR)
  1306. $(COPYTREE) logs $(RPMSRCDIR)
  1307. $(COPYTREE) base/Makefile* $(RPMSRCDIR)
  1308. $(COPYTREE) $(CVSINSTALL)/man $(RPMSRCDIR)
  1309. $(COPYTREE) $(CVSINSTALL)/doc $(RPMSRCDIR)
  1310. $(COPYTREE) $(CVSINSTALL)/demo $(RPMSRCDIR)
  1311. find $(RPMSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
  1312. cd $(RPMSRCDIR) ; tar cvz * > $(RPMSOURCESDIR)/fpc-$(FPC_VERSION)-src.tar.gz
  1313. # fpc-docs.rpm
  1314. rm -rf $(DOCSRCDIR)
  1315. cp $(CVSINSTALL)/fpc-docs-$(FPC_VERSION).spec $(RPMSPECDIR)
  1316. install -d $(DOCSRCDIR)
  1317. $(COPYTREE) docs $(DOCSRCDIR)
  1318. find $(DOCSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
  1319. cd $(DOCSRCDIR) ; tar cvz * > $(RPMSOURCESDIR)/fpc-docs-$(FPC_VERSION)-src.tar.gz
  1320. rpm: checkfpcdir rpmcopy
  1321. cd $(RPMSPECDIR) ; rpm -ba fpc-$(FPC_VERSION).spec
  1322. cd $(RPMSPECDIR) ; rpm -ba fpc-docs-$(FPC_VERSION).spec