2016-07-23 22:50:02 +00:00
|
|
|
include("first/yacc.lua")
|
|
|
|
|
|
|
|
definerule("build_as",
|
|
|
|
{
|
2018-09-01 17:35:31 +00:00
|
|
|
arch = { type="string" },
|
|
|
|
deps = { type="targets", default={} },
|
2016-07-23 22:50:02 +00:00
|
|
|
},
|
|
|
|
function(e)
|
|
|
|
-- Remember this is executed from the caller's directory; local
|
|
|
|
-- target names will resolve there
|
|
|
|
local archlib = clibrary {
|
|
|
|
name = e.name.."/archlib",
|
|
|
|
srcs = {},
|
2016-08-20 10:40:13 +00:00
|
|
|
hdrs = {
|
|
|
|
"mach/"..e.arch.."/as/mach*.c",
|
|
|
|
"mach/"..e.arch.."/as/*.h"
|
|
|
|
}
|
2016-07-23 22:50:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
local preprocessedy = cppfile {
|
|
|
|
name = e.name.."/yaccinput",
|
|
|
|
srcs = { "mach/proto/as/comm2.y" },
|
|
|
|
outleaf = "comm2.y",
|
|
|
|
deps = {
|
2017-11-11 21:09:05 +00:00
|
|
|
"mach/proto/as/comm0.h",
|
|
|
|
"mach/proto/as/comm1.h",
|
2016-07-23 22:50:02 +00:00
|
|
|
"h+emheaders",
|
|
|
|
archlib,
|
2018-09-01 17:35:31 +00:00
|
|
|
e.deps,
|
2016-07-23 22:50:02 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
local yaccfiles = yacc {
|
|
|
|
name = e.name.."/yacc",
|
|
|
|
srcs = { preprocessedy }
|
|
|
|
}
|
|
|
|
|
|
|
|
return cprogram {
|
|
|
|
name = e.name,
|
2016-07-29 22:39:22 +00:00
|
|
|
srcs = concat(
|
2016-07-23 22:50:02 +00:00
|
|
|
"mach/proto/as/*.c",
|
2016-08-04 21:51:19 +00:00
|
|
|
matching(filenamesof(yaccfiles), "%.c$")
|
2016-07-29 22:39:22 +00:00
|
|
|
),
|
2016-07-23 22:50:02 +00:00
|
|
|
deps = {
|
|
|
|
"h+emheaders",
|
|
|
|
"modules/src/object+lib",
|
|
|
|
archlib,
|
2018-09-01 17:35:31 +00:00
|
|
|
yaccfiles,
|
|
|
|
e.deps
|
2016-07-23 22:50:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
)
|
|
|
|
|