top_builddir = ../..
top_srcdir = @top_srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@

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

BINDIR = $(DESTDIR)$(bindir)

VPATH = $(top_srcdir)/tool/mlfc

OBJ = main.o

CFLAGS = $(CFLAGS_LOCAL) @CFLAGS@ @CPPFLAGS@ @FONTCONFIG_CFLAGS@ -I/usr/local/include

LIBS = $(LIBS_LOCAL) @FONTCONFIG_LIBS@ -L/usr/local/lib -R/usr/local/lib

PROG = mlfc

LIBTOOL_CC = $(LIBTOOL) --mode=compile $(CC) $(CFLAGS)
LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CC) @LDFLAGS@
LIBTOOL_INSTALL = $(LIBTOOL) --mode=install $(INSTALL)

all: $(PROG)

$(PROG): $(OBJ)
	$(LIBTOOL_LINK) $(CFLAGS) -o $(PROG) $(OBJ:.o=.lo) $(LIBS)

.SUFFIXES: .c .o

.c.o:
	$(LIBTOOL_CC) -c $<

$(BINDIR):
	mkdir -p $(BINDIR)

install: $(BINDIR)
	$(LIBTOOL_INSTALL) $(PROG) $(BINDIR)

uninstall:
	rm -f $(BINDIR)/$(PROG)

wc:
	find . -name "*.[ch]" -a \! -name "test_*" | xargs wc -l

clean:
	rm -rf $(PROG) $(PROG).exe *core $(OBJ) $(OBJ:.o=.lo) .libs

distclean: clean
	rm -f Makefile
