blob: 9444620172cfda128b6af863fcd8a411db2f4bcf [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
sireesh282702a2014-06-18 14:16:48 +053023ifeq ($(ARCH_ARM_HAVE_NEON),true)
Riley Andrewsb4397412014-08-19 17:21:02 -070024my_cflags_arm := -DPNG_ARM_NEON_OPT=2
sireesh282702a2014-06-18 14:16:48 +053025endif
Stephen Hinesbdcf23a2014-04-17 16:25:53 -070026
Riley Andrewsb4397412014-08-19 17:21:02 -070027my_cflags_arm64 := -DPNG_ARM_NEON_OPT=2
sireesh43608cf2014-06-26 13:09:53 +053028
Stephen Hinesbdcf23a2014-04-17 16:25:53 -070029# 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
Ying Wang3446b932014-02-27 14:05:59 -080033my_src_files_arm := \
Sireesh Tripurarib478e662014-05-09 15:15:10 +053034 arm/arm_init.c \
35 arm/filter_neon.S \
36 arm/filter_neon_intrinsics.c
Chris Craikb50c2172013-07-29 15:28:30 -070037
38
39common_CFLAGS := -std=gnu89 #-fvisibility=hidden ## -fomit-frame-pointer
The Android Open Source Project893912b2009-03-03 19:30:05 -080040
Raphael Moll671f9cd2011-02-09 12:43:48 -080041ifeq ($(HOST_OS),windows)
Chris Craikb50c2172013-07-29 15:28:30 -070042 ifeq ($(USE_MINGW),)
43# Case where we're building windows but not under linux (so it must be cygwin)
44# In this case, gcc cygwin doesn't recognize -fvisibility=hidden
45 $(info libpng: Ignoring gcc flag $(common_CFLAGS) on Cygwin)
Ying Wang3446b932014-02-27 14:05:59 -080046 common_CFLAGS :=
Chris Craikb50c2172013-07-29 15:28:30 -070047 endif
Raphael Moll671f9cd2011-02-09 12:43:48 -080048endif
49
Ying Wang3446b932014-02-27 14:05:59 -080050common_C_INCLUDES +=
The Android Open Source Project893912b2009-03-03 19:30:05 -080051
52common_COPY_HEADERS_TO := libpng
53common_COPY_HEADERS := png.h pngconf.h pngusr.h
54
55# For the host
56# =====================================================
57
58include $(CLEAR_VARS)
Dan Albert1afb0702014-10-21 11:10:48 -070059LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
The Android Open Source Project893912b2009-03-03 19:30:05 -080060
61LOCAL_SRC_FILES := $(common_SRC_FILES)
62LOCAL_CFLAGS += $(common_CFLAGS)
Tim Murray43d98c92014-04-23 15:34:05 -070063LOCAL_ASFLAGS += $(common_ASFLAGS)
The Android Open Source Project893912b2009-03-03 19:30:05 -080064LOCAL_C_INCLUDES += $(common_C_INCLUDES) external/zlib
65
66LOCAL_MODULE:= libpng
67
68LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO)
69LOCAL_COPY_HEADERS := $(common_COPY_HEADERS)
70
71include $(BUILD_HOST_STATIC_LIBRARY)
72
73
Stephen Hinesb5e7fb42013-06-26 15:15:33 -070074# For the device (static)
75# =====================================================
76
77include $(CLEAR_VARS)
Dan Albert1afb0702014-10-21 11:10:48 -070078LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Stephen Hinesb5e7fb42013-06-26 15:15:33 -070079LOCAL_CLANG := true
80LOCAL_SRC_FILES := $(common_SRC_FILES)
81LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv
Ying Wang3446b932014-02-27 14:05:59 -080082LOCAL_CFLAGS_arm := $(my_cflags_arm)
Tim Murray43d98c92014-04-23 15:34:05 -070083LOCAL_ASFLAGS += $(common_ASFLAGS)
Ying Wang3446b932014-02-27 14:05:59 -080084LOCAL_SRC_FILES_arm := $(my_src_files_arm)
sireesh43608cf2014-06-26 13:09:53 +053085LOCAL_CFLAGS_arm64 := $(my_cflags_arm64)
86LOCAL_SRC_FILES_arm64 := $(my_src_files_arm)
Dan Albert1afb0702014-10-21 11:10:48 -070087LOCAL_ADDRESS_SANITIZER := false
Ying Wang3446b932014-02-27 14:05:59 -080088
Stephen Hinesb5e7fb42013-06-26 15:15:33 -070089LOCAL_C_INCLUDES += $(common_C_INCLUDES) \
90 external/zlib
91LOCAL_SHARED_LIBRARIES := \
92 libz
93
94LOCAL_MODULE:= libpng
95
96include $(BUILD_STATIC_LIBRARY)
97
98# For the device (shared)
The Android Open Source Project893912b2009-03-03 19:30:05 -080099# =====================================================
100
101include $(CLEAR_VARS)
Dan Albert1afb0702014-10-21 11:10:48 -0700102LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Stephen Hinesdeba48b2012-08-03 17:25:20 -0700103LOCAL_CLANG := true
The Android Open Source Project893912b2009-03-03 19:30:05 -0800104LOCAL_SRC_FILES := $(common_SRC_FILES)
Geremy Condra14cab862012-06-05 15:17:48 -0700105LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv
Ying Wang3446b932014-02-27 14:05:59 -0800106LOCAL_CFLAGS_arm := $(my_cflags_arm)
Tim Murray43d98c92014-04-23 15:34:05 -0700107LOCAL_ASFLAGS += $(common_ASFLAGS)
Ying Wang3446b932014-02-27 14:05:59 -0800108LOCAL_SRC_FILES_arm := $(my_src_files_arm)
sireesh43608cf2014-06-26 13:09:53 +0530109LOCAL_CFLAGS_arm64 := $(my_cflags_arm64)
110LOCAL_SRC_FILES_arm64 := $(my_src_files_arm)
Ying Wang3446b932014-02-27 14:05:59 -0800111
The Android Open Source Project893912b2009-03-03 19:30:05 -0800112LOCAL_C_INCLUDES += $(common_C_INCLUDES) \
113 external/zlib
114LOCAL_SHARED_LIBRARIES := \
115 libz
116
117LOCAL_MODULE:= libpng
118
119LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO)
120LOCAL_COPY_HEADERS := $(common_COPY_HEADERS)
121
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700122include $(BUILD_SHARED_LIBRARY)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800123
Geremy Condra14cab862012-06-05 15:17:48 -0700124# For testing
125# =====================================================
The Android Open Source Project893912b2009-03-03 19:30:05 -0800126
Geremy Condra14cab862012-06-05 15:17:48 -0700127include $(CLEAR_VARS)
Dan Albert1afb0702014-10-21 11:10:48 -0700128LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700129LOCAL_CLANG := true
Geremy Condra14cab862012-06-05 15:17:48 -0700130LOCAL_C_INCLUDES:= $(common_C_INCLUDES) external/zlib
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700131LOCAL_SRC_FILES:= pngtest.c
Geremy Condra14cab862012-06-05 15:17:48 -0700132LOCAL_MODULE := pngtest
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700133LOCAL_SHARED_LIBRARIES:= libpng libz
Geremy Condra14cab862012-06-05 15:17:48 -0700134LOCAL_MODULE_TAGS := debug
135include $(BUILD_EXECUTABLE)