News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

A general purpose makelib.bat file.

Started by hutch--, October 11, 2018, 03:46:07 PM

Previous topic - Next topic

hutch--

Should be easy enough to use, put your library source files into a directory, add this batch file and run the batch file from the command line with the name of the library with NO extension and it will build your source files into a library of your name choice.
@echo off
  if "%1" == "" goto quit
  if "%1" == "?" goto help
  dir /b *.asm > src.txt
  \masm32\bin64\ml64 /c @src.txt
  dir /b *.obj > obj.txt
  @echo.
  \masm32\bin64\lib /MACHINE:X64 /OUT:%1.lib @obj.txt
  del *.obj
  del obj.txt
  del src.txt
  dir *.lib
  pause
  goto theend
:help
  @echo.
  @echo ****************************
  @echo SYNTAX : makelib YourLibName
  @echo ****************************
  @echo.
  pause
  goto theend
:quit
  %echo --------------------------------------------------------------------------------------------
  %echo Missing library name, run the batch file with the library name you require with NO extension
  %echo --------------------------------------------------------------------------------------------
  goto help
:theend

Vortex

Hi Hutch,

Thanks. Here is another version using a FOR loop to process all the source files :

@echo off

  if "%1" == "" goto quit
  if "%1" == "?" goto help

  for /r %%v IN (*.asm) do \masm32\bin64\ml64 /c %%v
 
  \masm32\bin64\lib /MACHINE:X64 /OUT:%1.lib *.obj

  @echo.

  del *.obj
  dir *.lib
  pause

  goto theend
:help
  @echo.
  @echo ****************************
  @echo SYNTAX : makelib YourLibName
  @echo ****************************
  @echo.
  pause
  goto theend
:quit
  %echo --------------------------------------------------------------------------------------------
  %echo Missing library name, run the batch file with the library name you require with NO extension
  %echo --------------------------------------------------------------------------------------------
  goto help
:theend

hutch--

Thanks Erol,

The FOR - IN - DO loop is a good design.  :t