summaryrefslogtreecommitdiff
path: root/utils/ic/mkfile
diff options
context:
space:
mode:
authorRichard Miller <miller.research@gmail.com>2020-11-09 11:36:14 +0000
committerRichard Miller <miller.research@gmail.com>2020-11-09 11:36:14 +0000
commit6e84dc968bc4eaf047fbefcba2f670940718dda8 (patch)
tree523d2f81946b1e0abe4afddf1d2fce7e1525b7d7 /utils/ic/mkfile
parent2a571cc0ece4073eb56d5ccfc3e061a09a353e13 (diff)
Add toolchain for riscv (ia ic il) and riscv64 (ja jc jl)
Because the rv64 ISA is very nearly a proper superset of rv32, the compilers ic and jc are actually the same program, which compiles to .i or .j depending on how it is invoked; similarly for ia/ja and il/jl. It is also possible to invoke ia/ic/il with a '-j' option to specify 64-bit behaviour.
Diffstat (limited to 'utils/ic/mkfile')
-rw-r--r--utils/ic/mkfile48
1 files changed, 48 insertions, 0 deletions
diff --git a/utils/ic/mkfile b/utils/ic/mkfile
new file mode 100644
index 00000000..cf66563c
--- /dev/null
+++ b/utils/ic/mkfile
@@ -0,0 +1,48 @@
+<../../mkconfig
+
+TARG=ic # also makes jc (for riscv64)
+
+OFILES=\
+ cgen.$O\
+ enam.$O\
+ list.$O\
+ mul.$O\
+ peep.$O\
+ pgen.$O\
+ pswt.$O\
+ reg.$O\
+ sgen.$O\
+ swt.$O\
+ txt.$O\
+ lex.$O\
+ machcap.$O\
+
+HFILES=\
+ gc.h\
+ i.out.h\
+ ../cc/cc.h\
+
+LIBS=cc bio 9 # order is important
+
+BIN=$ROOT/$OBJDIR/bin
+
+<$ROOT/mkfiles/mkone-$SHELLTYPE
+
+CFLAGS= $CFLAGS -I../include
+
+$ROOT/$OBJDIR/lib/libcc.a:
+ cd ../cc
+ mk $MKFLAGS install
+ mk $MKFLAGS clean
+
+../cc/y.tab.h: ../cc/cc.y
+ cd ../cc
+ mk $MKFLAGS y.tab.h
+
+lex.$O: ../cc/lex.c ../cc/y.tab.h
+ $CC -Dmain'='ccmain $CFLAGS ../cc/lex.c
+
+%.$O: ../cc/%.c
+ $CC -I. $CFLAGS ../cc/$stem.c
+
+install:V: $BIN/jc