Makefile 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966
  1. #
  2. # Makefile generated by fpcmake v0.99.13 on 1999-11-25 20:05
  3. #
  4. defaultrule: all
  5. #####################################################################
  6. # Autodetect OS (Linux or Dos or Windows NT)
  7. # define inlinux when running under linux
  8. # define inWinNT when running under WinNT
  9. #####################################################################
  10. # We need only / in the path
  11. override PATH:=$(subst \,/,$(PATH))
  12. # Search for PWD and determine also if we are under linux
  13. PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
  14. ifeq ($(PWD),)
  15. PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
  16. ifeq ($(PWD),)
  17. nopwd:
  18. @echo You need the GNU utils package to use this Makefile!
  19. @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
  20. @exit
  21. else
  22. inlinux=1
  23. endif
  24. else
  25. PWD:=$(firstword $(PWD))
  26. endif
  27. # Detect NT - NT sets OS to Windows_NT
  28. ifndef inlinux
  29. ifeq ($(OS),Windows_NT)
  30. inWinNT=1
  31. endif
  32. endif
  33. # Detect OS/2 - OS/2 has OS2_SHELL defined
  34. ifndef inlinux
  35. ifndef inWinNT
  36. ifdef OS2_SHELL
  37. inOS2=1
  38. endif
  39. endif
  40. endif
  41. # The extension of executables
  42. ifdef inlinux
  43. EXEEXT=
  44. else
  45. EXEEXT=.exe
  46. endif
  47. # The path which is search separated by spaces
  48. ifdef inlinux
  49. SEARCHPATH=$(subst :, ,$(PATH))
  50. else
  51. SEARCHPATH=$(subst ;, ,$(PATH))
  52. endif
  53. #####################################################################
  54. # FPC version/target Detection
  55. #####################################################################
  56. # What compiler to use ?
  57. ifndef FPC
  58. ifdef inOS2
  59. export FPC=ppos2$(EXEEXT)
  60. else
  61. export FPC=ppc386$(EXEEXT)
  62. endif
  63. endif
  64. # Target OS
  65. ifndef OS_TARGET
  66. export OS_TARGET:=$(shell $(FPC) -iTO)
  67. endif
  68. # Source OS
  69. ifndef OS_SOURCE
  70. export OS_SOURCE:=$(shell $(FPC) -iSO)
  71. endif
  72. # Target CPU
  73. ifndef CPU_TARGET
  74. export CPU_TARGET:=$(shell $(FPC) -iTP)
  75. endif
  76. # Source CPU
  77. ifndef CPU_SOURCE
  78. export CPU_SOURCE:=$(shell $(FPC) -iSP)
  79. endif
  80. # FPC version
  81. ifndef FPC_VERSION
  82. export FPC_VERSION:=$(shell $(FPC) -iV)
  83. endif
  84. #####################################################################
  85. # Default Settings
  86. #####################################################################
  87. # Release ? Then force OPT and don't use extra opts via commandline
  88. ifndef REDIRFILE
  89. REDIRFILE=log
  90. endif
  91. ifdef RELEASE
  92. override OPT:=-Xs -OG2p3 -n
  93. endif
  94. # Verbose settings (warning,note,info)
  95. ifdef VERBOSE
  96. override OPT+=-vwni
  97. endif
  98. ifdef REDIR
  99. ifndef inlinux
  100. override FPC=redir -eo $(FPC)
  101. endif
  102. # set the verbosity to max
  103. override OPT+=-va
  104. override REDIR:= >> $(REDIRFILE)
  105. endif
  106. #####################################################################
  107. # User Settings
  108. #####################################################################
  109. # Targets
  110. override UNITOBJECTS+=dllist postgres
  111. override EXAMPLEOBJECTS+=testpg testemail
  112. # Clean
  113. # Install
  114. ZIPTARGET=install
  115. # Defaults
  116. # Directories
  117. ifndef FPCDIR
  118. FPCDIR=../..
  119. endif
  120. ifndef PACKAGEDIR
  121. PACKAGEDIR=$(FPCDIR)/packages
  122. endif
  123. # Packages
  124. # Libraries
  125. # Info
  126. INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall
  127. #####################################################################
  128. # Default Directories
  129. #####################################################################
  130. # Base dir
  131. ifdef PWD
  132. BASEDIR:=$(shell $(PWD))
  133. else
  134. BASEDIR=.
  135. endif
  136. # this can be set to 'rtl' when the RTL units are installed
  137. ifndef UNITPREFIX
  138. UNITPREFIX=units
  139. endif
  140. # set the prefix directory where to install everything
  141. ifndef PREFIXINSTALLDIR
  142. ifdef inlinux
  143. export PREFIXINSTALLDIR=/usr
  144. else
  145. export PREFIXINSTALLDIR=/pp
  146. endif
  147. endif
  148. # create fcldir,rtldir,unitdir
  149. ifdef FPCDIR
  150. ifneq ($(FPCDIR),.)
  151. override RTLDIR=$(FPCDIR)/rtl
  152. override FCLDIR=$(FPCDIR)/fcl
  153. override UNITDIR=$(FPCDIR)/units
  154. endif
  155. endif
  156. #####################################################################
  157. # Install Directories
  158. #####################################################################
  159. # set the base directory where to install everything
  160. ifndef BASEINSTALLDIR
  161. ifdef inlinux
  162. BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
  163. else
  164. BASEINSTALLDIR=$(PREFIXINSTALLDIR)
  165. endif
  166. endif
  167. # set the directory where to install the binaries
  168. ifndef BININSTALLDIR
  169. ifdef inlinux
  170. BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
  171. else
  172. BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
  173. endif
  174. endif
  175. # set the directory where to install the units.
  176. ifndef UNITINSTALLDIR
  177. UNITINSTALLDIR=$(BASEINSTALLDIR)/$(UNITPREFIX)/$(OS_TARGET)
  178. endif
  179. # Where to install shared libraries
  180. ifndef LIBINSTALLDIR
  181. ifdef inlinux
  182. LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
  183. else
  184. LIBINSTALLDIR=$(UNITINSTALLDIR)
  185. endif
  186. endif
  187. # Where the source files will be stored
  188. ifndef SOURCEINSTALLDIR
  189. ifdef inlinux
  190. SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
  191. else
  192. SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
  193. endif
  194. endif
  195. # Where the doc files will be stored
  196. ifndef DOCINSTALLDIR
  197. ifdef inlinux
  198. DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc/$(FPC_VERSION)
  199. else
  200. DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
  201. endif
  202. endif
  203. # Where the some extra (data)files will be stored
  204. ifndef EXTRAINSTALLDIR
  205. EXTRAINSTALLDIR=$(BASEINSTALLDIR)
  206. endif
  207. #####################################################################
  208. # Compiler Command Line
  209. #####################################################################
  210. # Load commandline OPTDEF and add FPC_CPU define
  211. override FPCOPTDEF:=-d$(CPU_TARGET)
  212. # Load commandline OPT and add target and unit dir to be sure
  213. ifneq ($(OS_TARGET),$(OS_SOURCE))
  214. override FPCOPT+=-T$(OS_TARGET)
  215. endif
  216. ifdef RTLDIR
  217. override FPCOPT+=-Fu$(RTLDIR)
  218. endif
  219. ifdef UNITSDIR
  220. override FPCOPT+=-Fu$(UNITSDIR)
  221. endif
  222. # Smartlinking
  223. ifdef SMARTLINK
  224. override FPCOPT+=-CX
  225. endif
  226. # Debug
  227. ifdef DEBUG
  228. override FPCOPT+=-g
  229. endif
  230. # Add commandline options
  231. ifdef OPT
  232. override FPCOPT+=$(OPT)
  233. endif
  234. ifdef UNITDIR
  235. override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
  236. endif
  237. ifdef LIBDIR
  238. override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
  239. endif
  240. ifdef OBJDIR
  241. override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
  242. endif
  243. ifdef INCDIR
  244. override FPCOPT+=$(addprefix -Fi,$(INCDIR))
  245. endif
  246. # Add defines from FPCOPTDEF to FPCOPT
  247. ifdef FPCOPTDEF
  248. override FPCOPT+=$(FPCOPTDEF)
  249. endif
  250. # Error file ?
  251. ifdef ERRORFILE
  252. override FPCOPT+=-Fr$(ERRORFILE)
  253. endif
  254. # Was a config file specified ?
  255. ifdef CFGFILE
  256. override FPCOPT+=@$(CFGFILE)
  257. endif
  258. override COMPILER=$(FPC) $(FPCOPT)
  259. #####################################################################
  260. # Shell tools
  261. #####################################################################
  262. # To copy pograms
  263. ifndef COPY
  264. export COPY:=cp -fp
  265. endif
  266. # Copy a whole tree
  267. ifndef COPYTREE
  268. export COPYTREE:=cp -rfp
  269. endif
  270. # To move pograms
  271. ifndef MOVE
  272. export MOVE:=mv -f
  273. endif
  274. # Check delete program
  275. ifndef DEL
  276. export DEL:=rm -f
  277. endif
  278. # Check deltree program
  279. ifndef DELTREE
  280. export DELTREE:=rm -rf
  281. endif
  282. # To install files
  283. ifndef INSTALL
  284. ifdef inlinux
  285. export INSTALL:=install -m 644
  286. else
  287. export INSTALL:=$(COPY)
  288. endif
  289. endif
  290. # To install programs
  291. ifndef INSTALLEXE
  292. ifdef inlinux
  293. export INSTALLEXE:=install -m 755
  294. else
  295. export INSTALLEXE:=$(COPY)
  296. endif
  297. endif
  298. # To make a directory.
  299. ifndef MKDIR
  300. ifdef inlinux
  301. export MKDIR:=install -m 755 -d
  302. else
  303. export MKDIR:=ginstall -m 755 -d
  304. endif
  305. endif
  306. #####################################################################
  307. # Default Tools
  308. #####################################################################
  309. # file used to check if a package is compiled
  310. ifndef FPCMAKED
  311. FPCMAKED=fpcmaked
  312. endif
  313. # assembler, redefine it if cross compiling
  314. ifndef AS
  315. AS=as
  316. endif
  317. # linker, but probably not used
  318. ifndef LD
  319. LD=ld
  320. endif
  321. # ppas.bat / ppas.sh
  322. ifdef inlinux
  323. PPAS=ppas.sh
  324. else
  325. ifdef inOS2
  326. PPAS=ppas.cmd
  327. else
  328. PPAS=ppas.bat
  329. endif
  330. endif
  331. # also call ppas if with command option -s
  332. ifeq (,$(findstring -s ,$(COMPILER)))
  333. EXECPPAS=
  334. else
  335. EXECPPAS=@$(PPAS)
  336. endif
  337. # ldconfig to rebuild .so cache
  338. ifdef inlinux
  339. LDCONFIG=ldconfig
  340. else
  341. LDCONFIG=
  342. endif
  343. # echo
  344. ifndef ECHO
  345. ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
  346. ifeq ($(ECHO),)
  347. export ECHO:=echo
  348. else
  349. export ECHO:=$(firstword $(ECHO))
  350. endif
  351. endif
  352. # ppdep
  353. ifndef PPDEP
  354. PPDEP:=$(strip $(wildcard $(addsuffix /ppdep$(EXEEXT),$(SEARCHPATH))))
  355. ifeq ($(PPDEP),)
  356. PPDEP=
  357. else
  358. export PPDEP:=$(firstword $(PPDEP))
  359. endif
  360. endif
  361. # ppumove
  362. ifndef PPUMOVE
  363. PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(EXEEXT),$(SEARCHPATH))))
  364. ifeq ($(PPUMOVE),)
  365. PPUMOVE=
  366. else
  367. export PPUMOVE:=$(firstword $(PPUMOVE))
  368. endif
  369. endif
  370. # ppufiles
  371. ifndef PPUFILES
  372. PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
  373. ifeq ($(PPUFILES),)
  374. PPUFILES=
  375. else
  376. export PPUFILES:=$(firstword $(PPUFILES))
  377. endif
  378. endif
  379. # Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
  380. # upx uses that one itself (PFV)
  381. ifndef UPXPROG
  382. ifeq ($(OS_TARGET),go32v2)
  383. UPXPROG:=1
  384. endif
  385. ifeq ($(OS_TARGET),win32)
  386. UPXPROG:=1
  387. endif
  388. ifdef UPXPROG
  389. UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(SEARCHPATH))))
  390. ifeq ($(UPXPROG),)
  391. UPXPROG=
  392. else
  393. export UPXPROG:=$(firstword $(UPXPROG))
  394. endif
  395. else
  396. UPXPROG=
  397. endif
  398. endif
  399. # gdate/date
  400. ifndef DATE
  401. DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
  402. ifeq ($(DATE),)
  403. DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
  404. ifeq ($(DATE),)
  405. DATE=
  406. else
  407. export DATE:=$(firstword $(DATE))
  408. endif
  409. else
  410. export DATE:=$(firstword $(DATE))
  411. endif
  412. endif
  413. ifdef DATE
  414. DATESTR:=$(shell $(DATE) +%Y%m%d)
  415. else
  416. DATESTR=
  417. endif
  418. # ZipProg, you can't use Zip as the var name (PFV)
  419. ifndef ZIPPROG
  420. ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
  421. ifeq ($(ZIPPROG),)
  422. ZIPPROG=
  423. else
  424. export ZIPPROG:=$(firstword $(ZIPPROG)) -D9 -r
  425. endif
  426. endif
  427. ifndef ZIPEXT
  428. ZIPEXT=.zip
  429. endif
  430. #####################################################################
  431. # Default extensions
  432. #####################################################################
  433. # Default needed extensions (Go32v2,Linux)
  434. LOADEREXT=.as
  435. PPLEXT=.ppl
  436. PPUEXT=.ppu
  437. OEXT=.o
  438. ASMEXT=.s
  439. SMARTEXT=.sl
  440. STATICLIBEXT=.a
  441. SHAREDLIBEXT=.so
  442. PACKAGESUFFIX=
  443. # Go32v1
  444. ifeq ($(OS_TARGET),go32v1)
  445. PPUEXT=.pp1
  446. OEXT=.o1
  447. ASMEXT=.s1
  448. SMARTEXT=.sl1
  449. STATICLIBEXT=.a1
  450. SHAREDLIBEXT=.so1
  451. PACKAGESUFFIX=v1
  452. endif
  453. # Go32v2
  454. ifeq ($(OS_TARGET),go32v2)
  455. PACKAGESUFFIX=go32
  456. endif
  457. # Linux
  458. ifeq ($(OS_TARGET),linux)
  459. PACKAGESUFFIX=linux
  460. endif
  461. # Win32
  462. ifeq ($(OS_TARGET),win32)
  463. PPUEXT=.ppw
  464. OEXT=.ow
  465. ASMEXT=.sw
  466. SMARTEXT=.slw
  467. STATICLIBEXT=.aw
  468. SHAREDLIBEXT=.dll
  469. PACKAGESUFFIX=win32
  470. endif
  471. # OS/2
  472. ifeq ($(OS_TARGET),os2)
  473. PPUEXT=.ppo
  474. ASMEXT=.so2
  475. OEXT=.oo2
  476. SMARTEXT=.so
  477. STATICLIBEXT=.ao2
  478. SHAREDLIBEXT=.dll
  479. PACKAGESUFFIX=os2
  480. endif
  481. # library prefix
  482. LIBPREFIX=lib
  483. ifeq ($(OS_TARGET),go32v2)
  484. LIBPREFIX=
  485. endif
  486. ifeq ($(OS_TARGET),go32v1)
  487. LIBPREFIX=
  488. endif
  489. # determine which .pas extension is used
  490. ifndef PASEXT
  491. ifdef EXEOBJECTS
  492. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
  493. else
  494. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
  495. endif
  496. ifeq ($(TESTPAS),)
  497. PASEXT=.pp
  498. else
  499. PASEXT=.pas
  500. endif
  501. endif
  502. #####################################################################
  503. # Standard rules
  504. #####################################################################
  505. all: fpc_all
  506. debug: fpc_debug
  507. examples: fpc_examples
  508. test: fpc_test
  509. smart: fpc_smart
  510. shared: fpc_shared
  511. showinstall: fpc_showinstall
  512. install: fpc_install
  513. sourceinstall: fpc_sourceinstall
  514. zipinstall: fpc_zipinstall
  515. zipinstalladd: fpc_zipinstalladd
  516. clean: fpc_clean
  517. cleanall: fpc_cleanall
  518. info: fpc_info
  519. .PHONY: all debug examples test smart shared showinstall install sourceinstall zipinstall zipinstalladd clean cleanall info
  520. #####################################################################
  521. # Package depends
  522. #####################################################################
  523. ifneq ($(wildcard $(RTLDIR)/$(OS_TARGET)),)
  524. ifeq ($(wildcard $(RTLDIR)/$(OS_TARGET)/$(FPCMAKED)),)
  525. override COMPILEPACKAGES+=rtl
  526. rtl_package:
  527. $(MAKE) -C $(RTLDIR)/$(OS_TARGET) all
  528. endif
  529. endif
  530. .PHONY: $(OS_TARGET)_package
  531. #####################################################################
  532. # Units
  533. #####################################################################
  534. .PHONY: fpc_units
  535. override ALLTARGET+=fpc_units
  536. override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
  537. override INSTALLPPUFILES+=$(UNITPPUFILES)
  538. override CLEANPPUFILES+=$(UNITPPUFILES)
  539. fpc_units: $(UNITPPUFILES)
  540. #####################################################################
  541. # Examples
  542. #####################################################################
  543. .PHONY: fpc_examples fpc_test
  544. override EXAMPLEFILES=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
  545. override EXAMPLEOFILES=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
  546. override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
  547. fpc_examples: all $(EXAMPLEFILES)
  548. fpc_test: examples
  549. #####################################################################
  550. # General compile rules
  551. #####################################################################
  552. .PHONY: fpc_all fpc_debug
  553. $(FPCMAKED):
  554. @$(ECHO) Compiled > $(FPCMAKED)
  555. fpc_all: $(addsuffix _package,$(COMPILEPACKAGES)) $(ALLTARGET) $(FPCMAKED)
  556. fpc_debug:
  557. $(MAKE) all DEBUG=1
  558. # General compile rules, available for both possible PASEXT
  559. .SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
  560. %$(PPUEXT): %.pp
  561. $(COMPILER) $< $(REDIR)
  562. $(EXECPASS)
  563. %$(PPUEXT): %.pas
  564. $(COMPILER) $< $(REDIR)
  565. $(EXECPASS)
  566. %$(EXEEXT): %.pp
  567. $(COMPILER) $< $(REDIR)
  568. $(EXECPASS)
  569. %$(EXEEXT): %.pas
  570. $(COMPILER) $< $(REDIR)
  571. $(EXECPASS)
  572. #####################################################################
  573. # Library
  574. #####################################################################
  575. .PHONY: fpc_smart fpc_shared
  576. # Default sharedlib units are all unit objects
  577. ifndef SHAREDLIBUNITOBJECTS
  578. SHAREDLIBUNITOBJECTS=$(UNITOBJECTS)
  579. endif
  580. fpc_smart:
  581. $(MAKE) all SMARTLINK=1
  582. fpc_shared: all
  583. ifdef inlinux
  584. ifndef LIBNAME
  585. @$(ECHO) LIBNAME not set
  586. else
  587. $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
  588. endif
  589. else
  590. @$(ECHO) Shared Libraries not supported
  591. endif
  592. #####################################################################
  593. # Install rules
  594. #####################################################################
  595. .PHONY: fpc_showinstall fpc_install
  596. ifdef EXTRAINSTALLUNITS
  597. override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))
  598. endif
  599. ifdef INSTALLPPUFILES
  600. ifdef PPUFILES
  601. ifdef inlinux
  602. INSTALLPPULINKFILES=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
  603. INSTALLPPULIBFILES=$(shell $(PPUFILES) -L $(INSTALLPPUFILES))
  604. else
  605. INSTALLPPULINKFILES=$(shell $(PPUFILES) $(INSTALLPPUFILES))
  606. endif
  607. else
  608. INSTALLPPULINKFILES=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES))
  609. endif
  610. endif
  611. fpc_showinstall: $(SHOWINSTALLTARGET)
  612. ifdef INSTALLEXEFILES
  613. @$(ECHO) $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
  614. endif
  615. ifdef INSTALLPPUFILES
  616. @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
  617. ifneq ($(INSTALLPPULINKFILES),)
  618. @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
  619. endif
  620. ifneq ($(INSTALLPPULIBFILES),)
  621. @$(ECHO) $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
  622. endif
  623. endif
  624. ifdef EXTRAINSTALLFILES
  625. @$(ECHO) $(addprefix "\n"$(EXTRAINSTALLDIR)/,$(EXTRAINSTALLFILES))
  626. endif
  627. fpc_install: $(INSTALLTARGET)
  628. # Create UnitInstallFiles
  629. ifdef INSTALLEXEFILES
  630. $(MKDIR) $(BININSTALLDIR)
  631. # Compress the exes if upx is defined
  632. ifdef UPXPROG
  633. -$(UPXPROG) $(INSTALLEXEFILES)
  634. endif
  635. $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR)
  636. endif
  637. ifdef INSTALLPPUFILES
  638. $(MKDIR) $(UNITINSTALLDIR)
  639. $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR)
  640. ifneq ($(INSTALLPPULINKFILES),)
  641. $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
  642. endif
  643. ifneq ($(INSTALLPPULIBFILES),)
  644. $(MKDIR) $(LIBINSTALLDIR)
  645. $(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
  646. endif
  647. endif
  648. ifdef EXTRAINSTALLFILES
  649. $(MKDIR) $(EXTRAINSTALLDIR)
  650. $(INSTALL) $(EXTRAINSTALLFILES) $(EXTRAINSTALLDIR)
  651. endif
  652. #####################################################################
  653. # Source install rules
  654. #####################################################################
  655. .PHONY: fpc_sourceinstall
  656. fpc_sourceinstall: clean
  657. $(MKDIR) $(SOURCEINSTALLDIR)
  658. $(COPYTREE) $(BASEDIR) $(SOURCEINSTALLDIR)
  659. #####################################################################
  660. # Zip
  661. #####################################################################
  662. .PHONY: fpc_zipinstall fpc_zipinstalladd
  663. # Temporary path to pack a file
  664. ifndef PACKDIR
  665. ifndef inlinux
  666. PACKDIR=pack_tmp
  667. else
  668. PACKDIR=/tmp/fpc-pack
  669. endif
  670. endif
  671. # Test dir if none specified
  672. ifndef DESTZIPDIR
  673. DESTZIPDIR=$(BASEDIR)
  674. endif
  675. # Add .zip/.tar.gz extension
  676. ifdef ZIPNAME
  677. ifndef inlinux
  678. override ZIPNAME:=$(ZIPNAME)$(ZIPEXT)
  679. endif
  680. endif
  681. # Note: This will not remove the zipfile first
  682. fpc_zipinstalladd:
  683. ifndef ZIPNAME
  684. @$(ECHO) Please specify ZIPNAME!
  685. @exit
  686. else
  687. $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
  688. ifdef inlinux
  689. gzip -d $(DESTZIPDIR)/$(ZIPNAME).tar.gz
  690. cd $(PACKDIR) ; tar rv --file $(DESTZIPDIR)/$(ZIPNAME).tar * ; cd $(BASEDIR)
  691. gzip $(DESTZIPDIR)/$(ZIPNAME).tar
  692. else
  693. cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
  694. endif
  695. $(DELTREE) $(PACKDIR)
  696. endif
  697. # First remove the zip and then install
  698. fpc_zipinstall:
  699. ifndef ZIPNAME
  700. @$(ECHO) Please specify ZIPNAME!
  701. @exit
  702. else
  703. $(DEL) $(DESTZIPDIR)/$(ZIPNAME)
  704. $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
  705. ifdef inlinux
  706. cd $(PACKDIR) ; tar cvz --file $(DESTZIPDIR)/$(ZIPNAME).tar.gz * ; cd $(BASEDIR)
  707. else
  708. cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
  709. endif
  710. $(DELTREE) $(PACKDIR)
  711. endif
  712. #####################################################################
  713. # Clean rules
  714. #####################################################################
  715. .PHONY: fpc_clean fpc_cleanall
  716. ifdef EXTRACLEANUNITS
  717. override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
  718. endif
  719. ifdef CLEANPPUFILES
  720. ifdef PPUFILES
  721. CLEANPPULINKFILES=$(shell $(PPUFILES) $(CLEANPPUFILES))
  722. else
  723. CLEANPPULINKFILES=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES))
  724. endif
  725. endif
  726. fpc_clean: $(CLEANTARGET)
  727. ifdef CLEANEXEFILES
  728. -$(DEL) $(CLEANEXEFILES)
  729. endif
  730. ifdef CLEANPPUFILES
  731. -$(DEL) $(CLEANPPUFILES)
  732. endif
  733. ifneq ($(CLEANPPULINKFILES),)
  734. -$(DEL) $(CLEANPPULINKFILES)
  735. endif
  736. ifdef EXTRACLEANFILES
  737. -$(DEL) $(EXTRACLEANFILES)
  738. endif
  739. -$(DEL) $(FPCMAKED) $(PPAS) link.res $(REDIRFILE)
  740. fpc_cleanall: $(CLEANTARGET)
  741. ifdef CLEANEXEFILES
  742. -$(DEL) $(CLEANEXEFILES)
  743. endif
  744. -$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  745. -$(DELTREE) *$(SMARTEXT)
  746. -$(DEL) $(FPCMAKED) $(PPAS) link.res $(REDIRFILE)
  747. #####################################################################
  748. # Info rules
  749. #####################################################################
  750. .PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \
  751. fpc_dirinfo
  752. fpc_info: $(INFOTARGET)
  753. fpc_infocfg:
  754. @$(ECHO)
  755. @$(ECHO) == Configuration info ==
  756. @$(ECHO)
  757. @$(ECHO) FPC....... $(FPC)
  758. @$(ECHO) Version... $(FPC_VERSION)
  759. @$(ECHO) CPU....... $(CPU_TARGET)
  760. @$(ECHO) Source.... $(OS_SOURCE)
  761. @$(ECHO) Target.... $(OS_TARGET)
  762. @$(ECHO)
  763. fpc_infoobjects:
  764. @$(ECHO)
  765. @$(ECHO) == Object info ==
  766. @$(ECHO)
  767. @$(ECHO) LoaderObjects..... $(LOADEROBJECTS)
  768. @$(ECHO) UnitObjects....... $(UNITOBJECTS)
  769. @$(ECHO) ExeObjects........ $(EXEOBJECTS)
  770. @$(ECHO)
  771. @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS)
  772. @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES)
  773. @$(ECHO)
  774. @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS)
  775. @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES)
  776. @$(ECHO)
  777. fpc_infoinstall:
  778. @$(ECHO)
  779. @$(ECHO) == Install info ==
  780. @$(ECHO)
  781. ifdef DATE
  782. @$(ECHO) DateStr.............. $(DATESTR)
  783. endif
  784. @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX)
  785. @$(ECHO)
  786. @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR)
  787. @$(ECHO) BinInstallDir........ $(BININSTALLDIR)
  788. @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR)
  789. @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR)
  790. @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR)
  791. @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR)
  792. @$(ECHO) ExtraInstallDir...... $(EXTRAINSTALLDIR)
  793. @$(ECHO)