SYSTEM=$(shell uname) MACHINE=$(shell uname -m) DISTRIB=$(shell cat /etc/issue | cut -f 1 -d\ | head -1) GL_GLUE=gl-glue.s ifeq ($(SYSTEM),Darwin) 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 GL_GLUE=gl-glue-fat.o STRIP = strip -x else ARCH_FLAGS=-march=i686 -m32 ASFLAGS=-march=i686 --32 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/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 BASIC_LDFLAGS = /usr/lib/libucl.a endif endif SHARED_FLAGS=-shared SHARED_EXT=so LD = g++ -m32 LDFLAGS_GL = -lGLU -lGL STRIP = strip --strip-unneeded endif CC = gcc CXX = g++ 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.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 -DHAVE_VASPRINTF LIBS += -lz -ldl -lpthread CPPFLAGS_NO_ARCH += $(INCLUDES) -g -DSTDC_HEADERS $(CPPFLAGS_READLINE) -DHOOK_STDS -fexceptions -DWORDS_LITTLEENDIAN -fexceptions $(HAVES) -DUSE_MPQLIB CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) BASIC_LDFLAGS += $(ARCH_FLAGS) $(LIBS) LDFLAGS += $(BASIC_LDFLAGS) $(LDFLAGS_READLINE) -L/usr/lib/oracle/11.1.0.1/client/lib ../LuaJIT/src/luajit.a 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 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.cc \ 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 \ 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 \ LuaOCCI.cpp \ plugin-luaocci.cc \ 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 $@ ./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) $(LDFLAGS_MESA) -locci -lclntsh 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 $@ $< %.c : %.lua bin2c $< $@ $(basename $@) gl-glue-i386.dep: touch gl-glue-i386.dep gl-glue-x86_64.dep: touch gl-glue-x86_64.dep gl-glue-ppc.dep: touch gl-glue-ppc.dep gl-glue-ppc64.dep: touch gl-glue-ppc64.dep gl-glue.dep: touch gl-glue.dep gl-glue-fat.dep: touch gl-glue-fat.dep gl-glue-i386.s: src/generate-gl-glue.sh $(SYSTEM) i386 > gl-glue-i386.s gl-glue-x86_64.s: src/generate-gl-glue.sh $(SYSTEM) x86_64 > gl-glue-x86_64.s gl-glue-ppc.s: src/generate-gl-glue.sh $(SYSTEM) ppc > gl-glue-ppc.s gl-glue-ppc64.s: src/generate-gl-glue.sh $(SYSTEM) ppc64 > gl-glue-ppc64.s gl-glue.s: src/generate-gl-glue.sh > gl-glue.s gl-glue-i386.o: gl-glue-i386.s as -arch i386 $< -o $@ gl-glue-x86_64.o: gl-glue-x86_64.s as -arch x86_64 $< -o $@ gl-glue-ppc.o: gl-glue-ppc.s as -arch ppc $< -o $@ gl-glue-ppc64.o: gl-glue-ppc64.s as -arch ppc64 $< -o $@ gl-glue-fat.o: gl-glue-i386.o gl-glue-x86_64.o gl-glue-ppc.o gl-glue-ppc64.o lipo -create $^ -output $@ -include $(ALL_DEPS) .PHONY: dist