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"
|
|
|
|
|
2022-07-14 21:57:54 +00:00
|
|
|
local srcs = {
|
|
|
|
"./adder.c",
|
|
|
|
"./add_ext.c",
|
|
|
|
"./adf4.c",
|
|
|
|
"./adf8.c",
|
|
|
|
"./cff4.c",
|
|
|
|
"./cff8.c",
|
|
|
|
"./cfi.c",
|
|
|
|
"./cfu.c",
|
|
|
|
"./cif4.c",
|
|
|
|
"./cif8.c",
|
|
|
|
"./cmf4.c",
|
|
|
|
"./cmf8.c",
|
|
|
|
"./compact.c",
|
|
|
|
"./cuf4.c",
|
|
|
|
"./cuf8.c",
|
|
|
|
"./div_ext.c",
|
|
|
|
"./dvf4.c",
|
|
|
|
"./dvf8.c",
|
|
|
|
"./extend.c",
|
|
|
|
"./fef4.c",
|
|
|
|
"./fef8.c",
|
|
|
|
"./fif4.c",
|
|
|
|
"./fif8.c",
|
|
|
|
"./fptrp.e",
|
|
|
|
"./mlf4.c",
|
|
|
|
"./mlf8.c",
|
|
|
|
"./mul_ext.c",
|
|
|
|
"./ngf4.c",
|
|
|
|
"./ngf8.c",
|
|
|
|
"./nrm_ext.c",
|
|
|
|
"./sbf4.c",
|
|
|
|
"./sbf8.c",
|
|
|
|
"./sft_ext.c",
|
|
|
|
"./shifter.c",
|
|
|
|
"./sub_ext.c",
|
|
|
|
"./zrf4.c",
|
|
|
|
"./zrf8.c",
|
|
|
|
"./zrf_ext.c",
|
|
|
|
}
|
|
|
|
|
2018-04-25 04:17:19 +00:00
|
|
|
-- For now, only cpm uses software floating-point.
|
|
|
|
for _, plat in ipairs({"cpm"}) do
|
|
|
|
local edits = {}
|
2022-07-14 21:57:54 +00:00
|
|
|
for _, src in fpairs(srcs) do
|
2018-04-25 04:17:19 +00:00
|
|
|
|
|
|
|
-- Compile each src file into assembly code.
|
|
|
|
local n = basename(src):gsub("%.%w*$", "")
|
|
|
|
local assembly = ackfile {
|
|
|
|
name = "s_"..plat.."/"..n,
|
|
|
|
srcs = { src },
|
|
|
|
deps = {
|
2022-07-14 21:57:54 +00:00
|
|
|
"./FP_bias.h",
|
|
|
|
"./FP_shift.h",
|
|
|
|
"./FP_trap.h",
|
|
|
|
"./FP_types.h",
|
|
|
|
"./get_put.h",
|
2018-04-25 04:17:19 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-17 22:22:50 +00:00
|
|
|
-- Run massage_s.lua to edit the assembly code.
|
2018-04-25 04:17:19 +00:00
|
|
|
edits[#edits+1] = normalrule {
|
|
|
|
name = "ed_"..plat.."/"..n,
|
|
|
|
ins = {
|
2022-07-17 22:22:50 +00:00
|
|
|
"./massage_s.lua",
|
2018-04-25 04:17:19 +00:00
|
|
|
assembly,
|
|
|
|
},
|
|
|
|
outleaves = { n..".s" },
|
|
|
|
commands = {
|
2022-07-17 22:22:50 +00:00
|
|
|
"$LUA %{ins[1]} <%{ins[2]} >%{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
|