Makefile 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480
  1. #
  2. # Makefile generated by fpcmake v0.99.15 [2000/05/26]
  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 searched separated by spaces
  48. ifdef inlinux
  49. SEARCHPATH=$(subst :, ,$(PATH))
  50. else
  51. SEARCHPATH=$(subst ;, ,$(PATH))
  52. endif
  53. # Base dir
  54. ifdef PWD
  55. BASEDIR:=$(shell $(PWD))
  56. else
  57. BASEDIR=.
  58. endif
  59. #####################################################################
  60. # FPC version/target Detection
  61. #####################################################################
  62. # What compiler to use ?
  63. ifndef FPC
  64. # Compatibility with old makefiles
  65. ifdef PP
  66. FPC=$(PP)
  67. else
  68. ifdef inOS2
  69. FPC=ppos2
  70. else
  71. FPC=ppc386
  72. endif
  73. endif
  74. endif
  75. override FPC:=$(subst $(EXEEXT),,$(FPC))
  76. override FPC:=$(subst \,/,$(FPC))$(EXEEXT)
  77. # Target OS
  78. ifndef OS_TARGET
  79. OS_TARGET:=$(shell $(FPC) -iTO)
  80. endif
  81. # Source OS
  82. ifndef OS_SOURCE
  83. OS_SOURCE:=$(shell $(FPC) -iSO)
  84. endif
  85. # Target CPU
  86. ifndef CPU_TARGET
  87. CPU_TARGET:=$(shell $(FPC) -iTP)
  88. endif
  89. # Source CPU
  90. ifndef CPU_SOURCE
  91. CPU_SOURCE:=$(shell $(FPC) -iSP)
  92. endif
  93. # FPC version
  94. ifndef FPC_VERSION
  95. FPC_VERSION:=$(shell $(FPC) -iV)
  96. endif
  97. export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
  98. #####################################################################
  99. # Pre Settings
  100. #####################################################################
  101. # Don't export OS_SOURCE because it can change after the first compile
  102. unexport OS_SOURCE FPC_VERSION
  103. # Allow ALPHA, POWERPC, M68K, I386 defines for target cpu
  104. ifdef ALPHA
  105. CPU_TARGET=alpha
  106. endif
  107. ifdef POWERPC
  108. CPU_TARGET=powerpc
  109. endif
  110. ifdef M68K
  111. CPU_TARGET=m68k
  112. endif
  113. ifdef I386
  114. CPU_TARGET=i386
  115. endif
  116. # RTL
  117. UTILSDIR=../utils
  118. # Utils used by compiler development/installation
  119. COMPILERUTILSDIR=utils
  120. # Default language for the compiler
  121. ifndef FPCLANG
  122. FPCLANG=e
  123. endif
  124. # Local defines for the compiler only
  125. ifndef LOCALDEF
  126. LOCALDEF=
  127. endif
  128. # Local options for the compiler only
  129. ifndef LOCALOPT
  130. LOCALOPT=$(OPT)
  131. endif
  132. # Options for the RTL only when cycling
  133. ifndef RTLOPTS
  134. RTLOPTS=$(OPT)
  135. endif
  136. # Message files
  137. MSGFILES=$(wildcard error*.msg)
  138. #####################################################################
  139. # FPCDIR Setting
  140. #####################################################################
  141. # Test FPCDIR to look if the RTL dir exists
  142. ifdef FPCDIR
  143. override FPCDIR:=$(subst \,/,$(FPCDIR))
  144. ifeq ($(wildcard $(FPCDIR)/rtl),)
  145. ifeq ($(wildcard $(FPCDIR)/units),)
  146. override FPCDIR=wrong
  147. endif
  148. endif
  149. else
  150. override FPCDIR=wrong
  151. endif
  152. # Default FPCDIR
  153. ifeq ($(FPCDIR),wrong)
  154. override FPCDIR=..
  155. ifeq ($(wildcard $(FPCDIR)/rtl),)
  156. ifeq ($(wildcard $(FPCDIR)/units),)
  157. override FPCDIR=wrong
  158. endif
  159. endif
  160. endif
  161. # Detect FPCDIR
  162. ifeq ($(FPCDIR),wrong)
  163. ifdef inlinux
  164. override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
  165. ifeq ($(wildcard $(FPCDIR)/units),)
  166. override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
  167. endif
  168. else
  169. override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
  170. override FPCDIR:=$(FPCDIR)/..
  171. ifeq ($(wildcard $(FPCDIR)/rtl),)
  172. ifeq ($(wildcard $(FPCDIR)/units),)
  173. override FPCDIR:=$(FPCDIR)/..
  174. ifeq ($(wildcard $(FPCDIR)/rtl),)
  175. ifeq ($(wildcard $(FPCDIR)/units),)
  176. override FPCDIR=c:/pp
  177. endif
  178. endif
  179. endif
  180. endif
  181. endif
  182. endif
  183. ifndef PACKAGESDIR
  184. PACKAGESDIR=$(FPCDIR)/packages
  185. endif
  186. ifndef TOOLKITSDIR
  187. TOOLKITSDIR=
  188. endif
  189. ifndef COMPONENTSDIR
  190. COMPONENTSDIR=
  191. endif
  192. # Create units dir
  193. ifneq ($(FPCDIR),.)
  194. UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
  195. endif
  196. #####################################################################
  197. # User Settings
  198. #####################################################################
  199. # Targets
  200. # Clean
  201. # Install
  202. PACKAGENAME=compiler
  203. ZIPTARGET=install
  204. # Defaults
  205. override NEEDOPT=-Sg
  206. # Directories
  207. ifndef TARGETDIR
  208. TARGETDIR=.
  209. endif
  210. # Packages
  211. override PACKAGES+=rtl
  212. # Libraries
  213. # Info
  214. INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall
  215. #####################################################################
  216. # Post Settings
  217. #####################################################################
  218. # Default message file
  219. MSGFILE=error$(FPCLANG).msg
  220. # set correct defines (-d$(CPU_TARGET) is automaticly added in makefile.fpc)
  221. override LOCALDEF+=-dGDB -dBROWSERLOG
  222. # i386 specific
  223. ifeq ($(CPU_TARGET),i386)
  224. # also insert MMX support
  225. override LOCALDEF+=-dSUPPORT_MMX
  226. # We don't need the intel and binary writer on linux...
  227. ifdef inlinux
  228. override LOCALDEF+=-dNOAG386INT -dNOAG386BIN
  229. endif
  230. endif
  231. override LOCALOPT+=$(LOCALDEF)
  232. override FPCOPT+=$(LOCALOPT)
  233. #####################################################################
  234. # Shell tools
  235. #####################################################################
  236. # echo
  237. ifndef ECHO
  238. ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
  239. ifeq ($(ECHO),)
  240. ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
  241. ifeq ($(ECHO),)
  242. ECHO:=echo
  243. ECHOE:=echo
  244. else
  245. ECHO:=$(firstword $(ECHO))
  246. ECHOE=$(ECHO) -E
  247. endif
  248. else
  249. ECHO:=$(firstword $(ECHO))
  250. ECHOE=$(ECHO) -E
  251. endif
  252. endif
  253. # To copy pograms
  254. ifndef COPY
  255. COPY:=cp -fp
  256. endif
  257. # Copy a whole tree
  258. ifndef COPYTREE
  259. COPYTREE:=cp -rfp
  260. endif
  261. # To move pograms
  262. ifndef MOVE
  263. MOVE:=mv -f
  264. endif
  265. # Check delete program
  266. ifndef DEL
  267. DEL:=rm -f
  268. endif
  269. # Check deltree program
  270. ifndef DELTREE
  271. DELTREE:=rm -rf
  272. endif
  273. # To install files
  274. ifndef INSTALL
  275. ifdef inlinux
  276. INSTALL:=install -m 644
  277. else
  278. INSTALL:=$(COPY)
  279. endif
  280. endif
  281. # To install programs
  282. ifndef INSTALLEXE
  283. ifdef inlinux
  284. INSTALLEXE:=install -m 755
  285. else
  286. INSTALLEXE:=$(COPY)
  287. endif
  288. endif
  289. # To make a directory.
  290. ifndef MKDIR
  291. ifdef inlinux
  292. MKDIR:=install -m 755 -d
  293. else
  294. MKDIR:=ginstall -m 755 -d
  295. endif
  296. endif
  297. export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
  298. #####################################################################
  299. # Default Tools
  300. #####################################################################
  301. # assembler, redefine it if cross compiling
  302. ifndef AS
  303. AS=as
  304. endif
  305. # linker, but probably not used
  306. ifndef LD
  307. LD=ld
  308. endif
  309. # ppas.bat / ppas.sh
  310. ifdef inlinux
  311. PPAS=ppas.sh
  312. else
  313. ifdef inOS2
  314. PPAS=ppas.cmd
  315. else
  316. PPAS=ppas.bat
  317. endif
  318. endif
  319. # ldconfig to rebuild .so cache
  320. ifdef inlinux
  321. LDCONFIG=ldconfig
  322. else
  323. LDCONFIG=
  324. endif
  325. # ppumove
  326. ifndef PPUMOVE
  327. PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(EXEEXT),$(SEARCHPATH))))
  328. ifeq ($(PPUMOVE),)
  329. PPUMOVE=
  330. else
  331. PPUMOVE:=$(firstword $(PPUMOVE))
  332. endif
  333. endif
  334. export PPUMOVE
  335. # ppufiles
  336. ifndef PPUFILES
  337. PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
  338. ifeq ($(PPUFILES),)
  339. PPUFILES=
  340. else
  341. PPUFILES:=$(firstword $(PPUFILES))
  342. endif
  343. endif
  344. export PPUFILES
  345. # Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
  346. # upx uses that one itself (PFV)
  347. ifndef UPXPROG
  348. ifeq ($(OS_TARGET),go32v2)
  349. UPXPROG:=1
  350. endif
  351. ifeq ($(OS_TARGET),win32)
  352. UPXPROG:=1
  353. endif
  354. ifdef UPXPROG
  355. UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(SEARCHPATH))))
  356. ifeq ($(UPXPROG),)
  357. UPXPROG=
  358. else
  359. UPXPROG:=$(firstword $(UPXPROG))
  360. endif
  361. else
  362. UPXPROG=
  363. endif
  364. endif
  365. export UPXPROG
  366. # cmp
  367. ifndef CMP
  368. CMP:=$(strip $(wildcard $(addsuffix /cmp$(EXEEXT),$(SEARCHPATH))))
  369. ifeq ($(CMP),)
  370. CMP=
  371. else
  372. CMP:=$(firstword $(CMP))
  373. endif
  374. endif
  375. export CMP
  376. # diff
  377. ifndef DIFF
  378. DIFF:=$(strip $(wildcard $(addsuffix /diff$(EXEEXT),$(SEARCHPATH))))
  379. ifeq ($(DIFF),)
  380. DIFF=
  381. else
  382. DIFF:=$(firstword $(DIFF))
  383. endif
  384. endif
  385. export DIFF
  386. # gdate/date
  387. ifndef DATE
  388. DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
  389. ifeq ($(DATE),)
  390. DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
  391. ifeq ($(DATE),)
  392. DATE=
  393. else
  394. DATE:=$(firstword $(DATE))
  395. endif
  396. else
  397. DATE:=$(firstword $(DATE))
  398. endif
  399. endif
  400. export DATE
  401. ifdef DATE
  402. DATESTR:=$(shell $(DATE) +%Y%m%d)
  403. else
  404. DATESTR=
  405. endif
  406. # ZipProg, you can't use Zip as the var name (PFV)
  407. ifndef ZIPPROG
  408. ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
  409. ifeq ($(ZIPPROG),)
  410. ZIPPROG=
  411. else
  412. ZIPPROG:=$(firstword $(ZIPPROG))
  413. endif
  414. endif
  415. export ZIPPROG
  416. ZIPOPT=-9
  417. ZIPEXT=.zip
  418. # Tar
  419. ifndef TARPROG
  420. TARPROG:=$(strip $(wildcard $(addsuffix /tar$(EXEEXT),$(SEARCHPATH))))
  421. ifeq ($(TARPROG),)
  422. TARPROG=
  423. else
  424. TARPROG:=$(firstword $(TARPROG))
  425. endif
  426. endif
  427. export TARPROG
  428. ifeq ($(USETAR),bz2)
  429. TAROPT=vI
  430. TAREXT=.tar.bz2
  431. else
  432. TAROPT=vz
  433. TAREXT=.tar.gz
  434. endif
  435. #####################################################################
  436. # Default extensions
  437. #####################################################################
  438. # Default needed extensions (Go32v2,Linux)
  439. LOADEREXT=.as
  440. PPLEXT=.ppl
  441. PPUEXT=.ppu
  442. OEXT=.o
  443. ASMEXT=.s
  444. SMARTEXT=.sl
  445. STATICLIBEXT=.a
  446. SHAREDLIBEXT=.so
  447. RSTEXT=.rst
  448. FPCMADE=fpcmade
  449. # Go32v1
  450. ifeq ($(OS_TARGET),go32v1)
  451. PPUEXT=.pp1
  452. OEXT=.o1
  453. ASMEXT=.s1
  454. SMARTEXT=.sl1
  455. STATICLIBEXT=.a1
  456. SHAREDLIBEXT=.so1
  457. FPCMADE=fpcmade.v1
  458. endif
  459. # Go32v2
  460. ifeq ($(OS_TARGET),go32v2)
  461. FPCMADE=fpcmade.dos
  462. endif
  463. # Linux
  464. ifeq ($(OS_TARGET),linux)
  465. FPCMADE=fpcmade.lnx
  466. endif
  467. # Win32
  468. ifeq ($(OS_TARGET),win32)
  469. PPUEXT=.ppw
  470. OEXT=.ow
  471. ASMEXT=.sw
  472. SMARTEXT=.slw
  473. STATICLIBEXT=.aw
  474. SHAREDLIBEXT=.dll
  475. FPCMADE=fpcmade.w32
  476. endif
  477. # OS/2
  478. ifeq ($(OS_TARGET),os2)
  479. PPUEXT=.ppo
  480. ASMEXT=.so2
  481. OEXT=.oo2
  482. SMARTEXT=.so
  483. STATICLIBEXT=.ao2
  484. SHAREDLIBEXT=.dll
  485. FPCMADE=fpcmade.os2
  486. endif
  487. # library prefix
  488. LIBPREFIX=lib
  489. ifeq ($(OS_TARGET),go32v2)
  490. LIBPREFIX=
  491. endif
  492. ifeq ($(OS_TARGET),go32v1)
  493. LIBPREFIX=
  494. endif
  495. # determine which .pas extension is used
  496. ifndef PASEXT
  497. ifdef EXEOBJECTS
  498. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
  499. else
  500. override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
  501. endif
  502. ifeq ($(TESTPAS),)
  503. PASEXT=.pp
  504. else
  505. PASEXT=.pas
  506. endif
  507. endif
  508. # Check if the dirs really exists, else turn it off
  509. ifeq ($(wildcard $(UNITSDIR)),)
  510. UNITSDIR=
  511. endif
  512. ifeq ($(wildcard $(TOOLKITSDIR)),)
  513. TOOLKITSDIR=
  514. endif
  515. ifeq ($(wildcard $(PACKAGESDIR)),)
  516. PACKAGESDIR=
  517. endif
  518. ifeq ($(wildcard $(COMPONENTSDIR)),)
  519. COMPONENTSDIR=
  520. endif
  521. # PACKAGESDIR packages
  522. PACKAGERTL=1
  523. ifdef PACKAGERTL
  524. ifneq ($(wildcard $(FPCDIR)/rtl),)
  525. ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),)
  526. PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET)
  527. else
  528. PACKAGEDIR_RTL=$(FPCDIR)/rtl
  529. endif
  530. ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
  531. override COMPILEPACKAGES+=package_rtl
  532. package_rtl:
  533. $(MAKE) -C $(PACKAGEDIR_RTL) all
  534. endif
  535. UNITDIR_RTL=$(PACKAGEDIR_RTL)
  536. else
  537. PACKAGEDIR_RTL=
  538. ifneq ($(wildcard $(UNITSDIR)/rtl),)
  539. ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),)
  540. UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET)
  541. else
  542. UNITDIR_RTL=$(UNITSDIR)/rtl
  543. endif
  544. else
  545. UNITDIR_RTL=
  546. endif
  547. endif
  548. ifdef UNITDIR_RTL
  549. override NEEDUNITDIR+=$(UNITDIR_RTL)
  550. endif
  551. endif
  552. #####################################################################
  553. # Default Directories
  554. #####################################################################
  555. # set the prefix directory where to install everything
  556. ifndef PREFIXINSTALLDIR
  557. ifdef inlinux
  558. PREFIXINSTALLDIR=/usr
  559. else
  560. PREFIXINSTALLDIR=/pp
  561. endif
  562. endif
  563. export PREFIXINSTALLDIR
  564. # Where to place the resulting zip files
  565. ifndef DESTZIPDIR
  566. DESTZIPDIR:=$(BASEDIR)
  567. endif
  568. export DESTZIPDIR
  569. #####################################################################
  570. # Install Directories
  571. #####################################################################
  572. # set the base directory where to install everything
  573. ifndef BASEINSTALLDIR
  574. ifdef inlinux
  575. BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
  576. else
  577. BASEINSTALLDIR=$(PREFIXINSTALLDIR)
  578. endif
  579. endif
  580. # set the directory where to install the binaries
  581. ifndef BININSTALLDIR
  582. ifdef inlinux
  583. BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
  584. else
  585. BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
  586. endif
  587. endif
  588. # set the directory where to install the units.
  589. ifndef UNITINSTALLDIR
  590. UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)
  591. ifdef UNITSUBDIR
  592. UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)
  593. endif
  594. endif
  595. # Where to install shared libraries
  596. ifndef LIBINSTALLDIR
  597. ifdef inlinux
  598. LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
  599. else
  600. LIBINSTALLDIR=$(UNITINSTALLDIR)
  601. endif
  602. endif
  603. # Where the source files will be stored
  604. ifndef SOURCEINSTALLDIR
  605. ifdef inlinux
  606. SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
  607. else
  608. SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
  609. endif
  610. ifdef SOURCESUBDIR
  611. SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)
  612. endif
  613. endif
  614. # Where the doc files will be stored
  615. ifndef DOCINSTALLDIR
  616. ifdef inlinux
  617. DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
  618. else
  619. DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
  620. endif
  621. endif
  622. # Where the some extra (data)files will be stored
  623. ifndef DATAINSTALLDIR
  624. DATAINSTALLDIR=$(BASEINSTALLDIR)
  625. endif
  626. #####################################################################
  627. # Redirection
  628. #####################################################################
  629. ifndef REDIRFILE
  630. REDIRFILE=log
  631. endif
  632. ifdef REDIR
  633. ifndef inlinux
  634. override FPC=redir -eo $(FPC)
  635. endif
  636. # set the verbosity to max
  637. override FPCOPT+=-va
  638. override REDIR:= >> $(REDIRFILE)
  639. endif
  640. #####################################################################
  641. # Compiler Command Line
  642. #####################################################################
  643. # Load commandline OPTDEF and add FPC_CPU define
  644. override FPCOPTDEF:=-d$(CPU_TARGET)
  645. # Load commandline OPT and add target and unit dir to be sure
  646. ifneq ($(OS_TARGET),$(OS_SOURCE))
  647. override FPCOPT+=-T$(OS_TARGET)
  648. endif
  649. ifdef NEEDOPT
  650. override FPCOPT+=$(NEEDOPT)
  651. endif
  652. ifdef NEEDUNITDIR
  653. override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
  654. endif
  655. ifdef UNITSDIR
  656. override FPCOPT+=-Fu$(UNITSDIR)
  657. endif
  658. # Target dirs
  659. ifdef TARGETDIR
  660. override FPCOPT+=-FE$(TARGETDIR)
  661. endif
  662. # Smartlinking
  663. ifdef LINKSMART
  664. override FPCOPT+=-XX
  665. endif
  666. # Smartlinking creation
  667. ifdef CREATESMART
  668. override FPCOPT+=-CX
  669. endif
  670. # Debug
  671. ifdef DEBUG
  672. override FPCOPT+=-g -dDEBUG
  673. endif
  674. # Release mode (strip, optimize and don't load ppc386.cfg)
  675. # 0.99.12b has a bug in the optimizer so don't use it by default
  676. ifdef RELEASE
  677. ifeq ($(FPC_VERSION),0.99.12)
  678. override FPCOPT+=-Xs -OGp3 -n
  679. else
  680. override FPCOPT+=-Xs -OG2p3 -n
  681. endif
  682. endif
  683. # Strip
  684. ifdef STRIP
  685. override FPCOPT+=-Xs
  686. endif
  687. # Optimizer
  688. ifdef OPTIMIZE
  689. override FPCOPT+=-OG2p3
  690. endif
  691. # Verbose settings (warning,note,info)
  692. ifdef VERBOSE
  693. override FPCOPT+=-vwni
  694. endif
  695. # Add commandline options
  696. ifdef OPT
  697. override FPCOPT+=$(OPT)
  698. endif
  699. ifdef UNITDIR
  700. override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
  701. endif
  702. ifdef LIBDIR
  703. override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
  704. endif
  705. ifdef OBJDIR
  706. override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
  707. endif
  708. ifdef INCDIR
  709. override FPCOPT+=$(addprefix -Fi,$(INCDIR))
  710. endif
  711. # Add defines from FPCOPTDEF to FPCOPT
  712. ifdef FPCOPTDEF
  713. override FPCOPT+=$(FPCOPTDEF)
  714. endif
  715. # Error file ?
  716. ifdef ERRORFILE
  717. override FPCOPT+=-Fr$(ERRORFILE)
  718. endif
  719. # Was a config file specified ?
  720. ifdef CFGFILE
  721. override FPCOPT+=@$(CFGFILE)
  722. endif
  723. # For win32 the options are passed using the environment FPCEXTCMD
  724. ifeq ($(OS_SOURCE),win32)
  725. override FPCEXTCMD:=$(FPCOPT)
  726. override FPCOPT:=!FPCEXTCMD
  727. export FPCEXTCMD
  728. endif
  729. # Compiler commandline
  730. override COMPILER:=$(FPC) $(FPCOPT)
  731. # also call ppas if with command option -s
  732. ifeq (,$(findstring -s ,$(COMPILER)))
  733. EXECPPAS=
  734. else
  735. EXECPPAS:=@$(PPAS)
  736. endif
  737. #####################################################################
  738. # Standard rules
  739. #####################################################################
  740. debug: fpc_debug
  741. smart: fpc_smart
  742. shared: fpc_shared
  743. showinstall: fpc_showinstall
  744. sourceinstall: fpc_sourceinstall
  745. zipinstall: fpc_zipinstall
  746. zipsourceinstall: fpc_zipsourceinstall
  747. cleanall: fpc_cleanall
  748. info: fpc_info
  749. .PHONY: debug smart shared showinstall sourceinstall zipinstall zipsourceinstall cleanall info
  750. #####################################################################
  751. # General compile rules
  752. #####################################################################
  753. .PHONY: fpc_packages fpc_all fpc_debug
  754. $(FPCMADE): $(ALLTARGET)
  755. @$(ECHO) Compiled > $(FPCMADE)
  756. fpc_packages: $(COMPILEPACKAGES)
  757. fpc_all: fpc_packages $(FPCMADE)
  758. fpc_debug:
  759. $(MAKE) all DEBUG=1
  760. # General compile rules, available for both possible PASEXT
  761. .SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
  762. %$(PPUEXT): %.pp
  763. $(COMPILER) $< $(REDIR)
  764. $(EXECPPAS)
  765. %$(PPUEXT): %.pas
  766. $(COMPILER) $< $(REDIR)
  767. $(EXECPPAS)
  768. %$(EXEEXT): %.pp
  769. $(COMPILER) $< $(REDIR)
  770. $(EXECPPAS)
  771. %$(EXEEXT): %.pas
  772. $(COMPILER) $< $(REDIR)
  773. $(EXECPPAS)
  774. #####################################################################
  775. # Library
  776. #####################################################################
  777. .PHONY: fpc_smart fpc_shared
  778. # Default sharedlib units are all unit objects
  779. ifndef SHAREDLIBUNITOBJECTS
  780. SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
  781. endif
  782. fpc_smart:
  783. $(MAKE) all LINKSMART=1 CREATESMART=1
  784. fpc_shared: all
  785. ifdef inlinux
  786. ifndef LIBNAME
  787. @$(ECHO) "LIBNAME not set"
  788. else
  789. $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
  790. endif
  791. else
  792. @$(ECHO) "Shared Libraries not supported"
  793. endif
  794. #####################################################################
  795. # Install rules
  796. #####################################################################
  797. .PHONY: fpc_showinstall fpc_install
  798. ifdef EXTRAINSTALLUNITS
  799. override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))
  800. endif
  801. ifdef INSTALLPPUFILES
  802. ifdef PPUFILES
  803. ifdef inlinux
  804. INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
  805. ifdef LIBNAME
  806. INSTALLPPULIBFILES=$(LIBNAME)
  807. endif
  808. else
  809. INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
  810. endif
  811. else
  812. INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
  813. endif
  814. endif
  815. fpc_showinstall: $(SHOWINSTALLTARGET)
  816. ifdef INSTALLEXEFILES
  817. @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
  818. endif
  819. ifdef INSTALLPPUFILES
  820. @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
  821. ifneq ($(INSTALLPPULINKFILES),)
  822. @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
  823. endif
  824. ifneq ($(INSTALLPPULIBFILES),)
  825. @$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
  826. endif
  827. endif
  828. ifdef EXTRAINSTALLFILES
  829. @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES))
  830. endif
  831. fpc_install: $(INSTALLTARGET)
  832. # Create UnitInstallFiles
  833. ifdef INSTALLEXEFILES
  834. $(MKDIR) $(BININSTALLDIR)
  835. # Compress the exes if upx is defined
  836. ifdef UPXPROG
  837. -$(UPXPROG) $(INSTALLEXEFILES)
  838. endif
  839. $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR)
  840. endif
  841. ifdef INSTALLPPUFILES
  842. $(MKDIR) $(UNITINSTALLDIR)
  843. $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR)
  844. ifneq ($(INSTALLPPULINKFILES),)
  845. $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
  846. endif
  847. ifneq ($(INSTALLPPULIBFILES),)
  848. $(MKDIR) $(LIBINSTALLDIR)
  849. $(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
  850. endif
  851. endif
  852. ifdef EXTRAINSTALLFILES
  853. $(MKDIR) $(DATAINSTALLDIR)
  854. $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR)
  855. endif
  856. #####################################################################
  857. # SourceInstall rules
  858. #####################################################################
  859. .PHONY: fpc_sourceinstall
  860. ifndef SOURCETOPDIR
  861. SOURCETOPDIR=$(BASEDIR)
  862. endif
  863. fpc_sourceinstall: clean
  864. $(MKDIR) $(SOURCEINSTALLDIR)
  865. $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
  866. #####################################################################
  867. # Zip
  868. #####################################################################
  869. .PHONY: fpc_zipinstall
  870. # Create suffix to add
  871. ifndef PACKAGESUFFIX
  872. PACKAGESUFFIX=$(OS_TARGET)
  873. ifeq ($(OS_TARGET),go32v2)
  874. PACKAGESUFFIX=go32
  875. endif
  876. ifeq ($(OS_TARGET),win32)
  877. PACKAGESUFFIX=w32
  878. endif
  879. endif
  880. # Temporary path to pack a file
  881. ifndef PACKDIR
  882. ifndef inlinux
  883. PACKDIR=$(BASEDIR)/pack_tmp
  884. else
  885. PACKDIR=/tmp/fpc-pack
  886. endif
  887. endif
  888. # Maybe create default zipname from packagename
  889. ifndef ZIPNAME
  890. ifdef PACKAGENAME
  891. ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX)
  892. endif
  893. endif
  894. # Use tar by default under linux
  895. ifndef USEZIP
  896. ifdef inlinux
  897. USETAR=1
  898. endif
  899. endif
  900. fpc_zipinstall:
  901. ifndef ZIPNAME
  902. @$(ECHO) "Please specify ZIPNAME!"
  903. @exit 1
  904. else
  905. $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
  906. ifdef USETAR
  907. $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
  908. cd $(PACKDIR) ; $(TARPROG) c$(TAROPT) --file $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
  909. else
  910. $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
  911. cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)
  912. endif
  913. $(DELTREE) $(PACKDIR)
  914. endif
  915. .PHONY: fpc_zipsourceinstall
  916. fpc_zipsourceinstall:
  917. $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
  918. #####################################################################
  919. # Clean rules
  920. #####################################################################
  921. .PHONY: fpc_clean fpc_cleanall fpc_distclean
  922. ifdef EXTRACLEANUNITS
  923. override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
  924. endif
  925. ifdef CLEANPPUFILES
  926. ifdef PPUFILES
  927. CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
  928. else
  929. CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)))
  930. endif
  931. endif
  932. fpc_clean: $(CLEANTARGET)
  933. ifdef CLEANEXEFILES
  934. -$(DEL) $(CLEANEXEFILES)
  935. endif
  936. ifdef CLEANPPUFILES
  937. -$(DEL) $(CLEANPPUFILES)
  938. endif
  939. ifneq ($(CLEANPPULINKFILES),)
  940. -$(DEL) $(CLEANPPULINKFILES)
  941. endif
  942. ifdef CLEANRSTFILES
  943. -$(DEL) $(CLEANRSTFILES)
  944. endif
  945. ifdef EXTRACLEANFILES
  946. -$(DEL) $(EXTRACLEANFILES)
  947. endif
  948. ifdef LIBNAME
  949. -$(DEL) $(LIBNAME)
  950. endif
  951. -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
  952. fpc_distclean: fpc_clean
  953. fpc_cleanall: $(CLEANTARGET)
  954. ifdef CLEANEXEFILES
  955. -$(DEL) $(CLEANEXEFILES)
  956. endif
  957. -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  958. -$(DELTREE) *$(SMARTEXT)
  959. -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
  960. #####################################################################
  961. # Info rules
  962. #####################################################################
  963. .PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \
  964. fpc_dirinfo
  965. fpc_info: $(INFOTARGET)
  966. fpc_infocfg:
  967. @$(ECHO)
  968. @$(ECHO) == Configuration info ==
  969. @$(ECHO)
  970. @$(ECHO) FPC....... $(FPC)
  971. @$(ECHO) Version... $(FPC_VERSION)
  972. @$(ECHO) CPU....... $(CPU_TARGET)
  973. @$(ECHO) Source.... $(OS_SOURCE)
  974. @$(ECHO) Target.... $(OS_TARGET)
  975. @$(ECHO)
  976. fpc_infoobjects:
  977. @$(ECHO)
  978. @$(ECHO) == Object info ==
  979. @$(ECHO)
  980. @$(ECHO) LoaderObjects..... $(LOADEROBJECTS)
  981. @$(ECHO) UnitObjects....... $(UNITOBJECTS)
  982. @$(ECHO) ExeObjects........ $(EXEOBJECTS)
  983. @$(ECHO)
  984. @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS)
  985. @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES)
  986. @$(ECHO)
  987. @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS)
  988. @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES)
  989. @$(ECHO)
  990. fpc_infoinstall:
  991. @$(ECHO)
  992. @$(ECHO) == Install info ==
  993. @$(ECHO)
  994. ifdef DATE
  995. @$(ECHO) DateStr.............. $(DATESTR)
  996. endif
  997. ifdef PACKAGEPREFIX
  998. @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX)
  999. endif
  1000. ifdef PACKAGENAME
  1001. @$(ECHO) PackageName.......... $(PACKAGENAME)
  1002. endif
  1003. @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX)
  1004. @$(ECHO)
  1005. @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR)
  1006. @$(ECHO) BinInstallDir........ $(BININSTALLDIR)
  1007. @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR)
  1008. @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR)
  1009. @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR)
  1010. @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR)
  1011. @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR)
  1012. @$(ECHO)
  1013. @$(ECHO) DestZipDir........... $(DESTZIPDIR)
  1014. @$(ECHO) ZipName.............. $(ZIPNAME)
  1015. @$(ECHO)
  1016. #####################################################################
  1017. # Local Makefile
  1018. #####################################################################
  1019. ifneq ($(wildcard fpcmake.loc),)
  1020. include fpcmake.loc
  1021. endif
  1022. #####################################################################
  1023. # Users rules
  1024. #####################################################################
  1025. #####################################################################
  1026. # Setup Targets
  1027. #####################################################################
  1028. ifeq ($(OS_TARGET),win32)
  1029. ifdef CMP
  1030. override DIFF:=$(CMP) -i138
  1031. endif
  1032. endif
  1033. # Used to avoid unnecessary steps in remake3
  1034. ifdef DIFF
  1035. ifdef OLDFPC
  1036. DIFFRESULT:=$(shell $(DIFF) $(OLDFPC) $(FPC))
  1037. else
  1038. DIFFRESULT=Not equal
  1039. endif
  1040. else
  1041. DIFFRESULT=No diff program
  1042. endif
  1043. #####################################################################
  1044. # Setup os-independent filenames
  1045. #####################################################################
  1046. FPCEXENAME=pp$(EXEEXT)
  1047. EXENAME=ppc386$(EXEEXT)
  1048. M68KEXENAME=ppc68k$(EXEEXT)
  1049. TEMPNAME=ppc$(EXEEXT)
  1050. TEMPNAME1=ppc1$(EXEEXT)
  1051. TEMPNAME2=ppc2$(EXEEXT)
  1052. TEMPNAME3=ppc3$(EXEEXT)
  1053. MAKEDEP=ppdep$(EXEEXT)
  1054. MSG2INC=msg2inc$(EXEEXT)
  1055. #####################################################################
  1056. # Default makefile
  1057. #####################################################################
  1058. all: $(EXENAME)
  1059. $(MAKE) echotime
  1060. ifeq ($(MAKELEVEL),0)
  1061. ifndef STARTTIME
  1062. ifdef DATE
  1063. STARTTIME:=$(shell $(DATE) +%T)
  1064. else
  1065. STARTTIME:=unknown
  1066. endif
  1067. endif
  1068. endif
  1069. export STARTTIME
  1070. ifdef DATE
  1071. ENDTIME=$(shell $(DATE) +%T)
  1072. else
  1073. ENDTIME:=unknown
  1074. endif
  1075. echotime:
  1076. @echo Start $(STARTTIME) now $(ENDTIME)
  1077. ifndef DIFFRESULT
  1078. next :
  1079. @echo $(OLDFPC) and $(FPC) are equal
  1080. $(COPY) $(FPC) $(EXENAME)
  1081. else
  1082. next :
  1083. $(MAKE) execlean
  1084. $(MAKE) -C $(UNITDIR_RTL) clean
  1085. $(MAKE) -C $(UNITDIR_RTL) 'FPC=$(FPC)' 'OPT=$(RTLOPTS)' all
  1086. $(MAKE) clean
  1087. $(MAKE) all
  1088. endif
  1089. clean : execlean fpc_cleanall
  1090. ppuclean: fpc_cleanall
  1091. execlean :
  1092. -$(DEL) $(EXENAME)
  1093. distclean: clean
  1094. -$(DEL) $(TEMPNAME) $(TEMPNAME1) $(TEMPNAME2) $(TEMPNAME3) $(MSG2INC)
  1095. #####################################################################
  1096. # Include depencies
  1097. #####################################################################
  1098. $(MAKEDEP): $(UTILSDIR)/ppdep.pp
  1099. $(COMPILER) $(UTILSDIR)/ppdep.pp
  1100. $(COPY) $(UTILSDIR)/$(MAKEDEP) $(MAKEDEP)
  1101. dependencies : $(MAKEDEP)
  1102. $(MAKEDEP) pp.pas $(FPCOPTDEF) $(LOCALDEF) '-F$$(COMPILER) $$(LOCALOPT)' > depend
  1103. ifdef USEDEPEND
  1104. include depend
  1105. endif
  1106. #####################################################################
  1107. # Make targets
  1108. #####################################################################
  1109. $(MSG2INC): $(COMPILERUTILSDIR)/msg2inc.pp
  1110. $(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
  1111. # The msgtxt.inc only depends on the error?.msg file, not on msg2inc,
  1112. # because that one will be new almost everytime
  1113. msgtxt.inc: $(MSGFILE)
  1114. $(MAKE) $(MSG2INC)
  1115. $(MSG2INC) $(MSGFILE) msg msg
  1116. msg: msgtxt.inc
  1117. # Make only the compiler
  1118. ifndef COMPLETE
  1119. $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg
  1120. $(COMPILER) pp.pas
  1121. $(EXECPPAS)
  1122. $(MOVE) $(FPCEXENAME) $(EXENAME)
  1123. else
  1124. $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg
  1125. $(COMPILER) pp.pas
  1126. $(EXECPPAS)
  1127. $(COMPILER) pp.pas
  1128. $(EXECPPAS)
  1129. $(COMPILER) pp.pas
  1130. $(EXECPPAS)
  1131. $(MOVE) $(FPCEXENAME) $(EXENAME)
  1132. endif
  1133. tokens.dat : $(wildcard *.pas) $(wildcard *.inc)
  1134. $(COMPILER) tokendat.pas
  1135. ./tokendat
  1136. # This target remakes the units with the currently made version
  1137. remake: $(EXENAME)
  1138. $(MOVE) $(EXENAME) $(TEMPNAME)
  1139. $(MAKE) execlean
  1140. $(MAKE) -C $(UNITDIR_RTL) clean
  1141. $(MAKE) clean
  1142. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' all
  1143. remake3: $(TEMPNAME3)
  1144. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME3)' 'OLDFPC=$(BASEDIR)/$(TEMPNAME2)' next
  1145. $(DIFF) $(TEMPNAME3) $(EXENAME)
  1146. $(TEMPNAME1) : $(EXENAME)
  1147. -$(DEL) $(TEMPNAME1)
  1148. $(MOVE) $(EXENAME) $(TEMPNAME1)
  1149. $(TEMPNAME2) : $(TEMPNAME1)
  1150. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME1)' 'OLDFPC=' next
  1151. -$(DEL) $(TEMPNAME2)
  1152. $(MOVE) $(EXENAME) $(TEMPNAME2)
  1153. $(TEMPNAME3) : $(TEMPNAME2)
  1154. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME2)' 'OLDFPC=$(BASEDIR)/$(TEMPNAME1)' next
  1155. -$(DEL) $(TEMPNAME3)
  1156. $(MOVE) $(EXENAME) $(TEMPNAME3)
  1157. cycle:
  1158. $(MAKE) clean
  1159. $(MAKE) -C $(UNITDIR_RTL) clean
  1160. $(MAKE) -C $(UNITDIR_RTL) 'OPT=$(RTLOPTS)' all
  1161. $(MAKE) remake3
  1162. $(MAKE) echotime
  1163. cycledep:
  1164. $(MAKE) cycle USEDEPEND=1
  1165. cvstest:
  1166. $(MAKE) cycle 'LOCALOPT=-n -Se' 'RTLOPTS=-n -Se'
  1167. #####################################################################
  1168. # Installation
  1169. #####################################################################
  1170. .PHONY: quickinstall install installsym
  1171. MSGINSTALLDIR=$(BASEINSTALLDIR)/msg
  1172. # This will only install the ppc386.exe, not the message files etc.
  1173. quickinstall:
  1174. ifdef inlinux
  1175. $(MKDIR) $(BASEINSTALLDIR)
  1176. $(INSTALLEXE) $(EXENAME) $(BASEINSTALLDIR)
  1177. else
  1178. $(MKDIR) $(BININSTALLDIR)
  1179. ifdef UPXPROG
  1180. -$(UPXPROG) $(EXENAME)
  1181. endif
  1182. $(INSTALLEXE) $(EXENAME) $(BININSTALLDIR)
  1183. endif
  1184. install: quickinstall
  1185. ifdef inlinux
  1186. $(INSTALLEXE) $(COMPILERUTILSDIR)/samplecfg $(BASEINSTALLDIR)/samplecfg
  1187. endif
  1188. $(MKDIR) $(MSGINSTALLDIR)
  1189. $(INSTALL) $(MSGFILES) $(MSGINSTALLDIR)
  1190. # this also installs the link /usr/bin/ppc386. The .deb does that later
  1191. installsymlink: install
  1192. ifdef inlinux
  1193. $(MKDIR) $(BININSTALLDIR)
  1194. ln -sf $(BASEINSTALLDIR)/ppc386 $(BININSTALLDIR)/ppc386
  1195. endif
  1196. #####################################################################
  1197. # Misc
  1198. #####################################################################
  1199. .PHONY: rtl rtlclean rtlinstall
  1200. rtl:
  1201. $(MAKE) -C $(UNITDIR_RTL) all
  1202. rtlclean:
  1203. $(MAKE) -C $(UNITDIR_RTL) clean
  1204. rtlinstall:
  1205. $(MAKE) -C $(UNITDIR_RTL) install
  1206. #####################################################################
  1207. # local user configurable file
  1208. # in makefile.loc you can add any desired target
  1209. #####################################################################
  1210. localmake:=$(strip $(wildcard makefile.loc))
  1211. ifdef localmake
  1212. include ./$(localmake)
  1213. endif
  1214. #####################################################################
  1215. # M68k test targets
  1216. #####################################################################
  1217. # just a quick way to get ppc68k
  1218. # needs to be after makefile.def for PASFILES INCFILES
  1219. $(M68KEXENAME): $(PASFILES) $(INCFILES)
  1220. $(MAKE) clean
  1221. $(FPC) -uI386 -uSUPPORT_MMX -dm68k -o$(M68KEXENAME) pp
  1222. $(MAKE) clean