#######################################################################
#
#  Copyright (C) 2006 Novell, Inc.
#
#  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., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
#######################################################################

SUBDIRS = 
DIST_SUBDIRS = 

EXTRA_DIST = 

ROOT = ../..
LIB = lib

LIBDIR = $(ROOT)/$(LIB)
LOG4J_JARS_DIR = ../../Svc/external/log4j/logging-log4j-1.2.14/dist/lib

JAVAC= javac

MODULE_NAME = CasaJaasSupport
MODULE_EXT = jar

JAVAFILES = ../src/com/novell/casa/jaas/CasaLoginModule.java \
	../src/com/novell/casa/jaas/CasaPrincipal.java

BUILDDIR = ../build

CLASSES = $(addprefix $(BUILDDIR)/, $(JAVAFILES:%.java=%.class))

LIBS = $(LOG4J_JARS_DIR)/log4j-1.2.14.jar
CLASSPATH = $(LIBDIR)/java/CasaAuthToken.jar;$(LIBS)

CUR_DIR := $(shell pwd)

all: $(BUILDDIR)/$(MODULE_NAME).$(MODULE_EXT)

$(BUILDDIR)/%.class: %.java
	@echo [======== Compiling $@ ========]
	$(JAVAC) -g -sourcepath ../src -classpath "$(CLASSPATH)" -d $(BUILDDIR)/classes $<

$(BUILDDIR)/$(MODULE_NAME).$(MODULE_EXT): $(BUILDDIR) $(CLASSES)
	@echo [======== Jarring $@ ========]
	jar cvf $(BUILDDIR)/$(MODULE_NAME).$(MODULE_EXT) -C $(BUILDDIR)/classes .
	cp $(BUILDDIR)/$(MODULE_NAME).$(MODULE_EXT) $(LIBDIR)/java/

$(BUILDDIR):
	[ -d $(BUILDDIR) ] || mkdir -p $(BUILDDIR)
	[ -d $(BUILDDIR)/classes ] || mkdir -p $(BUILDDIR)/classes
	[ -d $(LIBDIR) ] || mkdir -p $(LIBDIR)
	[ -d $(LIBDIR)/java ] || mkdir -p $(LIBDIR)/java

install-exec-local:

uninstall-local:

#installcheck-local: install

clean-local:
	if [ -d $(BUILDDIR) ]; then  rm -rf $(BUILDDIR); fi
	if [ -f $(LIBDIR)/java/$(MODULE_NAME).$(MODULE_EXT) ]; then  rm -f $(LIBDIR)/java/$(MODULE_NAME).$(MODULE_EXT); fi

distclean-local:

maintainer-clean-local:
	rm -f Makefile.in
	rm -f Makefile

