diff --git a/make.bat b/make.bat index 05f930ca5..446d16ceb 100644 --- a/make.bat +++ b/make.bat @@ -1,18 +1,72 @@ @ECHO OFF -REM Command file for Sphinx documentation +if "%1" == "" ( + set LIVEHTML=1 +) +REM Persing of all the flags +:argv_loop +if NOT "%1" == "" ( + if "%1" == "help" ( + goto hepl + ) + + if "%1" == "sphinx" ( + set SPHINXBUILD=%2 + shift + ) else if "%1" == "lang" ( + set BF_LANG=%2 + shift + ) else if "%1" == "port" ( + set PORT=%2 + shift + ) else if "%1" == "livehtml" ( + set LIVEHTML=1 + ) else if "%1" == "-latexpdf" ( + set LATEXPDF=1 + ) else if "%1" == "check_syntax" ( + set CHECK_SINTAX=1 + ) else if "%1" == "checkout_locale" ( + set CHECKOUT_LOCALE=1 + ) else if "%1" == "update_po" ( + set UPDATE_PO=1 + ) else if "%1" == "report_po_progress" ( + set REPORT_PO_PROGRESS=1 + ) else if "%1" == "check_spelling" ( + set CHECK_SPELLING=1 + ) else if "%1" == "check_structure" ( + set CHECK_STRUCTURE=1 + ) else if "%1" == "update" ( + set UPDATE=1 + ) else ( + echo Command unknown: "%1"! + exit /b 1 + ) + + shift + goto argv_loop +) + +REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) +if "%BF_LANG%" == "" ( + set BF_LANG=en +) +if "%PORT%" == "" ( + set PORT=8000 +) + set SOURCEDIR=.\manual set BUILDDIR=build -if "%BF_LANG%" == "" set BF_LANG=en set SPHINXOPTS=-j auto -D language=%BF_LANG% REM Check if sphinx-build is available and fallback to Python version if any %SPHINXBUILD% 1>NUL 2>NUL -if errorlevel 9009 goto sphinx_python +if errorlevel 9009 ( + goto sphinx_python +) goto sphinx_ok :sphinx_python @@ -32,13 +86,7 @@ if errorlevel 9009 ( exit /b 1 ) -:sphinx_ok - -REM Default to livehtml -if "%1" == "" ( - goto livehtml -) - +:hepl if "%1" == "help" ( echo. echo Sphinx @@ -71,61 +119,57 @@ if "%1" == "help" ( goto EOF ) -if "%1" == "livehtml" ( - :livehtml - sphinx-autobuild --open-browser --delay 0 "%SOURCEDIR%" "%BUILDDIR%\html" %SPHINXOPTS% %O% - if errorlevel 1 exit /b 1 +:sphinx_ok + +if "%LIVEHTML%" == "1" ( + sphinx-autobuild --open-browser --delay 0 "%SOURCEDIR%" "%BUILDDIR%\html" %SPHINXOPTS% %O% --port %PORT% + if errorlevel 1 ( + exit /b 1 + ) goto EOF ) -if "%1" == "latexpdf" ( +if "%LATEXPDF%" == "1" ( %SPHINXBUILD% -b latex %SPHINXOPTS% %O% "%SOURCEDIR%" "%BUILDDIR%\latex" cd "%BUILDDIR%\latex" make all-pdf cd %~dp0 echo To view, run: - echo start "%BUILDDIR%\html\blender_manual.pdf" + echo start "%BUILDDIR%\html\blender_manual.pdf" goto EOF ) -if "%1" == "check_syntax" ( +if "%CHECK_SINTAX%" == "1" ( python tools_rst\rst_check_syntax.py --kbd --long - goto EOF ) -if "%1" == "checkout_locale" ( +if "%CHECKOUT_LOCALE%" == "1" ( python tools_make\checkout_locale.py - goto EOF ) -if "%1" == "update_po" ( +if "%UPDATE_PO%" == "1" ( python tools_maintenance\update_po.py - goto EOF ) -if "%1" == "report_po_progress" ( +if "%REPORT_PO_PROGRESS%" == "1" ( IF NOT EXIST %cd%\locale GOTO MISSING_LOCALE python tools_report\report_translation_progress.py locale\%2 --quiet - goto EOF - ) -if "%1" == "check_spelling" ( +if "%CHECK_SINTAX%" == "1" ( python tools_rst\rst_check_spelling.py - goto EOF ) -if "%1" == "check_structure" ( +if "%CHECK_SINTAX%" == "1" ( python tools_rst\rst_check_images.py - goto EOF +) -if "%1" == "update" ( +if "%UPDATE%" == "1" ( python tools_make\make_update.py - goto EOF - ) else ( - %SPHINXBUILD% -M %1 "%SOURCEDIR%" "%BUILDDIR%" %SPHINXOPTS% %O% - goto EOF + REM %SPHINXBUILD% -M %1 "%SOURCEDIR%" "%BUILDDIR%" %SPHINXOPTS% %O% + REM ??????????????????????????????????????????????????????????????? + REM goto EOF ) :MISSING_LOCALE @@ -133,8 +177,8 @@ echo. echo The locale directory is missing. echo. echo To correct this, checkout one or more translation repositories. -echo Details can be found at: -echo https://docs.blender.org/manual/en/latest/about/contribute/translations/contribute.html +echo Details can be found at: +echo https://docs.blender.org/manual/en/latest/about/contribute/translations/contribute.html rem Exit with errorlevel 1 exit /b 1