Makefile 18 KB

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