Makefile 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277
  1. #
  2. # Don't edit, this file is generated by FPCMake Version 1.1 [2001/12/11]
  3. #
  4. default: all
  5. override PATH:=$(subst \,/,$(PATH))
  6. ifeq ($(findstring ;,$(PATH)),)
  7. inUnix=1
  8. SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
  9. else
  10. SEARCHPATH:=$(subst ;, ,$(PATH))
  11. endif
  12. PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
  13. ifeq ($(PWD),)
  14. PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
  15. ifeq ($(PWD),)
  16. nopwd:
  17. @echo You need the GNU utils package to use this Makefile!
  18. @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
  19. @exit
  20. else
  21. PWD:=$(firstword $(PWD))
  22. SRCEXEEXT=
  23. endif
  24. else
  25. PWD:=$(firstword $(PWD))
  26. SRCEXEEXT=.exe
  27. endif
  28. ifndef inUnix
  29. ifeq ($(OS),Windows_NT)
  30. inWinNT=1
  31. else
  32. ifdef OS2_SHELL
  33. inOS2=1
  34. endif
  35. endif
  36. else
  37. ifneq ($(findstring cygwin,$(MACHTYPE)),)
  38. inCygWin=1
  39. endif
  40. endif
  41. ifeq ($(OS_TARGET),freebsd)
  42. BSDhier=1
  43. endif
  44. ifeq ($(OS_TARGET),netbsd)
  45. BSDhier=1
  46. endif
  47. ifdef inUnix
  48. BATCHEXT=.sh
  49. else
  50. ifdef inOS2
  51. BATCHEXT=.cmd
  52. else
  53. BATCHEXT=.bat
  54. endif
  55. endif
  56. ifdef inUnix
  57. PATHSEP=/
  58. else
  59. PATHSEP:=$(subst /,\,/)
  60. endif
  61. ifdef PWD
  62. BASEDIR:=$(subst \,/,$(shell $(PWD)))
  63. ifdef inCygWin
  64. ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
  65. BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
  66. BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
  67. BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
  68. endif
  69. endif
  70. else
  71. BASEDIR=.
  72. endif
  73. ifndef FPC
  74. ifdef PP
  75. FPC=$(PP)
  76. endif
  77. endif
  78. ifndef FPC
  79. FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
  80. ifneq ($(FPCPROG),)
  81. FPCPROG:=$(firstword $(FPCPROG))
  82. FPC:=$(shell $(FPCPROG) -PB)
  83. ifneq ($(findstring Error,$(FPC)),)
  84. override FPC=ppc386
  85. endif
  86. else
  87. override FPC=ppc386
  88. endif
  89. endif
  90. override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
  91. override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
  92. ifndef FPC_VERSION
  93. FPC_VERSION:=$(shell $(FPC) -iV)
  94. endif
  95. export FPC FPC_VERSION
  96. ifndef CPU_TARGET
  97. CPU_TARGET:=$(shell $(FPC) -iTP)
  98. endif
  99. ifndef CPU_SOURCE
  100. CPU_SOURCE:=$(shell $(FPC) -iSP)
  101. endif
  102. ifndef OS_TARGET
  103. OS_TARGET:=$(shell $(FPC) -iTO)
  104. endif
  105. ifndef OS_SOURCE
  106. OS_SOURCE:=$(shell $(FPC) -iSO)
  107. endif
  108. FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
  109. FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
  110. ifneq ($(FULL_TARGET),$(FULL_SOURCE))
  111. CROSSCOMPILE=1
  112. endif
  113. export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE CROSSCOMPILE
  114. ifdef FPCDIR
  115. override FPCDIR:=$(subst \,/,$(FPCDIR))
  116. ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
  117. override FPCDIR=wrong
  118. endif
  119. else
  120. override FPCDIR=wrong
  121. endif
  122. ifeq ($(FPCDIR),wrong)
  123. override FPCDIR=../..
  124. ifeq ($(wildcard $(FPCDIR)/rtl),)
  125. ifeq ($(wildcard $(FPCDIR)/units),)
  126. override FPCDIR=wrong
  127. endif
  128. endif
  129. endif
  130. ifeq ($(FPCDIR),wrong)
  131. ifdef inUnix
  132. override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
  133. ifeq ($(wildcard $(FPCDIR)/units),)
  134. override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
  135. endif
  136. else
  137. override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
  138. override FPCDIR:=$(FPCDIR)/..
  139. ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
  140. override FPCDIR:=$(FPCDIR)/..
  141. ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
  142. override FPCDIR=c:/pp
  143. endif
  144. endif
  145. endif
  146. endif
  147. ifndef CROSSDIR
  148. CROSSDIR:=$(FPCDIR)/cross/$(FULL_TARGET)
  149. endif
  150. ifndef CROSSTARGETDIR
  151. CROSSTARGETDIR=$(CROSSDIR)/$(FULL_TARGET)
  152. endif
  153. ifdef CROSSCOMPILE
  154. UNITSDIR:=$(wildcard $(CROSSTARGETDIR)/units)
  155. ifeq ($(UNITSDIR),)
  156. UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
  157. endif
  158. else
  159. UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
  160. endif
  161. PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages)
  162. override TARGET_PROGRAMS+=fpcmake
  163. override TARGET_RSTS+=fpcmmain
  164. override CLEAN_UNITS+=fpcmmain fpcmdic fpcmwr fpcmpkg
  165. override INSTALL_FPCPACKAGE=y
  166. ifdef REQUIRE_UNITSDIR
  167. override UNITSDIR+=$(REQUIRE_UNITSDIR)
  168. endif
  169. ifdef REQUIRE_PACKAGESDIR
  170. override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
  171. endif
  172. ifdef ZIPINSTALL
  173. ifeq ($(OS_TARGET),linux)
  174. UNIXINSTALLDIR=1
  175. endif
  176. ifeq ($(OS_TARGET),freebsd)
  177. UNIXINSTALLDIR=1
  178. endif
  179. ifeq ($(OS_TARGET),netbsd)
  180. UNIXINSTALLDIR=1
  181. endif
  182. else
  183. ifeq ($(OS_SOURCE),linux)
  184. UNIXINSTALLDIR=1
  185. endif
  186. ifeq ($(OS_SOURCE),freebsd)
  187. UNIXINSTALLDIR=1
  188. endif
  189. ifeq ($(OS_SOURCE),netbsd)
  190. UNIXINSTALLDIR=1
  191. endif
  192. endif
  193. ifndef INSTALL_PREFIX
  194. ifdef UNIXINSTALLDIR
  195. INSTALL_PREFIX=/usr/local
  196. else
  197. ifdef INSTALL_FPCPACKAGE
  198. INSTALL_BASEDIR:=/pp
  199. else
  200. INSTALL_BASEDIR:=/$(PACKAGE_NAME)
  201. endif
  202. endif
  203. endif
  204. export INSTALL_PREFIX
  205. ifndef DIST_DESTDIR
  206. DIST_DESTDIR:=$(BASEDIR)
  207. endif
  208. export DIST_DESTDIR
  209. ifndef INSTALL_BASEDIR
  210. ifdef UNIXINSTALLDIR
  211. ifdef INSTALL_FPCPACKAGE
  212. INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
  213. else
  214. INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)
  215. endif
  216. else
  217. INSTALL_BASEDIR:=$(INSTALL_PREFIX)
  218. endif
  219. endif
  220. ifndef INSTALL_BINDIR
  221. ifdef UNIXINSTALLDIR
  222. INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin
  223. else
  224. INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin
  225. ifdef INSTALL_FPCPACKAGE
  226. INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET)
  227. endif
  228. endif
  229. endif
  230. ifndef INSTALL_UNITDIR
  231. ifdef CROSSCOMPILE
  232. INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/units
  233. else
  234. INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET)
  235. endif
  236. ifdef INSTALL_FPCPACKAGE
  237. ifdef PACKAGE_NAME
  238. INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
  239. endif
  240. endif
  241. endif
  242. ifndef INSTALL_LIBDIR
  243. ifdef UNIXINSTALLDIR
  244. INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
  245. else
  246. INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
  247. endif
  248. endif
  249. ifndef INSTALL_SOURCEDIR
  250. ifdef UNIXINSTALLDIR
  251. ifdef INSTALL_FPCPACKAGE
  252. ifdef BSDhier
  253. INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/share/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
  254. else
  255. INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
  256. endif
  257. else
  258. ifdef BSDhier
  259. INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/share/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
  260. else
  261. INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
  262. endif
  263. endif
  264. else
  265. ifdef INSTALL_FPCPACKAGE
  266. INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
  267. else
  268. INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source
  269. endif
  270. endif
  271. endif
  272. ifndef INSTALL_DOCDIR
  273. ifdef UNIXINSTALLDIR
  274. ifdef INSTALL_FPCPACKAGE
  275. ifdef BSDhier
  276. INSTALL_DOCDIR:=$(INSTALL_PREFIX)/share/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
  277. else
  278. INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
  279. endif
  280. else
  281. ifdef BSDhier
  282. INSTALL_DOCDIR:=$(INSTALL_PREFIX)/share/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
  283. else
  284. INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
  285. endif
  286. endif
  287. else
  288. ifdef INSTALL_FPCPACKAGE
  289. INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)
  290. else
  291. INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc
  292. endif
  293. endif
  294. endif
  295. ifndef INSTALL_EXAMPLEDIR
  296. ifdef UNIXINSTALLDIR
  297. ifdef INSTALL_FPCPACKAGE
  298. ifdef BSDhier
  299. INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
  300. else
  301. INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME)
  302. endif
  303. else
  304. ifdef BSDhier
  305. INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
  306. else
  307. INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
  308. endif
  309. endif
  310. else
  311. ifdef INSTALL_FPCPACKAGE
  312. INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)
  313. else
  314. INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples
  315. endif
  316. endif
  317. endif
  318. ifndef INSTALL_DATADIR
  319. INSTALL_DATADIR=$(INSTALL_BASEDIR)
  320. endif
  321. ifdef CROSSCOMPILE
  322. ifndef CROSSBINDIR
  323. CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(FULL_SOURCE))
  324. ifeq ($(CROSSBINDIR),)
  325. CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin/$(FULL_SOURCE))
  326. endif
  327. endif
  328. else
  329. CROSSBINDIR=
  330. endif
  331. ifdef inUnix
  332. ifndef GCCLIBDIR
  333. GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`)
  334. endif
  335. ifeq ($(OS_TARGET),linux)
  336. ifndef OTHERLIBDIR
  337. OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }')
  338. endif
  339. endif
  340. ifeq ($(OS_TARGET),netbsd)
  341. OTHERLIBDIR+=/usr/pkg/lib
  342. endif
  343. export GCCLIBDIR OTHERLIB
  344. endif
  345. LOADEREXT=.as
  346. EXEEXT=.exe
  347. PPLEXT=.ppl
  348. PPUEXT=.ppu
  349. OEXT=.o
  350. ASMEXT=.s
  351. SMARTEXT=.sl
  352. STATICLIBEXT=.a
  353. SHAREDLIBEXT=.so
  354. STATICLIBPREFIX=libp
  355. RSTEXT=.rst
  356. FPCMADE=fpcmade
  357. ifeq ($(OS_TARGET),go32v1)
  358. PPUEXT=.pp1
  359. OEXT=.o1
  360. ASMEXT=.s1
  361. SMARTEXT=.sl1
  362. STATICLIBEXT=.a1
  363. SHAREDLIBEXT=.so1
  364. STATICLIBPREFIX=
  365. FPCMADE=fpcmade.v1
  366. PACKAGESUFFIX=v1
  367. endif
  368. ifeq ($(OS_TARGET),go32v2)
  369. STATICLIBPREFIX=
  370. FPCMADE=fpcmade.dos
  371. ZIPSUFFIX=go32
  372. endif
  373. ifeq ($(OS_TARGET),linux)
  374. EXEEXT=
  375. HASSHAREDLIB=1
  376. FPCMADE=fpcmade.lnx
  377. ZIPSUFFIX=linux
  378. endif
  379. ifeq ($(OS_TARGET),freebsd)
  380. EXEEXT=
  381. HASSHAREDLIB=1
  382. FPCMADE=fpcmade.freebsd
  383. ZIPSUFFIX=freebsd
  384. endif
  385. ifeq ($(OS_TARGET),netbsd)
  386. EXEEXT=
  387. HASSHAREDLIB=1
  388. FPCMADE=fpcmade.netbsd
  389. ZIPSUFFIX=netbsd
  390. endif
  391. ifeq ($(OS_TARGET),win32)
  392. PPUEXT=.ppw
  393. OEXT=.ow
  394. ASMEXT=.sw
  395. SMARTEXT=.slw
  396. STATICLIBEXT=.aw
  397. SHAREDLIBEXT=.dll
  398. FPCMADE=fpcmade.w32
  399. ZIPSUFFIX=w32
  400. endif
  401. ifeq ($(OS_TARGET),os2)
  402. PPUEXT=.ppo
  403. ASMEXT=.so2
  404. OEXT=.oo2
  405. AOUTEXT=.out
  406. SMARTEXT=.so
  407. STATICLIBEXT=.ao2
  408. SHAREDLIBEXT=.dll
  409. FPCMADE=fpcmade.os2
  410. ZIPSUFFIX=emx
  411. endif
  412. ifeq ($(OS_TARGET),amiga)
  413. EXEEXT=
  414. PPUEXT=.ppa
  415. ASMEXT=.asm
  416. OEXT=.o
  417. SMARTEXT=.sl
  418. STATICLIBEXT=.a
  419. SHAREDLIBEXT=.library
  420. FPCMADE=fpcmade.amg
  421. endif
  422. ifeq ($(OS_TARGET),atari)
  423. PPUEXT=.ppt
  424. ASMEXT=.s
  425. OEXT=.o
  426. SMARTEXT=.sl
  427. STATICLIBEXT=.a
  428. EXEEXT=.ttp
  429. FPCMADE=fpcmade.ata
  430. endif
  431. ifeq ($(OS_TARGET),beos)
  432. PPUEXT=.ppu
  433. ASMEXT=.s
  434. OEXT=.o
  435. SMARTEXT=.sl
  436. STATICLIBEXT=.a
  437. EXEEXT=
  438. FPCMADE=fpcmade.be
  439. ZIPSUFFIX=be
  440. endif
  441. ifeq ($(OS_TARGET),sunos)
  442. PPUEXT=.ppu
  443. ASMEXT=.s
  444. OEXT=.o
  445. SMARTEXT=.sl
  446. STATICLIBEXT=.a
  447. EXEEXT=
  448. FPCMADE=fpcmade.sun
  449. ZIPSUFFIX=sun
  450. endif
  451. ifeq ($(OS_TARGET),qnx)
  452. PPUEXT=.ppu
  453. ASMEXT=.s
  454. OEXT=.o
  455. SMARTEXT=.sl
  456. STATICLIBEXT=.a
  457. EXEEXT=
  458. FPCMADE=fpcmade.qnx
  459. ZIPSUFFIX=qnx
  460. endif
  461. ifndef ECHO
  462. ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
  463. ifeq ($(ECHO),)
  464. ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
  465. ifeq ($(ECHO),)
  466. ECHO=
  467. else
  468. ECHO:=$(firstword $(ECHO))
  469. endif
  470. else
  471. ECHO:=$(firstword $(ECHO))
  472. endif
  473. endif
  474. export ECHO
  475. ifndef DATE
  476. DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH))))
  477. ifeq ($(DATE),)
  478. DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
  479. ifeq ($(DATE),)
  480. DATE=
  481. else
  482. DATE:=$(firstword $(DATE))
  483. endif
  484. else
  485. DATE:=$(firstword $(DATE))
  486. endif
  487. endif
  488. export DATE
  489. ifndef GINSTALL
  490. GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH))))
  491. ifeq ($(GINSTALL),)
  492. GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH))))
  493. ifeq ($(GINSTALL),)
  494. GINSTALL=
  495. else
  496. GINSTALL:=$(firstword $(GINSTALL))
  497. endif
  498. else
  499. GINSTALL:=$(firstword $(GINSTALL))
  500. endif
  501. endif
  502. export GINSTALL
  503. ifndef CPPROG
  504. CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH))))
  505. ifeq ($(CPPROG),)
  506. CPPROG=
  507. else
  508. CPPROG:=$(firstword $(CPPROG))
  509. endif
  510. endif
  511. export CPPROG
  512. ifndef RMPROG
  513. RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH))))
  514. ifeq ($(RMPROG),)
  515. RMPROG=
  516. else
  517. RMPROG:=$(firstword $(RMPROG))
  518. endif
  519. endif
  520. export RMPROG
  521. ifndef MVPROG
  522. MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH))))
  523. ifeq ($(MVPROG),)
  524. MVPROG=
  525. else
  526. MVPROG:=$(firstword $(MVPROG))
  527. endif
  528. endif
  529. export MVPROG
  530. ifndef ECHOREDIR
  531. ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO))
  532. endif
  533. ifndef COPY
  534. COPY:=$(CPPROG) -fp
  535. endif
  536. ifndef COPYTREE
  537. COPYTREE:=$(CPPROG) -rfp
  538. endif
  539. ifndef MOVE
  540. MOVE:=$(MVPROG) -f
  541. endif
  542. ifndef DEL
  543. DEL:=$(RMPROG) -f
  544. endif
  545. ifndef DELTREE
  546. DELTREE:=$(RMPROG) -rf
  547. endif
  548. ifndef INSTALL
  549. ifdef inUnix
  550. INSTALL:=$(GINSTALL) -c -m 644
  551. else
  552. INSTALL:=$(COPY)
  553. endif
  554. endif
  555. ifndef INSTALLEXE
  556. ifdef inUnix
  557. INSTALLEXE:=$(GINSTALL) -c -m 755
  558. else
  559. INSTALLEXE:=$(COPY)
  560. endif
  561. endif
  562. ifndef MKDIR
  563. MKDIR:=$(GINSTALL) -m 755 -d
  564. endif
  565. export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
  566. ifndef PPUMOVE
  567. PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
  568. ifeq ($(PPUMOVE),)
  569. PPUMOVE=
  570. else
  571. PPUMOVE:=$(firstword $(PPUMOVE))
  572. endif
  573. endif
  574. export PPUMOVE
  575. ifndef FPCMAKE
  576. FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
  577. ifeq ($(FPCMAKE),)
  578. FPCMAKE=
  579. else
  580. FPCMAKE:=$(firstword $(FPCMAKE))
  581. endif
  582. endif
  583. export FPCMAKE
  584. ifndef ZIPPROG
  585. ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
  586. ifeq ($(ZIPPROG),)
  587. ZIPPROG=
  588. else
  589. ZIPPROG:=$(firstword $(ZIPPROG))
  590. endif
  591. endif
  592. export ZIPPROG
  593. ifndef TARPROG
  594. TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
  595. ifeq ($(TARPROG),)
  596. TARPROG=
  597. else
  598. TARPROG:=$(firstword $(TARPROG))
  599. endif
  600. endif
  601. export TARPROG
  602. ASNAME=as
  603. LDNAME=ld
  604. ARNAME=ar
  605. RCNAME=rc
  606. ifeq ($(OS_TARGET),win32)
  607. ASNAME=asw
  608. LDNAME=ldw
  609. ARNAME=arw
  610. endif
  611. ifndef ASPROG
  612. ifdef CROSSBINDIR
  613. ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)
  614. else
  615. ASPROG=$(ASNAME)
  616. endif
  617. endif
  618. ifndef LDPROG
  619. ifdef CROSSBINDIR
  620. LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)
  621. else
  622. LDPROG=$(LDNAME)
  623. endif
  624. endif
  625. ifndef RCPROG
  626. ifdef CROSSBINDIR
  627. RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)
  628. else
  629. RCPROG=$(RCNAME)
  630. endif
  631. endif
  632. ifndef ARPROG
  633. ifdef CROSSBINDIR
  634. ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)
  635. else
  636. ARPROG=$(ARNAME)
  637. endif
  638. endif
  639. AS=$(ASPROG)
  640. LD=$(LDPROG)
  641. RC=$(RCPROG)
  642. AR=$(ARPROG)
  643. PPAS=ppas$(BATCHEXT)
  644. ifdef inUnix
  645. LDCONFIG=ldconfig
  646. else
  647. LDCONFIG=
  648. endif
  649. ifdef DATE
  650. DATESTR:=$(shell $(DATE) +%Y%m%d)
  651. else
  652. DATESTR=
  653. endif
  654. ifndef UPXPROG
  655. ifeq ($(OS_TARGET),go32v2)
  656. UPXPROG:=1
  657. endif
  658. ifeq ($(OS_TARGET),win32)
  659. UPXPROG:=1
  660. endif
  661. ifdef UPXPROG
  662. UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
  663. ifeq ($(UPXPROG),)
  664. UPXPROG=
  665. else
  666. UPXPROG:=$(firstword $(UPXPROG))
  667. endif
  668. else
  669. UPXPROG=
  670. endif
  671. endif
  672. export UPXPROG
  673. ZIPOPT=-9
  674. ZIPEXT=.zip
  675. ifeq ($(USETAR),bz2)
  676. TAROPT=vI
  677. TAREXT=.tar.bz2
  678. else
  679. TAROPT=vz
  680. TAREXT=.tar.gz
  681. endif
  682. ifeq ($(OS_TARGET),linux)
  683. REQUIRE_PACKAGES_RTL=1
  684. REQUIRE_PACKAGES_PASZLIB=1
  685. REQUIRE_PACKAGES_INET=1
  686. REQUIRE_PACKAGES_FCL=1
  687. REQUIRE_PACKAGES_MYSQL=1
  688. REQUIRE_PACKAGES_IBASE=1
  689. endif
  690. ifeq ($(OS_TARGET),go32v2)
  691. REQUIRE_PACKAGES_RTL=1
  692. REQUIRE_PACKAGES_PASZLIB=1
  693. REQUIRE_PACKAGES_FCL=1
  694. endif
  695. ifeq ($(OS_TARGET),win32)
  696. REQUIRE_PACKAGES_RTL=1
  697. REQUIRE_PACKAGES_PASZLIB=1
  698. REQUIRE_PACKAGES_FCL=1
  699. REQUIRE_PACKAGES_MYSQL=1
  700. REQUIRE_PACKAGES_IBASE=1
  701. endif
  702. ifeq ($(OS_TARGET),os2)
  703. REQUIRE_PACKAGES_RTL=1
  704. REQUIRE_PACKAGES_PASZLIB=1
  705. REQUIRE_PACKAGES_FCL=1
  706. endif
  707. ifeq ($(OS_TARGET),freebsd)
  708. REQUIRE_PACKAGES_RTL=1
  709. REQUIRE_PACKAGES_PASZLIB=1
  710. REQUIRE_PACKAGES_INET=1
  711. REQUIRE_PACKAGES_FCL=1
  712. REQUIRE_PACKAGES_MYSQL=1
  713. REQUIRE_PACKAGES_IBASE=1
  714. endif
  715. ifeq ($(OS_TARGET),beos)
  716. REQUIRE_PACKAGES_RTL=1
  717. REQUIRE_PACKAGES_PASZLIB=1
  718. REQUIRE_PACKAGES_FCL=1
  719. endif
  720. ifeq ($(OS_TARGET),netbsd)
  721. REQUIRE_PACKAGES_RTL=1
  722. REQUIRE_PACKAGES_PASZLIB=1
  723. REQUIRE_PACKAGES_INET=1
  724. REQUIRE_PACKAGES_FCL=1
  725. endif
  726. ifeq ($(OS_TARGET),amiga)
  727. REQUIRE_PACKAGES_RTL=1
  728. REQUIRE_PACKAGES_PASZLIB=1
  729. REQUIRE_PACKAGES_FCL=1
  730. endif
  731. ifeq ($(OS_TARGET),atari)
  732. REQUIRE_PACKAGES_RTL=1
  733. REQUIRE_PACKAGES_PASZLIB=1
  734. REQUIRE_PACKAGES_FCL=1
  735. endif
  736. ifdef REQUIRE_PACKAGES_RTL
  737. PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))
  738. ifneq ($(PACKAGEDIR_RTL),)
  739. PACKAGEDIR_RTL:=$(firstword $(PACKAGEDIR_RTL))
  740. ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
  741. override COMPILEPACKAGES+=package_rtl
  742. package_rtl:
  743. $(MAKE) -C $(PACKAGEDIR_RTL) all
  744. endif
  745. ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),)
  746. UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET)
  747. else
  748. UNITDIR_RTL=$(PACKAGEDIR_RTL)
  749. endif
  750. else
  751. PACKAGEDIR_RTL=
  752. UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR)))))
  753. ifneq ($(UNITDIR_RTL),)
  754. UNITDIR_RTL:=$(firstword $(UNITDIR_RTL))
  755. else
  756. UNITDIR_RTL=
  757. endif
  758. endif
  759. ifdef UNITDIR_RTL
  760. override COMPILER_UNITDIR+=$(UNITDIR_RTL)
  761. endif
  762. endif
  763. ifdef REQUIRE_PACKAGES_PASZLIB
  764. PACKAGEDIR_PASZLIB:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR)))))
  765. ifneq ($(PACKAGEDIR_PASZLIB),)
  766. PACKAGEDIR_PASZLIB:=$(firstword $(PACKAGEDIR_PASZLIB))
  767. ifeq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(FPCMADE)),)
  768. override COMPILEPACKAGES+=package_paszlib
  769. package_paszlib:
  770. $(MAKE) -C $(PACKAGEDIR_PASZLIB) all
  771. endif
  772. ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(OS_TARGET)),)
  773. UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/$(OS_TARGET)
  774. else
  775. UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)
  776. endif
  777. else
  778. PACKAGEDIR_PASZLIB=
  779. UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR)))))
  780. ifneq ($(UNITDIR_PASZLIB),)
  781. UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB))
  782. else
  783. UNITDIR_PASZLIB=
  784. endif
  785. endif
  786. ifdef UNITDIR_PASZLIB
  787. override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB)
  788. endif
  789. endif
  790. ifdef REQUIRE_PACKAGES_INET
  791. PACKAGEDIR_INET:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /inet/Makefile.fpc,$(PACKAGESDIR)))))
  792. ifneq ($(PACKAGEDIR_INET),)
  793. PACKAGEDIR_INET:=$(firstword $(PACKAGEDIR_INET))
  794. ifeq ($(wildcard $(PACKAGEDIR_INET)/$(FPCMADE)),)
  795. override COMPILEPACKAGES+=package_inet
  796. package_inet:
  797. $(MAKE) -C $(PACKAGEDIR_INET) all
  798. endif
  799. ifneq ($(wildcard $(PACKAGEDIR_INET)/$(OS_TARGET)),)
  800. UNITDIR_INET=$(PACKAGEDIR_INET)/$(OS_TARGET)
  801. else
  802. UNITDIR_INET=$(PACKAGEDIR_INET)
  803. endif
  804. else
  805. PACKAGEDIR_INET=
  806. UNITDIR_INET:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /inet/Package.fpc,$(UNITSDIR)))))
  807. ifneq ($(UNITDIR_INET),)
  808. UNITDIR_INET:=$(firstword $(UNITDIR_INET))
  809. else
  810. UNITDIR_INET=
  811. endif
  812. endif
  813. ifdef UNITDIR_INET
  814. override COMPILER_UNITDIR+=$(UNITDIR_INET)
  815. endif
  816. endif
  817. ifdef REQUIRE_PACKAGES_FCL
  818. PACKAGEDIR_FCL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR)))))
  819. ifneq ($(PACKAGEDIR_FCL),)
  820. PACKAGEDIR_FCL:=$(firstword $(PACKAGEDIR_FCL))
  821. ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),)
  822. override COMPILEPACKAGES+=package_fcl
  823. package_fcl:
  824. $(MAKE) -C $(PACKAGEDIR_FCL) all
  825. endif
  826. ifneq ($(wildcard $(PACKAGEDIR_FCL)/$(OS_TARGET)),)
  827. UNITDIR_FCL=$(PACKAGEDIR_FCL)/$(OS_TARGET)
  828. else
  829. UNITDIR_FCL=$(PACKAGEDIR_FCL)
  830. endif
  831. else
  832. PACKAGEDIR_FCL=
  833. UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR)))))
  834. ifneq ($(UNITDIR_FCL),)
  835. UNITDIR_FCL:=$(firstword $(UNITDIR_FCL))
  836. else
  837. UNITDIR_FCL=
  838. endif
  839. endif
  840. ifdef UNITDIR_FCL
  841. override COMPILER_UNITDIR+=$(UNITDIR_FCL)
  842. endif
  843. endif
  844. ifdef REQUIRE_PACKAGES_MYSQL
  845. PACKAGEDIR_MYSQL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR)))))
  846. ifneq ($(PACKAGEDIR_MYSQL),)
  847. PACKAGEDIR_MYSQL:=$(firstword $(PACKAGEDIR_MYSQL))
  848. ifeq ($(wildcard $(PACKAGEDIR_MYSQL)/$(FPCMADE)),)
  849. override COMPILEPACKAGES+=package_mysql
  850. package_mysql:
  851. $(MAKE) -C $(PACKAGEDIR_MYSQL) all
  852. endif
  853. ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/$(OS_TARGET)),)
  854. UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/$(OS_TARGET)
  855. else
  856. UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)
  857. endif
  858. else
  859. PACKAGEDIR_MYSQL=
  860. UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR)))))
  861. ifneq ($(UNITDIR_MYSQL),)
  862. UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL))
  863. else
  864. UNITDIR_MYSQL=
  865. endif
  866. endif
  867. ifdef UNITDIR_MYSQL
  868. override COMPILER_UNITDIR+=$(UNITDIR_MYSQL)
  869. endif
  870. endif
  871. ifdef REQUIRE_PACKAGES_IBASE
  872. PACKAGEDIR_IBASE:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR)))))
  873. ifneq ($(PACKAGEDIR_IBASE),)
  874. PACKAGEDIR_IBASE:=$(firstword $(PACKAGEDIR_IBASE))
  875. ifeq ($(wildcard $(PACKAGEDIR_IBASE)/$(FPCMADE)),)
  876. override COMPILEPACKAGES+=package_ibase
  877. package_ibase:
  878. $(MAKE) -C $(PACKAGEDIR_IBASE) all
  879. endif
  880. ifneq ($(wildcard $(PACKAGEDIR_IBASE)/$(OS_TARGET)),)
  881. UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/$(OS_TARGET)
  882. else
  883. UNITDIR_IBASE=$(PACKAGEDIR_IBASE)
  884. endif
  885. else
  886. PACKAGEDIR_IBASE=
  887. UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR)))))
  888. ifneq ($(UNITDIR_IBASE),)
  889. UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE))
  890. else
  891. UNITDIR_IBASE=
  892. endif
  893. endif
  894. ifdef UNITDIR_IBASE
  895. override COMPILER_UNITDIR+=$(UNITDIR_IBASE)
  896. endif
  897. endif
  898. .PHONY: package_rtl package_paszlib package_inet package_fcl package_mysql package_ibase
  899. ifndef NOCPUDEF
  900. override FPCOPTDEF=$(CPU_TARGET)
  901. endif
  902. ifneq ($(OS_TARGET),$(OS_SOURCE))
  903. override FPCOPT+=-T$(OS_TARGET)
  904. endif
  905. ifdef UNITDIR
  906. override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
  907. endif
  908. ifdef LIBDIR
  909. override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
  910. endif
  911. ifdef OBJDIR
  912. override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
  913. endif
  914. ifdef INCDIR
  915. override FPCOPT+=$(addprefix -Fi,$(INCDIR))
  916. endif
  917. ifdef LINKSMART
  918. override FPCOPT+=-XX
  919. endif
  920. ifdef CREATESMART
  921. override FPCOPT+=-CX
  922. endif
  923. ifdef DEBUG
  924. override FPCOPT+=-gl
  925. override FPCOPTDEF+=DEBUG
  926. endif
  927. ifdef RELEASE
  928. ifeq ($(CPU_TARGET),i386)
  929. FPCCPUOPT:=-OG2p3
  930. else
  931. FPCCPUOPT:=
  932. endif
  933. override FPCOPT+=-Xs $(FPCCPUOPT) -n
  934. override FPCOPTDEF+=RELEASE
  935. endif
  936. ifdef STRIP
  937. override FPCOPT+=-Xs
  938. endif
  939. ifdef OPTIMIZE
  940. ifeq ($(CPU_TARGET),i386)
  941. override FPCOPT+=-OG2p3
  942. endif
  943. endif
  944. ifdef VERBOSE
  945. override FPCOPT+=-vwni
  946. endif
  947. ifdef COMPILER_OPTIONS
  948. override FPCOPT+=$(COMPILER_OPTIONS)
  949. endif
  950. ifdef COMPILER_UNITDIR
  951. override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
  952. endif
  953. ifdef COMPILER_LIBRARYDIR
  954. override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
  955. endif
  956. ifdef COMPILER_OBJECTDIR
  957. override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
  958. endif
  959. ifdef COMPILER_INCLUDEDIR
  960. override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
  961. endif
  962. ifdef CROSSBINDIR
  963. override FPCOPT+=-FD$(CROSSBINDIR)
  964. endif
  965. ifdef COMPILER_TARGETDIR
  966. override FPCOPT+=-FE$(COMPILER_TARGETDIR)
  967. ifeq ($(COMPILER_TARGETDIR),.)
  968. override TARGETDIRPREFIX=
  969. else
  970. override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
  971. endif
  972. endif
  973. ifdef COMPILER_UNITTARGETDIR
  974. override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
  975. ifeq ($(COMPILER_UNITTARGETDIR),.)
  976. override UNITTARGETDIRPREFIX=
  977. else
  978. override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
  979. endif
  980. else
  981. ifdef COMPILER_TARGETDIR
  982. override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
  983. override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
  984. endif
  985. endif
  986. ifdef GCCLIBDIR
  987. override FPCOPT+=-Fl$(GCCLIBDIR)
  988. endif
  989. ifdef OTHERLIBDIR
  990. override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
  991. endif
  992. ifdef OPT
  993. override FPCOPT+=$(OPT)
  994. endif
  995. ifdef FPCOPTDEF
  996. override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
  997. endif
  998. ifdef CFGFILE
  999. override FPCOPT+=@$(CFGFILE)
  1000. endif
  1001. ifdef USEENV
  1002. override FPCEXTCMD:=$(FPCOPT)
  1003. override FPCOPT:=!FPCEXTCMD
  1004. export FPCEXTCMD
  1005. endif
  1006. override COMPILER:=$(FPC) $(FPCOPT)
  1007. ifeq (,$(findstring -s ,$(COMPILER)))
  1008. EXECPPAS=
  1009. else
  1010. ifeq ($(OS_SOURCE),$(OS_TARGET))
  1011. EXECPPAS:=@$(PPAS)
  1012. endif
  1013. endif
  1014. .PHONY: fpc_exes
  1015. ifdef TARGET_PROGRAMS
  1016. override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS))
  1017. override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS)))
  1018. override ALLTARGET+=fpc_exes
  1019. override INSTALLEXEFILES+=$(EXEFILES)
  1020. override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES)
  1021. ifeq ($(OS_TARGET),os2)
  1022. override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS))
  1023. endif
  1024. endif
  1025. fpc_exes: $(EXEFILES)
  1026. ifdef TARGET_RSTS
  1027. override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
  1028. override CLEANRSTFILES+=$(RSTFILES)
  1029. endif
  1030. .PHONY: fpc_packages fpc_all fpc_smart fpc_debug
  1031. $(FPCMADE): $(ALLTARGET)
  1032. @$(ECHOREDIR) Compiled > $(FPCMADE)
  1033. fpc_packages: $(COMPILEPACKAGES)
  1034. fpc_all: fpc_packages $(FPCMADE)
  1035. fpc_smart:
  1036. $(MAKE) all LINKSMART=1 CREATESMART=1
  1037. fpc_debug:
  1038. $(MAKE) all DEBUG=1
  1039. .SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
  1040. %$(PPUEXT): %.pp
  1041. $(COMPILER) $<
  1042. $(EXECPPAS)
  1043. %$(PPUEXT): %.pas
  1044. $(COMPILER) $<
  1045. $(EXECPPAS)
  1046. %$(EXEEXT): %.pp
  1047. $(COMPILER) $<
  1048. $(EXECPPAS)
  1049. %$(EXEEXT): %.pas
  1050. $(COMPILER) $<
  1051. $(EXECPPAS)
  1052. vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
  1053. vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
  1054. vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
  1055. .PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
  1056. ifdef INSTALL_UNITS
  1057. override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
  1058. endif
  1059. ifdef INSTALLPPUFILES
  1060. override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
  1061. override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
  1062. override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)))
  1063. override INSTALL_CREATEPACKAGEFPC=1
  1064. endif
  1065. ifdef INSTALLEXEFILES
  1066. override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
  1067. endif
  1068. fpc_install: all $(INSTALLTARGET)
  1069. ifdef INSTALLEXEFILES
  1070. $(MKDIR) $(INSTALL_BINDIR)
  1071. ifdef UPXPROG
  1072. -$(UPXPROG) $(INSTALLEXEFILES)
  1073. endif
  1074. $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
  1075. endif
  1076. ifdef INSTALL_CREATEPACKAGEFPC
  1077. ifdef FPCMAKE
  1078. ifdef PACKAGE_VERSION
  1079. ifneq ($(wildcard Makefile.fpc),)
  1080. $(FPCMAKE) -p -T$(OS_TARGET) Makefile.fpc
  1081. $(MKDIR) $(INSTALL_UNITDIR)
  1082. $(INSTALL) Package.fpc $(INSTALL_UNITDIR)
  1083. endif
  1084. endif
  1085. endif
  1086. endif
  1087. ifdef INSTALLPPUFILES
  1088. $(MKDIR) $(INSTALL_UNITDIR)
  1089. $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
  1090. ifneq ($(INSTALLPPULINKFILES),)
  1091. $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
  1092. endif
  1093. ifneq ($(wildcard $(LIB_FULLNAME)),)
  1094. $(MKDIR) $(INSTALL_LIBDIR)
  1095. $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
  1096. ifdef inUnix
  1097. ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
  1098. endif
  1099. endif
  1100. endif
  1101. ifdef INSTALL_FILES
  1102. $(MKDIR) $(INSTALL_DATADIR)
  1103. $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
  1104. endif
  1105. fpc_sourceinstall: distclean
  1106. $(MKDIR) $(INSTALL_SOURCEDIR)
  1107. $(COPYTREE) $(BASEDIR) $(INSTALL_SOURCEDIR)
  1108. fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
  1109. ifdef HASEXAMPLES
  1110. $(MKDIR) $(INSTALL_EXAMPLEDIR)
  1111. endif
  1112. ifdef EXAMPLESOURCEFILES
  1113. $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
  1114. endif
  1115. ifdef TARGET_EXAMPLEDIRS
  1116. $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
  1117. endif
  1118. .PHONY: fpc_clean fpc_cleanall fpc_distclean
  1119. ifdef EXEFILES
  1120. override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
  1121. endif
  1122. ifdef CLEAN_UNITS
  1123. override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
  1124. endif
  1125. ifdef CLEANPPUFILES
  1126. override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
  1127. override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
  1128. override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
  1129. endif
  1130. fpc_clean: $(CLEANTARGET)
  1131. ifdef CLEANEXEFILES
  1132. -$(DEL) $(CLEANEXEFILES)
  1133. endif
  1134. ifdef CLEANPPUFILES
  1135. -$(DEL) $(CLEANPPUFILES)
  1136. endif
  1137. ifneq ($(CLEANPPULINKFILES),)
  1138. -$(DEL) $(CLEANPPULINKFILES)
  1139. endif
  1140. ifdef CLEANRSTFILES
  1141. -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
  1142. endif
  1143. ifdef CLEAN_FILES
  1144. -$(DEL) $(CLEAN_FILES)
  1145. endif
  1146. ifdef LIB_NAME
  1147. -$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
  1148. endif
  1149. -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
  1150. fpc_distclean: clean
  1151. ifdef COMPILER_UNITTARGETDIR
  1152. TARGETDIRCLEAN=fpc_clean
  1153. endif
  1154. fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)
  1155. ifdef CLEANEXEFILES
  1156. -$(DEL) $(CLEANEXEFILES)
  1157. endif
  1158. -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  1159. -$(DELTREE) *$(SMARTEXT)
  1160. -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
  1161. ifdef AOUTEXT
  1162. -$(DEL) *$(AOUTEXT)
  1163. endif
  1164. .PHONY: fpc_info
  1165. fpc_info:
  1166. @$(ECHO)
  1167. @$(ECHO) == Package info ==
  1168. @$(ECHO) Package Name..... $(PACKAGE_NAME)
  1169. @$(ECHO) Package Version.. $(PACKAGE_VERSION)
  1170. @$(ECHO)
  1171. @$(ECHO) == Configuration info ==
  1172. @$(ECHO)
  1173. @$(ECHO) FPC.......... $(FPC)
  1174. @$(ECHO) FPC Version.. $(FPC_VERSION)
  1175. @$(ECHO) Source CPU... $(CPU_SOURCE)
  1176. @$(ECHO) Target CPU... $(CPU_TARGET)
  1177. @$(ECHO) Source OS.... $(OS_SOURCE)
  1178. @$(ECHO) Target OS.... $(OS_TARGET)
  1179. @$(ECHO) Full Target.. $(FULL_SOURCE)
  1180. @$(ECHO) Full Source.. $(FULL_TARGET)
  1181. @$(ECHO)
  1182. @$(ECHO) == Directory info ==
  1183. @$(ECHO)
  1184. @$(ECHO) Basedir......... $(BASEDIR)
  1185. @$(ECHO) FPCDir.......... $(FPCDIR)
  1186. @$(ECHO) CrossBinDir..... $(CROSSBINDIR)
  1187. @$(ECHO) UnitsDir........ $(UNITSDIR)
  1188. @$(ECHO) PackagesDir..... $(PACKAGESDIR)
  1189. @$(ECHO)
  1190. @$(ECHO) GCC library..... $(GCCLIBDIR)
  1191. @$(ECHO) Other library... $(OTHERLIBDIR)
  1192. @$(ECHO)
  1193. @$(ECHO) == Tools info ==
  1194. @$(ECHO)
  1195. @$(ECHO) As........ $(AS)
  1196. @$(ECHO) Ld........ $(LD)
  1197. @$(ECHO) Ar........ $(AR)
  1198. @$(ECHO) Rc........ $(RC)
  1199. @$(ECHO)
  1200. @$(ECHO) Mv........ $(MVPROG)
  1201. @$(ECHO) Cp........ $(CPPROG)
  1202. @$(ECHO) Rm........ $(RMPROG)
  1203. @$(ECHO) GInstall.. $(GINSTALL)
  1204. @$(ECHO) Echo...... $(ECHO)
  1205. @$(ECHO) Date...... $(DATE)
  1206. @$(ECHO) FPCMake... $(FPCMAKE)
  1207. @$(ECHO) PPUMove... $(PPUMOVE)
  1208. @$(ECHO) Upx....... $(UPXPROG)
  1209. @$(ECHO) Zip....... $(ZIPPROG)
  1210. @$(ECHO)
  1211. @$(ECHO) == Object info ==
  1212. @$(ECHO)
  1213. @$(ECHO) Target Loaders...... $(TARGET_LOADERS)
  1214. @$(ECHO) Target Units........ $(TARGET_UNITS)
  1215. @$(ECHO) Target Programs..... $(TARGET_PROGRAMS)
  1216. @$(ECHO) Target Dirs......... $(TARGET_DIRS)
  1217. @$(ECHO) Target Examples..... $(TARGET_EXAMPLES)
  1218. @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS)
  1219. @$(ECHO)
  1220. @$(ECHO) Clean Units......... $(CLEAN_UNITS)
  1221. @$(ECHO) Clean Files......... $(CLEAN_FILES)
  1222. @$(ECHO)
  1223. @$(ECHO) Install Units....... $(INSTALL_UNITS)
  1224. @$(ECHO) Install Files....... $(INSTALL_FILES)
  1225. @$(ECHO)
  1226. @$(ECHO) == Install info ==
  1227. @$(ECHO)
  1228. @$(ECHO) DateStr.............. $(DATESTR)
  1229. @$(ECHO) ZipPrefix............ $(ZIPPREFIX)
  1230. @$(ECHO) ZipSuffix............ $(ZIPSUFFIX)
  1231. @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE)
  1232. @$(ECHO)
  1233. @$(ECHO) Install base dir..... $(INSTALL_BASEDIR)
  1234. @$(ECHO) Install binary dir... $(INSTALL_BINDIR)
  1235. @$(ECHO) Install library dir.. $(INSTALL_LIBDIR)
  1236. @$(ECHO) Install units dir.... $(INSTALL_UNITDIR)
  1237. @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR)
  1238. @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR)
  1239. @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR)
  1240. @$(ECHO) Install data dir..... $(INSTALL_DATADIR)
  1241. @$(ECHO)
  1242. @$(ECHO) Dist destination dir. $(DIST_DESTDIR)
  1243. @$(ECHO) Dist zip name........ $(DIST_ZIPNAME)
  1244. @$(ECHO)
  1245. ifndef DATA2INC
  1246. DATA2INC:=$(strip $(wildcard $(addsuffix /data2inc$(SRCEXEEXT),$(SEARCHPATH))))
  1247. ifeq ($(DATA2INC),)
  1248. DATA2INC=
  1249. else
  1250. DATA2INC:=$(firstword $(DATA2INC))
  1251. endif
  1252. endif
  1253. export DATA2INC
  1254. all: fpc_all
  1255. debug: fpc_debug
  1256. smart: fpc_smart
  1257. examples:
  1258. shared:
  1259. install: fpc_install
  1260. sourceinstall: fpc_sourceinstall
  1261. exampleinstall: fpc_exampleinstall
  1262. distinstall:
  1263. zipinstall:
  1264. zipsourceinstall:
  1265. zipexampleinstall:
  1266. zipdistinstall:
  1267. clean: fpc_clean
  1268. distclean: fpc_distclean
  1269. cleanall: fpc_cleanall
  1270. info: fpc_info
  1271. .PHONY: all debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info
  1272. ifneq ($(wildcard fpcmake.loc),)
  1273. include fpcmake.loc
  1274. endif
  1275. fpcmake.inc: fpcmake.ini
  1276. $(DATA2INC) -b -s fpcmake.ini fpcmake.inc fpcmakeini
  1277. fpcmake$(EXEEXT): $(wildcard fpcm*.pp) fpcmake.inc