aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2018-10-18 16:11:40 -0700
committerDan Willemsen <dwillemsen@google.com>2018-10-20 14:43:58 -0700
commit7ddc50a066287b804a754951a597668d627478df (patch)
tree1ba49bfc8ea468c13fabf973212353a006857559
parent17c9e2a2960e8ef054593284c879d5a8d1d03fcf (diff)
downloadbuild_make-7ddc50a066287b804a754951a597668d627478df.tar.gz
build_make-7ddc50a066287b804a754951a597668d627478df.tar.bz2
build_make-7ddc50a066287b804a754951a597668d627478df.zip
Refactor common makefile fragments
In preparation for setting up another Kati stage, move some common settings and tools into a common folder. This way it's a bit easier to see that they're safe to use, and that they shouldn't depend on anything outside of the common folder. Bug: 117463001 Test: build-aosp_arm.ninja is the same before and after Change-Id: Ief4b75a4dbe45b73ffd03bf32c60695c816d979d
-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 0000000000..e5264b072d
--- /dev/null
+++ b/common/core.mk
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Only use ANDROID_BUILD_SHELL to wrap around bash.
+# DO NOT use other shells such as zsh.
+ifdef ANDROID_BUILD_SHELL
+SHELL := $(ANDROID_BUILD_SHELL)
+else
+# Use bash, not whatever shell somebody has installed as /bin/sh
+# This is repeated from main.mk, since envsetup.sh runs this file
+# directly.
+SHELL := /bin/bash
+endif
+
+# Utility variables.
+empty :=
+space := $(empty) $(empty)
+comma := ,
+# Note that make will eat the newline just before endef.
+define newline
+
+
+endef
+# The pound character "#"
+define pound
+#
+endef
+# Unfortunately you can't simply define backslash as \ or \\.
+backslash := \a
+backslash := $(patsubst %a,%,$(backslash))
+
+# Prevent accidentally changing these variables
+.KATI_READONLY := SHELL empty space comma newline pound backslash
+
+# Basic warning/error wrappers. These will be redefined to include the local
+# module information when reading Android.mk files.
+define pretty-warning
+$(warning $(1))
+endef
+
+define pretty-error
+$(error $(1))
+endef
diff --git a/core/math.mk b/common/math.mk
index ac3151e3c5..ac3151e3c5 100644
--- a/core/math.mk
+++ b/common/math.mk
diff --git a/core/strings.mk b/common/strings.mk
index ce6d6fbe9f..ce6d6fbe9f 100644
--- a/core/strings.mk
+++ b/common/strings.mk
diff --git a/core/config.mk b/core/config.mk
index aeb8aeeaee..5491234e68 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -17,36 +17,10 @@ $(warning )
$(error done)
endif
-# Only use ANDROID_BUILD_SHELL to wrap around bash.
-# DO NOT use other shells such as zsh.
-ifdef ANDROID_BUILD_SHELL
-SHELL := $(ANDROID_BUILD_SHELL)
-else
-# Use bash, not whatever shell somebody has installed as /bin/sh
-# This is repeated from main.mk, since envsetup.sh runs this file
-# directly.
-SHELL := /bin/bash
-endif
-
-# Utility variables.
-empty :=
-space := $(empty) $(empty)
-comma := ,
-# Note that make will eat the newline just before endef.
-define newline
-
-
-endef
-# The pound character "#"
-define pound
-#
-endef
-# Unfortunately you can't simply define backslash as \ or \\.
-backslash := \a
-backslash := $(patsubst %a,%,$(backslash))
+BUILD_SYSTEM :=$= build/make/core
+BUILD_SYSTEM_COMMON :=$= build/make/common
-# Prevent accidentally changing these variables
-.KATI_READONLY := SHELL empty space comma newline pound backslash
+include $(BUILD_SYSTEM_COMMON)/core.mk
# Mark variables that should be coming as environment variables from soong_ui
# as readonly
@@ -138,9 +112,9 @@ endif
# Set up efficient math functions which are used in make.
# Here since this file is included by envsetup as well as during build.
-include $(BUILD_SYSTEM)/math.mk
+include $(BUILD_SYSTEM_COMMON)/math.mk
-include $(BUILD_SYSTEM)/strings.mk
+include $(BUILD_SYSTEM_COMMON)/strings.mk
# Various mappings to avoid hard-coding paths all over the place
include $(BUILD_SYSTEM)/pathmap.mk
diff --git a/core/definitions.mk b/core/definitions.mk
index 3538166d33..43a218942e 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -806,29 +806,13 @@ define echo-error
echo -e "$(ESC_BOLD)$(1): $(ESC_ERROR)error:$(ESC_RESET)$(ESC_BOLD)" $(2) "$(ESC_RESET)" >&2
endef
-# $(1): message to print
-define pretty-warning
-$(shell $(call echo-warning,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1)))
-endef
-
-# $(1): message to print
-define pretty-error
-$(shell $(call echo-error,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1)))
-$(error done)
-endef
-
###########################################################
-## Output the command lines, or not
+## Legacy showcommands compatibility
###########################################################
-ifeq ($(strip $(SHOW_COMMANDS)),)
define pretty
@echo $1
endef
-else
-define pretty
-endef
-endif
###########################################################
## Commands for including the dependency files the compiler generates
diff --git a/core/main.mk b/core/main.mk
index ecb8c0da26..967f52bbfd 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -36,8 +36,6 @@ PWD := $(shell pwd)
TOP := .
TOPDIR :=
-BUILD_SYSTEM := $(TOPDIR)build/make/core
-
# This is the default target. It must be the first declared target.
.PHONY: droid
DEFAULT_GOAL := droid
@@ -48,7 +46,7 @@ droid_targets:
# Set up various standard variables based on configuration
# and host information.
-include $(BUILD_SYSTEM)/config.mk
+include build/make/core/config.mk
ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),)
dont_bother := true
@@ -419,6 +417,19 @@ ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),)
ENFORCE_RRO_SOURCES :=
endif
+# Color-coded warnings including current module info
+# $(1): message to print
+define pretty-warning
+$(shell $(call echo-warning,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1)))
+endef
+
+# Color-coded errors including current module info
+# $(1): message to print
+define pretty-error
+$(shell $(call echo-error,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1)))
+$(error done)
+endef
+
subdir_makefiles_inc := .
FULL_BUILD :=
@@ -493,6 +504,18 @@ $(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] fi
# -------------------------------------------------------------------
# -------------------------------------------------------------------
+# Use basic warning/error messages now that LOCAL_MODULE_MAKEFILE
+# and LOCAL_MODULE aren't useful anymore.
+# -------------------------------------------------------------------
+define pretty-warning
+$(warning $(1))
+endef
+
+define pretty-error
+$(error $(1))
+endef
+
+# -------------------------------------------------------------------
# Enforce to generate all RRO packages for modules having resource
# overlays.
# -------------------------------------------------------------------