Makefile 24 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171
  1. #
  2. # Makefile generated by fpcmake v0.99.13 on 1999-12-06 18:33
  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. # file used to check if a package is compiled
  376. ifndef FPCMAKED
  377. FPCMAKED=fpcmaked
  378. endif
  379. # assembler, redefine it if cross compiling
  380. ifndef AS
  381. AS=as
  382. endif
  383. # linker, but probably not used
  384. ifndef LD
  385. LD=ld
  386. endif
  387. # ppas.bat / ppas.sh
  388. ifdef inlinux
  389. PPAS=ppas.sh
  390. else
  391. ifdef inOS2
  392. PPAS=ppas.cmd
  393. else
  394. PPAS=ppas.bat
  395. endif
  396. endif
  397. # also call ppas if with command option -s
  398. ifeq (,$(findstring -s ,$(COMPILER)))
  399. EXECPPAS=
  400. else
  401. EXECPPAS:=@$(PPAS)
  402. endif
  403. # ldconfig to rebuild .so cache
  404. ifdef inlinux
  405. LDCONFIG=ldconfig
  406. else
  407. LDCONFIG=
  408. endif
  409. # echo
  410. ifndef ECHO
  411. ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
  412. ifeq ($(ECHO),)
  413. export ECHO:=echo
  414. else
  415. export ECHO:=$(firstword $(ECHO))
  416. endif
  417. endif
  418. # ppdep
  419. ifndef PPDEP
  420. PPDEP:=$(strip $(wildcard $(addsuffix /ppdep$(EXEEXT),$(SEARCHPATH))))
  421. ifeq ($(PPDEP),)
  422. PPDEP=
  423. else
  424. export PPDEP:=$(firstword $(PPDEP))
  425. endif
  426. endif
  427. # ppumove
  428. ifndef PPUMOVE
  429. PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(EXEEXT),$(SEARCHPATH))))
  430. ifeq ($(PPUMOVE),)
  431. PPUMOVE=
  432. else
  433. export PPUMOVE:=$(firstword $(PPUMOVE))
  434. endif
  435. endif
  436. # ppufiles
  437. ifndef PPUFILES
  438. PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
  439. ifeq ($(PPUFILES),)
  440. PPUFILES=
  441. else
  442. export PPUFILES:=$(firstword $(PPUFILES))
  443. endif
  444. endif
  445. # Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
  446. # upx uses that one itself (PFV)
  447. ifndef UPXPROG
  448. ifeq ($(OS_TARGET),go32v2)
  449. UPXPROG:=1
  450. endif
  451. ifeq ($(OS_TARGET),win32)
  452. UPXPROG:=1
  453. endif
  454. ifdef UPXPROG
  455. UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(SEARCHPATH))))
  456. ifeq ($(UPXPROG),)
  457. UPXPROG=
  458. else
  459. export UPXPROG:=$(firstword $(UPXPROG))
  460. endif
  461. else
  462. UPXPROG=
  463. endif
  464. endif
  465. # gdate/date
  466. ifndef DATE
  467. DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
  468. ifeq ($(DATE),)
  469. DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
  470. ifeq ($(DATE),)
  471. DATE=
  472. else
  473. export DATE:=$(firstword $(DATE))
  474. endif
  475. else
  476. export DATE:=$(firstword $(DATE))
  477. endif
  478. endif
  479. ifdef DATE
  480. DATESTR:=$(shell $(DATE) +%Y%m%d)
  481. else
  482. DATESTR=
  483. endif
  484. # ZipProg, you can't use Zip as the var name (PFV)
  485. ifndef ZIPPROG
  486. ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
  487. ifeq ($(ZIPPROG),)
  488. ZIPPROG=
  489. else
  490. export ZIPPROG:=$(firstword $(ZIPPROG)) -D9 -r
  491. endif
  492. endif
  493. ifndef ZIPEXT
  494. ZIPEXT=.zip
  495. endif
  496. #####################################################################
  497. # Default extensions
  498. #####################################################################
  499. # Default needed extensions (Go32v2,Linux)
  500. LOADEREXT=.as
  501. PPLEXT=.ppl
  502. PPUEXT=.ppu
  503. OEXT=.o
  504. ASMEXT=.s
  505. SMARTEXT=.sl
  506. STATICLIBEXT=.a
  507. SHAREDLIBEXT=.so
  508. PACKAGESUFFIX=
  509. # Go32v1
  510. ifeq ($(OS_TARGET),go32v1)
  511. PPUEXT=.pp1
  512. OEXT=.o1
  513. ASMEXT=.s1
  514. SMARTEXT=.sl1
  515. STATICLIBEXT=.a1
  516. SHAREDLIBEXT=.so1
  517. PACKAGESUFFIX=v1
  518. endif
  519. # Go32v2
  520. ifeq ($(OS_TARGET),go32v2)
  521. PACKAGESUFFIX=go32
  522. endif
  523. # Linux
  524. ifeq ($(OS_TARGET),linux)
  525. PACKAGESUFFIX=linux
  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. endif
  537. # OS/2
  538. ifeq ($(OS_TARGET),os2)
  539. PPUEXT=.ppo
  540. ASMEXT=.so2
  541. OEXT=.oo2
  542. SMARTEXT=.so
  543. STATICLIBEXT=.ao2
  544. SHAREDLIBEXT=.dll
  545. PACKAGESUFFIX=os2
  546. endif
  547. # library prefix
  548. LIBPREFIX=lib
  549. ifeq ($(OS_TARGET),go32v2)
  550. LIBPREFIX=
  551. endif
  552. ifeq ($(OS_TARGET),go32v1)
  553. LIBPREFIX=
  554. endif
  555. # determine which .pas extension is used
  556. ifndef PASEXT
  557. ifdef EXEOBJECTS
  558. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
  559. else
  560. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
  561. endif
  562. ifeq ($(TESTPAS),)
  563. PASEXT=.pp
  564. else
  565. PASEXT=.pas
  566. endif
  567. endif
  568. #####################################################################
  569. # Standard rules
  570. #####################################################################
  571. all: fpc_all
  572. debug: fpc_debug
  573. smart: fpc_smart
  574. shared: fpc_shared
  575. showinstall: fpc_showinstall
  576. install: fpc_install
  577. sourceinstall: fpc_sourceinstall
  578. zipinstall: fpc_zipinstall
  579. zipinstalladd: fpc_zipinstalladd
  580. clean: fpc_clean
  581. cleanall: fpc_cleanall
  582. info: fpc_info
  583. .PHONY: all debug smart shared showinstall install sourceinstall zipinstall zipinstalladd clean cleanall info
  584. #####################################################################
  585. # Package depends
  586. #####################################################################
  587. #####################################################################
  588. # Loaders
  589. #####################################################################
  590. .PHONY: fpc_loaders
  591. %$(OEXT): %$(LOADEREXT)
  592. $(AS) -o $*$(OEXT) $<
  593. override ALLTARGET+=fpc_loaders
  594. override CLEANTARGET+=fpc_loaders_clean
  595. override SHOWINSTALLTARGET+=fpc_loaders_showinstall
  596. override INSTALLTARGET+=fpc_loaders_install
  597. override LOADEROFILES:=$(addsuffix $(OEXT),$(LOADEROBJECTS))
  598. fpc_loaders: $(LOADEROFILES)
  599. fpc_loaders_clean:
  600. -$(DEL) $(LOADEROFILES)
  601. fpc_loaders_showinstall:
  602. @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(LOADEROFILES))
  603. fpc_loaders_install:
  604. $(MKDIR) $(UNITINSTALLDIR)
  605. $(INSTALL) $(LOADEROFILES) $(UNITINSTALLDIR)
  606. #####################################################################
  607. # Units
  608. #####################################################################
  609. .PHONY: fpc_units
  610. override ALLTARGET+=fpc_units
  611. override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
  612. override INSTALLPPUFILES+=$(UNITPPUFILES)
  613. override CLEANPPUFILES+=$(UNITPPUFILES)
  614. fpc_units: $(UNITPPUFILES)
  615. #####################################################################
  616. # General compile rules
  617. #####################################################################
  618. .PHONY: fpc_all fpc_debug
  619. $(FPCMAKED):
  620. @$(ECHO) Compiled > $(FPCMAKED)
  621. fpc_all: $(addsuffix _package,$(COMPILEPACKAGES)) \
  622. $(addsuffix _component,$(COMPILECOMPONENTS)) \
  623. $(ALLTARGET) $(FPCMAKED)
  624. fpc_debug:
  625. $(MAKE) all DEBUG=1
  626. # General compile rules, available for both possible PASEXT
  627. .SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
  628. %$(PPUEXT): %.pp
  629. $(COMPILER) $< $(REDIR)
  630. $(EXECPASS)
  631. %$(PPUEXT): %.pas
  632. $(COMPILER) $< $(REDIR)
  633. $(EXECPASS)
  634. %$(EXEEXT): %.pp
  635. $(COMPILER) $< $(REDIR)
  636. $(EXECPASS)
  637. %$(EXEEXT): %.pas
  638. $(COMPILER) $< $(REDIR)
  639. $(EXECPASS)
  640. #####################################################################
  641. # Library
  642. #####################################################################
  643. .PHONY: fpc_smart fpc_shared
  644. # Default sharedlib units are all unit objects
  645. ifndef SHAREDLIBUNITOBJECTS
  646. SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
  647. endif
  648. fpc_smart:
  649. $(MAKE) all SMARTLINK=1
  650. fpc_shared: all
  651. ifdef inlinux
  652. ifndef LIBNAME
  653. @$(ECHO) LIBNAME not set
  654. else
  655. $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
  656. endif
  657. else
  658. @$(ECHO) Shared Libraries not supported
  659. endif
  660. #####################################################################
  661. # Install rules
  662. #####################################################################
  663. .PHONY: fpc_showinstall fpc_install
  664. ifdef EXTRAINSTALLUNITS
  665. override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))
  666. endif
  667. ifdef INSTALLPPUFILES
  668. ifdef PPUFILES
  669. ifdef inlinux
  670. INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
  671. INSTALLPPULIBFILES:=$(shell $(PPUFILES) -L $(INSTALLPPUFILES))
  672. else
  673. INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
  674. endif
  675. else
  676. INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES))
  677. endif
  678. endif
  679. fpc_showinstall: $(SHOWINSTALLTARGET)
  680. ifdef INSTALLEXEFILES
  681. @$(ECHO) $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
  682. endif
  683. ifdef INSTALLPPUFILES
  684. @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
  685. ifneq ($(INSTALLPPULINKFILES),)
  686. @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
  687. endif
  688. ifneq ($(INSTALLPPULIBFILES),)
  689. @$(ECHO) $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
  690. endif
  691. endif
  692. ifdef EXTRAINSTALLFILES
  693. @$(ECHO) $(addprefix "\n"$(EXTRAINSTALLDIR)/,$(EXTRAINSTALLFILES))
  694. endif
  695. fpc_install: $(INSTALLTARGET)
  696. # Create UnitInstallFiles
  697. ifdef INSTALLEXEFILES
  698. $(MKDIR) $(BININSTALLDIR)
  699. # Compress the exes if upx is defined
  700. ifdef UPXPROG
  701. -$(UPXPROG) $(INSTALLEXEFILES)
  702. endif
  703. $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR)
  704. endif
  705. ifdef INSTALLPPUFILES
  706. $(MKDIR) $(UNITINSTALLDIR)
  707. $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR)
  708. ifneq ($(INSTALLPPULINKFILES),)
  709. $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
  710. endif
  711. ifneq ($(INSTALLPPULIBFILES),)
  712. $(MKDIR) $(LIBINSTALLDIR)
  713. $(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
  714. endif
  715. endif
  716. ifdef EXTRAINSTALLFILES
  717. $(MKDIR) $(EXTRAINSTALLDIR)
  718. $(INSTALL) $(EXTRAINSTALLFILES) $(EXTRAINSTALLDIR)
  719. endif
  720. #####################################################################
  721. # Source install rules
  722. #####################################################################
  723. .PHONY: fpc_sourceinstall
  724. fpc_sourceinstall: clean
  725. $(MKDIR) $(SOURCEINSTALLDIR)
  726. $(COPYTREE) $(BASEDIR) $(SOURCEINSTALLDIR)
  727. #####################################################################
  728. # Zip
  729. #####################################################################
  730. .PHONY: fpc_zipinstall fpc_zipinstalladd
  731. # Temporary path to pack a file
  732. ifndef PACKDIR
  733. ifndef inlinux
  734. PACKDIR=pack_tmp
  735. else
  736. PACKDIR=/tmp/fpc-pack
  737. endif
  738. endif
  739. # Test dir if none specified
  740. ifndef DESTZIPDIR
  741. DESTZIPDIR:=$(BASEDIR)
  742. endif
  743. # Add .zip/.tar.gz extension
  744. ifdef ZIPNAME
  745. ifndef inlinux
  746. override ZIPNAME:=$(ZIPNAME)$(ZIPEXT)
  747. endif
  748. endif
  749. # Note: This will not remove the zipfile first
  750. fpc_zipinstalladd:
  751. ifndef ZIPNAME
  752. @$(ECHO) Please specify ZIPNAME!
  753. @exit
  754. else
  755. $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
  756. ifdef inlinux
  757. gzip -d $(DESTZIPDIR)/$(ZIPNAME).tar.gz
  758. cd $(PACKDIR) ; tar rv --file $(DESTZIPDIR)/$(ZIPNAME).tar * ; cd $(BASEDIR)
  759. gzip $(DESTZIPDIR)/$(ZIPNAME).tar
  760. else
  761. cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
  762. endif
  763. $(DELTREE) $(PACKDIR)
  764. endif
  765. # First remove the zip and then install
  766. fpc_zipinstall:
  767. ifndef ZIPNAME
  768. @$(ECHO) Please specify ZIPNAME!
  769. @exit
  770. else
  771. $(DEL) $(DESTZIPDIR)/$(ZIPNAME)
  772. $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
  773. ifdef inlinux
  774. cd $(PACKDIR) ; tar cvz --file $(DESTZIPDIR)/$(ZIPNAME).tar.gz * ; cd $(BASEDIR)
  775. else
  776. cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
  777. endif
  778. $(DELTREE) $(PACKDIR)
  779. endif
  780. #####################################################################
  781. # Clean rules
  782. #####################################################################
  783. .PHONY: fpc_clean fpc_cleanall
  784. ifdef EXTRACLEANUNITS
  785. override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
  786. endif
  787. ifdef CLEANPPUFILES
  788. ifdef PPUFILES
  789. CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
  790. else
  791. CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES))
  792. endif
  793. endif
  794. fpc_clean: $(CLEANTARGET)
  795. ifdef CLEANEXEFILES
  796. -$(DEL) $(CLEANEXEFILES)
  797. endif
  798. ifdef CLEANPPUFILES
  799. -$(DEL) $(CLEANPPUFILES)
  800. endif
  801. ifneq ($(CLEANPPULINKFILES),)
  802. -$(DEL) $(CLEANPPULINKFILES)
  803. endif
  804. ifdef EXTRACLEANFILES
  805. -$(DEL) $(EXTRACLEANFILES)
  806. endif
  807. -$(DEL) $(FPCMAKED) $(PPAS) link.res $(REDIRFILE)
  808. fpc_cleanall: $(CLEANTARGET)
  809. ifdef CLEANEXEFILES
  810. -$(DEL) $(CLEANEXEFILES)
  811. endif
  812. -$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  813. -$(DELTREE) *$(SMARTEXT)
  814. -$(DEL) $(FPCMAKED) $(PPAS) link.res $(REDIRFILE)
  815. #####################################################################
  816. # Info rules
  817. #####################################################################
  818. .PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \
  819. fpc_dirinfo
  820. fpc_info: $(INFOTARGET)
  821. fpc_infocfg:
  822. @$(ECHO)
  823. @$(ECHO) == Configuration info ==
  824. @$(ECHO)
  825. @$(ECHO) FPC....... $(FPC)
  826. @$(ECHO) Version... $(FPC_VERSION)
  827. @$(ECHO) CPU....... $(CPU_TARGET)
  828. @$(ECHO) Source.... $(OS_SOURCE)
  829. @$(ECHO) Target.... $(OS_TARGET)
  830. @$(ECHO)
  831. fpc_infoobjects:
  832. @$(ECHO)
  833. @$(ECHO) == Object info ==
  834. @$(ECHO)
  835. @$(ECHO) LoaderObjects..... $(LOADEROBJECTS)
  836. @$(ECHO) UnitObjects....... $(UNITOBJECTS)
  837. @$(ECHO) ExeObjects........ $(EXEOBJECTS)
  838. @$(ECHO)
  839. @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS)
  840. @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES)
  841. @$(ECHO)
  842. @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS)
  843. @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES)
  844. @$(ECHO)
  845. fpc_infoinstall:
  846. @$(ECHO)
  847. @$(ECHO) == Install info ==
  848. @$(ECHO)
  849. ifdef DATE
  850. @$(ECHO) DateStr.............. $(DATESTR)
  851. endif
  852. @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX)
  853. @$(ECHO)
  854. @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR)
  855. @$(ECHO) BinInstallDir........ $(BININSTALLDIR)
  856. @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR)
  857. @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR)
  858. @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR)
  859. @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR)
  860. @$(ECHO) ExtraInstallDir...... $(EXTRAINSTALLDIR)
  861. @$(ECHO)
  862. #####################################################################
  863. # Users rules
  864. #####################################################################
  865. vpath %$(PASEXT) $(INC) $(PROCINC)
  866. #
  867. # Loaders
  868. #
  869. prt0$(OEXT) : $(CPU_TARGET)/prt0.as
  870. $(AS) -o prt0$(OEXT) $(CPU_TARGET)/prt0.as
  871. gprt0$(OEXT) : $(CPU_TARGET)/gprt0.as
  872. $(AS) -o gprt0$(OEXT) $(CPU_TARGET)/gprt0.as
  873. cprt0$(OEXT) : $(CPU_TARGET)/cprt0.as
  874. $(AS) -o cprt0$(OEXT) $(CPU_TARGET)/cprt0.as
  875. cprt21$(OEXT) : $(CPU_TARGET)/cprt21.as
  876. $(AS) -o cprt21$(OEXT) $(CPU_TARGET)/cprt21.as
  877. # still need to use gprt1, because gprt21 crashes
  878. gprt21$(OEXT) : $(CPU_TARGET)/gprt0.as
  879. $(AS) -o gprt21$(OEXT) $(CPU_TARGET)/gprt0.as
  880. #
  881. # System Units (System, Objpas, Strings)
  882. #
  883. $(SYSTEMPPU) : syslinux.pp sysconst.inc systypes.inc syscalls.inc $(SYSDEPS)
  884. $(COMPILER) -Us -Sg syslinux.pp $(REDIR)
  885. objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMPPU)
  886. $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp $(REDIR)
  887. strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\
  888. $(PROCINC)/strings.inc $(PROCINC)/stringss.inc\
  889. $(SYSTEMPPU)
  890. #
  891. # System Dependent Units
  892. #
  893. linux$(PPUEXT) : linux.pp strings$(PPUEXT) $(INC)/textrec.inc $(INC)/filerec.inc \
  894. syscalls.inc systypes.inc sysconst.inc timezone.inc $(SYSTEMPPU)
  895. ports$(PPUEXT) : ports.pp linux$(PPUEXT) objpas$(PPUEXT)
  896. #
  897. # TP7 Compatible RTL Units
  898. #
  899. dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
  900. linux$(PPUEXT) $(SYSTEMPPU)
  901. crt$(PPUEXT) : crt.pp $(INC)/textrec.inc linux$(PPUEXT) $(SYSTEMPPU)
  902. objects$(PPUEXT) : $(INC)/objects.pp objinc.inc $(SYSTEMPPU)
  903. printer$(PPUEXT) : printer.pp $(INC)/textrec.inc linux$(PPUEXT) $(SYSTEMPPU)
  904. #
  905. # Graph
  906. #
  907. ifndef NEWGRAPH
  908. graph$(PPUEXT) : graph.pp linux$(PPUEXT) objects$(PPUEXT)
  909. else
  910. include $(GRAPHDIR)/makefile.inc
  911. GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
  912. ifeq ($(USELIBGGI),YES)
  913. GRAPHINCDEPS+=ggigraph.inc
  914. override COMPILER+=-dUSEGGI -S2
  915. else
  916. GRAPHINCDEPS+=vgagraph.inc
  917. endif
  918. graph$(PPUEXT) : $(GRAPHDIR)/graph.pp $(SYSTEMPPU) $(GRAPHINCDEPS) graph.inc
  919. $(COMPILER) -I$(GRAPHDIR) $(GRAPHDIR)/graph.pp $(REDIR)
  920. endif
  921. #
  922. # Delphi Compatible Units
  923. #
  924. sysutils$(PPUEXT) : $(OBJPASDIR)/sysutils.pp $(wildcard $(OBJPASDIR)/*.inc) \
  925. filutil.inc disk.inc objpas$(PPUEXT) linux$(PPUEXT)
  926. $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/sysutils.pp $(REDIR)
  927. typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
  928. $(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp $(REDIR)
  929. math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
  930. $(COMPILER) $(OBJPASDIR)/math.pp $(REDIR)
  931. gettext$(PPUEXT): $(OBJPASDIR)/gettext.pp objpas$(PPUEXT) sysutils$(PPUEXT)
  932. $(COMPILER) $(OBJPASDIR)/gettext.pp $(REDIR)
  933. #
  934. # Other system-independent RTL Units
  935. #
  936. cpu$(PPUEXT) : $(PROCINC)/cpu.pp $(SYSTEMPPU)
  937. mmx$(PPUEXT) : $(PROCINC)/mmx.pp cpu$(PPUEXT) $(SYSTEMPPU)
  938. getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMPPU)
  939. heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMPPU)
  940. $(COMPILER) -Sg $(INC)/heaptrc.pp $(REDIR)
  941. #
  942. # Other system-dependent RTL Units
  943. #
  944. sockets$(PPUEXT) : sockets.pp $(INC)/textrec.inc $(INC)/filerec.inc \
  945. linux$(PPUEXT) $(SYSTEMPPU)
  946. errors$(PPUEXT) : errors.pp strings$(PPUEXT) $(SYSTEMPPU)
  947. ipc$(PPUEXT) : ipc.pp linux$(PPUEXT) $(SYSTEMPPU)