Last active
February 5, 2026 00:21
-
-
Save James-E-A/f7e193597904ed01627eac22134997bd to your computer and use it in GitHub Desktop.
Lua 5.5 MSVC Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Makefile for building Lua on Windows with MSVC | |
| # See ../doc/readme.html for installation and customization instructions. | |
| # == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= | |
| # Your platform. See PLATS for possible values. | |
| PLAT= msvc | |
| CC= cl.exe | |
| CFLAGS= /O2 /Wall /DLUA_BUILD_AS_DLL $(SYSCFLAGS) $(MYCFLAGS) | |
| LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) | |
| LIBS= $(SYSLIBS) $(MYLIBS) | |
| RM= del /F | |
| SYSCFLAGS= | |
| SYSLDFLAGS= | |
| SYSLIBS= | |
| MYCFLAGS= | |
| MYLDFLAGS= | |
| MYLIBS= | |
| MYOBJS= | |
| # Special flags for compiler modules; -Os reduces code size. | |
| CMCFLAGS= | |
| # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= | |
| PLATS= msvc | |
| LUA_A= liblua.lib | |
| CORE_O= lapi.obj lcode.obj lctype.obj ldebug.obj ldo.obj ldump.obj lfunc.obj lgc.obj llex.obj lmem.obj lobject.obj lopcodes.obj lparser.obj lstate.obj lstring.obj ltable.obj ltm.obj lundump.obj lvm.obj lzio.obj | |
| LIB_O= lauxlib.obj lbaselib.obj lcorolib.obj ldblib.obj liolib.obj lmathlib.obj loadlib.obj loslib.obj lstrlib.obj ltablib.obj lutf8lib.obj linit.obj | |
| BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) | |
| LUA_T= lua55.dll lua55.exe luac55.exe | |
| LUA_O= lua.obj | |
| LUAC_T= luac55.exe | |
| LUAC_O= luac.obj | |
| ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) | |
| ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) | |
| ALL_A= $(LUA_A) | |
| # Targets start here. | |
| default: $(PLAT) | |
| all: $(ALL_T) | |
| obj: $(ALL_O) | |
| lib: $(ALL_A) | |
| $(LUA_A): $(BASE_O) | |
| lib.exe /OUT:$@ $(BASE_O) | |
| lua55.dll: $(BASE_O) $(LUA_A) | |
| link.exe $(LDFLAGS) /DLL /OUT:$@ /IMPLIB:$(LUA_A) $(BASE_O) | |
| lua55.exe: $(LUA_O) $(LUA_A) lua55.dll | |
| link.exe $(LDFLAGS) /OUT:$@ $(LUA_O) $(LUA_A) $(LIBS) | |
| # FIXME: this is a massive pain to get working, apparently requires PATCHING THE SOURCE?? | |
| # https://gist.github.com/Frityet/06ec8d5572b5ea08353c7de92cffc001/da679f962e927d840b27f3c408adb85a2c0051d2#step-25-wlua-optional | |
| wlua55.exe: wlua.obj $(LUA_A) lua55.dll | |
| link.exe $(LDFLAGS) /SUBSYSTEM:WINDOWS /OUT:$@ wlua.obj $(LUA_A) $(LIBS) | |
| luac55.exe: $(LUAC_O) $(CORE_O) $(LUA_A) lua55.dll | |
| link.exe $(LDFLAGS) /OUT:$@ $(LUAC_O) $(CORE_O) $(LUA_A) $(LIBS) | |
| test: | |
| .\$(LUA_T) -v | |
| clean: | |
| $(RM) $(ALL_T) $(ALL_O) | |
| # Convenience targets for popular platforms. | |
| ALL= all | |
| msvc: $(ALL) | |
| # Compiler modules may use special flags. | |
| llex.obj: | |
| $(CC) $(CFLAGS) $(CMCFLAGS) /c llex.c | |
| lparser.obj: | |
| $(CC) $(CFLAGS) $(CMCFLAGS) /c lparser.c | |
| lcode.obj: | |
| $(CC) $(CFLAGS) $(CMCFLAGS) /c lcode.c |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment