1 # 2 # Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. 3 # 4 # SPDX-License-Identifier: BSD-3-Clause 5 # 6 7 # This file contains the logic to identify and include any relevant 8 # build environment specific make include files. 9 10 ifndef BUILD_ENV_MK 11 BUILD_ENV_MK := $(lastword $(MAKEFILE_LIST)) 12 13 # Block possible built-in command definitions that are not fully portable. 14 # This traps occurences that need replacing with our OS portable macros 15 COPY := $$(error "Replace COPY with call to SHELL_COPY or SHELL_COPY_TREE.") 16 CP := $$(error "Replace CP with call to SHELL_COPY or SHELL_COPY_TREE.") 17 DEL := $$(error "Replace DEL with call to SHELL_DELETE.") 18 MD := $$(error "Replace MD with call to MAKE_PREREQ_DIR.") 19 MKDIR := $$(error "Replace MKDIR with call to MAKE_PREREQ_DIR.") 20 RD := $$(error "Replace RD with call to SHELL_REMOVE_DIR.") 21 RM := $$(error "Replace RM with call to SHELL_DELETE.") 22 RMDIR := $$(error "Replace RMDIR with call to SHELL_REMOVE_DIR.") 23 24 ENV_FILE_TO_INCLUDE := unix.mk 25 ifdef OSTYPE 26 ifneq ($(findstring ${OSTYPE}, cygwin),) 27 ENV_FILE_TO_INCLUDE := cygwin.mk 28 else 29 ifneq ($(findstring ${OSTYPE}, MINGW32 mingw msys),) 30 ENV_FILE_TO_INCLUDE := msys.mk 31 endif 32 endif 33 else 34 ifdef MSYSTEM 35 # Although the MINGW MSYS shell sets OSTYPE as msys in its environment, 36 # it does not appear in the GNU make view of environment variables. 37 # We use MSYSTEM as an alternative, as that is seen by make 38 ifneq ($(findstring ${MSYSTEM}, MINGW32 mingw msys),) 39 OSTYPE ?= msys 40 ENV_FILE_TO_INCLUDE := msys.mk 41 endif 42 else 43 ifdef OS 44 ifneq ($(findstring ${OS}, Windows_NT),) 45 ENV_FILE_TO_INCLUDE := windows.mk 46 endif 47 endif 48 endif 49 endif 50 include ${MAKE_HELPERS_DIRECTORY}${ENV_FILE_TO_INCLUDE} 51 ENV_FILE_TO_INCLUDE := 52 53 ifndef SHELL_COPY 54 $(error "SHELL_COPY not defined for build environment.") 55 endif 56 ifndef SHELL_COPY_TREE 57 $(error "SHELL_COPY_TREE not defined for build environment.") 58 endif 59 ifndef SHELL_DELETE_ALL 60 $(error "SHELL_DELETE_ALL not defined for build environment.") 61 endif 62 ifndef SHELL_DELETE 63 $(error "SHELL_DELETE not defined for build environment.") 64 endif 65 ifndef MAKE_PREREQ_DIR 66 $(error "MAKE_PREREQ_DIR not defined for build environment.") 67 endif 68 ifndef SHELL_REMOVE_DIR 69 $(error "SHELL_REMOVE_DIR not defined for build environment.") 70 endif 71 72 endif 73