Please bear with the long post and description but don't really know
how else to describe my problem.
NDK_ROOT/apps/myapp
--- Application.mk
|
client
----jni
Android.mk
--- extra_libs
Android.mk
--- library-a
Android.mk
...
other sources
--- library-b
Android.mk
...
other sources
---source-dir-1
a.cpp
---source-dir-2
b.cpp
My Application.mk looks like this:
-----------------------------------------------------------------------------------------------
APP_MODULES := a b myapp
APP_PROJECT_PATH := $(call my-dir)/client
-----------------------------------------------------------------------------------------------
client/jni/Android.mk looks like this:
-----------------------------------------------------------------------------------------------
LOCAL_PATH := $(call my-dir)
include $(LOCAL_PATH)/extra_libs/Android.mk
include $(CLEAR_VARS)
LOCAL_SRC_FILES := source-dir1/a.cpp source-dir2/b.cpp
LOCAL_MODULE := mylib
LOCAL_LDLIBS := -ldl
include $(BUILD_SHARED_LIBRARY)
-----------------------------------------------------------------------------------------------
client/jni/extra_libs/Android.mk looks like this:
-----------------------------------------------------------------------------------------------
LOCAL_PATH := $(call my-dir)
include $(call all-subdir-makefiles)
-----------------------------------------------------------------------------------------------
Android Makefiles inside library-a and library-b are not important as
they seem to build fine.
The trouble comes when it starts to build the 'mylib' shared library,
where the build process emits something like this:
make: *** No rule to make target `apps/myapp/client/jni/extra_libs/
library-a/source-dir-1/a.cpp', needed by `out/apps/myapp/client/jni/
source-dir-1/oscall.o'. Stop.
I have tried building this in various ways by placing individual
Android.mk files inside source-dir-1/2, but apparently simply building
static libraries without shared library in a single Android.mk doesn't
work. The only way was to list all the sources at the top level
makefile itself with individual directory prefixes.
I also tried by doing:
include $(LOCAL_PATH)/extra_libs/Android.mk
include $(LOCAL_PATH)/source-dir-1/Android.mk
include $(LOCAL_PATH)/source-dir-2/Android.mk
but I see similar issues there as well.
Could anyone please help or suggest how could I build native sources
in such a scenario. The crux is that I want to build several shared
libraries instead of one.
Thanks in advance,
DivKis
NDK_ROOT/apps/myapp
--- Application.mk
client
----jni
Android.mk
--- extra_libs
Android.mk
--- library-a
Android.mk
...other sources
--- library-b
Android.mk
...other sources
---source-dir-1
a.cpp
---source-dir-2
b.cpp
include $(call all-subdir-makefiles)
doesn't work for some reasons.
For now I have manged to solve my problem by moving the code directory
which builds my own shared library at the same level which builds the
other third party libraries.
I hope that NDK build system becomes more robust and provides other
'documented' functions and macros to solve issues like this.
Thanks anyway,
Divkis
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
> You are redefining the meaning of LOCAL_PATH in several Android.mk, that
> probably explains why things are not working for you.
Quoting from the NDK documentation:
"LOCAL_PATH
This variable is used to give the path of the current file.
You MUST define it at the start of your Android.mk, which can
be done with:"
Hence I define it at the top of my Android.mk files, which I have
spread over several directories. I assumed that it would be something
like having multiple Makefile i.e. one inside every directory.
If I don't define LOCAL_PATH inside each Android.mk then how else
would I find path to the current Android.mk? Hence an Android.mk
residing deep inside the project hierarchy would either need to hard
code or use path from top most LOCAL_PATH. I don't see any other
macro/ function that serves this purpose.
Thanks again,
Divkis
Thanks again,
Divkis
Yeah it __does__ work for me now. I think I was confused and assumed
that defining LOCAL_PATH is necessary in every Android.mk files.
Without realizing that LOCAL_PATH is only necessary in the files which
build a module, I was defining in every Android.mk files and to work
around to the problem I was storing this LOCAL_PATH in another
variable and using that variable for obtaining paths, the following
fashion, which is not necessary now.
> LOCAL_PATH := $(call my-dir)
> LIB1_PATH := LOCAL_PATH
>include $LIB1_PATH/<path to Android.mk)
Thanks a lot for explaining this in so detail,
Regards,
Divkis