Fixed Android error on static lib build, if relative NDK_MODULE_PATH used
authorSam Lantinga <slouken@libsdl.org>
Sun, 15 Jun 2014 13:01:10 -0700
changeset 886481198d739376
parent 8863 557cd26c10b6
child 8865 105bbdd3183d
Fixed Android error on static lib build, if relative NDK_MODULE_PATH used

Stefan Pöschel

if the variable NDK_MODULE_PATH is set to a relative path (like "../"),
compiling of a static SDL lib fails with an error similar to this:
make: *** No rule to make target
`..//android_libs/SDL/..//android_libs/SDL/src/main/android/SDL_android_main.c',
needed by
`obj/local/armeabi/objs/SDL2_static/__//android_libs/SDL/src/main/android/SDL_android_main.o'.
Stop.

Regarding the shared lib, this is already prevented by a "subst" command
in the /Android.mk, which removes all occurences of "$(LOCAL_PATH)/".
The attached patch does the same with the additional
"SDL_android_main.c", which is included for build the static SDL lib.
Android.mk
     1.1 --- a/Android.mk	Sun Jun 15 10:42:28 2014 -0700
     1.2 +++ b/Android.mk	Sun Jun 15 13:01:10 2014 -0700
     1.3 @@ -61,7 +61,7 @@
     1.4  
     1.5  LOCAL_MODULE_FILENAME := libSDL2
     1.6  
     1.7 -LOCAL_SRC_FILES += $(LOCAL_PATH)/src/main/android/SDL_android_main.c
     1.8 +LOCAL_SRC_FILES += $(subst $(LOCAL_PATH)/,,$(LOCAL_PATH)/src/main/android/SDL_android_main.c)
     1.9  
    1.10  LOCAL_LDLIBS := 
    1.11  LOCAL_EXPORT_LDLIBS := -Wl,--undefined=Java_org_libsdl_app_SDLActivity_nativeInit -ldl -lGLESv1_CM -lGLESv2 -llog -landroid