Matt Sarett | 58ef73c | 2015-11-03 10:03:58 -0500 | [diff] [blame] | 1 | LOCAL_PATH:= $(call my-dir) |
| 2 | include $(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. |
| 10 | LOCAL_ARM_MODE := arm |
| 11 | |
Matt Sarett | 8488d01 | 2015-11-11 11:34:42 -0500 | [diff] [blame] | 12 | # BUG:25564571 |
| 13 | # Clang fails to compile the ARM v8 NEON asembly, and libjpeg-turbo may perform |
| 14 | # better when compiled with gcc. |
| 15 | LOCAL_CLANG := false |
| 16 | |
Matt Sarett | 58ef73c | 2015-11-03 10:03:58 -0500 | [diff] [blame] | 17 | LOCAL_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 |
| 28 | LOCAL_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. |
| 32 | ifeq ($(strip $(TARGET_ARCH)),arm) |
| 33 | ifeq ($(ARCH_ARM_HAVE_NEON),true) |
| 34 | LOCAL_CFLAGS += -D__ARM_HAVE_NEON__ |
| 35 | endif |
| 36 | endif |
| 37 | |
| 38 | # ARM v8 64-bit NEON |
Matt Sarett | 8488d01 | 2015-11-11 11:34:42 -0500 | [diff] [blame] | 39 | LOCAL_SRC_FILES_arm64 += simd/jsimd_arm64_neon.S simd/jsimd_arm64.c |
Matt Sarett | 58ef73c | 2015-11-03 10:03:58 -0500 | [diff] [blame] | 40 | |
| 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 Sarett | 14b47d1 | 2015-11-06 17:05:31 -0500 | [diff] [blame] | 44 | LOCAL_SRC_FILES_x86 += jsimd_none.c |
| 45 | LOCAL_SRC_FILES_x86_64 += jsimd_none.c |
Matt Sarett | 58ef73c | 2015-11-03 10:03:58 -0500 | [diff] [blame] | 46 | |
| 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 Sarett | 14b47d1 | 2015-11-06 17:05:31 -0500 | [diff] [blame] | 50 | LOCAL_SRC_FILES_mips += jsimd_none.c |
| 51 | LOCAL_SRC_FILES_mips64 += jsimd_none.c |
Matt Sarett | 58ef73c | 2015-11-03 10:03:58 -0500 | [diff] [blame] | 52 | |
| 53 | LOCAL_CFLAGS += -O3 -fstrict-aliasing |
| 54 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
| 55 | |
| 56 | ifneq (,$(TARGET_BUILD_APPS)) |
| 57 | # Unbundled branch, built against NDK. |
| 58 | LOCAL_SDK_VERSION := 17 |
| 59 | endif |
| 60 | |
| 61 | # Build as a static library. |
Matt Sarett | f9fa7cc | 2015-11-23 15:23:25 -0500 | [diff] [blame^] | 62 | LOCAL_MODULE := libjpeg_static |
Matt Sarett | 58ef73c | 2015-11-03 10:03:58 -0500 | [diff] [blame] | 63 | include $(BUILD_STATIC_LIBRARY) |
| 64 | |
| 65 | # Also build as a shared library. |
| 66 | include $(CLEAR_VARS) |
| 67 | |
| 68 | ifneq (,$(TARGET_BUILD_APPS)) |
| 69 | # Unbundled branch, built against NDK. |
| 70 | LOCAL_SDK_VERSION := 17 |
| 71 | endif |
| 72 | |
Matt Sarett | 657657c | 2015-11-04 11:20:47 -0500 | [diff] [blame] | 73 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
Matt Sarett | f9fa7cc | 2015-11-23 15:23:25 -0500 | [diff] [blame^] | 74 | LOCAL_WHOLE_STATIC_LIBRARIES = libjpeg_static |
| 75 | LOCAL_MODULE := libjpeg |
Matt Sarett | 58ef73c | 2015-11-03 10:03:58 -0500 | [diff] [blame] | 76 | include $(BUILD_SHARED_LIBRARY) |