1# Copyright (c) 2013 Google, Inc.
2#
3# This software is provided 'as-is', without any express or implied
4# warranty.  In no event will the authors be held liable for any damages
5# arising from the use of this software.
6# Permission is granted to anyone to use this software for any purpose,
7# including commercial applications, and to alter it and redistribute it
8# freely, subject to the following restrictions:
9# 1. The origin of this software must not be misrepresented; you must not
10# claim that you wrote the original software. If you use this software
11# in a product, an acknowledgment in the product documentation would be
12# appreciated but is not required.
13# 2. Altered source versions must be plainly marked as such, and must not be
14# misrepresented as being the original software.
15# 3. This notice may not be removed or altered from any source distribution.
16
17LOCAL_PATH := $(call my-dir)
18FLATBUFFERS_ROOT_DIR := $(LOCAL_PATH)/../../..
19
20# FlatBuffers test
21include $(CLEAR_VARS)
22
23# Include the FlatBuffer utility function to generate header files from schemas.
24include $(FLATBUFFERS_ROOT_DIR)/android/jni/include.mk
25
26LOCAL_MODULE := FlatBufferSample
27
28# Set up some useful variables to identify schema and output directories and
29# schema files.
30ANDROID_SAMPLE_GENERATED_OUTPUT_DIR := $(LOCAL_PATH)/gen/include
31ANDROID_SAMPLE_SCHEMA_DIR := $(LOCAL_PATH)/schemas
32ANDROID_SAMPLE_SCHEMA_FILES := $(ANDROID_SAMPLE_SCHEMA_DIR)/animal.fbs
33
34LOCAL_C_INCLUDES := $(ANDROID_SAMPLE_GENERATED_OUTPUT_DIR)
35
36$(info $(LOCAL_C_INCLUDES))
37
38LOCAL_SRC_FILES := main.cpp
39
40LOCAL_CPPFLAGS := -std=c++11 -fexceptions -Wall -Wno-literal-suffix
41LOCAL_LDLIBS := -llog -landroid -latomic
42LOCAL_ARM_MODE := arm
43LOCAL_STATIC_LIBRARIES := android_native_app_glue flatbuffers
44
45ifeq (,$(ANDROID_SAMPLE_RUN_ONCE))
46ANDROID_SAMPLE_RUN_ONCE := 1
47$(call flatbuffers_header_build_rules,$(ANDROID_SAMPLE_SCHEMA_FILES),$(ANDROID_SAMPLE_SCHEMA_DIR),$(ANDROID_SAMPLE_GENERATED_OUTPUT_DIR),,$(LOCAL_SRC_FILES))
48endif
49
50include $(BUILD_SHARED_LIBRARY)
51
52# Path to Flatbuffers root directory.
53$(call import-add-path,$(FLATBUFFERS_ROOT_DIR)/..)
54
55$(call import-module,flatbuffers/android/jni)
56$(call import-module,android/native_app_glue)
57