Commit 21d3294c authored by antirez's avatar antirez
Browse files

makefile adapted to link against lua lib and to pass the 32bit flag to Lua building system

parent efc34087
-- make table, grouping all data for the same item
-- input is 2 columns (item, data)
local A
while 1 do
local l=io.read()
if l==nil then break end
local _,_,a,b=string.find(l,'"?([_%w]+)"?%s*(.*)$')
if a~=A then A=a io.write("\n",a,":") end
io.write(" ",b)
end
io.write("\n")
-- trace calls
-- example: lua -ltrace-calls bisect.lua
local level=0
local function hook(event)
local t=debug.getinfo(3)
io.write(level," >>> ",string.rep(" ",level))
if t~=nil and t.currentline>=0 then io.write(t.short_src,":",t.currentline," ") end
t=debug.getinfo(2)
if event=="call" then
level=level+1
else
level=level-1 if level<0 then level=0 end
end
if t.what=="main" then
if event=="call" then
io.write("begin ",t.short_src)
else
io.write("end ",t.short_src)
end
elseif t.what=="Lua" then
-- table.foreach(t,print)
io.write(event," ",t.name or "(Lua)"," <",t.linedefined,":",t.short_src,">")
else
io.write(event," ",t.name or "(C)"," [",t.what,"] ")
end
io.write("\n")
end
debug.sethook(hook,"cr")
level=0
-- trace assigments to global variables
do
-- a tostring that quotes strings. note the use of the original tostring.
local _tostring=tostring
local tostring=function(a)
if type(a)=="string" then
return string.format("%q",a)
else
return _tostring(a)
end
end
local log=function (name,old,new)
local t=debug.getinfo(3,"Sl")
local line=t.currentline
io.write(t.short_src)
if line>=0 then io.write(":",line) end
io.write(": ",name," is now ",tostring(new)," (was ",tostring(old),")","\n")
end
local g={}
local set=function (t,name,value)
log(name,g[name],value)
g[name]=value
end
setmetatable(getfenv(),{__index=g,__newindex=set})
end
-- an example
a=1
b=2
a=10
b=20
b=nil
b=200
print(a,b,c)
-- hex dump
-- usage: lua xd.lua < file
local offset=0
while true do
local s=io.read(16)
if s==nil then return end
io.write(string.format("%08X ",offset))
string.gsub(s,"(.)",
function (c) io.write(string.format("%02X ",string.byte(c))) end)
io.write(string.rep(" ",3*(16-string.len(s))))
io.write(" ",string.gsub(s,"%c","."),"\n")
offset=offset+16
end
...@@ -137,9 +137,11 @@ dependencies: ...@@ -137,9 +137,11 @@ dependencies:
@cd ../deps/hiredis && $(MAKE) static ARCH="$(ARCH)" @cd ../deps/hiredis && $(MAKE) static ARCH="$(ARCH)"
@echo $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)linenoise$(ENDCOLOR) @echo $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)linenoise$(ENDCOLOR)
@cd ../deps/linenoise && $(MAKE) ARCH="$(ARCH)" @cd ../deps/linenoise && $(MAKE) ARCH="$(ARCH)"
@echo $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)Lua ansi$(ENDCOLOR)
@cd ../deps/lua && $(MAKE) ARCH="$(ARCH)" ansi
redis-server: $(OBJ) redis-server: $(OBJ)
@$(CC) -o $(PRGNAME) $(CCOPT) $(DEBUG) $(OBJ) @$(CC) -o $(PRGNAME) $(CCOPT) $(DEBUG) $(OBJ) ../deps/lua/src/liblua.a
@echo $(LINKCOLOR)LINK$(ENDCOLOR) $(BINCOLOR)$(@)$(ENDCOLOR) @echo $(LINKCOLOR)LINK$(ENDCOLOR) $(BINCOLOR)$(@)$(ENDCOLOR)
redis-benchmark: dependencies $(BENCHOBJ) redis-benchmark: dependencies $(BENCHOBJ)
...@@ -168,7 +170,7 @@ redis-check-aof: $(CHECKAOFOBJ) ...@@ -168,7 +170,7 @@ redis-check-aof: $(CHECKAOFOBJ)
@echo $(LINKCOLOR)LINK$(ENDCOLOR) $(BINCOLOR)$(@)$(ENDCOLOR) @echo $(LINKCOLOR)LINK$(ENDCOLOR) $(BINCOLOR)$(@)$(ENDCOLOR)
.c.o: .c.o:
@$(CC) -c $(CFLAGS) $(DEBUG) $(COMPILE_TIME) $< @$(CC) -c $(CFLAGS) $(DEBUG) $(COMPILE_TIME) -I../deps/lua/src $<
@echo $(CCCOLOR)CC$(ENDCOLOR) $(SRCCOLOR)$(<)$(ENDCOLOR) @echo $(CCCOLOR)CC$(ENDCOLOR) $(SRCCOLOR)$(<)$(ENDCOLOR)
clean: clean:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment