Android.mk
author Sam Lantinga
Sun, 22 Oct 2017 12:08:11 -0700
changeset 830 c292b484a95e
parent 791 3b05140ef301
child 836 f6a6026e7172
permissions -rw-r--r--
Fixed bug 2491 - Force LOCAL_ARM_MODE for android builds

Sylvain

Here's a patch for building SDL_mixer and its dependencies.
There is an Android.mk file for each library.

It easier to customize the compilation of each library if necessary. Cleaner to extend and to maintain I think.
slouken@830
     1
# Save the local path
slouken@791
     2
MY_LOCAL_PATH := $(call my-dir)
slouken@791
     3
slouken@830
     4
slouken@830
     5
# Enable this if you want to support loading FLAC music with libFLAC
slouken@830
     6
SUPPORT_FLAC ?= true
slouken@830
     7
FLAC_LIBRARY_PATH := external/flac-1.3.2
slouken@830
     8
slouken@830
     9
# Enable this if you want to support loading OGG Vorbis music via Tremor
slouken@830
    10
SUPPORT_OGG ?= true
slouken@830
    11
OGG_LIBRARY_PATH := external/libogg-1.3.2
slouken@830
    12
VORBIS_LIBRARY_PATH := external/libvorbisidec-1.2.1
slouken@830
    13
slouken@830
    14
# Enable this if you want to support loading MP3 music via MPG123
slouken@830
    15
SUPPORT_MP3_MPG123 ?= true
slouken@830
    16
MPG123_LIBRARY_PATH := external/mpg123-1.25.6
slouken@830
    17
slouken@830
    18
# Enable this if you want to support loading MOD music via modplug
slouken@830
    19
SUPPORT_MOD_MODPLUG ?= true
slouken@830
    20
MODPLUG_LIBRARY_PATH := external/libmodplug-0.8.9.0
slouken@830
    21
slouken@830
    22
# Enable this if you want to support TiMidity
slouken@830
    23
SUPPORT_TIMIDITY ?= true
slouken@830
    24
TIMIDITY_LIBRARY_PATH := timidity
slouken@830
    25
slouken@791
    26
slouken@830
    27
# Build the library
slouken@830
    28
ifeq ($(SUPPORT_FLAC),true)
slouken@830
    29
    include $(MY_LOCAL_PATH)/$(FLAC_LIBRARY_PATH)/Android.mk
slouken@830
    30
endif
slouken@830
    31
slouken@830
    32
# Build the library
slouken@830
    33
ifeq ($(SUPPORT_OGG),true)
slouken@830
    34
    include $(MY_LOCAL_PATH)/$(OGG_LIBRARY_PATH)/Android.mk
slouken@830
    35
    include $(MY_LOCAL_PATH)/$(VORBIS_LIBRARY_PATH)/Android.mk
slouken@830
    36
endif
slouken@830
    37
slouken@830
    38
# Build the library
slouken@830
    39
ifeq ($(SUPPORT_MP3_MPG123),true)
slouken@830
    40
    include $(MY_LOCAL_PATH)/$(MPG123_LIBRARY_PATH)/Android.mk
slouken@830
    41
endif
slouken@830
    42
slouken@830
    43
# Build the library
slouken@830
    44
ifeq ($(SUPPORT_MOD_MODPLUG),true)
slouken@830
    45
    include $(MY_LOCAL_PATH)/$(MODPLUG_LIBRARY_PATH)/Android.mk
slouken@830
    46
endif
slouken@830
    47
slouken@830
    48
# Build the library
slouken@830
    49
ifeq ($(SUPPORT_TIMIDITY),true)
slouken@830
    50
    include $(MY_LOCAL_PATH)/$(TIMIDITY_LIBRARY_PATH)/Android.mk
slouken@830
    51
endif
slouken@830
    52
slouken@830
    53
slouken@830
    54
# Restore local path
slouken@791
    55
LOCAL_PATH := $(MY_LOCAL_PATH)
slouken@491
    56
slouken@491
    57
include $(CLEAR_VARS)
slouken@491
    58
slouken@581
    59
LOCAL_MODULE := SDL2_mixer
slouken@491
    60
slouken@685
    61
LOCAL_SRC_FILES := $(notdir $(filter-out %/playmus.c %/playwave.c, $(wildcard $(LOCAL_PATH)/*.c))) \
slouken@689
    62
slouken@626
    63
LOCAL_LDLIBS :=
slouken@626
    64
LOCAL_STATIC_LIBRARIES :=
slouken@626
    65
LOCAL_SHARED_LIBRARIES := SDL2
slouken@626
    66
slouken@754
    67
ifeq ($(SUPPORT_FLAC),true)
slouken@754
    68
	LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(FLAC_LIBRARY_PATH)/include
slouken@777
    69
	LOCAL_CFLAGS += -DMUSIC_FLAC
slouken@830
    70
    LOCAL_STATIC_LIBRARIES += libFLAC
slouken@754
    71
endif
slouken@754
    72
slouken@830
    73
ifeq ($(SUPPORT_OGG),true)
slouken@830
    74
    LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(OGG_LIBRARY_PATH)/include
slouken@830
    75
    LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(VORBIS_LIBRARY_PATH)
slouken@830
    76
    LOCAL_CFLAGS += -DMUSIC_OGG -DOGG_USE_TREMOR -DOGG_HEADER="<ivorbisfile.h>"
slouken@830
    77
	LOCAL_STATIC_LIBRARIES += ogg vorbisidec
slouken@639
    78
endif
slouken@639
    79
slouken@830
    80
# This needs to be a shared library to comply with the LGPL license
slouken@790
    81
ifeq ($(SUPPORT_MP3_MPG123),true)
slouken@790
    82
    LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MPG123_LIBRARY_PATH)
slouken@790
    83
    LOCAL_CFLAGS += -DMUSIC_MP3_MPG123
slouken@791
    84
    LOCAL_SHARED_LIBRARIES += mpg123
slouken@626
    85
endif
slouken@626
    86
slouken@830
    87
ifeq ($(SUPPORT_MOD_MODPLUG),true)
slouken@830
    88
    LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MODPLUG_LIBRARY_PATH)/src
slouken@830
    89
    LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MODPLUG_LIBRARY_PATH)/src/libmodplug
slouken@830
    90
    LOCAL_CFLAGS += -DMUSIC_MOD_MODPLUG -DMODPLUG_HEADER="<modplug.h>"
slouken@830
    91
	LOCAL_STATIC_LIBRARIES += modplug
slouken@830
    92
endif
slouken@830
    93
slouken@830
    94
ifeq ($(SUPPORT_TIMIDITY),true)
slouken@830
    95
	LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(TIMIDITY_LIBRARY_PATH)
slouken@830
    96
	LOCAL_CFLAGS += -DMUSIC_MID_TIMIDITY
slouken@830
    97
	LOCAL_STATIC_LIBRARIES += timidity
slouken@626
    98
endif
slouken@491
    99
slouken@643
   100
LOCAL_EXPORT_C_INCLUDES += $(LOCAL_C_INCLUDES)
slouken@643
   101
slouken@491
   102
include $(BUILD_SHARED_LIBRARY)