On Friday, January 11, 2013 10:58:02 AM UTC-5, Digit wrote:
How can I add "pre-build" event for compilation of any file in android build system?
You can't, instead write a wrapper that runs your prebuilt script, then invokes ndk-build.
In regular makefile, I'd do something like this:
.PHONY pre-build
%.cpp: pre-build
pre-build:
PrebuildRule.sh
all: pre-build ...
...
this way, no matter what, pre-build step will be executed, but I can't find a way how to do such thing with android build system.
Can anybody suggest appropriate workaround?
thanks.
I would really prefer to avoid adding stuff, since I want to make as
simple as possible for the other programmers that use my stuff.
So, I added something like this at the beginning of my Android.mk file:
$(PrebuildResult) := $(shell prebuild.sh)
LOCAL_SRC_FILES := ....
And, then, I also manually added dependency on the prebuild.sh script (which generates the Prebuit.h header):
Prebuilt.h: prebuild.sh
So far everything works fine, except that it might fails on first clean built with -j8, because some parallel jobs try to compile files that depend on prebuilt.h which wasn't yet generated by the prebuilt.sh. That's why I was trying to find a way how add dependency or a prebuilt step in android. Perhaps, android/ndk devs could add that as a todo for the build system. Knowing internals it of the system it's easy to add something like that.