Android.mk
author Ozkan Sezer
Wed, 18 Dec 2019 18:55:56 +0300
changeset 1098 3be892f72aa7
parent 1048 569f5be0f8ec
permissions -rw-r--r--
fix build.
     1 # Save the local path
     2 SDL_MIXER_LOCAL_PATH := $(call my-dir)
     3 
     4 # Enable this if you want to support loading FLAC music with libFLAC
     5 SUPPORT_FLAC ?= true
     6 FLAC_LIBRARY_PATH := external/flac-1.3.3
     7 
     8 # Enable this if you want to support loading OGG Vorbis music via Tremor
     9 SUPPORT_OGG ?= true
    10 OGG_LIBRARY_PATH := external/libogg-1.3.2
    11 VORBIS_LIBRARY_PATH := external/libvorbisidec-1.2.1
    12 
    13 # Enable this if you want to support loading MP3 music via MPG123
    14 SUPPORT_MP3_MPG123 ?= true
    15 MPG123_LIBRARY_PATH := external/mpg123-1.25.13
    16 
    17 # Enable this if you want to support loading MOD music via modplug
    18 SUPPORT_MOD_MODPLUG ?= true
    19 MODPLUG_LIBRARY_PATH := external/libmodplug-0.8.9.0
    20 
    21 # Enable this if you want to support TiMidity
    22 SUPPORT_MID_TIMIDITY ?= true
    23 TIMIDITY_LIBRARY_PATH := src/codecs/timidity
    24 
    25 
    26 # Build the library
    27 ifeq ($(SUPPORT_FLAC),true)
    28     include $(SDL_MIXER_LOCAL_PATH)/$(FLAC_LIBRARY_PATH)/Android.mk
    29 endif
    30 
    31 # Build the library
    32 ifeq ($(SUPPORT_OGG),true)
    33     include $(SDL_MIXER_LOCAL_PATH)/$(OGG_LIBRARY_PATH)/Android.mk
    34     include $(SDL_MIXER_LOCAL_PATH)/$(VORBIS_LIBRARY_PATH)/Android.mk
    35 endif
    36 
    37 # Build the library
    38 ifeq ($(SUPPORT_MP3_MPG123),true)
    39     include $(SDL_MIXER_LOCAL_PATH)/$(MPG123_LIBRARY_PATH)/Android.mk
    40 endif
    41 
    42 # Build the library
    43 ifeq ($(SUPPORT_MOD_MODPLUG),true)
    44     include $(SDL_MIXER_LOCAL_PATH)/$(MODPLUG_LIBRARY_PATH)/Android.mk
    45 endif
    46 
    47 # Build the library
    48 ifeq ($(SUPPORT_MID_TIMIDITY),true)
    49     include $(SDL_MIXER_LOCAL_PATH)/$(TIMIDITY_LIBRARY_PATH)/Android.mk
    50 endif
    51 
    52 
    53 # Restore local path
    54 LOCAL_PATH := $(SDL_MIXER_LOCAL_PATH)
    55 
    56 include $(CLEAR_VARS)
    57 
    58 LOCAL_MODULE := SDL2_mixer
    59 
    60 LOCAL_C_INCLUDES :=                                     \
    61     $(LOCAL_PATH)/include                               \
    62     $(LOCAL_PATH)/src/                                  \
    63     $(LOCAL_PATH)/src/codecs                            \
    64 
    65 
    66 LOCAL_SRC_FILES :=                                      \
    67     $(subst $(LOCAL_PATH)/,,                            \
    68     $(wildcard $(LOCAL_PATH)/src/*.c)                   \
    69     $(wildcard $(LOCAL_PATH)/src/codecs/*.c)            \
    70     )
    71 
    72 LOCAL_CFLAGS :=
    73 LOCAL_LDLIBS :=
    74 LOCAL_STATIC_LIBRARIES :=
    75 LOCAL_SHARED_LIBRARIES := SDL2
    76 
    77 ifeq ($(SUPPORT_FLAC),true)
    78     LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(FLAC_LIBRARY_PATH)/include
    79     LOCAL_CFLAGS += -DMUSIC_FLAC
    80     LOCAL_STATIC_LIBRARIES += libFLAC
    81 endif
    82 
    83 ifeq ($(SUPPORT_OGG),true)
    84     LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(OGG_LIBRARY_PATH)/include
    85     LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(VORBIS_LIBRARY_PATH)
    86     LOCAL_CFLAGS += -DMUSIC_OGG -DOGG_USE_TREMOR -DOGG_HEADER="<ivorbisfile.h>"
    87     LOCAL_STATIC_LIBRARIES += ogg vorbisidec
    88 endif
    89 
    90 # This needs to be a shared library to comply with the LGPL license
    91 ifeq ($(SUPPORT_MP3_MPG123),true)
    92     LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MPG123_LIBRARY_PATH)
    93     LOCAL_CFLAGS += -DMUSIC_MP3_MPG123
    94     LOCAL_SHARED_LIBRARIES += mpg123
    95 endif
    96 
    97 ifeq ($(SUPPORT_MOD_MODPLUG),true)
    98     LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MODPLUG_LIBRARY_PATH)/src
    99     LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MODPLUG_LIBRARY_PATH)/src/libmodplug
   100     LOCAL_CFLAGS += -DMUSIC_MOD_MODPLUG -DMODPLUG_HEADER="<modplug.h>"
   101     LOCAL_STATIC_LIBRARIES += modplug
   102 endif
   103 
   104 ifeq ($(SUPPORT_MID_TIMIDITY),true)
   105     LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(TIMIDITY_LIBRARY_PATH)
   106     LOCAL_CFLAGS += -DMUSIC_MID_TIMIDITY
   107     LOCAL_STATIC_LIBRARIES += timidity
   108 endif
   109 
   110 LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)/include
   111 
   112 include $(BUILD_SHARED_LIBRARY)
   113 
   114 ###########################
   115 #
   116 # SDL2_mixer static library
   117 #
   118 ###########################
   119 
   120 LOCAL_MODULE := SDL2_mixer_static
   121 
   122 LOCAL_MODULE_FILENAME := libSDL2_mixer
   123 
   124 LOCAL_LDLIBS :=
   125 LOCAL_EXPORT_LDLIBS :=
   126 
   127 include $(BUILD_STATIC_LIBRARY)
   128