Makefile 19 KB

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