Makefile 23 KB

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