Android has makefile macros for creating local modules written in C, C++ and Java. A module declaration can look something like this.
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := mymodule LOCAL_SRC_FILES := a.cpp b.cpp LOCAL_LDLIBS := -lGLESv3 -llog LOCAL_CXXFLAGS := -std=c++14 include $(BUILD_SHARED_LIBRARY)
The syntax is simple, but not very flexible.
Today I needed to create a custom target in an Android makefile. At first I thought that it would be as simple as creating a standard Makefile target, but in my particular situation I found that it had to be structured as a local module. I finally found a solution by invoking the BUILD_PHONY_PACKAGE module template.
custom_myfile_target: echo Run custom code here include $(CLEAR_VARS) LOCAL_MODULE := mymodule LOCAL_ADDITIONAL_DEPENDENCIES := custom_myfile_target include $(BUILD_PHONY_PACKAGE)
custom_myfile_target is a regular GNU makefile target which can be extended as such.
Advertisements