
srcdir = @srcdir@
VPATH  = @srcdir@

include ../config.mk

SUBDIRS = po

LOCAL_CFLAGS = $(KPSE_CFLAGS) -I$(srcdir) -I.. -I$(srcdir)/../include
ALL_CFLAGS = $(CFLAGS) $(ADDCFLAGS) $(CPPFLAGS) $(LOCAL_CFLAGS)

OBJS     = common.o util.o pk.o gf.o vf.o bitmap.o font.o list.o \
	dviread.o paper.o pagesel.o setup.o special.o tfm.o sp-epsf.o \
	dvimisc.o hash.o assoc.o tfmfile.o t1.o tt.o fontmap.o \
	afmparse.o fontsrch.o files.o
SOURCES  = common.c util.c pk.c gf.c vf.c bitmap.c font.c list.c \
	dviread.c paper.c pagesel.c setup.c special.c tfm.c sp-epsf.c \
	dvimisc.c hash.c assoc.c tfmfile.c t1.c tt.c fontmap.c \
	afmparse.c fontsrch.c files.c
HEADERS = bitmap.h common.h defaults.h dviopcodes.h fontmap.h mdvi.h sysdeps.h

ALL_SOURCES = $(SOURCES)
ALL_HEADERS = $(addprefix $(srcdir)/../include/, $(HEADERS))
OTHERFILES = Makefile.in afmparse.h

# Dedendency files depend on these
DEPSOURCES = $(SOURCES)
DEPCFLAGS  = $(LOCAL_CFLAGS) $(T1LIB_CFLAGS) $(FREETYPE_CFLAGS)

# Files we distribute
DISTFILES = $(ALL_SOURCES) ../include $(OTHERFILES) po

# Files that we clean on the `clean' and `distclean' targets resp.
CLEANABLE += $(OBJS) $(MDVILIB)
DISTCLEANABLE += Makefile

# The main target of this Makefile
MDVILIB = mdvi.a

.PHONY: all $(SUBDIRS)
all: $(MDVILIB) $(SUBDIRS)

$(SUBDIRS):
	if test -d "$@"; then $(MAKE) -C $@; else :; fi

.PHONY: install uninstall
install:
uninstall:

$(MDVILIB): $(OBJS)
	$(MAKELIB) $@ $(OBJS)

.SUFFIXES:
.SUFFIXES: .c .o

.c.o:
	$(CC) $(ALL_CFLAGS) -c $<

t1.o: t1.c
	$(CC) $(ALL_CFLAGS) $(T1LIB_CFLAGS) -c $<
tt.o: tt.c
	$(CC) $(ALL_CFLAGS) $(FREETYPE_CFLAGS) -c $<

include $(FRAGDIR)/dist.mk
include $(FRAGDIR)/targets.mk
include $(FRAGDIR)/depend.mk
