1LOCAL_PATH:= $(call my-dir)
2
3# We need to build this for both the device (as a shared library)
4# and the host (as a static library for tools to use).
5
6common_SRC_FILES := \
7	png.c \
8	pngerror.c \
9	pngget.c \
10	pngmem.c \
11	pngpread.c \
12	pngread.c \
13	pngrio.c \
14	pngrtran.c \
15	pngrutil.c \
16	pngset.c \
17	pngtrans.c \
18	pngwio.c \
19	pngwrite.c \
20	pngwtran.c \
21	pngwutil.c \
22
23ifeq ($(ARCH_ARM_HAVE_NEON),true)
24my_cflags_arm := -DPNG_ARM_NEON_OPT=2
25endif
26
27my_cflags_arm64 := -DPNG_ARM_NEON_OPT=2
28
29# BUG: http://llvm.org/PR19472 - SLP vectorization (on ARM at least) crashes
30# when we can't lower a vectorized bswap.
31my_cflags_arm += -fno-slp-vectorize
32
33my_src_files_arm := \
34			arm/arm_init.c \
35			arm/filter_neon.S \
36			arm/filter_neon_intrinsics.c
37
38
39common_CFLAGS := -std=gnu89 #-fvisibility=hidden ## -fomit-frame-pointer
40
41# For the host
42# =====================================================
43
44include $(CLEAR_VARS)
45LOCAL_SRC_FILES := $(common_SRC_FILES)
46LOCAL_CFLAGS += $(common_CFLAGS)
47LOCAL_ASFLAGS += $(common_ASFLAGS)
48LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
49LOCAL_STATIC_LIBRARIES := libz
50LOCAL_MODULE:= libpng
51include $(BUILD_HOST_STATIC_LIBRARY)
52
53
54# For the device (static)
55# =====================================================
56
57include $(CLEAR_VARS)
58LOCAL_CLANG := true
59LOCAL_SRC_FILES := $(common_SRC_FILES)
60LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv
61LOCAL_CFLAGS_arm := $(my_cflags_arm)
62LOCAL_ASFLAGS += $(common_ASFLAGS)
63LOCAL_SRC_FILES_arm := $(my_src_files_arm)
64LOCAL_CFLAGS_arm64 := $(my_cflags_arm64)
65LOCAL_SRC_FILES_arm64 := $(my_src_files_arm)
66LOCAL_ADDRESS_SANITIZER := false
67LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
68LOCAL_SHARED_LIBRARIES := libz
69LOCAL_MODULE:= libpng
70include $(BUILD_STATIC_LIBRARY)
71
72# For the device (shared)
73# =====================================================
74
75include $(CLEAR_VARS)
76LOCAL_CLANG := true
77LOCAL_SRC_FILES := $(common_SRC_FILES)
78LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv
79LOCAL_CFLAGS_arm := $(my_cflags_arm)
80LOCAL_ASFLAGS += $(common_ASFLAGS)
81LOCAL_SRC_FILES_arm := $(my_src_files_arm)
82LOCAL_CFLAGS_arm64 := $(my_cflags_arm64)
83LOCAL_SRC_FILES_arm64 := $(my_src_files_arm)
84LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
85LOCAL_SHARED_LIBRARIES := libz
86LOCAL_MODULE:= libpng
87include $(BUILD_SHARED_LIBRARY)
88
89# For testing
90# =====================================================
91
92include $(CLEAR_VARS)
93LOCAL_CLANG := true
94LOCAL_SRC_FILES:= pngtest.c
95LOCAL_MODULE := pngtest
96LOCAL_SHARED_LIBRARIES:= libpng libz
97LOCAL_MODULE_TAGS := debug
98include $(BUILD_EXECUTABLE)
99