ifeq ($(SYSTEM),) SYSTEM=$(shell uname) endif TRUESYSTEM=$(shell uname) CC = gcc CXX = g++ FINK_PREFIX= IMAGEMAGICK_INCLUDE=/usr/include/ImageMagick ifeq ($(SYSTEM),Darwin) ARCH_FLAGS=-arch i386 SHARED_FLAGS=-dynamiclib SHARED_EXT=dylib OSMESA_LIBS = -lMagick++ -lMagick -lWand -lMagick CPPFLAGS = LD = g++ -arch i386 STRIP = strip -x ifeq ($(TRUESYSTEM),Linux) CC = i686-apple-darwin9-gcc CXX = i686-apple-darwin9-g++ LD = i686-apple-darwin9-g++ -arch i386 STRIP = i686-apple-darwin9-strip -x AS = i686-apple-darwin9-as LIPO = i686-apple-darwin9-lipo FINK_PREFIX=/usr/i686-apple-darwin9 ARCH_FLAGS = endif SQL_LIBS=$(FINK_PREFIX)/sw/lib/mysql/libmysqlclient.a -lz IMAGEMAGICK_INCLUDE=$(FINK_PREFIX)/sw/include else ARCH_FLAGS=-march=i686 -m32 SHARED_FLAGS=-shared SHARED_EXT=so SQL_LIBS=/usr/lib/libmysqlclient.a -lssl OSMESA_LIBS = `Magick++-config --libs` LD = g++ -m32 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../Mesa-7.4.4/include \ -I$(IMAGEMAGICK_INCLUDE) \ -I../mogltk/include \ -I../Baltisot/include \ -I../Baltisot/lib/zlib/include \ -I../LuaJIT/src \ -I ../tinyxml \ -I $(FINK_PREFIX)/sw/include/mysql \ -I /usr/include/mysql \ -I /usr/include/FTGL \ -I /usr/local/include/FTGL \ -I /usr/include/freetype2 \ -I $(FINK_PREFIX)/sw/include \ -I /usr/local/instantclient/sdk/include \ -I /usr/X11/include/freetype2 -I /usr/X11/include \ -I /usr/include/oracle/11.1.0.1/client 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 CPPFLAGS_NO_ARCH += $(INCLUDES) -O4 -fexceptions -DSTDC_HEADERS -DREADLINE_STATIC -DHOOK_STDS -DWORDS_LITTLEENDIAN $(HAVES) -DUSE_OSMESA -DNDEBUG -DUSE_MGL_NAMESPACE CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) LDFLAGS += $(ARCH_FLAGS) $(SHARED_FLAGS) -L/usr/lib/oracle/11.1.0.1/client/lib -L/usr/X11/lib -L$(FINK_PREFIX)/sw/lib -L/usr/local/instantclient ./lua-interface.$(SHARED_EXT) 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 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_LIBS = -locci -lclntsh 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 \ 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 = -lfreetype -lftgl OSMESA_SOURCES = \ plugin-luaosmesa.cc \ dds.c \ RAND_SOURCES = \ plugin-luarand.cc \ WHOLE_SOURCES = \ $(CONFIGFILES_SOURCES) \ $(XML_SOURCES) \ $(HANDLE_SOURCES) \ $(HTTP_SOURCES) \ $(REGEX_SOURCES) \ $(TASK_SOURCES) \ $(SQL_SOURCES) \ $(LUALIBS_SOURCES) \ $(GL_SOURCES) \ $(OSMESA_SOURCES) \ $(RAND_SOURCES) \ #$(FTGL_SOURCES) \ ifeq ($(HAVE_ORACLE),true) WHOLE_SOURCES += $(OCCI_SOURCES) endif MODULES_LIST = \ luaconfigfiles.$(SHARED_EXT) \ luaxml.$(SHARED_EXT) \ luahandle.$(SHARED_EXT) \ luahttp.$(SHARED_EXT) \ luaregex.$(SHARED_EXT) \ luatask.$(SHARED_EXT) \ luasql.$(SHARED_EXT) \ luagl.$(SHARED_EXT) \ lualibs.$(SHARED_EXT) \ luaosmesa.$(SHARED_EXT) \ luarand.$(SHARED_EXT) \ #luaftgl.$(SHARED_EXT) \ ifeq ($(HAVE_ORACLE),true) MODULES_LIST += luaocci.$(SHARED_EXT) endif 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 $(STRIP) $(MODULES_LIST) cp $(MODULES_LIST) ../lua-interface-dist modules: $(MODULES_LIST) dep: $(ALL_DEPS) luaconfigfiles.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(CONFIGFILES_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(CONFIGFILES_LIBS) luaxml.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(XML_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(XML_LIBS) luaocci.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(OCCI_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(OCCI_LIBS) luahandle.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(HANDLE_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(HANDLE_LIBS) luahttp.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(HTTP_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(HTTP_LIBS) luaregex.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(REGEX_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(REGEX_LIBS) luatask.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(TASK_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(TASK_LIBS) luasql.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(SQL_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(SQL_LIBS) luagl.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(GL_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(GL_LIBS) luarand.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(RAND_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(RAND_LIBS) luaftgl.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(FTGL_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(FTGL_LIBS) lualibs.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(LUALIBS_SOURCES) $(LUA_LIB)))) $(LD) $(LDFLAGS) -o $@ $+ $(LUALIBS_LIBS) luaosmesa.$(SHARED_EXT): $(addsuffix .o, $(notdir $(basename $(OSMESA_SOURCES)))) $(LD) $(LDFLAGS) -o $@ $+ $(OSMESA_LIBS) clean: rm -f *.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 $@) -include $(ALL_DEPS) .PHONY: dist clean