1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990
|
#
# Makefile.fpc for Free Pascal Compiler
#
[package]
name=compiler
version=3.2.2
[target]
programs=pp
dirs=utils
[compiler]
targetdir=.
unittargetdir=$(CPU_UNITDIR)/units/$(FULL_TARGET)
unitdir=$(COMPILERSOURCEDIR)
includedir=$(CPC_TARGET)
[require]
packages=rtl
tools=diff cmp
[install]
fpcpackage=y
[default]
fpcdir=..
[prerules]
# Don't export version it can change after the first compile
unexport FPC_VERSION FPC_COMPILERINFO
# Which platforms are ready for inclusion in the cycle
CYCLETARGETS=i386 powerpc sparc arm x86_64 powerpc64 m68k armeb mipsel mips avr jvm i8086 aarch64 sparc64
# All supported targets used for clean
ALLTARGETS=$(CYCLETARGETS)
# Allow POWERPC, POWERPC64, M68K, I386, jvm defines for target cpu
ifdef POWERPC
PPC_TARGET=powerpc
endif
ifdef POWERPC64
PPC_TARGET=powerpc64
endif
ifdef SPARC
PPC_TARGET=sparc
endif
ifdef SPARC64
PPC_TARGET=sparc64
endif
ifdef M68K
PPC_TARGET=m68k
endif
ifdef I386
PPC_TARGET=i386
endif
ifdef X86_64
PPC_TARGET=x86_64
endif
ifdef ARM
PPC_TARGET=arm
endif
ifdef ARMEB
PPC_TARGET=armeb
endif
ifdef MIPS
PPC_TARGET=mips
endif
ifdef MIPSEL
PPC_TARGET=mipsel
endif
ifdef AVR
PPC_TARGET=avr
endif
ifdef JVM
PPC_TARGET=jvm
endif
ifdef I8086
PPC_TARGET=i8086
endif
ifdef AARCH64
PPC_TARGET=aarch64
endif
# Default is to generate a compiler for the same
# platform as CPU_TARGET (a native compiler)
ifndef PPC_TARGET
PPC_TARGET=$(CPU_TARGET)
endif
ifeq ($(PPC_TARGET),armeb)
CPC_TARGET=arm
else
CPC_TARGET=$(PPC_TARGET)
endif
# Default is to generate a compiler for the same
# target as OS_TARGET (a native compiler)
ifndef PPC_OS
PPC_OS=$(OS_TARGET)
endif
# Where to place the unit files.
CPU_UNITDIR=$(CPC_TARGET)
# RTL
UTILSDIR=../utils
# Directories containing compiler sources
COMPILERSOURCEDIR=$(CPC_TARGET) systems
# Utils used by compiler development/installation
COMPILERUTILSDIR=utils
# Default language for the compiler
ifndef FPCLANG
FPCLANG=e
endif
# Local options for the compiler only
ifndef LOCALOPT
LOCALOPT:=$(OPT)
endif
# Options for the RTL only when cycling
ifndef RTLOPT
RTLOPT:=$(OPT)
endif
ifdef CYCLELEVEL
ifeq ($(CYCLELEVEL),1)
override LOCALOPT+=$(OPTLEVEL1)
override RTLOPT+=$(OPTLEVEL1)
override LOCALOPT+=$(LOCALOPTLEVEL1)
override RTLOPT+=$(RTLOPTLEVEL1)
endif
ifeq ($(CYCLELEVEL),2)
override LOCALOPT+=$(OPTLEVEL2)
override RTLOPT+=$(OPTLEVEL2)
override LOCALOPT+=$(LOCALOPTLEVEL2)
override RTLOPT+=$(RTLOPTLEVEL2)
override LOCALOPT+=$(OPTNEW)
override RTLOPT+=$(OPTNEW)
endif
ifeq ($(CYCLELEVEL),3)
override LOCALOPT+=$(OPTLEVEL3)
override RTLOPT+=$(OPTLEVEL3)
override LOCALOPT+=$(LOCALOPTLEVEL3)
override RTLOPT+=$(RTLOPTLEVEL3)
override LOCALOPT+=$(OPTNEW)
override RTLOPT+=$(OPTNEW)
endif
ifeq ($(CYCLELEVEL),4)
override LOCALOPT+=$(OPTLEVEL4)
override RTLOPT+=$(OPTLEVEL4)
override LOCALOPT+=$(LOCALOPTLEVEL4)
override RTLOPT+=$(RTLOPTLEVEL4)
override LOCALOPT+=$(OPTNEW)
override RTLOPT+=$(OPTNEW)
endif
endif
# Make OPT empty. It is copied to LOCALOPT and RTLOPT
override OPT=
# Message files
MSGFILES=$(wildcard msg/error*.msg)
# ppcSUFFIX
ifeq ($(CPC_TARGET),i386)
CPUSUF=386
endif
ifeq ($(CPC_TARGET),m68k)
CPUSUF=68k
ALLOW_WARNINGS=1
endif
ifeq ($(CPC_TARGET),powerpc)
CPUSUF=ppc
endif
ifeq ($(CPC_TARGET),powerpc64)
CPUSUF=ppc64
endif
ifeq ($(CPC_TARGET),sparc)
CPUSUF=sparc
endif
ifeq ($(CPC_TARGET),sparc64)
CPUSUF=sparc64
endif
ifeq ($(CPC_TARGET),x86_64)
CPUSUF=x64
endif
ifeq ($(CPC_TARGET),arm)
CPUSUF=arm
endif
ifeq ($(CPC_TARGET),mips)
CPUSUF=mips
endif
ifeq ($(CPC_TARGET),mipsel)
CPUSUF=mipsel
endif
ifeq ($(CPC_TARGET),avr)
CPUSUF=avr
ALLOW_WARNINGS=1
endif
ifeq ($(CPC_TARGET),jvm)
CPUSUF=jvm
endif
ifeq ($(CPC_TARGET),i8086)
CPUSUF=8086
endif
ifeq ($(CPC_TARGET),aarch64)
CPUSUF=a64
endif
# Do not define the default -d$(CPU_TARGET) because that
# will conflict with our -d$(CPC_TARGET)
NOCPUDEF=1
# Default message file
MSGFILE=msg/error$(FPCLANG).msg
SVNVERSION:=$(firstword $(wildcard $(addsuffix /svnversion$(SRCEXEEXT),$(SEARCHPATH))))
# Check if revision.inc is present
REVINC:=$(wildcard revision.inc)
ifneq ($(REVINC),)
# File revision.inc is present
#Use it to compile version.pas unit
override LOCALOPT+=-dREVINC
# Automatically update revision.inc if
# svnversion executable is available
ifeq ($(REVSTR),)
ifneq ($(SVNVERSION),)
REVSTR:=$(subst r,,$(subst r1:,,r$(subst exported,,$(shell $(SVNVERSION) -c .))))
export REVSTR
else
ifeq ($(REVINC),force)
REVSTR:=exported
export REVSTR
endif
endif
endif
endif
# set correct defines (-d$(CPU_TARGET) is automatically added in makefile.fpc)
override LOCALOPT+=-d$(CPC_TARGET) -dGDB -dBROWSERLOG
#include LLVM define/directory if requested
ifdef LLVM
ifeq ($(findstring $(PPC_TARGET),x86_64),)
$(error The $(PPC_TARGET) architecture is not (yet) support by the FPC/LLVM code generator)
endif
ifeq ($(findstring $(OS_TARGET),darwin iphonesim linux),)
$(error The $(PPC_TARGET) target OS is not (yet) support by the FPC/LLVM code generator)
endif
override LOCALOPT+=-dllvm -Fullvm
endif
# i386 specific
ifeq ($(PPC_TARGET),i386)
override LOCALOPT+=-Fux86
endif
# x86_64 specific
ifeq ($(PPC_TARGET),x86_64)
override LOCALOPT+=-Fux86
endif
# PowerPC specific
ifeq ($(PPC_TARGET),powerpc)
override LOCALOPT+=-Fuppcgen
endif
# PowerPC64 specific
ifeq ($(PPC_TARGET),powerpc64)
override LOCALOPT+=-Fuppcgen
endif
# m68k specific
ifeq ($(PPC_TARGET),m68k)
override LOCALOPT+=
endif
# Sparc specific
ifeq ($(PPC_TARGET),sparc)
override LOCALOPT+=-Fusparcgen -Fisparcgen
endif
# Sparc specific
ifeq ($(PPC_TARGET),sparc64)
override LOCALOPT+=-Fusparcgen -Fisparcgen
endif
# ARM specific
ifeq ($(PPC_TARGET),arm)
override LOCALOPT+=
endif
# mipsel specific
ifeq ($(PPC_TARGET),mipsel)
override LOCALOPT+=-Fumips
endif
# jvm specific
ifeq ($(PPC_TARGET),jvm)
override LOCALOPT+=-Fujvm
endif
# i8086 specific
ifeq ($(PPC_TARGET),i8086)
override LOCALOPT+=-Fux86
endif
OPTWPOCOLLECT=-OWdevirtcalls,optvmts -FW$(BASEDIR)/pp1.wpo
OPTWPOPERFORM=-Owdevirtcalls,optvmts -Fw$(BASEDIR)/pp1.wpo
# symbol liveness WPO requires nm, smart linking and no stripping (the latter
# is forced by the Makefile when necessary)
ifneq ($(findstring $(OS_TARGET),darwin linux dragonfly freebsd solaris),)
ifdef LINKSMART
ifdef CREATESMART
OPTWPOCOLLECT+=-OWsymbolliveness -Xs-
OPTWPOPERFORM+=-Owsymbolliveness
endif
endif
endif
# Don't compile a native compiler & utilities for JVM and embedded
# targets
ifeq ($(CPU_TARGET),jvm)
NoNativeBinaries=1
endif
ifeq ($(OS_TARGET),embedded)
NoNativeBinaries=1
endif
ifeq ($(OS_TARGET),gba)
NoNativeBinaries=1
endif
ifeq ($(OS_TARGET),msdos)
NoNativeBinaries=1
endif
ifeq ($(OS_TARGET),nds)
NoNativeBinaries=1
endif
ifeq ($(OS_TARGET),win16)
NoNativeBinaries=1
endif
ifeq ($(OS_TARGET),macosclassic)
NoNativeBinaries=1
endif
# Allow install for jvm
ifeq ($(NoNativeBinaries),1)
override EXEEXT=$(SRCEXEEXT)
# In those cases, installation in a cross-installation
CROSSINSTALL=1
endif
[rules]
#####################################################################
# Setup Targets
#####################################################################
ifneq ($(findstring $(OS_TARGET),win32 win64 aix),)
USE_CMP_FOR_DIFF=1
endif
ifdef USE_CMP_FOR_DIFF
ifdef CMP
override DIFF:=$(CMP) -i218
endif
endif
ifeq ($(OS_TARGET), darwin)
CODESIGN?=$(firstword $(wildcard $(addsuffix /codesign$(SRCEXEEXT),$(SEARCHPATH))))
endif
# Use -Sew option by default
# Allow disabling by setting ALLOW_WARNINGS=1
ifneq ($(CYCLELEVEL),1)
ifndef ALLOW_WARNINGS
override LOCALOPT+=-Sew
endif
endif
# Add Local options
override COMPILER+=$(LOCALOPT)
#####################################################################
# PASDoc
#####################################################################
PASDOC:=$(strip $(wildcard $(addsuffix /pasdoc.exe,$(SEARCHPATH))))
ifeq ($(PASDOC),)
PASDOC:=$(strip $(wildcard $(addsuffix /pasdoc,$(SEARCHPATH))))
endif
ifeq ($(PASDOC),)
PASDOC:=../projects/pasdoc/bin/pasdoc
else
PASDOC:=$(firstword $(PASDOC))
endif
#####################################################################
# Setup os-independent filenames
#####################################################################
ifndef EXENAME
EXENAME=ppc$(CPUSUF)$(EXEEXT)
endif
PPEXENAME=pp$(EXEEXT)
TEMPNAME=ppc$(SRCEXEEXT)
ifneq ($(CPUSUF),jvm)
PPCROSSNAME=ppcross$(CPUSUF)$(SRCEXEEXT)
else
PPCROSSNAME=ppc$(CPUSUF)$(SRCEXEEXT)
endif
TEMPNAME1=ppc1$(EXEEXT)
TEMPNAME2=ppc2$(EXEEXT)
TEMPNAME3=ppc3$(EXEEXT)
TEMPWPONAME1=ppcwpo1$(EXEEXT)
TEMPWPONAME2=ppcwpo2$(EXEEXT)
MAKEDEP=ppdep$(EXEEXT)
MSG2INC=./msg2inc$(EXEEXT)
ifdef CROSSINSTALL
INSTALLEXEFILE=$(PPCROSSNAME)
else
INSTALLEXEFILE=$(EXENAME)
endif
#####################################################################
# CPU targets
#####################################################################
PPC_TARGETS=i386 m68k powerpc sparc arm armeb x86_64 powerpc64 mips mipsel avr jvm i8086 aarch64 sparc64
PPC_SUFFIXES=386 68k ppc sparc arm armeb x64 ppc64 mips mipsel avr jvm 8086 a64 sparc64
INSTALL_TARGETS=$(addsuffix _exe_install,$(sort $(CYCLETARGETS) $(PPC_TARGETS)))
SYMLINKINSTALL_TARGETS=$(addsuffix _symlink_install,$(sort $(CYCLETARGETS) $(PPC_TARGETS)))
.PHONY: $(PPC_TARGETS) $(INSTALL_TARGETS)$(SYMLINKINSTALL_TARGETS)
$(PPC_TARGETS):
$(MAKE) PPC_TARGET=$@ CPU_UNITDIR=$@ all
$(INSTALL_TARGETS):
$(MAKE) all install PPC_TARGET=$(subst _exe_install,,$@) CPU_UNITDIR=$(subst _exe_install,,$@)
$(SYMLINKINSTALL_TARGETS):
$(MAKE) all installsymlink PPC_TARGET=$(subst _symlink_install,,$@) CPU_UNITDIR=$(subst _symlink_install,,$@)
alltargets: $(ALLTARGETS)
#####################################################################
# Default makefile
#####################################################################
.NOTPARALLEL:
.PHONY: all compiler echotime ppuclean execlean clean distclean
all: compiler $(addsuffix _all,$(TARGET_DIRS))
compiler: $(COMPILER_UNITTARGETDIR) $(COMPILER_TARGETDIR) $(EXENAME)
ifeq ($(MAKELEVEL),0)
ifndef STARTTIME
ifdef DATE
STARTTIME:=$(shell $(DATE) +%T)
else
STARTTIME:=unknown
endif
endif
endif
export STARTTIME
ifdef DATE
ENDTIME=$(shell $(DATE) +%T)
else
ENDTIME:=unknown
endif
echotime:
@echo Start $(STARTTIME) now $(ENDTIME)
ppuclean:
-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
-$(DEL) $(addsuffix /*$(PPUEXT),$(COMPILERSOURCEDIR))
tempclean:
-$(DEL) $(PPCROSSNAME) $(TEMPNAME) $(TEMPNAME1) $(TEMPNAME2) $(TEMPNAME3) $(MSG2INC) pp1.wpo pp2.wpo
execlean :
-$(DEL) $(addsuffix $(EXEEXT), $(addprefix ppc, $(PPC_SUFFIXES)))
-$(DEL) $(addsuffix $(EXEEXT), $(addprefix ppcross, $(PPC_SUFFIXES)))
-$(DEL) $(EXENAME) $(TEMPWPONAME1) $(TEMPWPONAME2)
$(addsuffix _clean,$(ALLTARGETS)):
-$(DELTREE) $(addprefix $(subst _clean,,$@),/units)
-$(DELTREE) $(addprefix $(subst _clean,,$@),/bin)
-$(DEL) $(addprefix $(subst _clean,,$@)/,*$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT))
-$(DEL) $(addprefix $(subst _clean,,$@)/ppc,$(addsuffix $(EXEEXT), $(PPC_SUFFIXES)))
cycleclean: cleanall $(addsuffix _clean,$(CPC_TARGET))
-$(DEL) $(EXENAME)
clean: tempclean execlean cleanall $(addsuffix _clean,$(CPC_TARGET)) $(addsuffix _clean,$(TARGET_DIRS))
distclean: tempclean execlean cleanall $(addsuffix _clean,$(ALLTARGETS)) $(addsuffix _distclean,$(TARGET_DIRS))
#####################################################################
# Make targets
#####################################################################
$(MSG2INC): $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(COMPILERUTILSDIR)/msg2inc.pp
$(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
# The msgtxt.inc only depends on the error?.msg file, not on msg2inc,
# because that one will be new almost everytime
msgtxt.inc: $(MSGFILE)
$(MAKE) $(MSG2INC)
$(MSG2INC) $(MSGFILE) msg msg
msg: msgtxt.inc
insdatx86 : $(COMPILER_UNITTARGETDIR) x86/x86ins.dat
$(COMPILER) -FE$(COMPILERUTILSDIR) $(COMPILERUTILSDIR)/mkx86ins.pp
cd x86 && ..$(PATHSEP)utils$(PATHSEP)mkx86ins$(SRCEXEEXT) i8086 && mv -f *.inc ../i8086
cd x86 && ..$(PATHSEP)utils$(PATHSEP)mkx86ins$(SRCEXEEXT) && mv -f *.inc ../i386
cd x86 && ..$(PATHSEP)utils$(PATHSEP)mkx86ins$(SRCEXEEXT) x86_64 && mv -f *.inc ../x86_64
insdatarm : arm/armins.dat
$(COMPILER) -FE$(COMPILERUTILSDIR) $(COMPILERUTILSDIR)/mkarmins.pp
cd arm && ..$(PATHSEP)utils$(PATHSEP)mkarmins$(SRCEXEEXT)
insdataarch64 : aarch64/a64ins.dat
$(COMPILER) -FE$(COMPILERUTILSDIR) $(COMPILERUTILSDIR)/mka64ins.pp
cd aarch64 && ..$(PATHSEP)utils$(PATHSEP)mka64ins$(SRCEXEEXT)
insdat: insdatx86 insdatarm insdataarch64
regdatx86 : x86/x86reg.dat
$(COMPILER) -FE$(COMPILERUTILSDIR) $(COMPILERUTILSDIR)/mkx86reg.pp
cd x86 && ..$(PATHSEP)utils$(PATHSEP)mkx86reg$(SRCEXEEXT) i8086
mv -f x86/r8086*.inc i8086
cd x86 && ..$(PATHSEP)utils$(PATHSEP)mkx86reg$(SRCEXEEXT)
mv -f x86/r386*.inc i386
cd x86 && ..$(PATHSEP)utils$(PATHSEP)mkx86reg$(SRCEXEEXT) x86_64
mv -f x86/r8664*.inc x86_64
regdatarm : arm/armreg.dat
$(COMPILER) -FE$(COMPILERUTILSDIR) $(COMPILERUTILSDIR)/mkarmreg.pp
cd arm && ..$(PATHSEP)utils$(PATHSEP)mkarmreg$(SRCEXEEXT)
regdatsp : sparcgen/spreg.dat
$(COMPILER) -FE$(COMPILERUTILSDIR) $(COMPILERUTILSDIR)/mkspreg.pp
cd sparcgen && ..$(PATHSEP)utils$(PATHSEP)mkspreg$(SRCEXEEXT)
mv -f sparcgen/rsp*.inc sparc
regdatsp64 : sparcgen/spreg.dat
$(COMPILER) -FE$(COMPILERUTILSDIR) $(COMPILERUTILSDIR)/mkspreg.pp
cd sparcgen && ..$(PATHSEP)utils$(PATHSEP)mkspreg$(SRCEXEEXT) sparc64
mv -f sparcgen/rsp*.inc sparc64
regdatavr : avr/avrreg.dat
$(COMPILER) -FE$(COMPILERUTILSDIR) $(COMPILERUTILSDIR)/mkavrreg.pp
cd avr && ..$(PATHSEP)utils$(PATHSEP)mkavrreg$(SRCEXEEXT)
regdataarch64 : aarch64/a64reg.dat
$(COMPILER) -FE$(COMPILERUTILSDIR) $(COMPILERUTILSDIR)/mka64reg.pp
cd aarch64 && ..$(PATHSEP)utils$(PATHSEP)mka64reg$(SRCEXEEXT)
regdatmips : mips/mipsreg.dat
$(COMPILER) -FE$(COMPILERUTILSDIR) $(COMPILERUTILSDIR)/mkmpsreg.pp
cd mips && ..$(PATHSEP)utils$(PATHSEP)mkmpsreg$(SRCEXEEXT)
regdat : regdatx86 regdatarm regdatsp regdatavr regdataarch64 regdatmips regdatsp64
# revision.inc rule
revision.inc :
ifneq ($(REVSTR),)
ifdef USEZIPWRAPPER
ifneq ($(ECHOREDIR),echo)
$(ECHOREDIR) "'$(REVSTR)'" > revision.inc
else
$(ECHOREDIR) '$(REVSTR)' > revision.inc
endif
else
$(ECHOREDIR) "'$(REVSTR)'" > revision.inc
endif
else
$(MAKE) revision.inc REVINC=force
endif
.PHONY : revision
revision :
$(DEL) revision.inc
$(MAKE) revision.inc
# Make only the compiler
# ECHOREDIR sometimes does not remove double quotes
$(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg \
$(wildcard systems/*.pas) $(wilcard systems/*.inc) \
$(wildcard $(CPC_TARGET)/*.pas) $(wildcard $(CPC_TARGET)/*.inc) \
$(COMPILER_UNITTARGETDIR) $(COMPILER_TARGETDIR)
ifneq ($(REVSTR),)
ifdef USEZIPWRAPPER
ifneq ($(ECHOREDIR),echo)
$(ECHOREDIR) "'$(REVSTR)'" > revision.inc
else
$(ECHOREDIR) '$(REVSTR)' > revision.inc
endif
else
$(ECHOREDIR) "'$(REVSTR)'" > revision.inc
endif
$(COMPILER) version.pas
endif
$(COMPILER) pp.pas
$(EXECPPAS)
$(MOVE) $(COMPILER_TARGETDIR)/$(PPEXENAME) $(EXENAME)
#####################################################################
# Cycle targets
#
# 1. Source CPU = Target CPU and Source OS = Target OS
# Normal cycle
#
# 2. Source CPU = Target CPU and Source OS <> Target OS
# First source native compiler
# Second target native compiler (skipped for cross installation)
#
# 3. Source CPU <> Target CPU
# First source native compiler
# Second cross compiler
# Third target native compiler (skipped for cross installation)
#
#####################################################################
.PHONY: cycle fullcycle wpocycle
ifeq ($(CPU_SOURCE),$(PPC_TARGET))
ifeq ($(OS_SOURCE),$(OS_TARGET))
##########################
# Normal cycle
#
ifndef NOWPOCYCLE
ifdef RELEASE
DOWPOCYCLE=1
# Two WPO cycles in case of RELEASE=1
wpocycle:
# don't use cycle_clean, it will delete the compiler utilities again
$(RM) $(EXENAME)
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME3)' 'OPT=$(strip $(LOCALOPT) $(OPTWPOCOLLECT) $(OPTNEW))' compiler
$(RM) $(EXENAME)
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME3)' 'OPT=$(strip $(RTLOPT) $(OPTWPOPERFORM) $(OPTNEW))' rtlclean rtl
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME3)' 'OPT=$(strip $(LOCALOPT) $(OPTNEW) $(OPTWPOPERFORM) $(subst pp1.wpo,pp2.wpo,$(OPTWPOCOLLECT)))' $(addsuffix _clean,$(ALLTARGETS)) compiler
$(MOVE) $(EXENAME) $(TEMPWPONAME1)
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPWPONAME1)' 'OPT=$(strip $(RTLOPT) $(OPTNEW) $(subst pp1.wpo,pp2.wpo,$(OPTWPOPERFORM)))' rtlclean rtl
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPWPONAME1)' 'OPT=$(strip $(LOCALOPT) $(OPTNEW) $(subst pp1.wpo,pp2.wpo,$(OPTWPOPERFORM)))' $(addsuffix _clean,$(ALLTARGETS)) compiler
$(COPY) $(EXENAME) $(TEMPWPONAME2)
endif
endif
ifndef DOWPOCYCLE
wpocycle:
endif
# Used to avoid unnecessary steps
ifdef DIFF
ifdef OLDFPC
ifneq ($(OS_TARGET),darwin)
DIFFRESULT:=$(shell $(DIFF) $(OLDFPC) $(FPC))
else
ifneq ($(CODESIGN),)
DIFFRESULT:=$(shell $(COPY) $(OLDFPC) $(OLDFPC).tmp; $(COPY) $(FPC) $(FPC).tmp; strip -no_uuid $(OLDFPC).tmp; strip -no_uuid $(FPC).tmp; $(CODESIGN) --remove-signature $(OLDFPC).tmp; $(CODESIGN) --remove-signature $(FPC).tmp; $(DIFF) $(OLDFPC).tmp $(FPC).tmp; $(RMPROG) $(OLDFPC).tmp $(FPC).tmp)
else
DIFFRESULT:=$(shell $(COPY) $(OLDFPC) $(OLDFPC).tmp; $(COPY) $(FPC) $(FPC).tmp; strip -no_uuid $(OLDFPC).tmp; strip -no_uuid $(FPC).tmp; $(DIFF) $(OLDFPC).tmp $(FPC).tmp; $(RMPROG) $(OLDFPC).tmp $(FPC).tmp)
endif
endif
else
DIFFRESULT=Not equal
endif
else
DIFFRESULT=No diff program
endif
ifndef DIFFRESULT
next :
@echo $(OLDFPC) and $(FPC) are equal
$(COPY) $(FPC) $(EXENAME)
else
next :
$(MAKE) rtlclean rtl
$(MAKE) cycleclean compiler
$(MAKE) echotime
endif
$(TEMPNAME1) :
$(MAKE) 'OLDFPC=' next CYCLELEVEL=1
-$(DEL) $(TEMPNAME1)
$(MOVE) $(EXENAME) $(TEMPNAME1)
$(TEMPNAME2) : $(TEMPNAME1)
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME1)' 'OLDFPC=' next CYCLELEVEL=2
-$(DEL) $(TEMPNAME2)
$(MOVE) $(EXENAME) $(TEMPNAME2)
$(TEMPNAME3) : $(TEMPNAME2)
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME2)' 'OLDFPC=$(BASEDIR)/$(TEMPNAME1)' next CYCLELEVEL=3
-$(DEL) $(TEMPNAME3)
$(MOVE) $(EXENAME) $(TEMPNAME3)
cycle:
$(MAKE) tempclean $(TEMPNAME3)
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME3)' 'OLDFPC=$(BASEDIR)/$(TEMPNAME2)' next CYCLELEVEL=4
ifneq ($(OS_TARGET), darwin)
$(DIFF) $(TEMPNAME3) $(EXENAME)
else
$(COPY) $(TEMPNAME3) $(TEMPNAME3).tmp
$(COPY) $(EXENAME) $(EXENAME).tmp
strip -no_uuid $(TEMPNAME3).tmp
strip -no_uuid $(EXENAME).tmp
ifneq ($(CODESIGN),)
$(CODESIGN) --remove-signature $(TEMPNAME3).tmp
$(CODESIGN) --remove-signature $(EXENAME).tmp
endif
$(DIFF) $(TEMPNAME3).tmp $(EXENAME).tmp
rm $(TEMPNAME3).tmp $(EXENAME).tmp
endif
$(MAKE) $(addsuffix _all,$(TARGET_DIRS)) 'FPC=$(BASEDIR)/$(EXENAME)'
$(MAKE) wpocycle
$(MAKE) echotime
else
##########################
# Cross Target cycle
#
cycle:
# ppc (source native)
$(MAKE) OS_TARGET=$(OS_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl CYCLELEVEL=1
$(MAKE) OS_TARGET=$(OS_SOURCE) EXENAME=$(TEMPNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler CYCLELEVEL=1
# ppcross<ARCH> (source native)
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl CYCLELEVEL=2
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) EXENAME=$(PPCROSSNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler CYCLELEVEL=2
# ppc<ARCH> (target native)
ifndef CROSSINSTALL
$(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' rtlclean rtl CYCLELEVEL=3
ifndef NoNativeBinaries
$(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' cycleclean compiler CYCLELEVEL=3
endif
endif
endif
else
##########################
# Cross CPU cycle
#
# ppc1 = native
# ppc2 = cross running on this platform
# ppc3/ppcXXX = native (skipped for cross installation)
#
cycle: override FPC=
cycle:
# ppc (source native)
# Clear detected compiler binary, because it can be existing crosscompiler binary, but we need native compiler here
$(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl CYCLELEVEL=1
$(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) EXENAME=$(TEMPNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler CYCLELEVEL=1
# ppcross<ARCH> (source native)
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl CYCLELEVEL=2
$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) PPC_TARGET=$(CPU_TARGET) EXENAME=$(PPCROSSNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler CYCLELEVEL=2
# ppc<ARCH> (target native)
ifndef CROSSINSTALL
$(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' 'OPT=$(RTLOPT) $(CROSSOPT)' rtlclean rtl CYCLELEVEL=3
ifndef NoNativeBinaries
$(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' 'OPT=$(strip $(LOCALOPT) $(CROSSOPT))' cycleclean compiler CYCLELEVEL=3
endif
endif
endif
cycledep:
$(MAKE) cycle USEDEPEND=1
# extcycle should still work, but generates
# lots of warnings, so ALLOW_WARNINGS=1 is required
extcycle:
$(MAKE) cycle OPT="$(OPT) -n -OG2p3 -glttt -CRriot -dEXTDEBUG" ALLOW_WARNINGS=1
cvstest:
$(MAKE) cycle 'LOCALOPT=-n -Se' 'RTLOPT=-n -Se'
##########################
# Full cycle
#
# 1. build a compiler using cycle
# 2. remove all .ppufiles
# 3. clean and recompile rtl if DOWPOCYCLE is set
# 4. build all supported cross compilers except the
# current PPC_TARGET which was already build
# unless FPC_SUPPORT_X87_TYPES_ON_WIN64 is set,
# win64 cannot compile i386 or i8086 compiler
# This is also the case for other CPUs that don't support
# 80bit real type.
ifeq ($(OS_SOURCE),win64)
EXCLUDE_80BIT_TARGETS=1
endif
ifneq ($(findstring $(CPU_SOURCE),aarch64 arm avr jvm m68k mips mipsel powerpc powerpc64 sparc sparc64),)
EXCLUDE_80BIT_TARGETS=1
endif
full: fullcycle
fullcycle:
$(MAKE) cycle
$(MAKE) ppuclean
ifdef DOWPOCYCLE
$(MAKE) rtlclean
$(MAKE) rtl 'FPC=$(BASEDIR)/$(EXENAME)'
endif
ifndef EXCLUDE_80BIT_TARGETS
$(MAKE) $(filter-out $(PPC_TARGET),$(CYCLETARGETS)) 'FPC=$(BASEDIR)/$(EXENAME)'
else
$(MAKE) $(filter-out i8086,$(filter-out i386,$(filter-out $(PPC_TARGET),$(CYCLETARGETS)))) 'FPC=$(BASEDIR)/$(EXENAME)'
endif
#####################################################################
# Docs
#####################################################################
htmldocs:
$(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
#####################################################################
# Installation
#####################################################################
.PHONY: quickinstall exeinstall install installsymlink fullinstall fullinstallsymlink
MSGINSTALLDIR=$(INSTALL_BASEDIR)/msg
override PPEXEFILE:=$(wildcard $(EXENAME))
ifdef UNIXHier
PPCCPULOCATION=$(INSTALL_BASEDIR)
else
PPCCPULOCATION=$(INSTALL_BINDIR)
endif
ifndef NoNativeBinaries
quickinstall: quickinstall_withutils
else
quickinstall: exeinstall
endif
# This will only install the ppcXXX executable, not the message files etc.
quickinstall_withutils: $(addsuffix _install,$(TARGET_DIRS)) exeinstall
# Install ppcXXX executable, for a cross installation we install
# the ppcrossXXX as ppcXXX. The target native build ppcXXX is not used
# for this installation type
exeinstall:
ifneq ($(INSTALLEXEFILE),)
ifdef UPXPROG
-$(UPXPROG) $(INSTALLEXEFILE)
endif
$(MKDIR) $(PPCCPULOCATION)
$(INSTALLEXE) $(INSTALLEXEFILE) $(PPCCPULOCATION)/$(INSTALLEXEFILE)
endif
fullinstall:
ifndef EXCLUDE_80BIT_TARGETS
$(MAKE) $(addsuffix _exe_install,$(filter-out $(PPC_TARGET),$(CYCLETARGETS)))
else
$(MAKE) $(addsuffix _exe_install,$(filter-out i8086,$(filter-out i386,$(filter-out $(PPC_TARGET),$(CYCLETARGETS)))))
endif
install: quickinstall
ifndef CROSSINSTALL
ifdef UNIXHier
$(MKDIR) $(INSTALL_BASEDIR)
$(INSTALLEXE) $(COMPILERUTILSDIR)/samplecfg $(INSTALL_BASEDIR)/samplecfg
endif
$(MKDIR) $(MSGINSTALLDIR)
$(INSTALL) $(MSGFILES) $(MSGINSTALLDIR)
endif
# This also installs a link from bin to the actual executable.
# The .deb does that later.
installsymlink: install
ifneq ($(PPCCPULOCATION),$(INSTALL_BINDIR))
$(MKDIR) $(INSTALL_BINDIR)
ln -sf $(INSTALL_BASEDIR)/$(EXENAME) $(INSTALL_BINDIR)/$(EXENAME)
endif
fullinstallsymlink: fullinstall
ifndef EXCLUDE_80BIT_TARGETS
$(MAKE) $(addsuffix _symlink_install,$(filter-out $(PPC_TARGET),$(CYCLETARGETS)))
else
$(MAKE) $(addsuffix _symlink_install,$(filter-out i8086,$(filter-out i386,$(filter-out $(PPC_TARGET),$(CYCLETARGETS)))))
endif
#####################################################################
# RTL
#####################################################################
.PHONY: rtl rtlclean rtlinstall
rtl:
$(MAKE) -C $(PACKAGEDIR_RTL) 'OPT=$(RTLOPT)' all
rtlclean:
$(MAKE) -C $(PACKAGEDIR_RTL) clean
rtlinstall:
$(MAKE) -C $(PACKAGEDIR_RTL) install
#####################################################################
# PPU testing targets
#####################################################################
PPUDIR=$(COMPILER_UNITTARGETDIR)
ALLPPUDIR=$(CPU_TARGET)/units/*
PPULIST=$(wildcard $(PPUDIR)/*.ppu)
PPULOGLIST=$(subst .ppu,.log-ppu,$(PPULIST))
RTLPPUDIR=../rtl/units/$(TARGETSUFFIX)
RTLPPULIST=$(wildcard $(RTLPPUDIR)/*.ppu)
RTLPPULOGLIST=$(subst .ppu,.log-ppu,$(RTLPPULIST))
.PHONY : ppulogs cleanppulogs rtlppulogs cleanrtlppulogs testppudump
ppulogs : $(PPULOGLIST)
rtlppulogs : $(RTLPPULOGLIST)
vpath %.ppu $(PPUDIR) $(RTLPPUDIR) $(ALLPPUDIR)
vpath %.log-ppu $(PPUDIR) $(RTLPPUDIR) $(ALLPPUDIR)
# Use installed ppudump
%.log-ppu : %.ppu
ppudump -VA -M $< > $@
./utils/ppudump$(EXEEXT):
$(MAKE) -C $(COMPILERUTILSDIR) ppudump$(EXEEXT)
ppuinfo :
echo PPU list is "$(PPULIST)"
echo PPULOG list is "$(PPULOGLIST)"
echo RTLPPUDIR is "$(RTLPPUDIR)"
echo RTLPPU list is "$(RTLPPULIST)"
cleanppulogs :
-$(RMPROG) $(PPULOGLIST)
cleanrtlppulogs :
-$(RMPROG) $(RTLPPULOGLIST)
testppudump :
$(MAKE) cleanrtlppulogs cleanppulogs ppulogs rtlppulogs
#####################################################################
# local user configurable file
# in makefile.loc you can add any desired target
#####################################################################
localmake:=$(strip $(wildcard makefile.loc))
ifdef localmake
include ./$(localmake)
endif
|