1#
2# CHRE Makefile
3#
4
5# Environment Setup ############################################################
6
7# Building CHRE is always done in-tree so the CHRE_PREFIX can be assigned to the
8# current directory.
9CHRE_PREFIX = .
10
11# Variant Configuration ########################################################
12
13include $(CHRE_VARIANT_MK_INCLUDES)
14
15# Build Configuration ##########################################################
16
17OUTPUT_NAME = libchre
18
19# Compiler Flags ###############################################################
20
21# Symbols required by the runtime for conditional compilation.
22COMMON_CFLAGS += -DCHRE_MINIMUM_LOG_LEVEL=CHRE_LOG_LEVEL_DEBUG
23COMMON_CFLAGS += -DNANOAPP_MINIMUM_LOG_LEVEL=CHRE_LOG_LEVEL_DEBUG
24COMMON_CFLAGS += -DCHRE_INCLUDE_DEFAULT_STATIC_NANOAPPS
25
26ifneq ($(CHRE_ASSERTIONS_ENABLED), false)
27COMMON_CFLAGS += -DCHRE_ASSERTIONS_ENABLED
28else
29COMMON_CFLAGS += -DCHRE_ASSERTIONS_DISABLED
30endif
31
32# Place nanoapps in a namespace.
33COMMON_CFLAGS += -DCHRE_NANOAPP_INTERNAL
34
35# Optional audio support.
36ifeq ($(CHRE_AUDIO_SUPPORT_ENABLED), true)
37COMMON_CFLAGS += -DCHRE_AUDIO_SUPPORT_ENABLED
38endif
39
40# Optional GNSS support.
41ifeq ($(CHRE_GNSS_SUPPORT_ENABLED), true)
42COMMON_CFLAGS += -DCHRE_GNSS_SUPPORT_ENABLED
43endif
44
45# Optional sensors support.
46ifeq ($(CHRE_SENSORS_SUPPORT_ENABLED), true)
47COMMON_CFLAGS += -DCHRE_SENSORS_SUPPORT_ENABLED
48endif
49
50# Optional Wi-Fi support.
51ifeq ($(CHRE_WIFI_SUPPORT_ENABLED), true)
52COMMON_CFLAGS += -DCHRE_WIFI_SUPPORT_ENABLED
53endif
54
55# Optional WWAN support.
56ifeq ($(CHRE_WWAN_SUPPORT_ENABLED), true)
57COMMON_CFLAGS += -DCHRE_WWAN_SUPPORT_ENABLED
58endif
59
60# Optional on-device unit tests support
61include $(CHRE_PREFIX)/test/test.mk
62
63# Determine the CHRE_HOST_OS to resolve build discrepancies across Darwin and
64# Linux.
65CHRE_HOST_OS := $(shell uname)
66
67ifeq ($(CHRE_PATCH_VERSION),)
68ifeq ($(CHRE_HOST_OS),Darwin)
69DATE_CMD=gdate
70else
71DATE_CMD=date
72endif
73
74# Compute the patch version as the number of hours since the start of some
75# arbitrary epoch. This will roll over 16 bits after ~7 years, but patch version
76# is scoped to the API version, so we can adjust the offset when a new API
77# version is released.
78EPOCH=$(shell $(DATE_CMD) --date='2017-01-01' +%s)
79CHRE_PATCH_VERSION = $(shell echo $$(((`$(DATE_CMD) +%s` - $(EPOCH)) / (60 * 60))))
80endif
81
82COMMON_CFLAGS += -DCHRE_PATCH_VERSION=$(CHRE_PATCH_VERSION)
83
84# Makefile Includes ############################################################
85
86# Common includes.
87include $(CHRE_PREFIX)/build/defs.mk
88include $(CHRE_PREFIX)/build/common.mk
89
90# CHRE Implementation includes.
91include $(CHRE_PREFIX)/apps/apps.mk
92include $(CHRE_PREFIX)/chre_api/chre_api.mk
93include $(CHRE_PREFIX)/core/core.mk
94include $(CHRE_PREFIX)/external/external.mk
95include $(CHRE_PREFIX)/pal/pal.mk
96include $(CHRE_PREFIX)/platform/platform.mk
97include $(CHRE_PREFIX)/util/util.mk
98
99# Supported Variants Includes. Not all CHRE variants are supported by this
100# implementation of CHRE. Example: this CHRE implementation is never built for
101# google_cm4_nanohub as Nanohub itself is a CHRE implementation.
102ifneq ($(CHRE_TARGET_EXTENSION),)
103include $(CHRE_TARGET_EXTENSION)
104endif
105include $(CHRE_PREFIX)/build/variant/google_arm64_android.mk
106include $(CHRE_PREFIX)/build/variant/google_hexagonv55_slpi-see.mk
107include $(CHRE_PREFIX)/build/variant/google_hexagonv60_slpi.mk
108include $(CHRE_PREFIX)/build/variant/google_hexagonv62_slpi.mk
109include $(CHRE_PREFIX)/build/variant/google_hexagonv62_slpi-uimg.mk
110include $(CHRE_PREFIX)/build/variant/google_hexagonv65_adsp-see.mk
111include $(CHRE_PREFIX)/build/variant/google_hexagonv65_adsp-see-uimg.mk
112include $(CHRE_PREFIX)/build/variant/google_hexagonv65_slpi-see.mk
113include $(CHRE_PREFIX)/build/variant/google_hexagonv65_slpi-see-uimg.mk
114include $(CHRE_PREFIX)/build/variant/google_hexagonv66_adsp-see.mk
115include $(CHRE_PREFIX)/build/variant/google_hexagonv66_adsp-see-uimg.mk
116include $(CHRE_PREFIX)/build/variant/google_hexagonv66_slpi-see.mk
117include $(CHRE_PREFIX)/build/variant/google_hexagonv66_slpi-see-uimg.mk
118include $(CHRE_PREFIX)/build/variant/google_hexagonv66_slpi-qsh.mk
119include $(CHRE_PREFIX)/build/variant/google_x86_linux.mk
120include $(CHRE_PREFIX)/build/variant/google_x86_googletest.mk
121