1LOCAL_PATH := $(call my-dir)
2include $(CLEAR_VARS)
3
4waffle_top := $(LOCAL_PATH)
5
6#
7# !!! The version must be updated in tandem with the CMakeLists !!!
8#
9waffle_major_version := 1
10waffle_minor_version := 6
11waffle_patch_version := 90
12waffle_api_version := 0x0106
13
14waffle_android_major_version := $(word 1, $(subst ., , $(PLATFORM_VERSION)))
15waffle_android_minor_version := $(word 2, $(subst ., , $(PLATFORM_VERSION)))
16waffle_android_version := $(waffle_android_major_version).$(waffle_android_minor_version)
17
18$(waffle_top)/include/waffle/waffle_version.h: \
19    $(waffle_top)/Android.mk \
20    $(waffle_top)/include/waffle/waffle_version.h.in
21	@echo "target  Gen: libwaffle <= $(waffle_top)/include/waffle/waffle_version.h"
22	@sed -e 's/@waffle_major_version@/$(waffle_major_version)/' \
23	     -e 's/@waffle_minor_version@/$(waffle_minor_version)/' \
24	     -e 's/@waffle_patch_version@/$(waffle_patch_version)/' \
25	     $(waffle_top)/include/waffle/waffle_version.h.in \
26	     > $(waffle_top)/include/waffle/waffle_version.h
27
28LOCAL_MODULE_TAGS := eng
29LOCAL_MODULE := libwaffle-$(waffle_major_version)
30
31LOCAL_CFLAGS := \
32    -DANDROID_STUB \
33    -DWAFFLE_API_VERSION=$(waffle_api_version) \
34    -DWAFFLE_API_EXPERIMENTAL \
35    -DWAFFLE_HAS_ANDROID \
36    -DWAFFLE_ANDROID_MAJOR_VERSION=$(waffle_android_major_version) \
37    -DWAFFLE_ANDROID_MINOR_VERSION=$(waffle_android_minor_version) \
38    -Wno-pointer-arith
39
40ifeq ($(shell echo "$(waffle_android_version) >= 4.4" | bc),1)
41LOCAL_CONLYFLAGS := -std=c99
42else
43LOCAL_CFLAGS += -std=c99
44endif
45
46LOCAL_CFLAGS += -fvisibility=hidden
47
48LOCAL_C_INCLUDES := \
49    $(LOCAL_PATH)/include \
50    $(LOCAL_PATH)/include/waffle \
51    $(LOCAL_PATH)/src/ \
52    $(LOCAL_PATH)/src/waffle/api/ \
53    $(LOCAL_PATH)/src/waffle/core/ \
54    $(LOCAL_PATH)/src/waffle/egl/ \
55    $(LOCAL_PATH)/src/waffle/linux/ \
56    $(LOCAL_PATH)/src/waffle/droid/ \
57    $(LOCAL_PATH)/third_party/khronos/ \
58    $(LOCAL_PATH)/third_party/threads/
59
60LOCAL_SRC_FILES := \
61    src/waffle/core/wcore_tinfo.c \
62    src/waffle/core/wcore_config_attrs.c \
63    src/waffle/core/wcore_error.c \
64    src/waffle/core/wcore_util.c \
65    src/waffle/core/wcore_display.c \
66    src/waffle/core/wcore_attrib_list.c \
67    src/waffle/api/api_priv.c \
68    src/waffle/api/waffle_attrib_list.c \
69    src/waffle/api/waffle_config.c \
70    src/waffle/api/waffle_context.c \
71    src/waffle/api/waffle_display.c \
72    src/waffle/api/waffle_enum.c \
73    src/waffle/api/waffle_error.c \
74    src/waffle/api/waffle_gl_misc.c \
75    src/waffle/api/waffle_init.c \
76    src/waffle/api/waffle_window.c \
77    src/waffle/api/waffle_dl.c \
78    src/waffle/linux/linux_dl.c \
79    src/waffle/linux/linux_platform.c \
80    src/waffle/egl/wegl_config.c \
81    src/waffle/egl/wegl_context.c \
82    src/waffle/egl/wegl_display.c \
83    src/waffle/egl/wegl_platform.c \
84    src/waffle/egl/wegl_util.c \
85    src/waffle/egl/wegl_surface.c \
86    src/waffle/android/droid_platform.c \
87    src/waffle/android/droid_display.c \
88    src/waffle/android/droid_window.c \
89    src/waffle/android/droid_surfaceflingerlink.cpp \
90    third_party/threads/threads_posix.c
91
92LOCAL_SHARED_LIBRARIES := \
93    libdl \
94    libutils \
95    libgui
96
97LOCAL_GENERATED_SOURCES := \
98    $(LOCAL_PATH)/include/waffle/waffle_version.h
99
100LOCAL_COPY_HEADERS := \
101    include/waffle/waffle.h \
102    include/waffle/waffle_gbm.h \
103    include/waffle/waffle_glx.h \
104    include/waffle/waffle_version.h \
105    include/waffle/waffle_wayland.h \
106    include/waffle/waffle_x11_egl.h
107
108LOCAL_COPY_HEADERS_TO := waffle-$(waffle_major_version)
109
110include $(BUILD_SHARED_LIBRARY)
111
112SUBDIRS := \
113    examples \
114    src/utils
115
116mkfiles := $(patsubst %,$(waffle_top)/%/Android.mk,$(SUBDIRS))
117include $(mkfiles)
118