[PD-dev] LuaJIT

Frank Barknecht fbar at footils.org
Mon May 26 23:13:17 CEST 2008


Hi lsit/Claude,

attached is a toy variation of pdlua's "Makefile.static" which builds
pdlua statically linked to LuaJIT, the optimizing JIT compiler for
Lua. Only tested on Linux. LuaJIT can be quite a performance boost.
It's probably good to install the jit/opt*.lua modules as well
according to http://luajit.org/luajit_install.html 

Ciao
-- 
 Frank Barknecht                                     _ ______footils.org__
-------------- next part --------------
#######################################################################
# User configuration goes here

# Uncomment the particular line according to your platform
PLATFORM = linux
#PLATFORM = macosx
#PLATFORM = mingw

# If Pd is in an unusual place, put -I/path/to m_pd.h here:
PDINCLUDE =
#PDINCLUDE = -I$(HOME)/include
#PDINCLUDE = -I/opt/puredata/include
#PDINCLUDE = -I/Applications/Pd-0.41-4.app/Contents/Resources/src

# End of user configuration
#######################################################################

# which Pd external to build
lua_src = src/lua.c
lua_linux = src/lua.pd_linux
lua_macosx = src/lua.pd_darwin
lua_mingw = src/lua.dll

# how to build a Pd external
# FIXME: Windows?
CFLAGS_linux = -shared
LIBS_linux =
CFLAGS_macosx = -bundle -undefined suppress -flat_namespace
LIBS_macosx =
CFLAGS_mingw = -export_dynamic -shared
LIBS_mingw = pd.dll

# Lua setup
##LUA = lua-5.1.3
##LUATGZ = $(LUA).tar.gz
##LUAURL = http://www.lua.org/ftp/$(LUATGZ)
##LUAI = -I$(LUA)/include/
##LUAL = $(LUA)/lib/liblua.a
##CFLAGS = -ansi -pedantic -Wall -O2 -fPIC $(LUAI) $(PDINCLUDE)

# LuaJIT setup
LUA = LuaJIT-1.1.4
LUATGZ = $(LUA).tar.gz
LUAURL = http://luajit.org/download/$(LUATGZ)
LUAI = -I$(LUA)/src/
LUAL = $(LUA)/src/liblua.a
CFLAGS = -ansi -pedantic -Wall -O2 -fPIC $(LUAI) $(PDINCLUDE)

# build
default: $(lua_$(PLATFORM))

# clean up
clean:
	rm -f $(lua_$(PLATFORM))

# install
install:
	echo "TODO"

# compile
$(lua_$(PLATFORM)): $(lua_src) $(LUA)/build.stamp
	gcc $(CFLAGS) $(CFLAGS_$(PLATFORM)) -o $(lua_$(PLATFORM)) $(lua_src) $(LUAL) $(LIBS_$(PLATFORM))

# get Lua: download, unpack, compile, install locally
$(LUA)/build.stamp: $(LUA)/unpack.stamp
	make -C $(LUA) $(PLATFORM) local
	touch $(LUA)/build.stamp

$(LUA)/unpack.stamp: $(LUATGZ)
	tar xzf $(LUATGZ)
	touch $(LUA)/unpack.stamp

$(LUATGZ):
	wget $(LUAURL)


More information about the Pd-dev mailing list