Index: /gsdl/trunk/build-src/win32.mak
===================================================================
--- /gsdl/trunk/build-src/win32.mak	(revision 16576)
+++ /gsdl/trunk/build-src/win32.mak	(revision 16577)
@@ -34,11 +34,5 @@
 MDEFINES = /f win32.mak
 
-
-COMPILEDIRS = src\hashfile src\phind\generate
-
 INSTALLDIRS = src\hashfile src\phind\generate
-
-
-PACKAGEDIRS = 
 
 
@@ -57,22 +51,19 @@
 MAKECLEANCMD = $(MAKE) $(MDEFINES) clean
 
-all: win32.mak $(PACKAGEDIRS) $(COMPILEDIRS) $(INSTALLDIRS) 
+all: win32.mak $(INSTALLDIRS) 
 
 install: win32.mak $(INSTALLDIRS)
 
 clean:
+	cd "$(BUILDHOME)"
 	cd src\phind\generate
 	$(MAKECLEANCMD)
-	cd "$(GSDLHOME)"
+	cd "$(BUILDHOME)"
 	cd src\hashfile
 	$(MAKECLEANCMD)
 	cd "$(GSDLHOME)"
 
-$(COMPILEDIRS): FORCE
-	cd "$@"
-	$(MAKECMD)
-	cd "$(GSDLHOME)"
-
 $(INSTALLDIRS): FORCE
+	cd "$(BUILDHOME)"
 	cd "$@"
 	$(MAKECMD)
Index: /gsdl/trunk/common-src/src/lib/gsdlconf.h
===================================================================
--- /gsdl/trunk/common-src/src/lib/gsdlconf.h	(revision 16576)
+++ /gsdl/trunk/common-src/src/lib/gsdlconf.h	(revision 16577)
@@ -37,7 +37,7 @@
 
 #if defined(__WIN32__) && !defined(__CYGWIN__)
-#include "../../win32cfg.h"
+#include "../../../win32cfg.h"
 #else
-#include "../../config.h"
+#include "../../../config.h"
 #endif
 
Index: /gsdl/trunk/common-src/src/lib/win32.mak
===================================================================
--- /gsdl/trunk/common-src/src/lib/win32.mak	(revision 16576)
+++ /gsdl/trunk/common-src/src/lib/win32.mak	(revision 16577)
@@ -25,7 +25,7 @@
 ###########################################################################
 
-GSDL_DIR = ..\..
-INDEXERS_DIR = $(GSDL_DIR)\indexers
-PACKAGES_DIR = $(GSDL_DIR)\packages
+GSDL_DIR = ..\..\..
+INDEXERS_DIR = $(GSDL_DIR)\common-src\indexers
+PACKAGES_DIR = $(GSDL_DIR)\common-src\packages
 
 
Index: /gsdl/trunk/common-src/win32.mak
===================================================================
--- /gsdl/trunk/common-src/win32.mak	(revision 16576)
+++ /gsdl/trunk/common-src/win32.mak	(revision 16577)
@@ -68,4 +68,5 @@
 
 clean:
+	cd "$(COMMONHOME)"
 	cd packages\windows\crypt\crypt
 	$(MAKECLEANCMD)
@@ -91,4 +92,5 @@
 
 $(COMPILEDIRS): FORCE
+	cd "$(COMMONHOME)"
 	cd "$@"
 	$(MAKECMD)
@@ -96,4 +98,5 @@
 
 $(INSTALLDIRS): FORCE
+	cd "$(COMMONHOME)"
 	cd "$@"
 	$(MAKECMD)
@@ -102,4 +105,5 @@
 
 $(SQLITE_DIR): FORCE
+	cd "$(COMMONHOME)"
 	cd "$@"
 	$(MAKECMD)
@@ -108,4 +112,5 @@
 
 $(INDEXERSDIR): FORCE
+	cd "$(COMMONHOME)"
 	cd "$@"
 	call winMake.bat all gs2
@@ -115,5 +120,6 @@
 	for %%i in (bin\*.exe) do \
 	  copy %%i "$(GSDLHOME)\bin\windows"
- 	copy lucene-gs\LuceneWrapper.jar "$(GSDLHOME)\bin\java"
+	if EXIST "lucene-gs\LuceneWrapper.jar" copy "lucene-gs\LuceneWrapper.jar" "$(GSDLHOME)\bin\java"
+	if NOT EXIST "lucene-gs\LuceneWrapper.jar" echo Warning: Failed to find lucene-gs\LuceneWrapper.jar.  Greenstone will not be able to use Lucene for indexing
 	cd "$(GSDLHOME)"
 
Index: /gsdl/trunk/runtime-src/src/colservr/win32.mak
===================================================================
--- /gsdl/trunk/runtime-src/src/colservr/win32.mak	(revision 16576)
+++ /gsdl/trunk/runtime-src/src/colservr/win32.mak	(revision 16577)
@@ -54,5 +54,5 @@
 !IF $(USE_SQLITE)
 SQLITE_DEFINES = -DUSE_SQLITE
-SQLITE_INCLUDES = -I"$(PACKAGES_DIR)\sqlite\include"
+SQLITE_INCLUDES = -I"$(COMMON_DIR)\packages\sqlite\include"
 !ELSE
 SQLITE_DEFINES = 
@@ -69,9 +69,9 @@
 	-I"$(INDEXERS_DIR)\mg" -I"$(INDEXERS_DIR)\mg\lib" -I"$(INDEXERS_DIR)\mg\src\text" \
 	-I"$(INDEXERS_DIR)\mgpp\lib" -I"$(INDEXERS_DIR)\mgpp\text" \
-	-I"$(PACKAGES_DIR)\windows\expat\expat" -I"$(PACKAGES_DIR)\windows\gdbm\gdbm" $(SQLITE_INCLUDES)
+	-I"$(COMMON_DIR)\packages\windows\expat\expat" -I"$(COMMON_DIR)\packages\windows\gdbm\gdbm" $(SQLITE_INCLUDES)
 
 !IF $(GSDL_VC4)
 DEFS=$(DEFS) -DGSDL_NAMESPACE_BROKEN -DGSDL_USE_IOS_H -D__STL_NO_NEW_IOSTREAMS
-INCLUDES = $(INCLUDES) -I"$(PACKAGES_DIR)\windows\stlport\stlport"
+INCLUDES = $(INCLUDES) -I"$(COMMON_DIR)\packages\windows\stlport\stlport"
 !ENDIF
 
Index: /gsdl/trunk/runtime-src/src/oaiservr/win32.mak
===================================================================
--- /gsdl/trunk/runtime-src/src/oaiservr/win32.mak	(revision 16576)
+++ /gsdl/trunk/runtime-src/src/oaiservr/win32.mak	(revision 16577)
@@ -30,4 +30,6 @@
 
 INDEXERS_DIR = $(COMMON_DIR)\indexers
+COMMON_PACKAGES = $(COMMON_DIR)\packages
+
 PACKAGES_DIR = $(RUNTIME_DIR)\packages
 COLSERVR_DIR = $(RUNTIME_DIR)\src\colservr
@@ -65,5 +67,5 @@
 
 !IF $(USE_SQLITE)
-SQLITE_LIBS = "$(PACKAGES_DIR)\sqlite\lib\sqlite3.lib"
+SQLITE_LIBS = "$(COMMON_PACKAGES)\sqlite\lib\sqlite3.lib"
 !ELSE
 SQLITE_LIBS = 
@@ -76,13 +78,13 @@
         -DGSDL_NOCACHE
 INCLUDES = -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" -I"$(PROTOCOL_DIR)" -I"$(RECPT_DIR)" \
-        -I"$(INDEXERS_DIR)\mgpp\text" -I"$(PACKAGES_DIR)\windows\crypt\crypt" \
-	-I"$(PACKAGES_DIR)\windows\expat\expat" -I"$(PACKAGES_DIR)\windows\gdbm\gdbm"
+        -I"$(INDEXERS_DIR)\mgpp\text" -I"$(COMMON_PACKAGES)\windows\crypt\crypt" \
+	-I"$(COMMON_PACKAGES)\windows\expat\expat" -I"$(COMMON_PACKAGES)\windows\gdbm\gdbm"
 LDFLAGS = 
-LIBS = "$(PACKAGES_DIR)\windows\crypt\crypt\crypt.lib" "$(PACKAGES_DIR)\windows\expat\expat\libexpat.lib" \
-        "$(PACKAGES_DIR)\windows\gdbm\gdbm\gdbm.lib" $(ACCENTFOLD_LIBS) $(SQLITE_LIBS)
+LIBS = "$(COMMON_PACKAGES)\windows\crypt\crypt\crypt.lib" "$(COMMON_PACKAGES)\windows\expat\expat\libexpat.lib" \
+        "$(COMMON_PACKAGES)\windows\gdbm\gdbm\gdbm.lib" $(ACCENTFOLD_LIBS) $(SQLITE_LIBS)
 
 !IF $(GSDL_VC4)
 DEFS = $(DEFS) -DGSDL_NAMESPACE_BROKEN -DGSDL_USE_IOS_H -D__STL_NO_NEW_IOSTREAMS
-INCLUDES = $(INCLUDES) -I"$(PACKAGES_DIR)\windows\stlport\stlport"
+INCLUDES = $(INCLUDES) -I"$(COMMON_PACKAGES)\windows\stlport\stlport"
 !ENDIF
 !IF $(LOCAL_LIBRARY)
Index: /gsdl/trunk/runtime-src/src/protocol/win32.mak
===================================================================
--- /gsdl/trunk/runtime-src/src/protocol/win32.mak	(revision 16576)
+++ /gsdl/trunk/runtime-src/src/protocol/win32.mak	(revision 16577)
@@ -30,5 +30,6 @@
 
 INDEXERS_DIR = $(COMMON_DIR)\indexers
-PACKAGES_DIR = $(RUNTIME_DIR)\packages
+COMMON_PACKAGES = $(COMMON_DIR)\packages
+
 COLSERVR_DIR = $(RUNTIME_DIR)\src\colservr
 
@@ -59,9 +60,9 @@
 # Do NOT add the "recpt" directory here: the protocol should be independent of the receptionist!
 INCLUDES = -I"$(GSDL_DIR)" -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" -I"$(INDEXERS_DIR)\mgpp\text" \
-	 -I"$(PACKAGES_DIR)\windows\gdbm\gdbm"
+	 -I"$(COMMON_PACKAGES)\windows\gdbm\gdbm"
 
 !IF $(GSDL_VC4)
 DEFS=$(DEFS) -DGSDL_NAMESPACE_BROKEN -DGSDL_USE_IOS_H -D__STL_NO_NEW_IOSTREAMS
-INCLUDES = $(INCLUDES) -I"$(PACKAGES_DIR)\windows\stlport\stlport"
+INCLUDES = $(INCLUDES) -I"$(COMMON_PACKAGES)\windows\stlport\stlport"
 !ENDIF
 
Index: /gsdl/trunk/runtime-src/src/recpt/win32.mak
===================================================================
--- /gsdl/trunk/runtime-src/src/recpt/win32.mak	(revision 16576)
+++ /gsdl/trunk/runtime-src/src/recpt/win32.mak	(revision 16577)
@@ -30,4 +30,7 @@
 
 INDEXERS_DIR = $(COMMON_DIR)\indexers
+COMMON_PACKAGES = $(COMMON_DIR)\packages
+
+
 PACKAGES_DIR = $(RUNTIME_DIR)\packages
 COLSERVR_DIR = $(RUNTIME_DIR)\src\colservr
@@ -66,5 +69,5 @@
 
 !IF $(USE_SQLITE)
-SQLITE_LIBS = "$(PACKAGES_DIR)\sqlite\lib\sqlite3.lib"
+SQLITE_LIBS = "$(COMMON_PACKAGES)\sqlite\lib\sqlite3.lib"
 !ELSE
 SQLITE_LIBS = 
@@ -74,5 +77,5 @@
 Z3950_DEFS = -DUSE_Z3950
 Z3950_INCLUDES = -I$(Z3950_DIR)
-Z3950_LIBS = $(Z3950_DIR)\gsdlz3950.lib $(PACKAGES_DIR)\yaz\yaz-2.1.4\lib\yaz.lib
+Z3950_LIBS = $(Z3950_DIR)\gsdlz3950.lib $(COMMON_PACKAGES)\yaz\yaz-2.1.4\lib\yaz.lib
 !ELSE
 Z3950_DEFS = 
@@ -88,13 +91,13 @@
 INCLUDES = -I. -I"$(GSDL_DIR)" -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" -I"$(PROTOCOL_DIR)" \
 	-I"$(INDEXERS_DIR)\mg" -I"$(INDEXERS_DIR)\mg\lib" -I"$(INDEXERS_DIR)\mgpp\text" \
-	-I"$(PACKAGES_DIR)\windows\crypt\crypt" -I"$(PACKAGES_DIR)\windows\expat\expat" \
-	-I"$(PACKAGES_DIR)\windows\gdbm\gdbm" $(Z3950_INCLUDES)
+	-I"$(COMMON_PACKAGES)\windows\crypt\crypt" -I"$(COMMON_PACKAGES)\windows\expat\expat" \
+	-I"$(COMMON_PACKAGES)\windows\gdbm\gdbm" $(Z3950_INCLUDES)
 LDFLAGS = 
-LIBS = "$(PACKAGES_DIR)\windows\crypt\crypt\crypt.lib" "$(PACKAGES_DIR)\windows\expat\expat\libexpat.lib" \
-        "$(PACKAGES_DIR)\windows\gdbm\gdbm\gdbm.lib" $(ACCENTFOLD_LIBS) $(SQLITE_LIBS) $(Z3950_LIBS)
+LIBS = "$(COMMON_PACKAGES)\windows\crypt\crypt\crypt.lib" "$(COMMON_PACKAGES)\windows\expat\expat\libexpat.lib" \
+        "$(COMMON_PACKAGES)\windows\gdbm\gdbm\gdbm.lib" $(ACCENTFOLD_LIBS) $(SQLITE_LIBS) $(Z3950_LIBS)
 
 !IF $(GSDL_VC4)
 DEFS = $(DEFS) -DGSDL_NAMESPACE_BROKEN -DGSDL_USE_IOS_H -D__STL_NO_NEW_IOSTREAMS
-INCLUDES = $(INCLUDES) -I"$(PACKAGES_DIR)\windows\stlport\stlport"
+INCLUDES = $(INCLUDES) -I"$(COMMON_PACKAGES)\windows\stlport\stlport"
 !ENDIF
 !IF $(LOCAL_LIBRARY)
Index: /gsdl/trunk/runtime-src/src/w32server/win32.mak
===================================================================
--- /gsdl/trunk/runtime-src/src/w32server/win32.mak	(revision 16576)
+++ /gsdl/trunk/runtime-src/src/w32server/win32.mak	(revision 16577)
@@ -30,7 +30,9 @@
 
 INDEXERS_DIR = $(COMMON_DIR)\indexers
+COMMON_PACKAGES = $(COMMON_DIR)\packages
+
 PACKAGES_DIR = $(RUNTIME_DIR)\packages
 COLSERVR_DIR = $(RUNTIME_DIR)\src\colservr
-PROTOCOL_DIR = $(RUNTIME_DIR)\protocol
+PROTOCOL_DIR = $(RUNTIME_DIR)\src\protocol
 RECPT_DIR    = $(RUNTIME_DIR)\src\recpt
 
@@ -54,5 +56,5 @@
 
 !IF $(USE_SQLITE)
-SQLITE_LIBS = "$(PACKAGES_DIR)\sqlite\lib\sqlite3.lib"
+SQLITE_LIBS = "$(COMMON_PACKAGES)\sqlite\lib\sqlite3.lib"
 !ELSE
 SQLITE_LIBS = 
@@ -65,10 +67,10 @@
 INCLUDES = -I"$(GSDL_DIR)" -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" -I"$(PROTOCOL_DIR)" -I"$(RECPT_DIR)" \
 	-I"$(COLSERVR_DIR)" -I"$(INDEXERS_DIR)\mg" \
-	-I"$(PACKAGES_DIR)\windows\gdbm\gdbm" \
+	-I"$(COMMON_PACKAGES)\windows\gdbm\gdbm" \
         -I"$(INDEXERS_DIR)\mg\lib" -I"$(INDEXERS_DIR)\mg\src\text" \
     	-I"$(INDEXERS_DIR)\mgpp\lib" -I"$(INDEXERS_DIR)\mgpp\text"
 LDFLAGS =
-LIBS = "$(PACKAGES_DIR)\windows\crypt\crypt\crypt.lib" "$(PACKAGES_DIR)\windows\expat\expat\libexpat.lib" \
-        "$(PACKAGES_DIR)\windows\gdbm\gdbm\gdbm.lib" $(ACCENTFOLD_LIBS) $(SQLITE_LIBS)
+LIBS = "$(COMMON_PACKAGES)\windows\crypt\crypt\crypt.lib" "$(COMMON_PACKAGES)\windows\expat\expat\libexpat.lib" \
+        "$(COMMON_PACKAGES)\windows\gdbm\gdbm\gdbm.lib" $(ACCENTFOLD_LIBS) $(SQLITE_LIBS)
 RSC = rc
 WINLIBS = kernel32.lib user32.lib gdi32.lib winspool.lib \
@@ -80,5 +82,5 @@
 !IF $(GSDL_VC4)
 DEFS = $(DEFS) -DGSDL_NAMESPACE_BROKEN -DGSDL_USE_IOS_H -D__STL_NO_NEW_IOSTREAMS
-INCLUDES = $(INCLUDES) -I"$(PACKAGES_DIR)\windows\stlport\stlport"
+INCLUDES = $(INCLUDES) -I"$(COMMON_PACKAGES)\windows\stlport\stlport"
 !ENDIF
 
Index: /gsdl/trunk/runtime-src/win32.mak
===================================================================
--- /gsdl/trunk/runtime-src/win32.mak	(revision 16576)
+++ /gsdl/trunk/runtime-src/win32.mak	(revision 16577)
@@ -1,5 +1,5 @@
 ###########################################################################
 #
-# win32 makefile -- gsdl
+# win32 makefile -- gsdl runtime code
 # A component of the Greenstone digital library software
 # from the New Zealand Digital Library Project at the
@@ -25,5 +25,7 @@
 ###########################################################################
 
-GSDLHOME = $(MAKEDIR)
+GSDLHOME = $(GSDLHOME)
+RUNTIMEHOME = $(MAKEDIR)
+
 GSDL_VC4 = 0
 LOCAL_LIBRARY = 0
@@ -35,11 +37,7 @@
 MDEFINES = /f win32.mak
 
-INDEXERSDIR = indexers
+COMPILEDIRS = src\colservr src\protocol
 
-COMPILEDIRS = packages\windows\gdbm\gdbm packages\windows\crypt\crypt \
-	    packages\windows\expat\expat src\lib src\colservr src\protocol
-
-INSTALLDIRS = src\hashfile src\gdbmedit\db2txt src\gdbmedit\txt2db src\phind\generate \
-	    src\recpt src\oaiservr 
+INSTALLDIRS = src\recpt src\oaiservr 
 
 PACKAGEDIRS = 
@@ -74,53 +72,28 @@
 MAKECLEANCMD = $(MAKE) $(MDEFINES) clean
 
-all: win32.mak $(INDEXERSDIR) $(PACKAGEDIRS) $(COMPILEDIRS) $(INSTALLDIRS) 
+all: win32.mak $(PACKAGEDIRS) $(COMPILEDIRS) $(INSTALLDIRS) 
 
-install: win32.mak $(INDEXERSDIR) $(INSTALLDIRS)
+install: win32.mak $(INSTALLDIRS)
 
 clean:
-	cd packages\windows\crypt\crypt
-	$(MAKECLEANCMD)
-	cd "$(GSDLHOME)"
-	cd packages\windows\gdbm\gdbm
-	$(MAKECLEANCMD)
-	cd "$(GSDLHOME)"
-	cd packages\windows\expat\expat
-	$(MAKECLEANCMD)
-	cd "$(GSDLHOME)"
-	cd src\lib
-	$(MAKECLEANCMD)
-	cd "$(GSDLHOME)"
+	cd "$(RUNTIMEHOME)"
 	cd src\colservr
 	$(MAKECLEANCMD)
-	cd "$(GSDLHOME)"
+	cd "$(RUNTIMEHOME)"
 	cd src\protocol
 	$(MAKECLEANCMD)
-	cd "$(GSDLHOME)"
+	cd "$(RUNTIMEHOME)"
 	cd src\recpt
 	$(MAKECLEANCMD)
-	cd "$(GSDLHOME)"
+	cd "$(RUNTIMEHOME)"
 	cd src\oaiservr
 	$(MAKECLEANCMD)
-	cd "$(GSDLHOME)"
+	cd "$(RUNTIMEHOME)"
 	cd src\w32server
 	$(MAKECLEANCMD)
 	cd "$(GSDLHOME)"
-	cd src\phind\generate
-	$(MAKECLEANCMD)
-	cd "$(GSDLHOME)"
-	cd src\hashfile
-	$(MAKECLEANCMD)
-	cd "$(GSDLHOME)"
-	cd src\gdbmedit\txt2db
-	$(MAKECLEANCMD)
-	cd "$(GSDLHOME)"
-	cd src\gdbmedit\db2txt
-	$(MAKECLEANCMD)
-	cd "$(GSDLHOME)"
-	cd indexers
-	call winMake.bat clean
-	cd "$(GSDLHOME)"
 
 $(COMPILEDIRS): FORCE
+	cd "$(RUNTIMEHOME)"
 	cd "$@"
 	$(MAKECMD)
@@ -128,4 +101,5 @@
 
 $(INSTALLDIRS): FORCE
+	cd "$(RUNTIMEHOME)"
 	cd "$@"
 	$(MAKECMD)
@@ -144,15 +118,4 @@
 	cd "$(GSDLHOME)"
 
-$(INDEXERSDIR): FORCE
-	cd "$@"
-	call winMake.bat all gs2
-	call winMake.bat install gs2
-	if NOT EXIST "$(GSDLHOME)\bin\windows" mkdir "$(GSDLHOME)\bin\windows"
-	if NOT EXIST "$(GSDLHOME)\bin\java" mkdir "$(GSDLHOME)\bin\java"
-	for %%i in (bin\*.exe) do \
-	  copy %%i "$(GSDLHOME)\bin\windows"
- 	copy lucene-gs\LuceneWrapper.jar "$(GSDLHOME)\bin\java"
-	cd "$(GSDLHOME)"
-
 FORCE:
 
Index: /gsdl/trunk/win32.mak
===================================================================
--- /gsdl/trunk/win32.mak	(revision 16576)
+++ /gsdl/trunk/win32.mak	(revision 16577)
@@ -35,6 +35,4 @@
 MDEFINES = /f win32.mak
 
-COMPILEDIRS = common-src build-src runtime-src 
-
 INSTALLDIRS = common-src build-src runtime-src 
 
@@ -63,5 +61,5 @@
 MAKECLEANCMD = $(MAKE) $(MDEFINES) clean
 
-all: win32.mak $(COMPILEDIRS) $(INSTALLDIRS) 
+all: win32.mak $(INSTALLDIRS) 
 
 install: win32.mak $(INSTALLDIRS)
@@ -78,9 +76,4 @@
 	cd "$(GSDLHOME)"
 
-$(COMPILEDIRS): FORCE
-	cd "$@"
-	$(MAKECMD)
-	cd "$(GSDLHOME)"
-
 $(INSTALLDIRS): FORCE
 	cd "$@"
