#######################################################################
#
#  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>
#
#######################################################################

if DEBUG
TARGET_CFG = Debug
else
TARGET_CFG = Release
endif

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

Module_CSFILES = $(srcdir)/Debug.cs
Module_KEYFILE = $(srcdir)/c-sharp-utilities.snk
Module_CSFILES_CSC := $(subst /,$(SEP),$(Module_CSFILES))
Module_INCLUDES =
Module_RESOURCES =
Module_FLAGS = $(CSC_LIBFLAG)
Module_LIBS = System.dll System.Data.dll System.Security.dll $(SYSTEM_XML)
Module_LIBPATH =

EXTRA_DIST = $(Module_CSFILES) $(Module_KEYFILE)

CUR_DIR := $(shell pwd)

all: Novell.Security.Utilities.dll

Novell.Security.Utilities.dll: $(Module_CSFILES) $(Module_RESOURCES)
	$(mkinstalldirs) bin/$(TARGET_CFG)
if WINDOWS
	$(CSC) /nowarn:1591,1573,1572 /out:bin/$(TARGET_CFG)/$@ $(CSCFLAGS) $(Module_FLAGS) $(Module_LIBS:%=/r:%) $(Module_LIBPATH:%=/lib:%) $(Module_CSFILES_CSC) /doc:Novell.Security.Utilities.doc.xml
else	
	$(CSC) /nowarn:1591,1573,1572 /out:bin/$(TARGET_CFG)/$@ $(CSCFLAGS) $(Module_FLAGS) /keyfile:$(Module_KEYFILE) $(Module_LIBS:%=/r:%) $(Module_LIBPATH:%=/lib:%) $(Module_CSFILES_CSC) /doc:Novell.Security.Utilities.doc.xml
endif

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

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

#installcheck-local: install
#	$(mkinstalldirs) $(DESTDIR)$(libdir)
#	$(INSTALL_PROGRAM) $(DESTDIR)$(libdir)
#	cd $(DESTDIR)$(libdir); $(MONO)
	
CLEAN_FILES = bin/$(TARGET_CFG)/Novell.Security.Utilities.dll /doc:Novell.Security.Utilities.doc.xml

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

distclean-local:

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