prefix = @prefix@
exec_prefix = @exec_prefix@

sharedir = @prefix@/share/fontforge
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ..
VPATH = @srcdir@
bindir = @bindir@
libdir = @libdir@
plugindir = $(sharedir)/plugins

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

X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_11LIB = @X_11LIB@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
STATIC_LIBS = @STATIC_LIBS@

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

LIBS = -rpath $(libdir) $(X_LIBS) ../libgdraw.la ../libgunicode.la \
    $(X_PRE_LIBS) $(X_11LIB) $(X_EXTRA_LIBS) @LIBS@ $(STATIC_LIBS) -L/usr/lib -lm

PLUGINS = gb12345.la

all: $(PLUGINS)

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

%.la: %.lo
	$(LIBTOOL) --mode=link $(CC) -export-dynamic -module -o $@ $< $(LIBS)

install: all
	mkdir -p $(plugindir)
	-mv .libs/*.{so,dll,dylib,lai}* $(plugindir)
	mv *.la $(plugindir)

