######################################################################
# Makefile                                                 August 2005
#
# KSSLD: An implementation of SSL/TLS in the Linux Kernel
# Copyright (C) 2005  NTT COMWARE Corporation.
#
# This file based in part on code from LVS www.linuxvirtualserver.org
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#####################################################################

include ../Makefile.base

SUBDIRS =

DISTFILE = Makefile $(SSL3MAC_SRCS) $(TSSL3MAC_SRCS)

CFLAGS = $(KCFLAGS)

SSL3MAC        = ssl3mac.o
SSL3MAC_SRCS   = ssl3mac.c

TSSL3MAC       = tssl3mac.o
TSSL3MAC_SRCS  = tssl3mac.c

.PHONY: all install modules_install unintall modules_uninstallclean \
	distclean dist

all:		$(SSL3MAC) $(TSSL3MAC)
		@for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit 1; done

$(TEST_CLIENT):	$(TEST_CLIENT_OBJS)
		$(LD) -r $^ -o $@

install:	modules_install
		@for i in $(SUBDIRS); do $(MAKE) -C $$i install || exit 1; done

modules_install:
		if [ ! -d "$(MODLIB)" ]; then mkdir -p "$(MODLIB)"; fi
		install -m 600 -c $(SSL3MAC) $(TSSL3MAC) "$(MODLIB)"
		#depmod -ae -F $(KERNELSYMS) $(DEPMOD_OPTS) $(KERNELRELEASE)
		depmod -ae

uninstall:	modules_uninstall
		@for i in $(SUBDIRS); do $(MAKE) -C $$i uninstall || exit 1; \
			done

modules_uninstall:
		(cd "$(MODLIB)"; rm -f $(CORE) $(SCHEDULERS) $(APPMODS))
		rmdir "$(MODLIB)"

clean:
		rm -f *.o *~ *.bak *.orig *.rej
		@for i in $(SUBDIRS); do $(MAKE) -C $$i clean || exit 1; done

distclean:	clean

dist:
		mkdir $(DISTDIR)/
		@for i in $(SUBDIRS); do \
			$(MAKE) DISTDIR="../$(DISTDIR)/$$i" -C $$i dist \
				|| exit 1; done
		install -m 644 $(DISTFILE) $(DISTDIR)	
