ack/lang/cem/cemcom.ansi/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

171 lines
2.9 KiB
Lua

include("util/LLgen/build.lua")
include("util/cmisc/build.lua")
normalrule {
name = "parameters",
ins = { "./BigPars" },
outleaves = { "parameters.h" },
commands = {
"echo '#ifndef PARAMETERS_H' > %{outs}",
"echo '#define PARAMETERS_H' >> %{outs}",
"grep -v '^!' < %{ins} >> %{outs}",
"echo '#endif' >> %{outs}"
}
}
local str_files = basename(filenamesof("./*.str"))
local str_targets = {}
for _, f in ipairs(str_files) do
local bf = f:gsub("%.str$", "")
str_targets[#str_targets+1] = normalrule {
name = "allocd_header/"..bf,
ins = { "./make.allocd", "./"..f },
outleaves = { bf..".h" },
commands = {
"%{ins[1]} < %{ins[2]} > %{outs}"
}
}
end
normalrule {
name = "next-c",
ins = {
"./make.next",
"./*.str",
},
outleaves = { "next.c" },
commands = {
"%{ins} > %{outs[1]}"
}
}
clibrary {
name = "nextlib",
srcs = { "+next-c" },
hdrs = str_targets,
deps = {
"+parameters",
str_targets
}
}
normalrule {
name = "tokenfile-g",
ins = {
"./make.tokfile",
"./tokenname.c",
},
outleaves = { "tokenfile.g" },
commands = {
"sh %{ins[1]} < %{ins[2]} > %{outs}",
}
}
normalrule {
name = "symbol2str-c",
ins = {
"./make.tokcase",
"./tokenname.c",
},
outleaves = { "symbol2str.c" },
commands = {
"sh %{ins[1]} < %{ins[2]} > %{outs}",
}
}
llgen {
name = "llgen",
srcs = {
"+tokenfile-g", -- must be first
"./*.g",
},
}
tabgen {
name = "tabgen",
srcs = { "./char.tab" }
}
cprogram {
name = "cemcom",
srcs = {
"./LLlex.c",
"./LLmessage.c",
"./arith.c",
"./blocks.c",
"./ch3.c",
"./ch3bin.c",
"./ch3mon.c",
"./code.c",
"./conversion.c",
"./cstoper.c",
"./dataflow.c",
"./declarator.c",
"./decspecs.c",
"./domacro.c",
"./dumpidf.c",
"./error.c",
"./eval.c",
"./expr.c",
"./field.c",
"./fltcstoper.c",
"./idf.c",
"./init.c",
"./input.c",
"./l_comment.c",
"./l_ev_ord.c",
"./l_lint.c",
"./l_misc.c",
"./l_outdef.c",
"./l_states.c",
"./label.c",
"./main.c",
"./options.c",
"./pragma.c",
"./proto.c",
"./replace.c",
"./skip.c",
"./stab.c",
"./stack.c",
"./struct.c",
"./switch.c",
"./tokenname.c",
"./type.c",
"./util.c",
"+symbol2str-c",
"+tabgen",
matching(filenamesof("+llgen"), "%.c$"),
},
deps = {
"./LLlex.h", "./align.h", "./arith.h", "./atw.h",
"./class.h", "./decspecs.h", "./file_info.h",
"./input.h", "./interface.h", "./l_class.h",
"./l_comment.h", "./l_em.h", "./l_lint.h",
"./label.h", "./level.h", "./mes.h", "./sizes.h",
"./specials.h", "./tokenname.h",
"+llgen",
"+nextlib",
"+parameters",
"h+emheaders",
"modules+headers",
"modules/src/alloc+lib",
"modules/src/em_code+lib_k",
"modules/src/em_data+lib",
"modules/src/em_mes+lib",
"modules/src/flt_arith+lib",
"modules/src/idf+lib",
"modules/src/input+lib",
"modules/src/print+lib",
"modules/src/string+lib",
"modules/src/system+lib",
},
}
installable {
name = "pkg",
map = {
["$(PLATDEP)/em_cemcom.ansi"] = "+cemcom"
}
}