## Makefile for MiKTeX Utilities (Win32 version)	-*- Makefile -*-
## Time-stamp: "97/08/04 00:10:58 mik"

!include ..\miktex.inc

srcdir = .
configdir = $(prefix)\miktex\config

vftovp_web = vftovp.web
vptovf_web = vptovf.web

.c.obj:
	$(CC) -c -I$(srcdir) -I$(libdir) -DMIKTEX_DLL $(release_info) \
		-MD -O2 $(cflags) $(CFLAGS) $<

all: vftovp.exe vptovf.exe MakeTeXPK.exe MakeTeXTFM.exe MakeTeXFMT.exe \
		configure.exe

vftovp.exe: vftovp.obj $(libdir)\miktex.lib vftovp.res
	link $(ldflags) $(LDFLAGS) -out:$@ $**

vftovp.res: vftovp.rc $(libdir)\miktex.version $(libdir)\version.h
	rc -I$(libdir) vftovp.rc

vftovp.c vftovp.h: vftovp.p
	$(C4P) $(C4PFLAGS) --rename link --rename index \
		--include-filename=miktex.h --one=vftovp vftovp.p

vftovp.p: $(vftovp_web) vftovp.win32-changes
	$(TANGLE) $(vftovp_web) $(srcdir)\vftovp.win32-changes vftovp.p nul

vptovf.exe: vptovf.obj $(libdir)\miktex.lib vptovf.res
	link $(ldflags) $(LDFLAGS) -out:$@ $**

vptovf.res: vptovf.rc $(libdir)\miktex.version $(libdir)\version.h
	rc -I$(libdir) vptovf.rc

vptovf.c vptovf.h: vptovf.p
	$(C4P) $(C4PFLAGS) --rename link --rename index \
		--include-filename=miktex.h --one=vptovf vptovf.p

vptovf.p: $(vptovf_web) vptovf.win32-changes
	$(TANGLE) $(vptovf_web) $(srcdir)\vptovf.win32-changes vptovf.p nul

MakeTeXTFM.exe: MakeTeXTFM.obj $(libdir)\miktex.lib MakeTeXTFM.res
	link $(ldflags) $(LDFLAGS) -out:$@ $**

MakeTeXTFM.res: MakeTeXTFM.rc $(libdir)\miktex.version $(libdir)\version.h
	rc -I$(libdir) MakeTeXTFM.rc

configure.exe: configure.obj $(libdir)\miktex.lib configure.res
	link $(ldflags) $(LDFLAGS) -out:$@ $** ..\lib\miktex.lib advapi32.lib

configure.res: configure.rc $(libdir)\miktex.version $(libdir)\version.h
	rc -I$(libdir) configure.rc

MakeTeXFMT.exe: MakeTeXFMT.obj $(libdir)\miktex.lib MakeTeXFMT.res
	link $(ldflags) $(LDFLAGS) -out:$@ $**

MakeTeXFMT.res: MakeTeXFMT.rc $(libdir)\miktex.version $(libdir)\version.h
	rc -I$(libdir) MakeTeXFMT.rc

MakeTeXPK.exe: MakeTeXPK.obj $(libdir)\miktex.lib MakeTeXPK.res
	link $(ldflags) $(LDFLAGS) -out:$@ $**

MakeTeXPK.res: MakeTeXPK.rc $(libdir)\miktex.version $(libdir)\version.h
	rc -I$(libdir) MakeTeXPK.rc

tex.exe: tex.obj $(libdir)\miktex.lib tex.res
	link $(ldflags) $(LDFLAGS) -out:$@ $**

tex.res: tex.rc $(libdir)\miktex.version tex.ico $(libdir)\version.h
	rc -I$(libdir) tex.rc

latex.exe: latex.obj $(libdir)\miktex.lib latex.res
	link $(ldflags) $(LDFLAGS) -out:$@ $**

latex.res: latex.rc $(libdir)\miktex.version tex.ico $(libdir)\version.h
	rc -I$(libdir) latex.rc

install: vftovp.exe vptovf.exe MakeTeXPK.exe MakeTeXTFM.exe configure.exe \
		miktex.environment MakeTeXFMT.exe \
		tex.exe	latex.exe
	$(INSTALL_DATA) miktex.environment $(configdir)\miktex.environment
	$(INSTALL_PROGRAM) configure.exe $(configdir)\configure.exe
	$(INSTALL_PROGRAM) vftovp.exe $(bindir)\vftovp.exe
	$(INSTALL_PROGRAM) vptovf.exe $(bindir)\vptovf.exe
	$(INSTALL_PROGRAM) MakeTeXTFM.exe $(bindir)\MakeTeXTFM.exe
	$(INSTALL_PROGRAM) MakeTeXPK.exe $(bindir)\MakeTeXPK.exe
	$(INSTALL_PROGRAM) MakeTeXFMT.exe $(bindir)\MakeTeXFMT.exe
	$(INSTALL_PROGRAM) tex.exe $(bindir)\tex.exe
	$(INSTALL_PROGRAM) latex.exe $(bindir)\latex.exe

uninstall:

mostlyclean:
	-del *.obj
	-del vftovp.c
	-del vftovp.h
	-del vptovf.c
	-del vptovf.h
	-del *.p
	-del *.res

clean: mostlyclean
	-del *.exe
	-del *.pdb
	-del *.ilk

distclean: clean
	-del *.opt
	-del makefile.win32.bak

realclean: distclean

depend: configure.c MakeTeXPK.c MakeTeXTFM.c MakeTeXFMT.c \
		vftovp.c vptovf.c
	makedepend -f makefile.win32 -I. -I..\lib $**

# DO NOT DELETE

configure.obj: ..\lib/getopt.h ..\lib/miktex.h ..\lib/c4plib.h configure.rc
configure.obj: ..\lib/miktex.version ..\lib/version.h
MakeTeXPK.obj: ..\lib/getopt.h ..\lib/miktex.h ..\lib/c4plib.h MakeTeXPK.rc
MakeTeXPK.obj: ..\lib/miktex.version ..\lib/version.h
MakeTeXTFM.obj: ..\lib/getopt.h ..\lib/miktex.h ..\lib/c4plib.h MakeTeXTFM.rc
MakeTeXTFM.obj: ..\lib/miktex.version ..\lib/version.h
MakeTeXFMT.obj: ..\lib/getopt.h ..\lib/miktex.h ..\lib/c4plib.h MakeTeXFMT.rc
MakeTeXFMT.obj: ..\lib/miktex.version ..\lib/version.h
vftovp.obj: ..\lib/miktex.h ..\lib/c4plib.h vftovp.h
vptovf.obj: ..\lib/miktex.h ..\lib/c4plib.h vptovf.h
