Makefile 19 KB

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