#
# @(#)Makefile	1.30 3/28/96
#
# Makefile for Privtool, by Mark Grant (mark@unicorn.com). Linux changes
# from David Summers (david@actsn.fay.ar.us) and Anders Baekgaard.
#

#
# In theory, you could have different code to replace mail_reader.c and
# x.c (e.g. for Motif, Xt, etc). In practice, that's not done yet.
#

MAIL_OBJECT = mail_reader.o $(LINUX_OBJ)
DISPLAY_OBJECT = x.o xprops.o

#
# WARNING: Currently the floppy code doesn't work properly !!!
# Use the first lines for SunOS, the second set of lines for other OSes
#

#FLOPPY_OBJECT = floppy.o
#FLOP_FILE = /dev/fd0
#FLOPPY_FLAGS = -DUSE_FLOPPY -DAUTO_EJECT -DFLOP_FILE=\"$(FLOP_FILE)\"

FLOPPY_OBJECT = 
FLOPPY_FLAGS = 
FLOP_FILE =

#
# You may need to use the first line for Solaris.
#

#MAIL_SPOOL_DIR=-DMAIL_SPOOL_DIR=\"/var/mail/\"
MAIL_SPOOL_DIR=

OFILES = pgplib.o buffers.o $(MAIL_OBJECT) messages.o main.o gui.o \
	$(DISPLAY_OBJECT) $(FLOPPY_OBJECT)

#
# Use the following lines if you don't have PGP Tools.
#
#PGPLDFLAGS=
#PGPTOOLDIR=

#
# Use the following lines if you do have PGP Tools, and set PGPTOOLDIR
# to the directory with the header files and libpgptools.a. You
# may want to simply create a link from this directory to the PGP Tools
# directory.
#
PGPTOOLDIR=./pgptools
PGPLDFLAGS=-L$(PGPTOOLDIR) -lpgptools

#
# Set the following to the path for your PGP executable - can be blank
# if using PGP Tools
#
PGPEXEC=$(HOME)/bin/pgp

#
# Set the following to the path for your Mixmaster executable, and
# Mixmaster directory.
#

MIXEXEC=$(HOME)/bin/mixmaster
MIXPATH=$(HOME)/Mix

#
# Set the version number to claim in encrypted/signed messages if using
# PGP Tools - can be blank if using PGP for everything. You'll probably
# want to set this to 2.5 now that has been released.
#
#PGPVERSION=2.3a
PGPVERSION=2.6

#
# Use the first lines if your OpenWindows files are installed in standard
# lib/include directories, or the second if they're in a tree under 
# $OPENWINHOME.
#

#OPENWINLDFLAGS=
#OPENWINCPPFLAGS=

OPENWINLDFLAGS=-L$(OPENWINHOME)/lib
OPENWINCPPFLAGS=-I$(OPENWINHOME)/include

#
# If using SunOS/Solaris, use the first definition, if using Linux use the
# second definition.
#

LDFLAGS= -Bdynamic $(OPENWINLDFLAGS) -lxview -lolgx -lX11 -lm \
	$(PGPLDFLAGS)

#LDFLAGS=$(OPENWINLDFLAGS) -lxview -lolgx -lX11 -lm $(PGPLDFLAGS) \
#	-L/usr/X11/lib

#
# If you have PGP Tools, use the first line, otherwise use the
# second. 
#
# You should modify the flags after -I$(PGPTOOLDIR) to match the
# flags you used when compiling libpgptools.a.
#
# Removing USE_HASH will save memory, but decrease performance. Using
# the public key hash table *significantly* improves the speed of
# signature verification for small messages when you have a large
# pubring.pgp.
#

PGPTOOLS=-DPGPTOOLS -DUSE_HASH -I$(PGPTOOLDIR) -DUNIX -DDYN_ALLOC \
	-DNO_ASM -DHIGHFIRST -DIDEA32 -DUSE_AUDIO
#PGPTOOLS=

#
# Define FIXED_WIDTH_FONT below to choose other than the OpenWindows
# default fixed width font.
#
#DEFAULT_FONT=-DFIXED_WIDTH_FONT=FONT_FAMILY_COUR
#DEFAULT_FONT=-DFIXED_WIDTH_FONT=\"fixed\"

#
# Define XResources below to override the default ".Xdefaults"
#
#XRESOURCES=-DXRESOURCES=\".Xresources\"

#
# Use -g for debugging, change to -O for production use. Add -DNO_MIXMASTER
# if you do not have the Mixmaster software. For Linux you will probably
# want to add -DCOMPACT, to compact the layout somewhat.
#
# If you're concerned about the icon that Privtool uses, then remove
# the -DNSA_ICON, and you may also want to add -DXSAFEMAIL. If you
# prefer the program to start up open rather than iconised, then
# add -DSTART_OPEN.
#
# If you're having problems with icons on Linux, add -DUSE_XBM. You
# must define NSA_ICON for this to work, but the other icons should
# be correct for your OS, as they are taken from the OS include files.
#
# Add -DALLOCA if you have alloca().
#
# Add -DDONT_REQUIRE_PLUS if you want all mailbox access to occur
# relative to your folder directory even if you don't put a + sign
# at the beginning of the file name.
#

#DEBUG=-g
DEBUG=-O

CFLAGS=$(DEBUG) -DPGPEXEC=\"$(PGPEXEC)\" -DPGPVERSION=\"$(PGPVERSION)\" \
	-DMIXEXEC=\"$(MIXEXEC)\" -DMIXPATH=\"$(MIXPATH)\" \
	$(DEFAULT_FONT) $(XRESOURCES) -DNSA_ICON $(MAIL_SPOOL_DIR)

#
# Note: Keep -DSAFE until you are sure of correct operation on
# your machine !
#
# The SunOS strstr() code seems to take an age, so we define SLOW_STRSTR
# to use the simple C implementation in pgplib.c. Add -DACCEPT_PATH if
# you want to support Usenet archives that use Path: instead of From,
# but be aware that this may cause problems with mail....
#

#CPPFLAGS=$(OPENWINCPPFLAGS) -DSAFE $(PGPTOOLS) -DSLOW_STRSTR $(FLOPPY_FLAGS)
CPPFLAGS=$(OPENWINCPPFLAGS) $(PGPTOOLS) -DSLOW_STRSTR $(FLOPPY_FLAGS)

#
# Code is written for gcc, but should work with cc and unproto.
#

CC=gcc
#CC=cc -DNON_ANSI

# Or, use acc or gcc for Solaris 2.x
#CC=acc -DSYSV
#CC=gcc -DSYSV

# For Linux, you should use the following :
#CC=gcc -Ilinux -DSYSV -DDONT_HAVE_TM_GMTOFF

# If using Linux, use the first line, otherwise use the second.

#LINUX_OBJ = linux/gettime.o linux/parsedate.o
LINUX_OBJ = 

#
# Following provides automatic dependencies on SunOS
#

.KEEP_STATE:

#
# Actually do the compilation...
#

all:		 privtool

privtool:	$(OFILES)
		$(CC) $(CFLAGS) $(OFILES) -o privtool $(LDFLAGS)

.c.o:	
		$(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)

clean:
		$(RM) privtool *.o

