SYSTEM=$(shell uname) SUBSYSTEM=$(shell uname | cut -f 1 -d_ ) ifeq ($(SYSTEM),Darwin) CC = i386-mingw32-gcc CXX = i386-mingw32-g++ LD = i386-mingw32-g++ STRIP = i386-mingw32-strip --strip-unneeded else ifeq ($(SUBSYSTEM),MINGW32) CC = gcc CXX = g++ LD = g++ strip = strip 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 else CC = i686-w64-mingw32-gcc CXX = i686-w64-mingw32-g++ LD = i686-w64-mingw32-g++ STRIP = i686-w64-mingw32-strip --strip-unneeded endif endif endif INCLUDES = \ -I ../Mesa-7.0.3-mingw32/include \ -I../mogltk/include \ -I../Baltisot/include \ -I../LuaJIT/src \ -I ../tinyxml \ -I ../mysql-5.0.51b-win32/include \ -I ../ftgl-win32/include -I ../freetype-win32/include/freetype2 \ -I ../Baltisot/MSVC/regex \ -I ../gnuwin32/include \ -I ../pthreads-w32-2-8-0-release/ \ -I ../gnuwin32/include/ImageMagick \ -I ../occi-gateway/ \ HAVES = -DHAVE_VSSCANF -DHAVE_LIBJPEG -DHAVE_MALLOC_H -DHAVE_BYTESWAP_H -DUSE_OSMESA -DHAVE_MYSQL CPPFLAGS += $(INCLUDES) -g -DSTDC_HEADERS -DREADLINE_STATIC -DHOOK_STDS -DWORDS_LITTLEENDIAN -fexceptions -march=i686 $(HAVES) -DNDEBUG -DMAGICK_STATIC_LINK # -DUSE_MGL_NAMESPACE LDFLAGS += -g -fexceptions -shared ../lua-interface/lua-interface.a -Wl,--export-dynamic -Wl,--enable-auto-image-base -Wl,--export-all-symbols -Wl,--enable-auto-import \ -L ../freetype-win32/lib -L ../gnuwin32/lib -L ../ftgl-win32/lib/ vpath %.c ../Baltisot/lib:../Baltisot/src:src:../mogltk/lib:../tinyxml vpath %.cc ../Baltisot/lib:../Baltisot/src:src:../mogltk/lib:../tinyxml vpath %.cpp ../Baltisot/lib:../Baltisot/src:src:../mogltk/lib:../tinyxml:../occi-gateway vpath %.lua ../Baltisot/lib:../Baltisot/src CONFIGFILES_SOURCES = \ plugin-luaconfigfiles.cc \ LuaConfigFile.cc \ CONFIGFILES_LIBS = XML_SOURCES = \ plugin-luaxml.cc \ tinystr.cpp \ tinyxml.cpp \ tinyxmlerror.cpp \ tinyxmlparser.cpp \ LuaXML.cc \ XML_LIBS = OCCI_SOURCES = \ plugin-luaocci.cc \ LuaOCCI.cc \ OCCI-mingw32gateway.cpp \ OCCI_LIBS = ../gnuwin32/lib/OCCI-MSVCgateway.lib HANDLE_SOURCES = \ plugin-luahandle.cc \ HANDLE_LIBS = HTTP_SOURCES = \ plugin-luahttp.cc \ LuaHttp.cc \ HTTP_LIBS = REGEX_SOURCES = \ plugin-luaregex.cc \ LuaRegex.cc \ REGEX_LIBS = TASK_SOURCES = \ plugin-luatask.cc \ TASK_LIBS = SQL_SOURCES = \ plugin-luasql.cc \ SQL.cc \ LuaSQL.cc \ SQL_LIBS = ../mysql-5.0.51b-win32/lib/libmySQL.a LUALIBS_SOURCES = \ plugin-lualibs.cc \ loadlualibs.cc \ LUA_LIB = \ supportlib.lua \ tasklib.lua \ ajaxlib.lua \ htmllib.lua \ xmllib.lua \ httplib.lua \ dblib.lua \ GL_SOURCES = \ plugin-luagl.cc \ LuaGL.cc \ GL_LIBS = FTGL_SOURCES = \ plugin-luaftgl.cc \ LuaFTGL.cc \ FTGL_LIBS = -lftgl-mingw32 -lfreetype.dll OSMESA_SOURCES = \ plugin-luaosmesa.cc \ dds.c \ OSMESA_LIBS = -lMagick++ -lMagickWand -lMagickCore -lbz2.dll -lz.dll -lfreetype.dll -lgdi32 -ljpeg.dll -lpng.dll ../pthreads-w32-2-8-0-release/libpthreadGC2.a WHOLE_SOURCES = \ $(CONFIGFILES_SOURCES) \ $(LUALIBS_SOURCES) \ $(XML_SOURCES) \ $(TASK_SOURCES) \ $(HANDLE_SOURCES) \ $(HTTP_SOURCES) \ $(REGEX_SOURCES) \ $(GL_SOURCES) \ $(FTGL_SOURCES) \ $(OSMESA_SOURCES) \ $(SQL_SOURCES) \ MODULES_LIST = \ luaconfigfiles.dll \ lualibs.dll \ luaxml.dll \ luatask.dll \ luahandle.dll \ luahttp.dll \ luaregex.dll \ luagl.dll \ luaftgl.dll \ luaosmesa.dll \ luasql.dll \ luaocci.dll \ ALL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(WHOLE_SOURCES) $(LUA_LIB)))) ALL_DEPS = $(addsuffix .dep, $(notdir $(basename $(WHOLE_SOURCES)))) all: dep modules dist: modules mkdir -p ../lua-interface-dist-win32 $(STRIP) $(MODULES_LIST) cp $(MODULES_LIST) ../lua-interface-dist-win32 modules: $(MODULES_LIST) dep: $(ALL_DEPS) luaconfigfiles.dll: $(addsuffix .o, $(notdir $(basename $(CONFIGFILES_SOURCES)))) $(LD) -o $@ $+ $(CONFIGFILES_LIBS) $(LDFLAGS) luaxml.dll: $(addsuffix .o, $(notdir $(basename $(XML_SOURCES)))) $(LD) -o $@ $+ $(XML_LIBS) $(LDFLAGS) luaocci.dll: $(addsuffix .o, $(notdir $(basename $(OCCI_SOURCES)))) $(LD) -o $@ $+ $(OCCI_LIBS) $(LDFLAGS) luahandle.dll: $(addsuffix .o, $(notdir $(basename $(HANDLE_SOURCES)))) $(LD) -o $@ $+ $(HANDLE_LIBS) $(LDFLAGS) luahttp.dll: $(addsuffix .o, $(notdir $(basename $(HTTP_SOURCES)))) $(LD) -o $@ $+ $(HTTP_LIBS) $(LDFLAGS) luaregex.dll: $(addsuffix .o, $(notdir $(basename $(REGEX_SOURCES)))) $(LD) -o $@ $+ $(REGEX_LIBS) $(LDFLAGS) luatask.dll: $(addsuffix .o, $(notdir $(basename $(TASK_SOURCES)))) $(LD) -o $@ $+ $(TASK_LIBS) $(LDFLAGS) luasql.dll: $(addsuffix .o, $(notdir $(basename $(SQL_SOURCES)))) $(LD) -o $@ $+ $(SQL_LIBS) $(LDFLAGS) luagl.dll: $(addsuffix .o, $(notdir $(basename $(GL_SOURCES)))) $(LD) -o $@ $+ $(GL_LIBS) $(LDFLAGS) luaftgl.dll: $(addsuffix .o, $(notdir $(basename $(FTGL_SOURCES)))) $(LD) -o $@ $+ $(FTGL_LIBS) $(LDFLAGS) lualibs.dll: $(addsuffix .o, $(notdir $(basename $(LUALIBS_SOURCES) $(LUA_LIB)))) $(LD) -o $@ $+ $(LUALIBS_LIBS) $(LDFLAGS) luaosmesa.dll: $(addsuffix .o, $(notdir $(basename $(OSMESA_SOURCES)))) $(LD) -o $@ $+ $(OSMESA_LIBS) $(LDFLAGS) clean: rm -f *.o *.dep *.dll %.dep : %.c $(CC) $(CPPFLAGS) -M -MF $@ $< %.dep : %.cpp $(CXX) $(CPPFLAGS) -M -MF $@ $< %.dep : %.cc $(CXX) $(CPPFLAGS) -M -MF $@ $< %.c : %.lua bin2c $< $@ $(basename $@) -include $(ALL_DEPS)