blob: 96fcb7020cfa0c21abddf0292dce88e2688ffd29 [file] [log] [blame]
Matt Sarett58ef73c2015-11-03 10:03:58 -05001LOCAL_PATH:= $(call my-dir)
2include $(CLEAR_VARS)
3
4# By default, the build system generates ARM target binaries in thumb mode,
5# where each instruction is 16 bits wide. Defining this variable as arm
6# forces the build system to generate object files in 32-bit arm mode. This
7# is the same setting previously used by libjpeg.
8# TODO (msarett): Run performance tests to determine whether arm mode is still
9# preferred to thumb mode for libjpeg-turbo.
10LOCAL_ARM_MODE := arm
11
Matt Sarett8488d012015-11-11 11:34:42 -050012# BUG:25564571
13# Clang fails to compile the ARM v8 NEON asembly, and libjpeg-turbo may perform
14# better when compiled with gcc.
15LOCAL_CLANG := false
16
Matt Sarett58ef73c2015-11-03 10:03:58 -050017LOCAL_SRC_FILES := \
18 jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
19 jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
20 jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
21 jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
22 jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
23 jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
24 jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jmemmgr.c \
25 jmemnobs.c jquant1.c jquant2.c jutils.c
26
27# ARM v7 NEON
28LOCAL_SRC_FILES_arm += simd/jsimd_arm_neon.S simd/jsimd_arm.c
29
30# If we are certain that the ARM v7 device has NEON (and there is no need for
31# a runtime check), we can indicate that with a flag.
32ifeq ($(strip $(TARGET_ARCH)),arm)
33 ifeq ($(ARCH_ARM_HAVE_NEON),true)
34 LOCAL_CFLAGS += -D__ARM_HAVE_NEON__
35 endif
36endif
37
38# ARM v8 64-bit NEON
Matt Sarett8488d012015-11-11 11:34:42 -050039LOCAL_SRC_FILES_arm64 += simd/jsimd_arm64_neon.S simd/jsimd_arm64.c
Matt Sarett58ef73c2015-11-03 10:03:58 -050040
41# TODO (msarett): x86 and x86_64 SIMD. Cross-compiling these assembly files
42# on Linux for Android is very tricky. This will require a
43# YASM or NASM as a dependency.
Matt Sarett14b47d12015-11-06 17:05:31 -050044LOCAL_SRC_FILES_x86 += jsimd_none.c
45LOCAL_SRC_FILES_x86_64 += jsimd_none.c
Matt Sarett58ef73c2015-11-03 10:03:58 -050046
47# TODO (msarett): MIPS SIMD. This is available in upstream libjpeg-turbo,
48# but has not been cherry picked into the version used by
49# Android.
Matt Sarett14b47d12015-11-06 17:05:31 -050050LOCAL_SRC_FILES_mips += jsimd_none.c
51LOCAL_SRC_FILES_mips64 += jsimd_none.c
Matt Sarett58ef73c2015-11-03 10:03:58 -050052
53LOCAL_CFLAGS += -O3 -fstrict-aliasing
54LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
55
56ifneq (,$(TARGET_BUILD_APPS))
57 # Unbundled branch, built against NDK.
58 LOCAL_SDK_VERSION := 17
59endif
60
61# Build as a static library.
Matt Sarettf9fa7cc2015-11-23 15:23:25 -050062LOCAL_MODULE := libjpeg_static
Matt Sarett58ef73c2015-11-03 10:03:58 -050063include $(BUILD_STATIC_LIBRARY)
64
65# Also build as a shared library.
66include $(CLEAR_VARS)
67
68ifneq (,$(TARGET_BUILD_APPS))
69 # Unbundled branch, built against NDK.
70 LOCAL_SDK_VERSION := 17
71endif
72
Matt Sarett657657c2015-11-04 11:20:47 -050073LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
Matt Sarettf9fa7cc2015-11-23 15:23:25 -050074LOCAL_WHOLE_STATIC_LIBRARIES = libjpeg_static
75LOCAL_MODULE := libjpeg
Matt Sarett58ef73c2015-11-03 10:03:58 -050076include $(BUILD_SHARED_LIBRARY)