In Android NDK, I build JNI files generated automatically by SWIG. callmanager_wrap.cpp is part of a shared library:git
LOCAL_SRC_FILES += callmanager_wrap.cpp include $(BUILD_SHARED_LIBRARY)
But I would like to append/edit callmanager_wrap.cpp
before compiling. To be more explicit:app
cat jnistuff.txt >> callmanager_wrap.cpp
Content I need to add is known in advance but callmanager_wrap.cpp is not. It is generated by SWIG. Ultimately, my custom rule will have to run following command to generate callmanager_wrap.cpp:ide
swig -c++ -java -package com.package.my -o callmanager_wrap.cpp callmanager.i
According to this post, it is not possible to add custom rules to Android.mk
. But in Android sources, I believe there are some Android.mk
handling steps after BUILT or INSTALLED. I tried the following:post
MY_JNI_WRAP=callmanager_wrap.cpp include $(CLEAR_VARS) LOCAL_SRC_FILES += callmanager_wrap.cpp LOCAL_INTERMEDIATE_TARGETS += myjni myjni: echo "in myjni target" swig -c++ -java -package com.package.my -o $(MY_JNI_WRAP) callmanager.i cat jnistuff.txt >> $(MY_JNI_WRAP) include $(BUILD_SHARED_LIBRARY)
But myjni
target is never called.ui
- What is LOCAL_INTERMEDIATE_TARGETS used for?
- Can I possibly achieve what I want to do here without writing an external script or makefile?
make clean
after agit rebase
. But that's a developer's problem. Isn't it possible to custom android makefiles to that extent? I won't hide that I am considering writing a top-script to do just that but I remain curious about this android limitation. – m-ric Sep 11 '12 at 20:40