Makefile 32 KB

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