pcc_ccom now builds, for ARM, in a kind of bodged way.
authorDavid Given <dg@cowlark.com>
Sat, 3 Sep 2016 18:14:53 +0000 (20:14 +0200)
committerDavid Given <dg@cowlark.com>
Sat, 3 Sep 2016 18:14:53 +0000 (20:14 +0200)
--HG--
branch : default-branch

build.lua
lang/pcc/build.lua [new file with mode: 0644]

index b5de879..82d8e2c 100644 (file)
--- a/build.lua
+++ b/build.lua
@@ -24,6 +24,7 @@ installable {
                "lang/cem/cemcom.ansi+pkg",
                "lang/m2/comp+pkg",
                "lang/pc/comp+pkg",
+               "lang/pcc+pkg",
                "util/ack+pkg",
                "util/amisc+pkg",
                "util/arch+pkg",
diff --git a/lang/pcc/build.lua b/lang/pcc/build.lua
new file mode 100644 (file)
index 0000000..77a9fe3
--- /dev/null
@@ -0,0 +1,99 @@
+include("first/yacc.lua")
+
+local pccarch = "arm"
+
+local pcc_cflags = {
+       "-D_DEFAULT_SOURCE",
+       "-DGCC_COMPAT",
+       "-DPCC_DEBUG",
+       "-DNATIVE_FLOATING_POINT",
+       "-D_ISOC99_SOURCE",
+       "-Dos_ack",
+       "-Dmach_"..pccarch
+}
+
+clibrary {
+       name = "headers",
+       srcs = {},
+       hdrs = {
+               "./pcc/arch/"..pccarch.."/macdefs.h",
+               "./pcc/cc/ccom/pass1.h",
+               "./pcc/common/*.h",
+               "./pcc/mip/*.h",
+       }
+}
+
+cprogram {
+       name = "mkext",
+       srcs = {
+               "./pcc/mip/mkext.c",
+               "./pcc/mip/common.c",
+               "./pcc/arch/"..pccarch.."/table.c"
+       },
+       deps = {
+               "+headers"
+       },
+       vars = {
+               ["+cflags"] = { "-DMKEXT", unpack(pcc_cflags) }
+       }
+}
+
+normalrule {
+       name = "external",
+       ins = { "+mkext" },
+       outleaves = { "external.h", "external.c" },
+       commands = {
+               "(cd %{dir} && %{ins})"
+       }
+}
+
+flex {
+       name = "flex",
+       srcs = { "./pcc/cc/ccom/scan.l" }
+}
+
+yacc {
+       name = "yacc",
+       srcs = { "./pcc/cc/ccom/cgram.y" }
+}
+
+normalrule {
+       name = "cgram_h",
+       ins = { matching(filenamesof("+yacc"), "%.h$") },
+       outleaves = { "cgram.h" },
+       commands = {
+               "cp %{ins} %{outs}"
+       }
+}
+
+cprogram {
+       name = "pcc_ccom",
+       srcs = {
+               matching(filenamesof("+external"), "%.c$"),
+               matching(filenamesof("+yacc", "+flex"), "%.c$"),
+               "./pcc/arch/"..pccarch.."/*.c",
+               "./pcc/cc/ccom/*.c",
+               "./pcc/common/*.c",
+               "./pcc/mip/common.c",
+               "./pcc/mip/match.c",
+               "./pcc/mip/optim2.c",
+               "./pcc/mip/reader.c",
+               "./pcc/mip/regs.c",
+       },
+       deps = {
+               "+headers",
+               "+external",
+               "+cgram_h",
+       },
+       vars = {
+               ["+cflags"] = pcc_cflags
+       }
+}
+
+installable {
+       name = "pkg",
+       map = {
+               ["$(PLATDEP)/pcc_ccom"] = "+pcc_ccom",
+       }
+}
+