Makefile 31 KB

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