build: remove Windows compatibility layer

For a couple of releases now we have officially withdrawn support for
building TF-A on Windows using the native environment, relying instead
on POSIX emulation layers like MSYS2, Mingw64, Cygwin or WSL.

This change removes the remainder of the OS compatibility layer
entirely, and migrates the build system over to explicitly relying on a
POSIX environment.

Change-Id: I8fb60d998162422e958009afd17eab826e3bc39b
Signed-off-by: Chris Kay <chris.kay@arm.com>
diff --git a/make_helpers/build_env.mk b/make_helpers/build_env.mk
deleted file mode 100644
index 13acaae..0000000
--- a/make_helpers/build_env.mk
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-# This file contains the logic to identify and include any relevant
-# build environment specific make include files.
-
-ifndef BUILD_ENV_MK
-    BUILD_ENV_MK        :=      $(lastword $(MAKEFILE_LIST))
-
-    # Block possible built-in command definitions that are not fully portable.
-    # This traps occurences that need replacing with our OS portable macros
-    COPY                :=      $$(error "Replace COPY with call to SHELL_COPY or SHELL_COPY_TREE.")
-    CP                  :=      $$(error "Replace CP with call to SHELL_COPY or SHELL_COPY_TREE.")
-    DEL                 :=      $$(error "Replace DEL with call to SHELL_DELETE.")
-    RD                  :=      $$(error "Replace RD with call to SHELL_REMOVE_DIR.")
-    RM                  :=      $$(error "Replace RM with call to SHELL_DELETE.")
-    RMDIR               :=      $$(error "Replace RMDIR with call to SHELL_REMOVE_DIR.")
-
-    ENV_FILE_TO_INCLUDE := unix.mk
-    ifdef OSTYPE
-        ifneq ($(findstring ${OSTYPE}, cygwin),)
-            ENV_FILE_TO_INCLUDE := cygwin.mk
-        else
-            ifneq ($(findstring ${OSTYPE}, MINGW32 mingw msys),)
-                ENV_FILE_TO_INCLUDE := msys.mk
-            endif
-        endif
-    else
-        ifdef MSYSTEM
-            # Although the MINGW MSYS shell sets OSTYPE as msys in its environment,
-            # it does not appear in the GNU make view of environment variables.
-            # We use MSYSTEM as an alternative, as that is seen by make
-            ifneq ($(findstring ${MSYSTEM}, MINGW32 mingw msys),)
-                OSTYPE ?= msys
-                ENV_FILE_TO_INCLUDE := msys.mk
-            endif
-        else
-            ifdef OS
-                ifneq ($(findstring ${OS}, Windows_NT),)
-                    ENV_FILE_TO_INCLUDE := windows.mk
-                endif
-            endif
-        endif
-    endif
-    include $(dir $(lastword $(MAKEFILE_LIST)))${ENV_FILE_TO_INCLUDE}
-    ENV_FILE_TO_INCLUDE :=
-
-    ifndef SHELL_COPY
-        $(error "SHELL_COPY not defined for build environment.")
-    endif
-    ifndef SHELL_COPY_TREE
-        $(error "SHELL_COPY_TREE not defined for build environment.")
-    endif
-    ifndef SHELL_DELETE_ALL
-        $(error "SHELL_DELETE_ALL not defined for build environment.")
-    endif
-    ifndef SHELL_DELETE
-        $(error "SHELL_DELETE not defined for build environment.")
-    endif
-    ifndef SHELL_REMOVE_DIR
-        $(error "SHELL_REMOVE_DIR not defined for build environment.")
-    endif
-
-endif
diff --git a/make_helpers/common.mk b/make_helpers/common.mk
index 848e4e9..a4b69c7 100644
--- a/make_helpers/common.mk
+++ b/make_helpers/common.mk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -14,4 +14,6 @@
 
         s := @$(if $(or $(verbose),$(silent)),: )
         q := $(if $(verbose),,@)
+
+        .exe := $(if $(filter Windows_NT,$(OS)),.exe)
 endif
diff --git a/make_helpers/cygwin.mk b/make_helpers/cygwin.mk
deleted file mode 100644
index 04a963f..0000000
--- a/make_helpers/cygwin.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#
-
-# OS specific definitions for builds in a Cygwin environment.
-# Cygwin allows us to use unix style commands on a windows platform.
-
-ifndef CYGWIN_MK
-    CYGWIN_MK := $(lastword $(MAKEFILE_LIST))
-
-    include ${MAKE_HELPERS_DIRECTORY}unix.mk
-
-    # In cygwin executable files have the Windows .exe extension type.
-    BIN_EXT := .exe
-
-endif
diff --git a/make_helpers/msys.mk b/make_helpers/msys.mk
deleted file mode 100644
index 7e60d57..0000000
--- a/make_helpers/msys.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#
-
-# OS specific definitions for builds in a Mingw32 MSYS environment.
-# Mingw32 allows us to use some unix style commands on a windows platform.
-
-ifndef MSYS_MK
-    MSYS_MK := $(lastword $(MAKEFILE_LIST))
-
-    include ${MAKE_HELPERS_DIRECTORY}unix.mk
-
-    # In MSYS executable files have the Windows .exe extension type.
-    BIN_EXT := .exe
-
-endif
-
diff --git a/make_helpers/toolchain.mk b/make_helpers/toolchain.mk
index 2ab577c..3b9d984 100644
--- a/make_helpers/toolchain.mk
+++ b/make_helpers/toolchain.mk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2023-2024, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2023-2025, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -18,7 +18,6 @@
 ifndef toolchain-mk
         toolchain-mk := $(lastword $(MAKEFILE_LIST))
 
-        include $(dir $(toolchain-mk))build_env.mk
         include $(dir $(toolchain-mk))utilities.mk
 
         #
@@ -242,28 +241,28 @@
         #
 
         # Arm Compiler for Embedded
-        toolchain-guess-tool-arm-clang = $(shell $(1) --version 2>&1 <$(nul) | grep -o "Tool: armclang")
-        toolchain-guess-tool-arm-link = $(shell $(1) --help 2>&1 <$(nul) | grep -o "Tool: armlink")
-        toolchain-guess-tool-arm-fromelf = $(shell $(1) --help 2>&1 <$(nul) | grep -o "Tool: fromelf")
-        toolchain-guess-tool-arm-ar = $(shell $(1) --version 2>&1 <$(nul) | grep -o "Tool: armar")
+        toolchain-guess-tool-arm-clang = $(shell $(1) --version 2>&1 </dev/null | grep -o "Tool: armclang")
+        toolchain-guess-tool-arm-link = $(shell $(1) --help 2>&1 </dev/null | grep -o "Tool: armlink")
+        toolchain-guess-tool-arm-fromelf = $(shell $(1) --help 2>&1 </dev/null | grep -o "Tool: fromelf")
+        toolchain-guess-tool-arm-ar = $(shell $(1) --version 2>&1 </dev/null | grep -o "Tool: armar")
 
         # LLVM Project
-        toolchain-guess-tool-llvm-clang = $(shell $(1) -v 2>&1 <$(nul) | grep -o "clang version")
-        toolchain-guess-tool-llvm-lld = $(shell $(1) --help 2>&1 <$(nul) | grep -o "OVERVIEW: lld")
-        toolchain-guess-tool-llvm-objcopy = $(shell $(1) --help 2>&1 <$(nul) | grep -o "llvm-objcopy tool")
-        toolchain-guess-tool-llvm-objdump = $(shell $(1) --help 2>&1 <$(nul) | grep -o "llvm object file dumper")
-        toolchain-guess-tool-llvm-ar = $(shell $(1) --help 2>&1 <$(nul) | grep -o "LLVM Archiver")
+        toolchain-guess-tool-llvm-clang = $(shell $(1) -v 2>&1 </dev/null | grep -o "clang version")
+        toolchain-guess-tool-llvm-lld = $(shell $(1) --help 2>&1 </dev/null | grep -o "OVERVIEW: lld")
+        toolchain-guess-tool-llvm-objcopy = $(shell $(1) --help 2>&1 </dev/null | grep -o "llvm-objcopy tool")
+        toolchain-guess-tool-llvm-objdump = $(shell $(1) --help 2>&1 </dev/null | grep -o "llvm object file dumper")
+        toolchain-guess-tool-llvm-ar = $(shell $(1) --help 2>&1 </dev/null | grep -o "LLVM Archiver")
 
         # GNU Compiler Collection & GNU Binary Utilities
-        toolchain-guess-tool-gnu-gcc = $(shell $(1) -v 2>&1 <$(nul) | grep -o "gcc version")
-        toolchain-guess-tool-gnu-ld = $(shell $(1) -v 2>&1 <$(nul) | grep -o "GNU ld")
-        toolchain-guess-tool-gnu-objcopy = $(shell $(1) --version 2>&1 <$(nul) | grep -o "GNU objcopy")
-        toolchain-guess-tool-gnu-objdump = $(shell $(1) --version 2>&1 <$(nul) | grep -o "GNU objdump")
-        toolchain-guess-tool-gnu-ar = $(shell $(1) --version 2>&1 <$(nul) | grep -o "GNU ar")
+        toolchain-guess-tool-gnu-gcc = $(shell $(1) -v 2>&1 </dev/null | grep -o "gcc version")
+        toolchain-guess-tool-gnu-ld = $(shell $(1) -v 2>&1 </dev/null | grep -o "GNU ld")
+        toolchain-guess-tool-gnu-objcopy = $(shell $(1) --version 2>&1 </dev/null | grep -o "GNU objcopy")
+        toolchain-guess-tool-gnu-objdump = $(shell $(1) --version 2>&1 </dev/null | grep -o "GNU objdump")
+        toolchain-guess-tool-gnu-ar = $(shell $(1) --version 2>&1 </dev/null | grep -o "GNU ar")
 
         # Other tools
-        toolchain-guess-tool-generic-dtc = $(shell $(1) --version 2>&1 <$(nul) | grep -o "Version: DTC")
-        toolchain-guess-tool-generic-poetry = $(shell $(1) --version 2>&1 <$(nul))
+        toolchain-guess-tool-generic-dtc = $(shell $(1) --version 2>&1 </dev/null | grep -o "Version: DTC")
+        toolchain-guess-tool-generic-poetry = $(shell $(1) --version 2>&1 </dev/null)
 
         toolchain-guess-tool = $(if $(2),$(firstword $(foreach candidate,$(1),$\
                 $(if $(call toolchain-guess-tool-$(candidate),$(2)),$(candidate)))))
@@ -330,17 +329,17 @@
 
         toolchain-derive-llvm-clang-cpp = $(1)
         toolchain-derive-llvm-clang-as = $(1)
-        toolchain-derive-llvm-clang-ld = $(shell $(1) --print-prog-name ld.lld 2>$(nul))
-        toolchain-derive-llvm-clang-oc = $(shell $(1) --print-prog-name llvm-objcopy 2>$(nul))
-        toolchain-derive-llvm-clang-od = $(shell $(1) --print-prog-name llvm-objdump 2>$(nul))
-        toolchain-derive-llvm-clang-ar = $(shell $(1) --print-prog-name llvm-ar 2>$(nul))
+        toolchain-derive-llvm-clang-ld = $(shell $(1) --print-prog-name ld.lld 2>/dev/null)
+        toolchain-derive-llvm-clang-oc = $(shell $(1) --print-prog-name llvm-objcopy 2>/dev/null)
+        toolchain-derive-llvm-clang-od = $(shell $(1) --print-prog-name llvm-objdump 2>/dev/null)
+        toolchain-derive-llvm-clang-ar = $(shell $(1) --print-prog-name llvm-ar 2>/dev/null)
 
         toolchain-derive-gnu-gcc-cpp = $(1)
         toolchain-derive-gnu-gcc-as = $(1)
         toolchain-derive-gnu-gcc-ld = $(1)
-        toolchain-derive-gnu-gcc-oc = $(shell $(1) --print-prog-name objcopy 2>$(nul))
-        toolchain-derive-gnu-gcc-od = $(shell $(1) --print-prog-name objdump 2>$(nul))
-        toolchain-derive-gnu-gcc-ar = $(shell $(1) --print-prog-name ar 2>$(nul))
+        toolchain-derive-gnu-gcc-oc = $(shell $(1) --print-prog-name objcopy 2>/dev/null)
+        toolchain-derive-gnu-gcc-od = $(shell $(1) --print-prog-name objdump 2>/dev/null)
+        toolchain-derive-gnu-gcc-ar = $(shell $(1) --print-prog-name ar 2>/dev/null)
 
         toolchain-derive = $(if $3,$(call toolchain-derive-$1-$2,$3))
 
diff --git a/make_helpers/unix.mk b/make_helpers/unix.mk
deleted file mode 100644
index fa7722a..0000000
--- a/make_helpers/unix.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-# Trusted Firmware shell command definitions for a Unix style environment.
-
-ifndef UNIX_MK
-    UNIX_MK := $(lastword $(MAKEFILE_LIST))
-
-    DIR_DELIM := /
-    PATH_SEP := :
-
-    # These defines provide Unix style equivalents of the shell commands
-    # required by the Trusted Firmware build environment.
-
-    # ${1} is the file to be copied.
-    # ${2} is the destination file name.
-    define SHELL_COPY
-	$(q)cp -f  "${1}"  "${2}"
-    endef
-
-    # ${1} is the directory to be copied.
-    # ${2} is the destination directory path.
-    define SHELL_COPY_TREE
-	$(q)cp -rf  "${1}"  "${2}"
-    endef
-
-    # ${1} is the file to be deleted.
-    define SHELL_DELETE
-	-$(q)rm -f  "${1}"
-    endef
-
-    # ${1} is a space delimited list of files to be deleted.
-    # Note that we do not quote ${1}, as multiple parameters may be passed.
-    define SHELL_DELETE_ALL
-	-$(q)rm -rf  ${1}
-    endef
-
-    define SHELL_REMOVE_DIR
-	-$(q)rm -rf  "${1}"
-    endef
-
-    nul := /dev/null
-
-    which = $(shell command -v $(call escape-shell,$(1)) 2>$(nul))
-endif
diff --git a/make_helpers/utilities.mk b/make_helpers/utilities.mk
index fcccd24..10645bf 100644
--- a/make_helpers/utilities.mk
+++ b/make_helpers/utilities.mk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -127,3 +127,17 @@
 #
 
 defined = $(call bool,$(filter-out undefined,$(origin $(1))))
+
+#
+# Determine the path to a program.
+#
+# Parameters:
+#
+#   - $(1): The program to search for.
+#
+# Example usage:
+#
+#     path-to-gcc := $(call which,gcc) # "/usr/bin/gcc"
+#
+
+which = $(shell command -v $(call escape-shell,$(1)) 2>/dev/null)
diff --git a/make_helpers/windows.mk b/make_helpers/windows.mk
deleted file mode 100644
index c24aa08..0000000
--- a/make_helpers/windows.mk
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-
-# OS specific parts for builds in a Windows_NT environment. The
-# environment variable OS is set to Windows_NT on all modern Windows platforms
-
-# Include generic windows command definitions.
-
-ifndef WINDOWS_MK
-    WINDOWS_MK := $(lastword $(MAKEFILE_LIST))
-
-    DIR_DELIM := $(strip \)
-    BIN_EXT   := .exe
-    PATH_SEP  := ;
-
-    # For some Windows native commands there is a problem with the directory delimiter.
-    # Make uses / (slash) and the commands expect \ (backslash)
-    # We have to provide a means of translating these, so we define local functions.
-
-    # ${1} is the file to be copied.
-    # ${2} is the destination file name.
-    define SHELL_COPY
-	$(eval tmp_from_file:=$(subst /,\,${1}))
-	$(eval tmp_to_file:=$(subst /,\,${2}))
-	copy "${tmp_from_file}" "${tmp_to_file}"
-    endef
-
-    # ${1} is the directory to be copied.
-    # ${2} is the destination directory path.
-    define SHELL_COPY_TREE
-	$(eval tmp_from_dir:=$(subst /,\,${1}))
-	$(eval tmp_to_dir:=$(subst /,\,${2}))
-	xcopy /HIVE "${tmp_from_dir}" "${tmp_to_dir}"
-    endef
-
-    # ${1} is the file to be deleted.
-    define SHELL_DELETE
-	$(eval tmp_del_file:=$(subst /,\,${*}))
-	-@if exist $(tmp_del_file)  del /Q $(tmp_del_file)
-    endef
-
-    # ${1} is a space delimited list of files to be deleted.
-    define SHELL_DELETE_ALL
-	$(eval $(foreach filename,$(wildcard ${1}),$(call DELETE_IF_THERE,${filename})))
-    endef
-
-    # ${1} is the directory to be removed.
-    define SHELL_REMOVE_DIR
-	$(eval tmp_dir:=$(subst /,\,${1}))
-	-@if exist "$(tmp_dir)"  rd /Q /S "$(tmp_dir)"
-    endef
-
-    nul := nul
-
-    which = $(shell where "$(1)" 2>$(nul))
-endif
-
-# Because git is not available from CMD.EXE, we need to avoid
-# the BUILD_STRING generation which uses git.
-# For now we use "development build".
-# This can be overridden from the command line or environment.
-BUILD_STRING ?= development build
-
-MSVC_NMAKE := nmake.exe