APP := lib$(PROJECT)_$(MARCH).$(EXT)
 
THIRDPARTIES_INC := ../thirdparties/android/include
THIRDPARTIES_INC_COMMON := ../thirdparties/common/include
THIRDPARTIES_LIB := ../thirdparties/android/lib
THIRDPARTIES_MARCH_LIB := ../thirdparties/android/lib/$(MARCH)
 
##########
# Before starting to set parmeters we will override those provided by the user
#
 
ifeq ($(LICENSE),lgpl)
    H264 := no
endif
 
 
##########
# Set LD and CFLAGS according to the user parameters
#
 
# FFMPEG (Default: enabled)
ifeq ($(FFMPEG), no)
    FFMPEG_CFLAGS := -DHAVE_FFMPEG=0
    FFMPEG_LDFLAGS :=
else
    FFMPEG_CFLAGS := -DHAVE_FFMPEG=1
    FFMPEG_LDFLAGS := -lavutil-$(LICENSE) -lswscale-$(LICENSE) -lavcore-$(LICENSE) -lavcodec-$(LICENSE)
endif
# LibYUV (Default: enabled)
ifeq ($(LIBYUV), no)
    LIBYUV_CFLAGS := -DHAVE_LIBYUV=0
    LIBYUV_LDFLAGS := 
else
    LIBYUV_CFLAGS := -DHAVE_LIBYUV=1 -I$(THIRDPARTIES_INC_COMMON)/libyuv
    LIBYUV_LDFLAGS := -lyuv_$(MARCH)
endif
# H264 (Default: enabled)
ifeq ($(H264),no) # TODO: should depend on FFMPEG
    FFMPEG_CFLAGS := $(FFMPEG_CFLAGS) -DHAVE_H264=0
else
    FFMPEG_CFLAGS := $(FFMPEG_CFLAGS) -DHAVE_H264=1
    FFMPEG_LDFLAGS := $(FFMPEG_LDFLAGS) -lx264
endif
# THEORA (Default: enabled)
ifeq ($(THEORA),no) # TODO: should depend on FFMPEG
    FFMPEG_CFLAGS := $(FFMPEG_CFLAGS) -DHAVE_THEORA=0
else
    FFMPEG_CFLAGS := $(FFMPEG_CFLAGS) -DHAVE_THEORA=1
    FFMPEG_LDFLAGS := $(FFMPEG_LDFLAGS) -ltheora -logg
endif
# VP8 (Default: disabled because of NEON)
ifeq ($(VPX),yes)
    VPX_CFLAGS := -DHAVE_LIBVPX=1
    VPX_LDFLAGS := -lvpx_$(MARCH)
    
else
    VPX_CFLAGS := -DHAVE_LIBVPX=0
endif
 
# OPUS (Default: enabled)
ifeq ($(OPUS), no)
    OPUS_CFLAGS := -DHAVE_LIBOPUS=0
else
    OPUS_CFLAGS := -DHAVE_LIBOPUS=1
    OPUS_LDFLAGS := -lopus
endif
 
# AMR (Default: enabled)
ifeq ($(OPENCORE_AMR), no)
    OPENCORE_AMR_CFLAGS := -DHAVE_OPENCORE_AMR=0
else
    OPENCORE_AMR_CFLAGS := -DHAVE_OPENCORE_AMR=1
    OPENCORE_AMR_LDFLAGS := -lopencore-amrnb
endif
 
# SPEEX_DSP (Default: disabled)
ifeq ($(SPEEX_DSP), yes)
    SPEEX_DSP_CFLAGS := -DHAVE_SPEEX_DSP=1
    SPEEX_DSP_LDFLAGS := -lspeexdsp
        # Speex audio resampler (Default: enabled)
        ifneq ($(SPEEX_RESAMPLER), no)
            SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_RESAMPLER=1
        else
            SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_RESAMPLER=0
        endif
        # Speex audio/video jitterbuffer (Default: enabled)
        ifneq ($(SPEEX_JB), no)
            SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_JB=1
        else
            SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_JB=0
        endif
        # Speex audio denoiser (Default: disabled)
        ifeq ($(SPEEX_DENOISE), yes)
            SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_DENOISE=1
        else
            SPEEX_DSP_CFLAGS := $(SPEEX_DSP_CFLAGS) -DHAVE_SPEEX_DENOISE=0
        endif
else
    SPEEX_DSP_CFLAGS := -DHAVE_SPEEX_DSP=0
endif
 
# SPEEX (Default: disabled)
ifeq ($(SPEEX), yes)