SYSTEM=$(shell uname) ifeq ($(SYSTEM),Darwin) CC = i386-mingw32-gcc CXX = i386-mingw32-g++ LD = i386-mingw32-g++ STRIP = i386-mingw32-strip --strip-unneeded WINDRES = i386-mingw32-windres else ifeq ($(SYSTEM),MINGW32_NT-5.1) CC = gcc CXX = g++ LD = g++ STRIP = strip --strip-unneeded WINDRES = windres else DISTRIB=$(shell cat /etc/issue | cut -f 1 -d\ | head -1) ifeq ($(DISTRIB), CentOS) CC = i686-pc-mingw32-gcc CXX = i686-pc-mingw32-g++ LD = i686-pc-mingw32-g++ STRIP = i686-pc-mingw32-strip --strip-unneeded WINDRES = i686-pc-mingw32-windres else CC = i586-mingw32msvc-gcc CXX = i586-mingw32msvc-g++ LD = i586-mingw32msvc-g++ STRIP = i586-mingw32msvc-strip --strip-unneeded WINDRES = i586-mingw32msvc-windres endif endif endif INCLUDES = \ -I../mogltk/include \ -I../Baltisot/include \ -I../LuaJIT/src \ -I../lua-modules/src \ -I../Baltisot/MSVC/iconv -I../Baltisot/MSVC/regex -I../Baltisot/MSVC \ -I../Mesa-7.0.3-mingw32/include \ -I../pthreads-w32-2-8-0-release/ \ -I../gnuwin32/include \ -I../tinyxml \ -I../lua-modules-iup/im/include -I../lua-modules-iup/cd/include -I../lua-modules-iup/iup/include \ HAVES = -DHAVE_VSSCANF -DHAVE_LIBJPEG -DHAVE_MALLOC_H -DHAVE_BYTESWAP_H -DHAVE_UCL CPPFLAGS += $(INCLUDES) -g -fexceptions -DLUATASK_OMIT_COMMAND -DSTDC_HEADERS -DLIBICONV_PLUG -DREADLINE_STATIC -fexceptions -DWORDS_LITTLEENDIAN -march=i686 $(HAVES) -DUSE_MPQLIB -DFROM_LUAINTERFACE LDFLAGS_BASIC += -g -fexceptions LDFLAGS += $(LDFLAGS_BASIC) -Wl,--enable-auto-image-base -Wl,--export-dynamic --export-all-symbols -Wl,--enable-auto-import -fexceptions -Wl,--enable-stdcall-fixup LIBS += -L../gnuwin32/lib ../libreadline-static.a -lz.dll -lucl.dll -lwsock32 -lws2_32 ../pthreads-w32-2-8-0-release/libpthreadGC2.a ../LuaJIT-win32/src/luajit.a IUP_LIBS = -lole32 -lcomctl32 -lgdi32 -lcomdlg32 vpath %.c ../Baltisot/lib:../Baltisot/src:src:../mogltk/lib:../tinyxml:../lua-modules/src:../Baltisot/MSVC/iconv:../Baltisot/MSVC/regex:../lua-modules-iup/src vpath %.cc ../Baltisot/lib:../Baltisot/src:src:../mogltk/lib:../tinyxml:../lua-modules/src:../Baltisot/MSVC/iconv:../Baltisot/MSVC/regex:../lua-modules-iup/src vpath %.cpp ../Baltisot/lib:../Baltisot/src:src:../mogltk/lib:../tinyxml:../lua-modules/src:../Baltisot/MSVC/iconv:../Baltisot/MSVC/regex:../lua-modules-iup/src vpath %.lua ../Baltisot/lib:../Baltisot/src:src LUAINTERFACE_SOURCES = \ lua-interface-main.c \ LUAINTERFACE_LDFLAGS = -Wl,--whole-archive ../Mesa-7.0.3-mingw32/lib/libGLU.a ../Mesa-7.0.3-mingw32/lib/libOSMesa.a -Wl,--no-whole-archive LUAINTERFACE_MAIN_SOURCES = \ lua-interface.cpp \ lua-interface-hc.c \ lua-plugin.cc \ BALTISOT_SOURCES = \ Main.cc \ ldirlib.c \ \ RandISAAC.cc \ Exceptions.cc \ String.cc \ Regex.cc \ \ Base64.cc \ Base85.cc \ \ Handle.cc \ Input.cc \ Output.cc \ Buffer.cc \ \ ConfigFile.cc \ \ Socket.cc \ \ Task.cc \ TaskMan.cc \ ChainTasks.cc \ CopyJob.cc \ ReadJob.cc \ HttpServ.cc \ Action.cc \ Domain.cc \ HtmlSkinner.cc \ Variables.cc \ Message.cc \ Form.cc \ SocketClient.cc \ HttpClient.cc \ MailClient.cc \ MailServer.cc \ HashFunction.cc \ \ BLua.cc \ LuaTask.cc \ LuaHandle.cc \ LuaCommandLine.cc \ \ fileutils.cc \ generic.cc \ checkargs.c \ datecalc.c \ \ hashtab.c \ recycle.c \ lookupa.c \ \ iconv.c \ localcharset.c \ relocatable.c \ \ msvc-regex.c \ \ md5.c \ sha1.c \ sha256.c \ LUAINTERFACE_LIGHT_SOURCES = \ plugin-luaconfigfiles.cc \ plugin-luahandle.cc \ plugin-luahttp.cc \ plugin-lualibs.cc \ plugin-luarand.cc \ plugin-luaregex.cc \ plugin-luasmtp.cc \ plugin-luatask.cc \ plugin-luaxml.cc \ plugin-luaiup.cc \ LuaConfigFile.cc \ tinystr.cpp \ tinyxml.cpp \ tinyxmlerror.cpp \ tinyxmlparser.cpp \ LuaXML.cc \ LuaHttp.cc \ LuaRegex.cc \ loadlualibs.cc \ supportlib.lua \ tasklib.lua \ ajaxlib.lua \ htmllib.lua \ xmllib.lua \ httplib.lua \ dblib.lua \ LuaSmtp.cc \ lua-plugin.cc \ lua-interface-hc.c \ lua-interface-light-hc.c \ WHOLE_SOURCES = $(BALTISOT_SOURCES) $(LUA_SOURCES) $(LUAINTERFACE_SOURCES) LUAINTERFACE_OBJECTS = $(addsuffix .o, $(notdir $(basename $(LUAINTERFACE_SOURCES)))) LUAINTERFACE_MAIN_OBJECTS = $(addsuffix .o, $(notdir $(basename $(LUAINTERFACE_MAIN_SOURCES)))) LUAINTERFACE_DLL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(BALTISOT_SOURCES)))) LUAINTERFACE_LIGHT_OBJECTS = lua-interface-light.o $(addsuffix .o, $(notdir $(basename $(LUAINTERFACE_LIGHT_SOURCES)))) ALL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(WHOLE_SOURCES)))) ALL_DEPS = $(addsuffix .dep, $(notdir $(basename $(WHOLE_SOURCES)))) all: dep lua-interface.dll lua-interface.exe dist: all mkdir -p ../lua-interface-dist-win32 $(STRIP) luac.exe lua-interface.dll lua-interface.exe cp lua-interface.dll lua-interface.exe ../lua-interface-dist-win32 dep: $(ALL_DEPS) lua-interface.dll: $(LUAINTERFACE_DLL_OBJECTS) $(LUAINTERFACE_MAIN_OBJECTS) $(LD) -shared -Wl,--output-def=lua-interface.def -Wl,--out-implib=lua-interface.a -o lua-interface.dll $(LUAINTERFACE_DLL_OBJECTS) $(LUAINTERFACE_MAIN_OBJECTS) $(LDFLAGS) $(LUAINTERFACE_LDFLAGS) $(LIBS) lua-interface.exe: $(LUAINTERFACE_OBJECTS) lua-interface-res.o $(LD) -o lua-interface.exe $(LUAINTERFACE_OBJECTS) ./lua-interface.a $(LDFLAGS) $(LIBS) lua-interface-res.o lua-interface-light.exe: lua-interface-light.dll $(LUAINTERFACE_OBJECTS) lua-interface-res.o $(LD) -o lua-interface-light.exe $(LUAINTERFACE_OBJECTS) ./lua-interface.a $(LDFLAGS) $(LIBS) lua-interface-res.o lua-interface-light.dll: $(LUAINTERFACE_DLL_OBJECTS) $(LUAINTERFACE_LIGHT_OBJECTS) $(LD) -shared -Wl,--output-def=lua-interface.def -Wl,--out-implib=lua-interface.a -o lua-interface.dll $(LUAINTERFACE_DLL_OBJECTS) $(LUAINTERFACE_LIGHT_OBJECTS) $(LIBS) $(LDFLAGS) ../lua-modules-iup-win32/luaiup.a $(IUP_LIBS) touch lua-interface-light.dll lua-interface-light.o: lua-interface.cpp $(CC) $(CPPFLAGS) -c -o lua-interface-light.o src/lua-interface.cpp -DLUA_INTERFACE_LIGHT lua-interface-res.o: src/lua-interface.rc src/lua-interface.manifest src/lua.ico src/pen.cur $(WINDRES) -o lua-interface-res.o src/lua-interface.rc clean: rm -f lua-interface.dll lua-interface.exe lua-interface-light.exe *.o *.dep *.a *.def %.dep : %.c $(CC) $(CPPFLAGS) -M -MF $@ $< %.dep : %.cpp $(CXX) $(CPPFLAGS) -M -MF $@ $< %.dep : %.cc $(CXX) $(CPPFLAGS) -M -MF $@ $< lua-interface-hc.c : lua-interface.lua bin2c $< $@ lua_interface_lua lua-interface-light-hc.c : lua-interface-light.lua bin2c $< $@ lua_interface_light_lua %.c : %.lua bin2c $< $@ $(basename $@) -include $(ALL_DEPS)