blob: cefc0826e441c36112c11b72457a4fd3749631ef [file] [log] [blame]
Bertrand SIMONNETa659ce92015-10-08 13:06:35 -07001#
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# ========================================================
19ifdef OSRELEASED_DIRECTORY
20
21include $(CLEAR_VARS)
22LOCAL_MODULE := product_id
Sen Jiangb6cfdd32016-11-03 16:24:14 -070023LOCAL_MODULE_CLASS := FAKE
24LOCAL_MODULE_PATH := $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)
Bertrand SIMONNETa659ce92015-10-08 13:06:35 -070025include $(BUILD_SYSTEM)/base_rules.mk
26
Bertrand SIMONNETa659ce92015-10-08 13:06:35 -070027$(LOCAL_BUILT_MODULE):
Sen Jiangb6cfdd32016-11-03 16:24:14 -070028 $(hide) mkdir -p $(dir $@)
Bertrand SIMONNETa659ce92015-10-08 13:06:35 -070029 echo $(BRILLO_PRODUCT_ID) > $@
Sen Jiangb6cfdd32016-11-03 16:24:14 -070030 $(hide) mkdir -p $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
31 ln -sf /oem/$(OSRELEASED_DIRECTORY)/product_id $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
32
Sen Jiang368d8a32017-03-24 12:44:58 -070033include $(CLEAR_VARS)
34LOCAL_MODULE := system_id
35LOCAL_MODULE_CLASS := ETC
36LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
37include $(BUILD_SYSTEM)/base_rules.mk
38
Sen Jiang368d8a32017-03-24 12:44:58 -070039$(LOCAL_BUILT_MODULE):
40 $(hide) mkdir -p $(dir $@)
41 echo $(BRILLO_SYSTEM_ID) > $@
42
Bertrand SIMONNETa659ce92015-10-08 13:06:35 -070043
44include $(CLEAR_VARS)
45LOCAL_MODULE := product_version
Sen Jiangb6cfdd32016-11-03 16:24:14 -070046LOCAL_MODULE_CLASS := FAKE
47LOCAL_MODULE_PATH := $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)
Bertrand SIMONNETa659ce92015-10-08 13:06:35 -070048include $(BUILD_SYSTEM)/base_rules.mk
49
Sen Jiang50ffb912017-04-04 13:24:56 -070050# The version is set to 0.0.0.0 if the user did not set the actual version.
Bertrand SIMONNETa659ce92015-10-08 13:06:35 -070051# This allows us to have a valid version number while being easy to filter.
Sen Jiang50ffb912017-04-04 13:24:56 -070052BRILLO_PRODUCT_VERSION ?= "0.0.0.0"
53ifeq ($(shell echo $(BRILLO_PRODUCT_VERSION) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$$'),)
Bertrand SIMONNETa659ce92015-10-08 13:06:35 -070054$(error Invalid BRILLO_PRODUCT_VERSION "$(BRILLO_PRODUCT_VERSION)", must be \
Sen Jiang50ffb912017-04-04 13:24:56 -070055 four numbers separated by dots. Example: "1.2.0.0")
Sen Jiang4e37d792017-02-21 17:16:35 -080056endif
57
58$(LOCAL_BUILT_MODULE):
59 $(hide) mkdir -p $(dir $@)
60 echo $(BRILLO_PRODUCT_VERSION) > $@
61 $(hide) mkdir -p $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
62 ln -sf /oem/$(OSRELEASED_DIRECTORY)/product_version $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
63
64
65include $(CLEAR_VARS)
66LOCAL_MODULE := system_version
67LOCAL_MODULE_CLASS := ETC
68LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
69include $(BUILD_SYSTEM)/base_rules.mk
70
Sen Jiang50ffb912017-04-04 13:24:56 -070071# The version is set to 0.0.0 if the user did not set the actual version.
Sen Jiang4e37d792017-02-21 17:16:35 -080072# This allows us to have a valid version number while being easy to filter.
Sen Jiang50ffb912017-04-04 13:24:56 -070073BRILLO_SYSTEM_VERSION ?= "0.0.0"
74ifeq ($(shell echo $(BRILLO_SYSTEM_VERSION) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$$'),)
Sen Jiang4e37d792017-02-21 17:16:35 -080075$(error Invalid BRILLO_SYSTEM_VERSION "$(BRILLO_SYSTEM_VERSION)", must be \
Sen Jiang50ffb912017-04-04 13:24:56 -070076 three numbers separated by dots. Example: "1.2.0")
Bertrand SIMONNETa659ce92015-10-08 13:06:35 -070077endif
78
79# Append BUILD_NUMBER if it is a number or a build timestamp otherwise.
Bertrand SIMONNET5f788822015-10-28 21:42:56 -070080# If you don' want this to change at every build, you can define BUILD_NUMBER in
81# your product makefile and increase it manually.
Bertrand SIMONNETa659ce92015-10-08 13:06:35 -070082$(LOCAL_BUILT_MODULE):
Sen Jiangb6cfdd32016-11-03 16:24:14 -070083 $(hide) mkdir -p $(dir $@)
Nan Zhangcfa38222018-02-20 13:11:27 -080084ifeq ($(strip $(HAS_BUILD_NUMBER)),true)
Nan Zhang4b15d3a2018-02-22 09:48:12 -080085 echo $(BRILLO_SYSTEM_VERSION).$(shell cat $(BUILD_NUMBER_FILE)) > $@
Bertrand SIMONNETa659ce92015-10-08 13:06:35 -070086else
Nan Zhang37eb91d2018-02-14 13:29:12 -080087 echo $(BRILLO_SYSTEM_VERSION).$(BUILD_DATETIME_FROM_FILE) > $@
Bertrand SIMONNETa659ce92015-10-08 13:06:35 -070088endif
Bertrand SIMONNETa659ce92015-10-08 13:06:35 -070089
90endif