diff options
author | Bertrand SIMONNET <bsimonnet@google.com> | 2015-10-08 13:06:35 -0700 |
---|---|---|
committer | Bertrand SIMONNET <bsimonnet@google.com> | 2015-10-13 09:17:41 -0700 |
commit | a659ce97b3ee5aac752c827e57dc036c65661ac9 (patch) | |
tree | 6817ca21283c85c16bd04859c2ace18a5df88577 /brillo_config | |
parent | f7b1a8f34349291589f7c4dd255c838454bb53d4 (diff) | |
download | extras-a659ce97b3ee5aac752c827e57dc036c65661ac9.tar.gz |
Add an Android.mk to generate build time configuration.
Some build time variables need to be installed on the image. Instead of
adding those fields in some system services, create a new Android.mk for
it.
BUG: 24585672
Change-Id: Ia4132ef7a200e7839702fe10f878b70cc4dfff43
Diffstat (limited to 'brillo_config')
-rw-r--r-- | brillo_config/Android.mk | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/brillo_config/Android.mk b/brillo_config/Android.mk new file mode 100644 index 00000000..268692df --- /dev/null +++ b/brillo_config/Android.mk @@ -0,0 +1,56 @@ +# +# Copyright (C) 2015 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. +# + +# Build time settings used by system services +# ======================================================== +ifdef OSRELEASED_DIRECTORY + +include $(CLEAR_VARS) +LOCAL_MODULE := product_id +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY) +include $(BUILD_SYSTEM)/base_rules.mk + +# We don't really have a default value for the product id as the backend +# interaction will not work if this is not set correctly. +$(LOCAL_BUILT_MODULE): BRILLO_PRODUCT_ID ?= "" +$(LOCAL_BUILT_MODULE): + echo $(BRILLO_PRODUCT_ID) > $@ + +include $(CLEAR_VARS) +LOCAL_MODULE := product_version +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY) +include $(BUILD_SYSTEM)/base_rules.mk + +# The version is set to 0.0.0 if the user did not set the actual version. +# This allows us to have a valid version number while being easy to filter. +BRILLO_PRODUCT_VERSION ?= "0.0.0" +ifeq ($(shell echo $(BRILLO_PRODUCT_VERSION) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$$'),) +$(error Invalid BRILLO_PRODUCT_VERSION "$(BRILLO_PRODUCT_VERSION)", must be \ + three numbers separated by dots. Example: "1.2.0") +endif + +# Append BUILD_NUMBER if it is a number or a build timestamp otherwise. +# Use DATE to generate the timestamp based on BUILD_DATETIME. +$(LOCAL_BUILT_MODULE): +ifeq ($(shell echo $(BUILD_NUMBER) | grep -E '[^0-9]'),) + echo $(BRILLO_PRODUCT_VERSION).$(BUILD_NUMBER) > $@ +else + echo $(BRILLO_PRODUCT_VERSION).$(BUILD_DATETIME_FROM_FILE) > $@ +endif + +endif |