Makefile 33 KB

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