Makefile 32 KB

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