## texk/web2c/mplibdir/am/libmplib.am: Makefile fragment for libmplib.
##
## Copyright (C) 2009-2013 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.

## libmplib.a, used by MetaPost and luaTeX
##
EXTRA_LIBRARIES += libmplib.a

libmplib_a_CPPFLAGS = $(CAIRO_INCLUDES) $(PIXMAN_INCLUDES) $(ZLIB_INCLUDES) $(LIBPNG_INCLUDES) $(AM_CPPFLAGS) -I$(srcdir)/mplibdir

## libmplib C sources
libmplib_a_SOURCES = mplibdir/avl.h mplibdir/avl.c
nodist_libmplib_a_SOURCES = tfmin.c $(mp_c_h) $(mpmath_c_h) $(mpmathdouble_c_h) $(psout_c_h) $(svgout_c_h) $(pngout_c_h) $(mpstrings_c_h)
mp_c_h =  mp.c mplib.h mpmp.h
mpmath_c_h = mpmath.h mpmath.c
mpmathdouble_c_h = mpmathdouble.h mpmathdouble.c
mpstrings_c_h = mpstrings.h mpstrings.c
psout_c_h = mppsout.h psout.c mplibps.h
svgout_c_h = mplibsvg.h mpsvgout.h svgout.c
pngout_c_h = mplibpng.h mppngout.h pngout.c

# Creating one file: just one rule
tfmin.c: ctangle$(EXEEXT) mplibdir/tfmin.w
	$(mp_ctangle) tfmin.w

# Creating several files: need stamp file and two rules with identical recipes
$(mp_c_h): mp-tangle
	@$(mp_ctangle_sh) mp
mp-tangle: ctangle$(EXEEXT) mplibdir/mp.w tangle-sh
	@$(mp_ctangle_sh) mp

$(mpmath_c_h): mpmath-tangle
	@$(mp_ctangle_sh) mpmath
mpmath-tangle: ctangle$(EXEEXT) mplibdir/mpmath.w tangle-sh
	@$(mp_ctangle_sh) mpmath

$(mpmathdouble_c_h): mpmathdouble-tangle
	@$(mp_ctangle_sh) mpmathdouble
mpmathdouble-tangle: ctangle$(EXEEXT) mplibdir/mpmathdouble.w tangle-sh
	@$(mp_ctangle_sh) mpmathdouble

$(mpstrings_c_h): mpstrings-tangle
	@$(mp_ctangle_sh) mpstrings
mpstrings-tangle: ctangle$(EXEEXT) mplibdir/mpstrings.w tangle-sh
	@$(mp_ctangle_sh) mpstrings

$(psout_c_h): psout-tangle
	@$(mp_ctangle_sh) psout
psout-tangle: ctangle$(EXEEXT) mplibdir/psout.w tangle-sh
	@$(mp_ctangle_sh) psout

$(svgout_c_h): svgout-tangle
	@$(mp_ctangle_sh) svgout
svgout-tangle: ctangle$(EXEEXT) mplibdir/svgout.w tangle-sh
	@$(mp_ctangle_sh) svgout

$(pngout_c_h): pngout-tangle
	@$(mp_ctangle_sh) pngout
pngout-tangle: ctangle$(EXEEXT) mplibdir/pngout.w tangle-sh
	@$(mp_ctangle_sh) pngout

## libmplib CWeb sources
libmplib_web = mplibdir/mp.w mplibdir/psout.w mplibdir/svgout.w mplibdir/pngout.w
libmplib_web += mplibdir/mpmath.w mplibdir/mpmathdouble.w mplibdir/mpstrings.w mplibdir/tfmin.w

$(libmplib_a_OBJECTS): $(nodist_libmplib_a_SOURCES) $(KPATHSEA_DEPEND) $(CAIRO_DEPEND)

EXTRA_DIST += $(libmplib_web)

DISTCLEANFILES += $(nodist_libmplib_a_SOURCES) \
	mp-tangle mpmath-tangle mpmathdouble-tangle mpstrings-tangle psout-tangle svgout-tangle pngout-tangle

