From: David Given Date: Sat, 3 Sep 2016 18:14:53 +0000 (+0200) Subject: pcc_ccom now builds, for ARM, in a kind of bodged way. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=88b68b3cd6bad362fe63697bfbcb6c9a6e636580;p=ack.git pcc_ccom now builds, for ARM, in a kind of bodged way. --HG-- branch : default-branch --- diff --git a/build.lua b/build.lua index b5de879c8..82d8e2cdd 100644 --- 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 index 000000000..77a9fe317 --- /dev/null +++ b/lang/pcc/build.lua @@ -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", + } +} +