blob: c9724957adc0cfba99dc0da6cfd7a49d164cbad3 [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 :=
27my_src_files_arm := \
28 arm/arm_init.c \
29 arm/filter_neon.S
Chris Craikb50c2172013-07-29 15:28:30 -070030
31
32common_CFLAGS := -std=gnu89 #-fvisibility=hidden ## -fomit-frame-pointer
The Android Open Source Project893912b2009-03-03 19:30:05 -080033
Raphael Moll671f9cd2011-02-09 12:43:48 -080034ifeq ($(HOST_OS),windows)
Chris Craikb50c2172013-07-29 15:28:30 -070035 ifeq ($(USE_MINGW),)
36# Case where we're building windows but not under linux (so it must be cygwin)
37# In this case, gcc cygwin doesn't recognize -fvisibility=hidden
38 $(info libpng: Ignoring gcc flag $(common_CFLAGS) on Cygwin)
Ying Wang3446b932014-02-27 14:05:59 -080039 common_CFLAGS :=
Chris Craikb50c2172013-07-29 15:28:30 -070040 endif
Raphael Moll671f9cd2011-02-09 12:43:48 -080041endif
42
Ying Wang3446b932014-02-27 14:05:59 -080043common_C_INCLUDES +=
The Android Open Source Project893912b2009-03-03 19:30:05 -080044
45common_COPY_HEADERS_TO := libpng
46common_COPY_HEADERS := png.h pngconf.h pngusr.h
47
48# For the host
49# =====================================================
50
51include $(CLEAR_VARS)
52
53LOCAL_SRC_FILES := $(common_SRC_FILES)
54LOCAL_CFLAGS += $(common_CFLAGS)
55LOCAL_C_INCLUDES += $(common_C_INCLUDES) external/zlib
56
57LOCAL_MODULE:= libpng
58
59LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO)
60LOCAL_COPY_HEADERS := $(common_COPY_HEADERS)
61
62include $(BUILD_HOST_STATIC_LIBRARY)
63
64
Stephen Hinesb5e7fb42013-06-26 15:15:33 -070065# For the device (static)
66# =====================================================
67
68include $(CLEAR_VARS)
69LOCAL_CLANG := true
70LOCAL_SRC_FILES := $(common_SRC_FILES)
71LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv
Ying Wang3446b932014-02-27 14:05:59 -080072LOCAL_CFLAGS_arm := $(my_cflags_arm)
73LOCAL_SRC_FILES_arm := $(my_src_files_arm)
74
Stephen Hinesb5e7fb42013-06-26 15:15:33 -070075LOCAL_C_INCLUDES += $(common_C_INCLUDES) \
76 external/zlib
77LOCAL_SHARED_LIBRARIES := \
78 libz
79
80LOCAL_MODULE:= libpng
81
82include $(BUILD_STATIC_LIBRARY)
83
84# For the device (shared)
The Android Open Source Project893912b2009-03-03 19:30:05 -080085# =====================================================
86
87include $(CLEAR_VARS)
Stephen Hinesdeba48b2012-08-03 17:25:20 -070088LOCAL_CLANG := true
The Android Open Source Project893912b2009-03-03 19:30:05 -080089LOCAL_SRC_FILES := $(common_SRC_FILES)
Geremy Condra14cab862012-06-05 15:17:48 -070090LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv
Ying Wang3446b932014-02-27 14:05:59 -080091LOCAL_CFLAGS_arm := $(my_cflags_arm)
92LOCAL_SRC_FILES_arm := $(my_src_files_arm)
93
The Android Open Source Project893912b2009-03-03 19:30:05 -080094LOCAL_C_INCLUDES += $(common_C_INCLUDES) \
95 external/zlib
96LOCAL_SHARED_LIBRARIES := \
97 libz
98
99LOCAL_MODULE:= libpng
100
101LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO)
102LOCAL_COPY_HEADERS := $(common_COPY_HEADERS)
103
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700104include $(BUILD_SHARED_LIBRARY)
The Android Open Source Project893912b2009-03-03 19:30:05 -0800105
Geremy Condra14cab862012-06-05 15:17:48 -0700106# For testing
107# =====================================================
The Android Open Source Project893912b2009-03-03 19:30:05 -0800108
Geremy Condra14cab862012-06-05 15:17:48 -0700109include $(CLEAR_VARS)
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700110LOCAL_CLANG := true
Geremy Condra14cab862012-06-05 15:17:48 -0700111LOCAL_C_INCLUDES:= $(common_C_INCLUDES) external/zlib
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700112LOCAL_SRC_FILES:= pngtest.c
Geremy Condra14cab862012-06-05 15:17:48 -0700113LOCAL_MODULE := pngtest
Stephen Hinesb5e7fb42013-06-26 15:15:33 -0700114LOCAL_SHARED_LIBRARIES:= libpng libz
Geremy Condra14cab862012-06-05 15:17:48 -0700115LOCAL_MODULE_TAGS := debug
116include $(BUILD_EXECUTABLE)