News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

batch file program

Started by marla, February 24, 2006, 10:04:14 PM

Previous topic - Next topic

marla

i am trying to make a generic batch file i can use on the command line. the file name is make.bat - i want it to use polink. also, i want to use it at the command line like "make.bat myasmfilename.asm" - so instead of NAME=friender - i would use "make.bat friender"

either way, the following code does not work, any ideas?

NAME=friender
$(NAME).exe: $(NAME).obj
   c:\masm32\bin\polink /SUBSYSTEM:WINDOWS $(NAME).obj
$(NAME).obj: $(NAME).asm
        c:\masm32\bin\ml /c /coff /Cp $(NAME).asm

Vortex

Your code is a script for the make utility.

Try this one for a batch file :

\masm32\bin\ml /c /coff %1.asm
\masm32\bin\polink /SUBSYSTEM:WINDOWS %1.obj

Mark Jones

"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

PBrennick

marla,
The way you wrote the script woulld require you to download nmake.exe and put it in the bin directory and run it this way...
\masm32\bin\nmake\NAME where NAME woulld be the assembly file.  The following script will do a better job because it does a complete check of necessary files.  Just name it make.bat and change the line that says
set file="yourname.asm"
to match the name of your file.  Any resource file should have the same name as the assembly file.

@echo off
set file="yourname.asm"

if exist %file%.obj del %file%.obj
if exist %file%.res del %file%.res
if exist %file%.exe del %file%.exe
if not exist %file%.rc goto nores
if not exist %file%.asm goto errasm

\masm32\bin\rc.exe /v %file%.rc
if not exist %file%.res goto nores
ren %file%.RES %file%.res

\masm32\bin\ml.exe /c /coff %file%.asm >trash.can
if errorlevel 1 goto errasm
del trash.can

\masm32\bin\polink.exe /SUBSYSTEM:WINDOWS /LIBPATH:masm32\lib %file%.obj %file%.res
if errorlevel 1 goto errlink

del %file%.res
del %file%.obj

dir /b /a-d %file%.*
goto TheEnd

:nores
echo _
echo Resource error
goto TheEnd

:errlink
echo _
echo Link error
goto TheEnd

:errasm
echo _
echo Assembly Error
goto TheEnd

:TheEnd
echo _
pause


Paul
The GeneSys Project is available from:
The Repository or My crappy website