diff options
-rw-r--r-- | common/core.mk | 56 | ||||
-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.mk | 36 | ||||
-rw-r--r-- | core/definitions.mk | 18 | ||||
-rw-r--r-- | core/main.mk | 29 |
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. | ||
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 | ||
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) |
18 | endif | 18 | endif |
19 | 19 | ||
20 | # Only use ANDROID_BUILD_SHELL to wrap around bash. | 20 | BUILD_SYSTEM :=$= build/make/core |
21 | # DO NOT use other shells such as zsh. | 21 | BUILD_SYSTEM_COMMON :=$= build/make/common |
22 | ifdef ANDROID_BUILD_SHELL | ||
23 | SHELL := $(ANDROID_BUILD_SHELL) | ||
24 | else | ||
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. | ||
28 | SHELL := /bin/bash | ||
29 | endif | ||
30 | |||
31 | # Utility variables. | ||
32 | empty := | ||
33 | space := $(empty) $(empty) | ||
34 | comma := , | ||
35 | # Note that make will eat the newline just before endef. | ||
36 | define newline | ||
37 | |||
38 | |||
39 | endef | ||
40 | # The pound character "#" | ||
41 | define pound | ||
42 | # | ||
43 | endef | ||
44 | # Unfortunately you can't simply define backslash as \ or \\. | ||
45 | backslash := \a | ||
46 | backslash := $(patsubst %a,%,$(backslash)) | ||
47 | 22 | ||
48 | # Prevent accidentally changing these variables | 23 | include $(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. |
141 | include $(BUILD_SYSTEM)/math.mk | 115 | include $(BUILD_SYSTEM_COMMON)/math.mk |
142 | 116 | ||
143 | include $(BUILD_SYSTEM)/strings.mk | 117 | include $(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 |
146 | include $(BUILD_SYSTEM)/pathmap.mk | 120 | include $(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 | |||
806 | echo -e "$(ESC_BOLD)$(1): $(ESC_ERROR)error:$(ESC_RESET)$(ESC_BOLD)" $(2) "$(ESC_RESET)" >&2 | 806 | echo -e "$(ESC_BOLD)$(1): $(ESC_ERROR)error:$(ESC_RESET)$(ESC_BOLD)" $(2) "$(ESC_RESET)" >&2 |
807 | endef | 807 | endef |
808 | 808 | ||
809 | # $(1): message to print | ||
810 | define pretty-warning | ||
811 | $(shell $(call echo-warning,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1))) | ||
812 | endef | ||
813 | |||
814 | # $(1): message to print | ||
815 | define pretty-error | ||
816 | $(shell $(call echo-error,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1))) | ||
817 | $(error done) | ||
818 | endef | ||
819 | |||
820 | ########################################################### | 809 | ########################################################### |
821 | ## Output the command lines, or not | 810 | ## Legacy showcommands compatibility |
822 | ########################################################### | 811 | ########################################################### |
823 | 812 | ||
824 | ifeq ($(strip $(SHOW_COMMANDS)),) | ||
825 | define pretty | 813 | define pretty |
826 | @echo $1 | 814 | @echo $1 |
827 | endef | 815 | endef |
828 | else | ||
829 | define pretty | ||
830 | endef | ||
831 | endif | ||
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) | |||
36 | TOP := . | 36 | TOP := . |
37 | TOPDIR := | 37 | TOPDIR := |
38 | 38 | ||
39 | BUILD_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 |
43 | DEFAULT_GOAL := droid | 41 | DEFAULT_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. |
51 | include $(BUILD_SYSTEM)/config.mk | 49 | include build/make/core/config.mk |
52 | 50 | ||
53 | ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),) | 51 | ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),) |
54 | dont_bother := true | 52 | dont_bother := true |
@@ -419,6 +417,19 @@ ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),) | |||
419 | ENFORCE_RRO_SOURCES := | 417 | ENFORCE_RRO_SOURCES := |
420 | endif | 418 | endif |
421 | 419 | ||
420 | # Color-coded warnings including current module info | ||
421 | # $(1): message to print | ||
422 | define pretty-warning | ||
423 | $(shell $(call echo-warning,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1))) | ||
424 | endef | ||
425 | |||
426 | # Color-coded errors including current module info | ||
427 | # $(1): message to print | ||
428 | define pretty-error | ||
429 | $(shell $(call echo-error,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1))) | ||
430 | $(error done) | ||
431 | endef | ||
432 | |||
422 | subdir_makefiles_inc := . | 433 | subdir_makefiles_inc := . |
423 | FULL_BUILD := | 434 | FULL_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 | # ------------------------------------------------------------------- | ||
510 | define pretty-warning | ||
511 | $(warning $(1)) | ||
512 | endef | ||
513 | |||
514 | define pretty-error | ||
515 | $(error $(1)) | ||
516 | endef | ||
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 | # ------------------------------------------------------------------- |