Makefile 24 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157
  1. #
  2. # Makefile generated by fpcmake v0.99.13 on 1999-11-25 23:51
  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. # Default target
  55. #####################################################################
  56. override OS_TARGET:=linux
  57. override CPU_TARGET:=i386
  58. #####################################################################
  59. # FPC version/target Detection
  60. #####################################################################
  61. # What compiler to use ?
  62. ifndef FPC
  63. ifdef inOS2
  64. export FPC=ppos2$(EXEEXT)
  65. else
  66. export FPC=ppc386$(EXEEXT)
  67. endif
  68. endif
  69. # Target OS
  70. ifndef OS_TARGET
  71. export OS_TARGET:=$(shell $(FPC) -iTO)
  72. endif
  73. # Source OS
  74. ifndef OS_SOURCE
  75. export OS_SOURCE:=$(shell $(FPC) -iSO)
  76. endif
  77. # Target CPU
  78. ifndef CPU_TARGET
  79. export CPU_TARGET:=$(shell $(FPC) -iTP)
  80. endif
  81. # Source CPU
  82. ifndef CPU_SOURCE
  83. export CPU_SOURCE:=$(shell $(FPC) -iSP)
  84. endif
  85. # FPC version
  86. ifndef FPC_VERSION
  87. export FPC_VERSION:=$(shell $(FPC) -iV)
  88. endif
  89. #####################################################################
  90. # Default Settings
  91. #####################################################################
  92. # Release ? Then force OPT and don't use extra opts via commandline
  93. ifndef REDIRFILE
  94. REDIRFILE=log
  95. endif
  96. ifdef RELEASE
  97. override OPT:=-Xs -OG2p3 -n
  98. endif
  99. # Verbose settings (warning,note,info)
  100. ifdef VERBOSE
  101. override OPT+=-vwni
  102. endif
  103. ifdef REDIR
  104. ifndef inlinux
  105. override FPC=redir -eo $(FPC)
  106. endif
  107. # set the verbosity to max
  108. override OPT+=-va
  109. override REDIR:= >> $(REDIRFILE)
  110. endif
  111. #####################################################################
  112. # User Settings
  113. #####################################################################
  114. # Pre Settings
  115. RTL=..
  116. INC=$(RTL)/inc
  117. PROCINC=$(RTL)/$(CPU_TARGET)
  118. UNITPREFIX=rtl
  119. # Paths
  120. OBJPASDIR=$(RTL)/objpas
  121. GRAPHDIR=$(INC)/graph
  122. # Define Go32v2 Units
  123. SYSTEMUNIT=syslinux
  124. # Use new graph unit ?
  125. # NEWGRAPH=YES
  126. # Use LibGGI ?
  127. # Use
  128. #
  129. ifndef USELIBGGI
  130. USELIBGGI=NO
  131. endif
  132. # Targets
  133. override LOADEROBJECTS+=prt0 cprt0 gprt0 cprt21 gprt21
  134. override UNITOBJECTS+=$(SYSTEMUNIT) objpas strings linux ports dos crt objects printer graph sysutils typinfo math cpu mmx getopts heaptrc errors sockets gpm ipc
  135. # Clean
  136. # Install
  137. ZIPTARGET=install
  138. # Defaults
  139. # Directories
  140. ifndef FPCDIR
  141. FPCDIR=.
  142. endif
  143. ifndef PACKAGEDIR
  144. PACKAGEDIR=$(FPCDIR)/packages
  145. endif
  146. ifndef COMPONENTDIR
  147. COMPONENTDIR=$(FPCDIR)/components
  148. endif
  149. override NEEDINCDIR=$(INC) $(PROCINC)
  150. ifndef TARGETDIR
  151. TARGETDIR=.
  152. endif
  153. # Packages
  154. # Libraries
  155. LIBNAME=fprtl
  156. SHAREDLIBOBJECTUNITS=$(SYSTEMUNIT) objpas strings linux ports dos crt objects printer sysutils typinfo math cpu mmx getopts heaptrc errors sockets gpm ipc
  157. # Info
  158. INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall
  159. # Post Settings
  160. SYSTEMPPU=$(addsuffix $(PPUEXT),$(SYSTEMUNIT))
  161. # Get the system independent include file names.
  162. # This will set the following variables :
  163. # SYSINCNAMES
  164. include $(INC)/makefile.inc
  165. SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
  166. # Get the processor dependent include file names.
  167. # This will set the following variables :
  168. # CPUINCNAMES
  169. include $(PROCINC)/makefile.cpu
  170. SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
  171. # Put system unit dependencies together.
  172. SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
  173. #####################################################################
  174. # Default Directories
  175. #####################################################################
  176. # Base dir
  177. ifdef PWD
  178. BASEDIR:=$(shell $(PWD))
  179. else
  180. BASEDIR=.
  181. endif
  182. # this can be set to 'rtl' when the RTL units are installed
  183. ifndef UNITPREFIX
  184. UNITPREFIX=units
  185. endif
  186. # set the prefix directory where to install everything
  187. ifndef PREFIXINSTALLDIR
  188. ifdef inlinux
  189. export PREFIXINSTALLDIR=/usr
  190. else
  191. export PREFIXINSTALLDIR=/pp
  192. endif
  193. endif
  194. # create fcldir,rtldir,unitdir
  195. ifdef FPCDIR
  196. ifneq ($(FPCDIR),.)
  197. override RTLDIR=$(FPCDIR)/rtl/$(OS_TARGET)
  198. override FCLDIR=$(FPCDIR)/fcl/$(OS_TARGET)
  199. override UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
  200. endif
  201. endif
  202. #####################################################################
  203. # Install Directories
  204. #####################################################################
  205. # set the base directory where to install everything
  206. ifndef BASEINSTALLDIR
  207. ifdef inlinux
  208. BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
  209. else
  210. BASEINSTALLDIR=$(PREFIXINSTALLDIR)
  211. endif
  212. endif
  213. # set the directory where to install the binaries
  214. ifndef BININSTALLDIR
  215. ifdef inlinux
  216. BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
  217. else
  218. BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
  219. endif
  220. endif
  221. # set the directory where to install the units.
  222. ifndef UNITINSTALLDIR
  223. UNITINSTALLDIR=$(BASEINSTALLDIR)/$(UNITPREFIX)/$(OS_TARGET)
  224. endif
  225. # Where to install shared libraries
  226. ifndef LIBINSTALLDIR
  227. ifdef inlinux
  228. LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
  229. else
  230. LIBINSTALLDIR=$(UNITINSTALLDIR)
  231. endif
  232. endif
  233. # Where the source files will be stored
  234. ifndef SOURCEINSTALLDIR
  235. ifdef inlinux
  236. SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
  237. else
  238. SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
  239. endif
  240. endif
  241. # Where the doc files will be stored
  242. ifndef DOCINSTALLDIR
  243. ifdef inlinux
  244. DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc/$(FPC_VERSION)
  245. else
  246. DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
  247. endif
  248. endif
  249. # Where the some extra (data)files will be stored
  250. ifndef EXTRAINSTALLDIR
  251. EXTRAINSTALLDIR=$(BASEINSTALLDIR)
  252. endif
  253. #####################################################################
  254. # Compiler Command Line
  255. #####################################################################
  256. # Load commandline OPTDEF and add FPC_CPU define
  257. override FPCOPTDEF:=-d$(CPU_TARGET)
  258. # Load commandline OPT and add target and unit dir to be sure
  259. ifneq ($(OS_TARGET),$(OS_SOURCE))
  260. override FPCOPT+=-T$(OS_TARGET)
  261. endif
  262. ifdef RTLDIR
  263. override FPCOPT+=-Fu$(RTLDIR)
  264. endif
  265. ifdef UNITSDIR
  266. override FPCOPT+=-Fu$(UNITSDIR)
  267. endif
  268. ifdef NEEDINCDIR
  269. override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))
  270. endif
  271. # Target dirs
  272. ifdef TARGETDIR
  273. override FPCOPT+=-FE$(TARGETDIR)
  274. endif
  275. # Smartlinking
  276. ifdef SMARTLINK
  277. override FPCOPT+=-CX
  278. endif
  279. # Debug
  280. ifdef DEBUG
  281. override FPCOPT+=-g
  282. endif
  283. # Add commandline options
  284. ifdef OPT
  285. override FPCOPT+=$(OPT)
  286. endif
  287. ifdef UNITDIR
  288. override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
  289. endif
  290. ifdef LIBDIR
  291. override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
  292. endif
  293. ifdef OBJDIR
  294. override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
  295. endif
  296. ifdef INCDIR
  297. override FPCOPT+=$(addprefix -Fi,$(INCDIR))
  298. endif
  299. # Add defines from FPCOPTDEF to FPCOPT
  300. ifdef FPCOPTDEF
  301. override FPCOPT+=$(FPCOPTDEF)
  302. endif
  303. # Error file ?
  304. ifdef ERRORFILE
  305. override FPCOPT+=-Fr$(ERRORFILE)
  306. endif
  307. # Was a config file specified ?
  308. ifdef CFGFILE
  309. override FPCOPT+=@$(CFGFILE)
  310. endif
  311. override COMPILER=$(FPC) $(FPCOPT)
  312. #####################################################################
  313. # Shell tools
  314. #####################################################################
  315. # To copy pograms
  316. ifndef COPY
  317. export COPY:=cp -fp
  318. endif
  319. # Copy a whole tree
  320. ifndef COPYTREE
  321. export COPYTREE:=cp -rfp
  322. endif
  323. # To move pograms
  324. ifndef MOVE
  325. export MOVE:=mv -f
  326. endif
  327. # Check delete program
  328. ifndef DEL
  329. export DEL:=rm -f
  330. endif
  331. # Check deltree program
  332. ifndef DELTREE
  333. export DELTREE:=rm -rf
  334. endif
  335. # To install files
  336. ifndef INSTALL
  337. ifdef inlinux
  338. export INSTALL:=install -m 644
  339. else
  340. export INSTALL:=$(COPY)
  341. endif
  342. endif
  343. # To install programs
  344. ifndef INSTALLEXE
  345. ifdef inlinux
  346. export INSTALLEXE:=install -m 755
  347. else
  348. export INSTALLEXE:=$(COPY)
  349. endif
  350. endif
  351. # To make a directory.
  352. ifndef MKDIR
  353. ifdef inlinux
  354. export MKDIR:=install -m 755 -d
  355. else
  356. export MKDIR:=ginstall -m 755 -d
  357. endif
  358. endif
  359. #####################################################################
  360. # Default Tools
  361. #####################################################################
  362. # file used to check if a package is compiled
  363. ifndef FPCMAKED
  364. FPCMAKED=fpcmaked
  365. endif
  366. # assembler, redefine it if cross compiling
  367. ifndef AS
  368. AS=as
  369. endif
  370. # linker, but probably not used
  371. ifndef LD
  372. LD=ld
  373. endif
  374. # ppas.bat / ppas.sh
  375. ifdef inlinux
  376. PPAS=ppas.sh
  377. else
  378. ifdef inOS2
  379. PPAS=ppas.cmd
  380. else
  381. PPAS=ppas.bat
  382. endif
  383. endif
  384. # also call ppas if with command option -s
  385. ifeq (,$(findstring -s ,$(COMPILER)))
  386. EXECPPAS=
  387. else
  388. EXECPPAS=@$(PPAS)
  389. endif
  390. # ldconfig to rebuild .so cache
  391. ifdef inlinux
  392. LDCONFIG=ldconfig
  393. else
  394. LDCONFIG=
  395. endif
  396. # echo
  397. ifndef ECHO
  398. ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
  399. ifeq ($(ECHO),)
  400. export ECHO:=echo
  401. else
  402. export ECHO:=$(firstword $(ECHO))
  403. endif
  404. endif
  405. # ppdep
  406. ifndef PPDEP
  407. PPDEP:=$(strip $(wildcard $(addsuffix /ppdep$(EXEEXT),$(SEARCHPATH))))
  408. ifeq ($(PPDEP),)
  409. PPDEP=
  410. else
  411. export PPDEP:=$(firstword $(PPDEP))
  412. endif
  413. endif
  414. # ppumove
  415. ifndef PPUMOVE
  416. PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(EXEEXT),$(SEARCHPATH))))
  417. ifeq ($(PPUMOVE),)
  418. PPUMOVE=
  419. else
  420. export PPUMOVE:=$(firstword $(PPUMOVE))
  421. endif
  422. endif
  423. # ppufiles
  424. ifndef PPUFILES
  425. PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
  426. ifeq ($(PPUFILES),)
  427. PPUFILES=
  428. else
  429. export PPUFILES:=$(firstword $(PPUFILES))
  430. endif
  431. endif
  432. # Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
  433. # upx uses that one itself (PFV)
  434. ifndef UPXPROG
  435. ifeq ($(OS_TARGET),go32v2)
  436. UPXPROG:=1
  437. endif
  438. ifeq ($(OS_TARGET),win32)
  439. UPXPROG:=1
  440. endif
  441. ifdef UPXPROG
  442. UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(SEARCHPATH))))
  443. ifeq ($(UPXPROG),)
  444. UPXPROG=
  445. else
  446. export UPXPROG:=$(firstword $(UPXPROG))
  447. endif
  448. else
  449. UPXPROG=
  450. endif
  451. endif
  452. # gdate/date
  453. ifndef DATE
  454. DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
  455. ifeq ($(DATE),)
  456. DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
  457. ifeq ($(DATE),)
  458. DATE=
  459. else
  460. export DATE:=$(firstword $(DATE))
  461. endif
  462. else
  463. export DATE:=$(firstword $(DATE))
  464. endif
  465. endif
  466. ifdef DATE
  467. DATESTR:=$(shell $(DATE) +%Y%m%d)
  468. else
  469. DATESTR=
  470. endif
  471. # ZipProg, you can't use Zip as the var name (PFV)
  472. ifndef ZIPPROG
  473. ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
  474. ifeq ($(ZIPPROG),)
  475. ZIPPROG=
  476. else
  477. export ZIPPROG:=$(firstword $(ZIPPROG)) -D9 -r
  478. endif
  479. endif
  480. ifndef ZIPEXT
  481. ZIPEXT=.zip
  482. endif
  483. #####################################################################
  484. # Default extensions
  485. #####################################################################
  486. # Default needed extensions (Go32v2,Linux)
  487. LOADEREXT=.as
  488. PPLEXT=.ppl
  489. PPUEXT=.ppu
  490. OEXT=.o
  491. ASMEXT=.s
  492. SMARTEXT=.sl
  493. STATICLIBEXT=.a
  494. SHAREDLIBEXT=.so
  495. PACKAGESUFFIX=
  496. # Go32v1
  497. ifeq ($(OS_TARGET),go32v1)
  498. PPUEXT=.pp1
  499. OEXT=.o1
  500. ASMEXT=.s1
  501. SMARTEXT=.sl1
  502. STATICLIBEXT=.a1
  503. SHAREDLIBEXT=.so1
  504. PACKAGESUFFIX=v1
  505. endif
  506. # Go32v2
  507. ifeq ($(OS_TARGET),go32v2)
  508. PACKAGESUFFIX=go32
  509. endif
  510. # Linux
  511. ifeq ($(OS_TARGET),linux)
  512. PACKAGESUFFIX=linux
  513. endif
  514. # Win32
  515. ifeq ($(OS_TARGET),win32)
  516. PPUEXT=.ppw
  517. OEXT=.ow
  518. ASMEXT=.sw
  519. SMARTEXT=.slw
  520. STATICLIBEXT=.aw
  521. SHAREDLIBEXT=.dll
  522. PACKAGESUFFIX=win32
  523. endif
  524. # OS/2
  525. ifeq ($(OS_TARGET),os2)
  526. PPUEXT=.ppo
  527. ASMEXT=.so2
  528. OEXT=.oo2
  529. SMARTEXT=.so
  530. STATICLIBEXT=.ao2
  531. SHAREDLIBEXT=.dll
  532. PACKAGESUFFIX=os2
  533. endif
  534. # library prefix
  535. LIBPREFIX=lib
  536. ifeq ($(OS_TARGET),go32v2)
  537. LIBPREFIX=
  538. endif
  539. ifeq ($(OS_TARGET),go32v1)
  540. LIBPREFIX=
  541. endif
  542. # determine which .pas extension is used
  543. ifndef PASEXT
  544. ifdef EXEOBJECTS
  545. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
  546. else
  547. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
  548. endif
  549. ifeq ($(TESTPAS),)
  550. PASEXT=.pp
  551. else
  552. PASEXT=.pas
  553. endif
  554. endif
  555. #####################################################################
  556. # Standard rules
  557. #####################################################################
  558. all: fpc_all
  559. debug: fpc_debug
  560. smart: fpc_smart
  561. shared: fpc_shared
  562. showinstall: fpc_showinstall
  563. install: fpc_install
  564. sourceinstall: fpc_sourceinstall
  565. zipinstall: fpc_zipinstall
  566. zipinstalladd: fpc_zipinstalladd
  567. clean: fpc_clean
  568. cleanall: fpc_cleanall
  569. info: fpc_info
  570. .PHONY: all debug smart shared showinstall install sourceinstall zipinstall zipinstalladd clean cleanall info
  571. #####################################################################
  572. # Package depends
  573. #####################################################################
  574. #####################################################################
  575. # Loaders
  576. #####################################################################
  577. .PHONY: fpc_loaders
  578. %$(OEXT): %$(LOADEREXT)
  579. $(AS) -o $*$(OEXT) $<
  580. override ALLTARGET+=fpc_loaders
  581. override CLEANTARGET+=fpc_loaders_clean
  582. override SHOWINSTALLTARGET+=fpc_loaders_showinstall
  583. override INSTALLTARGET+=fpc_loaders_install
  584. override LOADEROFILES=$(addsuffix $(OEXT),$(LOADEROBJECTS))
  585. fpc_loaders: $(LOADEROFILES)
  586. fpc_loaders_clean:
  587. -$(DEL) $(LOADEROFILES)
  588. fpc_loaders_showinstall:
  589. @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(LOADEROFILES))
  590. fpc_loaders_install:
  591. $(MKDIR) $(UNITINSTALLDIR)
  592. $(INSTALL) $(LOADEROFILES) $(UNITINSTALLDIR)
  593. #####################################################################
  594. # Units
  595. #####################################################################
  596. .PHONY: fpc_units
  597. override ALLTARGET+=fpc_units
  598. override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
  599. override INSTALLPPUFILES+=$(UNITPPUFILES)
  600. override CLEANPPUFILES+=$(UNITPPUFILES)
  601. fpc_units: $(UNITPPUFILES)
  602. #####################################################################
  603. # General compile rules
  604. #####################################################################
  605. .PHONY: fpc_all fpc_debug
  606. $(FPCMAKED):
  607. @$(ECHO) Compiled > $(FPCMAKED)
  608. fpc_all: $(addsuffix _package,$(COMPILEPACKAGES)) \
  609. $(addsuffix _component,$(COMPILECOMPONENTS)) \
  610. $(ALLTARGET) $(FPCMAKED)
  611. fpc_debug:
  612. $(MAKE) all DEBUG=1
  613. # General compile rules, available for both possible PASEXT
  614. .SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
  615. %$(PPUEXT): %.pp
  616. $(COMPILER) $< $(REDIR)
  617. $(EXECPASS)
  618. %$(PPUEXT): %.pas
  619. $(COMPILER) $< $(REDIR)
  620. $(EXECPASS)
  621. %$(EXEEXT): %.pp
  622. $(COMPILER) $< $(REDIR)
  623. $(EXECPASS)
  624. %$(EXEEXT): %.pas
  625. $(COMPILER) $< $(REDIR)
  626. $(EXECPASS)
  627. #####################################################################
  628. # Library
  629. #####################################################################
  630. .PHONY: fpc_smart fpc_shared
  631. # Default sharedlib units are all unit objects
  632. ifndef SHAREDLIBUNITOBJECTS
  633. SHAREDLIBUNITOBJECTS=$(UNITOBJECTS)
  634. endif
  635. fpc_smart:
  636. $(MAKE) all SMARTLINK=1
  637. fpc_shared: all
  638. ifdef inlinux
  639. ifndef LIBNAME
  640. @$(ECHO) LIBNAME not set
  641. else
  642. $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
  643. endif
  644. else
  645. @$(ECHO) Shared Libraries not supported
  646. endif
  647. #####################################################################
  648. # Install rules
  649. #####################################################################
  650. .PHONY: fpc_showinstall fpc_install
  651. ifdef EXTRAINSTALLUNITS
  652. override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))
  653. endif
  654. ifdef INSTALLPPUFILES
  655. ifdef PPUFILES
  656. ifdef inlinux
  657. INSTALLPPULINKFILES=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
  658. INSTALLPPULIBFILES=$(shell $(PPUFILES) -L $(INSTALLPPUFILES))
  659. else
  660. INSTALLPPULINKFILES=$(shell $(PPUFILES) $(INSTALLPPUFILES))
  661. endif
  662. else
  663. INSTALLPPULINKFILES=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES))
  664. endif
  665. endif
  666. fpc_showinstall: $(SHOWINSTALLTARGET)
  667. ifdef INSTALLEXEFILES
  668. @$(ECHO) $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
  669. endif
  670. ifdef INSTALLPPUFILES
  671. @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
  672. ifneq ($(INSTALLPPULINKFILES),)
  673. @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
  674. endif
  675. ifneq ($(INSTALLPPULIBFILES),)
  676. @$(ECHO) $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
  677. endif
  678. endif
  679. ifdef EXTRAINSTALLFILES
  680. @$(ECHO) $(addprefix "\n"$(EXTRAINSTALLDIR)/,$(EXTRAINSTALLFILES))
  681. endif
  682. fpc_install: $(INSTALLTARGET)
  683. # Create UnitInstallFiles
  684. ifdef INSTALLEXEFILES
  685. $(MKDIR) $(BININSTALLDIR)
  686. # Compress the exes if upx is defined
  687. ifdef UPXPROG
  688. -$(UPXPROG) $(INSTALLEXEFILES)
  689. endif
  690. $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR)
  691. endif
  692. ifdef INSTALLPPUFILES
  693. $(MKDIR) $(UNITINSTALLDIR)
  694. $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR)
  695. ifneq ($(INSTALLPPULINKFILES),)
  696. $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
  697. endif
  698. ifneq ($(INSTALLPPULIBFILES),)
  699. $(MKDIR) $(LIBINSTALLDIR)
  700. $(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
  701. endif
  702. endif
  703. ifdef EXTRAINSTALLFILES
  704. $(MKDIR) $(EXTRAINSTALLDIR)
  705. $(INSTALL) $(EXTRAINSTALLFILES) $(EXTRAINSTALLDIR)
  706. endif
  707. #####################################################################
  708. # Source install rules
  709. #####################################################################
  710. .PHONY: fpc_sourceinstall
  711. fpc_sourceinstall: clean
  712. $(MKDIR) $(SOURCEINSTALLDIR)
  713. $(COPYTREE) $(BASEDIR) $(SOURCEINSTALLDIR)
  714. #####################################################################
  715. # Zip
  716. #####################################################################
  717. .PHONY: fpc_zipinstall fpc_zipinstalladd
  718. # Temporary path to pack a file
  719. ifndef PACKDIR
  720. ifndef inlinux
  721. PACKDIR=pack_tmp
  722. else
  723. PACKDIR=/tmp/fpc-pack
  724. endif
  725. endif
  726. # Test dir if none specified
  727. ifndef DESTZIPDIR
  728. DESTZIPDIR=$(BASEDIR)
  729. endif
  730. # Add .zip/.tar.gz extension
  731. ifdef ZIPNAME
  732. ifndef inlinux
  733. override ZIPNAME:=$(ZIPNAME)$(ZIPEXT)
  734. endif
  735. endif
  736. # Note: This will not remove the zipfile first
  737. fpc_zipinstalladd:
  738. ifndef ZIPNAME
  739. @$(ECHO) Please specify ZIPNAME!
  740. @exit
  741. else
  742. $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
  743. ifdef inlinux
  744. gzip -d $(DESTZIPDIR)/$(ZIPNAME).tar.gz
  745. cd $(PACKDIR) ; tar rv --file $(DESTZIPDIR)/$(ZIPNAME).tar * ; cd $(BASEDIR)
  746. gzip $(DESTZIPDIR)/$(ZIPNAME).tar
  747. else
  748. cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
  749. endif
  750. $(DELTREE) $(PACKDIR)
  751. endif
  752. # First remove the zip and then install
  753. fpc_zipinstall:
  754. ifndef ZIPNAME
  755. @$(ECHO) Please specify ZIPNAME!
  756. @exit
  757. else
  758. $(DEL) $(DESTZIPDIR)/$(ZIPNAME)
  759. $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
  760. ifdef inlinux
  761. cd $(PACKDIR) ; tar cvz --file $(DESTZIPDIR)/$(ZIPNAME).tar.gz * ; cd $(BASEDIR)
  762. else
  763. cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
  764. endif
  765. $(DELTREE) $(PACKDIR)
  766. endif
  767. #####################################################################
  768. # Clean rules
  769. #####################################################################
  770. .PHONY: fpc_clean fpc_cleanall
  771. ifdef EXTRACLEANUNITS
  772. override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
  773. endif
  774. ifdef CLEANPPUFILES
  775. ifdef PPUFILES
  776. CLEANPPULINKFILES=$(shell $(PPUFILES) $(CLEANPPUFILES))
  777. else
  778. CLEANPPULINKFILES=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES))
  779. endif
  780. endif
  781. fpc_clean: $(CLEANTARGET)
  782. ifdef CLEANEXEFILES
  783. -$(DEL) $(CLEANEXEFILES)
  784. endif
  785. ifdef CLEANPPUFILES
  786. -$(DEL) $(CLEANPPUFILES)
  787. endif
  788. ifneq ($(CLEANPPULINKFILES),)
  789. -$(DEL) $(CLEANPPULINKFILES)
  790. endif
  791. ifdef EXTRACLEANFILES
  792. -$(DEL) $(EXTRACLEANFILES)
  793. endif
  794. -$(DEL) $(FPCMAKED) $(PPAS) link.res $(REDIRFILE)
  795. fpc_cleanall: $(CLEANTARGET)
  796. ifdef CLEANEXEFILES
  797. -$(DEL) $(CLEANEXEFILES)
  798. endif
  799. -$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  800. -$(DELTREE) *$(SMARTEXT)
  801. -$(DEL) $(FPCMAKED) $(PPAS) link.res $(REDIRFILE)
  802. #####################################################################
  803. # Info rules
  804. #####################################################################
  805. .PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \
  806. fpc_dirinfo
  807. fpc_info: $(INFOTARGET)
  808. fpc_infocfg:
  809. @$(ECHO)
  810. @$(ECHO) == Configuration info ==
  811. @$(ECHO)
  812. @$(ECHO) FPC....... $(FPC)
  813. @$(ECHO) Version... $(FPC_VERSION)
  814. @$(ECHO) CPU....... $(CPU_TARGET)
  815. @$(ECHO) Source.... $(OS_SOURCE)
  816. @$(ECHO) Target.... $(OS_TARGET)
  817. @$(ECHO)
  818. fpc_infoobjects:
  819. @$(ECHO)
  820. @$(ECHO) == Object info ==
  821. @$(ECHO)
  822. @$(ECHO) LoaderObjects..... $(LOADEROBJECTS)
  823. @$(ECHO) UnitObjects....... $(UNITOBJECTS)
  824. @$(ECHO) ExeObjects........ $(EXEOBJECTS)
  825. @$(ECHO)
  826. @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS)
  827. @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES)
  828. @$(ECHO)
  829. @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS)
  830. @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES)
  831. @$(ECHO)
  832. fpc_infoinstall:
  833. @$(ECHO)
  834. @$(ECHO) == Install info ==
  835. @$(ECHO)
  836. ifdef DATE
  837. @$(ECHO) DateStr.............. $(DATESTR)
  838. endif
  839. @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX)
  840. @$(ECHO)
  841. @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR)
  842. @$(ECHO) BinInstallDir........ $(BININSTALLDIR)
  843. @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR)
  844. @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR)
  845. @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR)
  846. @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR)
  847. @$(ECHO) ExtraInstallDir...... $(EXTRAINSTALLDIR)
  848. @$(ECHO)
  849. #####################################################################
  850. # Users rules
  851. #####################################################################
  852. vpath %$(PASEXT) $(INC) $(PROCINC)
  853. #
  854. # Loaders
  855. #
  856. prt0$(OEXT) : $(CPU_TARGET)/prt0.as
  857. $(AS) -o prt0$(OEXT) $(CPU_TARGET)/prt0.as
  858. gprt0$(OEXT) : $(CPU_TARGET)/gprt0.as
  859. $(AS) -o gprt0$(OEXT) $(CPU_TARGET)/gprt0.as
  860. cprt0$(OEXT) : $(CPU_TARGET)/cprt0.as
  861. $(AS) -o cprt0$(OEXT) $(CPU_TARGET)/cprt0.as
  862. cprt21$(OEXT) : $(CPU_TARGET)/cprt21.as
  863. $(AS) -o cprt21$(OEXT) $(CPU_TARGET)/cprt21.as
  864. # still need to use gprt1, because gprt21 crashes
  865. gprt21$(OEXT) : $(CPU_TARGET)/gprt0.as
  866. $(AS) -o gprt21$(OEXT) $(CPU_TARGET)/gprt0.as
  867. #
  868. # System Units (System, Objpas, Strings)
  869. #
  870. $(SYSTEMPPU) : syslinux.pp sysconst.inc systypes.inc syscalls.inc $(SYSDEPS)
  871. $(COMPILER) -Us -Sg syslinux.pp $(REDIR)
  872. objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMPPU)
  873. $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp $(REDIR)
  874. strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
  875. $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
  876. $(SYSTEMPPU)
  877. #
  878. # System Dependent Units
  879. #
  880. linux$(PPUEXT) : linux.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
  881. syscalls.inc systypes.inc sysconst.inc $(SYSTEMPPU)
  882. ports$(PPUEXT) : ports.pp linux$(PPUEXT) objpas$(PPUEXT)
  883. #
  884. # TP7 Compatible RTL Units
  885. #
  886. dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
  887. linux$(PPUEXT) $(SYSTEMPPU)
  888. crt$(PPUEXT) : crt.pp $(INC)/textrec.inc linux$(PPUEXT) $(SYSTEMPPU)
  889. objects$(PPUEXT) : $(INC)/objects.pp objinc.inc $(SYSTEMPPU)
  890. printer$(PPUEXT) : printer.pp $(INC)/textrec.inc linux$(PPUEXT) $(SYSTEMPPU)
  891. #
  892. # Graph
  893. #
  894. ifndef NEWGRAPH
  895. graph$(PPUEXT) : graph.pp linux$(PPUEXT) objects$(PPUEXT)
  896. else
  897. include $(GRAPHDIR)/makefile.inc
  898. GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
  899. ifeq ($(USELIBGGI),YES)
  900. GRAPHINCDEPS+=ggigraph.inc
  901. override COMPILER+=-dUSEGGI -S2
  902. else
  903. GRAPHINCDEPS+=vgagraph.inc
  904. endif
  905. graph$(PPUEXT) : $(GRAPHDIR)/graph.pp $(SYSTEMPPU) $(GRAPHINCDEPS) graph.inc
  906. $(COMPILER) -I$(GRAPHDIR) $(GRAPHDIR)/graph.pp $(REDIR)
  907. endif
  908. #
  909. # Delphi Compatible Units
  910. #
  911. sysutils$(PPUEXT) : $(OBJPASDIR)/sysutils.pp $(wildcard $(OBJPASDIR)/*.inc) \
  912. filutil.inc disk.inc objpas$(PPUEXT) linux$(PPUEXT)
  913. $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/sysutils.pp $(REDIR)
  914. typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
  915. $(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp $(REDIR)
  916. math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
  917. $(COMPILER) $(OBJPASDIR)/math.pp $(REDIR)
  918. gettext$(PPUEXT): $(OBJPASDIR)/gettext.pp objpas$(PPUEXT) sysutils$(PPUEXT)
  919. $(COMPILER) $(OBJPASDIR)/gettext.pp $(REDIR)
  920. #
  921. # Other system-independent RTL Units
  922. #
  923. cpu$(PPUEXT) : $(PROCINC)/cpu.pp $(SYSTEMPPU)
  924. mmx$(PPUEXT) : $(PROCINC)/mmx.pp cpu$(PPUEXT) $(SYSTEMPPU)
  925. getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMPPU)
  926. heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMPPU)
  927. $(COMPILER) -Sg $(INC)/heaptrc.pp $(REDIR)
  928. #
  929. # Other system-dependent RTL Units
  930. #
  931. sockets$(PPUEXT) : sockets.pp $(INC)/textrec.inc $(INC)/filerec.inc \
  932. linux$(PPUEXT) $(SYSTEMPPU)
  933. errors$(PPUEXT) : errors.pp strings$(PPUEXT) $(SYSTEMPPU)
  934. ipc$(PPUEXT) : ipc.pp linux$(PPUEXT) $(SYSTEMPPU)