Build the examples when doing a normal build; this exercises the compiler as a
whole and is one step further towards a proper test suite.
This commit is contained in:
parent
53c9731036
commit
1a7b4f8729
12
build.lua
12
build.lua
|
@ -12,6 +12,11 @@ vars.plats = {
|
|||
"rpi",
|
||||
}
|
||||
|
||||
local plat_packages = {}
|
||||
for _, p in ipairs(vars.plats) do
|
||||
plat_packages[#plat_packages+1] = "plat/"..p.."+pkg"
|
||||
end
|
||||
|
||||
installable {
|
||||
name = "ack",
|
||||
map = {
|
||||
|
@ -19,17 +24,14 @@ installable {
|
|||
"lang/cem/cemcom.ansi+pkg",
|
||||
"lang/m2/comp+pkg",
|
||||
"lang/pc/comp+pkg",
|
||||
"plat/cpm+pkg",
|
||||
"plat/linux386+pkg",
|
||||
"plat/linux68k+pkg",
|
||||
"plat/rpi+pkg",
|
||||
"plat/pc86+pkg",
|
||||
"util/ack+pkg",
|
||||
"util/amisc+pkg",
|
||||
"util/arch+pkg",
|
||||
"util/led+pkg",
|
||||
"util/misc+pkg",
|
||||
"util/opt+pkg",
|
||||
"examples+pkg",
|
||||
plat_packages
|
||||
}
|
||||
}
|
||||
|
||||
|
|
44
examples/build.lua
Normal file
44
examples/build.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
include("plat/build.lua")
|
||||
|
||||
local conly = {
|
||||
rpi = true
|
||||
}
|
||||
|
||||
local sourcefiles = filenamesof(
|
||||
"./hilo.b",
|
||||
"./hilo.c",
|
||||
"./hilo.mod",
|
||||
"./hilo.p",
|
||||
"./mandelbrot.c",
|
||||
"./paranoia.c",
|
||||
"./startrek.c"
|
||||
)
|
||||
|
||||
local installmap = {}
|
||||
for _, file in ipairs(sourcefiles) do
|
||||
local b = basename(file)
|
||||
local be = replace(b, "%.", "_")
|
||||
local _, _, e = b:find("%.(%w*)$")
|
||||
|
||||
for _, plat in ipairs(vars.plats) do
|
||||
if (e == "c") or not conly[plat] then
|
||||
local exe = ackprogram {
|
||||
name = be.."_"..plat,
|
||||
srcs = { file },
|
||||
vars = {
|
||||
plat = plat,
|
||||
lang = e,
|
||||
}
|
||||
}
|
||||
|
||||
installmap["$(PLATIND)/examples/"..be.."."..plat] = exe
|
||||
end
|
||||
end
|
||||
installmap["$(PLATIND)/examples/"..b] = file
|
||||
end
|
||||
|
||||
installable {
|
||||
name = "pkg",
|
||||
map = installmap
|
||||
}
|
||||
|
|
@ -216,6 +216,7 @@ definerule("cprogram",
|
|||
{
|
||||
srcs = { type="targets", default={} },
|
||||
deps = { type="targets", default={} },
|
||||
_clibrary = { type="object", default=clibrary },
|
||||
commands = {
|
||||
type="strings",
|
||||
default={
|
||||
|
@ -229,7 +230,7 @@ definerule("cprogram",
|
|||
for _, f in pairs(
|
||||
matching(
|
||||
filenamesof(
|
||||
clibrary {
|
||||
e._clibrary {
|
||||
name = e.name .. "/main",
|
||||
cwd = e.cwd,
|
||||
srcs = e.srcs,
|
||||
|
|
|
@ -54,6 +54,30 @@ definerule("acklibrary",
|
|||
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",
|
||||
"util/amisc+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" },
|
||||
|
|
Loading…
Reference in a new issue