diff --git a/src/bin/psql/bcc32.mak b/src/bin/psql/bcc32.mak
index 783acfe4c836c568a9983480edb89fe30dfc8857..320afad249e19209d225c645cda14eaa041e7aa1 100644
--- a/src/bin/psql/bcc32.mak
+++ b/src/bin/psql/bcc32.mak
@@ -59,23 +59,25 @@ ALL : sql_help.h psqlscan.c "..\..\port\pg_config_paths.h" "$(OUTDIR)\psql.exe"
 CLEAN :
 	-@erase "$(INTDIR)\command.obj"
 	-@erase "$(INTDIR)\common.obj"
+	-@erase "$(INTDIR)\copy.obj"
+	-@erase "$(INTDIR)\describe.obj"
 	-@erase "$(INTDIR)\help.obj"
 	-@erase "$(INTDIR)\input.obj"
-	-@erase "$(INTDIR)\stringutils.obj"
-	-@erase "$(INTDIR)\mainloop.obj"
-	-@erase "$(INTDIR)\copy.obj"
-	-@erase "$(INTDIR)\startup.obj"
-	-@erase "$(INTDIR)\prompt.obj"
-	-@erase "$(INTDIR)\variables.obj"
 	-@erase "$(INTDIR)\large_obj.obj"
+	-@erase "$(INTDIR)\mainloop.obj"
+	-@erase "$(INTDIR)\mbprint.obj"
 	-@erase "$(INTDIR)\print.obj"
-	-@erase "$(INTDIR)\describe.obj"
+	-@erase "$(INTDIR)\prompt.obj"
+	-@erase "$(INTDIR)\startup.obj"
+	-@erase "$(INTDIR)\stringutils.obj"
 	-@erase "$(INTDIR)\tab-complete.obj"
-	-@erase "$(INTDIR)\sprompt.obj"
+	-@erase "$(INTDIR)\variables.obj"
+	-@erase "$(INTDIR)\exec.obj"
 	-@erase "$(INTDIR)\getopt.obj"
 	-@erase "$(INTDIR)\getopt_long.obj"
 	-@erase "$(INTDIR)\path.obj"
-	-@erase "$(INTDIR)\mbprint.obj"
+	-@erase "$(INTDIR)\pgstrcasecmp.obj"
+	-@erase "$(INTDIR)\sprompt.obj"
 	-@erase "$(INTDIR)\psql.ilc"
 	-@erase "$(INTDIR)\psql.ild"
 	-@erase "$(INTDIR)\psql.tds"
@@ -125,23 +127,25 @@ LINK32_FLAGS=-L$(BCB)\lib;.\$(LIBPG_DIR) -x -v
 LINK32_OBJS= \
 	command.obj \
 	common.obj \
+	copy.obj \
+	describe.obj \
 	help.obj \
 	input.obj \
-	stringutils.obj \
-	mainloop.obj \
-	copy.obj \
-	startup.obj \
-	prompt.obj \
-	variables.obj \
 	large_obj.obj \
+	mainloop.obj \
+	mbprint.obj
 	print.obj \
-	describe.obj \
+	prompt.obj \
+	startup.obj \
+	stringutils.obj \
 	tab-complete.obj \
-	sprompt.obj \
+	variables.obj \
+	exec.obj \
 	getopt.obj \
 	getopt_long.obj \
 	path.obj \
-	mbprint.obj
+	pgstrcasecmp.obj \
+	sprompt.obj \
 	
 
 "$(OUTDIR)\psql.exe" : "$(OUTDIR)" $(LINK32_OBJS)
@@ -152,10 +156,12 @@ LINK32_OBJS= \
 	import32.lib $(LIBRARIES),,
 !
 
-sprompt.obj : "$(OUTDIR)" ..\..\port\sprompt.c
+exec.obj : "$(OUTDIR)" ..\..\port\exec.c
 getopt.obj : "$(OUTDIR)" ..\..\port\getopt.c
 getopt_long.obj : "$(OUTDIR)" ..\..\port\getopt_long.c
 path.obj : "$(OUTDIR)" ..\..\port\path.c
+pgstrcasecmp.obj : "$(OUTDIR)" ..\..\port\pgstrcasecmp.c
+sprompt.obj : "$(OUTDIR)" ..\..\port\sprompt.c
 
 "sql_help.h": create_help.pl 
        $(PERL) create_help.pl $(REFDOCDIR) $@
diff --git a/src/bin/psql/win32.mak b/src/bin/psql/win32.mak
index bc6d3446f5a5051b0f3a1972bad5ae3a821d4bfa..3381893293a7621444f65a1b4c2275c173d6f20f 100644
--- a/src/bin/psql/win32.mak
+++ b/src/bin/psql/win32.mak
@@ -22,24 +22,26 @@ ALL : sql_help.h psqlscan.c "..\..\port\pg_config_paths.h" "$(OUTDIR)\psql.exe"
 CLEAN :
 	-@erase "$(INTDIR)\command.obj"
 	-@erase "$(INTDIR)\common.obj"
+	-@erase "$(INTDIR)\copy.obj"
+	-@erase "$(INTDIR)\describe.obj"
 	-@erase "$(INTDIR)\help.obj"
 	-@erase "$(INTDIR)\input.obj"
-	-@erase "$(INTDIR)\stringutils.obj"
-	-@erase "$(INTDIR)\mainloop.obj"
-	-@erase "$(INTDIR)\copy.obj"
-	-@erase "$(INTDIR)\startup.obj"
-	-@erase "$(INTDIR)\prompt.obj"
-	-@erase "$(INTDIR)\variables.obj"
 	-@erase "$(INTDIR)\large_obj.obj"
+	-@erase "$(INTDIR)\mainloop.obj"
+	-@erase "$(INTDIR)\mbprint.obj"
 	-@erase "$(INTDIR)\print.obj"
-	-@erase "$(INTDIR)\describe.obj"
+	-@erase "$(INTDIR)\prompt.obj"
 	-@erase "$(INTDIR)\psqlscan.obj"
+	-@erase "$(INTDIR)\startup.obj"
+	-@erase "$(INTDIR)\stringutils.obj"
 	-@erase "$(INTDIR)\tab-complete.obj"
-	-@erase "$(INTDIR)\sprompt.obj"
+	-@erase "$(INTDIR)\variables.obj"
+	-@erase "$(INTDIR)\exec.obj"
 	-@erase "$(INTDIR)\getopt.obj"
 	-@erase "$(INTDIR)\getopt_long.obj"
 	-@erase "$(INTDIR)\path.obj"
-	-@erase "$(INTDIR)\mbprint.obj"
+	-@erase "$(INTDIR)\pgstrcasecmp.obj"
+	-@erase "$(INTDIR)\sprompt.obj"
 	-@erase "$(INTDIR)\*psql.pch"
 	-@erase "$(OUTDIR)\psql.exe"
 	-@erase "$(INTDIR)\..\..\port\pg_config_paths.h"
@@ -60,8 +62,7 @@ CLEAN :
 
 CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D\
  "_MBCS" /Fp"$(INTDIR)\psql.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
- /I ..\..\include /I ..\..\interfaces\libpq /I ..\..\include\port\win32 \
- /D "HAVE_STRDUP" /D "FRONTEND"
+ /I ..\..\include /I ..\..\interfaces\libpq /D "HAVE_STRDUP" /D "FRONTEND"
 
 CPP_OBJS=.\Release/
 CPP_SBRS=.
@@ -72,28 +73,28 @@ LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
  odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:no\
  /pdb:"$(OUTDIR)\psql.pdb" /machine:I386 /out:"$(OUTDIR)\psql.exe" 
 LINK32_OBJS= \
-	"$(INTDIR)\pgstrcasecmp.obj" \
-	"$(INTDIR)\exec.obj" \
 	"$(INTDIR)\command.obj" \
 	"$(INTDIR)\common.obj" \
+	"$(INTDIR)\copy.obj" \
+	"$(INTDIR)\describe.obj" \
 	"$(INTDIR)\help.obj" \
 	"$(INTDIR)\input.obj" \
-	"$(INTDIR)\stringutils.obj" \
-	"$(INTDIR)\mainloop.obj" \
-	"$(INTDIR)\copy.obj" \
-	"$(INTDIR)\startup.obj" \
-	"$(INTDIR)\prompt.obj" \
-	"$(INTDIR)\variables.obj" \
 	"$(INTDIR)\large_obj.obj" \
+	"$(INTDIR)\mainloop.obj" \
+	"$(INTDIR)\mbprint.obj" \
 	"$(INTDIR)\print.obj" \
-	"$(INTDIR)\describe.obj" \
+	"$(INTDIR)\prompt.obj" \
 	"$(INTDIR)\psqlscan.obj" \
+	"$(INTDIR)\startup.obj" \
+	"$(INTDIR)\stringutils.obj" \
 	"$(INTDIR)\tab-complete.obj" \
-	"$(INTDIR)\sprompt.obj" \
+	"$(INTDIR)\variables.obj" \
+	"$(INTDIR)\exec.obj" \
 	"$(INTDIR)\getopt.obj" \
 	"$(INTDIR)\getopt_long.obj" \
 	"$(INTDIR)\path.obj" \
-	"$(INTDIR)\mbprint.obj" \
+	"$(INTDIR)\pgstrcasecmp.obj" \
+	"$(INTDIR)\sprompt.obj" \
 	"..\..\interfaces\libpq\Release\libpqdll.lib"
 
 "$(OUTDIR)\psql.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
@@ -101,9 +102,9 @@ LINK32_OBJS= \
   $(LINK32_FLAGS) $(LINK32_OBJS)
 <<
 
-"$(OUTDIR)\sprompt.obj" : "$(OUTDIR)" ..\..\port\sprompt.c
+"$(INTDIR)\exec.obj" : ..\..\port\exec.c
     $(CPP) @<<
-    $(CPP_PROJ) ..\..\port\sprompt.c
+    $(CPP_PROJ) ..\..\port\exec.c
 <<
 
 "$(OUTDIR)\getopt.obj" : "$(OUTDIR)" ..\..\port\getopt.c
@@ -126,9 +127,9 @@ LINK32_OBJS= \
     $(CPP_PROJ) ..\..\port\pgstrcasecmp.c
 <<
 
-"$(INTDIR)\exec.obj" : ..\..\port\exec.c
+"$(OUTDIR)\sprompt.obj" : "$(OUTDIR)" ..\..\port\sprompt.c
     $(CPP) @<<
-    $(CPP_PROJ) ..\..\port\exec.c
+    $(CPP_PROJ) ..\..\port\sprompt.c
 <<
 
 .c{$(CPP_OBJS)}.obj::