Bertrand SIMONNET | a659ce9 | 2015-10-08 13:06:35 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2015 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 | # Build time settings used by system services |
| 18 | # ======================================================== |
| 19 | ifdef OSRELEASED_DIRECTORY |
| 20 | |
| 21 | include $(CLEAR_VARS) |
| 22 | LOCAL_MODULE := product_id |
Bob Badour | 4e06008 | 2021-02-16 18:59:28 -0800 | [diff] [blame] | 23 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 |
| 24 | LOCAL_LICENSE_CONDITIONS := notice |
Sen Jiang | b6cfdd3 | 2016-11-03 16:24:14 -0700 | [diff] [blame] | 25 | LOCAL_MODULE_CLASS := FAKE |
| 26 | LOCAL_MODULE_PATH := $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY) |
Bertrand SIMONNET | a659ce9 | 2015-10-08 13:06:35 -0700 | [diff] [blame] | 27 | include $(BUILD_SYSTEM)/base_rules.mk |
| 28 | |
Bertrand SIMONNET | a659ce9 | 2015-10-08 13:06:35 -0700 | [diff] [blame] | 29 | $(LOCAL_BUILT_MODULE): |
Sen Jiang | b6cfdd3 | 2016-11-03 16:24:14 -0700 | [diff] [blame] | 30 | $(hide) mkdir -p $(dir $@) |
Bertrand SIMONNET | a659ce9 | 2015-10-08 13:06:35 -0700 | [diff] [blame] | 31 | echo $(BRILLO_PRODUCT_ID) > $@ |
Sen Jiang | b6cfdd3 | 2016-11-03 16:24:14 -0700 | [diff] [blame] | 32 | $(hide) mkdir -p $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY) |
| 33 | ln -sf /oem/$(OSRELEASED_DIRECTORY)/product_id $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY) |
| 34 | |
Sen Jiang | 368d8a3 | 2017-03-24 12:44:58 -0700 | [diff] [blame] | 35 | include $(CLEAR_VARS) |
| 36 | LOCAL_MODULE := system_id |
Bob Badour | 4e06008 | 2021-02-16 18:59:28 -0800 | [diff] [blame] | 37 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 |
| 38 | LOCAL_LICENSE_CONDITIONS := notice |
Sen Jiang | 368d8a3 | 2017-03-24 12:44:58 -0700 | [diff] [blame] | 39 | LOCAL_MODULE_CLASS := ETC |
| 40 | LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY) |
| 41 | include $(BUILD_SYSTEM)/base_rules.mk |
| 42 | |
Sen Jiang | 368d8a3 | 2017-03-24 12:44:58 -0700 | [diff] [blame] | 43 | $(LOCAL_BUILT_MODULE): |
| 44 | $(hide) mkdir -p $(dir $@) |
| 45 | echo $(BRILLO_SYSTEM_ID) > $@ |
| 46 | |
Bertrand SIMONNET | a659ce9 | 2015-10-08 13:06:35 -0700 | [diff] [blame] | 47 | |
| 48 | include $(CLEAR_VARS) |
| 49 | LOCAL_MODULE := product_version |
Bob Badour | 4e06008 | 2021-02-16 18:59:28 -0800 | [diff] [blame] | 50 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 |
| 51 | LOCAL_LICENSE_CONDITIONS := notice |
Sen Jiang | b6cfdd3 | 2016-11-03 16:24:14 -0700 | [diff] [blame] | 52 | LOCAL_MODULE_CLASS := FAKE |
| 53 | LOCAL_MODULE_PATH := $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY) |
Bertrand SIMONNET | a659ce9 | 2015-10-08 13:06:35 -0700 | [diff] [blame] | 54 | include $(BUILD_SYSTEM)/base_rules.mk |
| 55 | |
Sen Jiang | 50ffb91 | 2017-04-04 13:24:56 -0700 | [diff] [blame] | 56 | # The version is set to 0.0.0.0 if the user did not set the actual version. |
Bertrand SIMONNET | a659ce9 | 2015-10-08 13:06:35 -0700 | [diff] [blame] | 57 | # This allows us to have a valid version number while being easy to filter. |
Sen Jiang | 50ffb91 | 2017-04-04 13:24:56 -0700 | [diff] [blame] | 58 | BRILLO_PRODUCT_VERSION ?= "0.0.0.0" |
| 59 | ifeq ($(shell echo $(BRILLO_PRODUCT_VERSION) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$$'),) |
Bertrand SIMONNET | a659ce9 | 2015-10-08 13:06:35 -0700 | [diff] [blame] | 60 | $(error Invalid BRILLO_PRODUCT_VERSION "$(BRILLO_PRODUCT_VERSION)", must be \ |
Sen Jiang | 50ffb91 | 2017-04-04 13:24:56 -0700 | [diff] [blame] | 61 | four numbers separated by dots. Example: "1.2.0.0") |
Sen Jiang | 4e37d79 | 2017-02-21 17:16:35 -0800 | [diff] [blame] | 62 | endif |
| 63 | |
| 64 | $(LOCAL_BUILT_MODULE): |
| 65 | $(hide) mkdir -p $(dir $@) |
| 66 | echo $(BRILLO_PRODUCT_VERSION) > $@ |
| 67 | $(hide) mkdir -p $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY) |
| 68 | ln -sf /oem/$(OSRELEASED_DIRECTORY)/product_version $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY) |
| 69 | |
| 70 | |
| 71 | include $(CLEAR_VARS) |
| 72 | LOCAL_MODULE := system_version |
Bob Badour | 4e06008 | 2021-02-16 18:59:28 -0800 | [diff] [blame] | 73 | LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 |
| 74 | LOCAL_LICENSE_CONDITIONS := notice |
Sen Jiang | 4e37d79 | 2017-02-21 17:16:35 -0800 | [diff] [blame] | 75 | LOCAL_MODULE_CLASS := ETC |
| 76 | LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY) |
| 77 | include $(BUILD_SYSTEM)/base_rules.mk |
| 78 | |
Sen Jiang | 50ffb91 | 2017-04-04 13:24:56 -0700 | [diff] [blame] | 79 | # The version is set to 0.0.0 if the user did not set the actual version. |
Sen Jiang | 4e37d79 | 2017-02-21 17:16:35 -0800 | [diff] [blame] | 80 | # This allows us to have a valid version number while being easy to filter. |
Sen Jiang | 50ffb91 | 2017-04-04 13:24:56 -0700 | [diff] [blame] | 81 | BRILLO_SYSTEM_VERSION ?= "0.0.0" |
| 82 | ifeq ($(shell echo $(BRILLO_SYSTEM_VERSION) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$$'),) |
Sen Jiang | 4e37d79 | 2017-02-21 17:16:35 -0800 | [diff] [blame] | 83 | $(error Invalid BRILLO_SYSTEM_VERSION "$(BRILLO_SYSTEM_VERSION)", must be \ |
Sen Jiang | 50ffb91 | 2017-04-04 13:24:56 -0700 | [diff] [blame] | 84 | three numbers separated by dots. Example: "1.2.0") |
Bertrand SIMONNET | a659ce9 | 2015-10-08 13:06:35 -0700 | [diff] [blame] | 85 | endif |
| 86 | |
| 87 | # Append BUILD_NUMBER if it is a number or a build timestamp otherwise. |
Bertrand SIMONNET | 5f78882 | 2015-10-28 21:42:56 -0700 | [diff] [blame] | 88 | # If you don' want this to change at every build, you can define BUILD_NUMBER in |
| 89 | # your product makefile and increase it manually. |
Bertrand SIMONNET | a659ce9 | 2015-10-08 13:06:35 -0700 | [diff] [blame] | 90 | $(LOCAL_BUILT_MODULE): |
Sen Jiang | b6cfdd3 | 2016-11-03 16:24:14 -0700 | [diff] [blame] | 91 | $(hide) mkdir -p $(dir $@) |
Nan Zhang | cfa3822 | 2018-02-20 13:11:27 -0800 | [diff] [blame] | 92 | ifeq ($(strip $(HAS_BUILD_NUMBER)),true) |
Nan Zhang | 4b15d3a | 2018-02-22 09:48:12 -0800 | [diff] [blame] | 93 | echo $(BRILLO_SYSTEM_VERSION).$(shell cat $(BUILD_NUMBER_FILE)) > $@ |
Bertrand SIMONNET | a659ce9 | 2015-10-08 13:06:35 -0700 | [diff] [blame] | 94 | else |
Nan Zhang | 37eb91d | 2018-02-14 13:29:12 -0800 | [diff] [blame] | 95 | echo $(BRILLO_SYSTEM_VERSION).$(BUILD_DATETIME_FROM_FILE) > $@ |
Bertrand SIMONNET | a659ce9 | 2015-10-08 13:06:35 -0700 | [diff] [blame] | 96 | endif |
Bertrand SIMONNET | a659ce9 | 2015-10-08 13:06:35 -0700 | [diff] [blame] | 97 | |
| 98 | endif |