Makefile 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434
  1. #
  2. # Don't edit, this file is generated by FPCMake Version 1.1 [2002/11/24]
  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_PROGRAMS+=fpcmake
  216. override TARGET_RSTS+=fpcmmain
  217. override CLEAN_UNITS+=fpcmmain fpcmdic fpcmwr fpcmpkg
  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 fcl
  784. ifeq ($(OS_TARGET),linux)
  785. REQUIRE_PACKAGES_RTL=1
  786. REQUIRE_PACKAGES_PASZLIB=1
  787. REQUIRE_PACKAGES_INET=1
  788. REQUIRE_PACKAGES_FCL=1
  789. REQUIRE_PACKAGES_MYSQL=1
  790. REQUIRE_PACKAGES_IBASE=1
  791. endif
  792. ifeq ($(OS_TARGET),go32v2)
  793. REQUIRE_PACKAGES_RTL=1
  794. REQUIRE_PACKAGES_PASZLIB=1
  795. REQUIRE_PACKAGES_FCL=1
  796. endif
  797. ifeq ($(OS_TARGET),win32)
  798. REQUIRE_PACKAGES_RTL=1
  799. REQUIRE_PACKAGES_PASZLIB=1
  800. REQUIRE_PACKAGES_FCL=1
  801. REQUIRE_PACKAGES_MYSQL=1
  802. REQUIRE_PACKAGES_IBASE=1
  803. endif
  804. ifeq ($(OS_TARGET),os2)
  805. REQUIRE_PACKAGES_RTL=1
  806. REQUIRE_PACKAGES_PASZLIB=1
  807. REQUIRE_PACKAGES_FCL=1
  808. endif
  809. ifeq ($(OS_TARGET),freebsd)
  810. REQUIRE_PACKAGES_RTL=1
  811. REQUIRE_PACKAGES_PASZLIB=1
  812. REQUIRE_PACKAGES_INET=1
  813. REQUIRE_PACKAGES_FCL=1
  814. REQUIRE_PACKAGES_MYSQL=1
  815. REQUIRE_PACKAGES_IBASE=1
  816. endif
  817. ifeq ($(OS_TARGET),beos)
  818. REQUIRE_PACKAGES_RTL=1
  819. REQUIRE_PACKAGES_PASZLIB=1
  820. REQUIRE_PACKAGES_FCL=1
  821. endif
  822. ifeq ($(OS_TARGET),netbsd)
  823. REQUIRE_PACKAGES_RTL=1
  824. REQUIRE_PACKAGES_PASZLIB=1
  825. REQUIRE_PACKAGES_INET=1
  826. REQUIRE_PACKAGES_FCL=1
  827. REQUIRE_PACKAGES_MYSQL=1
  828. REQUIRE_PACKAGES_IBASE=1
  829. endif
  830. ifeq ($(OS_TARGET),amiga)
  831. REQUIRE_PACKAGES_RTL=1
  832. REQUIRE_PACKAGES_PASZLIB=1
  833. REQUIRE_PACKAGES_FCL=1
  834. endif
  835. ifeq ($(OS_TARGET),atari)
  836. REQUIRE_PACKAGES_RTL=1
  837. REQUIRE_PACKAGES_PASZLIB=1
  838. REQUIRE_PACKAGES_FCL=1
  839. endif
  840. ifeq ($(OS_TARGET),sunos)
  841. REQUIRE_PACKAGES_RTL=1
  842. REQUIRE_PACKAGES_PASZLIB=1
  843. REQUIRE_PACKAGES_FCL=1
  844. endif
  845. ifeq ($(OS_TARGET),qnx)
  846. REQUIRE_PACKAGES_RTL=1
  847. REQUIRE_PACKAGES_PASZLIB=1
  848. REQUIRE_PACKAGES_FCL=1
  849. endif
  850. ifeq ($(OS_TARGET),netware)
  851. REQUIRE_PACKAGES_RTL=1
  852. REQUIRE_PACKAGES_PASZLIB=1
  853. REQUIRE_PACKAGES_FCL=1
  854. endif
  855. ifeq ($(OS_TARGET),openbsd)
  856. REQUIRE_PACKAGES_RTL=1
  857. REQUIRE_PACKAGES_PASZLIB=1
  858. REQUIRE_PACKAGES_INET=1
  859. REQUIRE_PACKAGES_FCL=1
  860. REQUIRE_PACKAGES_MYSQL=1
  861. REQUIRE_PACKAGES_IBASE=1
  862. endif
  863. ifeq ($(OS_TARGET),wdosx)
  864. REQUIRE_PACKAGES_RTL=1
  865. REQUIRE_PACKAGES_PASZLIB=1
  866. REQUIRE_PACKAGES_FCL=1
  867. endif
  868. ifdef REQUIRE_PACKAGES_RTL
  869. PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/$(OS_TARGET)/Makefile.fpc,$(PACKAGESDIR))))))
  870. ifneq ($(PACKAGEDIR_RTL),)
  871. ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),)
  872. UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET)
  873. else
  874. UNITDIR_RTL=$(PACKAGEDIR_RTL)
  875. endif
  876. ifdef CHECKDEPEND
  877. $(PACKAGEDIR_RTL)/$(FPCMADE):
  878. $(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE)
  879. override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE)
  880. endif
  881. else
  882. PACKAGEDIR_RTL=
  883. UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR)))))
  884. ifneq ($(UNITDIR_RTL),)
  885. UNITDIR_RTL:=$(firstword $(UNITDIR_RTL))
  886. else
  887. UNITDIR_RTL=
  888. endif
  889. endif
  890. ifdef UNITDIR_RTL
  891. override COMPILER_UNITDIR+=$(UNITDIR_RTL)
  892. endif
  893. endif
  894. ifdef REQUIRE_PACKAGES_PASZLIB
  895. PACKAGEDIR_PASZLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))))
  896. ifneq ($(PACKAGEDIR_PASZLIB),)
  897. ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(OS_TARGET)),)
  898. UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/$(OS_TARGET)
  899. else
  900. UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)
  901. endif
  902. ifdef CHECKDEPEND
  903. $(PACKAGEDIR_PASZLIB)/$(FPCMADE):
  904. $(MAKE) -C $(PACKAGEDIR_PASZLIB) $(FPCMADE)
  905. override ALLDEPENDENCIES+=$(PACKAGEDIR_PASZLIB)/$(FPCMADE)
  906. endif
  907. else
  908. PACKAGEDIR_PASZLIB=
  909. UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR)))))
  910. ifneq ($(UNITDIR_PASZLIB),)
  911. UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB))
  912. else
  913. UNITDIR_PASZLIB=
  914. endif
  915. endif
  916. ifdef UNITDIR_PASZLIB
  917. override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB)
  918. endif
  919. endif
  920. ifdef REQUIRE_PACKAGES_INET
  921. PACKAGEDIR_INET:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /inet/Makefile.fpc,$(PACKAGESDIR))))))
  922. ifneq ($(PACKAGEDIR_INET),)
  923. ifneq ($(wildcard $(PACKAGEDIR_INET)/$(OS_TARGET)),)
  924. UNITDIR_INET=$(PACKAGEDIR_INET)/$(OS_TARGET)
  925. else
  926. UNITDIR_INET=$(PACKAGEDIR_INET)
  927. endif
  928. ifdef CHECKDEPEND
  929. $(PACKAGEDIR_INET)/$(FPCMADE):
  930. $(MAKE) -C $(PACKAGEDIR_INET) $(FPCMADE)
  931. override ALLDEPENDENCIES+=$(PACKAGEDIR_INET)/$(FPCMADE)
  932. endif
  933. else
  934. PACKAGEDIR_INET=
  935. UNITDIR_INET:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /inet/Package.fpc,$(UNITSDIR)))))
  936. ifneq ($(UNITDIR_INET),)
  937. UNITDIR_INET:=$(firstword $(UNITDIR_INET))
  938. else
  939. UNITDIR_INET=
  940. endif
  941. endif
  942. ifdef UNITDIR_INET
  943. override COMPILER_UNITDIR+=$(UNITDIR_INET)
  944. endif
  945. endif
  946. ifdef REQUIRE_PACKAGES_FCL
  947. PACKAGEDIR_FCL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))))
  948. ifneq ($(PACKAGEDIR_FCL),)
  949. ifneq ($(wildcard $(PACKAGEDIR_FCL)/$(OS_TARGET)),)
  950. UNITDIR_FCL=$(PACKAGEDIR_FCL)/$(OS_TARGET)
  951. else
  952. UNITDIR_FCL=$(PACKAGEDIR_FCL)
  953. endif
  954. ifdef CHECKDEPEND
  955. $(PACKAGEDIR_FCL)/$(FPCMADE):
  956. $(MAKE) -C $(PACKAGEDIR_FCL) $(FPCMADE)
  957. override ALLDEPENDENCIES+=$(PACKAGEDIR_FCL)/$(FPCMADE)
  958. endif
  959. else
  960. PACKAGEDIR_FCL=
  961. UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR)))))
  962. ifneq ($(UNITDIR_FCL),)
  963. UNITDIR_FCL:=$(firstword $(UNITDIR_FCL))
  964. else
  965. UNITDIR_FCL=
  966. endif
  967. endif
  968. ifdef UNITDIR_FCL
  969. override COMPILER_UNITDIR+=$(UNITDIR_FCL)
  970. endif
  971. endif
  972. ifdef REQUIRE_PACKAGES_MYSQL
  973. PACKAGEDIR_MYSQL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR))))))
  974. ifneq ($(PACKAGEDIR_MYSQL),)
  975. ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/$(OS_TARGET)),)
  976. UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/$(OS_TARGET)
  977. else
  978. UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)
  979. endif
  980. ifdef CHECKDEPEND
  981. $(PACKAGEDIR_MYSQL)/$(FPCMADE):
  982. $(MAKE) -C $(PACKAGEDIR_MYSQL) $(FPCMADE)
  983. override ALLDEPENDENCIES+=$(PACKAGEDIR_MYSQL)/$(FPCMADE)
  984. endif
  985. else
  986. PACKAGEDIR_MYSQL=
  987. UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR)))))
  988. ifneq ($(UNITDIR_MYSQL),)
  989. UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL))
  990. else
  991. UNITDIR_MYSQL=
  992. endif
  993. endif
  994. ifdef UNITDIR_MYSQL
  995. override COMPILER_UNITDIR+=$(UNITDIR_MYSQL)
  996. endif
  997. endif
  998. ifdef REQUIRE_PACKAGES_IBASE
  999. PACKAGEDIR_IBASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR))))))
  1000. ifneq ($(PACKAGEDIR_IBASE),)
  1001. ifneq ($(wildcard $(PACKAGEDIR_IBASE)/$(OS_TARGET)),)
  1002. UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/$(OS_TARGET)
  1003. else
  1004. UNITDIR_IBASE=$(PACKAGEDIR_IBASE)
  1005. endif
  1006. ifdef CHECKDEPEND
  1007. $(PACKAGEDIR_IBASE)/$(FPCMADE):
  1008. $(MAKE) -C $(PACKAGEDIR_IBASE) $(FPCMADE)
  1009. override ALLDEPENDENCIES+=$(PACKAGEDIR_IBASE)/$(FPCMADE)
  1010. endif
  1011. else
  1012. PACKAGEDIR_IBASE=
  1013. UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR)))))
  1014. ifneq ($(UNITDIR_IBASE),)
  1015. UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE))
  1016. else
  1017. UNITDIR_IBASE=
  1018. endif
  1019. endif
  1020. ifdef UNITDIR_IBASE
  1021. override COMPILER_UNITDIR+=$(UNITDIR_IBASE)
  1022. endif
  1023. endif
  1024. ifndef NOCPUDEF
  1025. override FPCOPTDEF=$(CPU_TARGET)
  1026. endif
  1027. ifneq ($(OS_TARGET),$(OS_SOURCE))
  1028. override FPCOPT+=-T$(OS_TARGET)
  1029. endif
  1030. ifeq ($(OS_SOURCE),openbsd)
  1031. override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
  1032. endif
  1033. ifdef UNITDIR
  1034. override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
  1035. endif
  1036. ifdef LIBDIR
  1037. override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
  1038. endif
  1039. ifdef OBJDIR
  1040. override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
  1041. endif
  1042. ifdef INCDIR
  1043. override FPCOPT+=$(addprefix -Fi,$(INCDIR))
  1044. endif
  1045. ifdef LINKSMART
  1046. override FPCOPT+=-XX
  1047. endif
  1048. ifdef CREATESMART
  1049. override FPCOPT+=-CX
  1050. endif
  1051. ifdef DEBUG
  1052. override FPCOPT+=-gl
  1053. override FPCOPTDEF+=DEBUG
  1054. endif
  1055. ifdef RELEASE
  1056. ifeq ($(CPU_TARGET),i386)
  1057. FPCCPUOPT:=-OG2p3
  1058. else
  1059. FPCCPUOPT:=
  1060. endif
  1061. override FPCOPT+=-Xs $(FPCCPUOPT) -n
  1062. override FPCOPTDEF+=RELEASE
  1063. endif
  1064. ifdef STRIP
  1065. override FPCOPT+=-Xs
  1066. endif
  1067. ifdef OPTIMIZE
  1068. ifeq ($(CPU_TARGET),i386)
  1069. override FPCOPT+=-OG2p3
  1070. endif
  1071. endif
  1072. ifdef VERBOSE
  1073. override FPCOPT+=-vwni
  1074. endif
  1075. ifdef COMPILER_OPTIONS
  1076. override FPCOPT+=$(COMPILER_OPTIONS)
  1077. endif
  1078. ifdef COMPILER_UNITDIR
  1079. override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
  1080. endif
  1081. ifdef COMPILER_LIBRARYDIR
  1082. override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
  1083. endif
  1084. ifdef COMPILER_OBJECTDIR
  1085. override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
  1086. endif
  1087. ifdef COMPILER_INCLUDEDIR
  1088. override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
  1089. endif
  1090. ifdef CROSSBINDIR
  1091. override FPCOPT+=-FD$(CROSSBINDIR)
  1092. endif
  1093. ifdef COMPILER_TARGETDIR
  1094. override FPCOPT+=-FE$(COMPILER_TARGETDIR)
  1095. ifeq ($(COMPILER_TARGETDIR),.)
  1096. override TARGETDIRPREFIX=
  1097. else
  1098. override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
  1099. endif
  1100. endif
  1101. ifdef COMPILER_UNITTARGETDIR
  1102. override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
  1103. ifeq ($(COMPILER_UNITTARGETDIR),.)
  1104. override UNITTARGETDIRPREFIX=
  1105. else
  1106. override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
  1107. endif
  1108. else
  1109. ifdef COMPILER_TARGETDIR
  1110. override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
  1111. override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
  1112. endif
  1113. endif
  1114. ifdef GCCLIBDIR
  1115. override FPCOPT+=-Fl$(GCCLIBDIR)
  1116. endif
  1117. ifdef OTHERLIBDIR
  1118. override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
  1119. endif
  1120. ifdef OPT
  1121. override FPCOPT+=$(OPT)
  1122. endif
  1123. ifdef FPCOPTDEF
  1124. override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
  1125. endif
  1126. ifdef CFGFILE
  1127. override FPCOPT+=@$(CFGFILE)
  1128. endif
  1129. ifdef USEENV
  1130. override FPCEXTCMD:=$(FPCOPT)
  1131. override FPCOPT:=!FPCEXTCMD
  1132. export FPCEXTCMD
  1133. endif
  1134. override COMPILER:=$(FPC) $(FPCOPT)
  1135. ifeq (,$(findstring -s ,$(COMPILER)))
  1136. EXECPPAS=
  1137. else
  1138. ifeq ($(OS_SOURCE),$(OS_TARGET))
  1139. EXECPPAS:=@$(PPAS)
  1140. endif
  1141. endif
  1142. .PHONY: fpc_exes
  1143. ifdef TARGET_PROGRAMS
  1144. override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS))
  1145. override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS)))
  1146. override ALLTARGET+=fpc_exes
  1147. override INSTALLEXEFILES+=$(EXEFILES)
  1148. override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES)
  1149. ifeq ($(OS_TARGET),os2)
  1150. override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS))
  1151. endif
  1152. endif
  1153. fpc_exes: $(EXEFILES)
  1154. ifdef TARGET_RSTS
  1155. override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
  1156. override CLEANRSTFILES+=$(RSTFILES)
  1157. endif
  1158. .PHONY: fpc_all fpc_smart fpc_debug fpc_release
  1159. $(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
  1160. @$(ECHOREDIR) Compiled > $(FPCMADE)
  1161. fpc_all: $(FPCMADE)
  1162. fpc_smart:
  1163. $(MAKE) all LINKSMART=1 CREATESMART=1
  1164. fpc_debug:
  1165. $(MAKE) all DEBUG=1
  1166. fpc_release:
  1167. $(MAKE) all RELEASE=1
  1168. .SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp .rc .res
  1169. %$(PPUEXT): %.pp
  1170. $(COMPILER) $<
  1171. $(EXECPPAS)
  1172. %$(PPUEXT): %.pas
  1173. $(COMPILER) $<
  1174. $(EXECPPAS)
  1175. %$(EXEEXT): %.pp
  1176. $(COMPILER) $<
  1177. $(EXECPPAS)
  1178. %$(EXEEXT): %.pas
  1179. $(COMPILER) $<
  1180. $(EXECPPAS)
  1181. %.res: %.rc
  1182. windres -i $< -o $@
  1183. vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
  1184. vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
  1185. vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
  1186. .PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
  1187. ifdef INSTALL_UNITS
  1188. override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
  1189. endif
  1190. ifdef INSTALL_BUILDUNIT
  1191. override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
  1192. endif
  1193. ifdef INSTALLPPUFILES
  1194. override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
  1195. override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
  1196. override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)))
  1197. override INSTALL_CREATEPACKAGEFPC=1
  1198. endif
  1199. ifdef INSTALLEXEFILES
  1200. override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
  1201. endif
  1202. fpc_install: all $(INSTALLTARGET)
  1203. ifdef INSTALLEXEFILES
  1204. $(MKDIR) $(INSTALL_BINDIR)
  1205. ifdef UPXPROG
  1206. -$(UPXPROG) $(INSTALLEXEFILES)
  1207. endif
  1208. $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
  1209. endif
  1210. ifdef INSTALL_CREATEPACKAGEFPC
  1211. ifdef FPCMAKE
  1212. ifdef PACKAGE_VERSION
  1213. ifneq ($(wildcard Makefile.fpc),)
  1214. $(FPCMAKE) -p -T$(OS_TARGET) Makefile.fpc
  1215. $(MKDIR) $(INSTALL_UNITDIR)
  1216. $(INSTALL) Package.fpc $(INSTALL_UNITDIR)
  1217. endif
  1218. endif
  1219. endif
  1220. endif
  1221. ifdef INSTALLPPUFILES
  1222. $(MKDIR) $(INSTALL_UNITDIR)
  1223. $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
  1224. ifneq ($(INSTALLPPULINKFILES),)
  1225. $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
  1226. endif
  1227. ifneq ($(wildcard $(LIB_FULLNAME)),)
  1228. $(MKDIR) $(INSTALL_LIBDIR)
  1229. $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
  1230. ifdef inUnix
  1231. ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
  1232. endif
  1233. endif
  1234. endif
  1235. ifdef INSTALL_FILES
  1236. $(MKDIR) $(INSTALL_DATADIR)
  1237. $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
  1238. endif
  1239. fpc_sourceinstall: distclean
  1240. $(MKDIR) $(INSTALL_SOURCEDIR)
  1241. $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
  1242. fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
  1243. ifdef HASEXAMPLES
  1244. $(MKDIR) $(INSTALL_EXAMPLEDIR)
  1245. endif
  1246. ifdef EXAMPLESOURCEFILES
  1247. $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
  1248. endif
  1249. ifdef TARGET_EXAMPLEDIRS
  1250. $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
  1251. endif
  1252. .PHONY: fpc_clean fpc_cleanall fpc_distclean
  1253. ifdef EXEFILES
  1254. override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
  1255. endif
  1256. ifdef CLEAN_UNITS
  1257. override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
  1258. endif
  1259. ifdef CLEANPPUFILES
  1260. override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
  1261. override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
  1262. override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
  1263. endif
  1264. fpc_clean: $(CLEANTARGET)
  1265. ifdef CLEANEXEFILES
  1266. -$(DEL) $(CLEANEXEFILES)
  1267. endif
  1268. ifdef CLEANPPUFILES
  1269. -$(DEL) $(CLEANPPUFILES)
  1270. endif
  1271. ifneq ($(CLEANPPULINKFILES),)
  1272. -$(DEL) $(CLEANPPULINKFILES)
  1273. endif
  1274. ifdef CLEANRSTFILES
  1275. -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
  1276. endif
  1277. ifdef CLEAN_FILES
  1278. -$(DEL) $(CLEAN_FILES)
  1279. endif
  1280. ifdef LIB_NAME
  1281. -$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
  1282. endif
  1283. -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
  1284. fpc_distclean: clean
  1285. ifdef COMPILER_UNITTARGETDIR
  1286. TARGETDIRCLEAN=fpc_clean
  1287. endif
  1288. fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)
  1289. ifdef CLEANEXEFILES
  1290. -$(DEL) $(CLEANEXEFILES)
  1291. endif
  1292. -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  1293. -$(DELTREE) *$(SMARTEXT)
  1294. -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
  1295. ifdef AOUTEXT
  1296. -$(DEL) *$(AOUTEXT)
  1297. endif
  1298. .PHONY: fpc_baseinfo
  1299. override INFORULES+=fpc_baseinfo
  1300. fpc_baseinfo:
  1301. @$(ECHO)
  1302. @$(ECHO) == Package info ==
  1303. @$(ECHO) Package Name..... $(PACKAGE_NAME)
  1304. @$(ECHO) Package Version.. $(PACKAGE_VERSION)
  1305. @$(ECHO)
  1306. @$(ECHO) == Configuration info ==
  1307. @$(ECHO)
  1308. @$(ECHO) FPC.......... $(FPC)
  1309. @$(ECHO) FPC Version.. $(FPC_VERSION)
  1310. @$(ECHO) Source CPU... $(CPU_SOURCE)
  1311. @$(ECHO) Target CPU... $(CPU_TARGET)
  1312. @$(ECHO) Source OS.... $(OS_SOURCE)
  1313. @$(ECHO) Target OS.... $(OS_TARGET)
  1314. @$(ECHO) Full Source.. $(FULL_SOURCE)
  1315. @$(ECHO) Full Target.. $(FULL_TARGET)
  1316. @$(ECHO)
  1317. @$(ECHO) == Directory info ==
  1318. @$(ECHO)
  1319. @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES)
  1320. @$(ECHO)
  1321. @$(ECHO) Basedir......... $(BASEDIR)
  1322. @$(ECHO) FPCDir.......... $(FPCDIR)
  1323. @$(ECHO) CrossBinDir..... $(CROSSBINDIR)
  1324. @$(ECHO) UnitsDir........ $(UNITSDIR)
  1325. @$(ECHO) PackagesDir..... $(PACKAGESDIR)
  1326. @$(ECHO)
  1327. @$(ECHO) GCC library..... $(GCCLIBDIR)
  1328. @$(ECHO) Other library... $(OTHERLIBDIR)
  1329. @$(ECHO)
  1330. @$(ECHO) == Tools info ==
  1331. @$(ECHO)
  1332. @$(ECHO) As........ $(AS)
  1333. @$(ECHO) Ld........ $(LD)
  1334. @$(ECHO) Ar........ $(AR)
  1335. @$(ECHO) Rc........ $(RC)
  1336. @$(ECHO)
  1337. @$(ECHO) Mv........ $(MVPROG)
  1338. @$(ECHO) Cp........ $(CPPROG)
  1339. @$(ECHO) Rm........ $(RMPROG)
  1340. @$(ECHO) GInstall.. $(GINSTALL)
  1341. @$(ECHO) Echo...... $(ECHO)
  1342. @$(ECHO) Shell..... $(SHELL)
  1343. @$(ECHO) Date...... $(DATE)
  1344. @$(ECHO) FPCMake... $(FPCMAKE)
  1345. @$(ECHO) PPUMove... $(PPUMOVE)
  1346. @$(ECHO) Upx....... $(UPXPROG)
  1347. @$(ECHO) Zip....... $(ZIPPROG)
  1348. @$(ECHO)
  1349. @$(ECHO) == Object info ==
  1350. @$(ECHO)
  1351. @$(ECHO) Target Loaders........ $(TARGET_LOADERS)
  1352. @$(ECHO) Target Units.......... $(TARGET_UNITS)
  1353. @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS)
  1354. @$(ECHO) Target Programs....... $(TARGET_PROGRAMS)
  1355. @$(ECHO) Target Dirs........... $(TARGET_DIRS)
  1356. @$(ECHO) Target Examples....... $(TARGET_EXAMPLES)
  1357. @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)
  1358. @$(ECHO)
  1359. @$(ECHO) Clean Units......... $(CLEAN_UNITS)
  1360. @$(ECHO) Clean Files......... $(CLEAN_FILES)
  1361. @$(ECHO)
  1362. @$(ECHO) Install Units....... $(INSTALL_UNITS)
  1363. @$(ECHO) Install Files....... $(INSTALL_FILES)
  1364. @$(ECHO)
  1365. @$(ECHO) == Install info ==
  1366. @$(ECHO)
  1367. @$(ECHO) DateStr.............. $(DATESTR)
  1368. @$(ECHO) ZipPrefix............ $(ZIPPREFIX)
  1369. @$(ECHO) ZipSuffix............ $(ZIPSUFFIX)
  1370. @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE)
  1371. @$(ECHO)
  1372. @$(ECHO) Install base dir..... $(INSTALL_BASEDIR)
  1373. @$(ECHO) Install binary dir... $(INSTALL_BINDIR)
  1374. @$(ECHO) Install library dir.. $(INSTALL_LIBDIR)
  1375. @$(ECHO) Install units dir.... $(INSTALL_UNITDIR)
  1376. @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR)
  1377. @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR)
  1378. @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR)
  1379. @$(ECHO) Install data dir..... $(INSTALL_DATADIR)
  1380. @$(ECHO)
  1381. @$(ECHO) Dist destination dir. $(DIST_DESTDIR)
  1382. @$(ECHO) Dist zip name........ $(DIST_ZIPNAME)
  1383. @$(ECHO)
  1384. .PHONY: fpc_info
  1385. fpc_info: $(INFORULES)
  1386. .PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \
  1387. fpc_makefile_dirs
  1388. fpc_makefile:
  1389. $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc
  1390. fpc_makefile_sub1:
  1391. ifdef TARGET_DIRS
  1392. $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS))
  1393. endif
  1394. ifdef TARGET_EXAMPLEDIRS
  1395. $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS))
  1396. endif
  1397. fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
  1398. fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
  1399. fpc_makefiles: fpc_makefile fpc_makefile_dirs
  1400. ifndef DATA2INC
  1401. DATA2INC:=$(strip $(wildcard $(addsuffix /data2inc$(SRCEXEEXT),$(SEARCHPATH))))
  1402. ifeq ($(DATA2INC),)
  1403. DATA2INC=
  1404. else
  1405. DATA2INC:=$(firstword $(DATA2INC))
  1406. endif
  1407. endif
  1408. export DATA2INC
  1409. all: fpc_all
  1410. debug: fpc_debug
  1411. smart: fpc_smart
  1412. release: fpc_release
  1413. examples:
  1414. shared:
  1415. install: fpc_install
  1416. sourceinstall: fpc_sourceinstall
  1417. exampleinstall: fpc_exampleinstall
  1418. distinstall:
  1419. zipinstall:
  1420. zipsourceinstall:
  1421. zipexampleinstall:
  1422. zipdistinstall:
  1423. clean: fpc_clean
  1424. distclean: fpc_distclean
  1425. cleanall: fpc_cleanall
  1426. info: fpc_info
  1427. makefiles: fpc_makefiles
  1428. .PHONY: all debug smart release examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
  1429. ifneq ($(wildcard fpcmake.loc),)
  1430. include fpcmake.loc
  1431. endif
  1432. fpcmake.inc: fpcmake.ini
  1433. $(DATA2INC) -b -s fpcmake.ini fpcmake.inc fpcmakeini
  1434. fpcmake$(EXEEXT): $(wildcard fpcm*.pp) fpcmake.inc