SYSTEM=$(shell uname) MACHINE=$(shell uname -m) DISTRIB=$(shell cat /etc/issue | cut -f 1 -d\ | head -1) ifeq ($(SYSTEM),Darwin) ARCH_FLAGS= LDFLAGS_MESA=-all_load ../Mesa-7.4.2/lib/libGLU.a ../Mesa-7.4.2/lib/libOSMesa.a CPPFLAGS_READLINE= LDFLAGS_READLINE=-lreadline -lncurses SHARED_FLAGS=-dynamiclib SHARED_EXT=dylib LIBS=-liconv LD = g++ LDFLAGS_GL = -L/usr/X11/lib -lGLU -lGL -X11 -dylib_file \ /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:\ /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib else ARCH_FLAGS=-march=i686 -m32 ASFLAGS=-march=i686 --32 LDFLAGS_MESA=-u gluNewTess -Wl,--whole-archive ../Mesa-7.4.2/lib/libGLU.a ../Mesa-7.4.2/lib/libOSMesa.a -Wl,--no-whole-archive CPPFLAGS_READLINE=-DREADLINE_STATIC LDFLAGS_READLINE=/usr/lib/libreadline.a /usr/lib/libncurses.a ifeq ($(MACHINE),x86_64) ifeq ($(DISTRIB),Debian) #LDFLAGS_READLINE=/usr/lib32/libreadline.a /usr/lib32/libncurses.a endif ifeq ($(DISTRIB),Debian) HAVES = -DHAVE_UCL LDFLAGS = -lucl endif endif SHARED_FLAGS=-shared SHARED_EXT=so LD = g++ -m32 LDFLAGS_GL = -lGLU -lGL endif CC = gcc CXX = g++ STRIP = strip INCLUDES = \ -I../mogltk/include \ -I../Baltisot/include \ -I../Baltisot/lib/zlib/include \ -I../Baltisot/lib/lua/include -I../Baltisot/lib/lua/includes \ -I../lua-modules/src \ \ -I ../Mesa-7.4.2/include \ -I ../tinyxml \ -I /usr/include/mysql \ -I /usr/include/FTGL -I /usr/include/freetype2 \ -I /usr/include/oracle/11.1.0.1/client/ \ -I ../PSX-Bundle/includes HAVES += -DHAVE_VSSCANF -DHAVE_LIBJPEG -DHAVE_FCNTL -DHAVE_MYSQL -DHAVE_UNISTD_H -DHAVE_FORK -DHAVE_PIPE -DHAVE_FSYNC -DHAVE_MALLOC_H -DHAVE_ASPRINTF -DHAVE_BYTESWAP_H LIBS += -lz -ldl -lpthread CPPFLAGS += $(INCLUDES) -g -DSTDC_HEADERS $(CPPFLAGS_READLINE) -DHOOK_STDS -fexceptions -DWORDS_LITTLEENDIAN -fexceptions $(ARCH_FLAGS) $(HAVES) -DUSE_MPQLIB BASIC_LDFLAGS = $(ARCH_FLAGS) $(LIBS) LDFLAGS += $(BASIC_LDFLAGS) $(LDFLAGS_READLINE) -L/usr/lib/oracle/11.1.0.1/client/lib vpath %.c ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../paperIdol/src:../mogltk/lib:../tinyxml:../lua-modules/src vpath %.cc ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../paperIdol/src:../mogltk/lib:../tinyxml:../lua-modules/src:../lua-modules-cd-tool/src vpath %.cpp ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../paperIdol/src:../mogltk/lib:../tinyxml:../lua-modules/src:../PSX-Bundle/lib vpath %.lua ../Baltisot/lib:../Baltisot/src LUAINTERFACE_SOURCES = \ lua-interface.cc \ lua-plugin.cc \ BALTISOT_SOURCES = \ Main.cc \ \ RandISAAC.cc \ Exceptions.cc \ String.cc \ Regex.cc \ \ Base64.cc \ \ Handle.cc \ Input.cc \ InPipe.cc \ Output.cc \ Buffer.cc \ \ ConfigFile.cc \ \ Socket.cc \ \ Task.cc \ TaskMan.cc \ ChainTasks.cc \ CopyJob.cc \ ReadJob.cc \ HttpServ.cc \ MailServer.cc \ Action.cc \ Domain.cc \ HtmlSkinner.cc \ Variables.cc \ Message.cc \ Form.cc \ SocketClient.cc \ HttpClient.cc \ MailClient.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 \ \ md5.c \ sha1.c \ sha256.c \ LUA_SOURCES = \ lapi.c \ lcode.c \ ldebug.c \ ldo.c \ ldump.c \ lfunc.c \ lgc.c \ llex.c \ lmem.c \ lobject.c \ lopcodes.c \ lparser.c \ lstate.c \ lstring.c \ ltable.c \ ltests.c \ ltm.c \ luacomp.c \ lundump.c \ lvm.c \ lzio.c \ lprint.c \ \ linit.c \ lauxlib.c \ loadlib.c \ lbaselib.c \ ldblib.c \ ldirlib.c \ liolib.c \ loslib.c \ lmathlib.c \ lstrlib.c \ ltablib.c \ LUAC_SOURCES = \ luac.cc \ \ Main.cc \ Exceptions.cc \ String.cc \ \ Handle.cc \ Input.cc \ Output.cc \ Buffer.cc \ \ BLua.cc \ \ fileutils.cc \ generic.cc \ checkargs.c \ datecalc.c \ DEBUG_MODULES = \ lua-interface-main.c \ tinystr.cpp \ tinyxml.cpp \ tinyxmlerror.cpp \ tinyxmlparser.cpp \ plugin-luaconfigfiles.cc \ LuaConfigFile.cc \ plugin-luaxml.cc \ LuaXML.cc \ plugin-luahandle.cc \ plugin-luahttp.cc \ LuaHttp.cc \ plugin-luaregex.cc \ LuaRegex.cc \ plugin-luatask.cc \ plugin-lualibs.cc \ loadlualibs.cc \ supportlib.lua \ tasklib.lua \ ajaxlib.lua \ htmllib.lua \ xmllib.lua \ httplib.lua \ dblib.lua \ plugin-luacd.cc \ luacd.cpp \ cdabstract.cpp \ cdreader.cpp \ cdutils.cpp \ dvdabstract.cpp \ isobuilder.cpp \ yazedc.cpp \ WHOLE_SOURCES = $(BALTISOT_SOURCES) $(LUA_SOURCES) $(LUAINTERFACE_SOURCES) gl-glue.s DEBUG_SOURCES = $(DEBUG_MODULES) LUAINTERFACE_OBJECTS = $(addsuffix .o, $(notdir $(basename $(LUAINTERFACE_SOURCES)))) LUAC_OBJECTS = $(addsuffix .o, $(notdir $(basename $(LUAC_SOURCES) $(LUA_SOURCES)))) DEBUG_OBJECTS = $(addsuffix .o, $(notdir $(basename $(DEBUG_SOURCES)))) ALL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(WHOLE_SOURCES)))) ALL_DEPS = $(addsuffix .dep, $(notdir $(basename $(WHOLE_SOURCES) $(DEBUG_SOURCES)))) all: dep luac lua-interface dist: luac lua-interface lua-interface-gl.$(SHARED_EXT) mkdir -p ../lua-interface-dist cp luac lua-interface lua-interface-*.$(SHARED_EXT) ../lua-interface-dist dep: $(ALL_DEPS) luac: $(LUAC_OBJECTS) $(LD) -o luac $(LUAC_OBJECTS) $(BASIC_LDFLAGS) lua-interface-mesa.$(SHARED_EXT): $(ALL_OBJECTS) $(LD) $(SHARED_FLAGS) -o lua-interface.$(SHARED_EXT) $(ALL_OBJECTS) $(LDFLAGS) $(LDFLAGS_MESA) mv lua-interface.$(SHARED_EXT) $@ ln -sf $@ lua-interface.$(SHARED_EXT) lua-interface-gl.$(SHARED_EXT): $(ALL_OBJECTS) $(LD) $(SHARED_FLAGS) -o lua-interface.$(SHARED_EXT) $(ALL_OBJECTS) $(LDFLAGS) $(LDFLAGS_GL) mv lua-interface.$(SHARED_EXT) $@ ln -sf $@ lua-interface.$(SHARED_EXT) lua-interface: lua-interface-mesa.$(SHARED_EXT) lua-interface-main.o $(LD) -o $@ ./lua-interface.$(SHARED_EXT) lua-interface-main.o lua-interface-dbg: $(ALL_OBJECTS) $(DEBUG_OBJECTS) $(LD) -o lua-interface-dbg $(ALL_OBJECTS) $(DEBUG_OBJECTS) $(LDFLAGS) clean: rm -f lua-interface-mesa lua-interface-gl luac *.o *.dep *.so *.dylib %.dep : %.c $(CC) $(CPPFLAGS) -M -MF $@ $< %.dep : %.cpp $(CXX) $(CPPFLAGS) -M -MF $@ $< %.dep : %.cc $(CXX) $(CPPFLAGS) -M -MF $@ $< %.c : %.clua bin2c $< $@ $(basename $@) %.clua : %.lua ./luac -o $@ $< gl-glue.dep: touch gl-glue.dep gl-glue.s: src/generate-gl-glue.sh > gl-glue.s -include $(ALL_DEPS) .PHONY: dist