mirror of
https://github.com/natnat-mc/moonbuild
synced 2026-05-28 02:59:39 +02:00
added calccdeps
This commit is contained in:
@@ -43,7 +43,7 @@ flatten= (tab) ->
|
||||
return {tab} if (type tab)!='table'
|
||||
out={}
|
||||
for e in *tab
|
||||
if (type e)=='table' and e[1]
|
||||
if (type e)=='table'
|
||||
insert out, v for v in *flatten e
|
||||
else
|
||||
insert out, e
|
||||
@@ -80,6 +80,11 @@ popen= (c, args, mode='r', params={}) ->
|
||||
print escaped if params.print
|
||||
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
|
||||
wildcard= (pattern) ->
|
||||
prefix, suffix=pattern\match '^(.*)%*%*(.*)$'
|
||||
@@ -164,6 +169,7 @@ sortedpairs= (table, cmp) ->
|
||||
|
||||
-- command functions
|
||||
:run, :popen
|
||||
:calccdeps
|
||||
|
||||
-- string functions
|
||||
:patsubst, :match, :isglob
|
||||
|
||||
Reference in New Issue
Block a user