1# 2# Nanoapp Makefile 3# 4# Include this file in your nanoapp Makefile to produce binary nanoapps to 5# target a variety of architectures. 6# 7 8# Nanoapp Build Configuration Checks ########################################### 9 10ifeq ($(NANOAPP_NAME),) 11$(error "The NANOAPP_NAME variable must be set to the name of the nanoapp. \ 12 This should be assigned by the Makefile that includes app.mk.") 13endif 14 15ifeq ($(NANOAPP_ID),) 16$(error "The NANOAPP_ID variable must be set to the ID of the nanoapp. \ 17 This should be assigned by the Makefile that includes app.mk.") 18endif 19 20ifeq ($(NANOAPP_VERSION),) 21$(error "The NANOAPP_VERSION variable must be set to the version of the nanoapp. \ 22 This should be assigned by the Makefile that includes app.mk.") 23endif 24 25NANOAPP_VERSION := $(strip $(NANOAPP_VERSION)) 26MATCHED_NANOAPP_VERSION := $(shell echo $(NANOAPP_VERSION) \ 27 | grep "^0x[0-9a-fA-F]\{8\}") 28ifneq ($(MATCHED_NANOAPP_VERSION), $(NANOAPP_VERSION)) 29$(error "The NANOAPP_VERSION must be a 4-byte hex-formatted integer. Example: \ 30 0x00000101") 31endif 32 33ifeq ($(NANOAPP_NAME_STRING),) 34$(error "The NANOAPP_NAME_STRING variable must be set to the friendly name of \ 35 the nanoapp. This should be assigned by the Makefile that includes \ 36 app.mk.") 37endif 38 39ifeq ($(NANOAPP_VENDOR_STRING),) 40$(info "NANOAPP_VENDOR_STRING not supplied, defaulting to \"Google\".") 41NANOAPP_VENDOR_STRING = \"Google\" 42endif 43 44ifeq ($(NANOAPP_IS_SYSTEM_NANOAPP),) 45$(info "NANOAPP_IS_SYSTEM_NANOAPP not supplied, defaulting to 0.") 46NANOAPP_IS_SYSTEM_NANOAPP = 0 47endif 48 49ifeq ($(CHRE_PREFIX),) 50ifeq ($(ANDROID_BUILD_TOP),) 51$(error "You must run lunch, or specify an explicit CHRE_PREFIX environment \ 52 variable") 53else 54CHRE_PREFIX = $(ANDROID_BUILD_TOP)/system/chre 55endif 56endif 57 58# Nanoapp Build ################################################################ 59 60# This variable indicates to the variants that some post-processing may be 61# required as the target is a nanoapp. 62IS_NANOAPP_BUILD = true 63 64# Common App Build Configuration ############################################### 65 66OUTPUT_NAME = $(NANOAPP_NAME) 67 68# Common Compiler Flags ######################################################## 69 70# Add the CHRE API to the include search path. 71COMMON_CFLAGS += -I$(CHRE_PREFIX)/chre_api/include/chre_api 72 73# Add util and platform/shared to the include search path. 74COMMON_CFLAGS += -I$(CHRE_PREFIX)/util/include 75COMMON_CFLAGS += -I$(CHRE_PREFIX)/platform/shared/include 76 77# Allows a nanoapp to know that is compiled separately from the CHRE system. 78COMMON_CFLAGS += -DCHRE_IS_NANOAPP_BUILD 79 80# Compile FlatBuffers in a portable way. 81COMMON_CFLAGS += -DFLATBUFFERS_CHRE 82 83# Nanoapp configuration flags. 84COMMON_CFLAGS += -DNANOAPP_ID=$(NANOAPP_ID) 85COMMON_CFLAGS += -DNANOAPP_VERSION=$(NANOAPP_VERSION) 86COMMON_CFLAGS += -DNANOAPP_VENDOR_STRING=$(NANOAPP_VENDOR_STRING) 87COMMON_CFLAGS += -DNANOAPP_NAME_STRING=$(NANOAPP_NAME_STRING) 88COMMON_CFLAGS += -DNANOAPP_IS_SYSTEM_NANOAPP=$(NANOAPP_IS_SYSTEM_NANOAPP) 89 90# Version String ############################################################### 91 92COMMIT_HASH_DIRTY_SUFFIX = $(shell git diff --quiet || echo -dirty) 93COMMIT_HASH = $(shell git log -1 --pretty="format:%h" .)$(COMMIT_HASH_DIRTY_SUFFIX) 94NANOAPP_VERSION_STRING = "nanoapp=$(NANOAPP_NAME)@$(COMMIT_HASH)" 95COMMON_CFLAGS += -DNANOAPP_VERSION_STRING="\"$(NANOAPP_VERSION_STRING)\"" 96 97# Variant-specific Nanoapp Support Source Files ################################ 98 99APP_SUPPORT_PATH = $(CHRE_PREFIX)/build/app_support 100DSO_SUPPORT_LIB_PATH = $(CHRE_PREFIX)/platform/shared/nanoapp 101DSO_SUPPORT_LIB_SRCS = $(DSO_SUPPORT_LIB_PATH)/nanoapp_support_lib_dso.cc 102 103GOOGLE_HEXAGONV60_SLPI_SRCS += $(DSO_SUPPORT_LIB_SRCS) 104GOOGLE_HEXAGONV62_SLPI_SRCS += $(DSO_SUPPORT_LIB_SRCS) 105GOOGLE_HEXAGONV62_SLPI-UIMG_SRCS += $(DSO_SUPPORT_LIB_SRCS) 106GOOGLE_HEXAGONV65_ADSP-SEE_SRCS += $(DSO_SUPPORT_LIB_SRCS) 107GOOGLE_HEXAGONV65_ADSP-SEE-UIMG_SRCS += $(DSO_SUPPORT_LIB_SRCS) 108GOOGLE_HEXAGONV65_SLPI-SEE_SRCS += $(DSO_SUPPORT_LIB_SRCS) 109GOOGLE_HEXAGONV65_SLPI-SEE-UIMG_SRCS += $(DSO_SUPPORT_LIB_SRCS) 110GOOGLE_HEXAGONV66_ADSP-SEE_SRCS += $(DSO_SUPPORT_LIB_SRCS) 111GOOGLE_HEXAGONV66_ADSP-SEE-UIMG_SRCS += $(DSO_SUPPORT_LIB_SRCS) 112GOOGLE_HEXAGONV66_SLPI-SEE_SRCS += $(DSO_SUPPORT_LIB_SRCS) 113GOOGLE_HEXAGONV66_SLPI-SEE-UIMG_SRCS += $(DSO_SUPPORT_LIB_SRCS) 114GOOGLE_ARM64_ANDROID_SRCS += $(DSO_SUPPORT_LIB_SRCS) 115GOOGLE_X86_LINUX_SRCS += $(DSO_SUPPORT_LIB_SRCS) 116QCOM_HEXAGONV60_NANOHUB_SRCS += $(APP_SUPPORT_PATH)/qcom_nanohub/app_support.cc 117QCOM_HEXAGONV60_NANOHUB-UIMG_SRCS += $(APP_SUPPORT_PATH)/qcom_nanohub/app_support_uimg.cc 118 119# Makefile Includes ############################################################ 120 121# Common includes 122include $(CHRE_PREFIX)/build/defs.mk 123include $(CHRE_PREFIX)/build/common.mk 124 125# CHRE API version. 126include $(CHRE_PREFIX)/chre_api/chre_api_version.mk 127 128# Supported variants includes 129include $(CHRE_PREFIX)/build/variant/google_arm64_android.mk 130include $(CHRE_PREFIX)/build/variant/google_cm4_nanohub.mk 131include $(CHRE_PREFIX)/build/variant/google_hexagonv55_slpi-see.mk 132include $(CHRE_PREFIX)/build/variant/google_hexagonv60_slpi.mk 133include $(CHRE_PREFIX)/build/variant/google_hexagonv62_slpi.mk 134include $(CHRE_PREFIX)/build/variant/google_hexagonv62_slpi-uimg.mk 135include $(CHRE_PREFIX)/build/variant/google_hexagonv65_adsp-see.mk 136include $(CHRE_PREFIX)/build/variant/google_hexagonv65_adsp-see-uimg.mk 137include $(CHRE_PREFIX)/build/variant/google_hexagonv65_slpi-see.mk 138include $(CHRE_PREFIX)/build/variant/google_hexagonv65_slpi-see-uimg.mk 139include $(CHRE_PREFIX)/build/variant/google_hexagonv66_adsp-see.mk 140include $(CHRE_PREFIX)/build/variant/google_hexagonv66_adsp-see-uimg.mk 141include $(CHRE_PREFIX)/build/variant/google_hexagonv66_slpi-see.mk 142include $(CHRE_PREFIX)/build/variant/google_hexagonv66_slpi-see-uimg.mk 143include $(CHRE_PREFIX)/build/variant/google_x86_linux.mk 144include $(CHRE_PREFIX)/build/variant/qcom_hexagonv60_nanohub.mk 145include $(CHRE_PREFIX)/build/variant/qcom_hexagonv60_nanohub-uimg.mk 146