#######################################################################
#
#  Copyright (C) 2004 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.
#
#  Author: Juan Carlos Luciani <jluciani@novell.com>
#
#######################################################################

# handle Mono secondary dependencies
export MONO_PATH := $(MONO_PATH)

lcredmgr_CSFILES = $(srcdir)/lextend.cpp $(srcdir)/lcredmgr.cpp 
lcredmgr_CSFILES_CSC := $(subst /,$(SEP),$(lcredmgr_CSFILES))
lcredmgr_INCLUDES =
lcredmgr_RESOURCES =
lcredmgr_FLAGS = $(CSC_LIBFLAG)
lcredmgr_LIBS =
lcredmgr_LIBPATH =

EXTRA_DIST = $(lcredmgr_CSFILES)

CUR_DIR := $(shell pwd)

all: lcredmgr.dll

devenv:
	@if ! test -x "$(VSINSTALLDIR)/devenv.exe"; then echo "Error: Microsoft Visual Studio .NET is currently required to build MSI and MSM packages"; exit 1; fi

lcredmgr.dll: $(lcredmgr_CSFILES) $(lcredmgr_RESOURCES) devenv
	@rm -f $(MSM_LOG_FILE) $@
	@CMD='"$(VSINSTALLDIR)/devenv.exe" ../LoginCapture.sln /build $(DEVENV_CONFIGURATION) /project lcredmgr /out build.log'; \
	echo $$CMD; \
	if eval $$CMD; then \
		ls -l bin/$(DEVENV_CONFIGURATION)/lcredmgr.dll; \
	else \
		grep -a "ERROR:" build.log; \
	fi

install-exec-local: Novell.Security.lcredmgr.dll
	$(mkinstalldirs) $(DESTDIR)$(libdir)
	$(INSTALL_PROGRAM) bin/$(DEVENV_CONFIGURATION)/lcredmgr.dll $(DESTDIR)$(libdir)/

uninstall-local:
	cd $(DESTDIR)$(libdir); rm -f lcredmgr.dll
	rmdir $(DESTDIR)$(libdir)

#installcheck-local: install
#	$(mkinstalldirs) $(DESTDIR)$(libdir)
#	$(INSTALL_PROGRAM) $(DESTDIR)$(libdir)
#	cd $(DESTDIR)$(libdir); $(MONO)
	
CLEAN_FILES = bin/$(DEVENV_CONFIGURATION)/lcredmgr.dll ../Common/$(DEVENV_CONFIGURATION)/lcredmgr.dll

clean-local:
	rm -rf *.dbg *.exe *.dll $(CLEAN_FILES) $(COMMON_CLEAN_FILES)

distclean-local:

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