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

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

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

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.make

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

install-exec:
	$(SHELL) $(top_srcdir)/../mkdirchain $(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
uninstall-exec:
	cd $(bindir); rm -f $(programs)

install-data:
	$(SHELL) $(top_srcdir)/../mkdirchain $(mandir) $(dvilj_latex2e_macrodir) $(fontdir)
	$(INSTALL_DATA) $(srcdir)/dvilj.man $(mandir)/dvilj.$(manext)
	cd $(srcdir)/tex && for m in *.sty; do \
	  $(INSTALL_DATA) $$m $(dvilj_latex2e_macrodir)/$$m; done

# 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.
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.make
ac_include ../make/config.make

info dvi check:

ac_include ../make/clean.make

ac_include ../make/rdepend.make
dvilj.o dvilj2p.o dvilj4.o dvilj4l.o: dvi2xx.c dvi2xx.h ../kpathsea/config.h c-auto.h \
 ../kpathsea/c-std.h \
 ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
 ../kpathsea/c-memstr.h \
 ../kpathsea/c-errno.h \
 ../kpathsea/c-minmax.h \
 ../kpathsea/c-limits.h \
 ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
 ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/magstep.h \
 ../kpathsea/proginit.h ../kpathsea/tex-glyph.h ../kpathsea/tex-file.h \
 ../kpathsea/tex-hush.h ../kpathsea/tex-make.h \
 config.h commands.h
tfm.o: tfm.c ../kpathsea/config.h c-auto.h ../kpathsea/c-std.h \
 ../kpathsea/c-unistd.h ../kpathsea/systypes.h \
 ../kpathsea/c-memstr.h \
 ../kpathsea/c-errno.h \
 ../kpathsea/c-minmax.h \
 ../kpathsea/c-limits.h \
 ../kpathsea/c-proto.h ../kpathsea/debug.h ../kpathsea/types.h \
 ../kpathsea/lib.h ../kpathsea/progname.h ../kpathsea/c-fopen.h \
 ../kpathsea/tex-file.h config.h
