## Makefile for psutils (win32 version)			-*- Makefile -*-
## Time-stamp: "97/08/03 00:53:24 mik"

!include ..\miktex.inc

PERL = perl

paper = a4

scriptdir = $(bindir)
includedir = $(prefix)\psutils\base
docdir = $(prefix)\doc\psutils

.c.obj:
	$(CC) -c -I. -DPAPER=\"$(paper)\" -DWINNT \
		-MD -O2 $(cflags) $(CFLAGS) $<

BIN = psbook.exe psselect.exe pstops.exe epsffit.exe psnup.exe \
	psresize.exe

PERLSCRIPTS = fixfmps.cmd fixmacps.cmd fixpsditps.cmd fixpspps.cmd \
	fixtpps.cmd fixwfwps.cmd fixwpps.cmd fixscribeps.cmd fixwwps.cmd \
	fixdlsrps.cmd extractres.cmd includeres.cmd psmerge.cmd

MANPAGES = psbook.1 psselect.1 pstops.1 epsffit.1 psnup.1 \
	psresize.1 psmerge.1 fixscribeps.1 getafm.1 \
	fixdlsrps.1 fixfmps.1 fixmacps.1 fixpsditps.1 \
	fixpspps.1 fixtpps.1 fixwfwps.1 fixwpps.1 \
	fixwwps.1 extractres.1 includeres.1

DVIFILES = psbook.1.dvi psselect.1.dvi pstops.1.dvi epsffit.1.dvi psnup.1.dvi \
	psresize.1.dvi psmerge.1.dvi fixscribeps.1.dvi getafm.1.dvi \
	fixdlsrps.1.dvi fixfmps.1.dvi fixmacps.1.dvi fixpsditps.1.dvi \
	fixpspps.1.dvi fixtpps.1.dvi fixwfwps.1.dvi fixwpps.1.dvi \
	fixwwps.1.dvi extractres.1.dvi includeres.1.dvi
	  
INCLUDES = md68_0.ps md71_0.ps

all: $(BIN) $(PERLSCRIPTS) $(DVIFILES)

install: install.bin install.script install.include install.dvi

install.bin: $(BIN)
	@for %1 in ( $(BIN) ) do $(INSTALL_PROGRAM) %1 $(bindir)\%1

install.script: $(PERLSCRIPTS)
	@for %1 in ( $(PERLSCRIPTS) ) do $(INSTALL_PROGRAM) %1 $(scriptdir)\%1

install.include: $(INCLUDES)
	@for %1 in ( $(INCLUDES) ) do $(INSTALL_DATA) %1 $(includedir)\%1

install.dvi: $(DVIFILES)
	@for %1 in ( $(DVIFILES) ) do $(INSTALL_DATA) %1 $(docdir)\%1

epsffit.exe: epsffit.obj pserror.obj
	link  $(ldflags) -out:$@ $**

psnup.exe: psnup.obj psutil.obj psspec.obj pserror.obj
	link  $(ldflags) -out:$@ $**

psresize.exe: psresize.obj psutil.obj pserror.obj psspec.obj
	link  $(ldflags) -out:$@ $**

psbook.exe: psbook.obj psutil.obj pserror.obj
	link  $(ldflags) -out:$@ $**

psselect.exe: psselect.obj psutil.obj pserror.obj
	link  $(ldflags) -out:$@ $**

pstops.exe: pstops.obj psutil.obj psspec.obj pserror.obj
	link  $(ldflags) -out:$@ $**

psmerge.cmd: psmerge.pl
	$(PERL) maketext PERL=$(PERL) $? > $@

fixfmps.cmd: fixfmps.pl
	$(PERL) maketext PERL=$(PERL) $? > $@

fixmacps.cmd: fixmacps.pl
	$(PERL) maketext PERL=$(PERL) INCLUDE=$(includedir) $? > $@

fixpsditps.cmd: fixpsditps.pl
	$(PERL) maketext PERL=$(PERL) $? > $@

fixpspps.cmd: fixpspps.pl
	$(PERL) maketext PERL=$(PERL) $? > $@

fixscribeps.cmd: fixscribeps.pl
	$(PERL) maketext PERL=$(PERL) $? > $@

fixtpps.cmd: fixtpps.pl
	$(PERL) maketext PERL=$(PERL) $? > $@

fixwfwps.cmd: fixwfwps.pl
	$(PERL) maketext PERL=$(PERL) $? > $@

fixwpps.cmd: fixwpps.pl
	$(PERL) maketext PERL=$(PERL) $? > $@

fixwwps.cmd: fixwwps.pl
	$(PERL) maketext PERL=$(PERL) $? > $@

fixdlsrps.cmd: fixdlsrps.pl
	$(PERL) maketext PERL=$(PERL) $? > $@

extractres.cmd: extractres.pl
	$(PERL) maketext PERL=$(PERL) $? > $@

includeres.cmd: includeres.pl
	$(PERL) maketext PERL=$(PERL) INCLUDE=$(includedir) $? > $@

epsffit.1: epsffit.man
	$(PERL) maketext MAN="$(MANPAGES)" $? > $@

psnup.1: psnup.man
	$(PERL) maketext MAN="$(MANPAGES)" PAPER=$(paper) $? > $@

psresize.1: psresize.man
	$(PERL) maketext MAN="$(MANPAGES)" PAPER=$(paper) $? > $@

psbook.1: psbook.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

psselect.1: psselect.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

pstops.1: pstops.man
	$(PERL) maketext "MAN=$(MANPAGES)" PAPER=$(paper) $? > $@

psmerge.1: psmerge.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

fixfmps.1: fixfmps.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

fixmacps.1: fixmacps.man
	$(PERL) maketext "MAN=$(MANPAGES)" INCLUDE=$(INCLUDEDIR) $? > $@

fixpsditps.1: fixpsditps.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

fixpspps.1: fixpspps.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

fixscribeps.1: fixscribeps.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

fixtpps.1: fixtpps.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

fixwfwps.1: fixwfwps.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

fixwpps.1: fixwpps.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

fixwwps.1: fixwwps.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

fixdlsrps.1: fixdlsrps.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

extractres.1: extractres.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

includeres.1: includeres.man
	$(PERL) maketext "MAN=$(MANPAGES)" INCLUDE=$(INCLUDEDIR) $? > $@

getafm.1: getafm.man
	$(PERL) maketext "MAN=$(MANPAGES)" $? > $@

epsffit.1.dvi: epsffit.1
   eqn epsffit.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man epsffit.1 > $@

psnup.1.dvi: psnup.1
   eqn psnup.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man psnup.1 > $@

psresize.1.dvi: psresize.1
   eqn psresize.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man psresize.1 > $@

psbook.1.dvi: psbook.1
   eqn psbook.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man psbook.1 > $@

psselect.1.dvi: psselect.1
   eqn psselect.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man psselect.1 > $@

pstops.1.dvi: pstops.1
   eqn pstops.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man pstops.1 > $@

psmerge.1.dvi: psmerge.1
   eqn psmerge.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man psmerge.1 > $@

fixfmps.1.dvi: fixfmps.1
   eqn fixfmps.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man fixfmps.1 > $@

fixmacps.1.dvi: fixmacps.1
   eqn fixmacps.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man fixmacps.1 > $@

fixpsditps.1.dvi: fixpsditps.1
   eqn fixpsditps.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man fixpsditps.1 > $@

fixpspps.1.dvi: fixpspps.1
   eqn fixpspps.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man fixpspps.1 > $@

fixscribeps.1.dvi: fixscribeps.1
   eqn fixscribeps.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man fixscribeps.1 > $@

fixtpps.1.dvi: fixtpps.1
   eqn fixtpps.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man fixtpps.1 > $@

fixwfwps.1.dvi: fixwfwps.1
   eqn fixwfwps.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man fixwfwps.1 > $@

fixwpps.1.dvi: fixwpps.1
   eqn fixwpps.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man fixwpps.1 > $@

fixwwps.1.dvi: fixwwps.1
   eqn fixwwps.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man fixwwps.1 > $@

fixdlsrps.1.dvi: fixdlsrps.1
   eqn fixdlsrps.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man fixdlsrps.1 > $@

extractres.1.dvi: extractres.1
   eqn extractres.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man extractres.1 > $@

includeres.1.dvi: includeres.1
   eqn includeres.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man includeres.1 > $@

getafm.1.dvi: getafm.1
   eqn getafm.1 | tbl | troff -Tdvi -man | grodvi > $@
#groff -Tdvi -man getafm.1 > $@

mostlyclean:
	-del *.obj

clean: mostlyclean
	-del $(BIN)
	-del $(PERLSCRIPTS)
	-del $(MANPAGES)
	-del $(DVIFILES)
	-del *.ilk
	-del *.pdb

distclean: clean
	-del *.opt

realclean:

##

psutil.obj: psutil.h patchlev.h pserror.h psutil.c
psspec.obj: psutil.h patchlev.h psspec.h pserror.h psspec.c
pserror.obj: psutil.h patchlev.h pserror.h pserror.c
epsffit.obj: epsffit.c pserror.h patchlev.h
psnup.obj: psutil.h patchlev.h psspec.h pserror.h psnup.c
psresize.obj: psutil.h patchlev.h psspec.h pserror.h psresize.c
psbook.obj: psutil.h patchlev.h pserror.h psbook.c
psselect.obj: psutil.h patchlev.h pserror.h psselect.c
pstops.obj: psutil.h patchlev.h psspec.h pserror.h pstops.c
