Fix android build
[oweals/minetest.git] / build / android / jni / Android.mk
1 LOCAL_PATH := $(call my-dir)/..
2
3 #LOCAL_ADDRESS_SANITIZER:=true
4
5 include $(CLEAR_VARS)
6 LOCAL_MODULE := Irrlicht
7 LOCAL_SRC_FILES := deps/irrlicht/lib/Android/libIrrlicht.a
8 include $(PREBUILT_STATIC_LIBRARY)
9
10 ifeq ($(HAVE_LEVELDB), 1)
11         include $(CLEAR_VARS)
12         LOCAL_MODULE := LevelDB
13         LOCAL_SRC_FILES := deps/leveldb/libleveldb.a
14         include $(PREBUILT_STATIC_LIBRARY)
15 endif
16
17 include $(CLEAR_VARS)
18 LOCAL_MODULE := curl
19 LOCAL_SRC_FILES := deps/curl/lib/.libs/libcurl.a
20 include $(PREBUILT_STATIC_LIBRARY)
21
22 include $(CLEAR_VARS)
23 LOCAL_MODULE := freetype
24 LOCAL_SRC_FILES := deps/freetype2-android/Android/obj/local/$(TARGET_ARCH_ABI)/libfreetype2-static.a
25 include $(PREBUILT_STATIC_LIBRARY)
26
27 include $(CLEAR_VARS)
28 LOCAL_MODULE := iconv
29 LOCAL_SRC_FILES := deps/libiconv/lib/.libs/libiconv.so
30 include $(PREBUILT_SHARED_LIBRARY)
31
32 include $(CLEAR_VARS)
33 LOCAL_MODULE := openal
34 LOCAL_SRC_FILES := deps/openal-soft/libs/$(TARGET_LIBDIR)/libopenal.so
35 include $(PREBUILT_SHARED_LIBRARY)
36
37 include $(CLEAR_VARS)
38 LOCAL_MODULE := ogg
39 LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libogg.so
40 include $(PREBUILT_SHARED_LIBRARY)
41
42 include $(CLEAR_VARS)
43 LOCAL_MODULE := vorbis
44 LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libvorbis.so
45 include $(PREBUILT_SHARED_LIBRARY)
46
47 include $(CLEAR_VARS)
48 LOCAL_MODULE := gmp
49 LOCAL_SRC_FILES := deps/gmp/usr/lib/libgmp.so
50 include $(PREBUILT_SHARED_LIBRARY)
51
52 include $(CLEAR_VARS)
53 LOCAL_MODULE := ssl
54 LOCAL_SRC_FILES := deps/openssl/libssl.a
55 include $(PREBUILT_STATIC_LIBRARY)
56
57 include $(CLEAR_VARS)
58 LOCAL_MODULE := crypto
59 LOCAL_SRC_FILES := deps/openssl/libcrypto.a
60 include $(PREBUILT_STATIC_LIBRARY)
61
62 include $(CLEAR_VARS)
63 LOCAL_MODULE := minetest
64
65 LOCAL_CPP_FEATURES += exceptions
66
67 ifdef GPROF
68 GPROF_DEF=-DGPROF
69 endif
70
71 LOCAL_CFLAGS := -D_IRR_ANDROID_PLATFORM_      \
72                                 -DHAVE_TOUCHSCREENGUI         \
73                                 -DUSE_CURL=1                  \
74                                 -DUSE_SOUND=1                 \
75                                 -DUSE_FREETYPE=1              \
76                                 -DUSE_LEVELDB=$(HAVE_LEVELDB) \
77                                 $(GPROF_DEF)                  \
78                                 -pipe -fstrict-aliasing
79
80 ifndef NDEBUG
81 LOCAL_CFLAGS += -g -D_DEBUG -O0 -fno-omit-frame-pointer
82 else
83 LOCAL_CFLAGS += -fexpensive-optimizations -O3
84 endif
85
86 ifdef GPROF
87 PROFILER_LIBS := android-ndk-profiler
88 LOCAL_CFLAGS += -pg
89 endif
90
91 # LOCAL_CFLAGS += -fsanitize=address
92 # LOCAL_LDFLAGS += -fsanitize=address
93
94 ifeq ($(TARGET_ARCH_ABI),x86)
95 LOCAL_CFLAGS += -fno-stack-protector
96 endif
97
98 LOCAL_C_INCLUDES :=                               \
99                 jni/src jni/src/sqlite                    \
100                 jni/src/script                            \
101                 jni/src/lua/src                           \
102                 jni/src/json                              \
103                 jni/src/cguittfont                        \
104                 deps/irrlicht/include                     \
105                 deps/libiconv/include                     \
106                 deps/freetype2-android/include            \
107                 deps/curl/include                         \
108                 deps/openal-soft/jni/OpenAL/include       \
109                 deps/libvorbis-libogg-android/jni/include \
110                 deps/gmp/usr/include                      \
111                 deps/leveldb/include                      \
112                 deps/sqlite/
113
114 LOCAL_SRC_FILES :=                                \
115                 jni/src/areastore.cpp                     \
116                 jni/src/ban.cpp                           \
117                 jni/src/camera.cpp                        \
118                 jni/src/cavegen.cpp                       \
119                 jni/src/chat.cpp                          \
120                 jni/src/client.cpp                        \
121                 jni/src/clientiface.cpp                   \
122                 jni/src/clientmap.cpp                     \
123                 jni/src/clientmedia.cpp                   \
124                 jni/src/clientobject.cpp                  \
125                 jni/src/clouds.cpp                        \
126                 jni/src/collision.cpp                     \
127                 jni/src/content_abm.cpp                   \
128                 jni/src/content_cao.cpp                   \
129                 jni/src/content_cso.cpp                   \
130                 jni/src/content_mapblock.cpp              \
131                 jni/src/content_mapnode.cpp               \
132                 jni/src/content_nodemeta.cpp              \
133                 jni/src/content_sao.cpp                   \
134                 jni/src/convert_json.cpp                  \
135                 jni/src/craftdef.cpp                      \
136                 jni/src/database-dummy.cpp                \
137                 jni/src/database-sqlite3.cpp              \
138                 jni/src/database.cpp                      \
139                 jni/src/debug.cpp                         \
140                 jni/src/defaultsettings.cpp               \
141                 jni/src/drawscene.cpp                     \
142                 jni/src/dungeongen.cpp                    \
143                 jni/src/emerge.cpp                        \
144                 jni/src/environment.cpp                   \
145                 jni/src/filecache.cpp                     \
146                 jni/src/filesys.cpp                       \
147                 jni/src/fontengine.cpp                    \
148                 jni/src/game.cpp                          \
149                 jni/src/genericobject.cpp                 \
150                 jni/src/gettext.cpp                       \
151                 jni/src/guiChatConsole.cpp                \
152                 jni/src/guiEngine.cpp                     \
153                 jni/src/guiFileSelectMenu.cpp             \
154                 jni/src/guiFormSpecMenu.cpp               \
155                 jni/src/guiKeyChangeMenu.cpp              \
156                 jni/src/guiPasswordChange.cpp             \
157                 jni/src/guiTable.cpp                      \
158                 jni/src/guiscalingfilter.cpp              \
159                 jni/src/guiVolumeChange.cpp               \
160                 jni/src/httpfetch.cpp                     \
161                 jni/src/hud.cpp                           \
162                 jni/src/imagefilters.cpp                  \
163                 jni/src/intlGUIEditBox.cpp                \
164                 jni/src/inventory.cpp                     \
165                 jni/src/inventorymanager.cpp              \
166                 jni/src/itemdef.cpp                       \
167                 jni/src/keycode.cpp                       \
168                 jni/src/light.cpp                         \
169                 jni/src/localplayer.cpp                   \
170                 jni/src/log.cpp                           \
171                 jni/src/main.cpp                          \
172                 jni/src/map.cpp                           \
173                 jni/src/mapblock.cpp                      \
174                 jni/src/mapblock_mesh.cpp                 \
175                 jni/src/mapgen.cpp                        \
176                 jni/src/mapgen_flat.cpp                   \
177                 jni/src/mapgen_fractal.cpp                \
178                 jni/src/mapgen_singlenode.cpp             \
179                 jni/src/mapgen_v5.cpp                     \
180                 jni/src/mapgen_v6.cpp                     \
181                 jni/src/mapgen_v7.cpp                     \
182                 jni/src/mapnode.cpp                       \
183                 jni/src/mapsector.cpp                     \
184                 jni/src/mesh.cpp                          \
185                 jni/src/mg_biome.cpp                      \
186                 jni/src/mg_decoration.cpp                 \
187                 jni/src/mg_ore.cpp                        \
188                 jni/src/mg_schematic.cpp                  \
189                 jni/src/minimap.cpp                       \
190                 jni/src/mods.cpp                          \
191                 jni/src/nameidmapping.cpp                 \
192                 jni/src/nodedef.cpp                       \
193                 jni/src/nodemetadata.cpp                  \
194                 jni/src/nodetimer.cpp                     \
195                 jni/src/noise.cpp                         \
196                 jni/src/objdef.cpp                        \
197                 jni/src/object_properties.cpp             \
198                 jni/src/particles.cpp                     \
199                 jni/src/pathfinder.cpp                    \
200                 jni/src/player.cpp                        \
201                 jni/src/porting_android.cpp               \
202                 jni/src/porting.cpp                       \
203                 jni/src/profiler.cpp                      \
204                 jni/src/quicktune.cpp                     \
205                 jni/src/rollback.cpp                      \
206                 jni/src/rollback_interface.cpp            \
207                 jni/src/serialization.cpp                 \
208                 jni/src/server.cpp                        \
209                 jni/src/serverlist.cpp                    \
210                 jni/src/serverobject.cpp                  \
211                 jni/src/shader.cpp                        \
212                 jni/src/sky.cpp                           \
213                 jni/src/socket.cpp                        \
214                 jni/src/sound.cpp                         \
215                 jni/src/sound_openal.cpp                  \
216                 jni/src/staticobject.cpp                  \
217                 jni/src/subgame.cpp                       \
218                 jni/src/tool.cpp                          \
219                 jni/src/treegen.cpp                       \
220                 jni/src/version.cpp                       \
221                 jni/src/voxel.cpp                         \
222                 jni/src/voxelalgorithms.cpp               \
223                 jni/src/util/auth.cpp                     \
224                 jni/src/util/base64.cpp                   \
225                 jni/src/util/directiontables.cpp          \
226                 jni/src/util/numeric.cpp                  \
227                 jni/src/util/pointedthing.cpp             \
228                 jni/src/util/serialize.cpp                \
229                 jni/src/util/sha1.cpp                     \
230                 jni/src/util/string.cpp                   \
231                 jni/src/util/srp.cpp                      \
232                 jni/src/util/timetaker.cpp                \
233                 jni/src/unittest/test.cpp                 \
234                 jni/src/unittest/test_collision.cpp       \
235                 jni/src/unittest/test_compression.cpp     \
236                 jni/src/unittest/test_connection.cpp      \
237                 jni/src/unittest/test_filepath.cpp        \
238                 jni/src/unittest/test_inventory.cpp       \
239                 jni/src/unittest/test_mapnode.cpp         \
240                 jni/src/unittest/test_nodedef.cpp         \
241                 jni/src/unittest/test_noderesolver.cpp    \
242                 jni/src/unittest/test_noise.cpp           \
243                 jni/src/unittest/test_objdef.cpp          \
244                 jni/src/unittest/test_profiler.cpp        \
245                 jni/src/unittest/test_random.cpp          \
246                 jni/src/unittest/test_schematic.cpp       \
247                 jni/src/unittest/test_serialization.cpp   \
248                 jni/src/unittest/test_settings.cpp        \
249                 jni/src/unittest/test_socket.cpp          \
250                 jni/src/unittest/test_utilities.cpp       \
251                 jni/src/unittest/test_voxelalgorithms.cpp \
252                 jni/src/unittest/test_voxelmanipulator.cpp \
253                 jni/src/touchscreengui.cpp                \
254                 jni/src/database-leveldb.cpp              \
255                 jni/src/settings.cpp                      \
256                 jni/src/wieldmesh.cpp                     \
257                 jni/src/client/clientlauncher.cpp         \
258                 jni/src/client/tile.cpp
259
260 # intentionally kept out (we already build openssl itself): jni/src/util/sha256.c
261
262 # Network
263 LOCAL_SRC_FILES +=                                \
264                 jni/src/network/connection.cpp            \
265                 jni/src/network/networkpacket.cpp         \
266                 jni/src/network/clientopcodes.cpp         \
267                 jni/src/network/clientpackethandler.cpp   \
268                 jni/src/network/serveropcodes.cpp         \
269                 jni/src/network/serverpackethandler.cpp   \
270
271 # lua api
272 LOCAL_SRC_FILES +=                                \
273                 jni/src/script/common/c_content.cpp       \
274                 jni/src/script/common/c_converter.cpp     \
275                 jni/src/script/common/c_internal.cpp      \
276                 jni/src/script/common/c_types.cpp         \
277                 jni/src/script/cpp_api/s_async.cpp        \
278                 jni/src/script/cpp_api/s_base.cpp         \
279                 jni/src/script/cpp_api/s_entity.cpp       \
280                 jni/src/script/cpp_api/s_env.cpp          \
281                 jni/src/script/cpp_api/s_inventory.cpp    \
282                 jni/src/script/cpp_api/s_item.cpp         \
283                 jni/src/script/cpp_api/s_mainmenu.cpp     \
284                 jni/src/script/cpp_api/s_node.cpp         \
285                 jni/src/script/cpp_api/s_nodemeta.cpp     \
286                 jni/src/script/cpp_api/s_player.cpp       \
287                 jni/src/script/cpp_api/s_security.cpp     \
288                 jni/src/script/cpp_api/s_server.cpp       \
289                 jni/src/script/lua_api/l_areastore.cpp    \
290                 jni/src/script/lua_api/l_base.cpp         \
291                 jni/src/script/lua_api/l_craft.cpp        \
292                 jni/src/script/lua_api/l_env.cpp          \
293                 jni/src/script/lua_api/l_inventory.cpp    \
294                 jni/src/script/lua_api/l_item.cpp         \
295                 jni/src/script/lua_api/l_mainmenu.cpp     \
296                 jni/src/script/lua_api/l_mapgen.cpp       \
297                 jni/src/script/lua_api/l_nodemeta.cpp     \
298                 jni/src/script/lua_api/l_nodetimer.cpp    \
299                 jni/src/script/lua_api/l_noise.cpp        \
300                 jni/src/script/lua_api/l_object.cpp       \
301                 jni/src/script/lua_api/l_particles.cpp    \
302                 jni/src/script/lua_api/l_rollback.cpp     \
303                 jni/src/script/lua_api/l_server.cpp       \
304                 jni/src/script/lua_api/l_settings.cpp     \
305                 jni/src/script/lua_api/l_util.cpp         \
306                 jni/src/script/lua_api/l_vmanip.cpp       \
307                 jni/src/script/scripting_game.cpp         \
308                 jni/src/script/scripting_mainmenu.cpp
309
310 #freetype2 support
311 LOCAL_SRC_FILES +=                                \
312                 jni/src/cguittfont/xCGUITTFont.cpp
313
314 # lua
315 LOCAL_SRC_FILES +=                                \
316                 jni/src/lua/src/lapi.c                    \
317                 jni/src/lua/src/lauxlib.c                 \
318                 jni/src/lua/src/lbaselib.c                \
319                 jni/src/lua/src/lcode.c                   \
320                 jni/src/lua/src/ldblib.c                  \
321                 jni/src/lua/src/ldebug.c                  \
322                 jni/src/lua/src/ldo.c                     \
323                 jni/src/lua/src/ldump.c                   \
324                 jni/src/lua/src/lfunc.c                   \
325                 jni/src/lua/src/lgc.c                     \
326                 jni/src/lua/src/linit.c                   \
327                 jni/src/lua/src/liolib.c                  \
328                 jni/src/lua/src/llex.c                    \
329                 jni/src/lua/src/lmathlib.c                \
330                 jni/src/lua/src/lmem.c                    \
331                 jni/src/lua/src/loadlib.c                 \
332                 jni/src/lua/src/lobject.c                 \
333                 jni/src/lua/src/lopcodes.c                \
334                 jni/src/lua/src/loslib.c                  \
335                 jni/src/lua/src/lparser.c                 \
336                 jni/src/lua/src/lstate.c                  \
337                 jni/src/lua/src/lstring.c                 \
338                 jni/src/lua/src/lstrlib.c                 \
339                 jni/src/lua/src/ltable.c                  \
340                 jni/src/lua/src/ltablib.c                 \
341                 jni/src/lua/src/ltm.c                     \
342                 jni/src/lua/src/lundump.c                 \
343                 jni/src/lua/src/lvm.c                     \
344                 jni/src/lua/src/lzio.c                    \
345                 jni/src/lua/src/print.c
346
347 # SQLite3
348 LOCAL_SRC_FILES += deps/sqlite/sqlite3.c
349
350 # Threading
351 LOCAL_SRC_FILES += \
352                 jni/src/threading/event.cpp \
353                 jni/src/threading/mutex.cpp \
354                 jni/src/threading/semaphore.cpp \
355                 jni/src/threading/thread.cpp
356
357 # JSONCPP
358 LOCAL_SRC_FILES += jni/src/json/jsoncpp.cpp
359
360 LOCAL_SHARED_LIBRARIES := iconv openal ogg vorbis gmp
361 LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl ssl crypto android_native_app_glue $(PROFILER_LIBS)
362
363 ifeq ($(HAVE_LEVELDB), 1)
364         LOCAL_STATIC_LIBRARIES += LevelDB
365 endif
366 LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid
367
368 include $(BUILD_SHARED_LIBRARY)
369
370 # at the end of Android.mk
371 ifdef GPROF
372 $(call import-module,android-ndk-profiler)
373 endif
374 $(call import-module,android/native_app_glue)