|
|
@ -43,7 +43,7 @@ flatten= (tab) -> |
|
|
|
return {tab} if (type tab)!='table' |
|
|
|
return {tab} if (type tab)!='table' |
|
|
|
out={} |
|
|
|
out={} |
|
|
|
for e in *tab |
|
|
|
for e in *tab |
|
|
|
if (type e)=='table' and e[1] |
|
|
|
if (type e)=='table' |
|
|
|
insert out, v for v in *flatten e |
|
|
|
insert out, v for v in *flatten e |
|
|
|
else |
|
|
|
else |
|
|
|
insert out, e |
|
|
|
insert out, e |
|
|
@ -80,6 +80,11 @@ popen= (c, args, mode='r', params={}) -> |
|
|
|
print escaped if params.print |
|
|
|
print escaped if params.print |
|
|
|
io.popen escaped, mode |
|
|
|
io.popen escaped, mode |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
calccdeps= (infile, includesys=false) -> |
|
|
|
|
|
|
|
data=(popen 'cc', {includesys and '-M' or '-MM', infile})\read '*a' |
|
|
|
|
|
|
|
rawdeps=data\gsub('\\\n', '')\match ':(.+)' |
|
|
|
|
|
|
|
[dep for dep in rawdeps\gmatch '%S+' when dep!=infile] |
|
|
|
|
|
|
|
|
|
|
|
-- file matcher |
|
|
|
-- file matcher |
|
|
|
wildcard= (pattern) -> |
|
|
|
wildcard= (pattern) -> |
|
|
|
prefix, suffix=pattern\match '^(.*)%*%*(.*)$' |
|
|
|
prefix, suffix=pattern\match '^(.*)%*%*(.*)$' |
|
|
@ -164,6 +169,7 @@ sortedpairs= (table, cmp) -> |
|
|
|
|
|
|
|
|
|
|
|
-- command functions |
|
|
|
-- command functions |
|
|
|
:run, :popen |
|
|
|
:run, :popen |
|
|
|
|
|
|
|
:calccdeps |
|
|
|
|
|
|
|
|
|
|
|
-- string functions |
|
|
|
-- string functions |
|
|
|
:patsubst, :match, :isglob |
|
|
|
:patsubst, :match, :isglob |
|
|
|