this repo has no description
1# Copyright (C) PlayControl Software, LLC.
2# Eric Wing <ewing . public @ playcontrol.net>
3#
4# This is a "Prebuilt" Android Makefile provided as an example/template (or direct use if no tweaking is required).
5# The idea is that you have already built the lua .so and .a libraries using CMake.
6# Now you want to use those prebuilt libraries in your own project.
7# Android support prebuilt exteneral modules through its ndk-build system, but you need to have all the pieces setup and in the right place. This is one of those pieces.
8#
9# This file assumes you built all your lua libs and put things into a directory structure like so:
10#
11# Android.mk (this file)
12# libs/armeabi/liblua.a
13# libs/armeabi/liblua.so
14# libs/armeabi-v7a/liblua.a
15# libs/armeabi-v7a/liblua.so
16# libs/x86/liblua.a
17# libs/x86/liblua.so
18#
19# include/lua/lua.h
20# ... (the other header files here)
21#
22# Note that this file is copied into the directory above libs and include.
23# Below is the code you need to make this Makefile export the correct headers, libraries, and flags for both dynamic and static versions.
24
25# LOCAL_PATH needs to be before include
26LOCAL_PATH := $(call my-dir)
27
28# For the dynamic library
29include $(CLEAR_VARS)
30# This is the name of module the caller will use in LOCAL_SHARED_LIBRARIES
31LOCAL_MODULE := SDL_gpu_shared
32LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libSDL2_gpu.so
33LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
34# Use LOCAL_EXPORT_CFLAGS to automatically export the correct flags (as necessary) to the calling module so the caller doesn't need to know the details.
35# LOCAL_EXPORT_CFLAGS :=
36# The .so is already linked so we don't really need to export this.
37#LOCAL_EXPORT_LDLIBS := -lm
38include $(PREBUILT_SHARED_LIBRARY)
39
40
41## For the static library
42#include $(CLEAR_VARS)
43## This is the name of module the caller will use in LOCAL_STATIC_LIBRARIES
44#LOCAL_MODULE := ALmixerLuaBindings_static
45#LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libALmixerLuaBindings.a
46# Use LOCAL_EXPORT_CFLAGS to automatically export the correct flags (as necessary) to the calling module so the caller doesn't need to know the details.
47#LOCAL_EXPORT_CFLAGS :=
48## Since the .a isn't linked, it's link dependencies must be passed on to the calling project.
49# LOCAL_EXPORT_LDLIBS :=
50#LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include/lua
51#include $(PREBUILT_STATIC_LIBRARY)
52
53
54
55# Two other pieces are needed to make this work which fall outside the scope of this file.
56# First, you must have a directory convention for the calling makefile.
57# So let's say we put all the above in a directory called lua. The layout looks like this:
58# lua/
59# Android.mk (this file)
60# libs/armeabi/liblua.a
61# libs/armeabi/liblua.so
62# libs/armeabi-v7a/liblua.a
63# libs/armeabi-v7a/liblua.so
64# libs/x86/liblua.a
65# libs/x86/liblua.so
66#
67# include/lua.h
68# ... (the other header files here)
69
70# So the calling makefile looks something like:
71# LOCAL_PATH := $(call my-dir)
72# include $(CLEAR_VARS)
73# LOCAL_MODULE := hello-jni
74# LOCAL_SRC_FILES := hello-jni.c
75# These are the LOCAL_MODULE names as defined in the prebuilt module's Android.mk. Define either shared or static, but not both. If you use dynamic, don't forget you need to do a System.loadLibrary("lua") in your Java code.
76# LOCAL_SHARED_LIBRARIES := lua_shared
77# #LOCAL_STATIC_LIBRARIES := lua_static
78# include $(BUILD_SHARED_LIBRARY)
79# Android build system will look for folder `lua` in all import paths:
80# $(call import-module,lua)
81# ------ end -----
82
83# Second, you need to set the environmental variable NDK_MODULE_PATH to list the directory containing lua.
84# So if lua is in /Library/Frameworks/Android/PrebuiltModules
85# export NDK_MODULE_PATH=/Library/Frameworks/Android/PrebuiltModules
86# Note that NDK_MODULE_PATH may contain multiple directories like the PATH environmental variable.
87