blob: 74a292efbc55ad93da07e6312aefeeb0396dc24a [file] [log] [blame]
Evan Lloyda71d2592015-12-02 18:56:06 +00001#
Antonio Nino Diaz493bf332016-12-14 14:31:32 +00002# Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
Evan Lloyda71d2592015-12-02 18:56:06 +00003#
Antonio Nino Diaz493bf332016-12-14 14:31:32 +00004# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are met:
Evan Lloyda71d2592015-12-02 18:56:06 +00006#
Antonio Nino Diaz493bf332016-12-14 14:31:32 +00007# Redistributions of source code must retain the above copyright notice, this
8# list of conditions and the following disclaimer.
Evan Lloyda71d2592015-12-02 18:56:06 +00009#
Antonio Nino Diaz493bf332016-12-14 14:31:32 +000010# Redistributions in binary form must reproduce the above copyright notice,
11# this list of conditions and the following disclaimer in the documentation
12# and/or other materials provided with the distribution.
Evan Lloyda71d2592015-12-02 18:56:06 +000013#
Antonio Nino Diaz493bf332016-12-14 14:31:32 +000014# Neither the name of ARM nor the names of its contributors may be used
15# to endorse or promote products derived from this software without specific
16# prior written permission.
Evan Lloyda71d2592015-12-02 18:56:06 +000017#
Antonio Nino Diaz493bf332016-12-14 14:31:32 +000018# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28# POSSIBILITY OF SUCH DAMAGE.
Evan Lloyda71d2592015-12-02 18:56:06 +000029#
30
31# This file contains the logic to identify and include any relevant
32# build environment specific make include files.
33
34ifndef BUILD_ENV_MK
35 BUILD_ENV_MK := $(lastword $(MAKEFILE_LIST))
36
37 # Block possible built-in command definitions that are not fully portable.
38 # This traps occurences that need replacing with our OS portable macros
39 COPY := $$(error "Replace COPY with call to SHELL_COPY or SHELL_COPY_TREE.")
40 CP := $$(error "Replace CP with call to SHELL_COPY or SHELL_COPY_TREE.")
41 DEL := $$(error "Replace DEL with call to SHELL_DELETE.")
42 MD := $$(error "Replace MD with call to MAKE_PREREQ_DIR.")
43 MKDIR := $$(error "Replace MKDIR with call to MAKE_PREREQ_DIR.")
44 RD := $$(error "Replace RD with call to SHELL_REMOVE_DIR.")
45 RM := $$(error "Replace RM with call to SHELL_DELETE.")
46 RMDIR := $$(error "Replace RMDIR with call to SHELL_REMOVE_DIR.")
47
48 ENV_FILE_TO_INCLUDE := unix.mk
49 ifdef OSTYPE
50 ifneq ($(findstring ${OSTYPE}, cygwin),)
51 ENV_FILE_TO_INCLUDE := cygwin.mk
52 else
53 ifneq ($(findstring ${OSTYPE}, MINGW32 mingw msys),)
54 ENV_FILE_TO_INCLUDE := msys.mk
55 endif
56 endif
57 else
58 ifdef MSYSTEM
59 # Although the MINGW MSYS shell sets OSTYPE as msys in its environment,
60 # it does not appear in the GNU make view of environment variables.
61 # We use MSYSTEM as an alternative, as that is seen by make
62 ifneq ($(findstring ${MSYSTEM}, MINGW32 mingw msys),)
63 OSTYPE ?= msys
64 ENV_FILE_TO_INCLUDE := msys.mk
65 endif
66 else
67 ifdef OS
68 ifneq ($(findstring ${OS}, Windows_NT),)
69 ENV_FILE_TO_INCLUDE := windows.mk
70 endif
71 endif
72 endif
73 endif
74 include ${MAKE_HELPERS_DIRECTORY}${ENV_FILE_TO_INCLUDE}
75 ENV_FILE_TO_INCLUDE :=
76
77 ifndef SHELL_COPY
78 $(error "SHELL_COPY not defined for build environment.")
79 endif
80 ifndef SHELL_COPY_TREE
81 $(error "SHELL_COPY_TREE not defined for build environment.")
82 endif
83 ifndef SHELL_DELETE_ALL
84 $(error "SHELL_DELETE_ALL not defined for build environment.")
85 endif
86 ifndef SHELL_DELETE
87 $(error "SHELL_DELETE not defined for build environment.")
88 endif
89 ifndef MAKE_PREREQ_DIR
90 $(error "MAKE_PREREQ_DIR not defined for build environment.")
91 endif
92 ifndef SHELL_REMOVE_DIR
93 $(error "SHELL_REMOVE_DIR not defined for build environment.")
94 endif
95
96endif