#
#  Makefile for mimep, the MultImedia MEssage printer.
#  (based upon the Multimedia Internet Mail Extensions)
#
#  @(#)Makefile 1.0 95/06/07
#
# Copyright (c) Mikael Cam.
#
#
#  WARNING: This Makefile uses some files of the Mp distribution.
#
#  Original Makefile for mp:
#  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.
#
#  NOTE: The following definitions are expected to be overridden by the
#        calling Makefile in the parent directory.
#
#=====================================================================
#
SYSTEM=
#
#=====================================================================
#  Mimep will extract the user's gecos field, and try to make sense of what
#  it finds. It applies various rules to do this. If this field is too long,
#  then it needs to truncate sensibly. If it's extracted N "words" or has
#  found a comma, then it stops extracting. If an ampersand is found, this
#  is expanded to the users name in capitals.
#  This option allows you to change the number of "words" that mp extracts
#  from the gecos field. By default this is 3. If needed, then it should
#  be uncommented, and set accordingly.
#
#GECOSFIELDS     = -DGECOSFIELDS=3
#---------------------------------------------------------------------
#  Mimep will extract upto a certain number of characters from the user's
#  passwd gecos field. By default, this is 40. This option allows you to
#  set this to something different. If needed, then it should be uncommented,
#  and set accordingly.
#
#GECOSLENGTH     = -DGECOSLENGTH=40
#---------------------------------------------------------------------
#  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=\"$(MPLIBDIR)\"
#---------------------------------------------------------------------
#  Mimep uses X11 to read/write it's resource files. You will need to set the
#  following two lines appropriately.
#
X11INCDIR       = -I$(OPENWINHOME)/include
X11LIBDIR       = -L$(OPENWINHOME)/lib
#---------------------------------------------------------------------
#  Alternate names for the mailp frontend
#
MAILPNAMES = mailp newsp digestp filep filofaxp franklinp \
	     proplanp timemanp timesysip timesyspp
#---------------------------------------------------------------------
#
#  Default locations where mp files will be installed.
#  You might wish to alter these values.
#
MPPATH     = /usr/local
MPBINDIR   = $(MPPATH)/bin
MPLIBDIR   = $(MPPATH)/lib/mp
MPMANDIR   = $(MPPATH)/man/man$(MPMANSECT)
MPSRC      = ../../mp
OPTSRC     = ../../common
MPMANSECT  = l
MIMEPBINDIR = $(MPBINDIR)
#---------------------------------------------------------------------
#  Compilation flags and standard macro definitions.
#
CDEFS	 = $(GECOSFIELDS) $(GECOSLENGTH) $(MIME_SUPPORT) $(X11INCDIR)
CCOMP	 = -O
CC       = gcc
CFLAGS   = $(CCOMP) $(CDEFS)
LDFLAGS  = $(X11LIBDIR)
LIBS     = -lX11

#=================================================================

.KEEP_STATE:

SRCS     = $(MPSRC)/header.c $(MPSRC)/input.c mimep.c $(OPTSRC)/option.c \
	   lineopts.c $(MPSRC)/print.c
OBJS     = header.o input.o option.o lineopts.o print.o mimep.o
HDRS     = header.h input.h mimep.h lineopts.h


mimep:	$(OBJS)
	$(CC) $(CFLAGS) -o mimep $(OBJS) $(LDFLAGS) $(LIBS)

header.o:	
	$(CC) -c $(CFLAGS) $(X11INCDIR) $(MPSRC)/header.c
input.o: 
	$(CC) -c $(CFLAGS) $(CDEFS) $(X11INCDIR) $(MPSRC)/input.c
lineopts.o:
	$(CC) -c $(CFLAGS) lineopts.c
option.o:
	$(CC) -c $(CFLAGS) $(X11INCDIR) $(OPTSRC)/option.c

print.o:
	$(CC) -c $(CFLAGS) $(CDEFS) $(MPSRC)/print.c

mimep.o:
	$(CC) -c $(CFLAGS) $(CDEFS) mimep.c


SHELL = /bin/sh

install:
	mv mimep $(MIMEPBINDIR)/mimep

clean:
	/bin/rm *.o

create:    SCCS
	-sccs create $(SRCS) $(HDRS) $(MIMEPAGES)

lint:
	lint $(CDEFS) $(SRCS)

saber:
	#load $(CDEFS) $(SRCS) $(LDFLAGS) $(LIBS)

SCCS:
	mkdir SCCS
	chmod 755 SCCS
