Makefile 28 KB

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