Makefile.fpc 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. #
  2. # Makefile.fpc for Free Pascal Compiler
  3. #
  4. [package]
  5. name=compiler
  6. version=2.5.1
  7. [target]
  8. programs=pp
  9. dirs=utils
  10. [compiler]
  11. targetdir=.
  12. unittargetdir=$(CPU_UNITDIR)/units/$(FULL_TARGET)
  13. unitdir=$(COMPILERSOURCEDIR)
  14. includedir=$(CPC_TARGET)
  15. [require]
  16. packages=rtl
  17. tools=diff cmp
  18. [install]
  19. fpcpackage=y
  20. [default]
  21. fpcdir=..
  22. [prerules]
  23. # Don't export version it can change after the first compile
  24. unexport FPC_VERSION FPC_COMPILERINFO
  25. # Which platforms are ready for inclusion in the cycle
  26. CYCLETARGETS=i386 powerpc sparc arm x86_64 powerpc64 m68k armeb mipsel mips
  27. # All supported targets used for clean
  28. ALLTARGETS=$(CYCLETARGETS)
  29. # Allow ALPHA, POWERPC, POWERPC64, M68K, I386 defines for target cpu
  30. ifdef ALPHA
  31. PPC_TARGET=alpha
  32. endif
  33. ifdef POWERPC
  34. PPC_TARGET=powerpc
  35. endif
  36. ifdef POWERPC64
  37. PPC_TARGET=powerpc64
  38. endif
  39. ifdef SPARC
  40. PPC_TARGET=sparc
  41. endif
  42. ifdef M68K
  43. PPC_TARGET=m68k
  44. endif
  45. ifdef I386
  46. PPC_TARGET=i386
  47. endif
  48. ifdef X86_64
  49. PPC_TARGET=x86_64
  50. endif
  51. ifdef ARM
  52. PPC_TARGET=arm
  53. endif
  54. ifdef ARMEB
  55. PPC_TARGET=armeb
  56. endif
  57. ifdef MIPS
  58. PPC_TARGET=mips
  59. endif
  60. ifdef MIPSEL
  61. PPC_TARGET=mipsel
  62. endif
  63. # Default is to generate a compiler for the same
  64. # platform as CPU_TARGET (a native compiler)
  65. ifndef PPC_TARGET
  66. PPC_TARGET=$(CPU_TARGET)
  67. endif
  68. ifeq ($(PPC_TARGET),armeb)
  69. CPC_TARGET=arm
  70. else
  71. CPC_TARGET=$(PPC_TARGET)
  72. endif
  73. # Default is to generate a compiler for the same
  74. # target as OS_TARGET (a native compiler)
  75. ifndef PPC_OS
  76. PPC_OS=$(OS_TARGET)
  77. endif
  78. # Where to place the unit files.
  79. CPU_UNITDIR=$(CPC_TARGET)
  80. # RTL
  81. UTILSDIR=../utils
  82. # Directories containing compiler sources
  83. COMPILERSOURCEDIR=$(CPC_TARGET) systems
  84. # Utils used by compiler development/installation
  85. COMPILERUTILSDIR=utils
  86. # Default language for the compiler
  87. ifndef FPCLANG
  88. FPCLANG=e
  89. endif
  90. # Local options for the compiler only
  91. ifndef LOCALOPT
  92. LOCALOPT:=$(OPT)
  93. endif
  94. # Options for the RTL only when cycling
  95. ifndef RTLOPT
  96. RTLOPT:=$(OPT)
  97. endif
  98. # Make OPT empty. It is copied to LOCALOPT and RTLOPT
  99. override OPT=
  100. # Message files
  101. MSGFILES=$(wildcard msg/error*.msg)
  102. # ppcSUFFIX
  103. ifeq ($(CPC_TARGET),i386)
  104. CPUSUF=386
  105. endif
  106. ifeq ($(CPC_TARGET),alpha)
  107. CPUSUF=axp
  108. endif
  109. ifeq ($(CPC_TARGET),m68k)
  110. CPUSUF=68k
  111. endif
  112. ifeq ($(CPC_TARGET),powerpc)
  113. CPUSUF=ppc
  114. endif
  115. ifeq ($(CPC_TARGET),powerpc64)
  116. CPUSUF=ppc64
  117. endif
  118. ifeq ($(CPC_TARGET),sparc)
  119. CPUSUF=sparc
  120. endif
  121. ifeq ($(CPC_TARGET),x86_64)
  122. CPUSUF=x64
  123. endif
  124. ifeq ($(CPC_TARGET),arm)
  125. CPUSUF=arm
  126. endif
  127. ifeq ($(CPC_TARGET),mips)
  128. CPUSUF=mips
  129. endif
  130. ifeq ($(CPC_TARGET),mipsel)
  131. CPUSUF=mipsel
  132. endif
  133. # Do not define the default -d$(CPU_TARGET) because that
  134. # will conflict with our -d$(CPC_TARGET)
  135. NOCPUDEF=1
  136. # Default message file
  137. MSGFILE=msg/error$(FPCLANG).msg
  138. SVNVERSION:=$(wildcard $(addsuffix /svnversion$(SRCEXEEXT),$(SEARCHPATH)))
  139. # Check if revision.inc is present
  140. REVINC:=$(wildcard revision.inc)
  141. ifneq ($(REVINC),)
  142. # File revision.inc is present
  143. #Use it to compile version.pas unit
  144. override LOCALOPT+=-dREVINC
  145. # Automatically update revision.inc if
  146. # svnversion executable is available
  147. ifeq ($(REVSTR),)
  148. ifneq ($(SVNVERSION),)
  149. REVSTR:=$(shell $(SVNVERSION) -c .)
  150. export REVSTR
  151. else
  152. ifeq ($(REVINC),force)
  153. REVSTR:=exported
  154. export REVSTR
  155. endif
  156. endif
  157. endif
  158. endif
  159. # set correct defines (-d$(CPU_TARGET) is automatically added in makefile.fpc)
  160. override LOCALOPT+=-d$(CPC_TARGET) -dGDB -dBROWSERLOG
  161. # i386 specific
  162. ifeq ($(PPC_TARGET),i386)
  163. override LOCALOPT+=-Fux86
  164. endif
  165. # x86_64 specific
  166. ifeq ($(PPC_TARGET),x86_64)
  167. override LOCALOPT+=-Fux86
  168. endif
  169. # PowerPC specific
  170. ifeq ($(PPC_TARGET),powerpc)
  171. override LOCALOPT+=-Fuppcgen
  172. endif
  173. # PowerPC64 specific
  174. ifeq ($(PPC_TARGET),powerpc64)
  175. override LOCALOPT+=-Fuppcgen
  176. endif
  177. # m68k specific
  178. ifeq ($(PPC_TARGET),m68k)
  179. override LOCALOPT+=-dNOOPT
  180. endif
  181. # Sparc specific
  182. ifeq ($(PPC_TARGET),sparc)
  183. override LOCALOPT+=
  184. endif
  185. # m68k specific with low stack
  186. ifeq ($(PPC_TARGET),m68k)
  187. ifeq ($(OS_TARGET),amiga)
  188. override LOCALOPT+=-Ct
  189. endif
  190. endif
  191. # ARM specific
  192. ifeq ($(PPC_TARGET),arm)
  193. override LOCALOPT+=
  194. endif
  195. # mipsel specific
  196. ifeq ($(PPC_TARGET),mipsel)
  197. override LOCALOPT+=-Fumips
  198. endif
  199. OPTWPOCOLLECT=-OWdevirtcalls,optvmts -FW$(BASEDIR)/pp1.wpo
  200. OPTWPOPERFORM=-Owdevirtcalls,optvmts -Fw$(BASEDIR)/pp1.wpo
  201. # symbol liveness WPO requires nm, smart linking and no stripping (the latter
  202. # is forced by the Makefile when necessary)
  203. ifneq ($(findstring $(OS_TARGET),darwin linux freebsd solaris),)
  204. ifdef LINKSMART
  205. ifdef CREATESMART
  206. OPTWPOCOLLECT+=-OWsymbolliveness -Xs-
  207. OPTWPOPERFORM+=-Owsymbolliveness
  208. endif
  209. endif
  210. endif
  211. [rules]
  212. #####################################################################
  213. # Setup Targets
  214. #####################################################################
  215. ifeq ($(OS_TARGET),win32)
  216. USE_CMP_FOR_DIFF=1
  217. endif
  218. ifeq ($(OS_TARGET),win64)
  219. USE_CMP_FOR_DIFF=1
  220. endif
  221. ifdef USE_CMP_FOR_DIFF
  222. ifdef CMP
  223. override DIFF:=$(CMP) -i218
  224. endif
  225. endif
  226. # Add Local options
  227. override COMPILER+=$(LOCALOPT)
  228. #####################################################################
  229. # PASDoc
  230. #####################################################################
  231. PASDOC:=$(strip $(wildcard $(addsuffix /pasdoc.exe,$(SEARCHPATH))))
  232. ifeq ($(PASDOC),)
  233. PASDOC:=$(strip $(wildcard $(addsuffix /pasdoc,$(SEARCHPATH))))
  234. endif
  235. ifeq ($(PASDOC),)
  236. PASDOC:=../projects/pasdoc/bin/pasdoc
  237. else
  238. PASDOC:=$(firstword $(PASDOC))
  239. endif
  240. #####################################################################
  241. # Setup os-independent filenames
  242. #####################################################################
  243. ifndef EXENAME
  244. EXENAME=ppc$(CPUSUF)$(EXEEXT)
  245. endif
  246. PPEXENAME=pp$(EXEEXT)
  247. TEMPNAME=ppc$(SRCEXEEXT)
  248. PPCROSSNAME=ppcross$(CPUSUF)$(SRCEXEEXT)
  249. TEMPNAME1=ppc1$(EXEEXT)
  250. TEMPNAME2=ppc2$(EXEEXT)
  251. TEMPNAME3=ppc3$(EXEEXT)
  252. TEMPWPONAME1=ppcwpo1$(EXEEXT)
  253. TEMPWPONAME2=ppcwpo2$(EXEEXT)
  254. MAKEDEP=ppdep$(EXEEXT)
  255. MSG2INC=./msg2inc$(EXEEXT)
  256. ifdef CROSSINSTALL
  257. INSTALLEXEFILE=$(PPCROSSNAME)
  258. else
  259. INSTALLEXEFILE=$(EXENAME)
  260. endif
  261. #####################################################################
  262. # CPU targets
  263. #####################################################################
  264. PPC_TARGETS=i386 m68k powerpc sparc arm armeb x86_64 powerpc64 alpha vis ia64 mips mipsel
  265. .PHONY: $(PPC_TARGETS)
  266. $(PPC_TARGETS):
  267. $(MAKE) PPC_TARGET=$@ CPU_UNITDIR=$@ all
  268. alltargets: $(ALLTARGETS)
  269. #####################################################################
  270. # Default makefile
  271. #####################################################################
  272. .NOTPARALLEL:
  273. .PHONY: all compiler echotime ppuclean execlean clean distclean
  274. all: compiler $(addsuffix _all,$(TARGET_DIRS))
  275. compiler: $(COMPILER_UNITTARGETDIR) $(COMPILER_TARGETDIR) $(EXENAME)
  276. ifeq ($(MAKELEVEL),0)
  277. ifndef STARTTIME
  278. ifdef DATE
  279. STARTTIME:=$(shell $(DATE) +%T)
  280. else
  281. STARTTIME:=unknown
  282. endif
  283. endif
  284. endif
  285. export STARTTIME
  286. ifdef DATE
  287. ENDTIME=$(shell $(DATE) +%T)
  288. else
  289. ENDTIME:=unknown
  290. endif
  291. echotime:
  292. @echo Start $(STARTTIME) now $(ENDTIME)
  293. ppuclean:
  294. -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
  295. -$(DEL) $(addsuffix /*$(PPUEXT),$(COMPILERSOURCEDIR))
  296. tempclean:
  297. -$(DEL) $(PPCROSSNAME) $(TEMPNAME) $(TEMPNAME1) $(TEMPNAME2) $(TEMPNAME3) $(MSG2INC) pp1.wpo pp2.wpo
  298. execlean :
  299. -$(DEL) ppc386$(EXEEXT) ppc68k$(EXEEXT) ppcx64$(EXEEXT) ppcppc$(EXEEXT) ppcsparc$(EXEEXT) ppcppc64$(EXEEXT) ppcarm$(EXEEXT) ppcmips$(EXEEXT) ppcmipsel$(EXEEXT) $(EXENAME) $(TEMPWPONAME1) $(TEMPWPONAME2)
  300. $(addsuffix _clean,$(ALLTARGETS)):
  301. -$(DELTREE) $(addprefix $(subst _clean,,$@),/units)
  302. -$(DEL) $(addprefix $(subst _clean,,$@)/,*$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT))
  303. -$(DEL) $(addprefix $(subst _clean,,$@)/,ppc386$(EXEEXT) ppc68k$(EXEEXT) ppcx64$(EXEEXT) ppcppc$(EXEEXT) ppcsparc$(EXEEXT) ppcppc64$(EXEEXT) ppcarm$(EXEEXT) ppcmips$(EXEEXT) ppcmipsel$(EXEEXT) $(EXENAME))
  304. cycleclean: cleanall $(addsuffix _clean,$(CPC_TARGET))
  305. -$(DEL) $(EXENAME)
  306. clean: tempclean execlean cleanall $(addsuffix _clean,$(CPC_TARGET)) $(addsuffix _clean,$(TARGET_DIRS))
  307. distclean: tempclean execlean cleanall $(addsuffix _clean,$(ALLTARGETS)) $(addsuffix _distclean,$(TARGET_DIRS))
  308. #####################################################################
  309. # Make targets
  310. #####################################################################
  311. $(MSG2INC): $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(COMPILERUTILSDIR)/msg2inc.pp
  312. $(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
  313. # The msgtxt.inc only depends on the error?.msg file, not on msg2inc,
  314. # because that one will be new almost everytime
  315. msgtxt.inc: $(MSGFILE)
  316. $(MAKE) $(MSG2INC)
  317. $(MSG2INC) $(MSGFILE) msg msg
  318. msg: msgtxt.inc
  319. insdatx86 : $(COMPILER_UNITTARGETDIR) x86/x86ins.dat
  320. $(COMPILER) -FE$(COMPILERUTILSDIR) $(COMPILERUTILSDIR)/mkx86ins.pp
  321. cd x86 && ../utils/mkx86ins$(SRCEXEEXT) && mv -f *.inc ../i386
  322. cd x86 && ../utils/mkx86ins$(SRCEXEEXT) x86_64 && mv -f *.inc ../x86_64
  323. insdatarm : arm/armins.dat
  324. $(COMPILER) -FE$(COMPILERUTILSDIR) $(COMPILERUTILSDIR)/mkarmins.pp
  325. cd arm && ../utils/mkarmins$(SRCEXEEXT)
  326. insdat: insdatx86 insdatarm
  327. regdatarm : arm/armreg.dat
  328. $(COMPILER) -FE$(COMPILERUTILSDIR) $(COMPILERUTILSDIR)/mkarmreg.pp
  329. cd arm && ../utils/mkarmreg$(SRCEXEEXT)
  330. # revision.inc rule
  331. revision.inc :
  332. ifneq ($(REVSTR),)
  333. ifdef USEZIPWRAPPER
  334. ifneq ($(ECHOREDIR),echo)
  335. $(ECHOREDIR) "'$(REVSTR)'" > revision.inc
  336. else
  337. $(ECHOREDIR) '$(REVSTR)' > revision.inc
  338. endif
  339. else
  340. $(ECHOREDIR) "'$(REVSTR)'" > revision.inc
  341. endif
  342. else
  343. $(MAKE) revision.inc REVINC=force
  344. endif
  345. .PHONY : revision
  346. revision :
  347. $(DEL) revision.inc
  348. $(MAKE) revision.inc
  349. # Make only the compiler
  350. # ECHOREDIR sometimes does not remove double quotes
  351. $(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg \
  352. $(wildcard systems/*.pas) $(wilcard systems/*.inc) \
  353. $(wildcard $(CPC_TARGET)/*.pas) $(wildcard $(CPC_TARGET)/*.inc)
  354. ifneq ($(REVSTR),)
  355. ifdef USEZIPWRAPPER
  356. ifneq ($(ECHOREDIR),echo)
  357. $(ECHOREDIR) "'$(REVSTR)'" > revision.inc
  358. else
  359. $(ECHOREDIR) '$(REVSTR)' > revision.inc
  360. endif
  361. else
  362. $(ECHOREDIR) "'$(REVSTR)'" > revision.inc
  363. endif
  364. $(COMPILER) version.pas
  365. endif
  366. $(COMPILER) pp.pas
  367. $(EXECPPAS)
  368. $(MOVE) $(COMPILER_TARGETDIR)/$(PPEXENAME) $(EXENAME)
  369. #####################################################################
  370. # Cycle targets
  371. #
  372. # 1. Source CPU = Target CPU and Source OS = Target OS
  373. # Normal cycle
  374. #
  375. # 2. Source CPU = Target CPU and Source OS <> Target OS
  376. # First source native compiler
  377. # Second target native compiler (skipped for cross installation)
  378. #
  379. # 3. Source CPU <> Target CPU
  380. # First source native compiler
  381. # Second cross compiler
  382. # Third target native compiler (skipped for cross installation)
  383. #
  384. #####################################################################
  385. ifeq ($(CPU_SOURCE),$(PPC_TARGET))
  386. ifeq ($(OS_SOURCE),$(OS_TARGET))
  387. ##########################
  388. # Normal cycle
  389. #
  390. ifndef NOWPOCYCLE
  391. ifdef RELEASE
  392. DOWPOCYCLE=1
  393. # Two WPO cycles in case of RELEASE=1
  394. wpocycle:
  395. # don't use cycle_clean, it will delete the compiler utilities again
  396. $(RM) $(EXENAME)
  397. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME3)' 'OPT=$(LOCALOPT) $(OPTWPOCOLLECT)' compiler
  398. $(RM) $(EXENAME)
  399. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME3)' 'OPT=$(RTLOPT) $(OPTWPOPERFORM)' rtlclean rtl
  400. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME3)' 'OPT=$(LOCALOPT) $(OPTWPOPERFORM) $(subst pp1.wpo,pp2.wpo,$(OPTWPOCOLLECT))' $(addsuffix _clean,$(ALLTARGETS)) compiler
  401. $(MOVE) $(EXENAME) $(TEMPWPONAME1)
  402. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPWPONAME1)' 'OPT=$(RTLOPT) $(subst pp1.wpo,pp2.wpo,$(OPTWPOPERFORM))' rtlclean rtl
  403. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPWPONAME1)' 'OPT=$(LOCALOPT) $(subst pp1.wpo,pp2.wpo,$(OPTWPOPERFORM))' $(addsuffix _clean,$(ALLTARGETS)) compiler
  404. $(COPY) $(EXENAME) $(TEMPWPONAME2)
  405. endif
  406. endif
  407. ifndef DOWPOCYCLE
  408. wpocycle:
  409. endif
  410. # Used to avoid unnecessary steps
  411. ifdef DIFF
  412. ifdef OLDFPC
  413. ifneq ($(OS_TARGET),darwin)
  414. DIFFRESULT:=$(shell $(DIFF) $(OLDFPC) $(FPC))
  415. else
  416. DIFFRESULT:=$(shell cp $(OLDFPC) $(OLDFPC).tmp; cp $(FPC) $(FPC).tmp; strip -no_uuid $(OLDFPC).tmp; strip -no_uuid $(FPC).tmp; $(DIFF) $(OLDFPC).tmp $(FPC).tmp; rm $(OLDFPC).tmp $(FPC).tmp)
  417. endif
  418. else
  419. DIFFRESULT=Not equal
  420. endif
  421. else
  422. DIFFRESULT=No diff program
  423. endif
  424. ifndef DIFFRESULT
  425. next :
  426. @echo $(OLDFPC) and $(FPC) are equal
  427. $(COPY) $(FPC) $(EXENAME)
  428. else
  429. next :
  430. $(MAKE) rtlclean rtl
  431. $(MAKE) cycleclean compiler
  432. $(MAKE) echotime
  433. endif
  434. $(TEMPNAME1) :
  435. $(MAKE) 'OLDFPC=' next
  436. -$(DEL) $(TEMPNAME1)
  437. $(MOVE) $(EXENAME) $(TEMPNAME1)
  438. $(TEMPNAME2) : $(TEMPNAME1)
  439. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME1)' 'OLDFPC=' next
  440. -$(DEL) $(TEMPNAME2)
  441. $(MOVE) $(EXENAME) $(TEMPNAME2)
  442. $(TEMPNAME3) : $(TEMPNAME2)
  443. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME2)' 'OLDFPC=$(BASEDIR)/$(TEMPNAME1)' next
  444. -$(DEL) $(TEMPNAME3)
  445. $(MOVE) $(EXENAME) $(TEMPNAME3)
  446. cycle:
  447. $(MAKE) tempclean $(TEMPNAME3)
  448. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME3)' 'OLDFPC=$(BASEDIR)/$(TEMPNAME2)' next
  449. $(DIFF) $(TEMPNAME3) $(EXENAME)
  450. $(MAKE) $(addsuffix _all,$(TARGET_DIRS)) 'FPC=$(BASEDIR)/$(EXENAME)'
  451. $(MAKE) wpocycle
  452. $(MAKE) echotime
  453. else
  454. ##########################
  455. # Cross Target cycle
  456. #
  457. cycle:
  458. # ppc (source native)
  459. $(MAKE) OS_TARGET=$(OS_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
  460. $(MAKE) OS_TARGET=$(OS_SOURCE) EXENAME=$(TEMPNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler
  461. # ppcross<ARCH> (source native)
  462. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
  463. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) EXENAME=$(PPCROSSNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler
  464. # ppc<ARCH> (target native)
  465. ifndef CROSSINSTALL
  466. $(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' rtlclean rtl
  467. # building a native compiler for embedded targets is not possible
  468. ifneq ($(OS_TARGET),embedded)
  469. $(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' cycleclean compiler
  470. endif
  471. endif
  472. endif
  473. else
  474. ##########################
  475. # Cross CPU cycle
  476. #
  477. # ppc1 = native
  478. # ppc2 = cross running on this platform
  479. # ppc3/ppcXXX = native (skipped for cross installation)
  480. #
  481. cycle:
  482. # ppc (source native)
  483. # Clear detected compiler binary, because it can be existing crosscompiler binary, but we need native compiler here
  484. override FPC=
  485. $(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
  486. $(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) EXENAME=$(TEMPNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler
  487. # ppcross<ARCH> (source native)
  488. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
  489. $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) PPC_TARGET=$(CPU_TARGET) EXENAME=$(PPCROSSNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler
  490. # ppc<ARCH> (target native)
  491. ifndef CROSSINSTALL
  492. $(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' 'OPT=$(OPT) $(CROSSOPT)' rtlclean rtl
  493. # building a native compiler for embedded targets is not possible
  494. ifneq ($(OS_TARGET),embedded)
  495. $(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' 'OPT=$(OPT) $(CROSSOPT)' cycleclean compiler
  496. endif
  497. endif
  498. endif
  499. cycledep:
  500. $(MAKE) cycle USEDEPEND=1
  501. extcycle:
  502. $(MAKE) cycle OPT='-n -OG2p3 -glttt -CRriot -dEXTDEBUG'
  503. cvstest:
  504. $(MAKE) cycle 'LOCALOPT=-n -Se' 'RTLOPT=-n -Se'
  505. ##########################
  506. # Full cycle
  507. #
  508. # 1. build a compiler using cycle
  509. # 2. remove all .ppufiles
  510. # 3. build all supported cross compilers except the
  511. # current PPC_TARGET which was already build
  512. #
  513. full: fullcycle
  514. fullcycle:
  515. $(MAKE) cycle
  516. $(MAKE) ppuclean
  517. $(MAKE) $(filter-out $(PPC_TARGET),$(CYCLETARGETS)) 'FPC=$(BASEDIR)/$(EXENAME)'
  518. #####################################################################
  519. # Docs
  520. #####################################################################
  521. htmldocs:
  522. $(PASDOC) -p -h -o html$(PATHSEP)$(PPC_TARGET) -d fpc -d gdb -d $(PPC_TARGET) -u $(PPC_TARGET) $(PPC_TARGET)$(PATHSEP)*.pas systems$(PATHSEP)*.pas *.pas
  523. #####################################################################
  524. # Installation
  525. #####################################################################
  526. .PHONY: quickinstall install installsym
  527. MSGINSTALLDIR=$(INSTALL_BASEDIR)/msg
  528. override PPEXEFILE:=$(wildcard $(EXENAME))
  529. ifdef UNIXHier
  530. PPCCPULOCATION=$(INSTALL_BASEDIR)
  531. else
  532. PPCCPULOCATION=$(INSTALL_BINDIR)
  533. endif
  534. # This will only install the ppcXXX executable, not the message files etc.
  535. quickinstall: $(addsuffix _install,$(TARGET_DIRS))
  536. # Install ppcXXX executable, for a cross installation we install
  537. # the ppcrossXXX as ppcXXX. The target native build ppcXXX is not used
  538. # for this installation type
  539. ifneq ($(INSTALLEXEFILE),)
  540. ifdef UPXPROG
  541. -$(UPXPROG) $(INSTALLEXEFILE)
  542. endif
  543. $(MKDIR) $(PPCCPULOCATION)
  544. $(INSTALLEXE) $(INSTALLEXEFILE) $(PPCCPULOCATION)/$(INSTALLEXEFILE)
  545. endif
  546. install: quickinstall
  547. ifndef CROSSINSTALL
  548. ifdef UNIXHier
  549. $(MKDIR) $(INSTALL_BASEDIR)
  550. $(INSTALLEXE) $(COMPILERUTILSDIR)/samplecfg $(INSTALL_BASEDIR)/samplecfg
  551. endif
  552. $(MKDIR) $(MSGINSTALLDIR)
  553. $(INSTALL) $(MSGFILES) $(MSGINSTALLDIR)
  554. endif
  555. # This also installs a link from bin to the actual executable.
  556. # The .deb does that later.
  557. installsymlink: install
  558. ifneq ($(PPCCPULOCATION),$(INSTALL_BINDIR))
  559. $(MKDIR) $(INSTALL_BINDIR)
  560. ln -sf $(INSTALL_BASEDIR)/$(EXENAME) $(INSTALL_BINDIR)/$(EXENAME)
  561. endif
  562. #####################################################################
  563. # RTL
  564. #####################################################################
  565. .PHONY: rtl rtlclean rtlinstall
  566. rtl:
  567. $(MAKE) -C $(PACKAGEDIR_RTL) 'OPT=$(RTLOPT)' all
  568. rtlclean:
  569. $(MAKE) -C $(PACKAGEDIR_RTL) clean
  570. rtlinstall:
  571. $(MAKE) -C $(PACKAGEDIR_RTL) install
  572. #####################################################################
  573. # local user configurable file
  574. # in makefile.loc you can add any desired target
  575. #####################################################################
  576. localmake:=$(strip $(wildcard makefile.loc))
  577. ifdef localmake
  578. include ./$(localmake)
  579. endif