Makefile 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854
  1. #
  2. # Don't edit, this file is generated by fpcmake v1.99.0 [2001/04/11]
  3. #
  4. default: all
  5. override PATH:=$(subst \,/,$(PATH))
  6. ifeq ($(findstring ;,$(PATH)),)
  7. inUnix=1
  8. SEARCHPATH=$(subst :, ,$(PATH))
  9. else
  10. SEARCHPATH=$(subst ;, ,$(PATH))
  11. endif
  12. PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
  13. ifeq ($(PWD),)
  14. PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
  15. ifeq ($(PWD),)
  16. nopwd:
  17. @echo You need the GNU utils package to use this Makefile!
  18. @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
  19. @exit
  20. else
  21. PWD:=$(firstword $(PWD))
  22. SRCEXEEXT=
  23. endif
  24. else
  25. PWD:=$(firstword $(PWD))
  26. SRCEXEEXT=.exe
  27. endif
  28. ifndef inUnix
  29. ifeq ($(OS),Windows_NT)
  30. inWinNT=1
  31. else
  32. ifdef OS2_SHELL
  33. inOS2=1
  34. endif
  35. endif
  36. else
  37. ifneq ($(findstring cygwin,$(MACH_TYPE)),)
  38. inCygWin=1
  39. endif
  40. endif
  41. ifdef inUnix
  42. BATCHEXT=.sh
  43. else
  44. ifdef inOS2
  45. BATCHEXT=.cmd
  46. else
  47. BATCHEXT=.bat
  48. endif
  49. endif
  50. ifdef inUnix
  51. PATHSEP=/
  52. else
  53. PATHSEP=$(subst /,\,/)
  54. endif
  55. ifdef PWD
  56. BASEDIR:=$(shell $(PWD))
  57. else
  58. BASEDIR=.
  59. endif
  60. ifndef FPC
  61. ifdef PP
  62. FPC=$(PP)
  63. else
  64. FPC=ppc386
  65. endif
  66. endif
  67. override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
  68. override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
  69. ifndef OS_TARGET
  70. OS_TARGET:=$(shell $(FPC) -iTO)
  71. endif
  72. ifndef OS_SOURCE
  73. OS_SOURCE:=$(shell $(FPC) -iSO)
  74. endif
  75. ifndef CPU_TARGET
  76. CPU_TARGET:=$(shell $(FPC) -iTP)
  77. endif
  78. ifndef CPU_SOURCE
  79. CPU_SOURCE:=$(shell $(FPC) -iSP)
  80. endif
  81. ifndef FPC_VERSION
  82. FPC_VERSION:=$(shell $(FPC) -iV)
  83. endif
  84. export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
  85. ifdef FPCDIR
  86. override FPCDIR:=$(subst \,/,$(FPCDIR))
  87. ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
  88. override FPCDIR=wrong
  89. endif
  90. else
  91. override FPCDIR=wrong
  92. endif
  93. ifeq ($(FPCDIR),wrong)
  94. override FPCDIR=../../../..
  95. ifeq ($(wildcard $(FPCDIR)/rtl),)
  96. ifeq ($(wildcard $(FPCDIR)/units),)
  97. override FPCDIR=wrong
  98. endif
  99. endif
  100. endif
  101. ifeq ($(FPCDIR),wrong)
  102. ifdef inUnix
  103. override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
  104. ifeq ($(wildcard $(FPCDIR)/units),)
  105. override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
  106. endif
  107. else
  108. override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
  109. override FPCDIR:=$(FPCDIR)/..
  110. ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
  111. override FPCDIR:=$(FPCDIR)/..
  112. ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
  113. override FPCDIR=c:/pp
  114. endif
  115. endif
  116. endif
  117. endif
  118. UNITSDIR=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
  119. PACKAGESDIR=$(wildcard $(FPCDIR) $(FPCDIR)/packages)
  120. ifndef ECHO
  121. ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
  122. ifeq ($(ECHO),)
  123. ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
  124. ifeq ($(ECHO),)
  125. ECHO:=echo
  126. else
  127. ECHO:=$(firstword $(ECHO))
  128. endif
  129. else
  130. ECHO:=$(firstword $(ECHO))
  131. endif
  132. endif
  133. ifndef COPY
  134. COPY:=cp -fp
  135. endif
  136. ifndef COPYTREE
  137. COPYTREE:=cp -rfp
  138. endif
  139. ifndef MOVE
  140. MOVE:=mv -f
  141. endif
  142. ifndef DEL
  143. DEL:=rm -f
  144. endif
  145. ifndef DELTREE
  146. DELTREE:=rm -rf
  147. endif
  148. ifndef INSTALL
  149. ifdef inUnix
  150. INSTALL:=install -c -m 644
  151. else
  152. INSTALL:=$(COPY)
  153. endif
  154. endif
  155. ifndef INSTALLEXE
  156. ifdef inUnix
  157. INSTALLEXE:=install -c -m 755
  158. else
  159. INSTALLEXE:=$(COPY)
  160. endif
  161. endif
  162. ifndef MKDIR
  163. ifdef inUnix
  164. MKDIR:=install -m 755 -d
  165. else
  166. MKDIR:=ginstall -m 755 -d
  167. endif
  168. endif
  169. export ECHO COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
  170. ifndef AS
  171. AS=as
  172. endif
  173. ifndef LD
  174. LD=ld
  175. endif
  176. ifndef RC
  177. RC=rc
  178. endif
  179. PPAS=ppas$(BATCHEXT)
  180. ifdef inUnix
  181. LDCONFIG=ldconfig
  182. else
  183. LDCONFIG=
  184. endif
  185. ifndef PPUMOVE
  186. PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
  187. ifeq ($(PPUMOVE),)
  188. PPUMOVE=
  189. else
  190. PPUMOVE:=$(firstword $(PPUMOVE))
  191. endif
  192. endif
  193. export PPUMOVE
  194. ifndef PPUFILES
  195. PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH))))
  196. ifeq ($(PPUFILES),)
  197. PPUFILES=
  198. else
  199. PPUFILES:=$(firstword $(PPUFILES))
  200. endif
  201. endif
  202. export PPUFILES
  203. ifndef DATE
  204. DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
  205. ifeq ($(DATE),)
  206. DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEACHPATH))))
  207. ifeq ($(DATE),)
  208. DATE=
  209. else
  210. DATE:=$(firstword $(DATE))
  211. endif
  212. else
  213. DATE:=$(firstword $(DATE))
  214. endif
  215. endif
  216. export DATE
  217. ifdef DATE
  218. DATESTR:=$(shell $(DATE) +%Y%m%d)
  219. else
  220. DATESTR=
  221. endif
  222. ifndef UPXPROG
  223. ifeq ($(OS_TARGET),go32v2)
  224. UPXPROG:=1
  225. endif
  226. ifeq ($(OS_TARGET),win32)
  227. UPXPROG:=1
  228. endif
  229. ifdef UPXPROG
  230. UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
  231. ifeq ($(UPXPROG),)
  232. UPXPROG=
  233. else
  234. UPXPROG:=$(firstword $(UPXPROG))
  235. endif
  236. else
  237. UPXPROG=
  238. endif
  239. endif
  240. export UPXPROG
  241. ifndef ZIPPROG
  242. ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
  243. ifeq ($(ZIPPROG),)
  244. ZIPPROG=
  245. else
  246. ZIPPROG:=$(firstword $(ZIPPROG))
  247. endif
  248. endif
  249. export ZIPPROG
  250. ZIPOPT=-9
  251. ZIPEXT=.zip
  252. ifndef TARPROG
  253. TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
  254. ifeq ($(TARPROG),)
  255. TARPROG=
  256. else
  257. TARPROG:=$(firstword $(TARPROG))
  258. endif
  259. endif
  260. export TARPROG
  261. ifeq ($(USETAR),bz2)
  262. TAROPT=vI
  263. TAREXT=.tar.bz2
  264. else
  265. TAROPT=vz
  266. TAREXT=.tar.gz
  267. endif
  268. LOADEREXT=.as
  269. EXEEXT=.exe
  270. PPLEXT=.ppl
  271. PPUEXT=.ppu
  272. OEXT=.o
  273. ASMEXT=.s
  274. SMARTEXT=.sl
  275. STATICLIBEXT=.a
  276. SHAREDLIBEXT=.so
  277. LIBPREFIX=lib
  278. RSTEXT=.rst
  279. FPCMADE=fpcmade
  280. ifeq ($(OS_TARGET),go32v1)
  281. PPUEXT=.pp1
  282. OEXT=.o1
  283. ASMEXT=.s1
  284. SMARTEXT=.sl1
  285. STATICLIBEXT=.a1
  286. SHAREDLIBEXT=.so1
  287. LIBPREFIX=
  288. FPCMADE=fpcmade.v1
  289. PACKAGESUFFIX=v1
  290. endif
  291. ifeq ($(OS_TARGET),go32v2)
  292. LIBPREFIX=
  293. FPCMADE=fpcmade.dos
  294. ZIPSUFFIX=go32
  295. endif
  296. ifeq ($(OS_TARGET),linux)
  297. EXEEXT=
  298. HASSHAREDLIB=1
  299. FPCMADE=fpcmade.lnx
  300. ZIPSUFFIX=linux
  301. endif
  302. ifeq ($(OS_TARGET),freebsd)
  303. EXEEXT=
  304. HASSHAREDLIB=1
  305. FPCMADE=fpcmade.freebsd
  306. ZIPSUFFIX=freebsd
  307. endif
  308. ifeq ($(OS_TARGET),win32)
  309. PPUEXT=.ppw
  310. OEXT=.ow
  311. ASMEXT=.sw
  312. SMARTEXT=.slw
  313. STATICLIBEXT=.aw
  314. SHAREDLIBEXT=.dll
  315. FPCMADE=fpcmade.w32
  316. ZIPSUFFIX=w32
  317. endif
  318. ifeq ($(OS_TARGET),os2)
  319. PPUEXT=.ppo
  320. ASMEXT=.so2
  321. OEXT=.oo2
  322. AOUTEXT=.out
  323. SMARTEXT=.so
  324. STATICLIBEXT=.ao2
  325. SHAREDLIBEXT=.dll
  326. FPCMADE=fpcmade.os2
  327. ZIPSUFFIX=emx
  328. endif
  329. ifdef REQUIRE_UNITSDIR
  330. override UNITSDIR+=$(REQUIRE_UNITSDIR)
  331. endif
  332. ifdef REQUIRE_PACKAGESDIR
  333. override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
  334. endif
  335. ifdef ZIPINSTALL
  336. ifeq ($(OS_TARGET),linux)
  337. UNIXINSTALLDIR=1
  338. endif
  339. ifeq ($(OS_TARGET),freebsd)
  340. UNIXINSTALLDIR=1
  341. endif
  342. else
  343. ifeq ($(OS_SOURCE),linux)
  344. UNIXINSTALLDIR=1
  345. endif
  346. ifeq ($(OS_SOURCE),freebsd)
  347. UNIXINSTALLDIR=1
  348. endif
  349. endif
  350. ifndef INSTALL_PREFIX
  351. ifdef UNIXINSTALLDIR
  352. INSTALL_PREFIX=/usr/local
  353. else
  354. INSTALL_PREFIX=/pp
  355. endif
  356. endif
  357. export INSTALL_PREFIX
  358. ifndef DIST_DESTDIR
  359. DIST_DESTDIR:=$(BASEDIR)
  360. endif
  361. export DIST_DESTDIR
  362. ifndef INSTALL_BASEDIR
  363. ifdef UNIXINSTALLDIR
  364. INSTALL_BASEDIR=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
  365. else
  366. INSTALL_BASEDIR=$(INSTALL_PREFIX)
  367. endif
  368. endif
  369. ifndef INSTALL_BINDIR
  370. ifdef UNIXINSTALLDIR
  371. INSTALL_BINDIR=$(INSTALL_PREFIX)/bin
  372. else
  373. INSTALL_BINDIR=$(INSTALL_BASEDIR)/bin/$(OS_TARGET)
  374. endif
  375. endif
  376. ifndef INSTALL_UNITDIR
  377. INSTALL_UNITDIR=$(INSTALL_BASEDIR)/units/$(OS_TARGET)
  378. ifdef PACKAGE_NAME
  379. INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
  380. endif
  381. endif
  382. ifndef INSTALL_LIBDIR
  383. ifdef UNIXINSTALLDIR
  384. INSTALL_LIBDIR=$(INSTALL_PREFIX)/lib
  385. else
  386. INSTALL_LIBDIR=$(INSTALL_UNITDIR)
  387. endif
  388. endif
  389. ifndef INSTALL_SOURCEDIR
  390. ifdef UNIXINSTALLDIR
  391. INSTALL_SOURCEDIR=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)
  392. else
  393. INSTALL_SOURCEDIR=$(INSTALL_BASEDIR)/source
  394. endif
  395. ifdef PACKAGE_NAME
  396. INSTALL_SOURCEDIR:=$(INSTALL_SOURCEDIR)/$(PACKAGE_NAME)
  397. endif
  398. endif
  399. ifndef INSTALL_DOCDIR
  400. ifdef UNIXINSTALLDIR
  401. INSTALL_DOCDIR=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)
  402. else
  403. INSTALL_DOCDIR=$(INSTALL_BASEDIR)/doc
  404. endif
  405. endif
  406. ifndef INSTALL_EXAMPLEDIR
  407. ifdef UNIXINSTALLDIR
  408. INSTALL_EXAMPLEDIR=$(INSTALL_DOCDIR)/examples
  409. else
  410. INSTALL_EXAMPLEDIR=$(INSTALL_BASEDIR)/examples
  411. endif
  412. ifdef EXAMPLESUBDIR
  413. INSTALL_EXAMPLEDIR:=$(INSTALL_EXAMPLEDIR)/$(EXAMPLESUBDIR)
  414. endif
  415. endif
  416. ifndef INSTALL_DATADIR
  417. INSTALL_DATADIR=$(INSTALL_BASEDIR)
  418. endif
  419. ifdef inUnix
  420. ifndef GCCLIBDIR
  421. GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`)
  422. endif
  423. ifndef OTHERLIBDIR
  424. OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }')
  425. endif
  426. export GCCLIBDIR OTHERLIB
  427. endif
  428. ifeq ($(OS_TARGET),linux)
  429. REQUIRE_PACKAGES_GTK=1
  430. REQUIRE_PACKAGES_X11=1
  431. REQUIRE_PACKAGES_OPENGL=1
  432. endif
  433. ifeq ($(OS_TARGET),go32v2)
  434. REQUIRE_PACKAGES_GTK=1
  435. REQUIRE_PACKAGES_OPENGL=1
  436. endif
  437. ifeq ($(OS_TARGET),win32)
  438. REQUIRE_PACKAGES_GTK=1
  439. REQUIRE_PACKAGES_OPENGL=1
  440. endif
  441. ifeq ($(OS_TARGET),os2)
  442. REQUIRE_PACKAGES_GTK=1
  443. REQUIRE_PACKAGES_OPENGL=1
  444. endif
  445. ifeq ($(OS_TARGET),freebsd)
  446. REQUIRE_PACKAGES_GTK=1
  447. REQUIRE_PACKAGES_OPENGL=1
  448. endif
  449. ifdef REQUIRE_PACKAGES_GTK
  450. PACKAGEDIR_GTK:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /gtk/Makefile.fpc,$(PACKAGESDIR)))))
  451. ifneq ($(PACKAGEDIR_GTK),)
  452. PACKAGEDIR_GTK:=$(firstword $(PACKAGEDIR_GTK))
  453. ifeq ($(wildcard $(PACKAGEDIR_GTK)/$(FPCMADE)),)
  454. override COMPILEPACKAGES+=package_gtk
  455. package_gtk:
  456. $(MAKE) -C $(PACKAGEDIR_GTK) all
  457. endif
  458. ifneq ($(wildcard $(PACKAGEDIR_GTK)/$(OS_TARGET)),)
  459. UNITDIR_GTK=$(PACKAGEDIR_GTK)/$(OS_TARGET)
  460. else
  461. UNITDIR_GTK=$(PACKAGEDIR_GTK)
  462. endif
  463. else
  464. PACKAGEDIR_GTK=
  465. UNITDIR_GTK:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /gtk/Package.fpc,$(UNITSDIR)))))
  466. ifneq ($(UNITDIR_GTK),)
  467. UNITDIR_GTK:=$(firstword $(UNITDIR_GTK))
  468. else
  469. UNITDIR_GTK=
  470. endif
  471. endif
  472. ifdef UNITDIR_GTK
  473. override COMPILER_UNITDIR+=$(UNITDIR_GTK)
  474. endif
  475. endif
  476. ifdef REQUIRE_PACKAGES_X11
  477. PACKAGEDIR_X11:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /x11/Makefile.fpc,$(PACKAGESDIR)))))
  478. ifneq ($(PACKAGEDIR_X11),)
  479. PACKAGEDIR_X11:=$(firstword $(PACKAGEDIR_X11))
  480. ifeq ($(wildcard $(PACKAGEDIR_X11)/$(FPCMADE)),)
  481. override COMPILEPACKAGES+=package_x11
  482. package_x11:
  483. $(MAKE) -C $(PACKAGEDIR_X11) all
  484. endif
  485. ifneq ($(wildcard $(PACKAGEDIR_X11)/$(OS_TARGET)),)
  486. UNITDIR_X11=$(PACKAGEDIR_X11)/$(OS_TARGET)
  487. else
  488. UNITDIR_X11=$(PACKAGEDIR_X11)
  489. endif
  490. else
  491. PACKAGEDIR_X11=
  492. UNITDIR_X11:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /x11/Package.fpc,$(UNITSDIR)))))
  493. ifneq ($(UNITDIR_X11),)
  494. UNITDIR_X11:=$(firstword $(UNITDIR_X11))
  495. else
  496. UNITDIR_X11=
  497. endif
  498. endif
  499. ifdef UNITDIR_X11
  500. override COMPILER_UNITDIR+=$(UNITDIR_X11)
  501. endif
  502. endif
  503. ifdef REQUIRE_PACKAGES_OPENGL
  504. PACKAGEDIR_OPENGL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /opengl/Makefile.fpc,$(PACKAGESDIR)))))
  505. ifneq ($(PACKAGEDIR_OPENGL),)
  506. PACKAGEDIR_OPENGL:=$(firstword $(PACKAGEDIR_OPENGL))
  507. ifeq ($(wildcard $(PACKAGEDIR_OPENGL)/$(FPCMADE)),)
  508. override COMPILEPACKAGES+=package_opengl
  509. package_opengl:
  510. $(MAKE) -C $(PACKAGEDIR_OPENGL) all
  511. endif
  512. ifneq ($(wildcard $(PACKAGEDIR_OPENGL)/$(OS_TARGET)),)
  513. UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL)/$(OS_TARGET)
  514. else
  515. UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL)
  516. endif
  517. else
  518. PACKAGEDIR_OPENGL=
  519. UNITDIR_OPENGL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /opengl/Package.fpc,$(UNITSDIR)))))
  520. ifneq ($(UNITDIR_OPENGL),)
  521. UNITDIR_OPENGL:=$(firstword $(UNITDIR_OPENGL))
  522. else
  523. UNITDIR_OPENGL=
  524. endif
  525. endif
  526. ifdef UNITDIR_OPENGL
  527. override COMPILER_UNITDIR+=$(UNITDIR_OPENGL)
  528. endif
  529. endif
  530. .PHONY: package_gtk package_x11 package_opengl
  531. override FPCOPTDEF=$(CPU_TARGET)
  532. ifneq ($(OS_TARGET),$(OS_SOURCE))
  533. override FPCOPT+=-T$(OS_TARGET)
  534. endif
  535. ifdef UNITDIR
  536. override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
  537. endif
  538. ifdef LIBDIR
  539. override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
  540. endif
  541. ifdef OBJDIR
  542. override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
  543. endif
  544. ifdef INCDIR
  545. override FPCOPT+=$(addprefix -Fi,$(INCDIR))
  546. endif
  547. ifdef LINKSMART
  548. override FPCOPT+=-XX
  549. endif
  550. ifdef CREATESMART
  551. override FPCOPT+=-CX
  552. endif
  553. ifdef DEBUG
  554. override FPCOPT+=-gl
  555. override FPCOPTDEF+=DEBUG
  556. endif
  557. ifdef RELEASE
  558. override FPCOPT+=-Xs -OG2p3 -n
  559. override FPCOPTDEF+=RELEASE
  560. endif
  561. ifdef STRIP
  562. override FPCOPT+=-Xs
  563. endif
  564. ifdef OPTIMIZE
  565. override FPCOPT+=-OG2p3
  566. endif
  567. ifdef VERBOSE
  568. override FPCOPT+=-vwni
  569. endif
  570. ifdef COMPILER_OPTIONS
  571. override FPCOPT+=$(COMPILER_OPTIONS)
  572. endif
  573. ifdef COMPILER_UNITDIR
  574. override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
  575. endif
  576. ifdef COMPILER_LIBRARYDIR
  577. override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
  578. endif
  579. ifdef COMPILER_OBJECTDIR
  580. override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
  581. endif
  582. ifdef COMPILER_INCLUDEDIR
  583. override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
  584. endif
  585. ifdef COMPILER_TARGETDIR
  586. override FPCOPT+=-FE$(COMPILER_TARGETDIR)
  587. ifeq ($(COMPILER_TARGETDIR),.)
  588. override TARGETDIRPREFIX=
  589. else
  590. override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
  591. endif
  592. endif
  593. ifdef COMPILER_UNITTARGETDIR
  594. override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
  595. ifeq ($(COMPILER_UNITTARGETDIR),.)
  596. override UNITTARGETDIRPREFIX=
  597. else
  598. override UNITTARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
  599. endif
  600. else
  601. ifdef COMPILER_TARGETDIR
  602. override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
  603. override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
  604. endif
  605. endif
  606. ifdef GCCLIBDIR
  607. override FPCOPT+=-Fl$(GCCLIBDIR)
  608. endif
  609. ifdef OTHERLIBDIR
  610. override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
  611. endif
  612. ifdef OPT
  613. override FPCOPT+=$(OPT)
  614. endif
  615. ifdef FPCOPTDEF
  616. override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
  617. endif
  618. ifdef CFGFILE
  619. override FPCOPT+=@$(CFGFILE)
  620. endif
  621. ifeq ($(OS_SOURCE),win32)
  622. override FPCEXTCMD:=$(FPCOPT)
  623. override FPCOPT:=!FPCEXTCMD
  624. export FPCEXTCMD
  625. endif
  626. override COMPILER:=$(FPC) $(FPCOPT)
  627. ifeq (,$(findstring -s ,$(COMPILER)))
  628. EXECPPAS=
  629. else
  630. ifeq ($(OS_SOURCE),$(OS_TARGET))
  631. EXECPPAS:=@$(PPAS)
  632. endif
  633. endif
  634. .PHONY: fpc_packages fpc_all fpc_smart fpc_debug
  635. $(FPCMADE): $(ALLTARGET)
  636. @$(ECHO) Compiled > $(FPCMADE)
  637. fpc_packages: $(COMPILEPACKAGES)
  638. fpc_all: fpc_packages $(FPCMADE)
  639. fpc_smart:
  640. $(MAKE) all LINKSMART=1 CREATESMART=1
  641. fpc_debug:
  642. $(MAKE) all DEBUG=1
  643. .SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
  644. %$(PPUEXT): %.pp
  645. $(COMPILER) $<
  646. $(EXECPPAS)
  647. %$(PPUEXT): %.pas
  648. $(COMPILER) $<
  649. $(EXECPPAS)
  650. %$(EXEEXT): %.pp
  651. $(COMPILER) $<
  652. $(EXECPPAS)
  653. %$(EXEEXT): %.pas
  654. $(COMPILER) $<
  655. $(EXECPPAS)
  656. vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
  657. vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
  658. vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
  659. .PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
  660. ifdef INSTALL_UNITS
  661. override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
  662. endif
  663. ifdef INSTALLPPUFILES
  664. ifdef PPUFILES
  665. override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
  666. override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)))
  667. else
  668. override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
  669. override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
  670. override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)))
  671. endif
  672. endif
  673. ifdef INSTALLEXEFILES
  674. override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
  675. endif
  676. fpc_install: $(INSTALLTARGET)
  677. ifdef INSTALLEXEFILES
  678. $(MKDIR) $(INSTALL_BINDIR)
  679. ifdef UPXPROG
  680. -$(UPXPROG) $(INSTALLEXEFILES)
  681. endif
  682. $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
  683. endif
  684. ifdef INSTALLPPUFILES
  685. $(MKDIR) $(INSTALL_UNITDIR)
  686. $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
  687. ifneq ($(INSTALLPPULINKFILES),)
  688. $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
  689. endif
  690. ifneq ($(wildcard $(LIB_FULLNAME)),)
  691. $(MKDIR) $(INSTALL_LIBDIR)
  692. $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
  693. ifdef inUnix
  694. ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
  695. endif
  696. endif
  697. endif
  698. ifdef INSTALL_FILES
  699. $(MKDIR) $(INSTALL_DATADIR)
  700. $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
  701. endif
  702. fpc_sourceinstall: distclean
  703. $(MKDIR) $(INSTALL_SOURCEDIR)
  704. $(COPYTREE) $(BASEDIR) $(INSTALL_SOURCEDIR)
  705. fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
  706. ifdef HASEXAMPLES
  707. $(MKDIR) $(INSTALL_EXAMPLEDIR)
  708. endif
  709. ifdef EXAMPLESOURCEFILES
  710. $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
  711. endif
  712. ifdef TARGET_EXAMPLEDIRS
  713. $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
  714. endif
  715. fpc_distinstall: fpc_install fpc_exampleinstall
  716. .PHONY: fpc_clean fpc_cleanall fpc_distclean
  717. ifdef EXEFILES
  718. override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
  719. endif
  720. ifdef CLEAN_UNITS
  721. override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
  722. endif
  723. ifdef CLEANPPUFILES
  724. override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
  725. ifdef PPUFILES
  726. CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
  727. else
  728. CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))))
  729. endif
  730. override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))
  731. endif
  732. fpc_clean: $(CLEANTARGET)
  733. ifdef CLEANEXEFILES
  734. -$(DEL) $(CLEANEXEFILES)
  735. endif
  736. ifdef CLEANPPUFILES
  737. -$(DEL) $(CLEANPPUFILES)
  738. endif
  739. ifneq ($(CLEANPPULINKFILES),)
  740. -$(DEL) $(CLEANPPULINKFILES)
  741. endif
  742. ifdef CLEANRSTFILES
  743. -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
  744. endif
  745. ifdef CLEAN_FILES
  746. -$(DEL) $(CLEAN_FILES)
  747. endif
  748. ifdef LIB_NAME
  749. -$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
  750. endif
  751. -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
  752. fpc_distclean: fpc_clean
  753. ifdef COMPILER_UNITTARGETDIR
  754. TARGETDIRCLEAN=fpc_clean
  755. endif
  756. fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)
  757. ifdef CLEANEXEFILES
  758. -$(DEL) $(CLEANEXEFILES)
  759. endif
  760. -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  761. -$(DELTREE) *$(SMARTEXT)
  762. -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
  763. ifdef AOUTEXT
  764. -$(DEL) *$(AOUTEXT)
  765. endif
  766. .PHONY: fpc_info
  767. fpc_info:
  768. @$(ECHO)
  769. @$(ECHO) == Package info ==
  770. @$(ECHO) Package Name..... $(PACKAGE_NAME)
  771. @$(ECHO) Package Version.. $(PACKAGE_VERSION)
  772. @$(ECHO)
  773. @$(ECHO) == Configuration info ==
  774. @$(ECHO)
  775. @$(ECHO) FPC.......... $(FPC)
  776. @$(ECHO) FPC Version.. $(FPC_VERSION)
  777. @$(ECHO) Source CPU... $(CPU_SOURCE)
  778. @$(ECHO) Target CPU... $(CPU_TARGET)
  779. @$(ECHO) Source OS.... $(OS_SOURCE)
  780. @$(ECHO) Target OS.... $(OS_TARGET)
  781. @$(ECHO)
  782. @$(ECHO) == Directory info ==
  783. @$(ECHO)
  784. @$(ECHO) Basedir......... $(BASEDIR)
  785. @$(ECHO) FPCDir.......... $(FPCDIR)
  786. @$(ECHO) UnitsDir........ $(UNITSDIR)
  787. @$(ECHO) PackagesDir..... $(PACKAGESDIR)
  788. @$(ECHO)
  789. @$(ECHO) GCC library..... $(GCCLIBDIR)
  790. @$(ECHO) Other library... $(OTHERLIBDIR)
  791. @$(ECHO)
  792. @$(ECHO) == Tools info ==
  793. @$(ECHO)
  794. @$(ECHO) Pwd....... $(PWD)
  795. @$(ECHO) Echo...... $(ECHO)
  796. @$(ECHO) PPUMove... $(PPUMOVE)
  797. @$(ECHO) PPUFiles.. $(PPUFILES)
  798. @$(ECHO) Date...... $(DATE)
  799. @$(ECHO) Upx....... $(UPXPROG)
  800. @$(ECHO) Zip....... $(ZIPPROG)
  801. @$(ECHO)
  802. @$(ECHO) == Object info ==
  803. @$(ECHO)
  804. @$(ECHO) Target Loaders...... $(TARGET_LOADERS)
  805. @$(ECHO) Target Units........ $(TARGET_UNITS)
  806. @$(ECHO) Target Programs..... $(TARGET_PROGRAMS)
  807. @$(ECHO) Target Dirs......... $(TARGET_DIRS)
  808. @$(ECHO) Target Examples..... $(TARGET_EXAMPLES)
  809. @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS)
  810. @$(ECHO)
  811. @$(ECHO) Clean Units......... $(CLEAN_UNITS)
  812. @$(ECHO) Clean Files......... $(CLEAN_FILES)
  813. @$(ECHO)
  814. @$(ECHO) Install Units....... $(INSTALL_UNITS)
  815. @$(ECHO) Install Files....... $(INSTALL_FILES)
  816. @$(ECHO)
  817. @$(ECHO) == Install info ==
  818. @$(ECHO)
  819. @$(ECHO) DateStr.............. $(DATESTR)
  820. @$(ECHO) ZipPrefix............ $(ZIPPREFIX)
  821. @$(ECHO) ZipSuffix............ $(ZIPSUFFIX)
  822. @$(ECHO)
  823. @$(ECHO) INSTALL_BASEDIR...... $(INSTALL_BASEDIR)
  824. @$(ECHO) INSTALL_BINDIR....... $(INSTALL_BINDIR)
  825. @$(ECHO) INSTALL_LIBDIR....... $(INSTALL_LIBDIR)
  826. @$(ECHO) INSTALL_UNITDIR...... $(INSTALL_UNITDIR)
  827. @$(ECHO) INSTALL_SOURCEDIR.... $(INSTALL_SOURCEDIR)
  828. @$(ECHO) INSTALL_DOCDIR....... $(INSTALL_DOCDIR)
  829. @$(ECHO) INSTALL_DATADIR...... $(INSTALL_DATADIR)
  830. @$(ECHO)
  831. @$(ECHO) DIST_DESTDIR......... $(DIST_DESTDIR)
  832. @$(ECHO) DIST_ZIPNAME......... $(DIST_ZIPNAME)
  833. @$(ECHO)
  834. all: fpc_all
  835. debug: fpc_debug
  836. examples: fpc_examples
  837. smart: fpc_smart
  838. shared: fpc_shared
  839. install: fpc_install
  840. sourceinstall: fpc_sourceinstall
  841. exampleinstall: fpc_exampleinstall
  842. distinstall: fpc_distinstall
  843. zipinstall:
  844. zipsourceinstall:
  845. zipexampleinstall:
  846. zipdistinstall:
  847. clean: fpc_clean
  848. distclean: fpc_distclean
  849. cleanall: fpc_cleanall
  850. info: fpc_info
  851. .PHONY: all debug examples smart shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info
  852. ifneq ($(wildcard fpcmake.loc),)
  853. include fpcmake.loc
  854. endif