2
0

Makefile 31 KB

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