#
# W32TeX Makefile
#
SHELL = sh
MAKE=make
top_srcdir = ..
srcdir = .

XDEFS = -DWIN32=1
CC = cl
CFLAGS = -nologo -O2 -MD $(XCFLAGS)
CPPFLAGS = -I../../ptexenc $(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)

# 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}

# Creating copies.
LN = cp

# 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)/kpathsealib.lib

#
#
AR = lib
ARFLAGS = -out:

# 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)/..

library = lib

# We don't make `texmfmp.obj', since TeX, Metafont, and MetaPost need to
# use different routine names, hence they need different .obj files. Maybe
# we should change this via #define's someday ...
objects = alloca.obj basechsuffix.obj chartostring.obj coredump.obj \
  eofeoln.obj fprintreal.obj inputint.obj input2int.obj main.obj \
  openclose.obj printversion.obj setupvar.obj uexit.obj usage.obj \
  version.obj zround.obj

ptexobjects = alloca.obj basechsuffix.obj chartostring.obj coredump.obj \
  eofeoln.obj fprintreal.obj inputint.obj input2int.obj main.obj \
  ptexopenclose.obj ptexprintversion.obj setupvar.obj uexit.obj usage.obj \
  version.obj zround.obj

default all: $(library).lib ptexlib.lib
$(library).lib: $(objects)
	rm -f $@
	$(AR) $(ARFLAGS)$@ $(objects)

ptexlib.lib: $(ptexobjects)
	rm -f $@
	$(AR) $(ARFLAGS)$@ $(ptexobjects)

# Do not use CPPFLAGS for this, because including config.h might
# result in a conflicting decl of xmalloc. How annoying.
alloca.obj: alloca.c 
	$(CC) $(CFLAGS) -c $(srcdir)/alloca.c

# clean.mk -- cleaning.

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

# End of clean.mk.

# 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:

#
# dependencies
#
# DO NOT DELETE

alloca.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/win32lib.h ../w2c/c-auto.h \
 ../w2c/config.h
basechsuffix.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/win32lib.h ../w2c/c-auto.h \
 ../w2c/config.h ../lib/lib.h
chartostring.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/win32lib.h ../w2c/c-auto.h \
 ../w2c/config.h ../lib/lib.h
coredump.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/win32lib.h ../w2c/c-auto.h \
 ../w2c/config.h
eofeoln.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/win32lib.h ../w2c/c-auto.h \
 ../w2c/config.h ../lib/lib.h
fprintreal.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/win32lib.h ../w2c/c-auto.h \
 ../w2c/config.h ../lib/lib.h
input2int.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/win32lib.h ../w2c/c-auto.h \
 ../w2c/config.h ../lib/lib.h
inputint.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/win32lib.h ../w2c/c-auto.h \
 ../w2c/config.h ../lib/lib.h
main.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/win32lib.h ../w2c/c-auto.h \
 ../w2c/config.h ../lib/lib.h
openclose.obj: ../../kpathsea/absolute.h ../../kpathsea/c-auto.h \
 ../../kpathsea/c-ctype.h ../../kpathsea/c-errno.h ../../kpathsea/c-fopen.h \
 ../../kpathsea/c-limits.h ../../kpathsea/c-memstr.h \
 ../../kpathsea/c-minmax.h ../../kpathsea/c-pathch.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/tex-file.h ../../kpathsea/types.h ../../kpathsea/variable.h \
 ../../kpathsea/win32lib.h ../w2c/c-auto.h ../w2c/config.h ../lib/lib.h

ptexopenclose.obj: openclose.c ../../kpathsea/absolute.h \
 ../../kpathsea/c-auto.h ../../kpathsea/c-ctype.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-pathch.h ../../kpathsea/c-proto.h ../../kpathsea/c-std.h \
 ../../kpathsea/c-unistd.h ../../kpathsea/config.h ../../kpathsea/debug.h \
 ../../kpathsea/hash.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/str-list.h ../../kpathsea/str-llist.h \
 ../../kpathsea/systypes.h ../../kpathsea/tex-file.h ../../kpathsea/types.h \
 ../../kpathsea/variable.h ../../kpathsea/win32lib.h ../w2c/c-auto.h \
 ../w2c/config.h lib.h
	$(compile) -DKANJI=1 -DPTEX=1 -Fo$@ openclose.c

printversion.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/version.h ../../kpathsea/win32lib.h \
 ../w2c/c-auto.h ../w2c/config.h ../lib/lib.h

ptexprintversion.obj: printversion.c ../../kpathsea/c-auto.h \
 ../../kpathsea/c-errno.h ../../kpathsea/c-fopen.h \
 ../../kpathsea/c-limits.h ../../kpathsea/c-memstr.h \
 ../../kpathsea/c-minmax.h ../../kpathsea/c-proto.h ../../kpathsea/c-std.h \
 ../../kpathsea/c-unistd.h ../../kpathsea/config.h ../../kpathsea/debug.h \
 ../../kpathsea/hash.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/str-list.h ../../kpathsea/str-llist.h \
 ../../kpathsea/systypes.h ../../kpathsea/types.h ../../kpathsea/version.h \
 ../../kpathsea/win32lib.h ../w2c/c-auto.h ../w2c/config.h lib.h
	$(compile) -DKANJI=1 -DPTEX=1 -Fo$@ printversion.c

setupvar.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/variable.h ../../kpathsea/win32lib.h \
 ../w2c/c-auto.h ../w2c/config.h ../lib/lib.h
uexit.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/win32lib.h ../w2c/c-auto.h \
 ../w2c/config.h
usage.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/win32lib.h ../w2c/c-auto.h \
 ../w2c/config.h
version.obj: ../w2c/c-auto.h
zround.obj: ../../kpathsea/c-auto.h ../../kpathsea/c-errno.h \
 ../../kpathsea/c-fopen.h ../../kpathsea/c-limits.h \
 ../../kpathsea/c-memstr.h ../../kpathsea/c-minmax.h \
 ../../kpathsea/c-proto.h ../../kpathsea/c-std.h ../../kpathsea/c-unistd.h \
 ../../kpathsea/config.h ../../kpathsea/debug.h ../../kpathsea/hash.h \
 ../../kpathsea/knj.h ../../kpathsea/lib.h ../../kpathsea/progname.h \
 ../../kpathsea/simpletypes.h ../../kpathsea/str-list.h \
 ../../kpathsea/str-llist.h ../../kpathsea/systypes.h \
 ../../kpathsea/types.h ../../kpathsea/win32lib.h ../w2c/c-auto.h \
 ../w2c/config.h ../lib/lib.h
