2018-04-25 04:17:19 +00:00
|
|
|
include("plat/build.lua")
|
|
|
|
|
|
|
|
-- For now, all floats are little-endian.
|
|
|
|
local byte_order = "mach/i86/libfp/byte_order.h"
|
|
|
|
|
|
|
|
-- For now, only cpm uses software floating-point.
|
|
|
|
for _, plat in ipairs({"cpm"}) do
|
|
|
|
local edits = {}
|
|
|
|
for _, src in fpairs("./*.c", "./*.e") do
|
|
|
|
|
|
|
|
-- Compile each src file into assembly code.
|
|
|
|
local n = basename(src):gsub("%.%w*$", "")
|
|
|
|
local assembly = ackfile {
|
|
|
|
name = "s_"..plat.."/"..n,
|
|
|
|
srcs = { src },
|
|
|
|
deps = {
|
|
|
|
"./*.h",
|
|
|
|
byte_order,
|
|
|
|
},
|
|
|
|
suffix = ".s",
|
|
|
|
vars = {
|
2018-04-26 02:48:28 +00:00
|
|
|
["+ackcflags"] = { "-I"..dirname(byte_order) },
|
2018-04-25 04:17:19 +00:00
|
|
|
plat = plat
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Run FP.script to edit the assembly code.
|
|
|
|
edits[#edits+1] = normalrule {
|
|
|
|
name = "ed_"..plat.."/"..n,
|
|
|
|
ins = {
|
|
|
|
"./FP.script",
|
2018-06-02 16:02:51 +00:00
|
|
|
"util/cmisc+ed",
|
2018-04-25 04:17:19 +00:00
|
|
|
assembly,
|
|
|
|
},
|
|
|
|
outleaves = { n..".s" },
|
|
|
|
commands = {
|
2018-06-02 16:02:51 +00:00
|
|
|
"%{ins[2]} -s %{ins[3]} <%{ins[1]} >%{outs}"
|
2018-04-25 04:17:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
acklibrary {
|
|
|
|
name = "lib_"..plat,
|
|
|
|
srcs = { edits },
|
|
|
|
vars = { plat = plat }
|
|
|
|
}
|
|
|
|
|
|
|
|
installable {
|
|
|
|
name = "pkg_"..plat,
|
|
|
|
map = {
|
|
|
|
["$(PLATIND)/"..plat.."/libfp.a"] = "+lib_"..plat,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|