1 LOCAL_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 6 common_SRC_FILES := \ 7 png.c \ 8 pngerror.c \ 9 pnggccrd.c \ 10 pngget.c \ 11 pngmem.c \ 12 pngpread.c \ 13 pngread.c \ 14 pngrio.c \ 15 pngrtran.c \ 16 pngrutil.c \ 17 pngset.c \ 18 pngtrans.c \ 19 pngvcrd.c \ 20 pngwio.c \ 21 pngwrite.c \ 22 pngwtran.c \ 23 pngwutil.c 24 25 common_CFLAGS := -std=gnu89 -fvisibility=hidden ## -fomit-frame-pointer 26 27 ifeq ($(HOST_OS),windows) 28 ifeq ($(USE_MINGW),) 29 # Case where we're building windows but not under linux (so it must be cygwin) 30 # In this case, gcc cygwin doesn't recognize -fvisibility=hidden 31 $(info libpng: Ignoring gcc flag $(common_CFLAGS) on Cygwin) 32 common_CFLAGS := 33 endif 34 endif 35 36 common_C_INCLUDES += 37 38 common_COPY_HEADERS_TO := libpng 39 common_COPY_HEADERS := png.h pngconf.h pngusr.h 40 41 # For the host 42 # ===================================================== 43 44 include $(CLEAR_VARS) 45 46 LOCAL_SRC_FILES := $(common_SRC_FILES) 47 LOCAL_CFLAGS += $(common_CFLAGS) 48 LOCAL_C_INCLUDES += $(common_C_INCLUDES) external/zlib 49 50 LOCAL_MODULE:= libpng 51 52 LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO) 53 LOCAL_COPY_HEADERS := $(common_COPY_HEADERS) 54 55 include $(BUILD_HOST_STATIC_LIBRARY) 56 57 58 # For the device (static) 59 # ===================================================== 60 61 include $(CLEAR_VARS) 62 LOCAL_CLANG := true 63 LOCAL_SRC_FILES := $(common_SRC_FILES) 64 LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv 65 LOCAL_C_INCLUDES += $(common_C_INCLUDES) \ 66 external/zlib 67 LOCAL_SHARED_LIBRARIES := \ 68 libz 69 70 LOCAL_MODULE:= libpng 71 72 include $(BUILD_STATIC_LIBRARY) 73 74 # For the device (shared) 75 # ===================================================== 76 77 include $(CLEAR_VARS) 78 LOCAL_CLANG := true 79 LOCAL_SRC_FILES := $(common_SRC_FILES) 80 LOCAL_CFLAGS += $(common_CFLAGS) -ftrapv 81 LOCAL_C_INCLUDES += $(common_C_INCLUDES) \ 82 external/zlib 83 LOCAL_SHARED_LIBRARIES := \ 84 libz 85 86 LOCAL_MODULE:= libpng 87 88 LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO) 89 LOCAL_COPY_HEADERS := $(common_COPY_HEADERS) 90 91 include $(BUILD_SHARED_LIBRARY) 92 93 # For testing 94 # ===================================================== 95 96 include $(CLEAR_VARS) 97 LOCAL_CLANG := true 98 LOCAL_C_INCLUDES:= $(common_C_INCLUDES) external/zlib 99 LOCAL_SRC_FILES:= pngtest.c 100 LOCAL_MODULE := pngtest 101 LOCAL_SHARED_LIBRARIES:= libpng libz 102 LOCAL_MODULE_TAGS := debug 103 include $(BUILD_EXECUTABLE) 104