1LOCAL_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
34LOCAL_SRC_FILES_arm64 += simd/jsimd_arm64_neon.S simd/jsimd_arm64.c
35
36# x86 MMX and SSE2
37LOCAL_SRC_FILES_x86 += \
38      simd/jsimd_i386.c simd/jccolor-mmx.asm simd/jccolor-sse2.asm \
39      simd/jcgray-mmx.asm  simd/jcgray-sse2.asm simd/jcsample-mmx.asm \
40      simd/jcsample-sse2.asm simd/jdcolor-mmx.asm simd/jdcolor-sse2.asm \
41      simd/jdmerge-mmx.asm simd/jdmerge-sse2.asm simd/jdsample-mmx.asm \
42      simd/jdsample-sse2.asm simd/jfdctflt-3dn.asm simd/jfdctflt-sse.asm \
43      simd/jfdctfst-mmx.asm simd/jfdctfst-sse2.asm simd/jfdctint-mmx.asm \
44      simd/jfdctint-sse2.asm simd/jidctflt-3dn.asm simd/jidctflt-sse2.asm \
45      simd/jidctflt-sse.asm simd/jidctfst-mmx.asm simd/jidctfst-sse2.asm \
46      simd/jidctint-mmx.asm simd/jidctint-sse2.asm simd/jidctred-mmx.asm \
47      simd/jidctred-sse2.asm simd/jquant-3dn.asm simd/jquantf-sse2.asm \
48      simd/jquanti-sse2.asm simd/jquant-mmx.asm simd/jquant-sse.asm \
49      simd/jsimdcpu.asm
50LOCAL_ASFLAGS_x86 += -DPIC -DELF
51LOCAL_C_INCLUDES_x86 += $(LOCAL_PATH)/simd
52
53# x86-64 SSE2
54LOCAL_SRC_FILES_x86_64 += \
55      simd/jsimd_x86_64.c simd/jccolor-sse2-64.asm simd/jcgray-sse2-64.asm \
56      simd/jcsample-sse2-64.asm simd/jdcolor-sse2-64.asm \
57      simd/jdmerge-sse2-64.asm simd/jdsample-sse2-64.asm \
58      simd/jfdctflt-sse-64.asm simd/jfdctfst-sse2-64.asm \
59      simd/jfdctint-sse2-64.asm simd/jidctflt-sse2-64.asm \
60      simd/jidctfst-sse2-64.asm simd/jidctint-sse2-64.asm \
61      simd/jidctred-sse2-64.asm simd/jquantf-sse2-64.asm \
62      simd/jquanti-sse2-64.asm
63LOCAL_ASFLAGS_x86_64 += -D__x86_64__ -DPIC -DELF
64LOCAL_C_INCLUDES_x86_64 += $(LOCAL_PATH)/simd
65
66LOCAL_SRC_FILES_mips += jsimd_none.c
67LOCAL_SRC_FILES_mips64 += jsimd_none.c
68
69LOCAL_CFLAGS += -O3 -fstrict-aliasing
70LOCAL_CFLAGS += -Wno-unused-parameter
71LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
72
73ifneq (,$(TARGET_BUILD_APPS))
74  # Unbundled branch, built against NDK.
75  LOCAL_SDK_VERSION := 17
76endif
77
78# Build as a static library.
79LOCAL_MODULE := libjpeg_static
80include $(BUILD_STATIC_LIBRARY)
81
82# Also build as a shared library.
83include $(CLEAR_VARS)
84
85ifneq (,$(TARGET_BUILD_APPS))
86  # Unbundled branch, built against NDK.
87  LOCAL_SDK_VERSION := 17
88endif
89
90LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
91LOCAL_WHOLE_STATIC_LIBRARIES = libjpeg_static
92LOCAL_MODULE := libjpeg
93include $(BUILD_SHARED_LIBRARY)
94