More programs, more libraries. src/modules build files are now saner.

This commit is contained in:
David Given
2016-07-23 00:30:31 +02:00
parent 1fdc69fb97
commit 2770a83837
20 changed files with 256 additions and 221 deletions

View File

@@ -5,149 +5,3 @@ clibrary {
}
}
clibrary {
name = "system",
srcs = { "./src/system/*.c" },
hdrs = { "./src/system/system.h" },
deps = { "+headers" },
}
clibrary {
name = "alloc",
srcs = { "./src/alloc/*.c" },
hdrs = { "./src/alloc/alloc.h" },
deps = {
"+headers",
"+system"
},
}
clibrary {
name = "flt_arith",
srcs = { "./src/flt_arith/*.c" },
hdrs = { "./src/flt_arith/flt_arith.h" },
deps = {
"+headers"
}
}
clibrary {
name = "idf",
srcs = {},
hdrs = { "./src/idf/idf_pkg.*" },
}
clibrary {
name = "input",
srcs = {
"./src/input/*.c"
},
hdrs = { "./src/input/inp_pkg.*" }
}
clibrary {
name = "string",
srcs = { "./src/string/*.c" },
deps = { "+headers" },
}
clibrary {
name = "object",
srcs = { "./src/object/*.c" },
deps = {
"+headers",
"h+local",
"h+emheaders",
},
}
normalrule {
name = "em_code_ek_h",
ins = {
"./src/em_code/make.em.gen",
"./src/em_code/em.nogen",
"h/em_table"
},
outleaves = { "em_codeEK.h" },
commands = {
"%{ins[1]} %{ins[3]} > %{outs}",
"cat %{ins[2]} >> %{outs}"
}
}
for _, variant in ipairs {
{ "e", "-DREADABLE_EM" },
{ "k", "" }
} do
local code = variant[1]
local cflags = variant[2]
clibrary {
name = "em_code_"..code,
srcs = {
"./src/em_code/C_out.c",
"./src/em_code/bhcst.c",
"./src/em_code/bhdlb.c",
"./src/em_code/bhdnam.c",
"./src/em_code/bhfcon.c",
"./src/em_code/bhicon.c",
"./src/em_code/bhilb.c",
"./src/em_code/bhpnam.c",
"./src/em_code/bhucon.c",
"./src/em_code/crcst.c",
"./src/em_code/crdlb.c",
"./src/em_code/crdnam.c",
"./src/em_code/crilb.c",
"./src/em_code/crpnam.c",
"./src/em_code/crscon.c",
"./src/em_code/crxcon.c",
"./src/em_code/cst.c",
"./src/em_code/dfdlb.c",
"./src/em_code/dfdnam.c",
"./src/em_code/dfilb.c",
"./src/em_code/dlb.c",
"./src/em_code/dnam.c",
"./src/em_code/em.c",
"./src/em_code/end.c",
"./src/em_code/endarg.c",
"./src/em_code/exc.c",
"./src/em_code/failed.c",
"./src/em_code/fcon.c",
"./src/em_code/getid.c",
"./src/em_code/icon.c",
"./src/em_code/ilb.c",
"./src/em_code/insert.c",
"./src/em_code/internerr.c",
"./src/em_code/msend.c",
"./src/em_code/msstart.c",
"./src/em_code/op.c",
"./src/em_code/opcst.c",
"./src/em_code/opdlb.c",
"./src/em_code/opdnam.c",
"./src/em_code/opilb.c",
"./src/em_code/opnarg.c",
"./src/em_code/oppnam.c",
"./src/em_code/pnam.c",
"./src/em_code/pro.c",
"./src/em_code/pronarg.c",
"./src/em_code/psdlb.c",
"./src/em_code/psdnam.c",
"./src/em_code/pspnam.c",
"./src/em_code/scon.c",
"./src/em_code/ucon.c",
},
hdrs = {
"+em_code_ek_h"
},
deps = {
"+alloc",
"+em_code_ek_h",
"+headers",
"+system",
"h+emheaders",
"h+local",
"util/data+libem",
},
cflags = { cflags }
}
end

View File

@@ -0,0 +1,10 @@
clibrary {
name = "lib",
srcs = { "./*.c" },
hdrs = { "./alloc.h" },
deps = {
"modules+headers",
"modules/src/system+lib"
},
}

View File

@@ -0,0 +1,88 @@
normalrule {
name = "em_code_ek_h",
ins = {
"./make.em.gen",
"./em.nogen",
"h/em_table"
},
outleaves = { "em_codeEK.h" },
commands = {
"%{ins[1]} %{ins[3]} > %{outs}",
"cat %{ins[2]} >> %{outs}"
}
}
local function build_variant(code, cflags)
clibrary {
name = "lib_"..code,
srcs = {
"./C_out.c",
"./bhcst.c",
"./bhdlb.c",
"./bhdnam.c",
"./bhfcon.c",
"./bhicon.c",
"./bhilb.c",
"./bhpnam.c",
"./bhucon.c",
"./crcst.c",
"./crdlb.c",
"./crdnam.c",
"./crilb.c",
"./crpnam.c",
"./crscon.c",
"./crxcon.c",
"./cst.c",
"./dfdlb.c",
"./dfdnam.c",
"./dfilb.c",
"./dlb.c",
"./dnam.c",
"./em.c",
"./end.c",
"./endarg.c",
"./exc.c",
"./failed.c",
"./fcon.c",
"./getid.c",
"./icon.c",
"./ilb.c",
"./insert.c",
"./internerr.c",
"./msend.c",
"./msstart.c",
"./op.c",
"./opcst.c",
"./opdlb.c",
"./opdnam.c",
"./opilb.c",
"./opnarg.c",
"./oppnam.c",
"./pnam.c",
"./pro.c",
"./pronarg.c",
"./psdlb.c",
"./psdnam.c",
"./pspnam.c",
"./scon.c",
"./ucon.c",
},
hdrs = {
"+em_code_ek_h"
},
deps = {
"+em_code_ek_h",
"h+emheaders",
"h+local",
"modules+headers",
"modules/src/alloc+lib",
"modules/src/system+lib",
"util/data+em_data",
},
cflags = { cflags }
}
end
build_variant("e", "-DREADABLE_EM")
build_variant("k", "")

View File

@@ -0,0 +1,10 @@
clibrary {
name = "lib",
srcs = { "./*.c" },
hdrs = { "./flt_arith.h" },
deps = {
"modules+headers"
}
}

View File

@@ -0,0 +1,7 @@
clibrary {
name = "lib",
srcs = {},
hdrs = { "./idf_pkg.*" },
}

View File

@@ -0,0 +1,9 @@
clibrary {
name = "lib",
srcs = {
"./*.c"
},
hdrs = { "./inp_pkg.*" }
}

View File

@@ -0,0 +1,11 @@
clibrary {
name = "lib",
srcs = { "./*.c" },
deps = {
"modules+headers",
"h+local",
"h+emheaders",
},
}

View File

@@ -0,0 +1,11 @@
clibrary {
name = "lib",
srcs = { "./*.c" },
hdrs = { "./print.h" },
deps = {
"modules+headers",
"modules/src/system+lib"
}
}

View File

@@ -0,0 +1,56 @@
normalrule {
name = "c_mnem_narg_h",
ins = {
"./m_C_mnem_na",
"h/em_table",
"./argtype"
},
outleaves = "C_mnem_narg.h",
commands = {
"%{ins} > %{outs}"
}
}
normalrule {
name = "c_mnem_h",
ins = {
"./m_C_mnem",
"h/em_table",
"./argtype"
},
outleaves = "C_mnem.h",
commands = {
"%{ins} > %{outs}"
}
}
clibrary {
name = "lib_ev",
cflags = {
"-DPRIVATE=static",
"-DEXPORT=",
"-DNDEBUG",
"-DCHECKING"
},
srcs = {
"./EM_vars.c",
"./read_em.c",
"./mkcalls.c",
},
hdrs = {
"./em_comp.h",
},
deps = {
"+c_mnem_h",
"+c_mnem_narg_h",
"h+emheaders",
"modules+headers",
"modules/src/alloc+lib",
"modules/src/em_code+em_code_ek_h",
"modules/src/system+lib",
"util/data+em_data",
}
}

View File

@@ -1,10 +1,11 @@
#!/bin/sh
EM_TABLE=$1
ARGTYPE=$2
echo "switch(p->em_opcode) {"
for i in - cdflnorswz p b
do
list=`./argtype $i $EM_TABLE`
list=`$ARGTYPE $i $EM_TABLE`
case $i in
-) args='()'
echo " /* no arguments */"
@@ -34,7 +35,7 @@ do
EOF
done
done
list=`./argtype g $EM_TABLE`
list=`$ARGTYPE g $EM_TABLE`
cat << 'EOF'
default:
/* a "g" argument */

View File

@@ -1,5 +1,6 @@
EM_TABLE=$1
list=`./argtype w $EM_TABLE`
ARGTYPE=$2
list=`$ARGTYPE w $EM_TABLE`
echo "switch(p->em_opcode) {"
for i in $list
do

View File

@@ -0,0 +1,7 @@
clibrary {
name = "lib",
srcs = { "./*.c" },
deps = { "modules+headers" },
}

View File

@@ -0,0 +1,8 @@
clibrary {
name = "lib",
srcs = { "./*.c" },
hdrs = { "./system.h" },
deps = { "modules+headers" },
}