Index: /indexers/trunk/lucene-gs/winMake.bat
===================================================================
--- /indexers/trunk/lucene-gs/winMake.bat	(revision 19523)
+++ /indexers/trunk/lucene-gs/winMake.bat	(revision 19524)
@@ -18,4 +18,9 @@
 set MYCLASSPATH=%LUCENE_JAR%;%JAVACLASSDIR%
 
+if "%DEBUG%" == "" (
+  set MAKE_VARS=DEBUG=0
+) else (
+  set MAKE_VARS=DEBUG=%DEBUG%
+)
 
 if ""%1"" == """" goto all
Index: /indexers/trunk/mg/java/org/greenstone/mg/winMake.bat
===================================================================
--- /indexers/trunk/mg/java/org/greenstone/mg/winMake.bat	(revision 19523)
+++ /indexers/trunk/mg/java/org/greenstone/mg/winMake.bat	(revision 19524)
@@ -14,4 +14,10 @@
 
 set JAVACOPTIONS= -deprecation -g -O
+
+if "%DEBUG%" == "" (
+  set MAKE_VARS=DEBUG=0
+) else (
+  set MAKE_VARS=DEBUG=%DEBUG%
+)
 
 
Index: /indexers/trunk/mg/jni/win32.mak
===================================================================
--- /indexers/trunk/mg/jni/win32.mak	(revision 19523)
+++ /indexers/trunk/mg/jni/win32.mak	(revision 19524)
@@ -29,5 +29,14 @@
 AR = lib
 CC = cl
-CPPFLAGS = 
+DEBUG = 0
+CXXFLAGS = 
+
+!IF $(DEBUG)
+CFLAGS = -DEBUG -Z7 /errorReport:prompt
+LDFLAGS = -DEBUG -Z7 /errorReport:prompt
+!ELSE
+CFLAGS =
+LDFLAGS = 
+!ENDIF
 
 DEFS = -DQUIET -DHAVE_CONFIG_H -D__WIN32__ -D_LITTLE_ENDIAN -DPARADOCNUM \
@@ -36,5 +45,5 @@
            -I"$(JAVA_HOME)\include" -I"$(JAVA_HOME)\include\win32"           
 
-COMPILE = $(CC) -c $(DEFS) $(INCLUDES)
+COMPILE = $(CC) $(CFLAGS) -c $(DEFS) $(INCLUDES)
  
 .SUFFIXES:
Index: /indexers/trunk/mg/lib/win32.mak
===================================================================
--- /indexers/trunk/mg/lib/win32.mak	(revision 19523)
+++ /indexers/trunk/mg/lib/win32.mak	(revision 19524)
@@ -29,5 +29,15 @@
 AR = lib
 CC = cl
-CPPFLAGS = 
+
+DEBUG = 0
+
+!IF $(DEBUG)
+CFLAGS = -DEBUG -Z7 /errorReport:prompt
+ARFLAGS = /DEBUG /Z7 /errorReport:prompt
+!ELSE
+CFLAGS =
+ARFLAGS =
+!ENDIF
+
 
 DEFS = -DQUIET -DHAVE_CONFIG_H -D__WIN32__ -D_LITTLE_ENDIAN -DPARADOCNUM \
@@ -36,5 +46,5 @@
 INCLUDES = -I"." -I"$(MGHOME)"
 
-COMPILE = $(CC) -c $(DEFS) $(INCLUDES)
+COMPILE = $(CC) $(CFLAGS) -c $(DEFS) $(INCLUDES)
  
 .SUFFIXES: .c .obj
@@ -83,5 +93,5 @@
 libmglib.lib : $(OBJECTS)
         if exist libmglib.lib del libmglib.lib
-	$(AR) /out:libmglib.lib $(OBJECTS)
+	$(AR) /out:libmglib.lib $(ARFLAGS) $(OBJECTS)
 
 install: 
Index: /indexers/trunk/mg/src/images/win32.mak
===================================================================
--- /indexers/trunk/mg/src/images/win32.mak	(revision 19523)
+++ /indexers/trunk/mg/src/images/win32.mak	(revision 19524)
@@ -27,12 +27,21 @@
 INSTALLDIR = ..\..\..\bin
 
+DEBUG = 0
+
 CC = cl
-CPPFLAGS = 
+
+!IF $(DEBUG)
+CFLAGS = -DEBUG -Z7 /errorReport:prompt
+LDFLAGS = -DEBUG -Z7 /errorReport:prompt
+!ELSE
+CFLAGS =
+LDFLAGS =
+!ENDIF
+
 DEFS = -DHAVE_CONFIG_H -D__WIN32__ -D_LITTLE_ENDIAN -D_CRT_SECURE_NO_DEPRECATE
 INCLUDES = -I"." -I"$(MGHOME)" -I"$(MGHOME)\lib"
-LDFLAGS =
 LIBS = $(MGHOME)\lib\libmglib.lib 
  
-COMPILE = $(CC) -c $(DEFS) $(INCLUDES)
+COMPILE = $(CC) $(CFLAGS) -c $(DEFS) $(INCLUDES)
 LINK = $(CC) $(LDFLAGS)
 
@@ -144,5 +153,6 @@
 clean: mostlyclean
 	if exist *$e del *$e
- 
+ 	if exist *.pdb del *.pdb
+
 distclean: clean
 	del ansi2knr
Index: /indexers/trunk/mg/src/text/win32.mak
===================================================================
--- /indexers/trunk/mg/src/text/win32.mak	(revision 19523)
+++ /indexers/trunk/mg/src/text/win32.mak	(revision 19524)
@@ -29,14 +29,23 @@
 INSTALLDIR = ..\..\..\bin
 
+DEBUG = 0
+
 AR = lib
-
 CC = cl
-CPPFLAGS = 
+
+!IF $(DEBUG)
+CFLAGS = -DEBUG -Z7 /errorReport:prompt
+LDFLAGS = -DEBUG -Z7 /errorReport:prompt
+!ELSE
+CFLAGS =
+LDFLAGS = 
+!ENDIF
+
+
 DEFS = -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DHAVE_CONFIG_H \
        -D__WIN32__ -D_LITTLE_ENDIAN -D_CRT_SECURE_NO_DEPRECATE
 INCLUDES = -I"." -I"$(MGHOME)" -I"$(MGHOME)\lib"
-COMPILE = $(CC) $(CPPFLAGS) -c $(DEFS) $(INCLUDES)
-
-LDFLAGS =
+COMPILE = $(CC) $(CFLAGS) -c $(DEFS) $(INCLUDES)
+
 LINK = $(CC) $(LDFLAGS)
 
@@ -241,2 +250,3 @@
         if exist libmgtext.lib del libmgtext.lib
         if exist libmgpass.lib del libmgpass.lib
+	if exist *.pdb del *.pdb
Index: /indexers/trunk/mg/win32.mak
===================================================================
--- /indexers/trunk/mg/win32.mak	(revision 19523)
+++ /indexers/trunk/mg/win32.mak	(revision 19524)
@@ -25,18 +25,15 @@
 ###########################################################################
 
+
+
 AR = lib
 CC = cl
-CPPFLAGS =
 
 MGHOME = $(MAKEDIR)
+DEBUG = 0
 DLL = 0
 DLLDEBUG = 0
 
 MDEFINES = /f win32.mak
-COMPILE = $(CC) -c $(CPPFLAGS) $(DEFS) $(INCLUDES)
-
-SOURCES = 
-
-OBJECTS = 
 
 OTHERDIRS = lib 
@@ -45,4 +42,7 @@
 
 MAKECMD = $(MAKE) $(MDEFINES)
+!IF $(DEBUG)
+MAKECMD = $(MAKECMD) DEBUG=1
+!ENDIF
 !IF $(DLL)
 MAKECMD = $(MAKECMD) DLL=1
Index: /indexers/trunk/mg/winMake.bat
===================================================================
--- /indexers/trunk/mg/winMake.bat	(revision 19523)
+++ /indexers/trunk/mg/winMake.bat	(revision 19524)
@@ -3,4 +3,10 @@
 set MAKE=nmake
 set MAKE_OPTIONS=/f
+
+if "%DEBUG%" == "" (
+  set MAKE_VARS=DEBUG=0
+) else (
+  set MAKE_VARS=DEBUG=%DEBUG%
+)
 
 if ""%1"" == """" goto all
@@ -19,13 +25,13 @@
 :all
 	cd lib
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..
 
 	cd src\images
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..\..
 
 	cd src\text
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..\..
 
@@ -35,5 +41,5 @@
 
 	cd jni
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..
 	goto done
@@ -46,13 +52,13 @@
 :nojava
 	cd lib
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..
 
 	cd src\images
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..\..
 
 	cd src\text
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..\..
 	goto done
Index: /indexers/trunk/mgpp/java/org/greenstone/mgpp/winMake.bat
===================================================================
--- /indexers/trunk/mgpp/java/org/greenstone/mgpp/winMake.bat	(revision 19523)
+++ /indexers/trunk/mgpp/java/org/greenstone/mgpp/winMake.bat	(revision 19524)
@@ -14,4 +14,10 @@
 
 set JAVACOPTIONS= -deprecation -g -O
+
+if "%DEBUG%" == "" (
+  set MAKE_VARS=DEBUG=0
+) else (
+  set MAKE_VARS=DEBUG=%DEBUG%
+)
 
 
Index: /indexers/trunk/mgpp/jni/win32.mak
===================================================================
--- /indexers/trunk/mgpp/jni/win32.mak	(revision 19523)
+++ /indexers/trunk/mgpp/jni/win32.mak	(revision 19524)
@@ -30,4 +30,5 @@
 ICONV_DIR = ../../packages/windows/iconv/iconv/lib
 
+DEBUG = 0
 ENABLE_ACCENTFOLD = 1
 
@@ -42,5 +43,12 @@
 AR = lib
 CC = cl
-CPPFLAGS = -GX
+
+!IF $(DEBUG)
+CXXFLAGS = -DEBUG -Z7 /errorReport:prompt
+!ELSE
+CXXFLAGS =
+!ENDIF
+
+CXXFLAGS = $(CXXFLAGS) -GX
 
 DEFS = -DQUIET -DHAVE_CONFIG_H -DSHORT_SUFFIX -DHAVE_STRING_H -D__WIN32__
@@ -48,5 +56,5 @@
            -I"$(JAVA_HOME)\include" -I"$(JAVA_HOME)\include\win32" $(AFINCLUDES)           
 
-COMPILE = $(CC) -c $(CPPFLAGS) $(DEFS) $(INCLUDES) 
+COMPILE = $(CC) -c $(CXXFLAGS) $(DEFS) $(INCLUDES) 
  
 .SUFFIXES:
Index: /indexers/trunk/mgpp/lib/win32.mak
===================================================================
--- /indexers/trunk/mgpp/lib/win32.mak	(revision 19523)
+++ /indexers/trunk/mgpp/lib/win32.mak	(revision 19524)
@@ -27,12 +27,20 @@
 MGPPHOME = ..
 
+DEBUG = 0
+
 AR = lib
 CC = cl
-CPPFLAGS = 
+
+!IF $(DEBUG)
+CXXFLAGS = -DEBUG -Z7 /errorReport:prompt
+!ELSE
+CXXFLAGS =
+!ENDIF
+
 
 DEFS = -DQUIET -DHAVE_CONFIG_H -D__WIN32__ -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE
 INCLUDES = -I"." -I"$(MGPPHOME)"
 
-COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS)
+COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CXXFLAGS)
 
 .SUFFIXES:
Index: /indexers/trunk/mgpp/text/win32.mak
===================================================================
--- /indexers/trunk/mgpp/text/win32.mak	(revision 19523)
+++ /indexers/trunk/mgpp/text/win32.mak	(revision 19524)
@@ -30,11 +30,20 @@
 ICONV_DIR = ../../packages/windows/iconv/iconv
 
+DEBUG = 0
 GSDL_VC4 = 0
 ENABLE_ACCENTFOLD = 1
 
+!IF $(DEBUG)
+CXXFLAGS = -DEBUG -Z7 /errorReport:prompt
+LDFLAGS = -DEBUG -Z7 /errorReport:prompt
+!ELSE
+CXXFLAGS =
+LDFLAGS =
+!ENDIF
+
 !IF $(GSDL_VC4)
-CPPFLAGS = -GX
+CXXFLAGS = $(CXXFLAGS) -GX
 !ELSE
-CPPFLAGS = -EHsc
+CXXFLAGS = $(CXXFLAGS) -EHsc
 !ENDIF
 
@@ -53,12 +62,13 @@
 AR = lib
 CC = cl
-LINK = cl
 
 DEFS = -DQUIET -DHAVE_CONFIG_H -D__WIN32__ -DSILENT -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE \
         -D__STDC__ -D__GNU_LIBRARY__ -D__MSDOS__ $(AFDEFS)
 INCLUDES = -I"." -I"$(MGPPHOME)" -I"$(MGPPHOME)\lib" $(AFINCLUDES)
+COMPILE = $(CC) -c $(CXXFLAGS) $(DEFS) $(INCLUDES)
+
+LINK = $(CC) $(LDFLAGS)
+
 LIBS = $(MGPPHOME)\lib\libmgpplib.lib $(AFLIBS) 
-
-COMPILE = $(CC) -c  $(CPPFLAGS) $(DEFS) $(INCLUDES)
 
 .SUFFIXES:
@@ -217,3 +227,4 @@
         if exist libmgpptext.lib del libmgpptext.lib 
         if exist libmgpppass.lib del libmgpppass.lib
-
+	if exist *.pdb del *.pdb
+
Index: /indexers/trunk/mgpp/winMake.bat
===================================================================
--- /indexers/trunk/mgpp/winMake.bat	(revision 19523)
+++ /indexers/trunk/mgpp/winMake.bat	(revision 19524)
@@ -3,4 +3,10 @@
 set MAKE=nmake
 set MAKE_OPTIONS=/f
+
+if "%DEBUG%" == "" (
+  set MAKE_VARS=DEBUG=0
+) else (
+  set MAKE_VARS=DEBUG=%DEBUG%
+)
 
 if ""%1"" == """" goto all
@@ -19,9 +25,9 @@
 :all
 	cd lib
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..
 
 	cd text
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..
 
@@ -31,5 +37,5 @@
 
 	cd jni
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..
 	goto done
@@ -43,9 +49,9 @@
 :nojava
 	cd lib
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..
 
 	cd text
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..
 	goto done
Index: /indexers/trunk/packages/unac/win32.mak
===================================================================
--- /indexers/trunk/packages/unac/win32.mak	(revision 19523)
+++ /indexers/trunk/packages/unac/win32.mak	(revision 19524)
@@ -4,4 +4,5 @@
 AR = lib
 
+DEBUG = 0
 DLL = 0
 DLLDEBUG = 0
@@ -9,20 +10,27 @@
 
 INCLUDES = -I. -DUNAC_VERSION=\"1.7.0\"
+
+!IF $(DEBUG)
+CXXFLAGS = -DEBUG -Z7 /errorReport:prompt
+!ELSE
+CXXFLAGS =
+!ENDIF
+
 !IF $(GSDL_VC4)
-CPPFLAGS = -GX
+CXXFLAGS = $(CXXFLAGS) -GX
 !ELSE
-CPPFLAGS = -EHsc
+CXXFLAGS = $(CXXFLAGS) -EHsc
 !ENDIF
 
 !IF $(DLL)
-CPPFLAGS = $(CPPFLAGS) -MD 
+CXXFLAGS = $(CXXFLAGS) -MD 
 !ELSE
 !IF ($(DLLDEBUG))
-CPPFLAGS = $(CPPFLAGS) -MDd
+CXXFLAGS = $(CXXFLAGS) -MDd
 !ENDIF
 !ENDIF
 
 
-COMPILE = $(CC) -nologo -c $(CPPFLAGS) $(DEFS) $(INCLUDES)
+COMPILE = $(CC) -nologo -c $(CXXFLAGS) $(DEFS) $(INCLUDES)
 LINK = $(CC) -nologo $(LDFLAGS)
 
Index: /indexers/trunk/winMake.bat
===================================================================
--- /indexers/trunk/winMake.bat	(revision 19523)
+++ /indexers/trunk/winMake.bat	(revision 19524)
@@ -3,4 +3,10 @@
 set MAKE=nmake
 set MAKE_OPTIONS=/f
+
+if "%DEBUG%" == "" (
+  set MAKE_VARS=DEBUG=0
+) else (
+  set MAKE_VARS=DEBUG=%DEBUG%
+)
 
 if ""%1"" == """" goto all
@@ -27,13 +33,13 @@
 	if NOT EXIST "iconv" unzip iconv.zip
 	cd iconv
-	%MAKE% %MAKE_OPTIONS% Makefile.msvc NO_NLS=1
+	%MAKE% %MAKE_OPTIONS% Makefile.msvc %MAKE_VARS% NO_NLS=1
 	cd ..\..\..\..
 
 	cd packages\unac
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..\..
 
 	cd mg
-	call winMake.bat %1 
+	call winMake.bat %1
 	cd ..
 
@@ -45,5 +51,13 @@
 	call winMake.bat %1
 	cd ..
+
+	if ""%1"" == ""clean"" goto clean2 
 	goto done
+
+:: Need another clean because a pre-all clean command sent to iconv regenerates some lib 
+:: and object files. So we delete these after it's finished processing the clean command
+:clean2	
+	for %%I in (lib srclib libcharset\lib) do if exist packages\windows\iconv\iconv\%%I\^*.obj del packages\windows\iconv\iconv\%%I\*.obj;
+	for %%I in (lib srclib libcharset\lib) do if exist packages\windows\iconv\iconv\%%I\^*.lib del packages\windows\iconv\iconv\%%I\*.lib;
 
 :java
@@ -63,9 +77,9 @@
 :nojava
 	cd packages\windows\iconv\iconv
-	%MAKE% %MAKE_OPTIONS% Makefile.msvc NO_NLS=1
+	%MAKE% %MAKE_OPTIONS% Makefile.msvc %MAKE_VARS% NO_NLS=1
 	cd ..\..\..\..
 
 	cd packages\unac
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..\..
 
@@ -83,9 +97,9 @@
 
 	cd packages\windows\iconv\iconv
-	%MAKE% %MAKE_OPTIONS% Makefile.msvc NO_NLS=1
+	%MAKE% %MAKE_OPTIONS% Makefile.msvc %MAKE_VARS% NO_NLS=1
 	cd ..\..\..\..
 
 	cd packages\unac
-	%MAKE% %MAKE_OPTIONS% win32.mak %1
+	%MAKE% %MAKE_OPTIONS% win32.mak %1 %MAKE_VARS% 
 	cd ..\..
 
