# Makefile for dviljk -- kb@mail.tug.org.  Public domain.
version = 2.6

ac_include ../make/paths.mk
ac_include ../make/common.mk
ac_include ../make/programs.mk

prog_cflags = -DKPATHSEA

common_objects = tfm.o

program = dvilj
objects = dvilj.o $(common_objects)
objects2p = dvilj2p.o $(common_objects)
program2p = dvilj2p
objects4 = dvilj4.o $(common_objects)
program4 = dvilj4
objects4l = dvilj4l.o $(common_objects)
program4l = dvilj4l
program6 = dvilj6

programs = $(program) $(program2p) $(program4) $(program4l)

default: $(program4)
all: $(programs)

$(program): $(objects) $(kpathsea)
	$(kpathsea_link) $(objects) $(LOADLIBES)
$(program2p): $(objects2p) $(kpathsea)
	$(kpathsea_link) $(objects2p) $(LOADLIBES)
$(program4): $(objects4) $(kpathsea)
	$(kpathsea_link) $(objects4) $(LOADLIBES)
$(program4l): $(objects4l) $(kpathsea)
	$(kpathsea_link) $(objects4l) $(LOADLIBES)

dvilj.o:
	$(compile) -DLJ $(srcdir)/dvi2xx.c
	mv dvi2xx.o $@
dvilj2p.o:
	$(compile) -DLJ2P $(srcdir)/dvi2xx.c
	mv dvi2xx.o $@
dvilj4.o:
	$(compile) -DLJ4 $(srcdir)/dvi2xx.c
	mv dvi2xx.o $@
dvilj4l.o:
	$(compile) -DLJ4 -DLJ4L $(srcdir)/dvi2xx.c
	mv dvi2xx.o $@

dvilj.o dvilj2p.o dvilj4.o dvilj4l.o: dvi2xx.c

ac_include ../make/tkpathsea.mk

install: install-exec install-data
uninstall: uninstall-exec uninstall-data

install-exec:
	$(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) $(scriptdir)
	test ! -f $(program) \
	  || $(INSTALL_LIBTOOL_PROG) $(bindir) $(program)
	test ! -f $(program2p) \
	  || $(INSTALL_LIBTOOL_PROG) $(bindir) $(program2p)
	test ! -f $(program4) \
	  || $(INSTALL_LIBTOOL_PROG) $(bindir) $(program4)
	test ! -f $(program4l) \
	  || $(INSTALL_LIBTOOL_PROG) $(bindir) $(program4l)
	$(INSTALL_SCRIPT) $(srcdir)/dvihp $(scriptdir)/dvihp
	rm -f $(bindir)/$(program6); $(LN) $(program4) $(bindir)/$(program6)
uninstall-exec:
	cd $(bindir); rm -f $(programs)

install-data:
	$(SHELL) $(top_srcdir)/../mkinstalldirs $(mandir) $(dvilj_latex2e_macrodir) $(fontdir)
	$(INSTALL_DATA) $(srcdir)/dvilj.man $(mandir)/dvilj.$(manext)

# It seems simplest to keep this separate. Use find and cpio instead of
# just cp -r in case the source hierarchy is cvs- or rcs-ified.
# Use "" to quote wildcards because backslash is a directory separator
# on MS-DOS and MS-Windows.
install-fonts:
	find fonts -name \( "*.tfm" -o -name "*.vf" \) -print | cpio -pld $(texmf)

uninstall-data:
	rm -f $(mandir)/dvilj.$(manext)


distname = dviljk
program_files = dvihp dvilj.man README.fonts
version_files = dvi2xx.c dvihp

pre-dist-$(distname):
post-dist-$(distname):
	ln -s `pwd`/fonts `pwd`/tex `pwd`/src.fonts $(distdir)

ac_include ../make/dist.mk
ac_include ../make/config.mk

info dvi check:

ac_include ../make/clean.mk

ac_include ../make/rdepend.mk
ac_include depend.mk
