OSDN Git Service

Merge "brillo_config: Don\'t cache the timestamp." am: 63b10569b9
[android-x86/system-extras.git] / brillo_config / Android.mk
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
23 LOCAL_MODULE_CLASS := ETC
24 LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
25 include $(BUILD_SYSTEM)/base_rules.mk
26
27 # We don't really have a default value for the product id as the backend
28 # interaction will not work if this is not set correctly.
29 $(LOCAL_BUILT_MODULE): BRILLO_PRODUCT_ID ?= ""
30 $(LOCAL_BUILT_MODULE):
31         $(hide)mkdir -p $(dir $@)
32         echo $(BRILLO_PRODUCT_ID) > $@
33
34 include $(CLEAR_VARS)
35 LOCAL_MODULE := product_version
36 LOCAL_MODULE_CLASS := ETC
37 LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)
38 include $(BUILD_SYSTEM)/base_rules.mk
39
40 # The version is set to 0.0.0 if the user did not set the actual version.
41 # This allows us to have a valid version number while being easy to filter.
42 BRILLO_PRODUCT_VERSION ?= "0.0.0"
43 ifeq ($(shell echo $(BRILLO_PRODUCT_VERSION) | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$$'),)
44 $(error Invalid BRILLO_PRODUCT_VERSION "$(BRILLO_PRODUCT_VERSION)", must be \
45   three numbers separated by dots. Example: "1.2.0")
46 endif
47
48 # Append BUILD_NUMBER if it is a number or a build timestamp otherwise.
49 # We don't want to use BUILD_DATETIME_FROM_FILE as this timestamp must be
50 # different at every build.
51 # If you don' want this to change at every build, you can define BUILD_NUMBER in
52 # your product makefile and increase it manually.
53 $(LOCAL_BUILT_MODULE):
54         $(hide)mkdir -p $(dir $@)
55 ifeq ($(shell echo $(BUILD_NUMBER) | grep -E '[^0-9]'),)
56         echo $(BRILLO_PRODUCT_VERSION).$(BUILD_NUMBER) > $@
57 else
58         echo $(BRILLO_PRODUCT_VERSION).$(BUILD_DATETIME) > $@
59 endif
60
61 endif