#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

DEPTH		= @DEPTH@
topsrcdir	= @top_srcdir@
srcdir		= @srcdir@
VPATH		= @srcdir@

include $(DEPTH)/config/autoconf.mk

MODULE		= layout
LIBRARY_NAME	= gkmedias
EXPORT_LIBRARY	= $(DIST)/lib
ifeq (WINNT,$(OS_TARGET))
FORCE_SHARED_LIB = 1
endif

SHARED_LIBRARY_LIBS = \
    $(MOZ_OTS_LIBS) \
    $(QCMS_LIBS) \
    $(MOZ_HARFBUZZ_LIBS) \
    $(NULL)

ifdef MOZ_TREE_CAIRO
SHARED_LIBRARY_LIBS += $(MOZ_CAIRO_LIBS)
endif

ifdef MOZ_TREE_PIXMAN
SHARED_LIBRARY_LIBS += $(MOZ_PIXMAN_LIBS)
endif

ifdef MOZ_GRAPHITE
SHARED_LIBRARY_LIBS += $(MOZ_GRAPHITE_LIBS)
endif

ifdef MOZ_VORBIS
SHARED_LIBRARY_LIBS 	+= \
	$(DEPTH)/media/libvorbis/lib/$(LIB_PREFIX)vorbis.$(LIB_SUFFIX) \
	$(DEPTH)/media/libogg/src/$(LIB_PREFIX)ogg.$(LIB_SUFFIX) \
	$(NULL)
endif

ifdef MOZ_TREMOR
SHARED_LIBRARY_LIBS	+= \
	$(DEPTH)/media/libtremor/lib/$(LIB_PREFIX)tremor.$(LIB_SUFFIX) \
	$(DEPTH)/media/libogg/src/$(LIB_PREFIX)ogg.$(LIB_SUFFIX) \
	$(NULL)
endif

ifdef MOZ_OGG
SHARED_LIBRARY_LIBS 	+= \
	$(DEPTH)/media/libtheora/lib/$(LIB_PREFIX)theora.$(LIB_SUFFIX) \
	$(NULL)
endif

ifdef MOZ_OPUS
SHARED_LIBRARY_LIBS += \
  $(DEPTH)/media/libopus/$(LIB_PREFIX)opus.$(LIB_SUFFIX) \
  $(NULL)
endif

ifdef MOZ_WEBM
SHARED_LIBRARY_LIBS 	+= \
	$(DEPTH)/media/libnestegg/src/$(LIB_PREFIX)nestegg.$(LIB_SUFFIX) \
	$(NULL)
endif

ifdef MOZ_VP8
ifndef MOZ_NATIVE_LIBVPX
SHARED_LIBRARY_LIBS 	+= \
	$(DEPTH)/media/libvpx/$(LIB_PREFIX)vpx.$(LIB_SUFFIX) \
	$(NULL)
endif
endif

ifdef MOZ_SYDNEYAUDIO
SHARED_LIBRARY_LIBS 	+= \
	$(DEPTH)/media/libsydneyaudio/src/$(LIB_PREFIX)sydneyaudio.$(LIB_SUFFIX) \
	$(NULL)
endif

ifdef MOZ_SPEEX_RESAMPLER
SHARED_LIBRARY_LIBS 	+= \
	$(DEPTH)/media/libspeex_resampler/src/$(LIB_PREFIX)speex_resampler.$(LIB_SUFFIX) \
	$(NULL)
endif

ifdef MOZ_CUBEB
SHARED_LIBRARY_LIBS 	+= \
	$(DEPTH)/media/libcubeb/src/$(LIB_PREFIX)cubeb.$(LIB_SUFFIX) \
	$(NULL)
endif

ifndef MOZ_NATIVE_PNG
SHARED_LIBRARY_LIBS 	+= \
	$(DEPTH)/media/libpng/$(LIB_PREFIX)mozpng.$(LIB_SUFFIX) \
	$(NULL)
endif

ifndef MOZ_NATIVE_JPEG
SHARED_LIBRARY_LIBS 	+= \
	$(DEPTH)/media/libjpeg/$(LIB_PREFIX)mozjpeg.$(LIB_SUFFIX) \
	$(NULL)
endif

SHARED_LIBRARY_LIBS 	+= \
	$(DEPTH)/gfx/angle/$(LIB_PREFIX)angle.$(LIB_SUFFIX) \
	$(DEPTH)/parser/expat/lib/$(LIB_PREFIX)mozexpat_s.$(LIB_SUFFIX) \
	$(NULL)

SHARED_LIBRARY_LIBS 	+= \
	$(DEPTH)/gfx/2d/$(LIB_PREFIX)gfx2d.$(LIB_SUFFIX) \
	$(NULL)

ifdef MOZ_ENABLE_SKIA
SHARED_LIBRARY_LIBS += $(MOZ_SKIA_LIBS)
endif

ifdef MOZ_WEBRTC
ifndef MOZ_WEBRTC_IN_LIBXUL
DEFINES += -DMOZ_WEBRTC_GKMEDIA=1
include $(topsrcdir)/media/webrtc/shared_libs.mk
SHARED_LIBRARY_LIBS += $(WEBRTC_LIBS)
endif
endif

ifeq (WINNT,$(OS_TARGET))
EXTRA_DSO_LDOPTS = $(MOZALLOC_LIB) $(NSPR_LIBS)
OS_LIBS += $(call EXPAND_LIBNAME,usp10 ole32)

ifdef MOZ_WEBRTC
EXTRA_DSO_LDOPTS += \
  -LIBPATH:"$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)" \
  $(NULL)
OS_LIBS += $(call EXPAND_LIBNAME,secur32 crypt32 iphlpapi strmiids dmoguids wmcodecdspuuid amstrmid msdmo wininet)
ifdef _MSC_VER
OS_LIBS += $(call EXPAND_LIBNAME,delayimp)
EXTRA_DSO_LDOPTS += \
  -DELAYLOAD:msdmo.dll \
  $(NULL)
endif
endif

ifdef MOZ_WEBRTC
EXTRA_DSO_LDOPTS += \
  -LIBPATH:"$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)" \
  $(NULL)
OS_LIBS += $(call EXPAND_LIBNAME,secur32 crypt32 iphlpapi strmiids dmoguids wmcodecdspuuid amstrmid msdmo wininet)
endif
DEFFILE = symbols.def
endif

include $(topsrcdir)/config/rules.mk

ifeq (WINNT,$(OS_TARGET))
symbols.def: symbols.def.in
	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(ACDEFINES) $< > $@

OS_LIBS += $(call EXPAND_LIBNAME, msimg32)

ifdef MOZ_CUBEB
OS_LIBS += $(call EXPAND_LIBNAME, winmm)
endif

endif
