ack/mach/proto/as/build.lua
George Koehler ac4cbd735e Use libc assert(); fix dependencies; unbreak isduo().
Switch from custom assert() to libc assert() in mach/proto/as.
Continue to disable asserts if DEBUG == 0.

This change found a problem in the build system; comm2.y was missing
depedencies on comm0.h and comm1.h.  Add the missing dependencies to
the cppfile rule.  Allow the dependencies by modifying cppfile in
first/build.lua to act like cfile if t.dir is false.

Now that comm2.y gets rebuilt, I must fix the wrong prototype of
yyparse() in comm1.h.

I got unlucky as induo() in comm5.c was reading beyond the end of the
array.  It found an operator "= " ('=' then space) in the garbage, so
it returned a garbage token number, and "VAR = 123" became a syntax
error.  Unbreak induo() by terminating the array.
2017-11-11 16:09:05 -05:00

52 lines
928 B
Lua

include("first/yacc.lua")
definerule("build_as",
{
arch = { type="string" }
},
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 = {},
hdrs = {
"mach/"..e.arch.."/as/mach*.c",
"mach/"..e.arch.."/as/*.h"
}
}
local preprocessedy = cppfile {
name = e.name.."/yaccinput",
srcs = { "mach/proto/as/comm2.y" },
outleaf = "comm2.y",
deps = {
"mach/proto/as/comm0.h",
"mach/proto/as/comm1.h",
"h+emheaders",
archlib,
},
}
local yaccfiles = yacc {
name = e.name.."/yacc",
srcs = { preprocessedy }
}
return cprogram {
name = e.name,
srcs = concat(
"mach/proto/as/*.c",
matching(filenamesof(yaccfiles), "%.c$")
),
deps = {
"h+emheaders",
"modules/src/object+lib",
archlib,
yaccfiles
}
}
end
)