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