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

# paths.mk -- installation directories.
#
# The compile-time paths are defined in kpathsea/paths.h, which is built
# from kpathsea/texmf.in and these definitions.  See kpathsea/INSTALL
# for how the various path-related files are used and created.

# Do not change prefix and exec_prefix in Makefile.in!
# configure doesn't propagate the change to the other Makefiles.
# Instead, give the -prefix/-exec-prefix options to configure.
# (See kpathsea/INSTALL for more details.) This is arguably
# a bug, but it's not likely to change soon.
prefix = c:/usr/local
exec_prefix = ${prefix}

# Architecture-dependent executables.
bindir = ${exec_prefix}/bin/

# Architecture-independent executables.
scriptdir = $(bindir)

# Architecture-dependent files, such as lib*.a files.
libdir = ${exec_prefix}/lib

# Architecture-independent files.
datadir = ${prefix}/share

# Header files.
includedir = ${prefix}/include

# GNU .info* files.
infodir = ${prefix}/info

# Unix man pages.
manext = 1
mandir = ${prefix}/man/man$(manext)

# TeX system-specific directories. Not all of the following are relevant
# for all programs, but it seems cleaner to collect everything in one place.

# The default paths are now in kpathsea/texmf.in. Passing all the
# paths to sub-makes can make the arg list too long on system V.
# Note that if you make changes below, you will have to make the
# corresponding changes to texmf.in or texmf.cnf yourself.

# The root of the main tree.
texmf = c:/usr/local/share/texmf

# The directory used by varfonts.
vartexfonts = c:/var/tex/fonts

# Regular input files.
texinputdir = $(texmf)/tex
mfinputdir = $(texmf)/metafont
mpinputdir = $(texmf)/metapost
mftinputdir = $(texmf)/mft

# dvips's epsf.tex, rotate.tex, etc. get installed here;
# ditto for dvilj's fonts support.
dvips_plain_macrodir = $(texinputdir)/plain/dvips
dvilj_latex2e_macrodir = $(texinputdir)/latex/dvilj

# mktex.cnf, texmf.cnf, etc.
web2cdir = $(texmf)/web2c

# The top-level font directory.
fontdir = $(texmf)/fonts

# Memory dumps (.fmt/.base/.mem).
fmtdir = $(web2cdir)
basedir = $(fmtdir)
memdir = $(fmtdir)

# Pool files.
texpooldir = $(web2cdir)
mfpooldir = $(texpooldir)
mppooldir = $(texpooldir)

# Where the .map files from fontname are installed.
fontnamedir = $(texmf)/fontname

# For dvips configuration files, psfonts.map, etc.
dvipsdir = $(texmf)/dvips

# For dvips .pro files, gsftopk's render.ps, etc.
psheaderdir = $(dvipsdir)

# If a font can't be found close enough to its stated size, we look for
# each of these sizes in the order given.  This colon-separated list is
# overridden by the envvar TEXSIZES, and by a program-specific variable
# (e.g., XDVISIZES), and perhaps by a config file (e.g., in dvips).
# This list must be sorted in ascending order.
default_texsizes = 300:600

# End of paths.mk.
# common.mk -- used by all Makefiles.
SHELL = sh
MAKE=make
top_srcdir = ..
srcdir = .

WD = setargv.obj
CC = cl
CFLAGS = -nologo -O2 -MD -DWIN32=1 -DGROFF=1 $(XCFLAGS)
CPPFLAGS =  $(XCPPFLAGS)

YDEFS = -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE \
-D_CRT_OBSOLETE_NO_DEPRECATE -D_SECURE_SCL=0

DEFS = -DHAVE_CONFIG_H $(XDEFS) $(YDEFS)

# Kpathsea needs this for compiling, programs need it for linking.
LIBTOOL = $(kpathsea_srcdir_parent)/klibtool

# You can change [X]CPPFLAGS, [X]CFLAGS, or [X]DEFS, but
# please don't change ALL_CPPFLAGS or ALL_CFLAGS.
# prog_cflags is set by subdirectories of web2c.
ALL_CPPFLAGS = $(DEFS) -I. -I$(srcdir) \
  -I$(kpathsea_parent) -I$(kpathsea_srcdir_parent) \
  $(prog_cflags) $(CPPFLAGS)
ALL_CFLAGS = $(ALL_CPPFLAGS) $(CFLAGS) -c
compile = $(CC) $(ALL_CFLAGS)

.SUFFIXES:
.SUFFIXES: .c .obj # in case the suffix list has been cleared, e.g., by web2c
.c.obj:
	$(compile) $<

# Installation.
INSTALL = cp
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = $(INSTALL_PROGRAM)
INSTALL_DATA = ${INSTALL}
INSTALL_LIBTOOL_LIBS =
INSTALL_LIBTOOL_PROG =

# Creating (symbolic) links.
LN = ln

# We use these for many things.
kpathsea_parent = ..
kpathsea_dir = $(kpathsea_parent)/kpathsea
kpathsea_srcdir_parent = $(top_srcdir)/..
kpathsea_srcdir = $(kpathsea_srcdir_parent)/kpathsea
kpathsea = $(kpathsea_dir)/kpathsea620.lib

#M#ifeq ($(CC), gcc)
#M#XDEFS = -Wpointer-arith $(warn_more)
#M#CFLAGS = -pipe -g $(XCFLAGS)
#M#endif
# End of common.mk.
# programs.mk -- used by Makefiles for executables only.

# Don't include $(CFLAGS), since ld -g under Linux forces
# static libraries, e.g., libc.a and libX*.a.
LDFLAGS =  $(XLDFLAGS)

# proglib is for web2c; 
# XLOADLIBES is for the installer.
LIBS = 
LOADLIBES = $(proglib) $(kpathsea) $(LIBS) $(XLOADLIBES)

# May as well separate linking from compiling, just in case.
CCLD = $(CC)
link_command = $(CCLD) -Fe$@ $(LDFLAGS) 

# When we link with Kpathsea, have to take account that it might be a
# shared library, etc.
kpathsea_link = $(link_command)
# End of programs.mk.
# web2c/kpathsea.mk -- In subdirectories of web2c, the build directory
# for kpathsea is one more level up.  c_auto_h_dir is used by make depend.
kpathsea_parent = ../..
c_auto_h_dir = ..

prog_cflags = -I.. -I$(srcdir)/..
# End of web2c/kpathsea.mk.

proglib = ../lib/lib.lib
# programs = dmp.exe mpto.exe newer.exe makempx
#
#
#
programs = dmp.exe mpto.exe newer.exe makempx.exe \
           makempx-without-g-prefix.exe

default: all
all: $(programs) 

dmp.exe: dmp.obj dmp_ffile.obj $(kpathsea)
	$(kpathsea_link) dmp.obj dmp_ffile.obj $(WD) $(LOADLIBES)
mpto.exe: mpto.obj $(kpathsea)
	$(link_command) mpto.obj $(WD) $(LIBS) $(LOADLIBES)
newer.exe: newer.obj $(kpathsea)
	$(link_command) newer.obj $(WD) $(LIBS) $(LOADLIBES)
makempx.exe: makempx.obj $(kpathsea)
	$(link_command) makempx.obj $(WD) $(LIBS) $(LOADLIBES)
makempx-without-g-prefix.exe: makempx-without-g-prefix.obj $(kpathsea)
	$(link_command) makempx-without-g-prefix.obj $(WD) $(LIBS) $(LOADLIBES)
#makempx: makempx.in Makefile.in
#	sed -e 's,@BINDIR@,$(bindir),g' -e 's,@web2cver@,7.3.1,g' \
#	    <$(srcdir)/makempx.in >$@

newer.obj dmp.obj: ../w2c/c-auto.h

checkdir = $(srcdir)/../check
check: mpto makempx newer dmp
	makempx $(checkdir)/label.mp ../check/xlabel.mpx
	./mpto -tex $(checkdir)/testex.mp | diff $(checkdir)/testex.tex -
	sed '16s/^%//' <$(checkdir)/testex.mp >testex1
	-mpto -tex testex1 >/dev/null 2>testex2
	sed '17s/^%//' <$(checkdir)/testex.mp >testex1
	-mpto -tex testex1 >/dev/null 2>>testex2
	sed '18s/^%//' <$(checkdir)/testex.mp >testex1
	-mpto -tex testex1 >/dev/null 2>>testex2
	sed '19s/^%//' <$(checkdir)/testex.mp >testex1
	-mpto -tex testex1 >/dev/null 2>>testex2
	sed '20s/^%//' <$(checkdir)/testex.mp >testex1
	-mpto -tex testex1 >/dev/null 2>>testex2
	diff $(checkdir)/testex.err testex2

install: install-exec install-data
install-exec: $(programs)
	echo $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) $(scriptdir)
	echo for p in mpto newer; do $(INSTALL_PROGRAM) $$p $(bindir)/$$p; done
	echo $(INSTALL_LIBTOOL_PROG) $(bindir) dmp
	echo $(INSTALL_SCRIPT) makempx $(scriptdir)/makempx
install-data:
	echo do nothing.

# tkpathsea.mk -- target for remaking kpathsea.
makeargs = $(MFLAGS) CC='$(CC)' CFLAGS='$(CFLAGS)' $(XMAKEARGS)

# This is wrong: the library doesn't depend on kpsewhich.c or
# acconfig.h.  But what to do?
$(kpathsea): $(kpathsea_srcdir)/*.c $(kpathsea_srcdir)/*.h
	cd $(kpathsea_dir) && $(MAKE) $(makeargs)
# End of tkpathsea.mk.

clean::
	rm -f *.exe *.obj *~

# Let's stick a rule for TAGS here, just in case someone wants them.
# (We don't put them in the distributions, to keep them smaller.)
TAGS: *.c *.h
	pwd | grep kpathsea >/dev/null && append=../kpathsea/TAGS; \
	  etags $$append *.[ch]

# Prevent GNU make 3.[59,63) from overflowing arg limit on system V.
.NOEXPORT:

# End of rdepend.mk.
dmp.obj: dmp.c ../w2c/config.h $(kpathsea_srcdir)/config.h \
 $(kpathsea_dir)/c-auto.h $(kpathsea_srcdir)/c-std.h \
 $(kpathsea_srcdir)/c-unistd.h \
 $(kpathsea_srcdir)/systypes.h \
 $(kpathsea_srcdir)/c-memstr.h \
 $(kpathsea_srcdir)/c-errno.h \
 $(kpathsea_srcdir)/c-minmax.h $(kpathsea_srcdir)/c-limits.h \
 $(kpathsea_srcdir)/c-proto.h $(kpathsea_srcdir)/debug.h \
 $(kpathsea_srcdir)/types.h $(kpathsea_srcdir)/lib.h $(kpathsea_srcdir)/progname.h \
 ../w2c/c-auto.h $(kpathsea_srcdir)/c-fopen.h \
 $(kpathsea_srcdir)/tex-file.h \
 $(kpathsea_srcdir)/c-ctype.h \
 $(kpathsea_srcdir)/c-pathch.h
mpto.obj: mpto.c ../w2c/c-auto.h 
newer.obj: newer.c ../w2c/c-auto.h 
makempx.obj: makempx.c ../w2c/c-auto.h
makempx-without-g-prefix.obj: makempx-without-g-prefix.c ../w2c/c-auto.h
dmp_ffile.obj: dmp_ffile.c ../w2c/c-auto.h
