Makefile 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846
  1. #
  2. # Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/03/19]
  3. #
  4. default: all
  5. MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince powerpc64-linux
  6. BSDs = freebsd netbsd openbsd darwin
  7. UNIXs = linux $(BSDs) solaris qnx
  8. LIMIT83fs = go32v2 os2 emx watcom
  9. FORCE:
  10. .PHONY: FORCE
  11. override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
  12. ifneq ($(findstring darwin,$(OSTYPE)),)
  13. inUnix=1 #darwin
  14. SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
  15. else
  16. ifeq ($(findstring ;,$(PATH)),)
  17. inUnix=1
  18. SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
  19. else
  20. SEARCHPATH:=$(subst ;, ,$(PATH))
  21. endif
  22. endif
  23. SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
  24. PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
  25. ifeq ($(PWD),)
  26. PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
  27. ifeq ($(PWD),)
  28. $(error You need the GNU utils package to use this Makefile)
  29. else
  30. PWD:=$(firstword $(PWD))
  31. SRCEXEEXT=
  32. endif
  33. else
  34. PWD:=$(firstword $(PWD))
  35. SRCEXEEXT=.exe
  36. endif
  37. ifndef inUnix
  38. ifeq ($(OS),Windows_NT)
  39. inWinNT=1
  40. else
  41. ifdef OS2_SHELL
  42. inOS2=1
  43. endif
  44. endif
  45. else
  46. ifneq ($(findstring cygdrive,$(PATH)),)
  47. inCygWin=1
  48. endif
  49. endif
  50. ifdef inUnix
  51. SRCBATCHEXT=.sh
  52. else
  53. ifdef inOS2
  54. SRCBATCHEXT=.cmd
  55. else
  56. SRCBATCHEXT=.bat
  57. endif
  58. endif
  59. ifdef inUnix
  60. PATHSEP=/
  61. else
  62. PATHSEP:=$(subst /,\,/)
  63. ifdef inCygWin
  64. PATHSEP=/
  65. endif
  66. endif
  67. ifdef PWD
  68. BASEDIR:=$(subst \,/,$(shell $(PWD)))
  69. ifdef inCygWin
  70. ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
  71. BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
  72. BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
  73. BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
  74. endif
  75. endif
  76. else
  77. BASEDIR=.
  78. endif
  79. ifdef inOS2
  80. ifndef ECHO
  81. ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
  82. ifeq ($(ECHO),)
  83. ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
  84. ifeq ($(ECHO),)
  85. ECHO=echo
  86. else
  87. ECHO:=$(firstword $(ECHO))
  88. endif
  89. else
  90. ECHO:=$(firstword $(ECHO))
  91. endif
  92. endif
  93. export ECHO
  94. endif
  95. override DEFAULT_FPCDIR=../../..
  96. ifndef FPC
  97. ifdef PP
  98. FPC=$(PP)
  99. endif
  100. endif
  101. ifndef FPC
  102. FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
  103. ifneq ($(FPCPROG),)
  104. FPCPROG:=$(firstword $(FPCPROG))
  105. FPC:=$(shell $(FPCPROG) -PB)
  106. ifneq ($(findstring Error,$(FPC)),)
  107. override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
  108. endif
  109. else
  110. override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
  111. endif
  112. endif
  113. override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
  114. override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
  115. FOUNDFPC:=$(strip $(wildcard $(FPC)))
  116. ifeq ($(FOUNDFPC),)
  117. FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))
  118. ifeq ($(FOUNDFPC),)
  119. $(error Compiler $(FPC) not found)
  120. endif
  121. endif
  122. ifndef FPC_COMPILERINFO
  123. FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO)
  124. endif
  125. ifndef FPC_VERSION
  126. FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO))
  127. endif
  128. export FPC FPC_VERSION FPC_COMPILERINFO
  129. unexport CHECKDEPEND ALLDEPENDENCIES
  130. ifndef CPU_TARGET
  131. ifdef CPU_TARGET_DEFAULT
  132. CPU_TARGET=$(CPU_TARGET_DEFAULT)
  133. endif
  134. endif
  135. ifndef OS_TARGET
  136. ifdef OS_TARGET_DEFAULT
  137. OS_TARGET=$(OS_TARGET_DEFAULT)
  138. endif
  139. endif
  140. ifneq ($(words $(FPC_COMPILERINFO)),5)
  141. FPC_COMPILERINFO+=$(shell $(FPC) -iSP)
  142. FPC_COMPILERINFO+=$(shell $(FPC) -iTP)
  143. FPC_COMPILERINFO+=$(shell $(FPC) -iSO)
  144. FPC_COMPILERINFO+=$(shell $(FPC) -iTO)
  145. endif
  146. ifndef CPU_SOURCE
  147. CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
  148. endif
  149. ifndef CPU_TARGET
  150. CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO))
  151. endif
  152. ifndef OS_SOURCE
  153. OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO))
  154. endif
  155. ifndef OS_TARGET
  156. OS_TARGET:=$(word 5,$(FPC_COMPILERINFO))
  157. endif
  158. FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
  159. FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
  160. ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
  161. TARGETSUFFIX=$(OS_TARGET)
  162. SOURCESUFFIX=$(OS_SOURCE)
  163. else
  164. TARGETSUFFIX=$(FULL_TARGET)
  165. SOURCESUFFIX=$(FULL_SOURCE)
  166. endif
  167. ifneq ($(FULL_TARGET),$(FULL_SOURCE))
  168. CROSSCOMPILE=1
  169. endif
  170. ifeq ($(findstring makefile,$(MAKECMDGOALS)),)
  171. ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),)
  172. $(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first)
  173. endif
  174. endif
  175. ifneq ($(findstring $(OS_TARGET),$(BSDs)),)
  176. BSDhier=1
  177. endif
  178. ifeq ($(OS_TARGET),linux)
  179. linuxHier=1
  180. endif
  181. export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
  182. ifdef FPCDIR
  183. override FPCDIR:=$(subst \,/,$(FPCDIR))
  184. ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
  185. override FPCDIR=wrong
  186. endif
  187. else
  188. override FPCDIR=wrong
  189. endif
  190. ifdef DEFAULT_FPCDIR
  191. ifeq ($(FPCDIR),wrong)
  192. override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR))
  193. ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
  194. override FPCDIR=wrong
  195. endif
  196. endif
  197. endif
  198. ifeq ($(FPCDIR),wrong)
  199. ifdef inUnix
  200. override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
  201. ifeq ($(wildcard $(FPCDIR)/units),)
  202. override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
  203. endif
  204. else
  205. override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
  206. override FPCDIR:=$(FPCDIR)/..
  207. ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
  208. override FPCDIR:=$(FPCDIR)/..
  209. ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
  210. override FPCDIR:=$(BASEDIR)
  211. ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
  212. override FPCDIR=c:/pp
  213. endif
  214. endif
  215. endif
  216. endif
  217. endif
  218. ifndef CROSSBINDIR
  219. CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
  220. endif
  221. ifndef BINUTILSPREFIX
  222. ifndef CROSSBINDIR
  223. ifdef CROSSCOMPILE
  224. BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
  225. endif
  226. endif
  227. endif
  228. UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
  229. ifeq ($(UNITSDIR),)
  230. UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
  231. endif
  232. PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
  233. override PACKAGE_NAME=libc
  234. override PACKAGE_VERSION=2.0.0
  235. ifeq ($(FULL_TARGET),i386-linux)
  236. override TARGET_UNITS+=kerneldefs kernelioctl libc
  237. endif
  238. ifeq ($(FULL_TARGET),i386-go32v2)
  239. override TARGET_UNITS+=kerneldefs kernelioctl libc
  240. endif
  241. ifeq ($(FULL_TARGET),i386-win32)
  242. override TARGET_UNITS+=kerneldefs kernelioctl libc
  243. endif
  244. ifeq ($(FULL_TARGET),i386-os2)
  245. override TARGET_UNITS+=kerneldefs kernelioctl libc
  246. endif
  247. ifeq ($(FULL_TARGET),i386-freebsd)
  248. override TARGET_UNITS+=kerneldefs kernelioctl libc
  249. endif
  250. ifeq ($(FULL_TARGET),i386-beos)
  251. override TARGET_UNITS+=kerneldefs kernelioctl libc
  252. endif
  253. ifeq ($(FULL_TARGET),i386-netbsd)
  254. override TARGET_UNITS+=kerneldefs kernelioctl libc
  255. endif
  256. ifeq ($(FULL_TARGET),i386-solaris)
  257. override TARGET_UNITS+=kerneldefs kernelioctl libc
  258. endif
  259. ifeq ($(FULL_TARGET),i386-qnx)
  260. override TARGET_UNITS+=kerneldefs kernelioctl libc
  261. endif
  262. ifeq ($(FULL_TARGET),i386-netware)
  263. override TARGET_UNITS+=kerneldefs kernelioctl libc
  264. endif
  265. ifeq ($(FULL_TARGET),i386-openbsd)
  266. override TARGET_UNITS+=kerneldefs kernelioctl libc
  267. endif
  268. ifeq ($(FULL_TARGET),i386-wdosx)
  269. override TARGET_UNITS+=kerneldefs kernelioctl libc
  270. endif
  271. ifeq ($(FULL_TARGET),i386-darwin)
  272. override TARGET_UNITS+=kerneldefs kernelioctl libc
  273. endif
  274. ifeq ($(FULL_TARGET),i386-emx)
  275. override TARGET_UNITS+=kerneldefs kernelioctl libc
  276. endif
  277. ifeq ($(FULL_TARGET),i386-watcom)
  278. override TARGET_UNITS+=kerneldefs kernelioctl libc
  279. endif
  280. ifeq ($(FULL_TARGET),i386-netwlibc)
  281. override TARGET_UNITS+=kerneldefs kernelioctl libc
  282. endif
  283. ifeq ($(FULL_TARGET),i386-wince)
  284. override TARGET_UNITS+=kerneldefs kernelioctl libc
  285. endif
  286. ifeq ($(FULL_TARGET),m68k-linux)
  287. override TARGET_UNITS+=kerneldefs kernelioctl libc
  288. endif
  289. ifeq ($(FULL_TARGET),m68k-freebsd)
  290. override TARGET_UNITS+=kerneldefs kernelioctl libc
  291. endif
  292. ifeq ($(FULL_TARGET),m68k-netbsd)
  293. override TARGET_UNITS+=kerneldefs kernelioctl libc
  294. endif
  295. ifeq ($(FULL_TARGET),m68k-amiga)
  296. override TARGET_UNITS+=kerneldefs kernelioctl libc
  297. endif
  298. ifeq ($(FULL_TARGET),m68k-atari)
  299. override TARGET_UNITS+=kerneldefs kernelioctl libc
  300. endif
  301. ifeq ($(FULL_TARGET),m68k-openbsd)
  302. override TARGET_UNITS+=kerneldefs kernelioctl libc
  303. endif
  304. ifeq ($(FULL_TARGET),m68k-palmos)
  305. override TARGET_UNITS+=kerneldefs kernelioctl libc
  306. endif
  307. ifeq ($(FULL_TARGET),powerpc-linux)
  308. override TARGET_UNITS+=kerneldefs kernelioctl libc
  309. endif
  310. ifeq ($(FULL_TARGET),powerpc-netbsd)
  311. override TARGET_UNITS+=kerneldefs kernelioctl libc
  312. endif
  313. ifeq ($(FULL_TARGET),powerpc-macos)
  314. override TARGET_UNITS+=kerneldefs kernelioctl libc
  315. endif
  316. ifeq ($(FULL_TARGET),powerpc-darwin)
  317. override TARGET_UNITS+=kerneldefs kernelioctl libc
  318. endif
  319. ifeq ($(FULL_TARGET),powerpc-morphos)
  320. override TARGET_UNITS+=kerneldefs kernelioctl libc
  321. endif
  322. ifeq ($(FULL_TARGET),sparc-linux)
  323. override TARGET_UNITS+=kerneldefs kernelioctl libc
  324. endif
  325. ifeq ($(FULL_TARGET),sparc-netbsd)
  326. override TARGET_UNITS+=kerneldefs kernelioctl libc
  327. endif
  328. ifeq ($(FULL_TARGET),sparc-solaris)
  329. override TARGET_UNITS+=kerneldefs kernelioctl libc
  330. endif
  331. ifeq ($(FULL_TARGET),x86_64-linux)
  332. override TARGET_UNITS+=kerneldefs kernelioctl libc
  333. endif
  334. ifeq ($(FULL_TARGET),x86_64-freebsd)
  335. override TARGET_UNITS+=kerneldefs kernelioctl libc
  336. endif
  337. ifeq ($(FULL_TARGET),x86_64-win64)
  338. override TARGET_UNITS+=kerneldefs kernelioctl libc
  339. endif
  340. ifeq ($(FULL_TARGET),arm-linux)
  341. override TARGET_UNITS+=kerneldefs kernelioctl libc
  342. endif
  343. ifeq ($(FULL_TARGET),arm-palmos)
  344. override TARGET_UNITS+=kerneldefs kernelioctl libc
  345. endif
  346. ifeq ($(FULL_TARGET),arm-wince)
  347. override TARGET_UNITS+=kerneldefs kernelioctl libc
  348. endif
  349. ifeq ($(FULL_TARGET),powerpc64-linux)
  350. override TARGET_UNITS+=kerneldefs kernelioctl libc
  351. endif
  352. override INSTALL_FPCPACKAGE=y
  353. override SHARED_BUILD=n
  354. override SHARED_BUILD=n
  355. ifdef REQUIRE_UNITSDIR
  356. override UNITSDIR+=$(REQUIRE_UNITSDIR)
  357. endif
  358. ifdef REQUIRE_PACKAGESDIR
  359. override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
  360. endif
  361. ifdef ZIPINSTALL
  362. ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)
  363. UNIXHier=1
  364. endif
  365. else
  366. ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)
  367. UNIXHier=1
  368. endif
  369. endif
  370. ifndef INSTALL_PREFIX
  371. ifdef PREFIX
  372. INSTALL_PREFIX=$(PREFIX)
  373. endif
  374. endif
  375. ifndef INSTALL_PREFIX
  376. ifdef UNIXHier
  377. INSTALL_PREFIX=/usr/local
  378. else
  379. ifdef INSTALL_FPCPACKAGE
  380. INSTALL_BASEDIR:=/pp
  381. else
  382. INSTALL_BASEDIR:=/$(PACKAGE_NAME)
  383. endif
  384. endif
  385. endif
  386. export INSTALL_PREFIX
  387. ifdef INSTALL_FPCSUBDIR
  388. export INSTALL_FPCSUBDIR
  389. endif
  390. ifndef DIST_DESTDIR
  391. DIST_DESTDIR:=$(BASEDIR)
  392. endif
  393. export DIST_DESTDIR
  394. ifndef COMPILER_UNITTARGETDIR
  395. ifdef PACKAGEDIR_MAIN
  396. COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX)
  397. else
  398. COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX)
  399. endif
  400. endif
  401. ifndef COMPILER_TARGETDIR
  402. COMPILER_TARGETDIR=.
  403. endif
  404. ifndef INSTALL_BASEDIR
  405. ifdef UNIXHier
  406. ifdef INSTALL_FPCPACKAGE
  407. INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
  408. else
  409. INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)
  410. endif
  411. else
  412. INSTALL_BASEDIR:=$(INSTALL_PREFIX)
  413. endif
  414. endif
  415. ifndef INSTALL_BINDIR
  416. ifdef UNIXHier
  417. INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin
  418. else
  419. INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin
  420. ifdef INSTALL_FPCPACKAGE
  421. ifdef CROSSCOMPILE
  422. ifdef CROSSINSTALL
  423. INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX)
  424. else
  425. INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
  426. endif
  427. else
  428. INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
  429. endif
  430. endif
  431. endif
  432. endif
  433. ifndef INSTALL_UNITDIR
  434. INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX)
  435. ifdef INSTALL_FPCPACKAGE
  436. ifdef PACKAGE_NAME
  437. INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
  438. endif
  439. endif
  440. endif
  441. ifndef INSTALL_LIBDIR
  442. ifdef UNIXHier
  443. INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
  444. else
  445. INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
  446. endif
  447. endif
  448. ifndef INSTALL_SOURCEDIR
  449. ifdef UNIXHier
  450. ifdef BSDhier
  451. SRCPREFIXDIR=share/src
  452. else
  453. ifdef linuxHier
  454. SRCPREFIXDIR=share/src
  455. else
  456. SRCPREFIXDIR=src
  457. endif
  458. endif
  459. ifdef INSTALL_FPCPACKAGE
  460. ifdef INSTALL_FPCSUBDIR
  461. INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
  462. else
  463. INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
  464. endif
  465. else
  466. INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
  467. endif
  468. else
  469. ifdef INSTALL_FPCPACKAGE
  470. ifdef INSTALL_FPCSUBDIR
  471. INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
  472. else
  473. INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
  474. endif
  475. else
  476. INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
  477. endif
  478. endif
  479. endif
  480. ifndef INSTALL_DOCDIR
  481. ifdef UNIXHier
  482. ifdef BSDhier
  483. DOCPREFIXDIR=share/doc
  484. else
  485. ifdef linuxHier
  486. DOCPREFIXDIR=share/doc
  487. else
  488. DOCPREFIXDIR=doc
  489. endif
  490. endif
  491. ifdef INSTALL_FPCPACKAGE
  492. INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
  493. else
  494. INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
  495. endif
  496. else
  497. ifdef INSTALL_FPCPACKAGE
  498. INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)
  499. else
  500. INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc
  501. endif
  502. endif
  503. endif
  504. ifndef INSTALL_EXAMPLEDIR
  505. ifdef UNIXHier
  506. ifdef INSTALL_FPCPACKAGE
  507. ifdef BSDhier
  508. INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
  509. else
  510. ifdef linuxHier
  511. INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples
  512. else
  513. INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME)
  514. endif
  515. endif
  516. else
  517. ifdef BSDhier
  518. INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
  519. else
  520. ifdef linuxHier
  521. INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
  522. else
  523. INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
  524. endif
  525. endif
  526. endif
  527. else
  528. ifdef INSTALL_FPCPACKAGE
  529. INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)
  530. else
  531. INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples
  532. endif
  533. endif
  534. endif
  535. ifndef INSTALL_DATADIR
  536. INSTALL_DATADIR=$(INSTALL_BASEDIR)
  537. endif
  538. ifndef INSTALL_SHAREDDIR
  539. INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib
  540. endif
  541. ifdef CROSSCOMPILE
  542. ifndef CROSSBINDIR
  543. CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX))
  544. ifeq ($(CROSSBINDIR),)
  545. CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE))
  546. endif
  547. endif
  548. else
  549. CROSSBINDIR=
  550. endif
  551. ifeq ($(OS_SOURCE),linux)
  552. ifndef GCCLIBDIR
  553. ifeq ($(CPU_TARGET),i386)
  554. ifneq ($(findstring x86_64,$(shell uname -a)),)
  555. ifeq ($(BINUTILSPREFIX),)
  556. GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`)
  557. endif
  558. endif
  559. endif
  560. ifeq ($(CPU_TARGET),powerpc64)
  561. ifeq ($(BINUTILSPREFIX),)
  562. GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`)
  563. endif
  564. endif
  565. endif
  566. ifndef GCCLIBDIR
  567. CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH))))
  568. ifneq ($(CROSSGCC),)
  569. GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`)
  570. endif
  571. endif
  572. ifndef OTHERLIBDIR
  573. OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }')
  574. endif
  575. endif
  576. ifdef inUnix
  577. ifeq ($(OS_SOURCE),netbsd)
  578. OTHERLIBDIR+=/usr/pkg/lib
  579. endif
  580. export GCCLIBDIR OTHERLIB
  581. endif
  582. BATCHEXT=.bat
  583. LOADEREXT=.as
  584. EXEEXT=.exe
  585. PPLEXT=.ppl
  586. PPUEXT=.ppu
  587. OEXT=.o
  588. ASMEXT=.s
  589. SMARTEXT=.sl
  590. STATICLIBEXT=.a
  591. SHAREDLIBEXT=.so
  592. SHAREDLIBPREFIX=libfp
  593. STATICLIBPREFIX=libp
  594. RSTEXT=.rst
  595. ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
  596. ifeq ($(OS_TARGET),go32v1)
  597. STATICLIBPREFIX=
  598. SHORTSUFFIX=v1
  599. endif
  600. ifeq ($(OS_TARGET),go32v2)
  601. STATICLIBPREFIX=
  602. SHORTSUFFIX=dos
  603. endif
  604. ifeq ($(OS_TARGET),watcom)
  605. STATICLIBPREFIX=
  606. OEXT=.obj
  607. ASMEXT=.asm
  608. SHAREDLIBEXT=.dll
  609. SHORTSUFFIX=wat
  610. endif
  611. ifeq ($(OS_TARGET),linux)
  612. BATCHEXT=.sh
  613. EXEEXT=
  614. HASSHAREDLIB=1
  615. SHORTSUFFIX=lnx
  616. endif
  617. ifeq ($(OS_TARGET),freebsd)
  618. BATCHEXT=.sh
  619. EXEEXT=
  620. HASSHAREDLIB=1
  621. SHORTSUFFIX=fbs
  622. endif
  623. ifeq ($(OS_TARGET),netbsd)
  624. BATCHEXT=.sh
  625. EXEEXT=
  626. HASSHAREDLIB=1
  627. SHORTSUFFIX=nbs
  628. endif
  629. ifeq ($(OS_TARGET),openbsd)
  630. BATCHEXT=.sh
  631. EXEEXT=
  632. HASSHAREDLIB=1
  633. SHORTSUFFIX=obs
  634. endif
  635. ifeq ($(OS_TARGET),win32)
  636. SHAREDLIBEXT=.dll
  637. SHORTSUFFIX=w32
  638. endif
  639. ifeq ($(OS_TARGET),os2)
  640. BATCHEXT=.cmd
  641. AOUTEXT=.out
  642. STATICLIBPREFIX=
  643. SHAREDLIBEXT=.dll
  644. SHORTSUFFIX=os2
  645. ECHO=echo
  646. endif
  647. ifeq ($(OS_TARGET),emx)
  648. BATCHEXT=.cmd
  649. AOUTEXT=.out
  650. STATICLIBPREFIX=
  651. SHAREDLIBEXT=.dll
  652. SHORTSUFFIX=emx
  653. ECHO=echo
  654. endif
  655. ifeq ($(OS_TARGET),amiga)
  656. EXEEXT=
  657. SHAREDLIBEXT=.library
  658. SHORTSUFFIX=amg
  659. endif
  660. ifeq ($(OS_TARGET),morphos)
  661. EXEEXT=
  662. SHAREDLIBEXT=.library
  663. SHORTSUFFIX=mos
  664. endif
  665. ifeq ($(OS_TARGET),atari)
  666. EXEEXT=.ttp
  667. SHORTSUFFIX=ata
  668. endif
  669. ifeq ($(OS_TARGET),beos)
  670. BATCHEXT=.sh
  671. EXEEXT=
  672. SHORTSUFFIX=be
  673. endif
  674. ifeq ($(OS_TARGET),solaris)
  675. BATCHEXT=.sh
  676. EXEEXT=
  677. SHORTSUFFIX=sun
  678. endif
  679. ifeq ($(OS_TARGET),qnx)
  680. BATCHEXT=.sh
  681. EXEEXT=
  682. SHORTSUFFIX=qnx
  683. endif
  684. ifeq ($(OS_TARGET),netware)
  685. EXEEXT=.nlm
  686. STATICLIBPREFIX=
  687. SHORTSUFFIX=nw
  688. endif
  689. ifeq ($(OS_TARGET),netwlibc)
  690. EXEEXT=.nlm
  691. STATICLIBPREFIX=
  692. SHORTSUFFIX=nwl
  693. endif
  694. ifeq ($(OS_TARGET),macos)
  695. BATCHEXT=
  696. EXEEXT=
  697. DEBUGSYMEXT=.xcoff
  698. SHORTSUFFIX=mac
  699. endif
  700. ifeq ($(OS_TARGET),darwin)
  701. BATCHEXT=.sh
  702. EXEEXT=
  703. HASSHAREDLIB=1
  704. SHORTSUFFIX=dwn
  705. endif
  706. else
  707. ifeq ($(OS_TARGET),go32v1)
  708. PPUEXT=.pp1
  709. OEXT=.o1
  710. ASMEXT=.s1
  711. SMARTEXT=.sl1
  712. STATICLIBEXT=.a1
  713. SHAREDLIBEXT=.so1
  714. STATICLIBPREFIX=
  715. SHORTSUFFIX=v1
  716. endif
  717. ifeq ($(OS_TARGET),go32v2)
  718. STATICLIBPREFIX=
  719. SHORTSUFFIX=dos
  720. endif
  721. ifeq ($(OS_TARGET),watcom)
  722. STATICLIBPREFIX=
  723. SHORTSUFFIX=wat
  724. endif
  725. ifeq ($(OS_TARGET),linux)
  726. BATCHEXT=.sh
  727. EXEEXT=
  728. HASSHAREDLIB=1
  729. SHORTSUFFIX=lnx
  730. endif
  731. ifeq ($(OS_TARGET),freebsd)
  732. BATCHEXT=.sh
  733. EXEEXT=
  734. HASSHAREDLIB=1
  735. SHORTSUFFIX=fbs
  736. endif
  737. ifeq ($(OS_TARGET),netbsd)
  738. BATCHEXT=.sh
  739. EXEEXT=
  740. HASSHAREDLIB=1
  741. SHORTSUFFIX=nbs
  742. endif
  743. ifeq ($(OS_TARGET),openbsd)
  744. BATCHEXT=.sh
  745. EXEEXT=
  746. HASSHAREDLIB=1
  747. SHORTSUFFIX=obs
  748. endif
  749. ifeq ($(OS_TARGET),win32)
  750. PPUEXT=.ppw
  751. OEXT=.ow
  752. ASMEXT=.sw
  753. SMARTEXT=.slw
  754. STATICLIBEXT=.aw
  755. SHAREDLIBEXT=.dll
  756. SHORTSUFFIX=w32
  757. endif
  758. ifeq ($(OS_TARGET),os2)
  759. BATCHEXT=.cmd
  760. PPUEXT=.ppo
  761. ASMEXT=.so2
  762. OEXT=.oo2
  763. AOUTEXT=.out
  764. SMARTEXT=.sl2
  765. STATICLIBPREFIX=
  766. STATICLIBEXT=.ao2
  767. SHAREDLIBEXT=.dll
  768. SHORTSUFFIX=os2
  769. ECHO=echo
  770. endif
  771. ifeq ($(OS_TARGET),amiga)
  772. EXEEXT=
  773. PPUEXT=.ppu
  774. ASMEXT=.asm
  775. OEXT=.o
  776. SMARTEXT=.sl
  777. STATICLIBEXT=.a
  778. SHAREDLIBEXT=.library
  779. SHORTSUFFIX=amg
  780. endif
  781. ifeq ($(OS_TARGET),atari)
  782. PPUEXT=.ppu
  783. ASMEXT=.s
  784. OEXT=.o
  785. SMARTEXT=.sl
  786. STATICLIBEXT=.a
  787. EXEEXT=.ttp
  788. SHORTSUFFIX=ata
  789. endif
  790. ifeq ($(OS_TARGET),beos)
  791. BATCHEXT=.sh
  792. PPUEXT=.ppu
  793. ASMEXT=.s
  794. OEXT=.o
  795. SMARTEXT=.sl
  796. STATICLIBEXT=.a
  797. EXEEXT=
  798. SHORTSUFFIX=be
  799. endif
  800. ifeq ($(OS_TARGET),solaris)
  801. BATCHEXT=.sh
  802. PPUEXT=.ppu
  803. ASMEXT=.s
  804. OEXT=.o
  805. SMARTEXT=.sl
  806. STATICLIBEXT=.a
  807. EXEEXT=
  808. SHORTSUFFIX=sun
  809. endif
  810. ifeq ($(OS_TARGET),qnx)
  811. BATCHEXT=.sh
  812. PPUEXT=.ppu
  813. ASMEXT=.s
  814. OEXT=.o
  815. SMARTEXT=.sl
  816. STATICLIBEXT=.a
  817. EXEEXT=
  818. SHORTSUFFIX=qnx
  819. endif
  820. ifeq ($(OS_TARGET),netware)
  821. STATICLIBPREFIX=
  822. PPUEXT=.ppu
  823. OEXT=.o
  824. ASMEXT=.s
  825. SMARTEXT=.sl
  826. STATICLIBEXT=.a
  827. SHAREDLIBEXT=.nlm
  828. EXEEXT=.nlm
  829. SHORTSUFFIX=nw
  830. endif
  831. ifeq ($(OS_TARGET),netwlibc)
  832. STATICLIBPREFIX=
  833. PPUEXT=.ppu
  834. OEXT=.o
  835. ASMEXT=.s
  836. SMARTEXT=.sl
  837. STATICLIBEXT=.a
  838. SHAREDLIBEXT=.nlm
  839. EXEEXT=.nlm
  840. SHORTSUFFIX=nwl
  841. endif
  842. ifeq ($(OS_TARGET),macos)
  843. BATCHEXT=
  844. PPUEXT=.ppu
  845. ASMEXT=.s
  846. OEXT=.o
  847. SMARTEXT=.sl
  848. STATICLIBEXT=.a
  849. EXEEXT=
  850. DEBUGSYMEXT=.xcoff
  851. SHORTSUFFIX=mac
  852. endif
  853. endif
  854. ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
  855. FPCMADE=fpcmade.$(SHORTSUFFIX)
  856. ZIPSUFFIX=$(SHORTSUFFIX)
  857. ZIPCROSSPREFIX=
  858. ZIPSOURCESUFFIX=src
  859. ZIPEXAMPLESUFFIX=exm
  860. else
  861. FPCMADE=fpcmade.$(TARGETSUFFIX)
  862. ZIPSOURCESUFFIX=.source
  863. ZIPEXAMPLESUFFIX=.examples
  864. ifdef CROSSCOMPILE
  865. ZIPSUFFIX=.$(SOURCESUFFIX)
  866. ZIPCROSSPREFIX=$(TARGETSUFFIX)-
  867. else
  868. ZIPSUFFIX=.$(TARGETSUFFIX)
  869. ZIPCROSSPREFIX=
  870. endif
  871. endif
  872. ifndef ECHO
  873. ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
  874. ifeq ($(ECHO),)
  875. ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
  876. ifeq ($(ECHO),)
  877. ECHO= __missing_command_ECHO
  878. else
  879. ECHO:=$(firstword $(ECHO))
  880. endif
  881. else
  882. ECHO:=$(firstword $(ECHO))
  883. endif
  884. endif
  885. export ECHO
  886. ifndef DATE
  887. DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH))))
  888. ifeq ($(DATE),)
  889. DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
  890. ifeq ($(DATE),)
  891. DATE= __missing_command_DATE
  892. else
  893. DATE:=$(firstword $(DATE))
  894. endif
  895. else
  896. DATE:=$(firstword $(DATE))
  897. endif
  898. endif
  899. export DATE
  900. ifndef GINSTALL
  901. GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH))))
  902. ifeq ($(GINSTALL),)
  903. GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH))))
  904. ifeq ($(GINSTALL),)
  905. GINSTALL= __missing_command_GINSTALL
  906. else
  907. GINSTALL:=$(firstword $(GINSTALL))
  908. endif
  909. else
  910. GINSTALL:=$(firstword $(GINSTALL))
  911. endif
  912. endif
  913. export GINSTALL
  914. ifndef CPPROG
  915. CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH))))
  916. ifeq ($(CPPROG),)
  917. CPPROG= __missing_command_CPPROG
  918. else
  919. CPPROG:=$(firstword $(CPPROG))
  920. endif
  921. endif
  922. export CPPROG
  923. ifndef RMPROG
  924. RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH))))
  925. ifeq ($(RMPROG),)
  926. RMPROG= __missing_command_RMPROG
  927. else
  928. RMPROG:=$(firstword $(RMPROG))
  929. endif
  930. endif
  931. export RMPROG
  932. ifndef MVPROG
  933. MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH))))
  934. ifeq ($(MVPROG),)
  935. MVPROG= __missing_command_MVPROG
  936. else
  937. MVPROG:=$(firstword $(MVPROG))
  938. endif
  939. endif
  940. export MVPROG
  941. ifndef MKDIRPROG
  942. MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH))))
  943. ifeq ($(MKDIRPROG),)
  944. MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH))))
  945. ifeq ($(MKDIRPROG),)
  946. MKDIRPROG= __missing_command_MKDIRPROG
  947. else
  948. MKDIRPROG:=$(firstword $(MKDIRPROG))
  949. endif
  950. else
  951. MKDIRPROG:=$(firstword $(MKDIRPROG))
  952. endif
  953. endif
  954. export MKDIRPROG
  955. ifndef ECHOREDIR
  956. ifndef inUnix
  957. ECHOREDIR=echo
  958. else
  959. ECHOREDIR=$(ECHO)
  960. endif
  961. endif
  962. ifndef COPY
  963. COPY:=$(CPPROG) -fp
  964. endif
  965. ifndef COPYTREE
  966. COPYTREE:=$(CPPROG) -Rfp
  967. endif
  968. ifndef MKDIRTREE
  969. MKDIRTREE:=$(MKDIRPROG) -p
  970. endif
  971. ifndef MOVE
  972. MOVE:=$(MVPROG) -f
  973. endif
  974. ifndef DEL
  975. DEL:=$(RMPROG) -f
  976. endif
  977. ifndef DELTREE
  978. DELTREE:=$(RMPROG) -rf
  979. endif
  980. ifndef INSTALL
  981. ifdef inUnix
  982. INSTALL:=$(GINSTALL) -c -m 644
  983. else
  984. INSTALL:=$(COPY)
  985. endif
  986. endif
  987. ifndef INSTALLEXE
  988. ifdef inUnix
  989. INSTALLEXE:=$(GINSTALL) -c -m 755
  990. else
  991. INSTALLEXE:=$(COPY)
  992. endif
  993. endif
  994. ifndef MKDIR
  995. MKDIR:=$(GINSTALL) -m 755 -d
  996. endif
  997. export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
  998. ifndef PPUMOVE
  999. PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
  1000. ifeq ($(PPUMOVE),)
  1001. PPUMOVE= __missing_command_PPUMOVE
  1002. else
  1003. PPUMOVE:=$(firstword $(PPUMOVE))
  1004. endif
  1005. endif
  1006. export PPUMOVE
  1007. ifndef FPCMAKE
  1008. FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
  1009. ifeq ($(FPCMAKE),)
  1010. FPCMAKE= __missing_command_FPCMAKE
  1011. else
  1012. FPCMAKE:=$(firstword $(FPCMAKE))
  1013. endif
  1014. endif
  1015. export FPCMAKE
  1016. ifndef ZIPPROG
  1017. ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
  1018. ifeq ($(ZIPPROG),)
  1019. ZIPPROG= __missing_command_ZIPPROG
  1020. else
  1021. ZIPPROG:=$(firstword $(ZIPPROG))
  1022. endif
  1023. endif
  1024. export ZIPPROG
  1025. ifndef TARPROG
  1026. TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH))))
  1027. ifeq ($(TARPROG),)
  1028. TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
  1029. ifeq ($(TARPROG),)
  1030. TARPROG= __missing_command_TARPROG
  1031. else
  1032. TARPROG:=$(firstword $(TARPROG))
  1033. endif
  1034. else
  1035. TARPROG:=$(firstword $(TARPROG))
  1036. endif
  1037. endif
  1038. export TARPROG
  1039. ASNAME=$(BINUTILSPREFIX)as
  1040. LDNAME=$(BINUTILSPREFIX)ld
  1041. ARNAME=$(BINUTILSPREFIX)ar
  1042. RCNAME=$(BINUTILSPREFIX)rc
  1043. ifneq ($(findstring 1.0.,$(FPC_VERSION)),)
  1044. ifeq ($(OS_TARGET),win32)
  1045. ifeq ($(CROSSBINDIR),)
  1046. ASNAME=asw
  1047. LDNAME=ldw
  1048. ARNAME=arw
  1049. endif
  1050. endif
  1051. endif
  1052. ifndef ASPROG
  1053. ifdef CROSSBINDIR
  1054. ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)
  1055. else
  1056. ASPROG=$(ASNAME)
  1057. endif
  1058. endif
  1059. ifndef LDPROG
  1060. ifdef CROSSBINDIR
  1061. LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)
  1062. else
  1063. LDPROG=$(LDNAME)
  1064. endif
  1065. endif
  1066. ifndef RCPROG
  1067. ifdef CROSSBINDIR
  1068. RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)
  1069. else
  1070. RCPROG=$(RCNAME)
  1071. endif
  1072. endif
  1073. ifndef ARPROG
  1074. ifdef CROSSBINDIR
  1075. ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)
  1076. else
  1077. ARPROG=$(ARNAME)
  1078. endif
  1079. endif
  1080. AS=$(ASPROG)
  1081. LD=$(LDPROG)
  1082. RC=$(RCPROG)
  1083. AR=$(ARPROG)
  1084. PPAS=ppas$(SRCBATCHEXT)
  1085. ifdef inUnix
  1086. LDCONFIG=ldconfig
  1087. else
  1088. LDCONFIG=
  1089. endif
  1090. ifdef DATE
  1091. DATESTR:=$(shell $(DATE) +%Y%m%d)
  1092. else
  1093. DATESTR=
  1094. endif
  1095. ifndef UPXPROG
  1096. ifeq ($(OS_TARGET),go32v2)
  1097. UPXPROG:=1
  1098. endif
  1099. ifeq ($(OS_TARGET),win32)
  1100. UPXPROG:=1
  1101. endif
  1102. ifdef UPXPROG
  1103. UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
  1104. ifeq ($(UPXPROG),)
  1105. UPXPROG=
  1106. else
  1107. UPXPROG:=$(firstword $(UPXPROG))
  1108. endif
  1109. else
  1110. UPXPROG=
  1111. endif
  1112. endif
  1113. export UPXPROG
  1114. ZIPOPT=-9
  1115. ZIPEXT=.zip
  1116. ifeq ($(USETAR),bz2)
  1117. TAROPT=vj
  1118. TAREXT=.tar.bz2
  1119. else
  1120. TAROPT=vz
  1121. TAREXT=.tar.gz
  1122. endif
  1123. override REQUIRE_PACKAGES=rtl
  1124. ifeq ($(FULL_TARGET),i386-linux)
  1125. REQUIRE_PACKAGES_RTL=1
  1126. endif
  1127. ifeq ($(FULL_TARGET),i386-go32v2)
  1128. REQUIRE_PACKAGES_RTL=1
  1129. endif
  1130. ifeq ($(FULL_TARGET),i386-win32)
  1131. REQUIRE_PACKAGES_RTL=1
  1132. endif
  1133. ifeq ($(FULL_TARGET),i386-os2)
  1134. REQUIRE_PACKAGES_RTL=1
  1135. endif
  1136. ifeq ($(FULL_TARGET),i386-freebsd)
  1137. REQUIRE_PACKAGES_RTL=1
  1138. endif
  1139. ifeq ($(FULL_TARGET),i386-beos)
  1140. REQUIRE_PACKAGES_RTL=1
  1141. endif
  1142. ifeq ($(FULL_TARGET),i386-netbsd)
  1143. REQUIRE_PACKAGES_RTL=1
  1144. endif
  1145. ifeq ($(FULL_TARGET),i386-solaris)
  1146. REQUIRE_PACKAGES_RTL=1
  1147. endif
  1148. ifeq ($(FULL_TARGET),i386-qnx)
  1149. REQUIRE_PACKAGES_RTL=1
  1150. endif
  1151. ifeq ($(FULL_TARGET),i386-netware)
  1152. REQUIRE_PACKAGES_RTL=1
  1153. endif
  1154. ifeq ($(FULL_TARGET),i386-openbsd)
  1155. REQUIRE_PACKAGES_RTL=1
  1156. endif
  1157. ifeq ($(FULL_TARGET),i386-wdosx)
  1158. REQUIRE_PACKAGES_RTL=1
  1159. endif
  1160. ifeq ($(FULL_TARGET),i386-darwin)
  1161. REQUIRE_PACKAGES_RTL=1
  1162. endif
  1163. ifeq ($(FULL_TARGET),i386-emx)
  1164. REQUIRE_PACKAGES_RTL=1
  1165. endif
  1166. ifeq ($(FULL_TARGET),i386-watcom)
  1167. REQUIRE_PACKAGES_RTL=1
  1168. endif
  1169. ifeq ($(FULL_TARGET),i386-netwlibc)
  1170. REQUIRE_PACKAGES_RTL=1
  1171. endif
  1172. ifeq ($(FULL_TARGET),i386-wince)
  1173. REQUIRE_PACKAGES_RTL=1
  1174. endif
  1175. ifeq ($(FULL_TARGET),m68k-linux)
  1176. REQUIRE_PACKAGES_RTL=1
  1177. endif
  1178. ifeq ($(FULL_TARGET),m68k-freebsd)
  1179. REQUIRE_PACKAGES_RTL=1
  1180. endif
  1181. ifeq ($(FULL_TARGET),m68k-netbsd)
  1182. REQUIRE_PACKAGES_RTL=1
  1183. endif
  1184. ifeq ($(FULL_TARGET),m68k-amiga)
  1185. REQUIRE_PACKAGES_RTL=1
  1186. endif
  1187. ifeq ($(FULL_TARGET),m68k-atari)
  1188. REQUIRE_PACKAGES_RTL=1
  1189. endif
  1190. ifeq ($(FULL_TARGET),m68k-openbsd)
  1191. REQUIRE_PACKAGES_RTL=1
  1192. endif
  1193. ifeq ($(FULL_TARGET),m68k-palmos)
  1194. REQUIRE_PACKAGES_RTL=1
  1195. endif
  1196. ifeq ($(FULL_TARGET),powerpc-linux)
  1197. REQUIRE_PACKAGES_RTL=1
  1198. endif
  1199. ifeq ($(FULL_TARGET),powerpc-netbsd)
  1200. REQUIRE_PACKAGES_RTL=1
  1201. endif
  1202. ifeq ($(FULL_TARGET),powerpc-macos)
  1203. REQUIRE_PACKAGES_RTL=1
  1204. endif
  1205. ifeq ($(FULL_TARGET),powerpc-darwin)
  1206. REQUIRE_PACKAGES_RTL=1
  1207. endif
  1208. ifeq ($(FULL_TARGET),powerpc-morphos)
  1209. REQUIRE_PACKAGES_RTL=1
  1210. endif
  1211. ifeq ($(FULL_TARGET),sparc-linux)
  1212. REQUIRE_PACKAGES_RTL=1
  1213. endif
  1214. ifeq ($(FULL_TARGET),sparc-netbsd)
  1215. REQUIRE_PACKAGES_RTL=1
  1216. endif
  1217. ifeq ($(FULL_TARGET),sparc-solaris)
  1218. REQUIRE_PACKAGES_RTL=1
  1219. endif
  1220. ifeq ($(FULL_TARGET),x86_64-linux)
  1221. REQUIRE_PACKAGES_RTL=1
  1222. endif
  1223. ifeq ($(FULL_TARGET),x86_64-freebsd)
  1224. REQUIRE_PACKAGES_RTL=1
  1225. endif
  1226. ifeq ($(FULL_TARGET),x86_64-win64)
  1227. REQUIRE_PACKAGES_RTL=1
  1228. endif
  1229. ifeq ($(FULL_TARGET),arm-linux)
  1230. REQUIRE_PACKAGES_RTL=1
  1231. endif
  1232. ifeq ($(FULL_TARGET),arm-palmos)
  1233. REQUIRE_PACKAGES_RTL=1
  1234. endif
  1235. ifeq ($(FULL_TARGET),arm-wince)
  1236. REQUIRE_PACKAGES_RTL=1
  1237. endif
  1238. ifeq ($(FULL_TARGET),powerpc64-linux)
  1239. REQUIRE_PACKAGES_RTL=1
  1240. endif
  1241. ifdef REQUIRE_PACKAGES_RTL
  1242. PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
  1243. ifneq ($(PACKAGEDIR_RTL),)
  1244. ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),)
  1245. UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)
  1246. else
  1247. UNITDIR_RTL=$(PACKAGEDIR_RTL)
  1248. endif
  1249. ifdef CHECKDEPEND
  1250. $(PACKAGEDIR_RTL)/$(FPCMADE):
  1251. $(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE)
  1252. override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE)
  1253. endif
  1254. else
  1255. PACKAGEDIR_RTL=
  1256. UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR)))))
  1257. ifneq ($(UNITDIR_RTL),)
  1258. UNITDIR_RTL:=$(firstword $(UNITDIR_RTL))
  1259. else
  1260. UNITDIR_RTL=
  1261. endif
  1262. endif
  1263. ifdef UNITDIR_RTL
  1264. override COMPILER_UNITDIR+=$(UNITDIR_RTL)
  1265. endif
  1266. endif
  1267. ifndef NOCPUDEF
  1268. override FPCOPTDEF=$(CPU_TARGET)
  1269. endif
  1270. ifneq ($(OS_TARGET),$(OS_SOURCE))
  1271. override FPCOPT+=-T$(OS_TARGET)
  1272. endif
  1273. ifeq ($(OS_SOURCE),openbsd)
  1274. override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
  1275. endif
  1276. ifndef CROSSBOOTSTRAP
  1277. ifneq ($(BINUTILSPREFIX),)
  1278. override FPCOPT+=-XP$(BINUTILSPREFIX) -Xc
  1279. endif
  1280. ifneq ($(BINUTILSPREFIX),)
  1281. override FPCOPT+=-Xr$(RLINKPATH)
  1282. endif
  1283. endif
  1284. ifdef UNITDIR
  1285. override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
  1286. endif
  1287. ifdef LIBDIR
  1288. override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
  1289. endif
  1290. ifdef OBJDIR
  1291. override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
  1292. endif
  1293. ifdef INCDIR
  1294. override FPCOPT+=$(addprefix -Fi,$(INCDIR))
  1295. endif
  1296. ifdef LINKSMART
  1297. override FPCOPT+=-XX
  1298. endif
  1299. ifdef CREATESMART
  1300. override FPCOPT+=-CX
  1301. endif
  1302. ifdef DEBUG
  1303. override FPCOPT+=-gl
  1304. override FPCOPTDEF+=DEBUG
  1305. endif
  1306. ifdef RELEASE
  1307. ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
  1308. ifeq ($(CPU_TARGET),i386)
  1309. FPCCPUOPT:=-OG2p3
  1310. endif
  1311. ifeq ($(CPU_TARGET),powerpc)
  1312. FPCCPUOPT:=-O1r
  1313. endif
  1314. else
  1315. FPCCPUOPT:=-O2
  1316. endif
  1317. override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
  1318. override FPCOPTDEF+=RELEASE
  1319. endif
  1320. ifdef STRIP
  1321. override FPCOPT+=-Xs
  1322. endif
  1323. ifdef OPTIMIZE
  1324. override FPCOPT+=-O2
  1325. endif
  1326. ifdef VERBOSE
  1327. override FPCOPT+=-vwni
  1328. endif
  1329. ifdef COMPILER_OPTIONS
  1330. override FPCOPT+=$(COMPILER_OPTIONS)
  1331. endif
  1332. ifdef COMPILER_UNITDIR
  1333. override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
  1334. endif
  1335. ifdef COMPILER_LIBRARYDIR
  1336. override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
  1337. endif
  1338. ifdef COMPILER_OBJECTDIR
  1339. override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
  1340. endif
  1341. ifdef COMPILER_INCLUDEDIR
  1342. override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
  1343. endif
  1344. ifdef CROSSBINDIR
  1345. override FPCOPT+=-FD$(CROSSBINDIR)
  1346. endif
  1347. ifdef COMPILER_TARGETDIR
  1348. override FPCOPT+=-FE$(COMPILER_TARGETDIR)
  1349. ifeq ($(COMPILER_TARGETDIR),.)
  1350. override TARGETDIRPREFIX=
  1351. else
  1352. override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
  1353. endif
  1354. endif
  1355. ifdef COMPILER_UNITTARGETDIR
  1356. override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
  1357. ifeq ($(COMPILER_UNITTARGETDIR),.)
  1358. override UNITTARGETDIRPREFIX=
  1359. else
  1360. override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
  1361. endif
  1362. else
  1363. ifdef COMPILER_TARGETDIR
  1364. override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
  1365. override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
  1366. endif
  1367. endif
  1368. ifdef CREATESHARED
  1369. override FPCOPT+=-Cg
  1370. ifeq ($(CPU_TARGET),i386)
  1371. override FPCOPT+=-Aas
  1372. endif
  1373. endif
  1374. ifdef LINKSHARED
  1375. endif
  1376. ifdef GCCLIBDIR
  1377. override FPCOPT+=-Fl$(GCCLIBDIR)
  1378. endif
  1379. ifdef OTHERLIBDIR
  1380. override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
  1381. endif
  1382. ifdef OPT
  1383. override FPCOPT+=$(OPT)
  1384. endif
  1385. ifdef FPCOPTDEF
  1386. override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
  1387. endif
  1388. ifdef CFGFILE
  1389. override FPCOPT+=@$(CFGFILE)
  1390. endif
  1391. ifdef USEENV
  1392. override FPCEXTCMD:=$(FPCOPT)
  1393. override FPCOPT:=!FPCEXTCMD
  1394. export FPCEXTCMD
  1395. endif
  1396. override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
  1397. override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
  1398. ifneq ($(AFULL_TARGET),$(AFULL_SOURCE))
  1399. override ACROSSCOMPILE=1
  1400. endif
  1401. ifdef ACROSSCOMPILE
  1402. override FPCOPT+=$(CROSSOPT)
  1403. endif
  1404. override COMPILER:=$(FPC) $(FPCOPT)
  1405. ifeq (,$(findstring -s ,$(COMPILER)))
  1406. EXECPPAS=
  1407. else
  1408. ifeq ($(FULL_SOURCE),$(FULL_TARGET))
  1409. EXECPPAS:=@$(PPAS)
  1410. endif
  1411. endif
  1412. .PHONY: fpc_units
  1413. ifneq ($(TARGET_UNITS),)
  1414. override ALLTARGET+=fpc_units
  1415. override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS))
  1416. override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS))
  1417. override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
  1418. override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
  1419. endif
  1420. fpc_units: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES)
  1421. ifdef TARGET_RSTS
  1422. override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
  1423. override CLEANRSTFILES+=$(RSTFILES)
  1424. endif
  1425. .PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared
  1426. $(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
  1427. @$(ECHOREDIR) Compiled > $(FPCMADE)
  1428. fpc_all: $(FPCMADE)
  1429. fpc_smart:
  1430. $(MAKE) all LINKSMART=1 CREATESMART=1
  1431. fpc_debug:
  1432. $(MAKE) all DEBUG=1
  1433. fpc_release:
  1434. $(MAKE) all RELEASE=1
  1435. .SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res
  1436. $(COMPILER_UNITTARGETDIR):
  1437. $(MKDIRTREE) $(COMPILER_UNITTARGETDIR)
  1438. $(COMPILER_TARGETDIR):
  1439. $(MKDIRTREE) $(COMPILER_TARGETDIR)
  1440. %$(PPUEXT): %.pp
  1441. $(COMPILER) $<
  1442. $(EXECPPAS)
  1443. %$(PPUEXT): %.pas
  1444. $(COMPILER) $<
  1445. $(EXECPPAS)
  1446. %$(EXEEXT): %.pp
  1447. $(COMPILER) $<
  1448. $(EXECPPAS)
  1449. %$(EXEEXT): %.pas
  1450. $(COMPILER) $<
  1451. $(EXECPPAS)
  1452. %$(EXEEXT): %.lpr
  1453. $(COMPILER) $<
  1454. $(EXECPPAS)
  1455. %$(EXEEXT): %.dpr
  1456. $(COMPILER) $<
  1457. $(EXECPPAS)
  1458. %.res: %.rc
  1459. windres -i $< -o $@
  1460. vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
  1461. vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
  1462. vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
  1463. vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
  1464. vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
  1465. vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
  1466. .PHONY: fpc_shared
  1467. override INSTALLTARGET+=fpc_shared_install
  1468. ifndef SHARED_LIBVERSION
  1469. SHARED_LIBVERSION=$(FPC_VERSION)
  1470. endif
  1471. ifndef SHARED_LIBNAME
  1472. SHARED_LIBNAME=$(PACKAGE_NAME)
  1473. endif
  1474. ifndef SHARED_FULLNAME
  1475. SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT)
  1476. endif
  1477. ifndef SHARED_LIBUNITS
  1478. SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS)
  1479. override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS))
  1480. endif
  1481. fpc_shared:
  1482. ifdef HASSHAREDLIB
  1483. $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
  1484. ifneq ($(SHARED_BUILD),n)
  1485. $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR)
  1486. endif
  1487. else
  1488. @$(ECHO) Shared Libraries not supported
  1489. endif
  1490. fpc_shared_install:
  1491. ifneq ($(SHARED_BUILD),n)
  1492. ifneq ($(SHARED_LIBUNITS),)
  1493. ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),)
  1494. $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR)
  1495. endif
  1496. endif
  1497. endif
  1498. .PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
  1499. ifdef INSTALL_UNITS
  1500. override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
  1501. endif
  1502. ifdef INSTALL_BUILDUNIT
  1503. override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
  1504. endif
  1505. ifdef INSTALLPPUFILES
  1506. override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
  1507. ifneq ($(UNITTARGETDIRPREFIX),)
  1508. override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES)))
  1509. override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES))))
  1510. endif
  1511. override INSTALL_CREATEPACKAGEFPC=1
  1512. endif
  1513. ifdef INSTALLEXEFILES
  1514. ifneq ($(TARGETDIRPREFIX),)
  1515. override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES)))
  1516. endif
  1517. endif
  1518. fpc_install: all $(INSTALLTARGET)
  1519. ifdef INSTALLEXEFILES
  1520. $(MKDIR) $(INSTALL_BINDIR)
  1521. ifdef UPXPROG
  1522. -$(UPXPROG) $(INSTALLEXEFILES)
  1523. endif
  1524. $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
  1525. endif
  1526. ifdef INSTALL_CREATEPACKAGEFPC
  1527. ifdef FPCMAKE
  1528. ifdef PACKAGE_VERSION
  1529. ifneq ($(wildcard Makefile.fpc),)
  1530. $(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
  1531. $(MKDIR) $(INSTALL_UNITDIR)
  1532. $(INSTALL) Package.fpc $(INSTALL_UNITDIR)
  1533. endif
  1534. endif
  1535. endif
  1536. endif
  1537. ifdef INSTALLPPUFILES
  1538. $(MKDIR) $(INSTALL_UNITDIR)
  1539. $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
  1540. ifneq ($(INSTALLPPULINKFILES),)
  1541. $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
  1542. endif
  1543. ifneq ($(wildcard $(LIB_FULLNAME)),)
  1544. $(MKDIR) $(INSTALL_LIBDIR)
  1545. $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
  1546. ifdef inUnix
  1547. ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
  1548. endif
  1549. endif
  1550. endif
  1551. ifdef INSTALL_FILES
  1552. $(MKDIR) $(INSTALL_DATADIR)
  1553. $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
  1554. endif
  1555. fpc_sourceinstall: distclean
  1556. $(MKDIR) $(INSTALL_SOURCEDIR)
  1557. $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
  1558. fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
  1559. ifdef HASEXAMPLES
  1560. $(MKDIR) $(INSTALL_EXAMPLEDIR)
  1561. endif
  1562. ifdef EXAMPLESOURCEFILES
  1563. $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
  1564. endif
  1565. ifdef TARGET_EXAMPLEDIRS
  1566. $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
  1567. endif
  1568. .PHONY: fpc_distinstall
  1569. fpc_distinstall: install exampleinstall
  1570. .PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall
  1571. ifndef PACKDIR
  1572. ifndef inUnix
  1573. PACKDIR=$(BASEDIR)/../fpc-pack
  1574. else
  1575. PACKDIR=/tmp/fpc-pack
  1576. endif
  1577. endif
  1578. ifndef ZIPNAME
  1579. ifdef DIST_ZIPNAME
  1580. ZIPNAME=$(DIST_ZIPNAME)
  1581. else
  1582. ZIPNAME=$(PACKAGE_NAME)
  1583. endif
  1584. endif
  1585. ifndef FULLZIPNAME
  1586. FULLZIPNAME=$(ZIPCROSSPREFIX)$(ZIPPREFIX)$(ZIPNAME)$(ZIPSUFFIX)
  1587. endif
  1588. ifndef ZIPTARGET
  1589. ifdef DIST_ZIPTARGET
  1590. ZIPTARGET=DIST_ZIPTARGET
  1591. else
  1592. ZIPTARGET=install
  1593. endif
  1594. endif
  1595. ifndef USEZIP
  1596. ifdef inUnix
  1597. USETAR=1
  1598. endif
  1599. endif
  1600. ifndef inUnix
  1601. USEZIPWRAPPER=1
  1602. endif
  1603. ifdef USEZIPWRAPPER
  1604. ZIPPATHSEP=$(PATHSEP)
  1605. ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(SRCBATCHEXT))
  1606. else
  1607. ZIPPATHSEP=/
  1608. endif
  1609. ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR))
  1610. ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR))
  1611. ifdef USETAR
  1612. ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(TAREXT)
  1613. ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) *
  1614. else
  1615. ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(ZIPEXT)
  1616. ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) *
  1617. endif
  1618. fpc_zipinstall:
  1619. $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1
  1620. $(MKDIR) $(DIST_DESTDIR)
  1621. $(DEL) $(ZIPDESTFILE)
  1622. ifdef USEZIPWRAPPER
  1623. ifneq ($(ECHOREDIR),echo)
  1624. $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER)
  1625. $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER)
  1626. $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER)
  1627. else
  1628. echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER)
  1629. echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER)
  1630. echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER)
  1631. endif
  1632. ifdef inUnix
  1633. /bin/sh $(ZIPWRAPPER)
  1634. else
  1635. $(ZIPWRAPPER)
  1636. endif
  1637. $(DEL) $(ZIPWRAPPER)
  1638. else
  1639. $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE)
  1640. endif
  1641. $(DELTREE) $(PACKDIR)
  1642. fpc_zipsourceinstall:
  1643. $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=$(ZIPSOURCESUFFIX)
  1644. fpc_zipexampleinstall:
  1645. ifdef HASEXAMPLES
  1646. $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=$(ZIPEXAMPLESUFFIX)
  1647. endif
  1648. fpc_zipdistinstall:
  1649. $(MAKE) fpc_zipinstall ZIPTARGET=distinstall
  1650. .PHONY: fpc_clean fpc_cleanall fpc_distclean
  1651. ifdef EXEFILES
  1652. override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
  1653. endif
  1654. ifdef CLEAN_UNITS
  1655. override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
  1656. endif
  1657. ifdef CLEANPPUFILES
  1658. override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
  1659. ifdef DEBUGSYMEXT
  1660. override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES))
  1661. endif
  1662. override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
  1663. override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
  1664. endif
  1665. fpc_clean: $(CLEANTARGET)
  1666. ifdef CLEANEXEFILES
  1667. -$(DEL) $(CLEANEXEFILES)
  1668. endif
  1669. ifdef CLEANPPUFILES
  1670. -$(DEL) $(CLEANPPUFILES)
  1671. endif
  1672. ifneq ($(CLEANPPULINKFILES),)
  1673. -$(DEL) $(CLEANPPULINKFILES)
  1674. endif
  1675. ifdef CLEANRSTFILES
  1676. -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
  1677. endif
  1678. ifdef CLEAN_FILES
  1679. -$(DEL) $(CLEAN_FILES)
  1680. endif
  1681. ifdef LIB_NAME
  1682. -$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
  1683. endif
  1684. -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
  1685. -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)
  1686. fpc_cleanall: $(CLEANTARGET)
  1687. ifdef CLEANEXEFILES
  1688. -$(DEL) $(CLEANEXEFILES)
  1689. endif
  1690. ifdef COMPILER_UNITTARGETDIR
  1691. ifdef CLEANPPUFILES
  1692. -$(DEL) $(CLEANPPUFILES)
  1693. endif
  1694. ifneq ($(CLEANPPULINKFILES),)
  1695. -$(DEL) $(CLEANPPULINKFILES)
  1696. endif
  1697. ifdef CLEANRSTFILES
  1698. -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
  1699. endif
  1700. endif
  1701. -$(DELTREE) units
  1702. -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  1703. ifneq ($(PPUEXT),.ppu)
  1704. -$(DEL) *.o *.ppu *.a
  1705. endif
  1706. -$(DELTREE) *$(SMARTEXT)
  1707. -$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
  1708. -$(DEL) *_ppas$(BATCHEXT)
  1709. ifdef AOUTEXT
  1710. -$(DEL) *$(AOUTEXT)
  1711. endif
  1712. ifdef DEBUGSYMEXT
  1713. -$(DEL) *$(DEBUGSYMEXT)
  1714. endif
  1715. fpc_distclean: cleanall
  1716. .PHONY: fpc_baseinfo
  1717. override INFORULES+=fpc_baseinfo
  1718. fpc_baseinfo:
  1719. @$(ECHO)
  1720. @$(ECHO) == Package info ==
  1721. @$(ECHO) Package Name..... $(PACKAGE_NAME)
  1722. @$(ECHO) Package Version.. $(PACKAGE_VERSION)
  1723. @$(ECHO)
  1724. @$(ECHO) == Configuration info ==
  1725. @$(ECHO)
  1726. @$(ECHO) FPC.......... $(FPC)
  1727. @$(ECHO) FPC Version.. $(FPC_VERSION)
  1728. @$(ECHO) Source CPU... $(CPU_SOURCE)
  1729. @$(ECHO) Target CPU... $(CPU_TARGET)
  1730. @$(ECHO) Source OS.... $(OS_SOURCE)
  1731. @$(ECHO) Target OS.... $(OS_TARGET)
  1732. @$(ECHO) Full Source.. $(FULL_SOURCE)
  1733. @$(ECHO) Full Target.. $(FULL_TARGET)
  1734. @$(ECHO) SourceSuffix. $(SOURCESUFFIX)
  1735. @$(ECHO) TargetSuffix. $(TARGETSUFFIX)
  1736. @$(ECHO)
  1737. @$(ECHO) == Directory info ==
  1738. @$(ECHO)
  1739. @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES)
  1740. @$(ECHO)
  1741. @$(ECHO) Basedir......... $(BASEDIR)
  1742. @$(ECHO) FPCDir.......... $(FPCDIR)
  1743. @$(ECHO) CrossBinDir..... $(CROSSBINDIR)
  1744. @$(ECHO) UnitsDir........ $(UNITSDIR)
  1745. @$(ECHO) PackagesDir..... $(PACKAGESDIR)
  1746. @$(ECHO)
  1747. @$(ECHO) GCC library..... $(GCCLIBDIR)
  1748. @$(ECHO) Other library... $(OTHERLIBDIR)
  1749. @$(ECHO)
  1750. @$(ECHO) == Tools info ==
  1751. @$(ECHO)
  1752. @$(ECHO) As........ $(AS)
  1753. @$(ECHO) Ld........ $(LD)
  1754. @$(ECHO) Ar........ $(AR)
  1755. @$(ECHO) Rc........ $(RC)
  1756. @$(ECHO)
  1757. @$(ECHO) Mv........ $(MVPROG)
  1758. @$(ECHO) Cp........ $(CPPROG)
  1759. @$(ECHO) Rm........ $(RMPROG)
  1760. @$(ECHO) GInstall.. $(GINSTALL)
  1761. @$(ECHO) Echo...... $(ECHO)
  1762. @$(ECHO) Shell..... $(SHELL)
  1763. @$(ECHO) Date...... $(DATE)
  1764. @$(ECHO) FPCMake... $(FPCMAKE)
  1765. @$(ECHO) PPUMove... $(PPUMOVE)
  1766. @$(ECHO) Upx....... $(UPXPROG)
  1767. @$(ECHO) Zip....... $(ZIPPROG)
  1768. @$(ECHO)
  1769. @$(ECHO) == Object info ==
  1770. @$(ECHO)
  1771. @$(ECHO) Target Loaders........ $(TARGET_LOADERS)
  1772. @$(ECHO) Target Units.......... $(TARGET_UNITS)
  1773. @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS)
  1774. @$(ECHO) Target Programs....... $(TARGET_PROGRAMS)
  1775. @$(ECHO) Target Dirs........... $(TARGET_DIRS)
  1776. @$(ECHO) Target Examples....... $(TARGET_EXAMPLES)
  1777. @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)
  1778. @$(ECHO)
  1779. @$(ECHO) Clean Units......... $(CLEAN_UNITS)
  1780. @$(ECHO) Clean Files......... $(CLEAN_FILES)
  1781. @$(ECHO)
  1782. @$(ECHO) Install Units....... $(INSTALL_UNITS)
  1783. @$(ECHO) Install Files....... $(INSTALL_FILES)
  1784. @$(ECHO)
  1785. @$(ECHO) == Install info ==
  1786. @$(ECHO)
  1787. @$(ECHO) DateStr.............. $(DATESTR)
  1788. @$(ECHO) ZipName.............. $(ZIPNAME)
  1789. @$(ECHO) ZipPrefix............ $(ZIPPREFIX)
  1790. @$(ECHO) ZipCrossPrefix....... $(ZIPCROSSPREFIX)
  1791. @$(ECHO) ZipSuffix............ $(ZIPSUFFIX)
  1792. @$(ECHO) FullZipName.......... $(FULLZIPNAME)
  1793. @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE)
  1794. @$(ECHO)
  1795. @$(ECHO) Install base dir..... $(INSTALL_BASEDIR)
  1796. @$(ECHO) Install binary dir... $(INSTALL_BINDIR)
  1797. @$(ECHO) Install library dir.. $(INSTALL_LIBDIR)
  1798. @$(ECHO) Install units dir.... $(INSTALL_UNITDIR)
  1799. @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR)
  1800. @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR)
  1801. @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR)
  1802. @$(ECHO) Install data dir..... $(INSTALL_DATADIR)
  1803. @$(ECHO)
  1804. @$(ECHO) Dist destination dir. $(DIST_DESTDIR)
  1805. @$(ECHO) Dist zip name........ $(DIST_ZIPNAME)
  1806. @$(ECHO)
  1807. .PHONY: fpc_info
  1808. fpc_info: $(INFORULES)
  1809. .PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \
  1810. fpc_makefile_dirs
  1811. fpc_makefile:
  1812. $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc
  1813. fpc_makefile_sub1:
  1814. ifdef TARGET_DIRS
  1815. $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS))
  1816. endif
  1817. ifdef TARGET_EXAMPLEDIRS
  1818. $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS))
  1819. endif
  1820. fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
  1821. fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
  1822. fpc_makefiles: fpc_makefile fpc_makefile_dirs
  1823. all: fpc_all
  1824. debug: fpc_debug
  1825. smart: fpc_smart
  1826. release: fpc_release
  1827. units: fpc_units
  1828. examples:
  1829. shared: fpc_shared
  1830. install: fpc_install
  1831. sourceinstall: fpc_sourceinstall
  1832. exampleinstall: fpc_exampleinstall
  1833. distinstall: fpc_distinstall
  1834. zipinstall: fpc_zipinstall
  1835. zipsourceinstall: fpc_zipsourceinstall
  1836. zipexampleinstall: fpc_zipexampleinstall
  1837. zipdistinstall: fpc_zipdistinstall
  1838. clean: fpc_clean
  1839. distclean: fpc_distclean
  1840. cleanall: fpc_cleanall
  1841. info: fpc_info
  1842. makefiles: fpc_makefiles
  1843. .PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
  1844. ifneq ($(wildcard fpcmake.loc),)
  1845. include fpcmake.loc
  1846. endif