diff --git a/lang/cem/libcc.ansi/build.lua b/lang/cem/libcc.ansi/build.lua index a75526836..ebc948871 100644 --- a/lang/cem/libcc.ansi/build.lua +++ b/lang/cem/libcc.ansi/build.lua @@ -1,11 +1,73 @@ +local headers = {} + +local function addheader(dir, list) + for _, f in ipairs(list) do + local b = basename(f) + headers[dir..b] = f + end +end + +addheader("", filenamesof("./headers/*.h")) +addheader("sys/", filenamesof("./headers/sys/*.h")) + +acklibrary { + name = "headers", + hdrs = headers +} + +tabgen { + name = "ctype_tab", + srcs = { "./ctype/char.tab" } +} + +normalrule { + name = "ctype_files", + ins = { "./ctype/genfiles" }, + outleaves = { + "isalnum.c", + "isalpha.c", + "isascii.c", + "iscntrl.c", + "isdigit.c", + "isgraph.c", + "islower.c", + "isprint.c", + "ispunct.c", + "isspace.c", + "isupper.c", + "isxdigit.c", + }, + commands = { + "sh %{ins[1]} %{dir}" + } +} + for _, plat in ipairs(vars.plats) do acklibrary { name = "lib_"..plat, srcs = { + "+ctype_files", + "+ctype_tab", + "./ctype/*.c", "./assert/*.c", + "./errno/*.c", + "./locale/*.c", + "./math/*.c", + "./misc/environ.c", -- don't build everything here as it's all obsolete + "./setjmp/*.c", + "./setjmp/*.e", + "./signal/*.c", + "./stdio/*.c", + "./stdlib/*.c", + "./string/*.c", + "./time/*.c", + }, - hdrs = { - }, + hdrs = {}, -- must be empty + deps = { + "+headers", + "plat/"..plat.."+headers", + }, vars = { plat = plat } } @@ -22,7 +84,7 @@ for _, plat in ipairs(vars.plats) do name = "pkg_"..plat, map = { ["$(PLATIND)/"..plat.."/c-ansi.o"] = "+crt_"..plat, - --["$(PLATIND)/"..plat.."/libc.a"] = "+lib_"..plat, + ["$(PLATIND)/"..plat.."/libc.a"] = "+lib_"..plat, } } end diff --git a/lang/cem/libcc.ansi/ctype/genfiles b/lang/cem/libcc.ansi/ctype/genfiles index 061a214bc..96121a3cd 100644 --- a/lang/cem/libcc.ansi/ctype/genfiles +++ b/lang/cem/libcc.ansi/ctype/genfiles @@ -3,7 +3,7 @@ for i in isalnum isalpha iscntrl isdigit isgraph islower isprint \ ispunct isspace isupper isxdigit isascii do -sed "s/xxxx/$i/" > $i.c << 'EOF' +sed "s/xxxx/$i/" > $1/$i.c << 'EOF' #include int (xxxx)(int c) { diff --git a/lang/cem/libcc.ansi/stdio/rename.c b/lang/cem/libcc.ansi/stdio/rename.c index 08c5ae85d..ff177ccd5 100644 --- a/lang/cem/libcc.ansi/stdio/rename.c +++ b/lang/cem/libcc.ansi/stdio/rename.c @@ -7,6 +7,8 @@ #include #include +/* Disabled, dtrg: rename is a system call these days. */ +#if 0 int _link(const char *name1, const char *name2); int diff --git a/plat/pc86/build.lua b/plat/pc86/build.lua index 6f68b1474..002f66a54 100644 --- a/plat/pc86/build.lua +++ b/plat/pc86/build.lua @@ -13,6 +13,14 @@ ackfile { vars = { plat = "pc86" } } +acklibrary { + name = "headers", + hdrs = { + ["ack/config.h"] = "./include/ack/config.h", + ["unistd.h"] = "./include/unistd.h", + } +} + build_plat_libs { name = "libs", arch = "i86",