blob: 41f89c9a698869885ad20c79ed4cbba164edab48 [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)
24my_cflags_arm := -DPNG_ARM_NEON_OPT=2 -DPNG_ARM_NEON_CHECK_SUPPORTED
25endif
Stephen Hinesbdcf23a2014-04-17 16:25:53 -070026
27# BUG: http://llvm.org/PR19472 - SLP vectorization (on ARM at least) crashes
28# when we can't lower a vectorized bswap.
29my_cflags_arm += -fno-slp-vectorize
30
Ying Wang3446b932014-02-27 14:05:59 -080031my_src_files_arm := \
Sireesh Tripurarib478e662014-05-09 15:15:10 +053032 arm/arm_init.c \
33 arm/filter_neon.S \
34 arm/filter_neon_intrinsics.c
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
Tim Murray43d98c92014-04-23 15:34:05 -070048ifeq ($(HOST_OS),darwin)
49common_CFLAGS += -no-integrated-as
50common_ASFLAGS += -no-integrated-as
51endif
52
Ying Wang3446b932014-02-27 14:05:59 -080053common_C_INCLUDES +=
The Android Open Source Project893912b2009-03-03 19:30:05 -080054
55common_COPY_HEADERS_TO := libpng
56common_COPY_HEADERS := png.h pngconf.h pngusr.h
57
58# For the host
59# =====================================================
60
61include $(CLEAR_VARS)
62
63LOCAL_SRC_FILES := $(common_SRC_FILES)
64LOCAL_CFLAGS += $(common_CFLAGS)
Tim Murray43d98c92014-04-23 15:34:05 -070065LOCAL_ASFLAGS += $(common_ASFLAGS)
The Android Open Source Project893912b2009-03-03 19:30:05 -080066LOCAL_C_INCLUDES += $(common_C_INCLUDES) external/zlib
67
68LOCAL_MODULE:= libpng
69
70LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO)
71LOCAL_COPY_HEADERS := $(common_COPY_HEADERS)
72
73include $(BUILD_HOST_STATIC_LIBRARY)
74
75
Stephen Hinesb5e7fb42013-06-26 15:15:33 -070076# For the device (static)
77# =====================================================
78
79include $(CLEAR_VARS)
80LOCAL_CLANG := true
81LOCAL_SRC_FILES := $(common_SRC_FILES)
82LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv
Ying Wang3446b932014-02-27 14:05:59 -080083LOCAL_CFLAGS_arm := $(my_cflags_arm)
Tim Murray43d98c92014-04-23 15:34:05 -070084LOCAL_ASFLAGS += $(common_ASFLAGS)
Ying Wang3446b932014-02-27 14:05:59 -080085LOCAL_SRC_FILES_arm := $(my_src_files_arm)
86
Stephen Hinesb5e7fb42013-06-26 15:15:33 -070087LOCAL_C_INCLUDES += $(common_C_INCLUDES) \
88 external/zlib
89LOCAL_SHARED_LIBRARIES := \
90 libz
91
92LOCAL_MODULE:= libpng
93
94include $(BUILD_STATIC_LIBRARY)
95
96# For the device (shared)
The Android Open Source Project893912b2009-03-03 19:30:05 -080097# =====================================================
98
99include $(CLEAR_VARS)
Stephen Hinesdeba48b2012-08-03 17:25:20 -0700100LOCAL_CLANG := true
The Android Open Source Project893912b2009-03-03 19:30:05 -0800101LOCAL_SRC_FILES := $(common_SRC_FILES)
Geremy Condra14cab862012-06-05 15:17:48 -0700102LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv
Ying Wang3446b932014-02-27 14:05:59 -0800103LOCAL_CFLAGS_arm := $(my_cflags_arm)
Tim Murray43d98c92014-04-23 15:34:05 -0700104LOCAL_ASFLAGS += $(common_ASFLAGS)
Ying Wang3446b932014-02-27 14:05:59 -0800105LOCAL_SRC_FILES_arm := $(my_src_files_arm)
106
The Android Open Source Project893912b2009-03-03 19:30:05 -0800107LOCAL_C_INCLUDES += $(common_C_INCLUDES) \
108 external/zlib
109LOCAL_SHARED_LIBRARIES := \
110 libz
111
112LOCAL_MODULE:= libpng
113
114LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO)
115LOCAL_COPY_HEADERS := $(common_COPY_HEADERS)
116
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700117include $(BUILD_SHARED_LIBRARY)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800118
Geremy Condra14cab862012-06-05 15:17:48 -0700119# For testing
120# =====================================================
The Android Open Source Project893912b2009-03-03 19:30:05 -0800121
Geremy Condra14cab862012-06-05 15:17:48 -0700122include $(CLEAR_VARS)
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700123LOCAL_CLANG := true
Geremy Condra14cab862012-06-05 15:17:48 -0700124LOCAL_C_INCLUDES:= $(common_C_INCLUDES) external/zlib
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700125LOCAL_SRC_FILES:= pngtest.c
Geremy Condra14cab862012-06-05 15:17:48 -0700126LOCAL_MODULE := pngtest
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700127LOCAL_SHARED_LIBRARIES:= libpng libz
Geremy Condra14cab862012-06-05 15:17:48 -0700128LOCAL_MODULE_TAGS := debug
129include $(BUILD_EXECUTABLE)