[AD] embedman.bat for MSVC8

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Attached is a file for MSVC 8 that should be placed in the "misc"
folder. It will be used by an upcoming makefile patch, but for now
will be useful even if run manually after the makefile process.

(NOTE: rename it to "embedman.bat".)

In short, it embeds all manifest files into their corresponding
executables and then deletes the manifest file. It does it by
searching for files, so there is no hard coding of paths. Usage:

To search and embed all manifest files:
misc\embedman.bat all

To do one executable:
misc\embedman.bat demo\demo.exe 1

To do one DLL:
misc\embedman.bat lib\msvc\alleg42.dll 2


--
Matthew Leverton
@ECHO OFF
REM *** embedman.bat is a helper tool for MSVC8.
REM     It embeds all XML manifest files into its corresponding executable.

REM ======== DISPATCHING ========
IF "%1" == "" GOTO usage
IF "%1" == "all" IF "%2" == "" GOTO search
IF "%2" == "" GOTO bad_usage
IF NOT EXIST "%1" GOTO file_not_found
IF NOT EXIST "%1.manifest" GOTO no_manifest

REM ======== EMBED MANIFEST ========
mt -nologo -manifest %1.manifest -outputresource:%1;%2
IF NOT "%ERRORLEVEL%" == "0" GOTO mt_fail
del %1.manifest
GOTO end

REM ======== SEARCH AND EMBED ========
:search
FOR /R %%v IN (*.exe) DO CALL %0 %%v 1 -silent
FOR /R %%v IN (*.scr) DO CALL %0 %%v 1 -silent
FOR /R %%v IN (*.dll) DO CALL %0 %%v 2 -silent

GOTO end

REM ======== ERRORS ========
:usage
ECHO.
ECHO Running embedman.bat with "all" as the first and only parameter causes it to 
ECHO search for all executables and DLLs with manifest files, and embed them.
ECHO.
ECHO %0 all
ECHO.
ECHO Alternatively, you can specify an exact file:
ECHO.
ECHO %0 file.exe 1
ECHO %0 file.dll 2
ECHO.
ECHO In every case, the manifest file must exist in the same folder with the same
ECHO name as the executable for it to work. The manifest file is then deleted.
GOTO end

:bad_usage
ECHO.
ECHO You must specify whether the file is an executable or DLL via the second
ECHO parameter.
ECHO.
ECHO 1 = Executable
ECHO 2 = DLL
GOTO end

:file_not_found
ECHO.
ECHO The file "%1" was not found.
GOTO end

:mt_fail
ECHO Unable to embed %1.manifest! Make sure mt.exe is in the path.
GOTO end

:no_manifest
IF NOT "%3" == "-silent" ECHO No manifest found for %1


REM ======== THE END ========
:end


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/