ifeq ($(SYSTEM),) SYSTEM=$(shell uname) endif TRUESYSTEM=$(shell uname) MACHINE=$(shell uname -m) DISTRIB=$(shell cat /etc/issue | cut -f 1 -d\ | head -1) GL_GLUE=gl-glue.s CC = gcc CXX = g++ LD = g++ AS = gcc -c -m32 LUAJIT = ../LuaJIT/src/libluajit.a ifeq ($(SYSTEM),Darwin) LIPO = lipo ARCH_FLAGS=-arch i386 LDFLAGS_MESA=-all_load ../Mesa-7.4.4/lib/libGLU.a ../Mesa-7.4.4/lib/libmesa.a ../Mesa-7.4.4/lib/libglapi.a ../Mesa-7.4.4/lib/osmesa.o CPPFLAGS_READLINE= LDFLAGS_READLINE=-lreadline -lncurses SHARED_FLAGS=-dynamiclib SHARED_EXT=dylib LIBS=-liconv LD = g++ -arch i386 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 STRIP = strip -x ifeq ($(TRUESYSTEM),Linux) CC = i686-apple-darwin9-gcc CXX = i686-apple-darwin9-g++ LD = i686-apple-darwin9-g++ -arch i386 -mmacosx-version-min=10.5 STRIP = i686-apple-darwin9-strip -x AS = i686-apple-darwin9-as -arch i386 LIPO = i686-apple-darwin9-lipo ARCH_FLAGS = LDFLAGS_MESA = -all_load ../Mesa-7.4.4-darwin9/lib/libGLU.a ../Mesa-7.4.4-darwin9/lib/libOSMesa.a LUAJIT = ../LuaJIT-darwin9/src/libluajit.a endif else ARCH_FLAGS=-march=i686 -m32 ASFLAGS=-march=i686 LDFLAGS_MESA=-u gluNewTess -Wl,--whole-archive ../Mesa-7.4.4/lib/libGLU.a ../Mesa-7.4.4/lib/libOSMesa.a -Wl,--no-whole-archive CPPFLAGS_READLINE=-DREADLINE_STATIC LDFLAGS_READLINE=/usr/lib/i386-linux-gnu/libreadline.a /usr/lib/i386-linux-gnu/libncurses.a ifeq ($(MACHINE),x86_64) ifeq ($(DISTRIB),Debian) #LDFLAGS_READLINE=/usr/lib32/libreadline.a /usr/lib32/libncurses.a endif endif ifeq ($(MACHINE),i686) ifeq ($(DISTRIB),Debian) HAVES = -DHAVE_UCL BASIC_LDFLAGS = /usr/lib/i386-linux-gnu/libucl.a endif endif SHARED_FLAGS=-shared SHARED_EXT=so LD = g++ -m32 LDFLAGS_GL = -lGLU -lGL STRIP = strip --strip-unneeded endif HAVE_ORACLE=$(shell [ -d /usr/local/instantclient ] || [ -e /usr/include/oracle/11.1/client/occi.h ] || [ -e /usr/bin/sqlplus ] && echo true || echo false) INCLUDES = \ -I../mogltk/include \ -I../Baltisot/include \ -I../Baltisot/lib/zlib/include \ -I../LuaJIT/src \ -I../lua-modules/src \ \ -I ../Mesa-7.4.4/include \ -I ../tinyxml \ -I /usr/include/mysql \ -I /usr/include/FTGL -I /usr/include/freetype2 \ -I /usr/include/oracle/11.2.0.1.0/client/ \ -I ../PSX-Bundle/includes \ -I../lua-modules-iup/im/include -I../lua-modules-iup/cd/include -I../lua-modules-iup/iup/include \ HAVES += -DHAVE_VSSCANF -DHAVE_LIBJPEG -DHAVE_FCNTL -DHAVE_MYSQL -DHAVE_UNISTD_H -DHAVE_FORK -DHAVE_PIPE -DHAVE_FSYNC -DHAVE_MALLOC_H -DHAVE_ASPRINTF -DHAVE_VASPRINTF LIBS += -lz -ldl -lpthread CPPFLAGS_NO_ARCH += $(INCLUDES) -g -DSTDC_HEADERS $(CPPFLAGS_READLINE) -DHOOK_STDS -fexceptions -DWORDS_LITTLEENDIAN -fexceptions $(HAVES) -DUSE_MPQLIB -fpermissive CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) BASIC_LDFLAGS += $(ARCH_FLAGS) $(LIBS) LDFLAGS += $(BASIC_LDFLAGS) $(LDFLAGS_READLINE) -L/usr/lib/oracle/11.2.0.1.0/client/lib $(LUAJIT) vpath %.c ../Baltisot/lib:../Baltisot/src:../mogltk/lib:../tinyxml:../lua-modules/src:src vpath %.cc ../Baltisot/lib:../Baltisot/src:../mogltk/lib:../tinyxml:../lua-modules/src:src:../lua-modules-cd-tool/src:../lua-modules-iup/src vpath %.cpp ../Baltisot/lib:../Baltisot/src:../mogltk/lib:../tinyxml:../lua-modules/src:src:../PSX-Bundle/lib vpath %.lua ../Baltisot/lib:../Baltisot/src LUAINTERFACE_SOURCES = \ lua-interface.cpp \ lua-interface-hc.c \ lua-plugin.cc \ BALTISOT_SOURCES = \ Main.cc \ ldirlib.c \ \ LockSmith.cc \ \ RandISAAC.cc \ Exceptions.cc \ String.cc \ Regex.cc \ \ Base64.cc \ Base85.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 \ 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 \ plugin-luaiup.cc \ ifeq ($(HAVE_ORACLE),true) DEBUG_MODULES += \ LuaOCCI.cpp \ plugin-luaocci.cc \ endif WHOLE_SOURCES = $(BALTISOT_SOURCES) $(LUAINTERFACE_SOURCES) $(GL_GLUE) DEBUG_SOURCES = $(DEBUG_MODULES) LUAINTERFACE_OBJECTS = $(addsuffix .o, $(notdir $(basename $(LUAINTERFACE_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 lua-interface dist: lua-interface lua-interface-gl.$(SHARED_EXT) mkdir -p ../lua-interface-dist ln -sf lua-interface-mesa.$(SHARED_EXT) lua-interface.$(SHARED_EXT) $(STRIP) $+ cp lua-interface lua-interface*.$(SHARED_EXT) ../lua-interface-dist dep: $(ALL_DEPS) 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 $@ -ldl lua-interface-main.o lua-interface-dbg: $(ALL_OBJECTS) $(DEBUG_OBJECTS) $(LD) -o lua-interface-dbg $(ALL_OBJECTS) $(DEBUG_OBJECTS) $(LDFLAGS) $(LDFLAGS_MESA) -locci -lclntsh -lnnz11 ../lua-modules-iup/luaiup.a -lXm -lXpm -lXmu -lXt -lXext -lX11 -lm clean: rm -f lua-interface-mesa lua-interface-gl *.o *.dep *.so *.dylib %.dep : %.c $(CC) $(CPPFLAGS_NO_ARCH) -M -MF $@ $< %.dep : %.cpp $(CXX) $(CPPFLAGS_NO_ARCH) -M -MF $@ $< %.dep : %.cc $(CXX) $(CPPFLAGS_NO_ARCH) -M -MF $@ $< lua-interface-hc.c : lua-interface.lua bin2c $< $@ lua_interface_lua %.c : %.lua bin2c $< $@ $(basename $@) gl-glue.dep: touch gl-glue.dep gl-glue.s: src/generate-gl-glue.sh $(SYSTEM) > gl-glue.s -include $(ALL_DEPS) .PHONY: dist