Makefile 22 KB

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