ack/plat/build.lua
David Given 5bae29a00c ego now builds and is used.
This needed lots of refactoring to ego --- not all platforms have ego descr
files, and ego will just crash if you invoke it without one. I think originally
it was never intended that these platforms would be used at -O2 or above.

Plats now only specify the ego descr file if they have one.
2016-08-21 22:01:19 +02:00

101 lines
2 KiB
Lua

include("mach/proto/as/build.lua")
include("mach/proto/ncg/build.lua")
include("mach/proto/top/build.lua")
definerule("ackfile",
{
srcs = { type="targets" },
deps = { type="targets", default={} },
},
function (e)
local plat = e.vars.plat
return cfile {
name = e.name,
srcs = e.srcs,
deps = {
"lang/cem/cemcom.ansi+pkg",
"lang/cem/cpp.ansi+pkg",
"lang/m2/comp+pkg",
"lang/pc/comp+pkg",
"plat/"..plat.."+tools",
"util/ack+pkg",
"util/ego+pkg",
"util/misc+pkg",
e.deps
},
commands = {
"ACKDIR=$(INSDIR) $(INSDIR)/bin/ack -m%{plat} -c -o %{outs} %{ins} %{hdrpaths} %{ackcflags}"
}
}
end
)
definerule("acklibrary",
{
srcs = { type="targets", default={} },
hdrs = { type="targets", default={} },
deps = { type="targets", default={} },
},
function (e)
return clibrary {
name = e.name,
srcs = e.srcs,
hdrs = e.hdrs,
deps = {
"util/arch+pkg",
e.deps
},
_cfile = ackfile,
commands = {
"rm -f %{outs[1]}",
"ACKDIR=$(INSDIR) $(INSDIR)/bin/aal qc %{outs[1]} %{ins}"
}
}
end
)
definerule("ackprogram",
{
srcs = { type="targets", default={} },
deps = { type="targets", default={} },
},
function (e)
return cprogram {
name = e.name,
srcs = e.srcs,
deps = {
"plat/"..e.vars.plat.."+pkg",
"util/ack+pkg",
"util/led+pkg",
e.deps
},
_clibrary = acklibrary,
commands = {
"ACKDIR=$(INSDIR) $(INSDIR)/bin/ack -m%{plat} -.%{lang} -o %{outs} %{ins}"
}
}
end
)
definerule("build_plat_libs",
{
arch = { type="string" },
plat = { type="string" },
},
function(e)
return installable {
name = e.name,
map = {
"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,
["$(PLATIND)/"..e.plat.."/libem.a"] = "mach/"..e.arch.."/libem+lib_"..e.plat,
["$(PLATIND)/"..e.plat.."/libend.a"] = "mach/"..e.arch.."/libend+lib_"..e.plat,
}
}
end
)