# Generated automatically from Makefile.in by configure.
# Makefile for the  MetaPost support programs.

SHELL = /bin/sh
srcdir = //53/src/Doc/Tools/src/teTeX-src-0.4/kpse-2.6/web2c/mpware
VPATH = //53/src/Doc/Tools/src/teTeX-src-0.4/kpse-2.6/web2c/mpware

# This is so kpathsea will get remade automatically if you change
# something in it and recompile from the package directory.
kpathsea_parent = ../..
kpathsea_dir = $(kpathsea_parent)/kpathsea
kpathsea = $(kpathsea_dir)/kpathsea.a

# Routines used everywhere.
commondefines = $(srcdir)/../lib/common.defines
commonh = $(srcdir)/../lib/config.h $(kpathsea_dir)/paths.h
commono = ../lib/lib.a $(kpathsea)

c_autoh = $(srcdir)/../lib/c-auto.h

program = dvitomp dmp mpto newer

CC = cc
CFLAGS = -g
CPPFLAGS = -I$(srcdir)/../lib -I../..

CCLD = $(CC)
LDFLAGS = $(CFLAGS) $(XLDFLAGS)
LIBS =  -ldir $(extralibs)
libs = $(commono) $(LIBS)

INSTALL = ../../
INSTALL_PROGRAM = ${INSTALL}


.SUFFIXES:
.SUFFIXES: .o .c .p .ch
.p.c:
	$(SHELL) $(srcdir)/../lib/convert $*.p $*.c
.ch.p:
	../web/tangle $*.web $*.ch
.c.o:
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $*.c


default: all
all: $(program) 

# DVItoMP
dvitomp: dvitomp.o $(commono)
	$(CCLD) $(LDFLAGS) -o dvitomp dvitomp.o $(libs)
dvitomp.o: dvitomp.c $(commonh)
dvitomp.c: dvitomp.p $(commondefines)
dvitomp.p: dvitomp.web dvitomp.ch

# DMP
dmp: dmp.o $(commono)
	$(CCLD) $(LDFLAGS) -o dmp dmp.o $(commono) -lm
dmp.o: dmp.c $(c_autoh)
	$(CC) $(CPPFLAGS) $(CFLAGS) -c dmp.c

# mpto (replacement for MPtoTeX and MPtoTR)
mpto: mpto.o $(commono)
	$(CCLD) $(LDFLAGS) -o mpto mpto.o $(commono)

# newer
newer: newer.o $(c_autoh)
	$(CCLD) $(LDFLAGS) -o newer newer.o

# This will abort if either diff returns nonzero exit status
# otherwise the test is considered passed.
run-triptrap: mpto newer
	./mpto -tex testex.mp | diff testex.tex -
	sed '16s/^%//' <testex.mp >testex1
	-mpto -tex testex1 >/dev/null 2>testex2
	sed '17s/^%//' <testex.mp >testex1
	-mpto -tex testex1 >/dev/null 2>>testex2
	sed '18s/^%//' <testex.mp >testex1
	-mpto -tex testex1 >/dev/null 2>>testex2
	sed '19s/^%//' <testex.mp >testex1
	-mpto -tex testex1 >/dev/null 2>>testex2
	sed '20s/^%//' <testex.mp >testex1
	-mpto -tex testex1 >/dev/null 2>>testex2
	diff testex.err testex2

clean-triptrap:
	rm -f testex1 testex2


Makefile: Makefile.in ../config.status
	(cd ..; sh config.status)


c-sources: dvitomp.c
.PHONY: c-sources

install install-exec: all
	for p in $(program); do $(INSTALL_PROGRAM) $$p $(bindir)/$$p; done
install-data:


TAGS: *.c *.h
	etags -t *.c *.h


mostlyclean::
	rm -f *.o $(program) $(lib) $(programs)

clean:: mostlyclean
	rm -f *.dvi *.pool

distclean:: clean
	rm -f Makefile config.status c-auto.h

# Although we can remake configure and c-auto.h.in, we don't remove
# them, since many people may lack Autoconf.  Use configclean for that.
realclean:: distclean
	rm -f TAGS *.info*

extraclean::
	rm -f *.aux *.bak *.bbl *.blg *.dvi *.log *.orig *.pl *.rej
	rm -f *.i *.s *.tfm *.vf *.vpl *\#* *gf *pk *~
	rm -f CONTENTS.tex a.out core mfput.* mpout.* patch* texput.*

configclean:
	rm -f configure c-auto.h.in c-auto.h


# Prevent GNU make 3 from overflowing arg limit on system V.
.NOEXPORT:

clean::
	rm -f *.p dvitomp.c dvitomp.h
