blob: 367ee4dae4bc770f1a7f81689f909c92594efb66 [file] [log] [blame]
The Android Open Source Project893912b2009-03-03 19:30:05 -08001LOCAL_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 \
The Android Open Source Project893912b2009-03-03 19:30:05 -08009 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 \
The Android Open Source Project893912b2009-03-03 19:30:05 -080018 pngwio.c \
19 pngwrite.c \
20 pngwtran.c \
Chris Craikb50c2172013-07-29 15:28:30 -070021 pngwutil.c \
The Android Open Source Project893912b2009-03-03 19:30:05 -080022
Ying Wang3446b932014-02-27 14:05:59 -080023# Previously these arm-specific flags were never applied.
24# TODO: apply the flags and fix the build.
25# my_cflags_arm := -DPNG_ARM_NEON_OPT=2 -DPNG_ARM_NEON_CHECK_SUPPORTED
26my_cflags_arm :=
Stephen Hinesbdcf23a2014-04-17 16:25:53 -070027
28# BUG: http://llvm.org/PR19472 - SLP vectorization (on ARM at least) crashes
29# when we can't lower a vectorized bswap.
30my_cflags_arm += -fno-slp-vectorize
31
Ying Wang3446b932014-02-27 14:05:59 -080032my_src_files_arm := \
33 arm/arm_init.c \
34 arm/filter_neon.S
Chris Craikb50c2172013-07-29 15:28:30 -070035
36
37common_CFLAGS := -std=gnu89 #-fvisibility=hidden ## -fomit-frame-pointer
The Android Open Source Project893912b2009-03-03 19:30:05 -080038
Raphael Moll671f9cd2011-02-09 12:43:48 -080039ifeq ($(HOST_OS),windows)
Chris Craikb50c2172013-07-29 15:28:30 -070040 ifeq ($(USE_MINGW),)
41# Case where we're building windows but not under linux (so it must be cygwin)
42# In this case, gcc cygwin doesn't recognize -fvisibility=hidden
43 $(info libpng: Ignoring gcc flag $(common_CFLAGS) on Cygwin)
Ying Wang3446b932014-02-27 14:05:59 -080044 common_CFLAGS :=
Chris Craikb50c2172013-07-29 15:28:30 -070045 endif
Raphael Moll671f9cd2011-02-09 12:43:48 -080046endif
47
Ying Wang3446b932014-02-27 14:05:59 -080048common_C_INCLUDES +=
The Android Open Source Project893912b2009-03-03 19:30:05 -080049
50common_COPY_HEADERS_TO := libpng
51common_COPY_HEADERS := png.h pngconf.h pngusr.h
52
53# For the host
54# =====================================================
55
56include $(CLEAR_VARS)
57
58LOCAL_SRC_FILES := $(common_SRC_FILES)
59LOCAL_CFLAGS += $(common_CFLAGS)
60LOCAL_C_INCLUDES += $(common_C_INCLUDES) external/zlib
61
62LOCAL_MODULE:= libpng
63
64LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO)
65LOCAL_COPY_HEADERS := $(common_COPY_HEADERS)
66
67include $(BUILD_HOST_STATIC_LIBRARY)
68
69
Stephen Hinesb5e7fb42013-06-26 15:15:33 -070070# For the device (static)
71# =====================================================
72
73include $(CLEAR_VARS)
74LOCAL_CLANG := true
75LOCAL_SRC_FILES := $(common_SRC_FILES)
76LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv
Ying Wang3446b932014-02-27 14:05:59 -080077LOCAL_CFLAGS_arm := $(my_cflags_arm)
78LOCAL_SRC_FILES_arm := $(my_src_files_arm)
79
Stephen Hinesb5e7fb42013-06-26 15:15:33 -070080LOCAL_C_INCLUDES += $(common_C_INCLUDES) \
81 external/zlib
82LOCAL_SHARED_LIBRARIES := \
83 libz
84
85LOCAL_MODULE:= libpng
86
87include $(BUILD_STATIC_LIBRARY)
88
89# For the device (shared)
The Android Open Source Project893912b2009-03-03 19:30:05 -080090# =====================================================
91
92include $(CLEAR_VARS)
Stephen Hinesdeba48b2012-08-03 17:25:20 -070093LOCAL_CLANG := true
The Android Open Source Project893912b2009-03-03 19:30:05 -080094LOCAL_SRC_FILES := $(common_SRC_FILES)
Geremy Condra14cab862012-06-05 15:17:48 -070095LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv
Ying Wang3446b932014-02-27 14:05:59 -080096LOCAL_CFLAGS_arm := $(my_cflags_arm)
97LOCAL_SRC_FILES_arm := $(my_src_files_arm)
98
The Android Open Source Project893912b2009-03-03 19:30:05 -080099LOCAL_C_INCLUDES += $(common_C_INCLUDES) \
100 external/zlib
101LOCAL_SHARED_LIBRARIES := \
102 libz
103
104LOCAL_MODULE:= libpng
105
106LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO)
107LOCAL_COPY_HEADERS := $(common_COPY_HEADERS)
108
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700109include $(BUILD_SHARED_LIBRARY)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800110
Geremy Condra14cab862012-06-05 15:17:48 -0700111# For testing
112# =====================================================
The Android Open Source Project893912b2009-03-03 19:30:05 -0800113
Geremy Condra14cab862012-06-05 15:17:48 -0700114include $(CLEAR_VARS)
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700115LOCAL_CLANG := true
Geremy Condra14cab862012-06-05 15:17:48 -0700116LOCAL_C_INCLUDES:= $(common_C_INCLUDES) external/zlib
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700117LOCAL_SRC_FILES:= pngtest.c
Geremy Condra14cab862012-06-05 15:17:48 -0700118LOCAL_MODULE := pngtest
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700119LOCAL_SHARED_LIBRARIES:= libpng libz
Geremy Condra14cab862012-06-05 15:17:48 -0700120LOCAL_MODULE_TAGS := debug
121include $(BUILD_EXECUTABLE)