# This program is an implementation of the ISAKMP Internet Standard.
# Copyright (C) 1997 Angelos D. Keromytis.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
# 
# This code was written while the author was in Greece, in May/June
# 1997.
#
# You may contact the author by:
#   e-mail: angelos@dsl.cis.upenn.edu
#  US-mail: Angelos D. Keromytis
#           Distributed Systems Lab
#           Computer and Information Science Department
#           University of Pennsylvania
#           Moore Building
#           200 South 33rd Street
#           Philadelphia, PA 19104	   

# Makefile by Angelos D. Keromytis (angelos@dsl.cis.upenn.edu) for
# ISAKMP/Oakley, May 1997

SHELL = /bin/sh
CC = gcc
# -O on Linux makes gcc coredump when compiling sha1.c
CFLAGS = -g #-O
CPPFLAGS = -I/usr/local/include -DPORT=7500 -DDEBUG #-DBYTE_ORDER=LITTLE_ENDIAN
ALLFLAGS = $(CPPFLAGS) $(CFLAGS)
LIBS = -L/usr/local/lib -lgmp
LDFLAGS =

BINNAME = pluto
BINNAME2 = whack

RM = /bin/rm
RMFLAGS = -f

.SUFFIXES:
.SUFFIXES: .c .o

OBJS = cookie.o log.o state.o main.o server.o timer.o ipsec_doi.o\
       kernel_comm.o demux.o rnd.o sha1.o md5.o libdeslite.o

OBJS2 = whack.o

all: $(BINNAME) $(BINNAME2)

install: all

$(BINNAME): $(OBJS)
	$(CC) -o $(BINNAME) $(LDFLAGS) $(OBJS) $(LIBS)

$(BINNAME2): $(OBJS2)
	$(CC) -o $(BINNAME2) $(OBJS2)

cleanall: clean

distclean: clean

mostlyclean: clean

realclean: clean

clean:
	$(RM) $(RMFLAGS) $(OBJS) *.core core *~ a.out ktrace.out
	$(RM) $(RMFLAGS) $(BINNAME) $(OBJS2) $(BINNAME2)
	(cd libdeslite; make clean)

.c.o:
	$(CC) $(COPTS) $(ALLFLAGS) -c $<

md5.o: md5.c md5.h
sha1.o: sha1.c sha1.h
rnd.o: rnd.c sha1.h defs.h constants.h
whack.o: whack.c constants.h
demux.o: demux.c constants.h packet.h defs.h state.h md5.h sha1.h
kernel_comm.o: kernel_comm.c constants.h
ipsec_doi.o: ipsec_doi.c constants.h state.h packet.h defs.h md5.h sha1.h
cookie.o: cookie.c constants.h defs.h sha1.h
log.o: log.c
state.o: state.c state.h constants.h defs.h
main.o: main.c
server.o: server.c defs.h constants.h state.h
timer.o: timer.c constants.h state.h defs.h
libdeslite.o:
	(cd libdeslite/; make)
	cp libdeslite/libdeslite.o libdeslite.o
