Author Topic: A general purpose makelib.bat file.  (Read 872 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5945
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
A general purpose makelib.bat file.
« on: October 11, 2018, 03:46:07 PM »
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
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

Vortex

  • Member
  • *****
  • Posts: 1873
Re: A general purpose makelib.bat file.
« Reply #1 on: October 13, 2018, 09:53:30 PM »
Hi Hutch,

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

Code: [Select]
@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--

  • Administrator
  • Member
  • ******
  • Posts: 5945
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: A general purpose makelib.bat file.
« Reply #2 on: October 13, 2018, 11:06:03 PM »
Thanks Erol,

The FOR - IN - DO loop is a good design.  :t
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin: