#
# MITSign Makefile.
#
# Created by:	Derek Atkins <warlord@MIT.EDU>
#
# Copyright 1994 Derek A. Atkins and the Massachusetts Institute of
# Technology
#
# For copying and distribution information, please see the file
# <warlord-copyright.h>.
#

#
# Set the locations for where to find include files and libraries.
# These locations are where kerberos and hesiod (if you have it) should
# be located.
#
INCDIR= /usr/athena/include
KRBLIB= /usr/athena/lib

#
# Set the locations for where to install the client, server, and manual
#
BINDIR= /usr/athena/bin
ETCDIR= /usr/athena/etc
MANDIR= /usr/athena/man

# Comment these lines if you do not have hesiod.
HESDEF= -DHESIOD
HESLIB= -lhesiod

# Uncomment the appropriate line, depending if you have memset, memcpy, etc.
#MEMSET=
MEMSET= -DHAVE_MEMSET=1

#
# You probably do not need to adjust much below this line.
#
INCLUDES= -I$(INCDIR)
DEFINES= $(HESDEF) $(MEMSET)
LIBDIR= -L$(KRBLIB)
LIBS= -lkrb -ldes $(HESLIB) $(EXTRA_LIBS)

MAKE= make
INSTALL= install

CC=gcc -Wall
DBG= -O6
AR=ar -crus
CFLAGS= $(DBG) $(INCLUDES) $(DEFINES) $(EXTRA_INCLUDES)

SRC_COMMON= authclient.c do_pgpsign.c do_pgpsignd.c getserver.c pgpglue.c \
	readkeyfromfile.c realm_list.c recvkey.c sendkey.c serverconn.c \
	string_in_list.c verify_key.c writekeytofile.c
OBJ_COMMON= authclient.o do_pgpsign.o do_pgpsignd.o getserver.o pgpglue.o \
	readkeyfromfile.o realm_list.o recvkey.o sendkey.o serverconn.o \
	string_in_list.o verify_key.o writekeytofile.o

SRC_CLIENT= pgpsign.c
OBJ_CLIENT= pgpsign.o

SRC_SERVER= pgpsignd.c
OBJ_SERVER= pgpsignd.o

PROGS= pgpsign pgpsignd

default:
	@echo "type:"
	@echo "	make <system>"
	@echo ""
	@echo "where <system> can be:"
	@echo "	linux, netbsd, mips-ultrix, rs6000, sun4sunos5, vax_bsd43"
	@echo ""
	@echo "	or \"make all\" to try the default settings"
	@echo ""

all: $(PROGS)

libpgpsign.a: $(OBJ_COMMON)
	$(AR) libpgpsign.a $(OBJ_COMMON)

pgpsign: $(OBJ_CLIENT) libpgpsign.a
	$(CC) -o pgpsign $(CFLAGS) $(LIBDIR) $(OBJ_CLIENT) libpgpsign.a \
	$(LIBS)

pgpsignd: $(OBJ_SERVER) libpgpsign.a
	$(CC) -o pgpsignd $(CFLAFS) $(LIBDIR) $(OBJ_SERVER) libpgpsign.a \
	$(LIBS)

clean:
	rm -f *.o *~ $(PROGS)

sun4sunos5:
	$(MAKE) all EXTRA_LIBS="-lresolv -lsocket -lnsl -lucb -lelf"

mips-ultrix: all
rs6000: all
linux: all
netbsd: all
vax_bsd43: all

install: install-client install-server

install-client: pgpsign
	$(INSTALL) pgpsign $(BINDIR)
	$(INSTALL) pgpsign.1 $(MANDIR)/man1

install-server: pgpsignd
	$(INSTALL) pgpsignd $(ETCDIR)
