Makefile 18 KB

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