From 7d1b7eda0e3e51b49449f96f8d77c26378afb291 Mon Sep 17 00:00:00 2001 From: Pierre Muller Date: Thu, 25 Nov 2021 21:41:35 +0000 Subject: [PATCH] Use filter instead of findstring make function when a whole word needs to match --- utils/fpcm/fpcmake.ini | 52 +++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/utils/fpcm/fpcmake.ini b/utils/fpcm/fpcmake.ini index 3674e7eda8..a101bc03b7 100644 --- a/utils/fpcm/fpcmake.ini +++ b/utils/fpcm/fpcmake.ini @@ -96,7 +96,7 @@ endif endif ifdef COMSPEC -ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),) +ifneq ($(filter $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),) ifndef RUNBATCH RUNBATCH=$(COMSPEC) /C endif @@ -311,11 +311,11 @@ endif # Full name of the target, including CPU and OS. For OSs limited # to 8.3 we only use the target OS -ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +ifneq ($(filter $(OS_SOURCE),$(LIMIT83fs)),) TARGETSUFFIX=$(OS_TARGET) SOURCESUFFIX=$(OS_SOURCE) else -ifneq ($(findstring $(OS_TARGET),$(LIMIT83fs)),) +ifneq ($(filter $(OS_TARGET),$(LIMIT83fs)),) TARGETSUFFIX=$(OS_TARGET) else TARGETSUFFIX=$(FULL_TARGET) @@ -331,14 +331,14 @@ endif # Check if the Makefile supports this target, but not # when the make target is to rebuild the makefile ifeq ($(findstring makefile,$(MAKECMDGOALS)),) -ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),) +ifeq ($(filter $(FULL_TARGET),$(MAKEFILETARGETS)),) $(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) endif endif # Detect BSD, since BSD uses a slightly different directory hierarchy. -ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +ifneq ($(filter $(OS_TARGET),$(BSDs)),) BSDhier=1 endif @@ -460,8 +460,8 @@ endif # Default binutils prefix for cross compile when the # crossbindir is not set (except for Darwin) -ifneq ($(findstring $(OS_TARGET),darwin iphonesim ios),) -ifneq ($(findstring $(OS_SOURCE),darwin ios),) +ifneq ($(filter $(OS_TARGET),darwin iphonesim ios),) +ifneq ($(filter $(OS_SOURCE),darwin ios),) DARWIN2DARWIN=1 endif endif @@ -598,12 +598,12 @@ endif # use the source os as default ifdef ZIPINSTALL # Zipinstall -ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +ifneq ($(filter $(OS_TARGET),$(UNIXs)),) UNIXHier=1 endif else # Normal install -ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +ifneq ($(filter $(OS_SOURCE),$(UNIXs)),) UNIXHier=1 endif endif @@ -844,7 +844,7 @@ ifeq ($(OS_SOURCE),linux) # Amd64 to i386? ifndef GCCLIBDIR ifeq ($(CPU_TARGET),i386) -ifneq ($(findstring x86_64,$(shell uname -a)),) +ifneq ($(filter x86_64,$(shell uname -a)),) ifeq ($(BINUTILSPREFIX),) GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) else @@ -867,12 +867,12 @@ CROSSGCCOPT=-m64 endif endif ifeq ($(CPU_TARGET),sparc) -ifneq ($(findstring sparc64,$(shell uname -a)),) +ifneq ($(filter sparc64,$(shell uname -a)),) ifeq ($(BINUTILSPREFIX),) GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) else # gcc mips seems not to recognize -m32/-m64 -ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),) +ifneq ($(filter $(FPCFPMAKE_CPU_OPT),mips mipsel),) CROSSGCCOPT=-mabi=32 else CROSSGCCOPT=-m32 @@ -889,19 +889,19 @@ ifeq ($(CPU_TARGET),$(FPCFPMAKE_CPU_TARGET)) # In that case use GCCLIBDIR value for FPCMAKEGCCLIBDIR FPCMAKEGCCLIBDIR:=$(GCCLIBDIR) else -ifneq ($(findstring $(FPCFPMAKE_CPU_TARGET),aarch64 powerpc64 riscv64 sparc64 x86_64),) +ifneq ($(filter $(FPCFPMAKE_CPU_TARGET),aarch64 powerpc64 riscv64 sparc64 x86_64),) FPCMAKE_CROSSGCCOPT=-m64 else -ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips64 mips64el),) +ifneq ($(filter $(FPCFPMAKE_CPU_OPT),mips64 mips64el),) FPCMAKE_CROSSGCCOPT=-mabi=64 else -ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),mips mipsel),) +ifneq ($(filter $(FPCFPMAKE_CPU_OPT),mips mipsel),) FPCMAKE_CROSSGCCOPT=-mabi=32 else -ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv64),) +ifeq ($(FPCFPMAKE_CPU_OPT),riscv64) FPCMAKE_CROSSGCCOPT=-mabi=lp64 else -ifneq ($(findstring $(FPCFPMAKE_CPU_OPT),riscv32),) +ifeq ($(FPCFPMAKE_CPU_OPT),riscv32) FPCMAKE_CROSSGCCOPT=-mabi=ilp32 else FPCMAKE_CROSSGCCOPT=-m32 @@ -1143,7 +1143,7 @@ IMPORTLIBPREFIX=imp endif # Darwin -ifneq ($(findstring $(OS_TARGET),darwin iphonesim ios),) +ifneq ($(filter $(OS_TARGET),darwin iphonesim ios),) BATCHEXT=.sh EXEEXT= HASSHAREDLIB=1 @@ -1252,7 +1252,7 @@ endif # For 8.3 limited OS's the short suffixes # Otherwise use the full source/target names -ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +ifneq ($(filter $(OS_SOURCE),$(LIMIT83fs)),) FPCMADE=fpcmade.$(SHORTSUFFIX) ZIPSUFFIX=$(SHORTSUFFIX) ZIPCROSSPREFIX= @@ -1521,9 +1521,9 @@ else # if we are compiling natively on aarch64-darwin and if -/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk exists, # add it to the compiler command line ifeq ($(OS_TARGET),$(OS_SOURCE)) -ifneq ($(findstring $(OS_TARGET),darwin),) +ifeq ($(OS_TARGET),darwin) # so far the only tested one -ifneq ($(findstring $(CPU_TARGET),aarch64),) +ifeq ($(CPU_TARGET),aarch64) ifneq ($(wildcard /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk),) override FPCOPT+=-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk endif @@ -1538,8 +1538,8 @@ endif # create always pic'ed code on x86_64, mips and mipsel # on unix-like systems -ifneq ($(findstring $(OS_TARGET),dragonfly freebsd openbsd netbsd linux solaris),) -ifneq ($(findstring $(CPU_TARGET),x86_64 mips mipsel riscv64 powerpc64),) +ifneq ($(filter $(OS_TARGET),dragonfly freebsd openbsd netbsd linux solaris),) +ifneq ($(filter $(CPU_TARGET),x86_64 mips mipsel riscv64 powerpc64),) override FPCOPT+=-Cg endif endif @@ -1609,10 +1609,10 @@ override COMPILER:=$(strip $(FPC) $(FPCOPT)) # also call ppas if with command option -s # but only if the FULL_SOURCE and FULL_TARGET are equal # or if -sh is used -ifneq (,$(findstring -sh ,$(COMPILER))) +ifneq (,$(filter -sh,$(COMPILER))) UseEXECPPAS=1 endif -ifneq (,$(findstring -s ,$(COMPILER))) +ifneq (,$(filter -s,$(COMPILER))) ifeq ($(FULL_SOURCE),$(FULL_TARGET)) UseEXECPPAS=1 endif @@ -2344,7 +2344,7 @@ endif # LCL Platform ifndef LCL_PLATFORM -ifneq ($(findstring $(OS_TARGET),win32 win64),) +ifneq ($(filter $(OS_TARGET),win32 win64),) LCL_PLATFORM=win32 else LCL_PLATFORM=gtk