Makefile 33 KB

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