Fix very broken clean.bat for msvc install. The way we used subroutines

in .bat simply did not work, and it called them in the wrong order,
some several times, and some not at all. So this unrolls all subroutine
calls.

This should fix the issues with clean deleting the wrong files reported
by Dave Page.

While at it, add the "clean dist" option to act like "make distclean",
and no longer remove the flex/bison output files by default. This shuold
fix the problem reported by Pavel Golub in bug #3909.
This commit is contained in:
Magnus Hagander 2008-02-06 15:13:25 +00:00
parent 03e4dc9ef2
commit 8d363727f4
2 changed files with 55 additions and 45 deletions

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/install-win32.sgml,v 1.44 2007/12/19 12:29:36 mha Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/install-win32.sgml,v 1.45 2008/02/06 15:13:25 mha Exp $ -->
<chapter id="install-win32"> <chapter id="install-win32">
<title>Installation on <productname>Windows</productname></title> <title>Installation on <productname>Windows</productname></title>
@ -238,7 +238,10 @@
handle changed files. But if there have been large changes, you may need handle changed files. But if there have been large changes, you may need
to clean the installation. To do this, simply run the to clean the installation. To do this, simply run the
<filename>clean.bat</filename> command, which will automatically clean out <filename>clean.bat</filename> command, which will automatically clean out
all generated files. all generated files. You can also run it with with the
<parameter>dist</parameter> parameter, in which case it will behave like
<userinput>make distclean</userinput> and remove the flex/bison output files
as well.
</para> </para>
<para> <para>

View File

@ -1,62 +1,74 @@
@echo off @echo off
REM $PostgreSQL: pgsql/src/tools/msvc/clean.bat,v 1.9 2007/12/19 12:31:35 mha Exp $ REM $PostgreSQL: pgsql/src/tools/msvc/clean.bat,v 1.10 2008/02/06 15:13:25 mha Exp $
set DIST=0
if "%1"=="dist" set DIST=1
set D=%CD% set D=%CD%
if exist ..\msvc if exist ..\..\..\src cd ..\..\.. if exist ..\msvc if exist ..\..\..\src cd ..\..\..
if exist debug rd /s /q debug if exist debug rd /s /q debug
if exist release rd /s /q release if exist release rd /s /q release
call :del *.vcproj for %%f in (*.vcproj) do del %%f
call :del pgsql.sln if exist pgsql.sln del /q pgsql.sln
del /s /q src\bin\win32ver.rc 2> NUL del /s /q src\bin\win32ver.rc 2> NUL
del /s /q src\interfaces\win32ver.rc 2> NUL del /s /q src\interfaces\win32ver.rc 2> NUL
call :del src\backend\win32ver.rc if exist src\backend\win32ver.rc del /q src\backend\win32ver.rc
REM Delete files created with GenerateFiles() in Solution.pm REM Delete files created with GenerateFiles() in Solution.pm
call :del src\include\pg_config.h if exist src\include\pg_config.h del /q src\include\pg_config.h
call :del src\include\pg_config_os.h if exist src\include\pg_config_os.h del /q src\include\pg_config_os.h
call :del src\backend\parser\parse.h if %DIST%==1 if exist src\backend\parser\parse.h del /q src\backend\parser\parse.h
call :del src\include\utils\fmgroids.h if exist src\include\utils\fmgroids.h del /q src\include\utils\fmgroids.h
call :del src\backend\utils\fmgrtab.c if exist src\backend\utils\fmgrtab.c del /q src\backend\utils\fmgrtab.c
call :del src\backend\catalog\postgres.bki if exist src\backend\catalog\postgres.bki del /q src\backend\catalog\postgres.bki
call :del src\backend\catalog\postgres.description if exist src\backend\catalog\postgres.description del /q src\backend\catalog\postgres.description
call :del src\backend\catalog\postgres.shdescription if exist src\backend\catalog\postgres.shdescription del /q src\backend\catalog\postgres.shdescription
call :del src\backend\parser\gram.c if %DIST%==1 if exist src\backend\parser\scan.c del /q src\backend\parser\scan.c
call :del src\backend\bootstrap\bootparse.c if %DIST%==1 if exist src\backend\parser\gram.c del /q src\backend\parser\gram.c
call :del src\backend\bootstrap\bootstrap_tokens.h if %DIST%==1 if exist src\backend\bootstrap\bootscanner.c del /q src\backend\bootstrap\bootscanner.c
if %DIST%==1 if exist src\backend\bootstrap\bootparse.c del /q src\backend\bootstrap\bootparse.c
if %DIST%==1 if exist src\backend\bootstrap\bootstrap_tokens.h del /q src\backend\bootstrap\bootstrap_tokens.h
if %DIST%==1 if exist src\backend\utils\misc\guc-file.c del /q src\backend\utils\misc\guc-file.c
call :del src\bin\psql\sql_help.h
call :del src\interfaces\libpq\libpq.rc if exist src\bin\psql\sql_help.h del /q src\bin\psql\sql_help.h
call :del src\interfaces\libpq\libpqdll.def
call :del src\interfaces\ecpg\compatlib\compatlib.def
call :del src\interfaces\ecpg\ecpglib\ecpglib.def
call :del src\interfaces\ecpg\include\ecpg_config.h
call :del src\interfaces\ecpg\pgtypeslib\pgtypeslib.def
call :del src\interfaces\ecpg\preproc\preproc.c
call :del src\interfaces\ecpg\preproc\preproc.h
call :del src\port\pg_config_paths.h if exist src\interfaces\libpq\libpq.rc del /q src\interfaces\libpq\libpq.rc
if exist src\interfaces\libpq\libpqdll.def del /q src\interfaces\libpq\libpqdll.def
if exist src\interfaces\ecpg\compatlib\compatlib.def del /q src\interfaces\ecpg\compatlib\compatlib.def
if exist src\interfaces\ecpg\ecpglib\ecpglib.def del /q src\interfaces\ecpg\ecpglib\ecpglib.def
if exist src\interfaces\ecpg\include\ecpg_config.h del /q src\interfaces\ecpg\include\ecpg_config.h
if exist src\interfaces\ecpg\pgtypeslib\pgtypeslib.def del /q src\interfaces\ecpg\pgtypeslib\pgtypeslib.def
if %DIST%==1 if exist src\interfaces\ecpg\preproc\pgc.c del /q src\interfaces\ecpg\preproc\pgc.c
if %DIST%==1 if exist src\interfaces\ecpg\preproc\preproc.c del /q src\interfaces\ecpg\preproc\preproc.c
if %DIST%==1 if exist src\interfaces\ecpg\preproc\preproc.h del /q src\interfaces\ecpg\preproc\preproc.h
call :del src\pl\plperl\spi.c if exist src\port\pg_config_paths.h del /q src\port\pg_config_paths.h
call :del src\pl\plpgsql\src\pl_gram.c
call :del src\pl\plpgsql\src\pl.tab.h
call :del contrib\cube\cubeparse.c if exist src\pl\plperl\spi.c del /q src\pl\plperl\spi.c
call :del contrib\cube\cubeparse.h if %DIST%==1 if exist src\pl\plpgsql\src\pl_scan.c del /q src\pl\plpgsql\src\pl_scan.c
call :del contrib\seg\segparse.c if %DIST%==1 if exist src\pl\plpgsql\src\pl_gram.c del /q src\pl\plpgsql\src\pl_gram.c
call :del contrib\seg\segparse.h if %DIST%==1 if exist src\pl\plpgsql\src\pl.tab.h del /q src\pl\plpgsql\src\pl.tab.h
if %DIST%==1 if exist src\bin\psql\psqlscan.c del /q src\bin\psql\psqlscan.c
if %DIST%==1 if exist contrib\cube\cubescan.c del /q contrib\cube\cubescan.c
if %DIST%==1 if exist contrib\cube\cubeparse.c del /q contrib\cube\cubeparse.c
if %DIST%==1 if exist contrib\cube\cubeparse.h del /q contrib\cube\cubeparse.h
if %DIST%==1 if exist contrib\seg\segscan.c del /q contrib\seg\segscan.c
if %DIST%==1 if exist contrib\seg\segparse.c del /q contrib\seg\segparse.c
if %DIST%==1 if exist contrib\seg\segparse.h del /q contrib\seg\segparse.h
if exist src\test\regress\tmp_check rd /s /q src\test\regress\tmp_check if exist src\test\regress\tmp_check rd /s /q src\test\regress\tmp_check
call :del contrib\spi\refint.dll if exist contrib\spi\refint.dll del /q contrib\spi\refint.dll
call :del contrib\spi\autoinc.dll if exist contrib\spi\autoinc.dll del /q contrib\spi\autoinc.dll
call :del src\test\regress\regress.dll if exist src\test\regress\regress.dll del /q src\test\regress\regress.dll
REM Clean up datafiles built with contrib REM Clean up datafiles built with contrib
cd contrib REM cd contrib
for /r %%f in (*.sql) do if exist %%f.in del %%f REM for /r %%f in (*.sql) do if exist %%f.in del %%f
cd %D% cd %D%
@ -64,8 +76,3 @@ REM Clean up ecpg regression test files
msbuild /NoLogo ecpg_regression.proj /t:clean /v:q msbuild /NoLogo ecpg_regression.proj /t:clean /v:q
goto :eof goto :eof
:del
if exist %1 del /q %1
goto :eof