
DEPTH		= ../../..
topsrcdir	= @top_srcdir@
srcdir		= @srcdir@
VPATH		= @srcdir@

include $(DEPTH)/config/autoconf.mk

MODULE		= thebes
LIBRARY_NAME	= thebes
LIBXUL_LIBRARY	= 1
EXPORT_LIBRARY	= 1

REQUIRES = \
	cairo \
	string \
	pref \
	xpcom \
	unicharutil \
	$(LCMS_REQUIRES) \
	$(NULL)

CPPSRCS	= \
	gfxASurface.cpp \
	gfxAlphaRecovery.cpp \
	gfxBlur.cpp \
	gfxContext.cpp \
	gfxImageSurface.cpp \
	gfxFont.cpp \
	gfxFontMissingGlyphs.cpp \
	gfxFontTest.cpp \
	gfxFontUtils.cpp \
	gfxMatrix.cpp \
	gfxPath.cpp \
	gfxPattern.cpp \
	gfxPlatform.cpp \
	gfxRect.cpp \
	gfxSkipChars.cpp \
	gfxTextRunCache.cpp \
	gfxTextRunWordCache.cpp \
	gfxUserFontSet.cpp \
	$(NULL)

EXTRA_DSO_LDOPTS += \
	$(MOZ_CAIRO_LIBS) \
	$(MOZ_UNICHARUTIL_LIBS) \
	$(XPCOM_LIBS) \
	$(NSPR_LIBS) \
	$(ZLIB_LIBS) \
	$(LCMS_LIBS) \
	$(NULL)


ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
CPPSRCS	+= 	gfxWindowsPlatform.cpp \
		gfxWindowsSurface.cpp \
		gfxWindowsNativeDrawing.cpp \
		nsUnicodeRange.cpp \
		$(NULL)

ifdef WINCE
DEFINES += -DMOZ_FT2_FONTS
CPPSRCS	+= gfxFT2Fonts.cpp
else
CPPSRCS	+= gfxWindowsFonts.cpp 
endif

CPPSRCS +=	gfxPDFSurface.cpp

_OS_LIBS	= usp10 msimg32
ifdef GNU_CXX
_OS_LIBS	+= uuid
endif
OS_LIBS		+= $(call EXPAND_LIBNAME,$(_OS_LIBS))

ACDEFINES +=	-UWIN32_LEAN_AND_MEAN
endif

ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
CPPSRCS	+=	gfxOS2Fonts.cpp \
		gfxOS2Platform.cpp \
		gfxOS2Surface.cpp \
		nsUnicodeRange.cpp \
		gfxFontconfigUtils.cpp \
		$(NULL)
CPPSRCS +=	gfxPDFSurface.cpp
REQUIRES += uconv locale
endif

ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)

ifdef MOZ_PANGO
CPPSRCS += gfxPangoFonts.cpp
else
CPPSRCS += gfxFT2Fonts.cpp
endif

ifdef MOZ_X11
CPPSRCS += gfxXlibSurface.cpp
endif

REQUIRES += locale
CPPSRCS +=  gfxPlatformGtk.cpp gfxGdkNativeRenderer.cpp
CPPSRCS +=	gfxPDFSurface.cpp gfxPSSurface.cpp
CPPSRCS +=	gfxFontconfigUtils.cpp
CPPSRCS +=	nsUnicodeRange.cpp

ifdef MOZ_X11
CSRCS = cairo-xlib-utils.c
endif

ifdef MOZ_DFB
CSRCS = cairo-gdk-utils.c
endif

EXTRA_DSO_LDOPTS += $(MOZ_PANGO_LIBS) $(ZLIB_LIBS) $(XLDFLAGS) $(XLIBS)
endif

ifdef MOZ_DFB
CPPSRCS += gfxDirectFBSurface.cpp
endif

ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
REQUIRES += locale
CPPSRCS += gfxQtPlatform.cpp gfxQPainterSurface.cpp
CPPSRCS += gfxXlibSurface.cpp gfxQtNativeRenderer.cpp
CPPSRCS +=	gfxFT2Fonts.cpp
CPPSRCS +=	gfxFontconfigUtils.cpp
CPPSRCS +=	nsUnicodeRange.cpp
#CSRCS = cairo-xlib-utils.c
EXTRA_DSO_LDOPTS += $(ZLIB_LIBS) $(XLDFLAGS) $(XLIBS) $(CAIRO_FT_LIBS)
endif

ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
REQUIRES += locale
CPPSRCS	+= 	gfxBeOSSurface.cpp gfxBeOSPlatform.cpp
CPPSRCS +=	gfxPangoFonts.cpp 
#CPPSRCS +=	gfxPDFSurface.cpp
CPPSRCS +=	gfxFontconfigUtils.cpp
CPPSRCS +=	nsUnicodeRange.cpp
EXTRA_DSO_LDOPTS += $(MOZ_PANGO_LIBS) $(CAIRO_FT_LIBS) -lfontconfig
endif

ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
CPPSRCS	+= \
	gfxQuartzSurface.cpp \
	gfxQuartzImageSurface.cpp \
	gfxQuartzPDFSurface.cpp \
	gfxPlatformMac.cpp \
	gfxAtsuiFonts.cpp \
	$(NULL)
#CPPSRCS +=	gfxPDFSurface.cpp
CPPSRCS +=      nsUnicodeRange.cpp
CPPSRCS +=      gfxQuartzNativeDrawing.cpp

CMMSRCS = gfxQuartzFontCache.mm

# Always link with OpenGL/AGL
EXTRA_DSO_LDOPTS += -framework OpenGL -framework AGL -framework QuickTime
endif

EXTRA_DSO_LDOPTS += $(TK_LIBS)

DEFINES += -DIMPL_THEBES

include $(topsrcdir)/config/rules.mk

CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(TK_CFLAGS)
CFLAGS += $(MOZ_CAIRO_CFLAGS) $(TK_CFLAGS)

ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
ifdef WINCE
CXXFLAGS += $(CAIRO_FT_CFLAGS)
endif
endif

ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
CXXFLAGS += $(MOZ_PANGO_CFLAGS)
endif

ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
CXXFLAGS += $(CAIRO_FT_CFLAGS)
endif

ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
CXXFLAGS += $(CAIRO_FT_CFLAGS)
endif

ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
CXXFLAGS += $(CAIRO_FT_CFLAGS)
endif

