Most of libc builds now (missing malloc).
authorDavid Given <dg@cowlark.com>
Mon, 8 Aug 2016 21:55:47 +0000 (23:55 +0200)
committerDavid Given <dg@cowlark.com>
Mon, 8 Aug 2016 21:55:47 +0000 (23:55 +0200)
lang/cem/libcc.ansi/build.lua
lang/cem/libcc.ansi/ctype/genfiles
lang/cem/libcc.ansi/stdio/rename.c
plat/pc86/build.lua

index a755268..ebc9488 100644 (file)
@@ -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
index 061a214..96121a3 100644 (file)
@@ -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       <ctype.h>
 
 int (xxxx)(int c) {
index 08c5ae8..ff177cc 100644 (file)
@@ -7,6 +7,8 @@
 #include <stdio.h>
 #include <unistd.h>
 
+/* Disabled, dtrg: rename is a system call these days. */
+#if 0
 int _link(const char *name1, const char *name2);
 
 int
index 6f68b14..002f66a 100644 (file)
@@ -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",