xref: /aosp_15_r20/build/make/common/core.mk (revision 9e94795a3d4ef5c1d47486f9a02bb378756cea8a)
1*9e94795aSAndroid Build Coastguard Worker#
2*9e94795aSAndroid Build Coastguard Worker# Copyright (C) 2018 The Android Open Source Project
3*9e94795aSAndroid Build Coastguard Worker#
4*9e94795aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
5*9e94795aSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
6*9e94795aSAndroid Build Coastguard Worker# You may obtain a copy of the License at
7*9e94795aSAndroid Build Coastguard Worker#
8*9e94795aSAndroid Build Coastguard Worker#      http://www.apache.org/licenses/LICENSE-2.0
9*9e94795aSAndroid Build Coastguard Worker#
10*9e94795aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
11*9e94795aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
12*9e94795aSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*9e94795aSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
14*9e94795aSAndroid Build Coastguard Worker# limitations under the License.
15*9e94795aSAndroid Build Coastguard Worker#
16*9e94795aSAndroid Build Coastguard Worker
17*9e94795aSAndroid Build Coastguard Worker# Only use ANDROID_BUILD_SHELL to wrap around bash.
18*9e94795aSAndroid Build Coastguard Worker# DO NOT use other shells such as zsh.
19*9e94795aSAndroid Build Coastguard Workerifdef ANDROID_BUILD_SHELL
20*9e94795aSAndroid Build Coastguard WorkerSHELL := $(ANDROID_BUILD_SHELL)
21*9e94795aSAndroid Build Coastguard Workerelse
22*9e94795aSAndroid Build Coastguard Worker# Use bash, not whatever shell somebody has installed as /bin/sh
23*9e94795aSAndroid Build Coastguard Worker# This is repeated from main.mk, since envsetup.sh runs this file
24*9e94795aSAndroid Build Coastguard Worker# directly.
25*9e94795aSAndroid Build Coastguard WorkerSHELL := /bin/bash
26*9e94795aSAndroid Build Coastguard Workerendif
27*9e94795aSAndroid Build Coastguard Worker
28*9e94795aSAndroid Build Coastguard Worker# Utility variables.
29*9e94795aSAndroid Build Coastguard Workerempty :=
30*9e94795aSAndroid Build Coastguard Workerspace := $(empty) $(empty)
31*9e94795aSAndroid Build Coastguard Workercomma := ,
32*9e94795aSAndroid Build Coastguard Worker# Note that make will eat the newline just before endef.
33*9e94795aSAndroid Build Coastguard Workerdefine newline
34*9e94795aSAndroid Build Coastguard Worker
35*9e94795aSAndroid Build Coastguard Worker
36*9e94795aSAndroid Build Coastguard Workerendef
37*9e94795aSAndroid Build Coastguard Worker# The pound character "#"
38*9e94795aSAndroid Build Coastguard Workerdefine pound
39*9e94795aSAndroid Build Coastguard Worker#
40*9e94795aSAndroid Build Coastguard Workerendef
41*9e94795aSAndroid Build Coastguard Worker# Unfortunately you can't simply define backslash as \ or \\.
42*9e94795aSAndroid Build Coastguard Workerbackslash := \a
43*9e94795aSAndroid Build Coastguard Workerbackslash := $(patsubst %a,%,$(backslash))
44*9e94795aSAndroid Build Coastguard Worker
45*9e94795aSAndroid Build Coastguard WorkerTOP :=$= .
46*9e94795aSAndroid Build Coastguard WorkerTOPDIR :=$=
47*9e94795aSAndroid Build Coastguard Worker
48*9e94795aSAndroid Build Coastguard Worker# Prevent accidentally changing these variables
49*9e94795aSAndroid Build Coastguard Worker.KATI_READONLY := SHELL empty space comma newline pound backslash
50*9e94795aSAndroid Build Coastguard Worker
51*9e94795aSAndroid Build Coastguard Worker# Basic warning/error wrappers. These will be redefined to include the local
52*9e94795aSAndroid Build Coastguard Worker# module information when reading Android.mk files.
53*9e94795aSAndroid Build Coastguard Workerdefine pretty-warning
54*9e94795aSAndroid Build Coastguard Worker$(warning $(1))
55*9e94795aSAndroid Build Coastguard Workerendef
56*9e94795aSAndroid Build Coastguard Worker
57*9e94795aSAndroid Build Coastguard Workerdefine pretty-error
58*9e94795aSAndroid Build Coastguard Worker$(error $(1))
59*9e94795aSAndroid Build Coastguard Workerendef
60