# $Id$

EXTRA_DIST = pipi_types.h.in pipi.pc.in
DISTCLEANFILES = pipi.pc

AM_CPPFLAGS = -I$(top_srcdir)

pkgconfig_DATA = pipi.pc
pkgconfigdir = $(libdir)/pkgconfig

include_HEADERS = pipi.h pipi_types.h

# The main library
lib_LTLIBRARIES = libpipi.la
libpipi_la_SOURCES = \
	pipi.c \
	pipi.h \
	pipi_types.h \
	pipi_internals.h \
	pipi_stubs.h \
	pipi_template.h \
	context.c \
	pixels.c \
	codec.c \
	stock.c \
	colorstring.c \
	resize.c \
	dither.c \
	accessors.c \
	$(codec_sources) \
	$(paint_sources) \
	$(render_sources) \
	$(combine_sources) \
	$(filter_sources) \
	$(quantize_sources) \
	$(dither_sources) \
	$(analysis_sources) \
	$(NULL)
libpipi_la_CFLAGS = $(codec_cflags)
libpipi_la_LDFLAGS = $(codec_libs) \
	-no-undefined -version-number @LT_VERSION@ \
	-lm
# Submodules

codec_cflags =
codec_libs =
codec_sources = \
	codec/oric.c

paint_sources = \
	paint/floodfill.c \
	paint/line.c \
	paint/bezier.c \
	paint/tile.c

render_sources = \
	render/noise.c \
	render/screen.c

combine_sources = \
	combine/rgb.c \
	combine/mean.c \
	combine/minmax.c \
	combine/subadd.c \
	combine/mulscreen.c

filter_sources = \
	filter/autocontrast.c \
	filter/blur.c \
	filter/convolution.c \
	filter/color.c \
	filter/transform.c \
	filter/median.c \
	filter/dilate.c

quantize_sources = \
	quantize/reduce.c

dither_sources = \
	dither/ediff.c \
	dither/ordered.c \
	dither/ostromoukhov.c \
	dither/dbs.c \
	dither/random.c

analysis_sources = \
	analysis/measure.c \
	analysis/histogram.c

# Conditional sources

if USE_SDL
codec_cflags += `sdl-config --cflags`
codec_libs += `sdl-config --libs` -lSDL_image
codec_sources += codec/sdl.c
endif

if USE_IMLIB2
codec_cflags += @IMLIB2_CFLAGS@
codec_libs += @IMLIB2_LIBS@
codec_sources += codec/imlib.c
endif

if USE_OPENCV
codec_cflags += @OPENCV_CFLAGS@
codec_libs += @OPENCV_LIBS@
codec_sources += codec/opencv.c
endif

if USE_GDI
codec_libs += -lgdi32
codec_sources += codec/gdi.c
endif

if USE_GDIPLUS
codec_libs += -Wl,--exclude-symbols,$$(printf '\x7f')gdiplus_NULL_THUNK_DATA -lgdiplus
codec_sources += codec/gdiplus.cpp
endif

if USE_COCOA
codec_objcflags = -I"/Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QuartzCore.framework/Versions/A/Headers/"
codec_libs += -framework Cocoa -framework IOKit -framework CoreFoundation -framework QuartzCore
codec_sources += codec/coreimage.m
endif

# Modular codecs
if USE_MODULAR
codec_sources += codec/modular.c
if USE_LIBJPEG
codec_libs += -ljpeg
codec_sources += codec/modular/jpeg.c
endif
endif
