Makefile 41 KB

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