Makefile 29 KB

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