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 Wi-Fi support.
46ifeq ($(CHRE_WIFI_SUPPORT_ENABLED), true)
47COMMON_CFLAGS += -DCHRE_WIFI_SUPPORT_ENABLED
48endif
49
50# Optional WWAN support.
51ifeq ($(CHRE_WWAN_SUPPORT_ENABLED), true)
52COMMON_CFLAGS += -DCHRE_WWAN_SUPPORT_ENABLED
53endif
54
55# Determine the CHRE_HOST_OS to resolve build discrepancies across Darwin and
56# Linux.
57CHRE_HOST_OS := $(shell uname)
58
59ifeq ($(CHRE_PATCH_VERSION),)
60ifeq ($(CHRE_HOST_OS),Darwin)
61DATE_CMD=gdate
62else
63DATE_CMD=date
64endif
65
66# Compute the patch version as the number of hours since the start of some
67# arbitrary epoch. This will roll over 16 bits after ~7 years, but patch version
68# is scoped to the API version, so we can adjust the offset when a new API
69# version is released.
70EPOCH=$(shell $(DATE_CMD) --date='2017-01-01' +%s)
71CHRE_PATCH_VERSION = $(shell echo $$(((`$(DATE_CMD) +%s` - $(EPOCH)) / (60 * 60))))
72endif
73
74COMMON_CFLAGS += -DCHRE_PATCH_VERSION=$(CHRE_PATCH_VERSION)
75
76# Makefile Includes ############################################################
77
78# Common includes.
79include $(CHRE_PREFIX)/build/defs.mk
80include $(CHRE_PREFIX)/build/common.mk
81
82# CHRE Implementation includes.
83include $(CHRE_PREFIX)/apps/apps.mk
84include $(CHRE_PREFIX)/ash/ash.mk
85include $(CHRE_PREFIX)/chre_api/chre_api.mk
86include $(CHRE_PREFIX)/core/core.mk
87include $(CHRE_PREFIX)/external/external.mk
88include $(CHRE_PREFIX)/pal/pal.mk
89include $(CHRE_PREFIX)/platform/platform.mk
90include $(CHRE_PREFIX)/util/util.mk
91
92# Supported Variants Includes. Not all CHRE variants are supported by this
93# implementation of CHRE. Example: this CHRE implementation is never built for
94# google_cm4_nanohub as Nanohub itself is a CHRE implementation.
95include $(CHRE_PREFIX)/build/variant/google_arm64_android.mk
96include $(CHRE_PREFIX)/build/variant/google_hexagonv55_slpi-see.mk
97include $(CHRE_PREFIX)/build/variant/google_hexagonv60_slpi.mk
98include $(CHRE_PREFIX)/build/variant/google_hexagonv62_slpi.mk
99include $(CHRE_PREFIX)/build/variant/google_hexagonv62_slpi-uimg.mk
100include $(CHRE_PREFIX)/build/variant/google_hexagonv65_adsp-see.mk
101include $(CHRE_PREFIX)/build/variant/google_hexagonv65_adsp-see-uimg.mk
102include $(CHRE_PREFIX)/build/variant/google_hexagonv65_slpi-see.mk
103include $(CHRE_PREFIX)/build/variant/google_hexagonv65_slpi-see-uimg.mk
104include $(CHRE_PREFIX)/build/variant/google_hexagonv66_adsp-see.mk
105include $(CHRE_PREFIX)/build/variant/google_hexagonv66_adsp-see-uimg.mk
106include $(CHRE_PREFIX)/build/variant/google_hexagonv66_slpi-see.mk
107include $(CHRE_PREFIX)/build/variant/google_hexagonv66_slpi-see-uimg.mk
108include $(CHRE_PREFIX)/build/variant/google_x86_linux.mk
109include $(CHRE_PREFIX)/build/variant/google_x86_googletest.mk
110