lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


David Manura writes:
> The output of etc/luavs.bat can be made more terse as follows...

Here's a further cleaned-up version of luavs.bat.

<snip>
@rem Script to build Lua under "Visual Studio .NET Command Prompt".
@rem Do not run from this directory; run it from the toplevel: etc\luavs.bat .
@rem It creates lua51.dll, lua51.lib, lua.exe, and luac.exe in src.

@setlocal
@set MYCOMPILE=cl /nologo /MD /O2 /W4 /c /D_CRT_SECURE_NO_DEPRECATE
@set MYLINK=link /nologo

cd src
%MYCOMPILE% /DLUA_BUILD_AS_DLL l*.c
del lua.obj luac.obj
%MYLINK% /DLL /out:lua51.dll l*.obj
%MYCOMPILE% /DLUA_BUILD_AS_DLL lua.c
%MYLINK% /out:lua.exe lua.obj lua51.lib
%MYCOMPILE% l*.c print.c
del lua.obj linit.obj lbaselib.obj ldblib.obj liolib.obj lmathlib.obj ^
    loslib.obj ltablib.obj lstrlib.obj loadlib.obj
%MYLINK% /out:luac.exe *.obj
del *.obj
cd ..
</snip>

Summary of differences:

- Warning level 4 (/W4) is now usable following the changes in 5.1.3-rc3.
  At least this is true in VC2005.  I haven't tried VC2008.
  VC6 (a ten-year-old compiler) gives some odd warnings including
  one in a standard header.  So, if you still want to use warning
  level 3 (/W3), that is ok.
- Prepend @ to commands that don't need echo.
- Add /nologo to avoid verbose banner display.
- Use line continuation char ^ to avoid >80 char lines.
- Simplify with local variable substitutions: MYCOMPILE/MYLINK.
  Note: I originally named these COMPILE/LINK, but LINK causes
  a conflict in link.exe.
- Remove /D_CRT_NONSTDC_NO_DEPRECATE .  It didn't seem necessary
  for me.  _CRT_NONSTDC_NO_DEPRECATE appears undocumented,
  but from the VC headers, I see it has to do with disabling warning
  when non-ANSI POSIX-like functions are not preceded by a
  a leading underscore.  It does no harm though if you want to
  keep it in.