Browse Source

* better detection of used ppcXXX

peter 24 years ago
parent
commit
2ac1305371
2 changed files with 221 additions and 212 deletions
  1. 195 190
      utils/fpcm/fpcmake.inc
  2. 26 22
      utils/fpcm/fpcmake.ini

File diff suppressed because it is too large
+ 195 - 190
utils/fpcm/fpcmake.inc


+ 26 - 22
utils/fpcm/fpcmake.ini

@@ -97,37 +97,28 @@ endif
 # FPC version/target Detection
 #####################################################################
 
-# What compiler to use ?
-ifndef FPC
 # Compatibility with old makefiles
+ifndef FPC
 ifdef PP
 FPC=$(PP)
-else
-ifdef inUnix
-CPU_SOURCE=$(shell uname -m)
-ifeq (m68k,$(CPU_SOURCE))
-FPC=ppc68k
-else
-FPC=ppc386
 endif
-else
-FPC=ppc386
 endif
+
+# Try to detect the ppcXXX file to use by using "fpc -P?" option
+# to query for the default ppcXXX the fpc executable tries
+ifndef FPC
+FPC:=$(shell fpc -P?)
+# Older fpc executables didn't support it and return
+# Error: Illegal processor... When found then fallback to ppc386
+ifneq ($(findstring Error,$(PPCBIN)),)
+override FPC=ppc386
 endif
 endif
+
+# Get a clean executable name
 override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
 override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
 
-# Target OS
-ifndef OS_TARGET
-OS_TARGET:=$(shell $(FPC) -iTO)
-endif
-
-# Source OS
-ifndef OS_SOURCE
-OS_SOURCE:=$(shell $(FPC) -iSO)
-endif
-
 # Target CPU
 ifndef CPU_TARGET
 CPU_TARGET:=$(shell $(FPC) -iTP)
@@ -138,6 +129,16 @@ ifndef CPU_SOURCE
 CPU_SOURCE:=$(shell $(FPC) -iSP)
 endif
 
+# Target OS
+ifndef OS_TARGET
+OS_TARGET:=$(shell $(FPC) -iTO)
+endif
+
+# Source OS
+ifndef OS_SOURCE
+OS_SOURCE:=$(shell $(FPC) -iSO)
+endif
+
 # FPC version
 ifndef FPC_VERSION
 FPC_VERSION:=$(shell $(FPC) -iV)
@@ -628,8 +629,11 @@ endif
 # Compiler Command Line
 #####################################################################
 
-# Load commandline OPTDEF and add FPC_CPU define
+# Load commandline OPTDEF and add FPC_CPU define, for compiling the
+# compiler this needs to be turned off
+ifndef NOCPUDEF
 override FPCOPTDEF=$(CPU_TARGET)
+endif
 
 # Load commandline OPT and add target and unit dir to be sure
 ifneq ($(OS_TARGET),$(OS_SOURCE))

Some files were not shown because too many files changed in this diff