SHELL = @SHELL@
prefix = @prefix@
exec_prefix = @exec_prefix@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = .
VPATH = @srcdir@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@

FFSPIRO_VERSION=0
FFSPIRO_REVISION=1
FFSPIRO_AGE=0

LIBTOOL = @LIBTOOL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
CC = @CC@

_CFLAGS = -I$(srcdir)/../inc -I$(srcdir) -I. -I$(srcdir)/../fontforge \
    @WFLAGS@ $(X_CFLAGS) \
    @DEFS@ '-DSHAREDIR="$(sharedir)"' -DLIBDIR='"$(libdir)"' \
    @CPPFLAGS@ '-DPREFIX="@prefix@"'
CFLAGS = @CFLAGS@ $(_CFLAGS)

O=lo
LIB_FF_SPIRO_OBJECTS = spiro.$O bezctx.$O spiroentrypoints.$O

LIBS = -lm

all: libspiro.la


clean:
	-rm -rf .libs *.la *.lo *.o

distclean: clean
	-rm -rf Makefile

get-spiro-src:
	bash < get-spiro-src.sh

%.lo: %.c
	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<

libspiro.la: $(LIB_FF_SPIRO_OBJECTS)
	$(LIBTOOL) --mode=link $(CC) $(CFLAGS) -no-undefined @LDFLAGS@  -o libspiro.la $(LIB_FF_SPIRO_OBJECTS) $(LIBS) \
	    @LIBS@ \
	    -rpath $(libdir) -version-info $(FFSPIRO_VERSION):$(FFSPIRO_REVISION):$(FFSPIRO_AGE)

install: all
	mkdir -p $(DESTDIR)$(libdir)
	mkdir -p $(DESTDIR)$(includedir)
	$(LIBTOOL) --mode=install $(INSTALL) -c libspiro.la $(DESTDIR)$(libdir)/libspiro.la
	$(LIBTOOL) --mode=finish $(DESTDIR)$(libdir)
	$(INSTALL_DATA) bezctx.h $(DESTDIR)$(includedir)
	$(INSTALL_DATA) bezctx_intf.h $(DESTDIR)$(includedir)
	$(INSTALL_DATA) spiro.h $(DESTDIR)$(includedir)
	$(INSTALL_DATA) spiroentrypoints.h $(DESTDIR)$(includedir)
