2016-07-26 21:35:30 +00:00
|
|
|
include("mach/proto/as/build.lua")
|
2018-02-23 21:31:46 +00:00
|
|
|
include("mach/proto/cg/build.lua")
|
2016-07-26 21:35:30 +00:00
|
|
|
include("mach/proto/ncg/build.lua")
|
2016-10-16 22:06:06 +00:00
|
|
|
include("mach/proto/mcg/build.lua")
|
2016-08-13 23:39:40 +00:00
|
|
|
include("mach/proto/top/build.lua")
|
2016-07-26 21:35:30 +00:00
|
|
|
|
2016-07-28 22:22:49 +00:00
|
|
|
definerule("ackfile",
|
|
|
|
{
|
|
|
|
srcs = { type="targets" },
|
|
|
|
deps = { type="targets", default={} },
|
2018-06-10 11:25:48 +00:00
|
|
|
suffix = { type="string", optional=true },
|
2016-07-28 22:22:49 +00:00
|
|
|
},
|
|
|
|
function (e)
|
2018-06-18 20:17:38 +00:00
|
|
|
local em = (e.vars.plat or ""):find("^em")
|
2018-06-10 11:25:48 +00:00
|
|
|
local suffix = e.suffix or (em and ".m" or ".o")
|
|
|
|
local c = "-c"..suffix
|
2016-07-28 22:22:49 +00:00
|
|
|
local plat = e.vars.plat
|
|
|
|
|
|
|
|
return cfile {
|
|
|
|
name = e.name,
|
|
|
|
srcs = e.srcs,
|
|
|
|
deps = {
|
2016-12-29 17:11:07 +00:00
|
|
|
"lang/b/compiler+pkg",
|
|
|
|
"lang/basic/src+pkg",
|
2016-08-11 22:19:51 +00:00
|
|
|
"lang/cem/cemcom.ansi+pkg",
|
2016-08-07 19:56:53 +00:00
|
|
|
"lang/cem/cpp.ansi+pkg",
|
2016-08-13 10:43:44 +00:00
|
|
|
"lang/m2/comp+pkg",
|
2016-08-13 11:03:06 +00:00
|
|
|
"lang/pc/comp+pkg",
|
2016-07-28 22:22:49 +00:00
|
|
|
"plat/"..plat.."+tools",
|
|
|
|
"util/ack+pkg",
|
2016-08-21 20:01:19 +00:00
|
|
|
"util/ego+pkg",
|
2016-08-07 19:56:53 +00:00
|
|
|
"util/misc+pkg",
|
2016-08-04 21:51:19 +00:00
|
|
|
e.deps
|
2016-07-28 22:22:49 +00:00
|
|
|
},
|
2018-06-10 11:25:48 +00:00
|
|
|
suffix = suffix,
|
2016-07-28 22:22:49 +00:00
|
|
|
commands = {
|
2018-04-25 04:17:19 +00:00
|
|
|
"ACKDIR=$(INSDIR) $(INSDIR)/bin/ack -m%{plat} "..c.." -o %{outs} %{ins} %{hdrpaths} %{ackcflags}"
|
2016-07-28 22:22:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
)
|
|
|
|
|
2016-07-29 22:39:22 +00:00
|
|
|
definerule("acklibrary",
|
|
|
|
{
|
|
|
|
srcs = { type="targets", default={} },
|
|
|
|
hdrs = { type="targets", default={} },
|
|
|
|
deps = { type="targets", default={} },
|
|
|
|
},
|
|
|
|
function (e)
|
2018-06-18 20:17:38 +00:00
|
|
|
local em = (e.vars.plat or ""):find("^em")
|
2022-07-17 22:55:02 +00:00
|
|
|
|
2022-07-18 14:48:14 +00:00
|
|
|
local function splitter(srcs, num, cmd)
|
|
|
|
local commands = {
|
|
|
|
}
|
|
|
|
local t = {}
|
|
|
|
local function flush()
|
|
|
|
commands[#commands+1] = cmd:gsub("%%%%", asstring(t))
|
|
|
|
t = {}
|
|
|
|
end
|
|
|
|
for _, target in ipairs(srcs) do
|
|
|
|
t[#t+1] = target
|
|
|
|
if #t == num then
|
|
|
|
flush()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if #t ~= 0 then
|
2022-07-17 22:55:02 +00:00
|
|
|
flush()
|
|
|
|
end
|
2022-07-18 14:48:14 +00:00
|
|
|
return table.concat(commands, " && ")
|
2022-07-17 22:55:02 +00:00
|
|
|
end
|
|
|
|
|
2016-07-29 22:39:22 +00:00
|
|
|
return clibrary {
|
|
|
|
name = e.name,
|
|
|
|
srcs = e.srcs,
|
|
|
|
hdrs = e.hdrs,
|
|
|
|
deps = {
|
|
|
|
"util/arch+pkg",
|
2016-08-04 21:51:19 +00:00
|
|
|
e.deps
|
2016-07-29 22:39:22 +00:00
|
|
|
},
|
2022-07-18 14:48:14 +00:00
|
|
|
vars = {
|
|
|
|
splitter = splitter
|
|
|
|
},
|
2016-07-29 22:39:22 +00:00
|
|
|
_cfile = ackfile,
|
2018-06-10 11:25:48 +00:00
|
|
|
suffix = em and ".m" or ".o",
|
2022-07-18 14:48:14 +00:00
|
|
|
commands = {
|
|
|
|
"rm -f %{outs[1]}",
|
|
|
|
"%{splitter(ins, 100, 'ACKDIR=$(INSDIR) $(INSDIR)/bin/aal qc '..tostring(outs[1])..' %%')}"
|
|
|
|
}
|
2016-07-29 22:39:22 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
)
|
2016-07-28 22:22:49 +00:00
|
|
|
|
2016-08-20 12:05:24 +00:00
|
|
|
definerule("ackprogram",
|
|
|
|
{
|
|
|
|
srcs = { type="targets", default={} },
|
|
|
|
deps = { type="targets", default={} },
|
|
|
|
},
|
|
|
|
function (e)
|
2016-11-20 17:57:44 +00:00
|
|
|
-- This bit is a hack. We *don't* want to link the language libraries here,
|
|
|
|
-- because the ack driver is going to pick the appropriate library itself and
|
|
|
|
-- we don't want more than one. But we still need to depend on them, so we use
|
|
|
|
-- a nasty hack.
|
|
|
|
|
|
|
|
local platstamp = normalrule {
|
|
|
|
name = e.name.."/platstamp",
|
|
|
|
ins = { "plat/"..e.vars.plat.."+pkg" },
|
|
|
|
outleaves = { "stamp" },
|
|
|
|
commands = { "touch %{outs}" }
|
|
|
|
}
|
|
|
|
|
2016-08-20 12:05:24 +00:00
|
|
|
return cprogram {
|
|
|
|
name = e.name,
|
|
|
|
srcs = e.srcs,
|
|
|
|
deps = {
|
2016-11-20 17:57:44 +00:00
|
|
|
platstamp,
|
2016-08-20 12:05:24 +00:00
|
|
|
"util/ack+pkg",
|
|
|
|
"util/led+pkg",
|
|
|
|
e.deps
|
|
|
|
},
|
|
|
|
_clibrary = acklibrary,
|
|
|
|
commands = {
|
2018-04-28 17:18:27 +00:00
|
|
|
"ACKDIR=$(INSDIR) $(INSDIR)/bin/ack -m%{plat} -.%{lang} -o %{outs} %{ins} %{ackldflags}"
|
2016-08-20 12:05:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
)
|
|
|
|
|
2016-07-29 22:39:22 +00:00
|
|
|
definerule("build_plat_libs",
|
|
|
|
{
|
|
|
|
arch = { type="string" },
|
|
|
|
plat = { type="string" },
|
2018-06-10 11:25:48 +00:00
|
|
|
em = { type="boolean", default=false },
|
2016-07-29 22:39:22 +00:00
|
|
|
},
|
|
|
|
function(e)
|
2018-04-25 04:17:19 +00:00
|
|
|
local installmap = {
|
|
|
|
"lang/b/lib+pkg_"..e.plat,
|
|
|
|
"lang/basic/lib+pkg_"..e.plat,
|
|
|
|
"lang/cem/libcc.ansi+pkg_"..e.plat,
|
|
|
|
"lang/m2/libm2+pkg_"..e.plat,
|
|
|
|
"lang/pc/libpc+pkg_"..e.plat,
|
|
|
|
"lang/b/lib+pkg_"..e.plat,
|
|
|
|
["$(PLATIND)/"..e.plat.."/libem.a"] = "mach/"..e.arch.."/libem+lib_"..e.plat,
|
|
|
|
["$(PLATIND)/"..e.plat.."/libend.a"] = "mach/"..e.arch.."/libend+lib_"..e.plat,
|
|
|
|
}
|
|
|
|
|
|
|
|
-- For now, only cpm uses software floating-point.
|
|
|
|
if e.plat == "cpm" then
|
|
|
|
installmap[#installmap+1] = "mach/proto/fp+pkg_"..e.plat
|
|
|
|
end
|
|
|
|
|
2016-07-29 22:39:22 +00:00
|
|
|
return installable {
|
|
|
|
name = e.name,
|
2018-04-25 04:17:19 +00:00
|
|
|
map = installmap,
|
2016-07-29 22:39:22 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
)
|
|
|
|
|