# Makefile for PS utilities release 1 patchlevel 16
#
# Copyright (C) Angus J. C. Duggan 1991-1995
# See file LICENSE for details.
#
# updated AJCD 14/3/94
#
# Multiple makefiles for different OSes are generated from a single master
# now.
#
# There are so many incompatible makes around that putting all of the
# non-standard targets explicitly seems to be the only way of ensuring
# portability.

# epsffit fits an epsf file to a given bounding box
# psbook rearranges pages into signatures
# psselect selects page ranges
# pstops performs general page rearrangement and merging
# psnup puts multiple logical pages on one physical page
# psresize scales and moves pages to fit on different paper sizes

PAPER=a4

# Makefile for PSUtils under Windows NT, Microsoft C/C++ Compiler

BINDIR = \psutils
SCRIPTDIR = $(BINDIR)
INCLUDEDIR = \psutils\include
PERL = perl

COPT = -Zi -G3ds
CFLAGS = -DPAPER=\"$(PAPER)\" -DWINNT /W4 $(COPT)

BIN = psbook.exe psselect.exe pstops.exe epsffit.exe psnup.exe \
	psresize.exe
SHELLSCRIPTS = 
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 =      \
	    \
	    \
	    \
	  
INCLUDES = md68_0.ps md71_0.ps

all: $(BIN) $(PERLSCRIPTS) $(MANPAGES)

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

epsffit.exe: epsffit.obj pserror.obj
	link -debug:full -out:epsffit.exe pserror.obj epsffit.obj

psnup.exe: psnup.obj psutil.obj psspec.obj pserror.obj
	link -debug:full -out:psnup.exe psutil.obj psspec.obj pserror.obj psnup.obj

psnup.obj: psutil.h patchlev.h psspec.h pserror.h psnup.c

psresize.exe: psresize.obj psutil.obj pserror.obj psspec.obj
	link -debug:full -out:psresize.exe psutil.obj psspec.obj pserror.obj psresize.obj

psresize.obj: psutil.h patchlev.h psspec.h pserror.h psresize.c

psbook.exe: psbook.obj psutil.obj pserror.obj
	link -debug:full -out:psbook.exe psutil.obj pserror.obj psbook.obj

psbook.obj: psutil.h patchlev.h pserror.h psbook.c

psselect.exe: psselect.obj psutil.obj pserror.obj
	link -debug:full -out:psselect.exe psutil.obj pserror.obj psselect.obj

psselect.obj: psutil.h patchlev.h pserror.h psselect.c

pstops.exe: pstops.obj psutil.obj psspec.obj pserror.obj
	link -debug:full -out:pstops.exe psutil.obj psspec.obj pserror.obj pstops.obj

pstops.obj: psutil.h patchlev.h psspec.h pserror.h pstops.c

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) $? > $@


clean:
	del *.obj

veryclean realclean: clean
	del $(BIN) $(PERLSCRIPTS) $(MANPAGES)

install: install.bin install.script install.include

install.bin: $(BIN)
	-mkdir $(BINDIR)
	@for %1 in ( $(BIN) ) do copy %1 $(BINDIR)

install.script: $(PERLSCRIPTS)
	-mkdir $(SCRIPTDIR)
	@for %1 in ( $(PERLSCRIPTS) ) do copy %1 $(SCRIPTDIR)

install.include: $(INCLUDES)
	-mkdir $(INCLUDEDIR)
	@for %1 in ( $(INCLUDES) ) do copy %1 $(INCLUDEDIR)

Makefiles: Makefile.unix Makefile.msc Makefile.bcc Makefile.sc Makefile.nt Makefile.os2

Makefile.unix: Makefile.ppe
	perl prepare MAKE_UNIX= Makefile.ppe >Makefile.unix

Makefile.msc: Makefile.ppe
	perl prepare MAKE_DOS= MICROSOFT= Makefile.ppe >Makefile.msc

Makefile.bcc: Makefile.ppe
	perl prepare MAKE_DOS= BORLAND= Makefile.ppe >Makefile.bcc

Makefile.sc: Makefile.ppe
	perl prepare MAKE_DOS= SYMANTEC= Makefile.ppe >Makefile.sc

Makefile.wat: Makefile.ppe
	perl prepare MAKE_DOS= WATCOM= Makefile.ppe >Makefile.wat

Makefile.os2: Makefile.ppe
	perl prepare MAKE_OS2= Makefile.ppe >Makefile.os2

Makefile.nt: Makefile.ppe
	perl prepare = Makefile.ppe >Makefile.nt

tar ../psutils.tar:
	(cd ..; tar cvf psutils.tar `cat psutils/tarfiles`)
