How to work with a source code file automatically generated during the build process

I am trying to create a third-party library that uses automatically generated source code files. In the normal case, such files are created using the gnu build tools. My question is: how can I specify NDK build tools to create and create this type of file.

Thanks in advance

+4
source share
1 answer

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 $< $@ 
+4
source

Source: https://habr.com/ru/post/1309054/


All Articles