From 4a3b7be79571fe86ae7c333c0e2f7c0b08bfcd52 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sat, 28 Apr 2018 13:18:27 -0400 Subject: [PATCH] Use `ack -mcpm -fp` for mandelbrot.c, startrek.c Add a variable %{ackldflags} so I can pass `-fp`. This change seems to cause the build to relink every ackprogram, because the link now needs to use %{ackldflags} even if the flags are empty. mandelbrot_c_cpm runs in YAZE-AG; startrek_c_cpm doesn't run because it doesn't fit in the 16-bit address space. --- build.lua | 1 + examples/build.lua | 16 ++++++++++++++++ plat/build.lua | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/build.lua b/build.lua index 0e167a079..1e2405907 100644 --- a/build.lua +++ b/build.lua @@ -4,6 +4,7 @@ vars.cflags = { vars.ackcflags = { "-O6" } +vars.ackldflags = {} vars.plats = { "cpm", "linux386", diff --git a/examples/build.lua b/examples/build.lua index fced8e299..d30f3745c 100644 --- a/examples/build.lua +++ b/examples/build.lua @@ -4,6 +4,10 @@ local conly = { rpi = true } +local softfp = { + cpm = true, +} + local sourcefiles = filenamesof( "./hilo.b", "./hilo.bas", @@ -15,6 +19,11 @@ local sourcefiles = filenamesof( "./startrek.c" ) +local usesfp = { + ["mandelbrot.c"] = true, + ["startrek.c"] = true, +} + local installmap = {} for _, file in ipairs(sourcefiles) do local b = basename(file) @@ -22,6 +31,12 @@ for _, file in ipairs(sourcefiles) do local _, _, e = b:find("%.(%w*)$") for _, plat in ipairs(vars.plats) do + local flags = {} + + if softfp[plat] and usesfp[b] then + flags[#flags+1] = "-fp" + end + if (e == "c") or not conly[plat] then local exe = ackprogram { name = be.."_"..plat, @@ -29,6 +44,7 @@ for _, file in ipairs(sourcefiles) do vars = { plat = plat, lang = e, + ["+ackldflags"] = flags, } } diff --git a/plat/build.lua b/plat/build.lua index 439a80c5d..676778dd8 100644 --- a/plat/build.lua +++ b/plat/build.lua @@ -91,7 +91,7 @@ definerule("ackprogram", }, _clibrary = acklibrary, commands = { - "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack -m%{plat} -.%{lang} -o %{outs} %{ins}" + "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack -m%{plat} -.%{lang} -o %{outs} %{ins} %{ackldflags}" } } end