Makefile 20 KB

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