|
@@ -160,52 +160,34 @@ FPC=$(PP)
|
|
|
endif
|
|
|
endif
|
|
|
|
|
|
-# The compiler to compile for the current system has to be determined
|
|
|
-# in case FPC is not defined, or when FPC is defined but a crossinstall
|
|
|
-# is performed. (This is to compile fpmake files)
|
|
|
-ifndef FPC
|
|
|
-DETERMINE_NATIVE_COMPILER=1
|
|
|
-else
|
|
|
-ifdef CROSSCOMPILE
|
|
|
-ifndef FPCFPMAKE
|
|
|
-DETERMINE_NATIVE_COMPILER=1
|
|
|
-endif
|
|
|
-endif
|
|
|
-endif
|
|
|
-
|
|
|
# Try to detect the ppcXXX file to use by using "fpc -PB" option
|
|
|
# to query for the default ppcXXX the fpc executable tries. When
|
|
|
# fpc is not found use ppc386 by default. Also when fpc -PB gives
|
|
|
# an error ppc386 will be used.
|
|
|
-ifdef DETERMINE_NATIVE_COMPILER
|
|
|
+ifndef FPC
|
|
|
# check if fpc exists
|
|
|
FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
|
|
|
ifneq ($(FPCPROG),)
|
|
|
FPCPROG:=$(firstword $(FPCPROG))
|
|
|
ifneq ($(CPU_TARGET),)
|
|
|
-FPCNATIVE:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB)
|
|
|
+FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB)
|
|
|
else
|
|
|
-FPCNATIVE:=$(shell $(FPCPROG) -PB)
|
|
|
+FPC:=$(shell $(FPCPROG) -PB)
|
|
|
endif
|
|
|
# Older fpc executables didn't support it and return
|
|
|
# Error: Illegal processor... If found then fallback to ppc386
|
|
|
-ifneq ($(findstring Error,$(FPCNATIVE)),)
|
|
|
-override FPCNATIVE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
|
|
|
+ifneq ($(findstring Error,$(FPC)),)
|
|
|
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
|
|
|
else
|
|
|
# if the cross compiler is not found, fall back to fpc
|
|
|
-ifeq ($(strip $(wildcard $(FPCNATIVE))),)
|
|
|
-FPCNATIVE:=$(firstword $(FPCPROG))
|
|
|
+ifeq ($(strip $(wildcard $(FPC))),)
|
|
|
+FPC:=$(firstword $(FPCPROG))
|
|
|
endif
|
|
|
endif
|
|
|
else
|
|
|
# fpc binary not found, fallback to ppc386
|
|
|
-override FPCNATIVE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
|
|
|
-endif
|
|
|
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
|
|
|
endif
|
|
|
-
|
|
|
-# If FPC is not set, use the native compiler.
|
|
|
-ifndef FPC
|
|
|
-FPC=$(FPCNATIVE)
|
|
|
endif
|
|
|
|
|
|
# Get a clean executable name
|
|
@@ -333,14 +315,28 @@ export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TA
|
|
|
# If FPCFPMAKE is not set and we're cross-compiling, try to find a
|
|
|
# native compiler.
|
|
|
ifndef FPCFPMAKE
|
|
|
+
|
|
|
ifdef CROSSCOMPILE
|
|
|
# Search for the (native) ppc compiler which is used to do the latest build
|
|
|
# of the native rtl
|
|
|
+
|
|
|
ifeq ($(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR)))),)
|
|
|
# If that compiler is not found, use the common, installed native compiler
|
|
|
# Note that in this case FPCFPMAKE is not exported, because it could be that
|
|
|
-# this compiler is compiled later on
|
|
|
-FPCFPMAKE:=$(FPCNATIVE)
|
|
|
+# a more suitable compiler is compiled later on
|
|
|
+# check if fpc exists
|
|
|
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
|
|
|
+ifneq ($(FPCPROG),)
|
|
|
+FPCPROG:=$(firstword $(FPCPROG))
|
|
|
+FPCFPMAKE:=$(shell $(FPCPROG) -PB)
|
|
|
+# if a native compiler is not found, fall back to fpc
|
|
|
+ifeq ($(strip $(wildcard $(FPCFPMAKE))),)
|
|
|
+FPCFPMAKE:=$(firstword $(FPCPROG))
|
|
|
+endif
|
|
|
+else
|
|
|
+# fpc binary not found, fallback to ppc386
|
|
|
+override FPCFPMAKE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
|
|
|
+endif
|
|
|
else
|
|
|
# Use the ppc compiler. Because the path to the compiler is relative, do not
|
|
|
# evaluate the variable here, but do that on the fly.
|
|
@@ -349,12 +345,12 @@ FPMAKE_SKIP_CONFIG=-n
|
|
|
export FPCFPMAKE
|
|
|
export FPMAKE_SKIP_CONFIG
|
|
|
endif
|
|
|
+
|
|
|
else
|
|
|
FPCFPMAKE=$(FPC)
|
|
|
FPMAKE_SKIP_CONFIG=-n
|
|
|
-export FPCFPMAKE
|
|
|
-export FPMAKE_SKIP_CONFIG
|
|
|
endif
|
|
|
+
|
|
|
endif
|
|
|
|
|
|
|