blob: 54c396b877772dcb3d663c2a8fd671b5b92f87dc [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
12LOCAL_SRC_FILES := \
13 jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
14 jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
15 jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
16 jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
17 jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c \
18 jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
19 jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jmemmgr.c \
20 jmemnobs.c jquant1.c jquant2.c jutils.c
21
22# ARM v7 NEON
23LOCAL_SRC_FILES_arm += simd/jsimd_arm_neon.S simd/jsimd_arm.c
24
25# If we are certain that the ARM v7 device has NEON (and there is no need for
26# a runtime check), we can indicate that with a flag.
27ifeq ($(strip $(TARGET_ARCH)),arm)
28 ifeq ($(ARCH_ARM_HAVE_NEON),true)
29 LOCAL_CFLAGS += -D__ARM_HAVE_NEON__
30 endif
31endif
32
33# ARM v8 64-bit NEON
Matt Sarett14b47d12015-11-06 17:05:31 -050034# TODO (msarett): Figure out why we can't compile NEON on Nexus 9.
Matt Sarettf37632a2015-11-06 16:30:42 -050035LOCAL_SRC_FILES_arm64 += jsimd_none.c
Matt Sarett58ef73c2015-11-03 10:03:58 -050036
37# TODO (msarett): x86 and x86_64 SIMD. Cross-compiling these assembly files
38# on Linux for Android is very tricky. This will require a
39# YASM or NASM as a dependency.
Matt Sarett14b47d12015-11-06 17:05:31 -050040LOCAL_SRC_FILES_x86 += jsimd_none.c
41LOCAL_SRC_FILES_x86_64 += jsimd_none.c
Matt Sarett58ef73c2015-11-03 10:03:58 -050042
43# TODO (msarett): MIPS SIMD. This is available in upstream libjpeg-turbo,
44# but has not been cherry picked into the version used by
45# Android.
Matt Sarett14b47d12015-11-06 17:05:31 -050046LOCAL_SRC_FILES_mips += jsimd_none.c
47LOCAL_SRC_FILES_mips64 += jsimd_none.c
Matt Sarett58ef73c2015-11-03 10:03:58 -050048
49LOCAL_CFLAGS += -O3 -fstrict-aliasing
50LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
51
52ifneq (,$(TARGET_BUILD_APPS))
53 # Unbundled branch, built against NDK.
54 LOCAL_SDK_VERSION := 17
55endif
56
57# Build as a static library.
58LOCAL_MODULE := libjpeg-turbo_static
59include $(BUILD_STATIC_LIBRARY)
60
61# Also build as a shared library.
62include $(CLEAR_VARS)
63
64ifneq (,$(TARGET_BUILD_APPS))
65 # Unbundled branch, built against NDK.
66 LOCAL_SDK_VERSION := 17
67endif
68
Matt Sarett657657c2015-11-04 11:20:47 -050069LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
Matt Sarett58ef73c2015-11-03 10:03:58 -050070LOCAL_WHOLE_STATIC_LIBRARIES = libjpeg-turbo_static
71LOCAL_MODULE := libjpeg-turbo
72include $(BUILD_SHARED_LIBRARY)