Makefile 23 KB

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