Builds libend (the simplest library). Becoming obvious I need to rework the way

ackbuilder deals with lists.
This commit is contained in:
David Given 2016-07-30 00:39:22 +02:00
parent 363d13cc2f
commit b2bb4ce3b2
12 changed files with 98 additions and 36 deletions

View file

@ -74,7 +74,7 @@ $(BUILDDIR)/build.ninja: Makefile
else
$(MAKECMDGOALS): $(BUILDDIR)/rules.mk
@make -r -f $(BUILDDIR)/rules.mk $@ \
+@make -r -f $(BUILDDIR)/rules.mk $@ \
$(MAKEFLAGS) \
OBJDIR=$(OBJDIR) \
BINDIR=$(BINDIR) \

View file

@ -4,6 +4,9 @@ vars.cflags = {
vars.ackcflags = {
"-O"
}
vars.plats = {
"pc86"
}
installable {
name = "ack",

View file

@ -30,10 +30,14 @@ end
local function concat(...)
local r = {}
for k, t in ipairs({...}) do
for _, t in ipairs({...}) do
if (type(t) == "table") and not t.is then
for _, v in ipairs(t) do
r[#r+1] = v
end
else
r[#r+1] = t
end
end
return r
end
@ -413,6 +417,10 @@ local typeconverters = {
end
return i
end,
object = function(propname, i)
return i
end,
}
local function definerule(rulename, types, cb)

View file

@ -146,6 +146,7 @@ definerule("clibrary",
srcs = { type="targets", default={} },
hdrs = { type="targets", default={} },
deps = { type="targets", default={} },
_cfile = { type="object", default=cfile },
commands = {
type="strings",
default={
@ -155,16 +156,13 @@ definerule("clibrary",
}
},
function (e)
local csrcs = filenamesof(e.srcs, "%.c$")
local hsrcs = filenamesof(e.srcs, "%.h$")
local ins = {}
for _, csrc in fpairs(csrcs) do
local n = basename(csrc):gsub("%.%w*$", "")
ins[#ins+1] = cfile {
for _, src in fpairs(e.srcs) do
local n = basename(src):gsub("%.%w*$", "")
ins[#ins+1] = e._cfile {
name = e.name.."/"..n,
cwd = e.cwd,
srcs = {csrc, unpack(hsrcs)},
srcs = {src},
deps = e.deps,
vars = {
["+cflags"] = { "-I"..e.cwd, },

View file

@ -65,7 +65,7 @@ normalrule {
}
}
llgen {
local llgen = llgen {
name = "llgen",
srcs = {
"+tokenfile_g",
@ -80,13 +80,13 @@ tabgen {
cprogram {
name = "cpp",
srcs = {
srcs = concat(
"./*.c",
"+llgen",
filenamesof(llgen, "%.c$"),
"+next_c",
"+symbol2str_c",
"+tabgen_c",
},
"+tabgen_c"
),
deps = {
"+llgen",
"+macro_h",

View file

@ -0,0 +1,8 @@
for _, plat in ipairs(vars.plats) do
acklibrary {
name = "lib_"..plat,
srcs = { "./*.s" },
vars = { plat = plat },
}
end

View file

@ -30,15 +30,15 @@ definerule("build_as",
return cprogram {
name = e.name,
srcs = {
srcs = concat(
"mach/proto/as/*.c",
yaccfiles, -- for .c file
},
filenamesof(yaccfiles, "%.c$")
),
deps = {
"h+emheaders",
"modules/src/object+lib",
archlib,
yaccfiles, -- for .h file
yaccfiles
}
}
end

View file

@ -25,11 +25,33 @@ definerule("ackfile",
end
)
definerule("acklibrary",
{
srcs = { type="targets", default={} },
hdrs = { type="targets", default={} },
deps = { type="targets", default={} },
},
function (e)
return clibrary {
name = e.name,
srcs = e.srcs,
hdrs = e.hdrs,
deps = {
"util/arch+pkg",
unpack(e.deps)
},
_cfile = ackfile,
commands = {
"ACKDIR=$(INSDIR) $(INSDIR)/bin/aal q %{outs[1]} %{ins}"
}
}
end
)
definerule("build_plat_tools",
{
arch = { type = "string" },
plat = { type = "string" },
arch = { type="string" },
plat = { type="string" },
},
function(e)
local descr = "plat/"..e.plat.."/descr"
@ -54,3 +76,20 @@ definerule("build_plat_tools",
}
end
)
definerule("build_plat_libs",
{
arch = { type="string" },
plat = { type="string" },
},
function(e)
return installable {
name = e.name,
map = {
["$(PLATIND)/"..e.plat.."/libend.a"] = "mach/"..e.arch.."/libend+lib_"..e.plat
}
}
end
)

View file

@ -12,10 +12,17 @@ ackfile {
vars = { plat = "pc86" }
}
build_plat_libs {
name = "libs",
arch = "i86",
plat = "pc86",
}
installable {
name = "pkg",
map = {
"+tools",
"+libs",
["$(PLATIND)/pc86/boot.o"] = "+boot"
}
}

View file

@ -19,7 +19,6 @@ cprogram {
name = "ack",
srcs = {
"./*.c",
"./*.h",
"+tables",
},
deps = {

View file

@ -1,4 +1,4 @@
normalrule {
local generated = normalrule {
name = "generated",
ins = {
"./new_table",
@ -22,10 +22,10 @@ normalrule {
clibrary {
name = "em_data",
srcs = {
srcs = concat(
"./em_ptyp.c",
"+generated", -- so we build the C files
},
filenamesof(generated, "%.c$")
),
hdrs = {
"+generated" -- so we export the H files
},

View file

@ -5,18 +5,18 @@ local cggparser = yacc {
srcs = { "./cgg.y" }
}
flex {
local cgglexer = flex {
name = "cgglexer",
srcs = { "./scan.l" }
}
normalrule {
name = "keywords",
ins = {
ins = concat(
"./cvtkeywords",
"./keywords",
unpack(filenamesof({cggparser}, "%.h$"))
},
filenamesof({cggparser}, "%.h$")
),
outleaves = { "enterkeyw.c" },
commands = {
"%{ins[1]} %{ins[2]} %{ins[3]} %{outs[1]}"
@ -25,12 +25,12 @@ normalrule {
cprogram {
name = "ncgg",
srcs = {
srcs = concat(
"./*.c",
"+cggparser", -- for .c file
"+cgglexer", -- for .c file
"+keywords",
},
filenamesof({cggparser}, "%.c$"),
filenamesof({cgglexer}, "%.c$"),
"+keywords"
),
deps = {
"+cggparser", -- for .h file
"+cgglexer", -- for .h file