Makefile 32 KB

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