#!make -f
#
#          Copyright (c) mjh-EDV Beratung, 1996-1998
#     mjh-EDV Beratung - 63263 Neu-Isenburg - Rosenstrasse 12
#          Tel +49 6102 328279 - Fax +49 6102 328278
#                Email info@mjh.teddy-net.com
#
#       Author: Jordan Hrycaj <jordan@mjh.teddy-net.com>
#
#   $Id: Makefile,v 1.6 1999/01/27 21:07:54 jordan Exp $
#
#   This library is free software; you can redistribute it and/or
#   modify it under the terms of the GNU Library General Public
#   License as published by the Free Software Foundation; either
#   version 2 of the License, or (at your option) any later version.
#
#   This library 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
#   Library General Public License for more details.
#
#   You should have received a copy of the GNU Library General Public
#   License along with this library; if not, write to the Free
#   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#


TOP  = ../..

include $(TOP)/nessus.tmpl

## MAKF = Makefile
XTRA =  rnd-pool.o
CPHS =  twofish.o blowfish.o des.o md5.o rmd160.o sha1.o
STRM =  cbc-frame.o iostream.o
OBJS = 	peks-setup.o peks-baseXX.o peks-file.o peks-handshake.o \
	messages.o peks-client.o peks-server.o hostnames.o baseXX.o \
	smallprime.o crandom.o cipher.o make-primes.o \
	$(RNDM) $(CPHS) $(STRM) $(XTRA)

OLIB = libnessusc

all : $(OLIB).so

.SUFFIXES: .o .c

.c.o:
	$(TOP)/libtool $(CC) $(DEFS) $(include) $(CFLAGS) -c $<

# on some gcc, the optimiser + debugging g make problems
twofish.o: twofish.c
	$(TOP)/libtool $(CC) $(DEFS) $(include) -c twofish.c

$(OBJS): peks.h iostream.h common-stuff.h peks-internal.h $(MAKF)

$(OLIB).so: $(OBJS)
	$(TOP)/libtool $(CC) -o $(OLIB).la $(OBJS:.o=.lo) -rpath $(rpath)
	@cp .libs/$(OLIB).so* .libs/$(OLIB).a ${rootdir}/libs/

install : .libs/libnessusc.so.0.0.0
	@echo 'cp .libs/$(OLIB).* $(lib_dir)'
	@cp .libs/$(OLIB).* $(lib_dir)

clean :
	@rm -f *.o *.lo *.la .libs/[!C][!V]*

distclean : clean
	@rm -f *~ *.bak *.swp


# -----------------------
# dependencies
# -----------------------

.PRECIOUS: peks-internal.h peks-baseXX.h cbc-frame.h
peks-internal.h: peks.h
peks-baseXX.h: baseXX.h cipher.h
cbc-frame.h: cipher.h iostream.h 

# -------------------------------------
# inherited sources (mostly from gnupg)
# -------------------------------------

random.o rndlinux.o rndunix.o: rnd-port.h
des.o twofish.o blowfish.o sha1.o md5.o rmd160.o: raw-port.h

# -----------------------
# other dependencies
# -----------------------

make-primes.o: peks-baseXX.h crandom.h
cbc-frame.o: cbc-frame.h
cipher.o: cipher.h
iostream.o: iostream.h
crandom.o: crandom.h
rnd-pool.o: rnd-pool.h

peks-baseXX.o: peks-baseXX.h crandom.h cipher.h
peks-file.o: peks.h messages.h peks-baseXX.h
peks-random.o: peks-baseXX.h crandom.h
messages.o: messages.h

peks-handshake.o: peks-baseXX.h version.h
peks-setup.o: messages.h cipher.h peks-baseXX.h make-primes.h version.h
peks-server.o: messages.h cbc-frame.h baseXX.h crandom.h peks-internal.h version.h
peks-client.o: messages.h cbc-frame.h baseXX.h crandom.h peks-internal.h version.h
