@echo off
rem ---
rem --- generic install batch file for Meadow & NTEmacs
rem ---

rem --- Argument
rem ---   elc, no argument : byte compile only
rem ---   all, install : compile and install
rem ---   what-where: list modules to be installed and where to.
rem ---   clean : cleanup
rem ---


rem --- check if executed from make.bat
if not "%SUBMAKEOK%"=="OK" goto prnusage
set SUBMAKEOK=

rem --- check command
set arg1=%1
if "%arg1%"=="" goto compile
if "%arg1%"=="all" goto install
if "%arg1%"=="install" goto install
if "%arg1%"=="elc" goto compile
if "%arg1%"=="what-where" goto listing
if "%arg1%"=="clean" goto clean
echo Unrecognized argument: specify either 'elc', 'all', 'install', 'clean'
echo Default is 'else' (when no argument is specified.)
goto end

rem --- install
:install
%EMACS% -batch -q -no-site-file -l makeconf.el -f install-modules %PREFIX% NONE %LISPDIR% %INFODIR% %VERSION_SPECIFIC_LISPDIR%
goto end

rem --- compile
:compile
%EMACS% -batch -q -no-site-file -l makeconf.el -f compile-modules %PREFIX% NONE %LISPDIR% %INFODIR% %VERSION_SPECIFIC_LISPDIR%
goto end

rem --- listing
:listing
%EMACS% -batch -q -no-site-file -l makeconf.el -f what-where-modules %PREFIX% NONE %LISPDIR% %INFODIR% %VERSION_SPECIFIC_LISPDIR%
goto end

rem --- cleanup
:clean
del *.elc
del *~
goto end

:printenv
echo EMACS=%EMACS%
echo LISPDIR=%LISPDIR%
goto pauseend

:prnusage
echo This file should not be executed by itself. Use makeit.bat.

:pauseend
echo Type any key when you're done reading the error message.
pause

rem --- end of makeit.bat
:end
