aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/core.mk56
-rw-r--r--common/math.mk (renamed from core/math.mk)0
-rw-r--r--common/strings.mk (renamed from core/strings.mk)0
-rw-r--r--core/config.mk36
-rw-r--r--core/definitions.mk18
-rw-r--r--core/main.mk29
6 files changed, 88 insertions, 51 deletions
diff --git a/common/core.mk b/common/core.mk
new file mode 100644
index 000000000..e5264b072
--- /dev/null
+++ b/common/core.mk
@@ -0,0 +1,56 @@
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.
19ifdef ANDROID_BUILD_SHELL
20SHELL := $(ANDROID_BUILD_SHELL)
21else
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.
25SHELL := /bin/bash
26endif
27
28# Utility variables.
29empty :=
30space := $(empty) $(empty)
31comma := ,
32# Note that make will eat the newline just before endef.
33define newline
34
35
36endef
37# The pound character "#"
38define pound
39#
40endef
41# Unfortunately you can't simply define backslash as \ or \\.
42backslash := \a
43backslash := $(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.
50define pretty-warning
51$(warning $(1))
52endef
53
54define pretty-error
55$(error $(1))
56endef
diff --git a/core/math.mk b/common/math.mk
index ac3151e3c..ac3151e3c 100644
--- a/core/math.mk
+++ b/common/math.mk
diff --git a/core/strings.mk b/common/strings.mk
index ce6d6fbe9..ce6d6fbe9 100644
--- a/core/strings.mk
+++ b/common/strings.mk
diff --git a/core/config.mk b/core/config.mk
index aeb8aeeae..5491234e6 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -17,36 +17,10 @@ $(warning )
17$(error done) 17$(error done)
18endif 18endif
19 19
20# Only use ANDROID_BUILD_SHELL to wrap around bash. 20BUILD_SYSTEM :=$= build/make/core
21# DO NOT use other shells such as zsh. 21BUILD_SYSTEM_COMMON :=$= build/make/common
22ifdef ANDROID_BUILD_SHELL
23SHELL := $(ANDROID_BUILD_SHELL)
24else
25# Use bash, not whatever shell somebody has installed as /bin/sh
26# This is repeated from main.mk, since envsetup.sh runs this file
27# directly.
28SHELL := /bin/bash
29endif
30
31# Utility variables.
32empty :=
33space := $(empty) $(empty)
34comma := ,
35# Note that make will eat the newline just before endef.
36define newline
37
38
39endef
40# The pound character "#"
41define pound
42#
43endef
44# Unfortunately you can't simply define backslash as \ or \\.
45backslash := \a
46backslash := $(patsubst %a,%,$(backslash))
47 22
48# Prevent accidentally changing these variables 23include $(BUILD_SYSTEM_COMMON)/core.mk
49.KATI_READONLY := SHELL empty space comma newline pound backslash
50 24
51# Mark variables that should be coming as environment variables from soong_ui 25# Mark variables that should be coming as environment variables from soong_ui
52# as readonly 26# as readonly
@@ -138,9 +112,9 @@ endif
138 112
139# Set up efficient math functions which are used in make. 113# Set up efficient math functions which are used in make.
140# Here since this file is included by envsetup as well as during build. 114# Here since this file is included by envsetup as well as during build.
141include $(BUILD_SYSTEM)/math.mk 115include $(BUILD_SYSTEM_COMMON)/math.mk
142 116
143include $(BUILD_SYSTEM)/strings.mk 117include $(BUILD_SYSTEM_COMMON)/strings.mk
144 118
145# Various mappings to avoid hard-coding paths all over the place 119# Various mappings to avoid hard-coding paths all over the place
146include $(BUILD_SYSTEM)/pathmap.mk 120include $(BUILD_SYSTEM)/pathmap.mk
diff --git a/core/definitions.mk b/core/definitions.mk
index 3538166d3..43a218942 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -806,29 +806,13 @@ define echo-error
806echo -e "$(ESC_BOLD)$(1): $(ESC_ERROR)error:$(ESC_RESET)$(ESC_BOLD)" $(2) "$(ESC_RESET)" >&2 806echo -e "$(ESC_BOLD)$(1): $(ESC_ERROR)error:$(ESC_RESET)$(ESC_BOLD)" $(2) "$(ESC_RESET)" >&2
807endef 807endef
808 808
809# $(1): message to print
810define pretty-warning
811$(shell $(call echo-warning,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1)))
812endef
813
814# $(1): message to print
815define pretty-error
816$(shell $(call echo-error,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1)))
817$(error done)
818endef
819
820########################################################### 809###########################################################
821## Output the command lines, or not 810## Legacy showcommands compatibility
822########################################################### 811###########################################################
823 812
824ifeq ($(strip $(SHOW_COMMANDS)),)
825define pretty 813define pretty
826@echo $1 814@echo $1
827endef 815endef
828else
829define pretty
830endef
831endif
832 816
833########################################################### 817###########################################################
834## Commands for including the dependency files the compiler generates 818## Commands for including the dependency files the compiler generates
diff --git a/core/main.mk b/core/main.mk
index ecb8c0da2..967f52bbf 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -36,8 +36,6 @@ PWD := $(shell pwd)
36TOP := . 36TOP := .
37TOPDIR := 37TOPDIR :=
38 38
39BUILD_SYSTEM := $(TOPDIR)build/make/core
40
41# This is the default target. It must be the first declared target. 39# This is the default target. It must be the first declared target.
42.PHONY: droid 40.PHONY: droid
43DEFAULT_GOAL := droid 41DEFAULT_GOAL := droid
@@ -48,7 +46,7 @@ droid_targets:
48 46
49# Set up various standard variables based on configuration 47# Set up various standard variables based on configuration
50# and host information. 48# and host information.
51include $(BUILD_SYSTEM)/config.mk 49include build/make/core/config.mk
52 50
53ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),) 51ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),)
54dont_bother := true 52dont_bother := true
@@ -419,6 +417,19 @@ ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),)
419ENFORCE_RRO_SOURCES := 417ENFORCE_RRO_SOURCES :=
420endif 418endif
421 419
420# Color-coded warnings including current module info
421# $(1): message to print
422define pretty-warning
423$(shell $(call echo-warning,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1)))
424endef
425
426# Color-coded errors including current module info
427# $(1): message to print
428define pretty-error
429$(shell $(call echo-error,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1)))
430$(error done)
431endef
432
422subdir_makefiles_inc := . 433subdir_makefiles_inc := .
423FULL_BUILD := 434FULL_BUILD :=
424 435
@@ -493,6 +504,18 @@ $(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] fi
493# ------------------------------------------------------------------- 504# -------------------------------------------------------------------
494 505
495# ------------------------------------------------------------------- 506# -------------------------------------------------------------------
507# Use basic warning/error messages now that LOCAL_MODULE_MAKEFILE
508# and LOCAL_MODULE aren't useful anymore.
509# -------------------------------------------------------------------
510define pretty-warning
511$(warning $(1))
512endef
513
514define pretty-error
515$(error $(1))
516endef
517
518# -------------------------------------------------------------------
496# Enforce to generate all RRO packages for modules having resource 519# Enforce to generate all RRO packages for modules having resource
497# overlays. 520# overlays.
498# ------------------------------------------------------------------- 521# -------------------------------------------------------------------