The ndk-build tool is a thin shell script that invokes GNU Make with some command line arguments. You can add any build rules to your Android.mk file that you like in make, including creating the source files.
If you have the generated file name in the LOCAL_SRC_FILES variable along with the rule for creating this file, make will figure it out. This is a minimal Android.mk example that copies “generated .in” to “generated .c” and then compiles it:
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := ndkexample LOCAL_SRC_FILES := generated.c $(LOCAL_PATH)/generated.c : $(LOCAL_PATH)/generated.in echo "Generate file" cp $< $@
richq source share