Most of libc builds now (missing malloc).

This commit is contained in:
David Given 2016-08-08 23:55:47 +02:00
parent c213602a02
commit 3ce4e53aa9
4 changed files with 76 additions and 4 deletions

View file

@ -1,10 +1,72 @@
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

View 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) {

View 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

View 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",