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 | |
| 12 | LOCAL_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 |
| 23 | LOCAL_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. |
| 27 | ifeq ($(strip $(TARGET_ARCH)),arm) |
| 28 | ifeq ($(ARCH_ARM_HAVE_NEON),true) |
| 29 | LOCAL_CFLAGS += -D__ARM_HAVE_NEON__ |
| 30 | endif |
| 31 | endif |
| 32 | |
| 33 | # ARM v8 64-bit NEON |
| 34 | LOCAL_SRC_FILES_arm64 += simd/jsimd_arm64_neon.S simd/jsimd_arm64.c |
| 35 | |
| 36 | # TODO (msarett): x86 and x86_64 SIMD. Cross-compiling these assembly files |
| 37 | # on Linux for Android is very tricky. This will require a |
| 38 | # YASM or NASM as a dependency. |
| 39 | |
| 40 | # TODO (msarett): MIPS SIMD. This is available in upstream libjpeg-turbo, |
| 41 | # but has not been cherry picked into the version used by |
| 42 | # Android. |
| 43 | |
| 44 | LOCAL_CFLAGS += -O3 -fstrict-aliasing |
| 45 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) |
| 46 | |
| 47 | ifneq (,$(TARGET_BUILD_APPS)) |
| 48 | # Unbundled branch, built against NDK. |
| 49 | LOCAL_SDK_VERSION := 17 |
| 50 | endif |
| 51 | |
| 52 | # Build as a static library. |
| 53 | LOCAL_MODULE := libjpeg-turbo_static |
| 54 | include $(BUILD_STATIC_LIBRARY) |
| 55 | |
| 56 | # Also build as a shared library. |
| 57 | include $(CLEAR_VARS) |
| 58 | |
| 59 | ifneq (,$(TARGET_BUILD_APPS)) |
| 60 | # Unbundled branch, built against NDK. |
| 61 | LOCAL_SDK_VERSION := 17 |
| 62 | endif |
| 63 | |
| 64 | LOCAL_WHOLE_STATIC_LIBRARIES = libjpeg-turbo_static |
| 65 | LOCAL_MODULE := libjpeg-turbo |
| 66 | include $(BUILD_SHARED_LIBRARY) |