ack/util/opt/build.lua
George Koehler ca4bd38206 Delete old "assert.h" files; use libc <assert.h>.
Edit build.lua for programs losing their private assert.h, so they
depend on a list of .h files excluding assert.h.

Remove modules/src/assert; it would be a dependency of cpp.ansi but we
didn't build it, so cpp.ansi uses the libc assert.

I hope that libc <assert.h> can better report failed assertions.  Some
old "assert.h" files didn't report the expression.  Some reported a
literal "x", because traditional C expanded the macro parameter x in
"x", but ANSI C89 doesn't expand macro parameters in string literals.
2017-11-09 22:22:13 -05:00

93 lines
1.5 KiB
Lua

include("first/yacc.lua")
yacc {
name = "yacc",
srcs = { "./mktab.y" }
}
flex {
name = "flex",
srcs = { "./scan.l" }
}
local headers = {
"./alloc.h", "./ext.h", "./line.h", "./lookup.h", "./optim.h",
"./param.h", "./pattern.h", "./pop_push.h", "./proinf.h",
"./tes.h", "./types.h",
}
cprogram {
name = "mktab",
srcs = {
matching(filenamesof("+yacc"), "%.c$"),
matching(filenamesof("+flex"), "%.c$"),
},
deps = concat(
headers,
"+flex",
"+yacc",
"modules/src/em_data+lib"
)
}
normalrule {
name = "pattern_c",
ins = {
"+mktab",
"./patterns",
"lang/cem/cpp.ansi+cpp"
},
outleaves = { "pattern.c" },
commands = {
"%{ins[3]} < %{ins[2]} | %{ins[1]} > %{outs}"
}
}
normalrule {
name = "pop_push_c",
ins = {
"./pop_push.awk",
"h/em_table"
},
outleaves = { "pop_push.c" },
commands = {
"awk -f %{ins[1]} < %{ins[2]} > %{outs}"
}
}
local function variant(name, cflags)
cprogram {
name = name,
srcs = {
"+pattern_c",
"+pop_push_c",
"./*.c",
},
deps = concat(
headers,
"h+emheaders",
"modules/src/alloc+lib",
"modules/src/print+lib",
"modules/src/string+lib",
"modules/src/system+lib",
"modules/src/em_data+lib"
),
vars = {
["+cflags"] = cflags
}
}
end
variant("em_opt", {})
variant("em_opt2", {"-DGLOBAL_OPT"})
installable {
name = "pkg",
map = {
["$(PLATDEP)/em_opt"] = "+em_opt",
["$(PLATDEP)/em_opt2"] = "+em_opt2",
["$(INSDIR)/share/man/man6/em_opt.6"] = "./em_opt.6",
}
}