#
#  Makefile for mp, the PostScript pretty printer.
#
#  @(#)Makefile.dist 1.1 90/08/29
#
#  Copyright (c) Steve Holden and Rich Burridge.
#                All rights reserved.
#
#  Permission is given to distribute these sources, as long as the
#  copyright messages are not removed, and no monies are exchanged.
#
#  No responsibility is taken for any errors inherent either
#  to the comments or the code of this program, but if reported
#  to me then an attempt will be made to fix them.
#
#=====================================================================
#
#  It is possible to change the location of the mp prologue file
#  with the -p command line option. It can also be defined at compile
#  time, by uncommenting the macro definition below and setting
#  appropriately. If it's not present, then a sensible default value
#  is used.
#
PROLOGUE = -DPROLOGUE=\"$(LIBDIR)\"
#---------------------------------------------------------------------
#  Not all machines have the index() string library function. If you
#  don't have this function then you should uncomment the NOINDEX
#  definition below.
#
#NOINDEX         = -DNOINDEX
#=====================================================================
#
#  Default locations where mp files will be installed.
#  You might wish to alter these values.
#
BINDIR   = /contrib/system/bin
LIBDIR   = /contrib/share/lib/mp
MANDIR   = /contrib/share/man/man$(MANSECT)
MANSECT  = 1
#
#  Compilation flags and standard macro definitions.
#
CFLAGS   = -g $(NOINDEX) $(PROLOGUE)
LDFLAGS  =
#=================================================================

.KEEPSTATE:

BINARIES = mp

SRCS     = header.c io.c main.c misc.c print.c
OBJS     = header.o io.o main.o misc.o print.o

HDRS     = extern.h mp.h patchlevel.h
OTHERS   = README Makefile.dist mailp mp.1 \
	   MANIFEST FILES CHANGES TODO \
	   mp.el mp.pro.ps mp.pro.alt.ps mp.pro.filofax.ps \
	   mp.pro.timeman.ps Data

SFILES1  = $(SRCS) $(HDRS) README MANIFEST FILES CHANGES TODO
SFILES2  = Makefile.dist mailp mp.1 mp.el Data \
	   mp.pro.ps mp.pro.alt.ps mp.pro.filofax.ps mp.pro.timeman.ps

all:       $(BINARIES)

mp:        $(OBJS)
	   cc $(LDFLAGS) -o mp $(OBJS)

install:   $(BINARIES)
	   install -c -m 751 mp $(BINDIR)
	   install -c -m 644 mp.1 $(MANDIR)/mp.$(MANSECT)
	   install -c -m 644 mp.pro.ps $(LIBDIR)
	   install -c -m 644 mp.pro.filofax.ps $(LIBDIR)
	   install -c -m 644 mp.pro.timeman.ps $(LIBDIR)

clean:;    rm -rf mp *.o core

create:    SCCS
	   -sccs create $(SRCS) $(OTHERS)

lint:;     lint $(SRCS)

shar:;     shar.script $(SFILES1) > Part1
	   shar.script $(SFILES2) > Part2

SCCS:
	   mkdir SCCS
	   chmod 755 SCCS

header.o:	mp.h extern.h
io.o:		mp.h extern.h
main.o:		mp.h
misc.o:		mp.h extern.h patchlevel.h
print.o:	mp.h extern.h
