Makefile 25 KB

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