From 25cd8e89710ca9995fe8076d2a193930e794037b Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 28 Mar 2025 00:02:48 +0100 Subject: [PATCH 01/79] Rename the cemcom.ansi directory to not have a dot in the name. --- lang/cem/{cemcom.ansi => cemcom-ansi}/BigPars | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/LLlex.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/LLlex.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/LLmessage.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/SmallPars | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/align.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/arith.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/arith.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/atw.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/blocks.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/blocks.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/build.lua | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/cemcom.ansi.1 | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/ch3.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/ch3.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/ch3bin.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/ch3bin.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/ch3mon.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/ch3mon.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/char.tab | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/class.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/code.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/code.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/conversion.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/conversion.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/cstoper.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/cstoper.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/dataflow.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/dataflow.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/declar.g | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/declar.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/declarator.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/declarator.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/decspecs.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/decspecs.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/def.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/domacro.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/domacro.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/dumpidf.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/error.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/error.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/estack.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/eval.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/eval.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/expr.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/expr.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/expression.g | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/field.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/field.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/file_info.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/fltcstoper.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/fltcstoper.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/idf.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/idf.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/input.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/input.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/interface.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/ival.g | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/l_brace.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/l_class.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/l_comment.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/l_comment.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/l_em.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/l_ev_ord.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/l_lint.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/l_lint.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/l_misc.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/l_outdef.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/l_outdef.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/l_state.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/l_states.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/label.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/label.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/level.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/macro.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/main.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/make.allocd | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/make.hfiles | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/make.next | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/make.tokcase | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/make.tokfile | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/mes.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/next.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/options | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/options.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/options.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/pragma.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/pragma.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/program.g | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/proto.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/proto.main | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/proto.make | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/proto.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/sizes.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/skip.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/skip.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/specials.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/stab.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/stab.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/stack.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/stack.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/statement.g | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/stb.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/stmt.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/struct.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/struct.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/switch.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/switch.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/tokcase.sed | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/tokcasee.in | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/tokcaseh.in | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/tokenname.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/tokenname.h | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/type.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/type.str | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/util.c | 0 lang/cem/{cemcom.ansi => cemcom-ansi}/util.str | 0 117 files changed, 0 insertions(+), 0 deletions(-) rename lang/cem/{cemcom.ansi => cemcom-ansi}/BigPars (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/LLlex.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/LLlex.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/LLmessage.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/SmallPars (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/align.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/arith.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/arith.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/atw.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/blocks.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/blocks.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/build.lua (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/cemcom.ansi.1 (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/ch3.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/ch3.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/ch3bin.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/ch3bin.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/ch3mon.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/ch3mon.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/char.tab (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/class.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/code.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/code.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/conversion.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/conversion.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/cstoper.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/cstoper.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/dataflow.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/dataflow.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/declar.g (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/declar.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/declarator.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/declarator.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/decspecs.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/decspecs.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/def.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/domacro.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/domacro.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/dumpidf.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/error.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/error.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/estack.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/eval.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/eval.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/expr.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/expr.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/expression.g (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/field.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/field.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/file_info.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/fltcstoper.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/fltcstoper.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/idf.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/idf.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/input.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/input.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/interface.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/ival.g (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/l_brace.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/l_class.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/l_comment.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/l_comment.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/l_em.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/l_ev_ord.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/l_lint.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/l_lint.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/l_misc.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/l_outdef.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/l_outdef.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/l_state.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/l_states.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/label.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/label.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/level.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/macro.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/main.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/make.allocd (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/make.hfiles (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/make.next (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/make.tokcase (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/make.tokfile (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/mes.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/next.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/options (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/options.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/options.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/pragma.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/pragma.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/program.g (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/proto.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/proto.main (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/proto.make (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/proto.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/sizes.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/skip.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/skip.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/specials.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/stab.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/stab.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/stack.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/stack.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/statement.g (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/stb.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/stmt.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/struct.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/struct.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/switch.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/switch.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/tokcase.sed (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/tokcasee.in (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/tokcaseh.in (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/tokenname.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/tokenname.h (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/type.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/type.str (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/util.c (100%) rename lang/cem/{cemcom.ansi => cemcom-ansi}/util.str (100%) diff --git a/lang/cem/cemcom.ansi/BigPars b/lang/cem/cemcom-ansi/BigPars similarity index 100% rename from lang/cem/cemcom.ansi/BigPars rename to lang/cem/cemcom-ansi/BigPars diff --git a/lang/cem/cemcom.ansi/LLlex.c b/lang/cem/cemcom-ansi/LLlex.c similarity index 100% rename from lang/cem/cemcom.ansi/LLlex.c rename to lang/cem/cemcom-ansi/LLlex.c diff --git a/lang/cem/cemcom.ansi/LLlex.h b/lang/cem/cemcom-ansi/LLlex.h similarity index 100% rename from lang/cem/cemcom.ansi/LLlex.h rename to lang/cem/cemcom-ansi/LLlex.h diff --git a/lang/cem/cemcom.ansi/LLmessage.c b/lang/cem/cemcom-ansi/LLmessage.c similarity index 100% rename from lang/cem/cemcom.ansi/LLmessage.c rename to lang/cem/cemcom-ansi/LLmessage.c diff --git a/lang/cem/cemcom.ansi/SmallPars b/lang/cem/cemcom-ansi/SmallPars similarity index 100% rename from lang/cem/cemcom.ansi/SmallPars rename to lang/cem/cemcom-ansi/SmallPars diff --git a/lang/cem/cemcom.ansi/align.h b/lang/cem/cemcom-ansi/align.h similarity index 100% rename from lang/cem/cemcom.ansi/align.h rename to lang/cem/cemcom-ansi/align.h diff --git a/lang/cem/cemcom.ansi/arith.c b/lang/cem/cemcom-ansi/arith.c similarity index 100% rename from lang/cem/cemcom.ansi/arith.c rename to lang/cem/cemcom-ansi/arith.c diff --git a/lang/cem/cemcom.ansi/arith.h b/lang/cem/cemcom-ansi/arith.h similarity index 100% rename from lang/cem/cemcom.ansi/arith.h rename to lang/cem/cemcom-ansi/arith.h diff --git a/lang/cem/cemcom.ansi/atw.h b/lang/cem/cemcom-ansi/atw.h similarity index 100% rename from lang/cem/cemcom.ansi/atw.h rename to lang/cem/cemcom-ansi/atw.h diff --git a/lang/cem/cemcom.ansi/blocks.c b/lang/cem/cemcom-ansi/blocks.c similarity index 100% rename from lang/cem/cemcom.ansi/blocks.c rename to lang/cem/cemcom-ansi/blocks.c diff --git a/lang/cem/cemcom.ansi/blocks.h b/lang/cem/cemcom-ansi/blocks.h similarity index 100% rename from lang/cem/cemcom.ansi/blocks.h rename to lang/cem/cemcom-ansi/blocks.h diff --git a/lang/cem/cemcom.ansi/build.lua b/lang/cem/cemcom-ansi/build.lua similarity index 100% rename from lang/cem/cemcom.ansi/build.lua rename to lang/cem/cemcom-ansi/build.lua diff --git a/lang/cem/cemcom.ansi/cemcom.ansi.1 b/lang/cem/cemcom-ansi/cemcom.ansi.1 similarity index 100% rename from lang/cem/cemcom.ansi/cemcom.ansi.1 rename to lang/cem/cemcom-ansi/cemcom.ansi.1 diff --git a/lang/cem/cemcom.ansi/ch3.c b/lang/cem/cemcom-ansi/ch3.c similarity index 100% rename from lang/cem/cemcom.ansi/ch3.c rename to lang/cem/cemcom-ansi/ch3.c diff --git a/lang/cem/cemcom.ansi/ch3.h b/lang/cem/cemcom-ansi/ch3.h similarity index 100% rename from lang/cem/cemcom.ansi/ch3.h rename to lang/cem/cemcom-ansi/ch3.h diff --git a/lang/cem/cemcom.ansi/ch3bin.c b/lang/cem/cemcom-ansi/ch3bin.c similarity index 100% rename from lang/cem/cemcom.ansi/ch3bin.c rename to lang/cem/cemcom-ansi/ch3bin.c diff --git a/lang/cem/cemcom.ansi/ch3bin.h b/lang/cem/cemcom-ansi/ch3bin.h similarity index 100% rename from lang/cem/cemcom.ansi/ch3bin.h rename to lang/cem/cemcom-ansi/ch3bin.h diff --git a/lang/cem/cemcom.ansi/ch3mon.c b/lang/cem/cemcom-ansi/ch3mon.c similarity index 100% rename from lang/cem/cemcom.ansi/ch3mon.c rename to lang/cem/cemcom-ansi/ch3mon.c diff --git a/lang/cem/cemcom.ansi/ch3mon.h b/lang/cem/cemcom-ansi/ch3mon.h similarity index 100% rename from lang/cem/cemcom.ansi/ch3mon.h rename to lang/cem/cemcom-ansi/ch3mon.h diff --git a/lang/cem/cemcom.ansi/char.tab b/lang/cem/cemcom-ansi/char.tab similarity index 100% rename from lang/cem/cemcom.ansi/char.tab rename to lang/cem/cemcom-ansi/char.tab diff --git a/lang/cem/cemcom.ansi/class.h b/lang/cem/cemcom-ansi/class.h similarity index 100% rename from lang/cem/cemcom.ansi/class.h rename to lang/cem/cemcom-ansi/class.h diff --git a/lang/cem/cemcom.ansi/code.c b/lang/cem/cemcom-ansi/code.c similarity index 100% rename from lang/cem/cemcom.ansi/code.c rename to lang/cem/cemcom-ansi/code.c diff --git a/lang/cem/cemcom.ansi/code.str b/lang/cem/cemcom-ansi/code.str similarity index 100% rename from lang/cem/cemcom.ansi/code.str rename to lang/cem/cemcom-ansi/code.str diff --git a/lang/cem/cemcom.ansi/conversion.c b/lang/cem/cemcom-ansi/conversion.c similarity index 100% rename from lang/cem/cemcom.ansi/conversion.c rename to lang/cem/cemcom-ansi/conversion.c diff --git a/lang/cem/cemcom.ansi/conversion.h b/lang/cem/cemcom-ansi/conversion.h similarity index 100% rename from lang/cem/cemcom.ansi/conversion.h rename to lang/cem/cemcom-ansi/conversion.h diff --git a/lang/cem/cemcom.ansi/cstoper.c b/lang/cem/cemcom-ansi/cstoper.c similarity index 100% rename from lang/cem/cemcom.ansi/cstoper.c rename to lang/cem/cemcom-ansi/cstoper.c diff --git a/lang/cem/cemcom.ansi/cstoper.h b/lang/cem/cemcom-ansi/cstoper.h similarity index 100% rename from lang/cem/cemcom.ansi/cstoper.h rename to lang/cem/cemcom-ansi/cstoper.h diff --git a/lang/cem/cemcom.ansi/dataflow.c b/lang/cem/cemcom-ansi/dataflow.c similarity index 100% rename from lang/cem/cemcom.ansi/dataflow.c rename to lang/cem/cemcom-ansi/dataflow.c diff --git a/lang/cem/cemcom.ansi/dataflow.h b/lang/cem/cemcom-ansi/dataflow.h similarity index 100% rename from lang/cem/cemcom.ansi/dataflow.h rename to lang/cem/cemcom-ansi/dataflow.h diff --git a/lang/cem/cemcom.ansi/declar.g b/lang/cem/cemcom-ansi/declar.g similarity index 100% rename from lang/cem/cemcom.ansi/declar.g rename to lang/cem/cemcom-ansi/declar.g diff --git a/lang/cem/cemcom.ansi/declar.str b/lang/cem/cemcom-ansi/declar.str similarity index 100% rename from lang/cem/cemcom.ansi/declar.str rename to lang/cem/cemcom-ansi/declar.str diff --git a/lang/cem/cemcom.ansi/declarator.c b/lang/cem/cemcom-ansi/declarator.c similarity index 100% rename from lang/cem/cemcom.ansi/declarator.c rename to lang/cem/cemcom-ansi/declarator.c diff --git a/lang/cem/cemcom.ansi/declarator.h b/lang/cem/cemcom-ansi/declarator.h similarity index 100% rename from lang/cem/cemcom.ansi/declarator.h rename to lang/cem/cemcom-ansi/declarator.h diff --git a/lang/cem/cemcom.ansi/decspecs.c b/lang/cem/cemcom-ansi/decspecs.c similarity index 100% rename from lang/cem/cemcom.ansi/decspecs.c rename to lang/cem/cemcom-ansi/decspecs.c diff --git a/lang/cem/cemcom.ansi/decspecs.h b/lang/cem/cemcom-ansi/decspecs.h similarity index 100% rename from lang/cem/cemcom.ansi/decspecs.h rename to lang/cem/cemcom-ansi/decspecs.h diff --git a/lang/cem/cemcom.ansi/def.str b/lang/cem/cemcom-ansi/def.str similarity index 100% rename from lang/cem/cemcom.ansi/def.str rename to lang/cem/cemcom-ansi/def.str diff --git a/lang/cem/cemcom.ansi/domacro.c b/lang/cem/cemcom-ansi/domacro.c similarity index 100% rename from lang/cem/cemcom.ansi/domacro.c rename to lang/cem/cemcom-ansi/domacro.c diff --git a/lang/cem/cemcom.ansi/domacro.h b/lang/cem/cemcom-ansi/domacro.h similarity index 100% rename from lang/cem/cemcom.ansi/domacro.h rename to lang/cem/cemcom-ansi/domacro.h diff --git a/lang/cem/cemcom.ansi/dumpidf.c b/lang/cem/cemcom-ansi/dumpidf.c similarity index 100% rename from lang/cem/cemcom.ansi/dumpidf.c rename to lang/cem/cemcom-ansi/dumpidf.c diff --git a/lang/cem/cemcom.ansi/error.c b/lang/cem/cemcom-ansi/error.c similarity index 100% rename from lang/cem/cemcom.ansi/error.c rename to lang/cem/cemcom-ansi/error.c diff --git a/lang/cem/cemcom.ansi/error.h b/lang/cem/cemcom-ansi/error.h similarity index 100% rename from lang/cem/cemcom.ansi/error.h rename to lang/cem/cemcom-ansi/error.h diff --git a/lang/cem/cemcom.ansi/estack.str b/lang/cem/cemcom-ansi/estack.str similarity index 100% rename from lang/cem/cemcom.ansi/estack.str rename to lang/cem/cemcom-ansi/estack.str diff --git a/lang/cem/cemcom.ansi/eval.c b/lang/cem/cemcom-ansi/eval.c similarity index 100% rename from lang/cem/cemcom.ansi/eval.c rename to lang/cem/cemcom-ansi/eval.c diff --git a/lang/cem/cemcom.ansi/eval.h b/lang/cem/cemcom-ansi/eval.h similarity index 100% rename from lang/cem/cemcom.ansi/eval.h rename to lang/cem/cemcom-ansi/eval.h diff --git a/lang/cem/cemcom.ansi/expr.c b/lang/cem/cemcom-ansi/expr.c similarity index 100% rename from lang/cem/cemcom.ansi/expr.c rename to lang/cem/cemcom-ansi/expr.c diff --git a/lang/cem/cemcom.ansi/expr.str b/lang/cem/cemcom-ansi/expr.str similarity index 100% rename from lang/cem/cemcom.ansi/expr.str rename to lang/cem/cemcom-ansi/expr.str diff --git a/lang/cem/cemcom.ansi/expression.g b/lang/cem/cemcom-ansi/expression.g similarity index 100% rename from lang/cem/cemcom.ansi/expression.g rename to lang/cem/cemcom-ansi/expression.g diff --git a/lang/cem/cemcom.ansi/field.c b/lang/cem/cemcom-ansi/field.c similarity index 100% rename from lang/cem/cemcom.ansi/field.c rename to lang/cem/cemcom-ansi/field.c diff --git a/lang/cem/cemcom.ansi/field.str b/lang/cem/cemcom-ansi/field.str similarity index 100% rename from lang/cem/cemcom.ansi/field.str rename to lang/cem/cemcom-ansi/field.str diff --git a/lang/cem/cemcom.ansi/file_info.h b/lang/cem/cemcom-ansi/file_info.h similarity index 100% rename from lang/cem/cemcom.ansi/file_info.h rename to lang/cem/cemcom-ansi/file_info.h diff --git a/lang/cem/cemcom.ansi/fltcstoper.c b/lang/cem/cemcom-ansi/fltcstoper.c similarity index 100% rename from lang/cem/cemcom.ansi/fltcstoper.c rename to lang/cem/cemcom-ansi/fltcstoper.c diff --git a/lang/cem/cemcom.ansi/fltcstoper.h b/lang/cem/cemcom-ansi/fltcstoper.h similarity index 100% rename from lang/cem/cemcom.ansi/fltcstoper.h rename to lang/cem/cemcom-ansi/fltcstoper.h diff --git a/lang/cem/cemcom.ansi/idf.c b/lang/cem/cemcom-ansi/idf.c similarity index 100% rename from lang/cem/cemcom.ansi/idf.c rename to lang/cem/cemcom-ansi/idf.c diff --git a/lang/cem/cemcom.ansi/idf.str b/lang/cem/cemcom-ansi/idf.str similarity index 100% rename from lang/cem/cemcom.ansi/idf.str rename to lang/cem/cemcom-ansi/idf.str diff --git a/lang/cem/cemcom.ansi/input.c b/lang/cem/cemcom-ansi/input.c similarity index 100% rename from lang/cem/cemcom.ansi/input.c rename to lang/cem/cemcom-ansi/input.c diff --git a/lang/cem/cemcom.ansi/input.h b/lang/cem/cemcom-ansi/input.h similarity index 100% rename from lang/cem/cemcom.ansi/input.h rename to lang/cem/cemcom-ansi/input.h diff --git a/lang/cem/cemcom.ansi/interface.h b/lang/cem/cemcom-ansi/interface.h similarity index 100% rename from lang/cem/cemcom.ansi/interface.h rename to lang/cem/cemcom-ansi/interface.h diff --git a/lang/cem/cemcom.ansi/ival.g b/lang/cem/cemcom-ansi/ival.g similarity index 100% rename from lang/cem/cemcom.ansi/ival.g rename to lang/cem/cemcom-ansi/ival.g diff --git a/lang/cem/cemcom.ansi/l_brace.str b/lang/cem/cemcom-ansi/l_brace.str similarity index 100% rename from lang/cem/cemcom.ansi/l_brace.str rename to lang/cem/cemcom-ansi/l_brace.str diff --git a/lang/cem/cemcom.ansi/l_class.h b/lang/cem/cemcom-ansi/l_class.h similarity index 100% rename from lang/cem/cemcom.ansi/l_class.h rename to lang/cem/cemcom-ansi/l_class.h diff --git a/lang/cem/cemcom.ansi/l_comment.c b/lang/cem/cemcom-ansi/l_comment.c similarity index 100% rename from lang/cem/cemcom.ansi/l_comment.c rename to lang/cem/cemcom-ansi/l_comment.c diff --git a/lang/cem/cemcom.ansi/l_comment.h b/lang/cem/cemcom-ansi/l_comment.h similarity index 100% rename from lang/cem/cemcom.ansi/l_comment.h rename to lang/cem/cemcom-ansi/l_comment.h diff --git a/lang/cem/cemcom.ansi/l_em.h b/lang/cem/cemcom-ansi/l_em.h similarity index 100% rename from lang/cem/cemcom.ansi/l_em.h rename to lang/cem/cemcom-ansi/l_em.h diff --git a/lang/cem/cemcom.ansi/l_ev_ord.c b/lang/cem/cemcom-ansi/l_ev_ord.c similarity index 100% rename from lang/cem/cemcom.ansi/l_ev_ord.c rename to lang/cem/cemcom-ansi/l_ev_ord.c diff --git a/lang/cem/cemcom.ansi/l_lint.c b/lang/cem/cemcom-ansi/l_lint.c similarity index 100% rename from lang/cem/cemcom.ansi/l_lint.c rename to lang/cem/cemcom-ansi/l_lint.c diff --git a/lang/cem/cemcom.ansi/l_lint.h b/lang/cem/cemcom-ansi/l_lint.h similarity index 100% rename from lang/cem/cemcom.ansi/l_lint.h rename to lang/cem/cemcom-ansi/l_lint.h diff --git a/lang/cem/cemcom.ansi/l_misc.c b/lang/cem/cemcom-ansi/l_misc.c similarity index 100% rename from lang/cem/cemcom.ansi/l_misc.c rename to lang/cem/cemcom-ansi/l_misc.c diff --git a/lang/cem/cemcom.ansi/l_outdef.c b/lang/cem/cemcom-ansi/l_outdef.c similarity index 100% rename from lang/cem/cemcom.ansi/l_outdef.c rename to lang/cem/cemcom-ansi/l_outdef.c diff --git a/lang/cem/cemcom.ansi/l_outdef.str b/lang/cem/cemcom-ansi/l_outdef.str similarity index 100% rename from lang/cem/cemcom.ansi/l_outdef.str rename to lang/cem/cemcom-ansi/l_outdef.str diff --git a/lang/cem/cemcom.ansi/l_state.str b/lang/cem/cemcom-ansi/l_state.str similarity index 100% rename from lang/cem/cemcom.ansi/l_state.str rename to lang/cem/cemcom-ansi/l_state.str diff --git a/lang/cem/cemcom.ansi/l_states.c b/lang/cem/cemcom-ansi/l_states.c similarity index 100% rename from lang/cem/cemcom.ansi/l_states.c rename to lang/cem/cemcom-ansi/l_states.c diff --git a/lang/cem/cemcom.ansi/label.c b/lang/cem/cemcom-ansi/label.c similarity index 100% rename from lang/cem/cemcom.ansi/label.c rename to lang/cem/cemcom-ansi/label.c diff --git a/lang/cem/cemcom.ansi/label.h b/lang/cem/cemcom-ansi/label.h similarity index 100% rename from lang/cem/cemcom.ansi/label.h rename to lang/cem/cemcom-ansi/label.h diff --git a/lang/cem/cemcom.ansi/level.h b/lang/cem/cemcom-ansi/level.h similarity index 100% rename from lang/cem/cemcom.ansi/level.h rename to lang/cem/cemcom-ansi/level.h diff --git a/lang/cem/cemcom.ansi/macro.str b/lang/cem/cemcom-ansi/macro.str similarity index 100% rename from lang/cem/cemcom.ansi/macro.str rename to lang/cem/cemcom-ansi/macro.str diff --git a/lang/cem/cemcom.ansi/main.c b/lang/cem/cemcom-ansi/main.c similarity index 100% rename from lang/cem/cemcom.ansi/main.c rename to lang/cem/cemcom-ansi/main.c diff --git a/lang/cem/cemcom.ansi/make.allocd b/lang/cem/cemcom-ansi/make.allocd similarity index 100% rename from lang/cem/cemcom.ansi/make.allocd rename to lang/cem/cemcom-ansi/make.allocd diff --git a/lang/cem/cemcom.ansi/make.hfiles b/lang/cem/cemcom-ansi/make.hfiles similarity index 100% rename from lang/cem/cemcom.ansi/make.hfiles rename to lang/cem/cemcom-ansi/make.hfiles diff --git a/lang/cem/cemcom.ansi/make.next b/lang/cem/cemcom-ansi/make.next similarity index 100% rename from lang/cem/cemcom.ansi/make.next rename to lang/cem/cemcom-ansi/make.next diff --git a/lang/cem/cemcom.ansi/make.tokcase b/lang/cem/cemcom-ansi/make.tokcase similarity index 100% rename from lang/cem/cemcom.ansi/make.tokcase rename to lang/cem/cemcom-ansi/make.tokcase diff --git a/lang/cem/cemcom.ansi/make.tokfile b/lang/cem/cemcom-ansi/make.tokfile similarity index 100% rename from lang/cem/cemcom.ansi/make.tokfile rename to lang/cem/cemcom-ansi/make.tokfile diff --git a/lang/cem/cemcom.ansi/mes.h b/lang/cem/cemcom-ansi/mes.h similarity index 100% rename from lang/cem/cemcom.ansi/mes.h rename to lang/cem/cemcom-ansi/mes.h diff --git a/lang/cem/cemcom.ansi/next.str b/lang/cem/cemcom-ansi/next.str similarity index 100% rename from lang/cem/cemcom.ansi/next.str rename to lang/cem/cemcom-ansi/next.str diff --git a/lang/cem/cemcom.ansi/options b/lang/cem/cemcom-ansi/options similarity index 100% rename from lang/cem/cemcom.ansi/options rename to lang/cem/cemcom-ansi/options diff --git a/lang/cem/cemcom.ansi/options.c b/lang/cem/cemcom-ansi/options.c similarity index 100% rename from lang/cem/cemcom.ansi/options.c rename to lang/cem/cemcom-ansi/options.c diff --git a/lang/cem/cemcom.ansi/options.h b/lang/cem/cemcom-ansi/options.h similarity index 100% rename from lang/cem/cemcom.ansi/options.h rename to lang/cem/cemcom-ansi/options.h diff --git a/lang/cem/cemcom.ansi/pragma.c b/lang/cem/cemcom-ansi/pragma.c similarity index 100% rename from lang/cem/cemcom.ansi/pragma.c rename to lang/cem/cemcom-ansi/pragma.c diff --git a/lang/cem/cemcom.ansi/pragma.h b/lang/cem/cemcom-ansi/pragma.h similarity index 100% rename from lang/cem/cemcom.ansi/pragma.h rename to lang/cem/cemcom-ansi/pragma.h diff --git a/lang/cem/cemcom.ansi/program.g b/lang/cem/cemcom-ansi/program.g similarity index 100% rename from lang/cem/cemcom.ansi/program.g rename to lang/cem/cemcom-ansi/program.g diff --git a/lang/cem/cemcom.ansi/proto.c b/lang/cem/cemcom-ansi/proto.c similarity index 100% rename from lang/cem/cemcom.ansi/proto.c rename to lang/cem/cemcom-ansi/proto.c diff --git a/lang/cem/cemcom.ansi/proto.main b/lang/cem/cemcom-ansi/proto.main similarity index 100% rename from lang/cem/cemcom.ansi/proto.main rename to lang/cem/cemcom-ansi/proto.main diff --git a/lang/cem/cemcom.ansi/proto.make b/lang/cem/cemcom-ansi/proto.make similarity index 100% rename from lang/cem/cemcom.ansi/proto.make rename to lang/cem/cemcom-ansi/proto.make diff --git a/lang/cem/cemcom.ansi/proto.str b/lang/cem/cemcom-ansi/proto.str similarity index 100% rename from lang/cem/cemcom.ansi/proto.str rename to lang/cem/cemcom-ansi/proto.str diff --git a/lang/cem/cemcom.ansi/sizes.h b/lang/cem/cemcom-ansi/sizes.h similarity index 100% rename from lang/cem/cemcom.ansi/sizes.h rename to lang/cem/cemcom-ansi/sizes.h diff --git a/lang/cem/cemcom.ansi/skip.c b/lang/cem/cemcom-ansi/skip.c similarity index 100% rename from lang/cem/cemcom.ansi/skip.c rename to lang/cem/cemcom-ansi/skip.c diff --git a/lang/cem/cemcom.ansi/skip.h b/lang/cem/cemcom-ansi/skip.h similarity index 100% rename from lang/cem/cemcom.ansi/skip.h rename to lang/cem/cemcom-ansi/skip.h diff --git a/lang/cem/cemcom.ansi/specials.h b/lang/cem/cemcom-ansi/specials.h similarity index 100% rename from lang/cem/cemcom.ansi/specials.h rename to lang/cem/cemcom-ansi/specials.h diff --git a/lang/cem/cemcom.ansi/stab.c b/lang/cem/cemcom-ansi/stab.c similarity index 100% rename from lang/cem/cemcom.ansi/stab.c rename to lang/cem/cemcom-ansi/stab.c diff --git a/lang/cem/cemcom.ansi/stab.h b/lang/cem/cemcom-ansi/stab.h similarity index 100% rename from lang/cem/cemcom.ansi/stab.h rename to lang/cem/cemcom-ansi/stab.h diff --git a/lang/cem/cemcom.ansi/stack.c b/lang/cem/cemcom-ansi/stack.c similarity index 100% rename from lang/cem/cemcom.ansi/stack.c rename to lang/cem/cemcom-ansi/stack.c diff --git a/lang/cem/cemcom.ansi/stack.str b/lang/cem/cemcom-ansi/stack.str similarity index 100% rename from lang/cem/cemcom.ansi/stack.str rename to lang/cem/cemcom-ansi/stack.str diff --git a/lang/cem/cemcom.ansi/statement.g b/lang/cem/cemcom-ansi/statement.g similarity index 100% rename from lang/cem/cemcom.ansi/statement.g rename to lang/cem/cemcom-ansi/statement.g diff --git a/lang/cem/cemcom.ansi/stb.c b/lang/cem/cemcom-ansi/stb.c similarity index 100% rename from lang/cem/cemcom.ansi/stb.c rename to lang/cem/cemcom-ansi/stb.c diff --git a/lang/cem/cemcom.ansi/stmt.str b/lang/cem/cemcom-ansi/stmt.str similarity index 100% rename from lang/cem/cemcom.ansi/stmt.str rename to lang/cem/cemcom-ansi/stmt.str diff --git a/lang/cem/cemcom.ansi/struct.c b/lang/cem/cemcom-ansi/struct.c similarity index 100% rename from lang/cem/cemcom.ansi/struct.c rename to lang/cem/cemcom-ansi/struct.c diff --git a/lang/cem/cemcom.ansi/struct.str b/lang/cem/cemcom-ansi/struct.str similarity index 100% rename from lang/cem/cemcom.ansi/struct.str rename to lang/cem/cemcom-ansi/struct.str diff --git a/lang/cem/cemcom.ansi/switch.c b/lang/cem/cemcom-ansi/switch.c similarity index 100% rename from lang/cem/cemcom.ansi/switch.c rename to lang/cem/cemcom-ansi/switch.c diff --git a/lang/cem/cemcom.ansi/switch.str b/lang/cem/cemcom-ansi/switch.str similarity index 100% rename from lang/cem/cemcom.ansi/switch.str rename to lang/cem/cemcom-ansi/switch.str diff --git a/lang/cem/cemcom.ansi/tokcase.sed b/lang/cem/cemcom-ansi/tokcase.sed similarity index 100% rename from lang/cem/cemcom.ansi/tokcase.sed rename to lang/cem/cemcom-ansi/tokcase.sed diff --git a/lang/cem/cemcom.ansi/tokcasee.in b/lang/cem/cemcom-ansi/tokcasee.in similarity index 100% rename from lang/cem/cemcom.ansi/tokcasee.in rename to lang/cem/cemcom-ansi/tokcasee.in diff --git a/lang/cem/cemcom.ansi/tokcaseh.in b/lang/cem/cemcom-ansi/tokcaseh.in similarity index 100% rename from lang/cem/cemcom.ansi/tokcaseh.in rename to lang/cem/cemcom-ansi/tokcaseh.in diff --git a/lang/cem/cemcom.ansi/tokenname.c b/lang/cem/cemcom-ansi/tokenname.c similarity index 100% rename from lang/cem/cemcom.ansi/tokenname.c rename to lang/cem/cemcom-ansi/tokenname.c diff --git a/lang/cem/cemcom.ansi/tokenname.h b/lang/cem/cemcom-ansi/tokenname.h similarity index 100% rename from lang/cem/cemcom.ansi/tokenname.h rename to lang/cem/cemcom-ansi/tokenname.h diff --git a/lang/cem/cemcom.ansi/type.c b/lang/cem/cemcom-ansi/type.c similarity index 100% rename from lang/cem/cemcom.ansi/type.c rename to lang/cem/cemcom-ansi/type.c diff --git a/lang/cem/cemcom.ansi/type.str b/lang/cem/cemcom-ansi/type.str similarity index 100% rename from lang/cem/cemcom.ansi/type.str rename to lang/cem/cemcom-ansi/type.str diff --git a/lang/cem/cemcom.ansi/util.c b/lang/cem/cemcom-ansi/util.c similarity index 100% rename from lang/cem/cemcom.ansi/util.c rename to lang/cem/cemcom-ansi/util.c diff --git a/lang/cem/cemcom.ansi/util.str b/lang/cem/cemcom-ansi/util.str similarity index 100% rename from lang/cem/cemcom.ansi/util.str rename to lang/cem/cemcom-ansi/util.str From cf1f432881ab253a6dc7fd9ca1c5e699df86dc17 Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 28 Mar 2025 22:45:11 +0100 Subject: [PATCH 02/79] First swatch of ab buildfiles. cemcom.ansi builds. --- Makefile | 120 +------ build.py | 13 + build/_objectify.py | 19 + build/_sandbox.py | 44 +++ build/ab.mk | 112 ++++++ build/ab.py | 623 +++++++++++++++++++++++++++++++++ build/c.py | 521 +++++++++++++++++++++++++++ build/d.py | 82 +++++ build/pkg.py | 84 +++++ build/toolchain.py | 6 + build/utils.py | 92 +++++ build/yacc.py | 35 ++ h/build.py | 33 ++ lang/cem/cemcom-ansi/build.py | 119 +++++++ lang/cem/cemcom.ansi/build.py | 1 + modules/h/build.py | 17 + modules/src/alloc/build.py | 14 + modules/src/data/build.py | 26 ++ modules/src/em_code/build.py | 97 +++++ modules/src/em_data/build.py | 27 ++ modules/src/em_mes/build.py | 9 + modules/src/flt_arith/build.py | 25 ++ modules/src/idf/build.py | 8 + modules/src/input/build.py | 9 + modules/src/object/build.py | 9 + modules/src/string/build.py | 7 + modules/src/system/build.py | 9 + util/LLgen/build.py | 52 +++ util/amisc/build.py | 25 ++ util/arch/build.py | 23 ++ util/cmisc/build.py | 15 + util/led/build.py | 23 ++ util/ncgg/build.py | 28 ++ util/ncgg/cgg.y | 1 + util/ncgg/make_enterkeyw_c.lua | 2 +- util/ncgg/scan.l | 2 +- 36 files changed, 2221 insertions(+), 111 deletions(-) create mode 100644 build.py create mode 100644 build/_objectify.py create mode 100644 build/_sandbox.py create mode 100644 build/ab.mk create mode 100644 build/ab.py create mode 100644 build/c.py create mode 100644 build/d.py create mode 100644 build/pkg.py create mode 100644 build/toolchain.py create mode 100644 build/utils.py create mode 100644 build/yacc.py create mode 100644 h/build.py create mode 100644 lang/cem/cemcom-ansi/build.py create mode 100644 lang/cem/cemcom.ansi/build.py create mode 100644 modules/h/build.py create mode 100644 modules/src/alloc/build.py create mode 100644 modules/src/data/build.py create mode 100644 modules/src/em_code/build.py create mode 100644 modules/src/em_data/build.py create mode 100644 modules/src/em_mes/build.py create mode 100644 modules/src/flt_arith/build.py create mode 100644 modules/src/idf/build.py create mode 100644 modules/src/input/build.py create mode 100644 modules/src/object/build.py create mode 100644 modules/src/string/build.py create mode 100644 modules/src/system/build.py create mode 100644 util/LLgen/build.py create mode 100644 util/amisc/build.py create mode 100644 util/arch/build.py create mode 100644 util/cmisc/build.py create mode 100644 util/led/build.py create mode 100644 util/ncgg/build.py diff --git a/Makefile b/Makefile index 6c4f22b584..b65307ad7b 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,8 @@ else ACK_TEMP_DIR ?= $(TMPDIR) endif +INSDIR = $(OBJ)/staging + # Where is the ACK going to be installed, eventually? If you don't want to # install it and just want to run the ACK from the build directory # ($(TMPDIR)/ack-build/staging, by default), leave this as $(INSDIR). @@ -22,7 +24,7 @@ endif ifeq ($(OS),Windows_NT) PREFIX ?= c:/ack else -PREFIX ?= /usr/local +PREFIX ?= /opt/pkg/ack #PREFIX = $(INSDIR) endif @@ -35,122 +37,22 @@ BUILDDIR ?= $(ACK_TEMP_DIR)/ack-build CFLAGS ?= -g \ -Werror=return-type \ -Werror=implicit-function-declaration \ - -Werror=strict-prototypes + -Werror=strict-prototypes \ + -DUNREACHABLE_CODE='__builtin_unreachable()' \ + -DNORETURN=_Noreturn + +HOSTCFLAGS = $(CFLAGS) LDFLAGS ?= -g # Various commands. -AR ?= ar -CC ?= gcc LUA ?= lua -# Which build system to use; use 'ninja' or 'make' (in lower case). Leave -# blank to autodetect. - -BUILDSYSTEM ?= - -# Build flags for ninja. - -NINJAFLAGS ?= - -# Build flags for make. - -MAKEFLAGS ?= - -# ======================================================================= # -# END OF CONFIGURATION # -# ======================================================================= # - -# You shouldn't need to change anything below this point unless you are -# actually developing ACK. - -OBJDIR = $(abspath $(BUILDDIR)/obj) -BINDIR = $(abspath $(BUILDDIR)/bin) -LIBDIR = $(abspath $(BUILDDIR)/lib) -INCDIR = $(abspath $(BUILDDIR)/include) -INSDIR = $(abspath $(BUILDDIR)/staging) +.PHONY: all +all: +all PLATIND = $(INSDIR)/share/ack PLATDEP = $(INSDIR)/lib/ack -MANDATORYCFLAGS = \ - -DUNREACHABLE_CODE='__builtin_unreachable()' \ - -DNORETURN=_Noreturn - -MANDATORYLDFLAGS = - -.NOTPARALLEL: - -ifeq ($(BUILDSYSTEM),) - ifneq ($(shell which ninja),) -BUILDSYSTEM = ninja - else -BUILDSYSTEM = make - endif -endif - -build-file = $(BUILDDIR)/build.$(BUILDSYSTEM) -lua-files = $(shell find . -name 'build*.lua') -our-lua = $(BUILDDIR)/lua - -# GNU make sets MAKECMDGOALS to the list of targets from the command -# line. We look for targets with '+' and forward them to BUILDSYSTEM. -# This handles commands like -# $ make util/opt+pkg util/ego+pkg - -all-goals = +ack +tests -plus-goals := $(patsubst all,$(all-goals),$(or $(MAKECMDGOALS),all)) -plus-goals := $(foreach g,$(plus-goals),$(if $(findstring +,$(g)),$(g),)) - -# @true silences extra message, "make: Nothing to be done..." - -all: build-plus-goals - @true - -ifneq ($(plus-goals),) -$(plus-goals): build-plus-goals - @true -endif - -build-plus-goals: $(build-file) -ifeq ($(BUILDSYSTEM),ninja) - @ninja $(NINJAFLAGS) -f $(build-file) $(plus-goals) -else ifeq ($(BUILDSYSTEM),make) -# GNU make passes MAKEFLAGS in environment. - @$(MAKE) -f $(build-file) $(plus-goals) -else -$(error unknown BUILDSYSTEM = $(BUILDSYSTEM)) -endif - -$(build-file): first/ackbuilder.lua Makefile $(lua-files) - @mkdir -p $(BUILDDIR) - @$(LUA) first/ackbuilder.lua \ - first/build.lua build.lua \ - --$(BUILDSYSTEM) \ - LUA=$(LUA) \ - DEFAULT_PLATFORM=$(DEFAULT_PLATFORM) \ - OBJDIR=$(OBJDIR) \ - BINDIR=$(BINDIR) \ - LIBDIR=$(LIBDIR) \ - INCDIR=$(INCDIR) \ - INSDIR=$(INSDIR) \ - PLATIND=$(PLATIND) \ - PLATDEP=$(PLATDEP) \ - PREFIX="$(PREFIX)" \ - AR=$(AR) \ - CC=$(CC) \ - CFLAGS="$(MANDATORYCFLAGS) $(CFLAGS)" \ - LDFLAGS="$(MANDATORYLDFLAGS) $(LDFLAGS)" \ - > $(build-file) - -ack-setup.exe: etc/windows-installer.nsi - makensis -dBUILDDIR=$(BUILDDIR)/staging -dOUTFILE="$$(realpath $@)" $< - -install: - mkdir -p $(PREFIX) - tar cf - -C $(INSDIR) . | tar xvf - -C $(PREFIX) - -clean: - rm -rf $(BUILDDIR) - +include build/ab.mk diff --git a/build.py b/build.py new file mode 100644 index 0000000000..29ccea61ec --- /dev/null +++ b/build.py @@ -0,0 +1,13 @@ +from build.ab import export + +export( + name="all", + deps=[ + "util/amisc+all", + "util/arch+all", + "util/led+all", + "util/ncgg", + "util/LLgen", + "lang/cem/cemcom-ansi+all", + ], +) diff --git a/build/_objectify.py b/build/_objectify.py new file mode 100644 index 0000000000..171489541d --- /dev/null +++ b/build/_objectify.py @@ -0,0 +1,19 @@ +import sys +from functools import partial + +if len(sys.argv) != 3: + sys.exit("Usage: %s " % sys.argv[0]) +filename = sys.argv[1] +symbol = sys.argv[2] + +print("const uint8_t " + symbol + "[] = {") +n = 0 +with open(filename, "rb") as in_file: + for c in iter(partial(in_file.read, 1), b""): + print("0x%02X," % ord(c), end="") + n += 1 + if n % 16 == 0: + print() +print("};") + +print("const size_t " + symbol + "_len = sizeof(" + symbol + ");") diff --git a/build/_sandbox.py b/build/_sandbox.py new file mode 100644 index 0000000000..2450c537e7 --- /dev/null +++ b/build/_sandbox.py @@ -0,0 +1,44 @@ +#!/usr/bin/python3 + +from os.path import * +import argparse +import os +import shutil + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("-s", "--sandbox") + parser.add_argument("-v", "--verbose", action="store_true") + parser.add_argument("-l", "--link", action="store_true") + parser.add_argument("-e", "--export", action="store_true") + parser.add_argument("files", nargs="*") + args = parser.parse_args() + + assert args.sandbox, "You must specify a sandbox directory" + assert args.link ^ args.export, "You can't link and export at the same time" + + if args.link: + os.makedirs(args.sandbox, exist_ok=True) + for f in args.files: + sf = join(args.sandbox, f) + if args.verbose: + print("link", sf) + os.makedirs(dirname(sf), exist_ok=True) + try: + os.link(abspath(f), sf) + except PermissionError: + shutil.copy(f, sf) + + if args.export: + for f in args.files: + sf = join(args.sandbox, f) + if args.verbose: + print("export", sf) + df = dirname(f) + if df: + os.makedirs(df, exist_ok=True) + os.rename(sf, f) + + +main() diff --git a/build/ab.mk b/build/ab.mk new file mode 100644 index 0000000000..26c79affba --- /dev/null +++ b/build/ab.mk @@ -0,0 +1,112 @@ +MAKENOT4 := $(if $(findstring 3.9999, $(lastword $(sort 3.9999 $(MAKE_VERSION)))),yes,no) +MAKE4.3 := $(if $(findstring 4.3, $(firstword $(sort 4.3 $(MAKE_VERSION)))),yes,no) +MAKE4.1 := $(if $(findstring no_no,$(MAKENOT4)_$(MAKE4.3)),yes,no) + +ifeq ($(MAKENOT3),yes) +$(error You need GNU Make 4.x for this (if you're on OSX, use gmake).) +endif + +OBJ ?= .obj +PYTHON ?= python3 +PKG_CONFIG ?= pkg-config +HOST_PKG_CONFIG ?= $(PKG_CONFIG) +ECHO ?= echo +CP ?= cp + +HOSTCC ?= gcc +HOSTCXX ?= g++ +HOSTAR ?= ar +HOSTCFLAGS ?= -g -Og +HOSTLDFLAGS ?= -g + +HOSTDMD ?= ldmd2 +HOSTDFLAGS ?= -g +HOSTDLINKFLAGS ?= + +CC ?= $(HOSTCC) +CXX ?= $(HOSTCXX) +AR ?= $(HOSTAR) +CFLAGS ?= $(HOSTCFLAGS) +LDFLAGS ?= $(HOSTLDFLAGS) + +DMD ?= $(HOSTDMD) +DFLAGS ?= $(HOSTDFLAGS) +DLINKFLAGS ?= $(HOSTDLINKFLAGS) + +export PKG_CONFIG +export HOST_PKG_CONFIG + +ifdef VERBOSE + hide = +else + ifdef V + hide = + else + hide = @ + endif +endif + +WINDOWS := no +OSX := no +LINUX := no +ifeq ($(OS),Windows_NT) + WINDOWS := yes +else + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Linux) + LINUX := yes + endif + ifeq ($(UNAME_S),Darwin) + OSX := yes + endif +endif + +ifeq ($(OS), Windows_NT) + EXT ?= .exe +endif +EXT ?= + +CWD=$(shell pwd) + +ifeq ($(PROGRESSINFO),) +# The first make invocation here has to have its output discarded or else it +# produces spurious 'Leaving directory' messages... don't know why. +rulecount := $(strip $(shell $(MAKE) --no-print-directory -q $(OBJ)/build.mk PROGRESSINFO=1 > /dev/null \ + && $(MAKE) --no-print-directory -n $(MAKECMDGOALS) PROGRESSINFO=XXXPROGRESSINFOXXX | grep XXXPROGRESSINFOXXX | wc -l)) +ruleindex := 1 +PROGRESSINFO = "[$(ruleindex)/$(rulecount)]$(eval ruleindex := $(shell expr $(ruleindex) + 1))" +endif + +PKG_CONFIG_HASHES = $(OBJ)/.pkg-config-hashes/target-$(word 1, $(shell $(PKG_CONFIG) --list-all | md5sum)) +HOST_PKG_CONFIG_HASHES = $(OBJ)/.pkg-config-hashes/host-$(word 1, $(shell $(HOST_PKG_CONFIG) --list-all | md5sum)) + +$(OBJ)/build.mk : $(PKG_CONFIG_HASHES) $(HOST_PKG_CONFIG_HASHES) +$(PKG_CONFIG_HASHES) $(HOST_PKG_CONFIG_HASHES) &: + $(hide) rm -rf $(OBJ)/.pkg-config-hashes + $(hide) mkdir -p $(OBJ)/.pkg-config-hashes + $(hide) touch $(PKG_CONFIG_HASHES) $(HOST_PKG_CONFIG_HASHES) + +include $(OBJ)/build.mk + +MAKEFLAGS += -r -j$(shell nproc) +.DELETE_ON_ERROR: + +.PHONY: update-ab +update-ab: + @echo "Press RETURN to update ab from the repository, or CTRL+C to cancel." \ + && read a \ + && (curl -L https://github.com/davidgiven/ab/releases/download/dev/distribution.tar.xz | tar xvJf -) \ + && echo "Done." + +.PHONY: clean +clean:: + @echo CLEAN + $(hide) rm -rf $(OBJ) + +export PYTHONHASHSEED = 1 +build-files = $(shell find . -name 'build.py') $(wildcard build/*.py) $(wildcard config.py) +$(OBJ)/build.mk: Makefile $(build-files) build/ab.mk + @echo "AB" + @mkdir -p $(OBJ) + $(hide) $(PYTHON) -X pycache_prefix=$(OBJ)/__pycache__ build/ab.py -o $@ build.py \ + || rm -f $@ diff --git a/build/ab.py b/build/ab.py new file mode 100644 index 0000000000..bc8fc21d64 --- /dev/null +++ b/build/ab.py @@ -0,0 +1,623 @@ +from os.path import * +from pathlib import Path +from typing import Iterable +import argparse +import builtins +from copy import copy +import functools +import importlib +import importlib.abc +import importlib.util +from importlib.machinery import ( + SourceFileLoader, + PathFinder, + ModuleSpec, +) +import inspect +import string +import sys +import hashlib +import re +import ast +from collections import namedtuple + +verbose = False +quiet = False +cwdStack = [""] +targets = {} +unmaterialisedTargets = {} # dict, not set, to get consistent ordering +materialisingStack = [] +defaultGlobals = {} + +RE_FORMAT_SPEC = re.compile( + r"(?:(?P[\s\S])?(?P[<>=^]))?" + r"(?P[- +])?" + r"(?Pz)?" + r"(?P#)?" + r"(?P0)?" + r"(?P\d+)?" + r"(?P[_,])?" + r"(?:(?P\.)(?P\d+))?" + r"(?P[bcdeEfFgGnosxX%])?" +) + +CommandFormatSpec = namedtuple( + "CommandFormatSpec", RE_FORMAT_SPEC.groupindex.keys() +) + +sys.path += ["."] +old_import = builtins.__import__ + + +class PathFinderImpl(PathFinder): + def find_spec(self, fullname, path, target=None): + # The second test here is needed for Python 3.9. + if not path or not path[0]: + path = ["."] + if len(path) != 1: + return None + + try: + path = relpath(path[0]) + except ValueError: + return None + + realpath = fullname.replace(".", "/") + buildpath = realpath + ".py" + if isfile(buildpath): + spec = importlib.util.spec_from_file_location( + name=fullname, + location=buildpath, + loader=BuildFileLoaderImpl(fullname=fullname, path=buildpath), + submodule_search_locations=[], + ) + return spec + if isdir(realpath): + return ModuleSpec(fullname, None, origin=realpath, is_package=True) + return None + + +class BuildFileLoaderImpl(SourceFileLoader): + def exec_module(self, module): + sourcepath = relpath(module.__file__) + + if not quiet: + print("loading", sourcepath) + cwdStack.append(dirname(sourcepath)) + super(SourceFileLoader, self).exec_module(module) + cwdStack.pop() + + +sys.meta_path.insert(0, PathFinderImpl()) + + +class ABException(BaseException): + pass + + +def error(message): + raise ABException(message) + + +class BracketedFormatter(string.Formatter): + def parse(self, format_string): + while format_string: + left, *right = format_string.split("$[", 1) + if not right: + yield (left, None, None, None) + break + right = right[0] + + offset = len(right) + 1 + try: + ast.parse(right) + except SyntaxError as e: + if not str(e).startswith("unmatched ']'"): + raise e + offset = e.offset + + expr = right[0 : offset - 1] + format_string = right[offset:] + + yield (left if left else None, expr, None, None) + + +def Rule(func): + sig = inspect.signature(func) + + @functools.wraps(func) + def wrapper(*, name=None, replaces=None, **kwargs): + cwd = None + if "cwd" in kwargs: + cwd = kwargs["cwd"] + del kwargs["cwd"] + + if not cwd: + if replaces: + cwd = replaces.cwd + else: + cwd = cwdStack[-1] + + if name: + if name[0] != "+": + name = "+" + name + t = Target(cwd, join(cwd, name)) + + assert ( + t.name not in targets + ), f"target {t.name} has already been defined" + targets[t.name] = t + elif replaces: + t = replaces + else: + raise ABException("you must supply either 'name' or 'replaces'") + + t.cwd = cwd + t.types = func.__annotations__ + t.callback = func + t.traits.add(func.__name__) + if "args" in kwargs: + t.args.update(kwargs["args"]) + del kwargs["args"] + if "traits" in kwargs: + t.traits |= kwargs["traits"] + del kwargs["traits"] + + t.binding = sig.bind(name=name, self=t, **kwargs) + t.binding.apply_defaults() + + unmaterialisedTargets[t] = None + if replaces: + t.materialise(replacing=True) + return t + + defaultGlobals[func.__name__] = wrapper + return wrapper + + +def _isiterable(xs): + return isinstance(xs, Iterable) and not isinstance( + xs, (str, bytes, bytearray) + ) + + +class Target: + def __init__(self, cwd, name): + if verbose: + print("rule('%s', cwd='%s'" % (name, cwd)) + self.name = name + self.localname = self.name.rsplit("+")[-1] + self.traits = set() + self.dir = join("$(OBJ)", name) + self.ins = [] + self.outs = [] + self.deps = [] + self.materialised = False + self.args = {} + + def __eq__(self, other): + return self.name is other.name + + def __lt__(self, other): + return self.name < other.name + + def __hash__(self): + return id(self) + + def __repr__(self): + return f"Target('{self.name}')" + + def templateexpand(selfi, s): + class Formatter(BracketedFormatter): + def get_field(self, name, a1, a2): + return ( + eval(name, selfi.callback.__globals__, selfi.args), + False, + ) + + def format_field(self, value, format_spec): + if not value: + return "" + if type(value) == str: + return value + if _isiterable(value): + value = list(value) + if type(value) != list: + value = [value] + return " ".join( + [selfi.templateexpand(f) for f in filenamesof(value)] + ) + + return Formatter().format(s) + + def materialise(self, replacing=False): + if self not in unmaterialisedTargets: + return + + if not replacing and self in materialisingStack: + print("Found dependency cycle:") + for i in materialisingStack: + print(f" {i.name}") + print(f" {self.name}") + sys.exit(1) + materialisingStack.append(self) + + # Perform type conversion to the declared rule parameter types. + + try: + for k, v in self.binding.arguments.items(): + if k != "kwargs": + t = self.types.get(k, None) + if t: + v = t.convert(v, self) + self.args[k] = copy(v) + else: + for kk, vv in v.items(): + t = self.types.get(kk, None) + if t: + vv = t.convert(v, self) + self.args[kk] = copy(vv) + self.args["name"] = self.name + self.args["dir"] = self.dir + self.args["self"] = self + + # Actually call the callback. + + cwdStack.append(self.cwd) + if "kwargs" in self.binding.arguments.keys(): + # If the caller wants kwargs, return all arguments except the standard ones. + cbargs = { + k: v for k, v in self.args.items() if k not in {"dir"} + } + else: + # Otherwise, just call the callback with the ones it asks for. + cbargs = {} + for k in self.binding.arguments.keys(): + if k != "kwargs": + try: + cbargs[k] = self.args[k] + except KeyError: + error( + f"invocation of {self} failed because {k} isn't an argument" + ) + self.callback(**cbargs) + cwdStack.pop() + except BaseException as e: + print(f"Error materialising {self}: {self.callback}") + print(f"Arguments: {self.args}") + raise e + + if self.outs is None: + raise ABException(f"{self.name} didn't set self.outs") + + if self in unmaterialisedTargets: + del unmaterialisedTargets[self] + materialisingStack.pop() + self.materialised = True + + def convert(value, target): + if not value: + return None + return target.targetof(value) + + def targetof(self, value): + if isinstance(value, str) and (value[0] == "="): + value = join(self.dir, value[1:]) + + return targetof(value, self.cwd) + + +def _filetarget(value, cwd): + if value in targets: + return targets[value] + + t = Target(cwd, value) + t.outs = [value] + targets[value] = t + return t + + +def targetof(value, cwd=None): + if not cwd: + cwd = cwdStack[-1] + if isinstance(value, Path): + value = value.as_posix() + if isinstance(value, Target): + t = value + else: + assert ( + value[0] != "=" + ), "can only use = for targets associated with another target" + + if value.startswith("."): + # Check for local rule. + if value.startswith(".+"): + value = normpath(join(cwd, value[1:])) + # Check for local path. + elif value.startswith("./"): + value = normpath(join(cwd, value)) + # Explicit directories are always raw files. + elif value.endswith("/"): + return _filetarget(value, cwd) + # Anything starting with a variable expansion is always a raw file. + elif value.startswith("$"): + return _filetarget(value, cwd) + + # If this is not a rule lookup... + if "+" not in value: + # ...and if the value is pointing at a directory without a trailing /, + # it's a shorthand rule lookup. + if isdir(value): + value = value + "+" + basename(value) + # Otherwise it's an absolute file. + else: + return _filetarget(value, cwd) + + # At this point we have the fully qualified name of a rule. + + (path, target) = value.rsplit("+", 1) + value = join(path, "+" + target) + if value not in targets: + # Load the new build file. + + path = join(path, "build.py") + try: + loadbuildfile(path) + except ModuleNotFoundError: + error( + f"no such build file '{path}' while trying to resolve '{value}'" + ) + assert ( + value in targets + ), f"build file at '{path}' doesn't contain '+{target}' when trying to resolve '{value}'" + + t = targets[value] + + t.materialise() + return t + + +class Targets: + def convert(value, target): + if not value: + return [] + assert _isiterable(value), "cannot convert non-list to Targets" + return [target.targetof(x) for x in flatten(value)] + + +class TargetsMap: + def convert(value, target): + if not value: + return {} + output = {k: target.targetof(v) for k, v in value.items()} + for k, v in output.items(): + assert ( + len(filenamesof([v])) == 1 + ), f"targets of a TargetsMap used as an argument of {target} with key '{k}' must contain precisely one output file, but was {filenamesof([v])}" + return output + + +def _removesuffix(self, suffix): + # suffix='' should not call self[:-0]. + if suffix and self.endswith(suffix): + return self[: -len(suffix)] + else: + return self[:] + + +def loadbuildfile(filename): + filename = _removesuffix(filename.replace("/", "."), ".py") + builtins.__import__(filename) + + +def flatten(items): + def generate(xs): + for x in xs: + if _isiterable(x): + yield from generate(x) + else: + yield x + + return list(generate(items)) + + +def targetnamesof(items): + assert _isiterable(items), "argument of filenamesof is not a collection" + + return [t.name for t in items] + + +def filenamesof(items): + assert _isiterable(items), "argument of filenamesof is not a collection" + + def generate(xs): + for x in xs: + if isinstance(x, Target): + yield from generate(x.outs) + else: + yield x + + return list(generate(items)) + + +def filenameof(x): + xs = filenamesof(x.outs) + assert ( + len(xs) == 1 + ), f"tried to use filenameof() on {x} which does not have exactly one output: {x.outs}" + return xs[0] + + +def emit(*args, into=None): + s = " ".join(args) + "\n" + if into is not None: + into += [s] + else: + outputFp.write(s) + + +def emit_rule(self, ins, outs, cmds=[], label=None): + name = self.name + fins = set(filenamesof(ins)) + fouts = filenamesof(outs) + nonobjs = [f for f in fouts if not f.startswith("$(OBJ)")] + + emit("") + + lines = [] + if nonobjs: + emit("clean::", into=lines) + emit("\t$(hide) rm -f", *nonobjs, into=lines) + + emit(".PHONY:", name, into=lines) + if outs: + emit(name, ":", *fouts, into=lines) + if len(fouts) == 1: + emit(*fouts, ":", *fins, "\x01", into=lines) + else: + emit("ifeq ($(MAKE4.3),yes)", into=lines) + emit(*fouts, "&:", *fins, "\x01", into=lines) + emit("else", into=lines) + emit(*(fouts[1:]), ":", fouts[0], into=lines) + emit(fouts[0], ":", *fins, "\x01", into=lines) + emit("endif", into=lines) + + if label: + emit("\t$(hide)", "$(ECHO) $(PROGRESSINFO)", label, into=lines) + + sandbox = join(self.dir, "sandbox") + emit("\t$(hide)", f"rm -rf {sandbox}", into=lines) + emit( + "\t$(hide)", + f"$(PYTHON) build/_sandbox.py --link -s {sandbox}", + *fins, + into=lines, + ) + for c in cmds: + emit(f"\t$(hide) cd {sandbox} && (", c, ")", into=lines) + emit( + "\t$(hide)", + f"$(PYTHON) build/_sandbox.py --export -s {sandbox}", + *fouts, + into=lines, + ) + else: + assert len(cmds) == 0, "rules with no outputs cannot have commands" + emit(name, ":", *fins, into=lines) + + cmd = "".join(lines) + hash = hashlib.sha1(bytes(cmd, "utf-8")).hexdigest() + + outputFp.write(cmd.replace("\x01", f"$(OBJ)/.hashes/{hash}")) + + if outs: + emit(f"$(OBJ)/.hashes/{hash}:") + emit( + f"\t$(hide) mkdir -p $(OBJ)/.hashes && touch $(OBJ)/.hashes/{hash}" + ) + emit("") + + +@Rule +def simplerule( + self, + name, + ins: Targets = [], + outs: Targets = [], + deps: Targets = [], + commands=[], + label="RULE", +): + self.ins = ins + self.outs = outs + self.deps = deps + + dirs = [] + cs = [] + for out in filenamesof(outs): + dir = dirname(out) + if dir and dir not in dirs: + dirs += [dir] + + cs = [("mkdir -p %s" % dir) for dir in dirs] + + for c in commands: + cs += [self.templateexpand(c)] + + emit_rule( + self=self, + ins=ins + deps, + outs=outs, + label=self.templateexpand("$[label] $[name]") if label else None, + cmds=cs, + ) + + +@Rule +def export(self, name=None, items: TargetsMap = {}, deps: Targets = []): + ins = [] + outs = [] + for dest, src in items.items(): + dest = self.targetof(dest) + outs += [dest] + + destf = filenameof(dest) + + srcs = filenamesof([src]) + assert ( + len(srcs) == 1 + ), "a dependency of an exported file must have exactly one output file" + + subrule = simplerule( + name=f"{self.localname}/{destf}", + cwd=self.cwd, + ins=[srcs[0]], + outs=[destf], + commands=["$(CP) -H %s %s" % (srcs[0], destf)], + label="", + ) + subrule.materialise() + + simplerule( + replaces=self, + ins=outs + deps, + outs=["=sentinel"], + commands=["touch $[outs[0]]"], + label="EXPORT", + ) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("-v", "--verbose", action="store_true") + parser.add_argument("-q", "--quiet", action="store_true") + parser.add_argument("-o", "--output") + parser.add_argument("files", nargs="+") + args = parser.parse_args() + + global verbose + verbose = args.verbose + + global quiet + quiet = args.quiet + + global outputFp + outputFp = open(args.output, "wt") + + for k in ["Rule"]: + defaultGlobals[k] = globals()[k] + + global __name__ + sys.modules["build.ab"] = sys.modules[__name__] + __name__ = "build.ab" + + for f in args.files: + loadbuildfile(f) + + while unmaterialisedTargets: + t = next(iter(unmaterialisedTargets)) + t.materialise() + emit("AB_LOADED = 1\n") + + +main() diff --git a/build/c.py b/build/c.py new file mode 100644 index 0000000000..e7ecf9ab36 --- /dev/null +++ b/build/c.py @@ -0,0 +1,521 @@ +from build.ab import ( + Rule, + Targets, + TargetsMap, + filenameof, + filenamesof, + flatten, + simplerule, + emit, +) +from build.utils import filenamesmatchingof, stripext, collectattrs +from build.toolchain import Toolchain, HostToolchain +from os.path import * + +emit( + """ +ifeq ($(OSX),no) +STARTGROUP ?= -Wl,--start-group +ENDGROUP ?= -Wl,--end-group +endif +""" +) + +Toolchain.CC = ["$(CC) -c -o $[outs[0]] $[ins[0]] $(CFLAGS) $[cflags]"] +Toolchain.CXX = ["$(CXX) -c -o $[outs[0]] $[ins[0]] $(CFLAGS) $[cflags]"] +Toolchain.AR = ["$(AR) cqs $[outs[0]] $[ins]"] +Toolchain.ARXX = ["$(AR) cqs $[outs[0]] $[ins]"] +Toolchain.CLINK = [ + "$(CC) -o $[outs[0]] $(STARTGROUP) $[ins] $[ldflags] $(LDFLAGS) $(ENDGROUP)" +] +Toolchain.CXXLINK = [ + "$(CXX) -o $[outs[0]] $(STARTGROUP) $[ins] $[ldflags] $(LDFLAGS) $(ENDGROUP)" +] + + +HostToolchain.CC = [ + "$(HOSTCC) -c -o $[outs[0]] $[ins[0]] $(HOSTCFLAGS) $[cflags]" +] +HostToolchain.CXX = [ + "$(HOSTCXX) -c -o $[outs[0]] $[ins[0]] $(HOSTCFLAGS) $[cflags]" +] +HostToolchain.AR = ["$(HOSTAR) cqs $[outs[0]] $[ins]"] +HostToolchain.ARXX = ["$(HOSTAR) cqs $[outs[0]] $[ins]"] +HostToolchain.CLINK = [ + "$(HOSTCC) -o $[outs[0]] $(STARTGROUP) $[ins] $[ldflags] $(HOSTLDFLAGS) $(ENDGROUP)" +] +HostToolchain.CXXLINK = [ + "$(HOSTCXX) -o $[outs[0]] $(STARTGROUP) $[ins] $[ldflags] $(HOSTLDFLAGS) $(ENDGROUP)" +] + + +def is_source_file(f): + return ( + f.endswith(".c") + or f.endswith(".cc") + or f.endswith(".cpp") + or f.endswith(".S") + or f.endswith(".s") + or f.endswith(".m") + or f.endswith(".mm") + ) + + +def _combine(list1, list2): + r = list(list1) + for i in list2: + if i not in r: + r.append(i) + return r + + +def _indirect(deps, name): + r = [] + for d in deps: + r = _combine(r, d.args.get(name, [d])) + return r + + +def cfileimpl(self, name, srcs, deps, suffix, commands, label, cflags): + outleaf = "=" + stripext(basename(filenameof(srcs[0]))) + suffix + + hdr_deps = _indirect(deps, "cheader_deps") + cflags = collectattrs( + targets=hdr_deps, name="caller_cflags", initial=cflags + ) + + t = simplerule( + replaces=self, + ins=srcs, + deps=sorted(_indirect(hdr_deps, "cheader_files")), + outs=[outleaf], + label=label, + commands=commands, + args={"cflags": cflags}, + ) + + +@Rule +def cfile( + self, + name, + srcs: Targets = None, + deps: Targets = None, + cflags=[], + suffix=".o", + toolchain=Toolchain, + label="CC", +): + cfileimpl( + self, + name, + srcs, + deps, + suffix, + toolchain.CC, + toolchain.PREFIX + label, + cflags, + ) + + +@Rule +def cxxfile( + self, + name, + srcs: Targets = None, + deps: Targets = None, + cflags=[], + suffix=".o", + toolchain=Toolchain, + label="CXX", +): + cfileimpl( + self, + name, + srcs, + deps, + suffix, + toolchain.CXX, + toolchain.PREFIX + label, + cflags, + ) + + +def _removeprefix(self, prefix): + if self.startswith(prefix): + return self[len(prefix) :] + else: + return self[:] + + +def findsources(name, srcs, deps, cflags, filerule, toolchain, cwd): + for f in filenamesof(srcs): + if not is_source_file(f): + cflags = cflags + [f"-I{dirname(f)}"] + deps = deps + [f] + + objs = [] + for s in flatten(srcs): + objs += [ + filerule( + name=join(name, _removeprefix(f, "$(OBJ)/")), + srcs=[f], + deps=deps, + cflags=sorted(set(cflags)), + toolchain=toolchain, + cwd=cwd, + ) + for f in filenamesof([s]) + if is_source_file(f) + ] + if any(f.endswith(".o") for f in filenamesof([s])): + objs += [s] + + return objs + + +def libraryimpl( + self, + name, + srcs, + deps, + hdrs, + caller_cflags, + caller_ldflags, + cflags, + ldflags, + toolchain, + commands, + label, + filerule, +): + hdr_deps = _combine(_indirect(deps, "cheader_deps"), [self]) + lib_deps = _combine(_indirect(deps, "clibrary_deps"), [self]) + + hr = None + hf = [] + ar = None + if hdrs: + cs = [] + ins = hdrs.values() + outs = [] + i = 0 + for dest, src in hdrs.items(): + s = filenamesof([src]) + assert ( + len(s) == 1 + ), "the target of a header must return exactly one file" + + cs += [f"$(CP) $[ins[{i}]] $[outs[{i}]]"] + outs += ["=" + dest] + i = i + 1 + + hr = simplerule( + name=f"{self.localname}_hdr", + ins=ins, + outs=outs, + commands=cs, + label=toolchain.PREFIX + "CHEADERS", + ) + hr.materialise() + hf = [f"-I{hr.dir}"] + + if srcs: + objs = findsources( + self.localname, + srcs, + deps + ([hr] if hr else []), + cflags + hf, + filerule, + toolchain, + self.cwd, + ) + + ar = simplerule( + name=f"{self.localname}_lib", + ins=objs, + outs=[f"={self.localname}.a"], + label=label, + commands=commands, + ) + ar.materialise() + + self.outs = ([hr] if hr else []) + ([ar] if ar else []) + self.deps = self.outs + self.args["cheader_deps"] = hdr_deps + self.args["clibrary_deps"] = lib_deps + self.args["cheader_files"] = [hr] if hr else [] + self.args["clibrary_files"] = [ar] if ar else [] + self.args["caller_cflags"] = caller_cflags + hf + self.args["caller_ldflags"] = caller_ldflags + + +@Rule +def clibrary( + self, + name, + srcs: Targets = None, + deps: Targets = None, + hdrs: TargetsMap = None, + caller_cflags=[], + caller_ldflags=[], + cflags=[], + ldflags=[], + toolchain=Toolchain, + label="LIB", + cfilerule=cfile, +): + libraryimpl( + self, + name, + srcs, + deps, + hdrs, + caller_cflags, + caller_ldflags, + cflags, + ldflags, + toolchain, + toolchain.AR, + toolchain.PREFIX + label, + cfilerule, + ) + + +@Rule +def hostclibrary( + self, + name, + srcs: Targets = None, + deps: Targets = None, + hdrs: TargetsMap = None, + caller_cflags=[], + caller_ldflags=[], + cflags=[], + ldflags=[], + toolchain=HostToolchain, + label="LIB", + cfilerule=cfile, +): + libraryimpl( + self, + name, + srcs, + deps, + hdrs, + caller_cflags, + caller_ldflags, + cflags, + ldflags, + toolchain, + toolchain.AR, + toolchain.PREFIX + label, + cfilerule, + ) + + +@Rule +def cxxlibrary( + self, + name, + srcs: Targets = None, + deps: Targets = None, + hdrs: TargetsMap = None, + caller_cflags=[], + caller_ldflags=[], + cflags=[], + ldflags=[], + toolchain=Toolchain, + label="CXXLIB", + cxxfilerule=cxxfile, +): + libraryimpl( + self, + name, + srcs, + deps, + hdrs, + caller_cflags, + caller_ldflags, + cflags, + ldflags, + toolchain, + toolchain.ARXX, + toolchain.PREFIX + label, + cxxfilerule, + ) + + +@Rule +def hostcxxlibrary( + self, + name, + srcs: Targets = None, + deps: Targets = None, + hdrs: TargetsMap = None, + caller_cflags=[], + caller_ldflags=[], + cflags=[], + ldflags=[], + toolchain=HostToolchain, + label="CXXLIB", + cxxfilerule=cxxfile, +): + libraryimpl( + self, + name, + srcs, + deps, + hdrs, + caller_cflags, + caller_ldflags, + cflags, + ldflags, + toolchain, + toolchain.ARXX, + toolchain.PREFIX + label, + cxxfilerule, + ) + + +def programimpl( + self, + name, + srcs, + deps, + cflags, + ldflags, + toolchain, + commands, + label, + filerule, +): + cfiles = findsources( + self.localname, srcs, deps, cflags, filerule, toolchain, self.cwd + ) + + lib_deps = [] + for d in deps: + lib_deps = _combine(lib_deps, d.args.get("clibrary_deps", {d})) + libs = filenamesmatchingof(lib_deps, "*.a") + ldflags = collectattrs( + targets=lib_deps, name="caller_ldflags", initial=ldflags + ) + + simplerule( + replaces=self, + ins=cfiles + libs, + outs=[f"={self.localname}$(EXT)"], + deps=_indirect(lib_deps, "clibrary_files"), + label=label, + commands=commands, + args={ + "ldflags": collectattrs( + targets=lib_deps, name="caller_ldflags", initial=ldflags + ) + }, + ) + + +@Rule +def cprogram( + self, + name, + srcs: Targets = None, + deps: Targets = None, + cflags=[], + ldflags=[], + toolchain=Toolchain, + label="CLINK", + cfilerule=cfile, +): + programimpl( + self, + name, + srcs, + deps, + cflags, + ldflags, + toolchain, + toolchain.CLINK, + toolchain.PREFIX + label, + cfilerule, + ) + + +@Rule +def hostcprogram( + self, + name, + srcs: Targets = None, + deps: Targets = None, + cflags=[], + ldflags=[], + toolchain=HostToolchain, + label="CLINK", + cfilerule=cfile, +): + programimpl( + self, + name, + srcs, + deps, + cflags, + ldflags, + toolchain, + toolchain.CLINK, + toolchain.PREFIX + label, + cfilerule, + ) + + +@Rule +def cxxprogram( + self, + name, + srcs: Targets = None, + deps: Targets = None, + cflags=[], + ldflags=[], + toolchain=Toolchain, + label="CXXLINK", + cxxfilerule=cxxfile, +): + programimpl( + self, + name, + srcs, + deps, + cflags, + ldflags, + toolchain, + toolchain.CXXLINK, + toolchain.PREFIX + label, + cxxfilerule, + ) + + +@Rule +def hostcxxprogram( + self, + name, + srcs: Targets = None, + deps: Targets = None, + cflags=[], + ldflags=[], + toolchain=HostToolchain, + label="CXXLINK", + cxxfilerule=cxxfile, +): + programimpl( + self, + name, + srcs, + deps, + cflags, + ldflags, + toolchain, + toolchain.CXXLINK, + toolchain.PREFIX + label, + cxxfilerule, + ) diff --git a/build/d.py b/build/d.py new file mode 100644 index 0000000000..3d3f43049e --- /dev/null +++ b/build/d.py @@ -0,0 +1,82 @@ +from build.ab import ( + Rule, + Targets, + TargetsMap, + filenameof, + filenamesof, + flatten, + simplerule, + emit, +) +from build.utils import filenamesmatchingof, stripext, collectattrs +from build.toolchain import Toolchain, HostToolchain +from os.path import * + +Toolchain.DMD = [ + "$(DMD) -of $[outs[0]] $[ins[0]] $(DFLAGS) $(DLINKFLAGS) $[dflags] $[dlinkflags]" +] +Toolchain.DMDLIB = [ + "$(DMD) -lib -of $[outs[0]] -Hd $[dir] $[ins] $(DFLAGS) $[dflags]" +] + +Toolchain.HOSTDMD = [ + "$(HOSTDMD) -of $[outs[0]] $[ins[0]] $(HOSTDFLAGS) $(HOSTDLINKFLAGS) $[dflags] $[dlinkflags]" +] +Toolchain.HOSTDMDLIB = [ + "$(HOSTDMD) -lib -of $[outs[0]] -Hf $[outs[1]] $[ins] $(HOSTDFLAGS) $[dflags]" +] + + +def _combine(list1, list2): + r = list(list1) + for i in list2: + if i not in r: + r.append(i) + return r + + +def _indirect(deps, name): + r = [] + for d in deps: + r = _combine(r, d.args.get(name, [d])) + return r + + +@Rule +def dlibrary( + self, + name, + srcs: Targets = None, + deps: Targets = None, + dflags=[], + toolchain=Toolchain, + label="DMDLIB", +): + simplerule( + replaces=self, + ins=srcs + deps, + outs=[f"={self.localname}.a", f"={self.localname}.di"], + commands=toolchain.DMDLIB, + label=label, + ) + + +@Rule +def dprogram( + self, + name, + srcs: Targets = None, + deps: Targets = None, + dflags=[], + dlinkflags=[], + toolchain=Toolchain, + label="DMD", +): + simplerule( + replaces=self, + ins=srcs + deps, + outs=[f"={self.localname}"], + deps=deps, + commands=toolchain.DMD, + label=label, + ) diff --git a/build/pkg.py b/build/pkg.py new file mode 100644 index 0000000000..c5d53a2122 --- /dev/null +++ b/build/pkg.py @@ -0,0 +1,84 @@ +from build.ab import Rule, Target +import os +import subprocess + + +class _PkgConfig: + package_present = set() + package_properties = {} + pkgconfig = None + + def __init__(self, cmd): + assert cmd, "no pkg-config environment variable supplied" + self.pkgconfig = cmd + + r = subprocess.run(f"{cmd} --list-all", shell=True, capture_output=True) + ps = r.stdout.decode("utf-8") + self.package_present = {l.split(" ", 1)[0] for l in ps.splitlines()} + + def has_package(self, name): + return name in self.package_present + + def get_property(self, name, flag): + p = f"{name}.{flag}" + if p not in self.package_properties: + r = subprocess.run( + f"{self.pkgconfig} {flag} {name}", + shell=True, + capture_output=True, + ) + self.package_properties[p] = r.stdout.decode("utf-8").strip() + return self.package_properties[p] + + +TargetPkgConfig = _PkgConfig(os.getenv("PKG_CONFIG")) +HostPkgConfig = _PkgConfig(os.getenv("HOST_PKG_CONFIG")) + + +def _package(self, name, package, fallback, pkgconfig): + if pkgconfig.has_package(package): + cflags = pkgconfig.get_property(package, "--cflags") + ldflags = pkgconfig.get_property(package, "--libs") + + if cflags: + self.args["caller_cflags"] = [cflags] + if ldflags: + self.args["caller_ldflags"] = [ldflags] + self.traits.add("clibrary") + self.traits.add("cheaders") + return + + assert ( + fallback + ), f"Required package '{package}' not installed when materialising target '$[name]'" + + if "cheader_deps" in fallback.args: + self.args["cheader_deps"] = fallback.args["cheader_deps"] + if "clibrary_deps" in fallback.args: + self.args["clibrary_deps"] = fallback.args["clibrary_deps"] + if "cheader_files" in fallback.args: + self.args["cheader_files"] = fallback.args["cheader_files"] + if "clibrary_files" in fallback.args: + self.args["clibrary_files"] = fallback.args["clibrary_files"] + self.ins = fallback.ins + self.outs = fallback.outs + self.deps = fallback.deps + self.traits = fallback.traits + + +@Rule +def package(self, name, package=None, fallback: Target = None): + _package(self, name, package, fallback, TargetPkgConfig) + + +@Rule +def hostpackage(self, name, package=None, fallback: Target = None): + _package(self, name, package, fallback, HostPkgConfig) + + +def has_package(name): + return TargetPkgConfig.has_package(name) + + +def has_host_package(name): + return HostPkgConfig.has_package(name) diff --git a/build/toolchain.py b/build/toolchain.py new file mode 100644 index 0000000000..b47d3e8a64 --- /dev/null +++ b/build/toolchain.py @@ -0,0 +1,6 @@ +class Toolchain: + PREFIX = "" + + +class HostToolchain(Toolchain): + PREFIX = "HOST" diff --git a/build/utils.py b/build/utils.py new file mode 100644 index 0000000000..53a85e0d1a --- /dev/null +++ b/build/utils.py @@ -0,0 +1,92 @@ +from build.ab import ( + Rule, + Target, + Targets, + filenameof, + filenamesof, + cwdStack, + error, + simplerule, +) +from os.path import relpath, splitext, join, basename, isfile +from glob import iglob +import fnmatch + + +def filenamesmatchingof(xs, pattern): + return fnmatch.filter(filenamesof(xs), pattern) + + +def stripext(path): + return splitext(path)[0] + + +def targetswithtraitsof(xs, trait): + return [t for t in xs if trait in t.traits] + + +def collectattrs(*, targets, name, initial=[]): + s = set(initial) + for a in [t.args.get(name, []) for t in targets]: + s.update(a) + return sorted(s) + + +def itemsof(pattern, root=None, cwd=None): + if not cwd: + cwd = cwdStack[-1] + if not root: + root = "." + + pattern = join(cwd, pattern) + root = join(cwd, root) + + result = {} + for f in iglob(pattern, recursive=True): + try: + if isfile(f): + result[relpath(f, root)] = f + except ValueError: + error(f"file '{f}' is not in root '{root}'") + return result + + +@Rule +def objectify(self, name, src: Target, symbol): + simplerule( + replaces=self, + ins=["build/_objectify.py", src], + outs=[f"={basename(filenameof(src))}.h"], + commands=["$(PYTHON) $[ins[0]] $[ins[1]] " + symbol + " > $[outs]"], + label="OBJECTIFY", + ) + + +@Rule +def test( + self, + name, + command: Target = None, + commands=None, + ins: Targets = None, + deps: Targets = None, + label="TEST", +): + if command: + simplerule( + replaces=self, + ins=[command], + outs=["=sentinel"], + commands=["$[ins[0]]", "touch $[outs[0]]"], + deps=deps, + label=label, + ) + else: + simplerule( + replaces=self, + ins=ins, + outs=["=sentinel"], + commands=commands + ["touch $[outs[0]]"], + deps=deps, + label=label, + ) diff --git a/build/yacc.py b/build/yacc.py new file mode 100644 index 0000000000..aad21c7989 --- /dev/null +++ b/build/yacc.py @@ -0,0 +1,35 @@ +from build.ab import simplerule, Rule, Target, Targets, emit + +emit( + """ +BISON ?= bison +FLEX ?= flex +""" +) + + +@Rule +def bison(self, name, src: Target, deps: Targets = [], stem=None): + if not stem: + stem = self.localname + simplerule( + replaces=self, + ins=[src], + outs=[f"={stem}.c", f"={stem}.h"], + deps=deps, + commands=[ + "$(BISON) --defines=$[outs[1]] --output=$[outs[0]] $[ins[0]]" + ], + label="BISON", + ) + + +@Rule +def flex(self, name, src: Target, deps: Targets = []): + simplerule( + replaces=self, + ins=[src], + outs=[f"={self.localname}.yy.c"], + commands=["$(FLEX) -s -t $[ins[0]] > $[outs[0]]"], + label="FLEX", + ) diff --git a/h/build.py b/h/build.py new file mode 100644 index 0000000000..7f252a6f71 --- /dev/null +++ b/h/build.py @@ -0,0 +1,33 @@ +from build.ab import simplerule +from build.c import clibrary + +simplerule( + name="local", + ins=[], + outs=["=local.h"], + commands=[ + "echo '#define VERSION 3' > $[outs]", + "echo '#define ACKM \"$(DEFAULT_PLATFORM)\"' >> $[outs]", + "echo '#define BIGMACHINE 1' >> $[outs]", + "echo '#define SYS_5' >> $[outs]", + ], +) + +clibrary( + name="h", + hdrs={ + k: f"./{k}" + for k in [ + "out.h", + "arch.h", + "ranlib.h", + "em_flag.h", + "em_ptyp.h", + "em_mes.h", + "cgg_cg.h", + "em_reg.h", + "stb.h", + ] + } + | {"local.h": ".+local"}, +) diff --git a/lang/cem/cemcom-ansi/build.py b/lang/cem/cemcom-ansi/build.py new file mode 100644 index 0000000000..7ccd28b155 --- /dev/null +++ b/lang/cem/cemcom-ansi/build.py @@ -0,0 +1,119 @@ +from build.ab import export, simplerule +from build.c import cprogram +from glob import glob +from util.LLgen.build import llgen +from util.cmisc.build import tabgen + +str_roots = [ + "code", + "declar", + "def", + "estack", + "expr", + "field", + "idf", + "l_brace", + "l_outdef", + "l_state", + "macro", + "next", + "proto", + "stack", + "stmt", + "struct", + "switch", + "type", + "util", +] + +simplerule( + name="parameters", + ins=["./BigPars"], + outs=["=parameters.h"], + commands=[ + "echo '#ifndef PARAMETERS_H' > $[outs]", + "echo '#define PARAMETERS_H' >> $[outs]", + "grep -v '^!' < $[ins] >> $[outs]", + "echo '#endif' >> $[outs]", + ], +) + +strtargets = [ + simplerule( + name=f"allocd_{str}", + ins=["./make.allocd", f"./{str}.str"], + outs=[f"={str}.h"], + commands=["$[ins[0]] < $[ins[1]] > $[outs]"], + ) + for str in str_roots +] + +simplerule( + name="next-c", + ins=[ + "./make.next", + ] + + [f"./{k}.str" for k in str_roots], + outs=["=next.c"], + commands=["$[ins] > $[outs]"], +) + +simplerule( + name="tokenfile-g", + ins=[ + "./make.tokfile", + "./tokenname.c", + ], + outs=["=tokenfile.g"], + commands=["sh $[ins[0]] < $[ins[1]] > $[outs]"], +) + +simplerule( + name="symbol2str-c", + ins=[ + "./make.tokcase", + "./tokenname.c", + ], + outs=["=symbol2str.c"], + commands=["sh $[ins[0]] < $[ins[1]] > $[outs]"], +) + +llgen( + name="llgen", + srcs=[ + ".+tokenfile-g", # must be first + "./declar.g", + "./expression.g", + "./ival.g", + "./program.g", + "./statement.g", + ], +) + +tabgen(name="tabgen", src="./char.tab") + +cprogram( + name="cemcom", + srcs=( + glob("lang/cem/cemcom-ansi/*.c") + + glob("lang/cem/cemcom-ansi/*.h") + + strtargets + + [".+parameters", ".+llgen", ".+next-c", ".+symbol2str-c", ".+tabgen"] + ), + deps=[ + "h", + "modules/h", + "modules/src/system", + "modules/src/alloc", + "modules/src/em_code+lib_k", + "modules/src/em_data", + "modules/src/em_mes", + "modules/src/flt_arith", + "modules/src/idf", + "modules/src/input", + "modules/src/string", + "modules/src/system", + ], +) + +export(name="all", items={"$(PLATDEP)/em_cemcom.ansi": ".+cemcom"}) diff --git a/lang/cem/cemcom.ansi/build.py b/lang/cem/cemcom.ansi/build.py new file mode 100644 index 0000000000..1feba8ecb4 --- /dev/null +++ b/lang/cem/cemcom.ansi/build.py @@ -0,0 +1 @@ +from build.c import cprogram diff --git a/modules/h/build.py b/modules/h/build.py new file mode 100644 index 0000000000..4ad9c569a5 --- /dev/null +++ b/modules/h/build.py @@ -0,0 +1,17 @@ +from build.c import clibrary + +clibrary( + name="h", + hdrs={ + k: f"./{k}" + for k in [ + "ansi.h", + "em_arith.h", + "em_label.h", + "em_label.h", + "em_mesX.h", + "em.h", + "emO_code.h", + ] + }, +) diff --git a/modules/src/alloc/build.py b/modules/src/alloc/build.py new file mode 100644 index 0000000000..174648b917 --- /dev/null +++ b/modules/src/alloc/build.py @@ -0,0 +1,14 @@ +from build.c import clibrary + +clibrary( + name="alloc", + srcs=[ + "./st_alloc.c", + "./std_alloc.c", + ], + hdrs={"alloc.h": "./alloc.h"}, + deps={ + "modules/h", + "modules/src/system", + }, +) diff --git a/modules/src/data/build.py b/modules/src/data/build.py new file mode 100644 index 0000000000..ac48b2db90 --- /dev/null +++ b/modules/src/data/build.py @@ -0,0 +1,26 @@ +from build.c import clibrary + +clibrary( + name="data", + srcs=[ + "./array.c", + "./astring.c", + "./warnings.c", + "./imap.c", + "./pmap.c", + "./smap.c", + "./stringlist.c", + ], + hdrs={ + k: f"./{k}" + for k in [ + "./array.h", + "./astring.h", + "./warnings.h", + "./imap.h", + "./pmap.h", + "./smap.h", + "./stringlist.h", + ] + }, +) diff --git a/modules/src/em_code/build.py b/modules/src/em_code/build.py new file mode 100644 index 0000000000..61f02fa749 --- /dev/null +++ b/modules/src/em_code/build.py @@ -0,0 +1,97 @@ +from build.ab import simplerule +from build.c import clibrary +from glob import glob + + +simplerule( + name="em_codeek_h", + ins=[ + "./make_codeek_h.lua", + "h/em_table_lib.lua", + "h/em_table", + "./em.nogen", + ], + outs=["=em_codeEK.h"], + commands=[ + "$(LUA) $[ins[0]] < $[ins[2]] > $[outs]", + "cat $[ins[3]] >> $[outs]", + ], +) + + +def build_variant(name, cflags): + clibrary( + name=name, + 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", + "./insert.h", + "./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", + "modules/src/read_em/em_comp.h", + ], + hdrs={ + "em_private.h": "./em_private.h", + "em_code.h": "./em_code.h", + "em_codeCE.h": "./em_codeCE.h", + "em_codeO.h": "./em_codeO.h", + "em_codeEK.h": ".+em_codeek_h", + }, + deps=[ + "h", + "modules/h", + "modules/src/em_data", + "modules/src/system", + "modules/src/alloc", + ], + ) + + +build_variant("lib_e", ["-DREADABLE_EM"]) +build_variant("lib_k", []) diff --git a/modules/src/em_data/build.py b/modules/src/em_data/build.py new file mode 100644 index 0000000000..56f155b8a3 --- /dev/null +++ b/modules/src/em_data/build.py @@ -0,0 +1,27 @@ +from build.ab import simplerule +from build.c import clibrary + +genfiles = ["flag.c", "mnem.c", "mnem.h", "pseu.c", "pseu.h", "spec.h"] + +generated = [] +for f in genfiles: + fu = f.replace(".", "_") + simplerule( + name=f"em_{fu}", + ins=[f"./make_{fu}.lua", "h/em_table_lib.lua", "h/em_table"], + outs=[f"={f}"], + deps=["h"], + commands=["$(LUA) $[ins[0]] < $[ins[2]] > $[outs]"], + label="GENFILE", + ) + +clibrary( + name="em_data", + srcs=["./em_ptyp.c", ".+em_flag_c", ".+em_mnem_c", ".+em_pseu_c"], + hdrs={ + "em_spec.h": ".+em_spec_h", + "em_mnem.h": ".+em_mnem_h", + "em_pseu.h": ".+em_pseu_h", + }, + deps=["h"], +) diff --git a/modules/src/em_mes/build.py b/modules/src/em_mes/build.py new file mode 100644 index 0000000000..a5a2e98ec5 --- /dev/null +++ b/modules/src/em_mes/build.py @@ -0,0 +1,9 @@ +from build.c import clibrary +from glob import glob + + +clibrary( + name="em_mes", + srcs=(glob("modules/src/em_mes/*.c")), + deps=["modules/h", "modules/src/em_code+lib_k"], +) diff --git a/modules/src/flt_arith/build.py b/modules/src/flt_arith/build.py new file mode 100644 index 0000000000..4e2bf29c82 --- /dev/null +++ b/modules/src/flt_arith/build.py @@ -0,0 +1,25 @@ +from build.c import clibrary + + +clibrary( + name="flt_arith", + srcs=[ + "./flt_ar2flt.c", + "./flt_div.c", + "./flt_flt2ar.c", + "./flt_modf.c", + "./flt_str2fl.c", + "./flt_cmp.c", + "./flt_add.c", + "./b64_add.c", + "./flt_mul.c", + "./flt_nrm.c", + "./b64_sft.c", + "./flt_umin.c", + "./flt_chk.c", + "./split.c", + "./flt_misc.h", + ], + hdrs={"flt_arith.h": "./flt_arith.h", "flt_misc.h": "./flt_misc.h"}, + deps=["h", "modules/h"], +) diff --git a/modules/src/idf/build.py b/modules/src/idf/build.py new file mode 100644 index 0000000000..b863c3b09f --- /dev/null +++ b/modules/src/idf/build.py @@ -0,0 +1,8 @@ +from build.c import clibrary +from glob import glob + + +clibrary( + name="idf", + hdrs={"idf_pkg.body": "./idf_pkg.body", "idf_pkg.spec": "./idf_pkg.spec"}, +) diff --git a/modules/src/input/build.py b/modules/src/input/build.py new file mode 100644 index 0000000000..ff4544248a --- /dev/null +++ b/modules/src/input/build.py @@ -0,0 +1,9 @@ +from build.c import clibrary +from glob import glob + + +clibrary( + name="input", + srcs=["./AtEoIF.c", "./AtEoIT.c"], + hdrs={"inp_pkg.body": "./inp_pkg.body", "inp_pkg.spec": "./inp_pkg.spec"}, +) diff --git a/modules/src/object/build.py b/modules/src/object/build.py new file mode 100644 index 0000000000..af9f0b170e --- /dev/null +++ b/modules/src/object/build.py @@ -0,0 +1,9 @@ +from build.c import clibrary +from glob import glob + +clibrary( + name="object", + srcs=glob("modules/src/object/*.c") + ["./obj.h"], + deps=["h"], + hdrs={"object.h": "./object.h"}, +) diff --git a/modules/src/string/build.py b/modules/src/string/build.py new file mode 100644 index 0000000000..dba7e40260 --- /dev/null +++ b/modules/src/string/build.py @@ -0,0 +1,7 @@ +from build.c import clibrary + +clibrary( + name="string", + srcs=["./bts2str.c", "./long2str.c"], + hdrs={"ack_string.h": "./ack_string.h"}, +) diff --git a/modules/src/system/build.py b/modules/src/system/build.py new file mode 100644 index 0000000000..ff94b5cd04 --- /dev/null +++ b/modules/src/system/build.py @@ -0,0 +1,9 @@ +from build.c import clibrary +from glob import glob + +clibrary( + name="system", + srcs=glob("modules/src/system/*.c"), + hdrs={"system.h": "./system.h"}, + deps=["modules/src/data", "modules/src/string"], +) diff --git a/util/LLgen/build.py b/util/LLgen/build.py new file mode 100644 index 0000000000..bf49dd94b6 --- /dev/null +++ b/util/LLgen/build.py @@ -0,0 +1,52 @@ +from build.ab import Rule, Targets, simplerule, filenamesof +from build.c import hostcprogram +from os.path import * + +hostcprogram( + name="LLgen", + # These use pre-LLgen'd versions of LLgen.c, Lpars.c, Lpars.h, and + # tokens.c. If LLgen.g or tokens.g gets updated, they need + # rebuilding. Use the bootstrap target to do this. + srcs=[ + "./src/LLgen.c", + "./src/Lpars.c", + "./src/alloc.c", + "./src/cclass.c", + "./src/check.c", + "./src/compute.c", + "./src/gencode.c", + "./src/global.c", + "./src/machdep.c", + "./src/main.c", + "./src/name.c", + "./src/reach.c", + "./src/savegram.c", + "./src/sets.c", + "./src/tokens.c", + "./src/utils.c", + "./src/cclass.h", + "./src/extern.h", + "./src/fileio.h", + "./src/Lpars.h", + "./src/sets.h", + "./src/types.h", + ], + cflags=['-DLIBDIR=\\"util/LLgen/lib\\"', "-DNON_CORRECTING"], +) + + +@Rule +def llgen(self, name, srcs: Targets = []): + fs = [splitext(basename(f))[0] for f in filenamesof(srcs)] + simplerule( + replaces=self, + ins=["util/LLgen"] + srcs, + outs=(["=Lpars.c", "=Lpars.h"] + [f"={f}.c" for f in fs]), + deps=["util/LLgen/lib/incl", "util/LLgen/lib/rec"], + commands=[ + f"$[ins[0]] {' '.join(filenamesof(srcs))}", + # llgen emits the files into the current directory (of the sandbox). + f"mv *.[ch] $[dir]", + ], + label="LLGEN", + ) diff --git a/util/amisc/build.py b/util/amisc/build.py new file mode 100644 index 0000000000..b8bcca2be9 --- /dev/null +++ b/util/amisc/build.py @@ -0,0 +1,25 @@ +from build.ab import export +from build.c import cprogram + +i = {} + + +def simpleprogram(name): + p = cprogram( + name=name, + srcs=[f"./{name}.c"], + deps=["h", "modules/src/object", "modules/src/system"], + ) + + i[f"$(INSDIR)/bin/{name}"] = p + i[f"$(INSDIR)/share/man/man1/{name}.1"] = f"./{name}.1" + + +simpleprogram("aelflod") +simpleprogram("anm") +simpleprogram("ashow") +simpleprogram("asize") +simpleprogram("aslod") +simpleprogram("astrip") + +export(name="all", items=i) diff --git a/util/arch/build.py b/util/arch/build.py new file mode 100644 index 0000000000..d213917534 --- /dev/null +++ b/util/arch/build.py @@ -0,0 +1,23 @@ +from build.ab import export +from build.c import cprogram + +cprogram( + name="aal", + srcs=["./archiver.c"], + deps=[ + "h", + "modules/src/data", + "modules/src/object", + "modules/src/string", + "modules/src/system", + ], + cflags=["-DAAL"], +) + +export( + name="all", + items={ + "$(INSDIR)/bin/aal": ".+aal", + "$(INSDIR)/share/man/man1/aal.1": "./aal.1", + }, +) diff --git a/util/cmisc/build.py b/util/cmisc/build.py new file mode 100644 index 0000000000..84885090d7 --- /dev/null +++ b/util/cmisc/build.py @@ -0,0 +1,15 @@ +from build.ab import Rule, Target, simplerule +from build.c import hostcprogram + +hostcprogram(name="tabgen", srcs=["./tabgen.c"]) + + +@Rule +def tabgen(self, name, src: Target): + simplerule( + replaces=self, + ins=["util/cmisc+tabgen", src], + outs=[f"={self.localname}.c"], + commands=["$[ins[0]] -f$[ins[1]] > $[outs]"], + label="TABGEN", + ) diff --git a/util/led/build.py b/util/led/build.py new file mode 100644 index 0000000000..7280864073 --- /dev/null +++ b/util/led/build.py @@ -0,0 +1,23 @@ +from build.ab import export +from build.c import cprogram +from glob import glob + +cprogram( + name="led", + srcs=glob("util/led/*.c") + glob("util/led/*.h"), + deps=[ + "h", + "modules/src/data", + "modules/src/object", + "modules/src/string", + "modules/src/system", + ], +) + +export( + name="all", + items={ + "$(INSDIR)/bin/led": ".+led", + "$(INSDIR)/share/man/man6/led.6": "./led.6", + }, +) diff --git a/util/ncgg/build.py b/util/ncgg/build.py new file mode 100644 index 0000000000..da136fd46f --- /dev/null +++ b/util/ncgg/build.py @@ -0,0 +1,28 @@ +from build.ab import simplerule +from build.c import cprogram +from build.yacc import bison, flex +from glob import glob + +bison(name="cggparser", src="./cgg.y") +flex(name="cgglexer", src="./scan.l") + +simplerule( + name="keywords", + ins=[ + "./make_enterkeyw_c.lua", + "./keywords", + ], + outs=["=enterkeyw.c"], + commands=["$(LUA) $[ins[0]] < $[ins[1]] > $[outs]"], +) + + +cprogram( + name="ncgg", + srcs=( + glob("util/ncgg/*.c") + + glob("util/ncgg/*.h") + + [".+cggparser", ".+cgglexer", ".+keywords"] + ), + deps=["h", "modules/src/em_data"], +) diff --git a/util/ncgg/cgg.y b/util/ncgg/cgg.y index c7c9982df1..7b15ac681d 100644 --- a/util/ncgg/cgg.y +++ b/util/ncgg/cgg.y @@ -7,6 +7,7 @@ static char rcsid[]= "$Id$"; #endif +#include #include "param.h" #include "varinfo.h" #include "lookup.h" diff --git a/util/ncgg/make_enterkeyw_c.lua b/util/ncgg/make_enterkeyw_c.lua index 3eb6bd15b0..e17af9fea3 100755 --- a/util/ncgg/make_enterkeyw_c.lua +++ b/util/ncgg/make_enterkeyw_c.lua @@ -6,7 +6,7 @@ print([[ #include "set.h" #include "expr.h" #include "iocc.h" -#include "y.tab.h" +#include "cggparser.h" void enterkeyw(void) { ]]) diff --git a/util/ncgg/scan.l b/util/ncgg/scan.l index f57bc9e97e..55c02045f6 100644 --- a/util/ncgg/scan.l +++ b/util/ncgg/scan.l @@ -18,7 +18,7 @@ static char rcsid2[]= "$Id$"; #include "subr.h" #include #include -#include "y.tab.h" +#include "cggparser.h" extern int emhere; From 0bbc304d1739966e7f3375c734abbb997f03a03e Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 02:01:59 +0100 Subject: [PATCH 03/79] Enough works to build a simple boot.s. --- build.py | 15 ++++++++--- build/ab.py | 21 ++++++++-------- build/ack.py | 16 ++++++++++++ build/c.py | 43 ++++++++++++++++++++++++++++++++ h/build.py | 13 +++++++++- mach/i86/ncg/build.py | 3 +++ mach/proto/as/build.lua | 2 +- mach/proto/as/build.py | 46 ++++++++++++++++++++++++++++++++++ mach/proto/as/comm3.c | 2 +- mach/proto/as/comm4.c | 2 +- mach/proto/as/comm5.c | 2 +- mach/proto/as/comm6.c | 2 +- mach/proto/as/comm7.c | 2 +- mach/proto/as/comm8.c | 2 +- mach/proto/ncg/build.py | 54 ++++++++++++++++++++++++++++++++++++++++ plat/pc86/build.py | 28 +++++++++++++++++++++ util/ack/build.py | 55 +++++++++++++++++++++++++++++++++++++++++ util/ncgg/build.py | 21 ++++++++++++++-- 18 files changed, 305 insertions(+), 24 deletions(-) create mode 100644 build/ack.py create mode 100644 mach/i86/ncg/build.py create mode 100644 mach/proto/as/build.py create mode 100644 mach/proto/ncg/build.py create mode 100644 plat/pc86/build.py create mode 100644 util/ack/build.py diff --git a/build.py b/build.py index 29ccea61ec..842566f2b7 100644 --- a/build.py +++ b/build.py @@ -1,13 +1,20 @@ from build.ab import export export( - name="all", + name="common", deps=[ + "util/ack+all", + "lang/cem/cemcom-ansi+all", "util/amisc+all", "util/arch+all", "util/led+all", - "util/ncgg", - "util/LLgen", - "lang/cem/cemcom-ansi+all", + ], +) + +export( + name="all", + deps=[ + "plat/pc86+all", + ".+common", ], ) diff --git a/build/ab.py b/build/ab.py index bc8fc21d64..06ffa660f7 100644 --- a/build/ab.py +++ b/build/ab.py @@ -557,6 +557,7 @@ def simplerule( def export(self, name=None, items: TargetsMap = {}, deps: Targets = []): ins = [] outs = [] + rules = [] for dest, src in items.items(): dest = self.targetof(dest) outs += [dest] @@ -568,7 +569,7 @@ def export(self, name=None, items: TargetsMap = {}, deps: Targets = []): len(srcs) == 1 ), "a dependency of an exported file must have exactly one output file" - subrule = simplerule( + rule = simplerule( name=f"{self.localname}/{destf}", cwd=self.cwd, ins=[srcs[0]], @@ -576,15 +577,15 @@ def export(self, name=None, items: TargetsMap = {}, deps: Targets = []): commands=["$(CP) -H %s %s" % (srcs[0], destf)], label="", ) - subrule.materialise() - - simplerule( - replaces=self, - ins=outs + deps, - outs=["=sentinel"], - commands=["touch $[outs[0]]"], - label="EXPORT", - ) + rule.materialise() + rules += [rule] + + self.ins = [] + self.outs = rules + deps + + emit("") + emit(".PHONY:", name) + emit(name, ":", *filenamesof(outs), *filenamesof(deps)) def main(): diff --git a/build/ack.py b/build/ack.py new file mode 100644 index 0000000000..e0ce42fcf6 --- /dev/null +++ b/build/ack.py @@ -0,0 +1,16 @@ +from build.toolchain import Toolchain +from build.c import cfile + + +class AckToolchain(Toolchain): + PREFIX = "ACK" + CC = ["$(INSDIR)/bin/ack $(ACKCFLAGS) -m$[plat] -c -o $[outs[0]] $[ins[0]]"] + + +def ackcfile(name, plat=None, **kwargs): + kwargs["deps"] = kwargs.get("deps", []) + [ + f"plat/{plat}+tools", + "util/ack+all", + ] + kwargs["args"] = kwargs.get("args", {}) | {"plat": plat} + cfile(name=name, toolchain=AckToolchain, **kwargs) diff --git a/build/c.py b/build/c.py index e7ecf9ab36..a8f89cd06d 100644 --- a/build/c.py +++ b/build/c.py @@ -22,6 +22,7 @@ ) Toolchain.CC = ["$(CC) -c -o $[outs[0]] $[ins[0]] $(CFLAGS) $[cflags]"] +Toolchain.CPP = ["$(CC) -E -P -o $[outs] $[cflags] -x c $[ins]"] Toolchain.CXX = ["$(CXX) -c -o $[outs[0]] $[ins[0]] $(CFLAGS) $[cflags]"] Toolchain.AR = ["$(AR) cqs $[outs[0]] $[ins]"] Toolchain.ARXX = ["$(AR) cqs $[outs[0]] $[ins]"] @@ -36,6 +37,7 @@ HostToolchain.CC = [ "$(HOSTCC) -c -o $[outs[0]] $[ins[0]] $(HOSTCFLAGS) $[cflags]" ] +HostToolchain.CPP = ["$(HOSTCC) -E -P -o $[outs] $[cflags] -x c $[ins]"] HostToolchain.CXX = [ "$(HOSTCXX) -c -o $[outs[0]] $[ins[0]] $(HOSTCFLAGS) $[cflags]" ] @@ -519,3 +521,44 @@ def hostcxxprogram( toolchain.PREFIX + label, cxxfilerule, ) + + +def _cppfileimpl(self, name, srcs, deps, cflags, toolchain): + hdr_deps = _indirect(deps, "cheader_deps") + cflags = collectattrs( + targets=hdr_deps, name="caller_cflags", initial=cflags + ) + + simplerule( + replaces=self, + ins=srcs, + outs=[f"={self.localname}"], + deps=deps, + commands=toolchain.CPP, + args={"cflags": cflags}, + label=toolchain.PREFIX + "CPPFILE", + ) + + +@Rule +def cppfile( + self, + name, + srcs: Targets = [], + deps: Targets = [], + cflags=[], + toolchain=Toolchain, +): + _cppfileimpl(self, name, srcs, deps, cflags, toolchain) + + +@Rule +def hostcppfile( + self, + name, + srcs: Targets = [], + deps: Targets = [], + cflags=[], + toolchain=HostToolchain, +): + _cppfileimpl(self, name, srcs, deps, cflags, toolchain) diff --git a/h/build.py b/h/build.py index 7f252a6f71..7c126fda4c 100644 --- a/h/build.py +++ b/h/build.py @@ -1,6 +1,16 @@ from build.ab import simplerule from build.c import clibrary +simplerule( + name="em_path", + ins=[], + outs=["=em_path.h"], + commands=[ + "echo '#define EM_DIR \"$(PREFIX)\"' > $[outs]", + "echo '#define ACK_PATH \"share/ack/descr\"' >> $[outs]", + ], +) + simplerule( name="local", ins=[], @@ -27,7 +37,8 @@ "cgg_cg.h", "em_reg.h", "stb.h", + "con_float", ] } - | {"local.h": ".+local"}, + | {"local.h": ".+local", "em_path.h": ".+em_path"}, ) diff --git a/mach/i86/ncg/build.py b/mach/i86/ncg/build.py new file mode 100644 index 0000000000..c69132d58c --- /dev/null +++ b/mach/i86/ncg/build.py @@ -0,0 +1,3 @@ +from build.c import clibrary + +clibrary(name="ncg", hdrs={"mach.h": "./mach.h", "mach.c": "./mach.c"}) diff --git a/mach/proto/as/build.lua b/mach/proto/as/build.lua index 9a2fa67a94..1b959e2d50 100644 --- a/mach/proto/as/build.lua +++ b/mach/proto/as/build.lua @@ -1,6 +1,6 @@ include("first/bison.lua") -definerule("build_as", + { arch = { type="string" }, deps = { type="targets", default={} }, diff --git a/mach/proto/as/build.py b/mach/proto/as/build.py new file mode 100644 index 0000000000..4995d15a63 --- /dev/null +++ b/mach/proto/as/build.py @@ -0,0 +1,46 @@ +from build.ab import Rule, Targets, simplerule +from build.utils import collectattrs +from build.c import cprogram, clibrary, cppfile +from build.yacc import bison + + +@Rule +def build_as(self, name, arch): + archlib = clibrary( + name=f"{self.localname}/arch", + hdrs={ + k: f"mach/{arch}/as/{k}" + for k in [ + "mach0.c", + "mach1.c", + "mach2.c", + "mach3.c", + "mach4.c", + "mach5.c", + ] + }, + ) + + preprocessedy = cppfile( + name=f"{self.localname}/bisoninput", + srcs=["mach/proto/as/comm2.y"], + deps=["mach/proto/as/comm0.h", "mach/proto/as/comm1.h", "h", archlib], + ) + + bisonfiles = bison(name=f"{self.localname}/bison", src=preprocessedy) + + cprogram( + replaces=self, + srcs=[ + "mach/proto/as/comm0.h", + "mach/proto/as/comm1.h", + "mach/proto/as/comm3.c", + "mach/proto/as/comm4.c", + "mach/proto/as/comm5.c", + "mach/proto/as/comm6.c", + "mach/proto/as/comm7.c", + "mach/proto/as/comm8.c", + bisonfiles, + ], + deps=["h", "modules/src/object", "modules/src/flt_arith", archlib], + ) diff --git a/mach/proto/as/comm3.c b/mach/proto/as/comm3.c index d53ac224e4..bbfcd88429 100644 --- a/mach/proto/as/comm3.c +++ b/mach/proto/as/comm3.c @@ -20,7 +20,7 @@ struct outhead outhead = { O_MAGIC, O_STAMP, 0 }; -#include "y.tab.h" +#include "bison.h" item_t keytab[] = { {0, EXTERN, 0, ".define"}, diff --git a/mach/proto/as/comm4.c b/mach/proto/as/comm4.c index a521fe85fd..2c1c517fe7 100644 --- a/mach/proto/as/comm4.c +++ b/mach/proto/as/comm4.c @@ -14,7 +14,7 @@ #include "comm0.h" #include "comm1.h" -#include "y.tab.h" +#include "bison.h" #include "object.h" #include diff --git a/mach/proto/as/comm5.c b/mach/proto/as/comm5.c index d1539f4afe..536870e061 100644 --- a/mach/proto/as/comm5.c +++ b/mach/proto/as/comm5.c @@ -7,7 +7,7 @@ #include "comm0.h" #include "comm1.h" -#include "y.tab.h" +#include "bison.h" extern YYSTYPE yylval; diff --git a/mach/proto/as/comm6.c b/mach/proto/as/comm6.c index 1d917fdb85..fc1d2f1bfb 100644 --- a/mach/proto/as/comm6.c +++ b/mach/proto/as/comm6.c @@ -10,7 +10,7 @@ #include "comm0.h" #include "comm1.h" -#include "y.tab.h" +#include "bison.h" #include "object.h" static void new_common(item_t *); diff --git a/mach/proto/as/comm7.c b/mach/proto/as/comm7.c index 8994a30d71..2e772ff033 100644 --- a/mach/proto/as/comm7.c +++ b/mach/proto/as/comm7.c @@ -11,7 +11,7 @@ #include #include "comm0.h" #include "comm1.h" -#include "y.tab.h" +#include "bison.h" #include #include "object.h" diff --git a/mach/proto/as/comm8.c b/mach/proto/as/comm8.c index 13a20eb8bf..7ec95b3eb6 100644 --- a/mach/proto/as/comm8.c +++ b/mach/proto/as/comm8.c @@ -7,7 +7,7 @@ #include "comm0.h" #include "comm1.h" -#include "y.tab.h" +#include "bison.h" /* ========== Machine dependent C routines ========== */ diff --git a/mach/proto/ncg/build.py b/mach/proto/ncg/build.py new file mode 100644 index 0000000000..a3a3ccec41 --- /dev/null +++ b/mach/proto/ncg/build.py @@ -0,0 +1,54 @@ +from build.ab import Rule, simplerule, Targets +from build.c import cprogram +from util.ncgg.build import ncgg + + +@Rule +def build_ncg(self, name, arch, deps: Targets = []): + tables = ncgg( + name=f"{self.localname}/tables", + srcs=[f"mach/{arch}/ncg/table"], + deps=deps, + ) + + cprogram( + replaces=self, + srcs=[ + "mach/proto/ncg/codegen.c", + "mach/proto/ncg/compute.c", + "mach/proto/ncg/data.h", + "mach/proto/ncg/equiv.c", + "mach/proto/ncg/equiv.h", + "mach/proto/ncg/extern.h", + "mach/proto/ncg/fillem.c", + "mach/proto/ncg/gencode.c", + "mach/proto/ncg/glosym.c", + "mach/proto/ncg/glosym.h", + "mach/proto/ncg/label.c", + "mach/proto/ncg/label.h", + "mach/proto/ncg/main.c", + "mach/proto/ncg/move.c", + "mach/proto/ncg/nextem.c", + "mach/proto/ncg/param.h", + "mach/proto/ncg/reg.c", + "mach/proto/ncg/regvar.c", + "mach/proto/ncg/regvar.h", + "mach/proto/ncg/result.h", + "mach/proto/ncg/salloc.c", + "mach/proto/ncg/state.c", + "mach/proto/ncg/state.h", + "mach/proto/ncg/subr.c", + "mach/proto/ncg/types.h", + "mach/proto/ncg/var.c", + "mach/proto/ncg/xmach.h", + tables, + ], + deps=[ + "h", + "modules/h", + "modules/src/flt_arith", + "modules/src/object", + "modules/src/em_data", + f"mach/{arch}/ncg", + ], + ) diff --git a/plat/pc86/build.py b/plat/pc86/build.py new file mode 100644 index 0000000000..33eb7489fe --- /dev/null +++ b/plat/pc86/build.py @@ -0,0 +1,28 @@ +from build.ab import export +from build.ack import ackcfile +from mach.proto.ncg.build import build_ncg +import importlib + +asm = importlib.import_module("mach.proto.as.build") + +asm.build_as(name="as", arch="i86") +build_ncg(name="ncg", arch="i86") + +ackcfile(name="boot", srcs=["./boot.s"], plat="pc86") + +export( + name="tools", + items={ + "$(PLATDEP)/pc86/as": ".+as", + "$(PLATDEP)/pc86/ncg": ".+ncg", + "$(PLATIND)/descr/pc86": "./descr", + }, +) + +export( + name="all", + items={ + "$(PLATIND)/pc86/boot.o": ".+boot", + }, + deps=[".+tools", "util/ack+all"], +) diff --git a/util/ack/build.py b/util/ack/build.py new file mode 100644 index 0000000000..260dfecf97 --- /dev/null +++ b/util/ack/build.py @@ -0,0 +1,55 @@ +from build.ab import export, simplerule +from build.c import cprogram, hostcprogram + +hostcprogram( + name="mktables", + srcs=["./mktables.c"], +) + +simplerule( + name="tables", + ins=[ + ".+mktables", + "lib/descr/fe", + ], + outs=["=dmach.c", "=intable.c"], + commands=["$[ins[0]] lib", "mv dmach.c intable.c $[dir]"], +) + +cprogram( + name="ack", + srcs=[ + "./data.c", + "./files.c", + "./grows.c", + "./list.c", + "./main.c", + "./rmach.c", + "./run.c", + "./scan.c", + "./svars.c", + "./trans.c", + "./util.c", + "./ack.h", + "./data.h", + "./dmach.h", + "./grows.h", + "./list.h", + "./trans.h", + ".+tables", + ], + deps=[ + "h", + "modules/src/data", + "modules/src/system", + ], +) + +export( + name="all", + items={ + "$(INSDIR)/bin/ack": ".+ack", + "$(INSDIR)/share/man/man1/ack.1": "./ack.1.X", + "$(PLATIND)/descr/fe": "lib/descr/fe", + }, +) diff --git a/util/ncgg/build.py b/util/ncgg/build.py index da136fd46f..41853b475d 100644 --- a/util/ncgg/build.py +++ b/util/ncgg/build.py @@ -1,5 +1,5 @@ -from build.ab import simplerule -from build.c import cprogram +from build.ab import simplerule, Targets, Rule +from build.c import cprogram, cppfile from build.yacc import bison, flex from glob import glob @@ -26,3 +26,20 @@ ), deps=["h", "modules/src/em_data"], ) + + +@Rule +def ncgg(self, name, srcs: Targets = [], deps: Targets = []): + cpptable = cppfile(name=f"{self.localname}/cpptable", srcs=srcs, deps=deps) + + simplerule( + replaces=self, + ins=["util/ncgg", cpptable], + outs=["=tables.c", "=tables.h"], + commands=[ + "$[ins]", + "mv tables.H $[dir]/tables.h", + "mv tables.c $[dir]/tables.c", + ], + label="NCGG", + ) From d86dbad0a77015992c1638052399dbc7415c70ec Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 16:08:01 +0100 Subject: [PATCH 04/79] Put the compiler name back to cemcom.ansi now that ab support for dotted paths is done. --- lang/cem/{ => cemcom.ansi}/cemcom-ansi/BigPars | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/LLlex.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/LLlex.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/LLmessage.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/SmallPars | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/align.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/arith.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/arith.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/atw.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/blocks.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/blocks.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/build.lua | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/build.py | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/cemcom.ansi.1 | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/ch3.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/ch3.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/ch3bin.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/ch3bin.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/ch3mon.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/ch3mon.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/char.tab | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/class.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/code.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/code.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/conversion.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/conversion.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/cstoper.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/cstoper.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/dataflow.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/dataflow.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/declar.g | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/declar.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/declarator.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/declarator.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/decspecs.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/decspecs.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/def.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/domacro.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/domacro.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/dumpidf.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/error.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/error.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/estack.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/eval.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/eval.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/expr.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/expr.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/expression.g | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/field.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/field.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/file_info.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/fltcstoper.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/fltcstoper.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/idf.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/idf.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/input.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/input.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/interface.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/ival.g | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_brace.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_class.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_comment.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_comment.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_em.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_ev_ord.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_lint.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_lint.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_misc.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_outdef.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_outdef.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_state.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_states.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/label.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/label.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/level.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/macro.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/main.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/make.allocd | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/make.hfiles | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/make.next | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/make.tokcase | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/make.tokfile | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/mes.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/next.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/options | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/options.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/options.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/pragma.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/pragma.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/program.g | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/proto.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/proto.main | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/proto.make | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/proto.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/sizes.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/skip.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/skip.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/specials.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/stab.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/stab.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/stack.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/stack.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/statement.g | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/stb.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/stmt.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/struct.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/struct.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/switch.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/switch.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/tokcase.sed | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/tokcasee.in | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/tokcaseh.in | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/tokenname.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/tokenname.h | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/type.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/type.str | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/util.c | 0 lang/cem/{ => cemcom.ansi}/cemcom-ansi/util.str | 0 118 files changed, 0 insertions(+), 0 deletions(-) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/BigPars (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/LLlex.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/LLlex.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/LLmessage.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/SmallPars (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/align.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/arith.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/arith.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/atw.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/blocks.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/blocks.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/build.lua (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/build.py (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/cemcom.ansi.1 (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/ch3.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/ch3.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/ch3bin.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/ch3bin.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/ch3mon.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/ch3mon.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/char.tab (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/class.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/code.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/code.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/conversion.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/conversion.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/cstoper.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/cstoper.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/dataflow.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/dataflow.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/declar.g (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/declar.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/declarator.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/declarator.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/decspecs.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/decspecs.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/def.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/domacro.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/domacro.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/dumpidf.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/error.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/error.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/estack.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/eval.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/eval.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/expr.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/expr.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/expression.g (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/field.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/field.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/file_info.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/fltcstoper.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/fltcstoper.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/idf.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/idf.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/input.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/input.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/interface.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/ival.g (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_brace.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_class.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_comment.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_comment.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_em.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_ev_ord.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_lint.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_lint.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_misc.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_outdef.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_outdef.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_state.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/l_states.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/label.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/label.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/level.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/macro.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/main.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/make.allocd (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/make.hfiles (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/make.next (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/make.tokcase (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/make.tokfile (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/mes.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/next.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/options (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/options.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/options.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/pragma.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/pragma.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/program.g (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/proto.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/proto.main (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/proto.make (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/proto.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/sizes.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/skip.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/skip.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/specials.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/stab.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/stab.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/stack.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/stack.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/statement.g (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/stb.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/stmt.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/struct.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/struct.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/switch.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/switch.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/tokcase.sed (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/tokcasee.in (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/tokcaseh.in (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/tokenname.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/tokenname.h (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/type.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/type.str (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/util.c (100%) rename lang/cem/{ => cemcom.ansi}/cemcom-ansi/util.str (100%) diff --git a/lang/cem/cemcom-ansi/BigPars b/lang/cem/cemcom.ansi/cemcom-ansi/BigPars similarity index 100% rename from lang/cem/cemcom-ansi/BigPars rename to lang/cem/cemcom.ansi/cemcom-ansi/BigPars diff --git a/lang/cem/cemcom-ansi/LLlex.c b/lang/cem/cemcom.ansi/cemcom-ansi/LLlex.c similarity index 100% rename from lang/cem/cemcom-ansi/LLlex.c rename to lang/cem/cemcom.ansi/cemcom-ansi/LLlex.c diff --git a/lang/cem/cemcom-ansi/LLlex.h b/lang/cem/cemcom.ansi/cemcom-ansi/LLlex.h similarity index 100% rename from lang/cem/cemcom-ansi/LLlex.h rename to lang/cem/cemcom.ansi/cemcom-ansi/LLlex.h diff --git a/lang/cem/cemcom-ansi/LLmessage.c b/lang/cem/cemcom.ansi/cemcom-ansi/LLmessage.c similarity index 100% rename from lang/cem/cemcom-ansi/LLmessage.c rename to lang/cem/cemcom.ansi/cemcom-ansi/LLmessage.c diff --git a/lang/cem/cemcom-ansi/SmallPars b/lang/cem/cemcom.ansi/cemcom-ansi/SmallPars similarity index 100% rename from lang/cem/cemcom-ansi/SmallPars rename to lang/cem/cemcom.ansi/cemcom-ansi/SmallPars diff --git a/lang/cem/cemcom-ansi/align.h b/lang/cem/cemcom.ansi/cemcom-ansi/align.h similarity index 100% rename from lang/cem/cemcom-ansi/align.h rename to lang/cem/cemcom.ansi/cemcom-ansi/align.h diff --git a/lang/cem/cemcom-ansi/arith.c b/lang/cem/cemcom.ansi/cemcom-ansi/arith.c similarity index 100% rename from lang/cem/cemcom-ansi/arith.c rename to lang/cem/cemcom.ansi/cemcom-ansi/arith.c diff --git a/lang/cem/cemcom-ansi/arith.h b/lang/cem/cemcom.ansi/cemcom-ansi/arith.h similarity index 100% rename from lang/cem/cemcom-ansi/arith.h rename to lang/cem/cemcom.ansi/cemcom-ansi/arith.h diff --git a/lang/cem/cemcom-ansi/atw.h b/lang/cem/cemcom.ansi/cemcom-ansi/atw.h similarity index 100% rename from lang/cem/cemcom-ansi/atw.h rename to lang/cem/cemcom.ansi/cemcom-ansi/atw.h diff --git a/lang/cem/cemcom-ansi/blocks.c b/lang/cem/cemcom.ansi/cemcom-ansi/blocks.c similarity index 100% rename from lang/cem/cemcom-ansi/blocks.c rename to lang/cem/cemcom.ansi/cemcom-ansi/blocks.c diff --git a/lang/cem/cemcom-ansi/blocks.h b/lang/cem/cemcom.ansi/cemcom-ansi/blocks.h similarity index 100% rename from lang/cem/cemcom-ansi/blocks.h rename to lang/cem/cemcom.ansi/cemcom-ansi/blocks.h diff --git a/lang/cem/cemcom-ansi/build.lua b/lang/cem/cemcom.ansi/cemcom-ansi/build.lua similarity index 100% rename from lang/cem/cemcom-ansi/build.lua rename to lang/cem/cemcom.ansi/cemcom-ansi/build.lua diff --git a/lang/cem/cemcom-ansi/build.py b/lang/cem/cemcom.ansi/cemcom-ansi/build.py similarity index 100% rename from lang/cem/cemcom-ansi/build.py rename to lang/cem/cemcom.ansi/cemcom-ansi/build.py diff --git a/lang/cem/cemcom-ansi/cemcom.ansi.1 b/lang/cem/cemcom.ansi/cemcom-ansi/cemcom.ansi.1 similarity index 100% rename from lang/cem/cemcom-ansi/cemcom.ansi.1 rename to lang/cem/cemcom.ansi/cemcom-ansi/cemcom.ansi.1 diff --git a/lang/cem/cemcom-ansi/ch3.c b/lang/cem/cemcom.ansi/cemcom-ansi/ch3.c similarity index 100% rename from lang/cem/cemcom-ansi/ch3.c rename to lang/cem/cemcom.ansi/cemcom-ansi/ch3.c diff --git a/lang/cem/cemcom-ansi/ch3.h b/lang/cem/cemcom.ansi/cemcom-ansi/ch3.h similarity index 100% rename from lang/cem/cemcom-ansi/ch3.h rename to lang/cem/cemcom.ansi/cemcom-ansi/ch3.h diff --git a/lang/cem/cemcom-ansi/ch3bin.c b/lang/cem/cemcom.ansi/cemcom-ansi/ch3bin.c similarity index 100% rename from lang/cem/cemcom-ansi/ch3bin.c rename to lang/cem/cemcom.ansi/cemcom-ansi/ch3bin.c diff --git a/lang/cem/cemcom-ansi/ch3bin.h b/lang/cem/cemcom.ansi/cemcom-ansi/ch3bin.h similarity index 100% rename from lang/cem/cemcom-ansi/ch3bin.h rename to lang/cem/cemcom.ansi/cemcom-ansi/ch3bin.h diff --git a/lang/cem/cemcom-ansi/ch3mon.c b/lang/cem/cemcom.ansi/cemcom-ansi/ch3mon.c similarity index 100% rename from lang/cem/cemcom-ansi/ch3mon.c rename to lang/cem/cemcom.ansi/cemcom-ansi/ch3mon.c diff --git a/lang/cem/cemcom-ansi/ch3mon.h b/lang/cem/cemcom.ansi/cemcom-ansi/ch3mon.h similarity index 100% rename from lang/cem/cemcom-ansi/ch3mon.h rename to lang/cem/cemcom.ansi/cemcom-ansi/ch3mon.h diff --git a/lang/cem/cemcom-ansi/char.tab b/lang/cem/cemcom.ansi/cemcom-ansi/char.tab similarity index 100% rename from lang/cem/cemcom-ansi/char.tab rename to lang/cem/cemcom.ansi/cemcom-ansi/char.tab diff --git a/lang/cem/cemcom-ansi/class.h b/lang/cem/cemcom.ansi/cemcom-ansi/class.h similarity index 100% rename from lang/cem/cemcom-ansi/class.h rename to lang/cem/cemcom.ansi/cemcom-ansi/class.h diff --git a/lang/cem/cemcom-ansi/code.c b/lang/cem/cemcom.ansi/cemcom-ansi/code.c similarity index 100% rename from lang/cem/cemcom-ansi/code.c rename to lang/cem/cemcom.ansi/cemcom-ansi/code.c diff --git a/lang/cem/cemcom-ansi/code.str b/lang/cem/cemcom.ansi/cemcom-ansi/code.str similarity index 100% rename from lang/cem/cemcom-ansi/code.str rename to lang/cem/cemcom.ansi/cemcom-ansi/code.str diff --git a/lang/cem/cemcom-ansi/conversion.c b/lang/cem/cemcom.ansi/cemcom-ansi/conversion.c similarity index 100% rename from lang/cem/cemcom-ansi/conversion.c rename to lang/cem/cemcom.ansi/cemcom-ansi/conversion.c diff --git a/lang/cem/cemcom-ansi/conversion.h b/lang/cem/cemcom.ansi/cemcom-ansi/conversion.h similarity index 100% rename from lang/cem/cemcom-ansi/conversion.h rename to lang/cem/cemcom.ansi/cemcom-ansi/conversion.h diff --git a/lang/cem/cemcom-ansi/cstoper.c b/lang/cem/cemcom.ansi/cemcom-ansi/cstoper.c similarity index 100% rename from lang/cem/cemcom-ansi/cstoper.c rename to lang/cem/cemcom.ansi/cemcom-ansi/cstoper.c diff --git a/lang/cem/cemcom-ansi/cstoper.h b/lang/cem/cemcom.ansi/cemcom-ansi/cstoper.h similarity index 100% rename from lang/cem/cemcom-ansi/cstoper.h rename to lang/cem/cemcom.ansi/cemcom-ansi/cstoper.h diff --git a/lang/cem/cemcom-ansi/dataflow.c b/lang/cem/cemcom.ansi/cemcom-ansi/dataflow.c similarity index 100% rename from lang/cem/cemcom-ansi/dataflow.c rename to lang/cem/cemcom.ansi/cemcom-ansi/dataflow.c diff --git a/lang/cem/cemcom-ansi/dataflow.h b/lang/cem/cemcom.ansi/cemcom-ansi/dataflow.h similarity index 100% rename from lang/cem/cemcom-ansi/dataflow.h rename to lang/cem/cemcom.ansi/cemcom-ansi/dataflow.h diff --git a/lang/cem/cemcom-ansi/declar.g b/lang/cem/cemcom.ansi/cemcom-ansi/declar.g similarity index 100% rename from lang/cem/cemcom-ansi/declar.g rename to lang/cem/cemcom.ansi/cemcom-ansi/declar.g diff --git a/lang/cem/cemcom-ansi/declar.str b/lang/cem/cemcom.ansi/cemcom-ansi/declar.str similarity index 100% rename from lang/cem/cemcom-ansi/declar.str rename to lang/cem/cemcom.ansi/cemcom-ansi/declar.str diff --git a/lang/cem/cemcom-ansi/declarator.c b/lang/cem/cemcom.ansi/cemcom-ansi/declarator.c similarity index 100% rename from lang/cem/cemcom-ansi/declarator.c rename to lang/cem/cemcom.ansi/cemcom-ansi/declarator.c diff --git a/lang/cem/cemcom-ansi/declarator.h b/lang/cem/cemcom.ansi/cemcom-ansi/declarator.h similarity index 100% rename from lang/cem/cemcom-ansi/declarator.h rename to lang/cem/cemcom.ansi/cemcom-ansi/declarator.h diff --git a/lang/cem/cemcom-ansi/decspecs.c b/lang/cem/cemcom.ansi/cemcom-ansi/decspecs.c similarity index 100% rename from lang/cem/cemcom-ansi/decspecs.c rename to lang/cem/cemcom.ansi/cemcom-ansi/decspecs.c diff --git a/lang/cem/cemcom-ansi/decspecs.h b/lang/cem/cemcom.ansi/cemcom-ansi/decspecs.h similarity index 100% rename from lang/cem/cemcom-ansi/decspecs.h rename to lang/cem/cemcom.ansi/cemcom-ansi/decspecs.h diff --git a/lang/cem/cemcom-ansi/def.str b/lang/cem/cemcom.ansi/cemcom-ansi/def.str similarity index 100% rename from lang/cem/cemcom-ansi/def.str rename to lang/cem/cemcom.ansi/cemcom-ansi/def.str diff --git a/lang/cem/cemcom-ansi/domacro.c b/lang/cem/cemcom.ansi/cemcom-ansi/domacro.c similarity index 100% rename from lang/cem/cemcom-ansi/domacro.c rename to lang/cem/cemcom.ansi/cemcom-ansi/domacro.c diff --git a/lang/cem/cemcom-ansi/domacro.h b/lang/cem/cemcom.ansi/cemcom-ansi/domacro.h similarity index 100% rename from lang/cem/cemcom-ansi/domacro.h rename to lang/cem/cemcom.ansi/cemcom-ansi/domacro.h diff --git a/lang/cem/cemcom-ansi/dumpidf.c b/lang/cem/cemcom.ansi/cemcom-ansi/dumpidf.c similarity index 100% rename from lang/cem/cemcom-ansi/dumpidf.c rename to lang/cem/cemcom.ansi/cemcom-ansi/dumpidf.c diff --git a/lang/cem/cemcom-ansi/error.c b/lang/cem/cemcom.ansi/cemcom-ansi/error.c similarity index 100% rename from lang/cem/cemcom-ansi/error.c rename to lang/cem/cemcom.ansi/cemcom-ansi/error.c diff --git a/lang/cem/cemcom-ansi/error.h b/lang/cem/cemcom.ansi/cemcom-ansi/error.h similarity index 100% rename from lang/cem/cemcom-ansi/error.h rename to lang/cem/cemcom.ansi/cemcom-ansi/error.h diff --git a/lang/cem/cemcom-ansi/estack.str b/lang/cem/cemcom.ansi/cemcom-ansi/estack.str similarity index 100% rename from lang/cem/cemcom-ansi/estack.str rename to lang/cem/cemcom.ansi/cemcom-ansi/estack.str diff --git a/lang/cem/cemcom-ansi/eval.c b/lang/cem/cemcom.ansi/cemcom-ansi/eval.c similarity index 100% rename from lang/cem/cemcom-ansi/eval.c rename to lang/cem/cemcom.ansi/cemcom-ansi/eval.c diff --git a/lang/cem/cemcom-ansi/eval.h b/lang/cem/cemcom.ansi/cemcom-ansi/eval.h similarity index 100% rename from lang/cem/cemcom-ansi/eval.h rename to lang/cem/cemcom.ansi/cemcom-ansi/eval.h diff --git a/lang/cem/cemcom-ansi/expr.c b/lang/cem/cemcom.ansi/cemcom-ansi/expr.c similarity index 100% rename from lang/cem/cemcom-ansi/expr.c rename to lang/cem/cemcom.ansi/cemcom-ansi/expr.c diff --git a/lang/cem/cemcom-ansi/expr.str b/lang/cem/cemcom.ansi/cemcom-ansi/expr.str similarity index 100% rename from lang/cem/cemcom-ansi/expr.str rename to lang/cem/cemcom.ansi/cemcom-ansi/expr.str diff --git a/lang/cem/cemcom-ansi/expression.g b/lang/cem/cemcom.ansi/cemcom-ansi/expression.g similarity index 100% rename from lang/cem/cemcom-ansi/expression.g rename to lang/cem/cemcom.ansi/cemcom-ansi/expression.g diff --git a/lang/cem/cemcom-ansi/field.c b/lang/cem/cemcom.ansi/cemcom-ansi/field.c similarity index 100% rename from lang/cem/cemcom-ansi/field.c rename to lang/cem/cemcom.ansi/cemcom-ansi/field.c diff --git a/lang/cem/cemcom-ansi/field.str b/lang/cem/cemcom.ansi/cemcom-ansi/field.str similarity index 100% rename from lang/cem/cemcom-ansi/field.str rename to lang/cem/cemcom.ansi/cemcom-ansi/field.str diff --git a/lang/cem/cemcom-ansi/file_info.h b/lang/cem/cemcom.ansi/cemcom-ansi/file_info.h similarity index 100% rename from lang/cem/cemcom-ansi/file_info.h rename to lang/cem/cemcom.ansi/cemcom-ansi/file_info.h diff --git a/lang/cem/cemcom-ansi/fltcstoper.c b/lang/cem/cemcom.ansi/cemcom-ansi/fltcstoper.c similarity index 100% rename from lang/cem/cemcom-ansi/fltcstoper.c rename to lang/cem/cemcom.ansi/cemcom-ansi/fltcstoper.c diff --git a/lang/cem/cemcom-ansi/fltcstoper.h b/lang/cem/cemcom.ansi/cemcom-ansi/fltcstoper.h similarity index 100% rename from lang/cem/cemcom-ansi/fltcstoper.h rename to lang/cem/cemcom.ansi/cemcom-ansi/fltcstoper.h diff --git a/lang/cem/cemcom-ansi/idf.c b/lang/cem/cemcom.ansi/cemcom-ansi/idf.c similarity index 100% rename from lang/cem/cemcom-ansi/idf.c rename to lang/cem/cemcom.ansi/cemcom-ansi/idf.c diff --git a/lang/cem/cemcom-ansi/idf.str b/lang/cem/cemcom.ansi/cemcom-ansi/idf.str similarity index 100% rename from lang/cem/cemcom-ansi/idf.str rename to lang/cem/cemcom.ansi/cemcom-ansi/idf.str diff --git a/lang/cem/cemcom-ansi/input.c b/lang/cem/cemcom.ansi/cemcom-ansi/input.c similarity index 100% rename from lang/cem/cemcom-ansi/input.c rename to lang/cem/cemcom.ansi/cemcom-ansi/input.c diff --git a/lang/cem/cemcom-ansi/input.h b/lang/cem/cemcom.ansi/cemcom-ansi/input.h similarity index 100% rename from lang/cem/cemcom-ansi/input.h rename to lang/cem/cemcom.ansi/cemcom-ansi/input.h diff --git a/lang/cem/cemcom-ansi/interface.h b/lang/cem/cemcom.ansi/cemcom-ansi/interface.h similarity index 100% rename from lang/cem/cemcom-ansi/interface.h rename to lang/cem/cemcom.ansi/cemcom-ansi/interface.h diff --git a/lang/cem/cemcom-ansi/ival.g b/lang/cem/cemcom.ansi/cemcom-ansi/ival.g similarity index 100% rename from lang/cem/cemcom-ansi/ival.g rename to lang/cem/cemcom.ansi/cemcom-ansi/ival.g diff --git a/lang/cem/cemcom-ansi/l_brace.str b/lang/cem/cemcom.ansi/cemcom-ansi/l_brace.str similarity index 100% rename from lang/cem/cemcom-ansi/l_brace.str rename to lang/cem/cemcom.ansi/cemcom-ansi/l_brace.str diff --git a/lang/cem/cemcom-ansi/l_class.h b/lang/cem/cemcom.ansi/cemcom-ansi/l_class.h similarity index 100% rename from lang/cem/cemcom-ansi/l_class.h rename to lang/cem/cemcom.ansi/cemcom-ansi/l_class.h diff --git a/lang/cem/cemcom-ansi/l_comment.c b/lang/cem/cemcom.ansi/cemcom-ansi/l_comment.c similarity index 100% rename from lang/cem/cemcom-ansi/l_comment.c rename to lang/cem/cemcom.ansi/cemcom-ansi/l_comment.c diff --git a/lang/cem/cemcom-ansi/l_comment.h b/lang/cem/cemcom.ansi/cemcom-ansi/l_comment.h similarity index 100% rename from lang/cem/cemcom-ansi/l_comment.h rename to lang/cem/cemcom.ansi/cemcom-ansi/l_comment.h diff --git a/lang/cem/cemcom-ansi/l_em.h b/lang/cem/cemcom.ansi/cemcom-ansi/l_em.h similarity index 100% rename from lang/cem/cemcom-ansi/l_em.h rename to lang/cem/cemcom.ansi/cemcom-ansi/l_em.h diff --git a/lang/cem/cemcom-ansi/l_ev_ord.c b/lang/cem/cemcom.ansi/cemcom-ansi/l_ev_ord.c similarity index 100% rename from lang/cem/cemcom-ansi/l_ev_ord.c rename to lang/cem/cemcom.ansi/cemcom-ansi/l_ev_ord.c diff --git a/lang/cem/cemcom-ansi/l_lint.c b/lang/cem/cemcom.ansi/cemcom-ansi/l_lint.c similarity index 100% rename from lang/cem/cemcom-ansi/l_lint.c rename to lang/cem/cemcom.ansi/cemcom-ansi/l_lint.c diff --git a/lang/cem/cemcom-ansi/l_lint.h b/lang/cem/cemcom.ansi/cemcom-ansi/l_lint.h similarity index 100% rename from lang/cem/cemcom-ansi/l_lint.h rename to lang/cem/cemcom.ansi/cemcom-ansi/l_lint.h diff --git a/lang/cem/cemcom-ansi/l_misc.c b/lang/cem/cemcom.ansi/cemcom-ansi/l_misc.c similarity index 100% rename from lang/cem/cemcom-ansi/l_misc.c rename to lang/cem/cemcom.ansi/cemcom-ansi/l_misc.c diff --git a/lang/cem/cemcom-ansi/l_outdef.c b/lang/cem/cemcom.ansi/cemcom-ansi/l_outdef.c similarity index 100% rename from lang/cem/cemcom-ansi/l_outdef.c rename to lang/cem/cemcom.ansi/cemcom-ansi/l_outdef.c diff --git a/lang/cem/cemcom-ansi/l_outdef.str b/lang/cem/cemcom.ansi/cemcom-ansi/l_outdef.str similarity index 100% rename from lang/cem/cemcom-ansi/l_outdef.str rename to lang/cem/cemcom.ansi/cemcom-ansi/l_outdef.str diff --git a/lang/cem/cemcom-ansi/l_state.str b/lang/cem/cemcom.ansi/cemcom-ansi/l_state.str similarity index 100% rename from lang/cem/cemcom-ansi/l_state.str rename to lang/cem/cemcom.ansi/cemcom-ansi/l_state.str diff --git a/lang/cem/cemcom-ansi/l_states.c b/lang/cem/cemcom.ansi/cemcom-ansi/l_states.c similarity index 100% rename from lang/cem/cemcom-ansi/l_states.c rename to lang/cem/cemcom.ansi/cemcom-ansi/l_states.c diff --git a/lang/cem/cemcom-ansi/label.c b/lang/cem/cemcom.ansi/cemcom-ansi/label.c similarity index 100% rename from lang/cem/cemcom-ansi/label.c rename to lang/cem/cemcom.ansi/cemcom-ansi/label.c diff --git a/lang/cem/cemcom-ansi/label.h b/lang/cem/cemcom.ansi/cemcom-ansi/label.h similarity index 100% rename from lang/cem/cemcom-ansi/label.h rename to lang/cem/cemcom.ansi/cemcom-ansi/label.h diff --git a/lang/cem/cemcom-ansi/level.h b/lang/cem/cemcom.ansi/cemcom-ansi/level.h similarity index 100% rename from lang/cem/cemcom-ansi/level.h rename to lang/cem/cemcom.ansi/cemcom-ansi/level.h diff --git a/lang/cem/cemcom-ansi/macro.str b/lang/cem/cemcom.ansi/cemcom-ansi/macro.str similarity index 100% rename from lang/cem/cemcom-ansi/macro.str rename to lang/cem/cemcom.ansi/cemcom-ansi/macro.str diff --git a/lang/cem/cemcom-ansi/main.c b/lang/cem/cemcom.ansi/cemcom-ansi/main.c similarity index 100% rename from lang/cem/cemcom-ansi/main.c rename to lang/cem/cemcom.ansi/cemcom-ansi/main.c diff --git a/lang/cem/cemcom-ansi/make.allocd b/lang/cem/cemcom.ansi/cemcom-ansi/make.allocd similarity index 100% rename from lang/cem/cemcom-ansi/make.allocd rename to lang/cem/cemcom.ansi/cemcom-ansi/make.allocd diff --git a/lang/cem/cemcom-ansi/make.hfiles b/lang/cem/cemcom.ansi/cemcom-ansi/make.hfiles similarity index 100% rename from lang/cem/cemcom-ansi/make.hfiles rename to lang/cem/cemcom.ansi/cemcom-ansi/make.hfiles diff --git a/lang/cem/cemcom-ansi/make.next b/lang/cem/cemcom.ansi/cemcom-ansi/make.next similarity index 100% rename from lang/cem/cemcom-ansi/make.next rename to lang/cem/cemcom.ansi/cemcom-ansi/make.next diff --git a/lang/cem/cemcom-ansi/make.tokcase b/lang/cem/cemcom.ansi/cemcom-ansi/make.tokcase similarity index 100% rename from lang/cem/cemcom-ansi/make.tokcase rename to lang/cem/cemcom.ansi/cemcom-ansi/make.tokcase diff --git a/lang/cem/cemcom-ansi/make.tokfile b/lang/cem/cemcom.ansi/cemcom-ansi/make.tokfile similarity index 100% rename from lang/cem/cemcom-ansi/make.tokfile rename to lang/cem/cemcom.ansi/cemcom-ansi/make.tokfile diff --git a/lang/cem/cemcom-ansi/mes.h b/lang/cem/cemcom.ansi/cemcom-ansi/mes.h similarity index 100% rename from lang/cem/cemcom-ansi/mes.h rename to lang/cem/cemcom.ansi/cemcom-ansi/mes.h diff --git a/lang/cem/cemcom-ansi/next.str b/lang/cem/cemcom.ansi/cemcom-ansi/next.str similarity index 100% rename from lang/cem/cemcom-ansi/next.str rename to lang/cem/cemcom.ansi/cemcom-ansi/next.str diff --git a/lang/cem/cemcom-ansi/options b/lang/cem/cemcom.ansi/cemcom-ansi/options similarity index 100% rename from lang/cem/cemcom-ansi/options rename to lang/cem/cemcom.ansi/cemcom-ansi/options diff --git a/lang/cem/cemcom-ansi/options.c b/lang/cem/cemcom.ansi/cemcom-ansi/options.c similarity index 100% rename from lang/cem/cemcom-ansi/options.c rename to lang/cem/cemcom.ansi/cemcom-ansi/options.c diff --git a/lang/cem/cemcom-ansi/options.h b/lang/cem/cemcom.ansi/cemcom-ansi/options.h similarity index 100% rename from lang/cem/cemcom-ansi/options.h rename to lang/cem/cemcom.ansi/cemcom-ansi/options.h diff --git a/lang/cem/cemcom-ansi/pragma.c b/lang/cem/cemcom.ansi/cemcom-ansi/pragma.c similarity index 100% rename from lang/cem/cemcom-ansi/pragma.c rename to lang/cem/cemcom.ansi/cemcom-ansi/pragma.c diff --git a/lang/cem/cemcom-ansi/pragma.h b/lang/cem/cemcom.ansi/cemcom-ansi/pragma.h similarity index 100% rename from lang/cem/cemcom-ansi/pragma.h rename to lang/cem/cemcom.ansi/cemcom-ansi/pragma.h diff --git a/lang/cem/cemcom-ansi/program.g b/lang/cem/cemcom.ansi/cemcom-ansi/program.g similarity index 100% rename from lang/cem/cemcom-ansi/program.g rename to lang/cem/cemcom.ansi/cemcom-ansi/program.g diff --git a/lang/cem/cemcom-ansi/proto.c b/lang/cem/cemcom.ansi/cemcom-ansi/proto.c similarity index 100% rename from lang/cem/cemcom-ansi/proto.c rename to lang/cem/cemcom.ansi/cemcom-ansi/proto.c diff --git a/lang/cem/cemcom-ansi/proto.main b/lang/cem/cemcom.ansi/cemcom-ansi/proto.main similarity index 100% rename from lang/cem/cemcom-ansi/proto.main rename to lang/cem/cemcom.ansi/cemcom-ansi/proto.main diff --git a/lang/cem/cemcom-ansi/proto.make b/lang/cem/cemcom.ansi/cemcom-ansi/proto.make similarity index 100% rename from lang/cem/cemcom-ansi/proto.make rename to lang/cem/cemcom.ansi/cemcom-ansi/proto.make diff --git a/lang/cem/cemcom-ansi/proto.str b/lang/cem/cemcom.ansi/cemcom-ansi/proto.str similarity index 100% rename from lang/cem/cemcom-ansi/proto.str rename to lang/cem/cemcom.ansi/cemcom-ansi/proto.str diff --git a/lang/cem/cemcom-ansi/sizes.h b/lang/cem/cemcom.ansi/cemcom-ansi/sizes.h similarity index 100% rename from lang/cem/cemcom-ansi/sizes.h rename to lang/cem/cemcom.ansi/cemcom-ansi/sizes.h diff --git a/lang/cem/cemcom-ansi/skip.c b/lang/cem/cemcom.ansi/cemcom-ansi/skip.c similarity index 100% rename from lang/cem/cemcom-ansi/skip.c rename to lang/cem/cemcom.ansi/cemcom-ansi/skip.c diff --git a/lang/cem/cemcom-ansi/skip.h b/lang/cem/cemcom.ansi/cemcom-ansi/skip.h similarity index 100% rename from lang/cem/cemcom-ansi/skip.h rename to lang/cem/cemcom.ansi/cemcom-ansi/skip.h diff --git a/lang/cem/cemcom-ansi/specials.h b/lang/cem/cemcom.ansi/cemcom-ansi/specials.h similarity index 100% rename from lang/cem/cemcom-ansi/specials.h rename to lang/cem/cemcom.ansi/cemcom-ansi/specials.h diff --git a/lang/cem/cemcom-ansi/stab.c b/lang/cem/cemcom.ansi/cemcom-ansi/stab.c similarity index 100% rename from lang/cem/cemcom-ansi/stab.c rename to lang/cem/cemcom.ansi/cemcom-ansi/stab.c diff --git a/lang/cem/cemcom-ansi/stab.h b/lang/cem/cemcom.ansi/cemcom-ansi/stab.h similarity index 100% rename from lang/cem/cemcom-ansi/stab.h rename to lang/cem/cemcom.ansi/cemcom-ansi/stab.h diff --git a/lang/cem/cemcom-ansi/stack.c b/lang/cem/cemcom.ansi/cemcom-ansi/stack.c similarity index 100% rename from lang/cem/cemcom-ansi/stack.c rename to lang/cem/cemcom.ansi/cemcom-ansi/stack.c diff --git a/lang/cem/cemcom-ansi/stack.str b/lang/cem/cemcom.ansi/cemcom-ansi/stack.str similarity index 100% rename from lang/cem/cemcom-ansi/stack.str rename to lang/cem/cemcom.ansi/cemcom-ansi/stack.str diff --git a/lang/cem/cemcom-ansi/statement.g b/lang/cem/cemcom.ansi/cemcom-ansi/statement.g similarity index 100% rename from lang/cem/cemcom-ansi/statement.g rename to lang/cem/cemcom.ansi/cemcom-ansi/statement.g diff --git a/lang/cem/cemcom-ansi/stb.c b/lang/cem/cemcom.ansi/cemcom-ansi/stb.c similarity index 100% rename from lang/cem/cemcom-ansi/stb.c rename to lang/cem/cemcom.ansi/cemcom-ansi/stb.c diff --git a/lang/cem/cemcom-ansi/stmt.str b/lang/cem/cemcom.ansi/cemcom-ansi/stmt.str similarity index 100% rename from lang/cem/cemcom-ansi/stmt.str rename to lang/cem/cemcom.ansi/cemcom-ansi/stmt.str diff --git a/lang/cem/cemcom-ansi/struct.c b/lang/cem/cemcom.ansi/cemcom-ansi/struct.c similarity index 100% rename from lang/cem/cemcom-ansi/struct.c rename to lang/cem/cemcom.ansi/cemcom-ansi/struct.c diff --git a/lang/cem/cemcom-ansi/struct.str b/lang/cem/cemcom.ansi/cemcom-ansi/struct.str similarity index 100% rename from lang/cem/cemcom-ansi/struct.str rename to lang/cem/cemcom.ansi/cemcom-ansi/struct.str diff --git a/lang/cem/cemcom-ansi/switch.c b/lang/cem/cemcom.ansi/cemcom-ansi/switch.c similarity index 100% rename from lang/cem/cemcom-ansi/switch.c rename to lang/cem/cemcom.ansi/cemcom-ansi/switch.c diff --git a/lang/cem/cemcom-ansi/switch.str b/lang/cem/cemcom.ansi/cemcom-ansi/switch.str similarity index 100% rename from lang/cem/cemcom-ansi/switch.str rename to lang/cem/cemcom.ansi/cemcom-ansi/switch.str diff --git a/lang/cem/cemcom-ansi/tokcase.sed b/lang/cem/cemcom.ansi/cemcom-ansi/tokcase.sed similarity index 100% rename from lang/cem/cemcom-ansi/tokcase.sed rename to lang/cem/cemcom.ansi/cemcom-ansi/tokcase.sed diff --git a/lang/cem/cemcom-ansi/tokcasee.in b/lang/cem/cemcom.ansi/cemcom-ansi/tokcasee.in similarity index 100% rename from lang/cem/cemcom-ansi/tokcasee.in rename to lang/cem/cemcom.ansi/cemcom-ansi/tokcasee.in diff --git a/lang/cem/cemcom-ansi/tokcaseh.in b/lang/cem/cemcom.ansi/cemcom-ansi/tokcaseh.in similarity index 100% rename from lang/cem/cemcom-ansi/tokcaseh.in rename to lang/cem/cemcom.ansi/cemcom-ansi/tokcaseh.in diff --git a/lang/cem/cemcom-ansi/tokenname.c b/lang/cem/cemcom.ansi/cemcom-ansi/tokenname.c similarity index 100% rename from lang/cem/cemcom-ansi/tokenname.c rename to lang/cem/cemcom.ansi/cemcom-ansi/tokenname.c diff --git a/lang/cem/cemcom-ansi/tokenname.h b/lang/cem/cemcom.ansi/cemcom-ansi/tokenname.h similarity index 100% rename from lang/cem/cemcom-ansi/tokenname.h rename to lang/cem/cemcom.ansi/cemcom-ansi/tokenname.h diff --git a/lang/cem/cemcom-ansi/type.c b/lang/cem/cemcom.ansi/cemcom-ansi/type.c similarity index 100% rename from lang/cem/cemcom-ansi/type.c rename to lang/cem/cemcom.ansi/cemcom-ansi/type.c diff --git a/lang/cem/cemcom-ansi/type.str b/lang/cem/cemcom.ansi/cemcom-ansi/type.str similarity index 100% rename from lang/cem/cemcom-ansi/type.str rename to lang/cem/cemcom.ansi/cemcom-ansi/type.str diff --git a/lang/cem/cemcom-ansi/util.c b/lang/cem/cemcom.ansi/cemcom-ansi/util.c similarity index 100% rename from lang/cem/cemcom-ansi/util.c rename to lang/cem/cemcom.ansi/cemcom-ansi/util.c diff --git a/lang/cem/cemcom-ansi/util.str b/lang/cem/cemcom.ansi/cemcom-ansi/util.str similarity index 100% rename from lang/cem/cemcom-ansi/util.str rename to lang/cem/cemcom.ansi/cemcom-ansi/util.str From 7c541c2523bfd6ba188deb425cbea80072de1716 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 16:24:54 +0100 Subject: [PATCH 05/79] Fix broken move. --- .../cem/cemcom.ansi/{cemcom-ansi => }/BigPars | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/LLlex.c | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/LLlex.h | 0 .../cemcom.ansi/{cemcom-ansi => }/LLmessage.c | 0 .../cemcom.ansi/{cemcom-ansi => }/SmallPars | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/align.h | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/arith.c | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/arith.h | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/atw.h | 0 .../cemcom.ansi/{cemcom-ansi => }/blocks.c | 0 .../cemcom.ansi/{cemcom-ansi => }/blocks.h | 0 .../cemcom.ansi/{cemcom-ansi => }/build.lua | 0 lang/cem/cemcom.ansi/build.py | 118 ++++++++++++++++++ .../{cemcom-ansi => }/cemcom.ansi.1 | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/ch3.c | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/ch3.h | 0 .../cemcom.ansi/{cemcom-ansi => }/ch3bin.c | 0 .../cemcom.ansi/{cemcom-ansi => }/ch3bin.h | 0 .../cemcom.ansi/{cemcom-ansi => }/ch3mon.c | 0 .../cemcom.ansi/{cemcom-ansi => }/ch3mon.h | 0 .../cemcom.ansi/{cemcom-ansi => }/char.tab | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/class.h | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/code.c | 0 .../cemcom.ansi/{cemcom-ansi => }/code.str | 0 .../{cemcom-ansi => }/conversion.c | 0 .../{cemcom-ansi => }/conversion.h | 0 .../cemcom.ansi/{cemcom-ansi => }/cstoper.c | 0 .../cemcom.ansi/{cemcom-ansi => }/cstoper.h | 0 .../cemcom.ansi/{cemcom-ansi => }/dataflow.c | 0 .../cemcom.ansi/{cemcom-ansi => }/dataflow.h | 0 .../cemcom.ansi/{cemcom-ansi => }/declar.g | 0 .../cemcom.ansi/{cemcom-ansi => }/declar.str | 0 .../{cemcom-ansi => }/declarator.c | 0 .../{cemcom-ansi => }/declarator.h | 0 .../cemcom.ansi/{cemcom-ansi => }/decspecs.c | 0 .../cemcom.ansi/{cemcom-ansi => }/decspecs.h | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/def.str | 0 .../cemcom.ansi/{cemcom-ansi => }/domacro.c | 0 .../cemcom.ansi/{cemcom-ansi => }/domacro.h | 0 .../cemcom.ansi/{cemcom-ansi => }/dumpidf.c | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/error.c | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/error.h | 0 .../cemcom.ansi/{cemcom-ansi => }/estack.str | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/eval.c | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/eval.h | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/expr.c | 0 .../cemcom.ansi/{cemcom-ansi => }/expr.str | 0 .../{cemcom-ansi => }/expression.g | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/field.c | 0 .../cemcom.ansi/{cemcom-ansi => }/field.str | 0 .../cemcom.ansi/{cemcom-ansi => }/file_info.h | 0 .../{cemcom-ansi => }/fltcstoper.c | 0 .../{cemcom-ansi => }/fltcstoper.h | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/idf.c | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/idf.str | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/input.c | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/input.h | 0 .../cemcom.ansi/{cemcom-ansi => }/interface.h | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/ival.g | 0 .../cemcom.ansi/{cemcom-ansi => }/l_brace.str | 0 .../cemcom.ansi/{cemcom-ansi => }/l_class.h | 0 .../cemcom.ansi/{cemcom-ansi => }/l_comment.c | 0 .../cemcom.ansi/{cemcom-ansi => }/l_comment.h | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/l_em.h | 0 .../cemcom.ansi/{cemcom-ansi => }/l_ev_ord.c | 0 .../cemcom.ansi/{cemcom-ansi => }/l_lint.c | 0 .../cemcom.ansi/{cemcom-ansi => }/l_lint.h | 0 .../cemcom.ansi/{cemcom-ansi => }/l_misc.c | 0 .../cemcom.ansi/{cemcom-ansi => }/l_outdef.c | 0 .../{cemcom-ansi => }/l_outdef.str | 0 .../cemcom.ansi/{cemcom-ansi => }/l_state.str | 0 .../cemcom.ansi/{cemcom-ansi => }/l_states.c | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/label.c | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/label.h | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/level.h | 0 .../cemcom.ansi/{cemcom-ansi => }/macro.str | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/main.c | 0 .../cemcom.ansi/{cemcom-ansi => }/make.allocd | 0 .../cemcom.ansi/{cemcom-ansi => }/make.hfiles | 0 .../cemcom.ansi/{cemcom-ansi => }/make.next | 0 .../{cemcom-ansi => }/make.tokcase | 0 .../{cemcom-ansi => }/make.tokfile | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/mes.h | 0 .../cemcom.ansi/{cemcom-ansi => }/next.str | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/options | 0 .../cemcom.ansi/{cemcom-ansi => }/options.c | 0 .../cemcom.ansi/{cemcom-ansi => }/options.h | 0 .../cemcom.ansi/{cemcom-ansi => }/pragma.c | 0 .../cemcom.ansi/{cemcom-ansi => }/pragma.h | 0 .../cemcom.ansi/{cemcom-ansi => }/program.g | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/proto.c | 0 .../cemcom.ansi/{cemcom-ansi => }/proto.main | 0 .../cemcom.ansi/{cemcom-ansi => }/proto.make | 0 .../cemcom.ansi/{cemcom-ansi => }/proto.str | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/sizes.h | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/skip.c | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/skip.h | 0 .../cemcom.ansi/{cemcom-ansi => }/specials.h | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/stab.c | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/stab.h | 0 .../cem/cemcom.ansi/{cemcom-ansi => }/stack.c | 0 .../cemcom.ansi/{cemcom-ansi => }/stack.str | 0 .../cemcom.ansi/{cemcom-ansi => }/statement.g | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/stb.c | 0 .../cemcom.ansi/{cemcom-ansi => }/stmt.str | 0 .../cemcom.ansi/{cemcom-ansi => }/struct.c | 0 .../cemcom.ansi/{cemcom-ansi => }/struct.str | 0 .../cemcom.ansi/{cemcom-ansi => }/switch.c | 0 .../cemcom.ansi/{cemcom-ansi => }/switch.str | 0 .../cemcom.ansi/{cemcom-ansi => }/tokcase.sed | 0 .../cemcom.ansi/{cemcom-ansi => }/tokcasee.in | 0 .../cemcom.ansi/{cemcom-ansi => }/tokcaseh.in | 0 .../cemcom.ansi/{cemcom-ansi => }/tokenname.c | 0 .../cemcom.ansi/{cemcom-ansi => }/tokenname.h | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/type.c | 0 .../cemcom.ansi/{cemcom-ansi => }/type.str | 0 lang/cem/cemcom.ansi/{cemcom-ansi => }/util.c | 0 .../cemcom.ansi/{cemcom-ansi => }/util.str | 0 118 files changed, 118 insertions(+) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/BigPars (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/LLlex.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/LLlex.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/LLmessage.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/SmallPars (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/align.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/arith.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/arith.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/atw.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/blocks.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/blocks.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/build.lua (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/cemcom.ansi.1 (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/ch3.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/ch3.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/ch3bin.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/ch3bin.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/ch3mon.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/ch3mon.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/char.tab (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/class.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/code.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/code.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/conversion.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/conversion.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/cstoper.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/cstoper.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/dataflow.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/dataflow.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/declar.g (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/declar.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/declarator.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/declarator.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/decspecs.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/decspecs.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/def.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/domacro.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/domacro.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/dumpidf.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/error.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/error.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/estack.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/eval.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/eval.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/expr.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/expr.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/expression.g (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/field.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/field.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/file_info.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/fltcstoper.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/fltcstoper.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/idf.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/idf.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/input.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/input.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/interface.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/ival.g (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/l_brace.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/l_class.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/l_comment.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/l_comment.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/l_em.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/l_ev_ord.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/l_lint.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/l_lint.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/l_misc.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/l_outdef.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/l_outdef.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/l_state.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/l_states.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/label.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/label.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/level.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/macro.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/main.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/make.allocd (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/make.hfiles (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/make.next (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/make.tokcase (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/make.tokfile (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/mes.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/next.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/options (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/options.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/options.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/pragma.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/pragma.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/program.g (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/proto.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/proto.main (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/proto.make (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/proto.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/sizes.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/skip.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/skip.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/specials.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/stab.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/stab.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/stack.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/stack.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/statement.g (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/stb.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/stmt.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/struct.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/struct.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/switch.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/switch.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/tokcase.sed (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/tokcasee.in (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/tokcaseh.in (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/tokenname.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/tokenname.h (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/type.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/type.str (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/util.c (100%) rename lang/cem/cemcom.ansi/{cemcom-ansi => }/util.str (100%) diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/BigPars b/lang/cem/cemcom.ansi/BigPars similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/BigPars rename to lang/cem/cemcom.ansi/BigPars diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/LLlex.c b/lang/cem/cemcom.ansi/LLlex.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/LLlex.c rename to lang/cem/cemcom.ansi/LLlex.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/LLlex.h b/lang/cem/cemcom.ansi/LLlex.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/LLlex.h rename to lang/cem/cemcom.ansi/LLlex.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/LLmessage.c b/lang/cem/cemcom.ansi/LLmessage.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/LLmessage.c rename to lang/cem/cemcom.ansi/LLmessage.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/SmallPars b/lang/cem/cemcom.ansi/SmallPars similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/SmallPars rename to lang/cem/cemcom.ansi/SmallPars diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/align.h b/lang/cem/cemcom.ansi/align.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/align.h rename to lang/cem/cemcom.ansi/align.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/arith.c b/lang/cem/cemcom.ansi/arith.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/arith.c rename to lang/cem/cemcom.ansi/arith.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/arith.h b/lang/cem/cemcom.ansi/arith.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/arith.h rename to lang/cem/cemcom.ansi/arith.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/atw.h b/lang/cem/cemcom.ansi/atw.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/atw.h rename to lang/cem/cemcom.ansi/atw.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/blocks.c b/lang/cem/cemcom.ansi/blocks.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/blocks.c rename to lang/cem/cemcom.ansi/blocks.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/blocks.h b/lang/cem/cemcom.ansi/blocks.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/blocks.h rename to lang/cem/cemcom.ansi/blocks.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/build.lua b/lang/cem/cemcom.ansi/build.lua similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/build.lua rename to lang/cem/cemcom.ansi/build.lua diff --git a/lang/cem/cemcom.ansi/build.py b/lang/cem/cemcom.ansi/build.py index 1feba8ecb4..7ccd28b155 100644 --- a/lang/cem/cemcom.ansi/build.py +++ b/lang/cem/cemcom.ansi/build.py @@ -1 +1,119 @@ +from build.ab import export, simplerule from build.c import cprogram +from glob import glob +from util.LLgen.build import llgen +from util.cmisc.build import tabgen + +str_roots = [ + "code", + "declar", + "def", + "estack", + "expr", + "field", + "idf", + "l_brace", + "l_outdef", + "l_state", + "macro", + "next", + "proto", + "stack", + "stmt", + "struct", + "switch", + "type", + "util", +] + +simplerule( + name="parameters", + ins=["./BigPars"], + outs=["=parameters.h"], + commands=[ + "echo '#ifndef PARAMETERS_H' > $[outs]", + "echo '#define PARAMETERS_H' >> $[outs]", + "grep -v '^!' < $[ins] >> $[outs]", + "echo '#endif' >> $[outs]", + ], +) + +strtargets = [ + simplerule( + name=f"allocd_{str}", + ins=["./make.allocd", f"./{str}.str"], + outs=[f"={str}.h"], + commands=["$[ins[0]] < $[ins[1]] > $[outs]"], + ) + for str in str_roots +] + +simplerule( + name="next-c", + ins=[ + "./make.next", + ] + + [f"./{k}.str" for k in str_roots], + outs=["=next.c"], + commands=["$[ins] > $[outs]"], +) + +simplerule( + name="tokenfile-g", + ins=[ + "./make.tokfile", + "./tokenname.c", + ], + outs=["=tokenfile.g"], + commands=["sh $[ins[0]] < $[ins[1]] > $[outs]"], +) + +simplerule( + name="symbol2str-c", + ins=[ + "./make.tokcase", + "./tokenname.c", + ], + outs=["=symbol2str.c"], + commands=["sh $[ins[0]] < $[ins[1]] > $[outs]"], +) + +llgen( + name="llgen", + srcs=[ + ".+tokenfile-g", # must be first + "./declar.g", + "./expression.g", + "./ival.g", + "./program.g", + "./statement.g", + ], +) + +tabgen(name="tabgen", src="./char.tab") + +cprogram( + name="cemcom", + srcs=( + glob("lang/cem/cemcom-ansi/*.c") + + glob("lang/cem/cemcom-ansi/*.h") + + strtargets + + [".+parameters", ".+llgen", ".+next-c", ".+symbol2str-c", ".+tabgen"] + ), + deps=[ + "h", + "modules/h", + "modules/src/system", + "modules/src/alloc", + "modules/src/em_code+lib_k", + "modules/src/em_data", + "modules/src/em_mes", + "modules/src/flt_arith", + "modules/src/idf", + "modules/src/input", + "modules/src/string", + "modules/src/system", + ], +) + +export(name="all", items={"$(PLATDEP)/em_cemcom.ansi": ".+cemcom"}) diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/cemcom.ansi.1 b/lang/cem/cemcom.ansi/cemcom.ansi.1 similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/cemcom.ansi.1 rename to lang/cem/cemcom.ansi/cemcom.ansi.1 diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/ch3.c b/lang/cem/cemcom.ansi/ch3.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/ch3.c rename to lang/cem/cemcom.ansi/ch3.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/ch3.h b/lang/cem/cemcom.ansi/ch3.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/ch3.h rename to lang/cem/cemcom.ansi/ch3.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/ch3bin.c b/lang/cem/cemcom.ansi/ch3bin.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/ch3bin.c rename to lang/cem/cemcom.ansi/ch3bin.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/ch3bin.h b/lang/cem/cemcom.ansi/ch3bin.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/ch3bin.h rename to lang/cem/cemcom.ansi/ch3bin.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/ch3mon.c b/lang/cem/cemcom.ansi/ch3mon.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/ch3mon.c rename to lang/cem/cemcom.ansi/ch3mon.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/ch3mon.h b/lang/cem/cemcom.ansi/ch3mon.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/ch3mon.h rename to lang/cem/cemcom.ansi/ch3mon.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/char.tab b/lang/cem/cemcom.ansi/char.tab similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/char.tab rename to lang/cem/cemcom.ansi/char.tab diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/class.h b/lang/cem/cemcom.ansi/class.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/class.h rename to lang/cem/cemcom.ansi/class.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/code.c b/lang/cem/cemcom.ansi/code.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/code.c rename to lang/cem/cemcom.ansi/code.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/code.str b/lang/cem/cemcom.ansi/code.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/code.str rename to lang/cem/cemcom.ansi/code.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/conversion.c b/lang/cem/cemcom.ansi/conversion.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/conversion.c rename to lang/cem/cemcom.ansi/conversion.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/conversion.h b/lang/cem/cemcom.ansi/conversion.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/conversion.h rename to lang/cem/cemcom.ansi/conversion.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/cstoper.c b/lang/cem/cemcom.ansi/cstoper.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/cstoper.c rename to lang/cem/cemcom.ansi/cstoper.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/cstoper.h b/lang/cem/cemcom.ansi/cstoper.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/cstoper.h rename to lang/cem/cemcom.ansi/cstoper.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/dataflow.c b/lang/cem/cemcom.ansi/dataflow.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/dataflow.c rename to lang/cem/cemcom.ansi/dataflow.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/dataflow.h b/lang/cem/cemcom.ansi/dataflow.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/dataflow.h rename to lang/cem/cemcom.ansi/dataflow.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/declar.g b/lang/cem/cemcom.ansi/declar.g similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/declar.g rename to lang/cem/cemcom.ansi/declar.g diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/declar.str b/lang/cem/cemcom.ansi/declar.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/declar.str rename to lang/cem/cemcom.ansi/declar.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/declarator.c b/lang/cem/cemcom.ansi/declarator.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/declarator.c rename to lang/cem/cemcom.ansi/declarator.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/declarator.h b/lang/cem/cemcom.ansi/declarator.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/declarator.h rename to lang/cem/cemcom.ansi/declarator.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/decspecs.c b/lang/cem/cemcom.ansi/decspecs.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/decspecs.c rename to lang/cem/cemcom.ansi/decspecs.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/decspecs.h b/lang/cem/cemcom.ansi/decspecs.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/decspecs.h rename to lang/cem/cemcom.ansi/decspecs.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/def.str b/lang/cem/cemcom.ansi/def.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/def.str rename to lang/cem/cemcom.ansi/def.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/domacro.c b/lang/cem/cemcom.ansi/domacro.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/domacro.c rename to lang/cem/cemcom.ansi/domacro.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/domacro.h b/lang/cem/cemcom.ansi/domacro.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/domacro.h rename to lang/cem/cemcom.ansi/domacro.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/dumpidf.c b/lang/cem/cemcom.ansi/dumpidf.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/dumpidf.c rename to lang/cem/cemcom.ansi/dumpidf.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/error.c b/lang/cem/cemcom.ansi/error.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/error.c rename to lang/cem/cemcom.ansi/error.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/error.h b/lang/cem/cemcom.ansi/error.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/error.h rename to lang/cem/cemcom.ansi/error.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/estack.str b/lang/cem/cemcom.ansi/estack.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/estack.str rename to lang/cem/cemcom.ansi/estack.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/eval.c b/lang/cem/cemcom.ansi/eval.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/eval.c rename to lang/cem/cemcom.ansi/eval.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/eval.h b/lang/cem/cemcom.ansi/eval.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/eval.h rename to lang/cem/cemcom.ansi/eval.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/expr.c b/lang/cem/cemcom.ansi/expr.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/expr.c rename to lang/cem/cemcom.ansi/expr.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/expr.str b/lang/cem/cemcom.ansi/expr.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/expr.str rename to lang/cem/cemcom.ansi/expr.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/expression.g b/lang/cem/cemcom.ansi/expression.g similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/expression.g rename to lang/cem/cemcom.ansi/expression.g diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/field.c b/lang/cem/cemcom.ansi/field.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/field.c rename to lang/cem/cemcom.ansi/field.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/field.str b/lang/cem/cemcom.ansi/field.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/field.str rename to lang/cem/cemcom.ansi/field.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/file_info.h b/lang/cem/cemcom.ansi/file_info.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/file_info.h rename to lang/cem/cemcom.ansi/file_info.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/fltcstoper.c b/lang/cem/cemcom.ansi/fltcstoper.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/fltcstoper.c rename to lang/cem/cemcom.ansi/fltcstoper.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/fltcstoper.h b/lang/cem/cemcom.ansi/fltcstoper.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/fltcstoper.h rename to lang/cem/cemcom.ansi/fltcstoper.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/idf.c b/lang/cem/cemcom.ansi/idf.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/idf.c rename to lang/cem/cemcom.ansi/idf.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/idf.str b/lang/cem/cemcom.ansi/idf.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/idf.str rename to lang/cem/cemcom.ansi/idf.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/input.c b/lang/cem/cemcom.ansi/input.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/input.c rename to lang/cem/cemcom.ansi/input.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/input.h b/lang/cem/cemcom.ansi/input.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/input.h rename to lang/cem/cemcom.ansi/input.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/interface.h b/lang/cem/cemcom.ansi/interface.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/interface.h rename to lang/cem/cemcom.ansi/interface.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/ival.g b/lang/cem/cemcom.ansi/ival.g similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/ival.g rename to lang/cem/cemcom.ansi/ival.g diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/l_brace.str b/lang/cem/cemcom.ansi/l_brace.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/l_brace.str rename to lang/cem/cemcom.ansi/l_brace.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/l_class.h b/lang/cem/cemcom.ansi/l_class.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/l_class.h rename to lang/cem/cemcom.ansi/l_class.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/l_comment.c b/lang/cem/cemcom.ansi/l_comment.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/l_comment.c rename to lang/cem/cemcom.ansi/l_comment.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/l_comment.h b/lang/cem/cemcom.ansi/l_comment.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/l_comment.h rename to lang/cem/cemcom.ansi/l_comment.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/l_em.h b/lang/cem/cemcom.ansi/l_em.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/l_em.h rename to lang/cem/cemcom.ansi/l_em.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/l_ev_ord.c b/lang/cem/cemcom.ansi/l_ev_ord.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/l_ev_ord.c rename to lang/cem/cemcom.ansi/l_ev_ord.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/l_lint.c b/lang/cem/cemcom.ansi/l_lint.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/l_lint.c rename to lang/cem/cemcom.ansi/l_lint.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/l_lint.h b/lang/cem/cemcom.ansi/l_lint.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/l_lint.h rename to lang/cem/cemcom.ansi/l_lint.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/l_misc.c b/lang/cem/cemcom.ansi/l_misc.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/l_misc.c rename to lang/cem/cemcom.ansi/l_misc.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/l_outdef.c b/lang/cem/cemcom.ansi/l_outdef.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/l_outdef.c rename to lang/cem/cemcom.ansi/l_outdef.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/l_outdef.str b/lang/cem/cemcom.ansi/l_outdef.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/l_outdef.str rename to lang/cem/cemcom.ansi/l_outdef.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/l_state.str b/lang/cem/cemcom.ansi/l_state.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/l_state.str rename to lang/cem/cemcom.ansi/l_state.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/l_states.c b/lang/cem/cemcom.ansi/l_states.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/l_states.c rename to lang/cem/cemcom.ansi/l_states.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/label.c b/lang/cem/cemcom.ansi/label.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/label.c rename to lang/cem/cemcom.ansi/label.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/label.h b/lang/cem/cemcom.ansi/label.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/label.h rename to lang/cem/cemcom.ansi/label.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/level.h b/lang/cem/cemcom.ansi/level.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/level.h rename to lang/cem/cemcom.ansi/level.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/macro.str b/lang/cem/cemcom.ansi/macro.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/macro.str rename to lang/cem/cemcom.ansi/macro.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/main.c b/lang/cem/cemcom.ansi/main.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/main.c rename to lang/cem/cemcom.ansi/main.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/make.allocd b/lang/cem/cemcom.ansi/make.allocd similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/make.allocd rename to lang/cem/cemcom.ansi/make.allocd diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/make.hfiles b/lang/cem/cemcom.ansi/make.hfiles similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/make.hfiles rename to lang/cem/cemcom.ansi/make.hfiles diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/make.next b/lang/cem/cemcom.ansi/make.next similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/make.next rename to lang/cem/cemcom.ansi/make.next diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/make.tokcase b/lang/cem/cemcom.ansi/make.tokcase similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/make.tokcase rename to lang/cem/cemcom.ansi/make.tokcase diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/make.tokfile b/lang/cem/cemcom.ansi/make.tokfile similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/make.tokfile rename to lang/cem/cemcom.ansi/make.tokfile diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/mes.h b/lang/cem/cemcom.ansi/mes.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/mes.h rename to lang/cem/cemcom.ansi/mes.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/next.str b/lang/cem/cemcom.ansi/next.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/next.str rename to lang/cem/cemcom.ansi/next.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/options b/lang/cem/cemcom.ansi/options similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/options rename to lang/cem/cemcom.ansi/options diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/options.c b/lang/cem/cemcom.ansi/options.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/options.c rename to lang/cem/cemcom.ansi/options.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/options.h b/lang/cem/cemcom.ansi/options.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/options.h rename to lang/cem/cemcom.ansi/options.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/pragma.c b/lang/cem/cemcom.ansi/pragma.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/pragma.c rename to lang/cem/cemcom.ansi/pragma.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/pragma.h b/lang/cem/cemcom.ansi/pragma.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/pragma.h rename to lang/cem/cemcom.ansi/pragma.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/program.g b/lang/cem/cemcom.ansi/program.g similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/program.g rename to lang/cem/cemcom.ansi/program.g diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/proto.c b/lang/cem/cemcom.ansi/proto.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/proto.c rename to lang/cem/cemcom.ansi/proto.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/proto.main b/lang/cem/cemcom.ansi/proto.main similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/proto.main rename to lang/cem/cemcom.ansi/proto.main diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/proto.make b/lang/cem/cemcom.ansi/proto.make similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/proto.make rename to lang/cem/cemcom.ansi/proto.make diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/proto.str b/lang/cem/cemcom.ansi/proto.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/proto.str rename to lang/cem/cemcom.ansi/proto.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/sizes.h b/lang/cem/cemcom.ansi/sizes.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/sizes.h rename to lang/cem/cemcom.ansi/sizes.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/skip.c b/lang/cem/cemcom.ansi/skip.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/skip.c rename to lang/cem/cemcom.ansi/skip.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/skip.h b/lang/cem/cemcom.ansi/skip.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/skip.h rename to lang/cem/cemcom.ansi/skip.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/specials.h b/lang/cem/cemcom.ansi/specials.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/specials.h rename to lang/cem/cemcom.ansi/specials.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/stab.c b/lang/cem/cemcom.ansi/stab.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/stab.c rename to lang/cem/cemcom.ansi/stab.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/stab.h b/lang/cem/cemcom.ansi/stab.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/stab.h rename to lang/cem/cemcom.ansi/stab.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/stack.c b/lang/cem/cemcom.ansi/stack.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/stack.c rename to lang/cem/cemcom.ansi/stack.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/stack.str b/lang/cem/cemcom.ansi/stack.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/stack.str rename to lang/cem/cemcom.ansi/stack.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/statement.g b/lang/cem/cemcom.ansi/statement.g similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/statement.g rename to lang/cem/cemcom.ansi/statement.g diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/stb.c b/lang/cem/cemcom.ansi/stb.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/stb.c rename to lang/cem/cemcom.ansi/stb.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/stmt.str b/lang/cem/cemcom.ansi/stmt.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/stmt.str rename to lang/cem/cemcom.ansi/stmt.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/struct.c b/lang/cem/cemcom.ansi/struct.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/struct.c rename to lang/cem/cemcom.ansi/struct.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/struct.str b/lang/cem/cemcom.ansi/struct.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/struct.str rename to lang/cem/cemcom.ansi/struct.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/switch.c b/lang/cem/cemcom.ansi/switch.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/switch.c rename to lang/cem/cemcom.ansi/switch.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/switch.str b/lang/cem/cemcom.ansi/switch.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/switch.str rename to lang/cem/cemcom.ansi/switch.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/tokcase.sed b/lang/cem/cemcom.ansi/tokcase.sed similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/tokcase.sed rename to lang/cem/cemcom.ansi/tokcase.sed diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/tokcasee.in b/lang/cem/cemcom.ansi/tokcasee.in similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/tokcasee.in rename to lang/cem/cemcom.ansi/tokcasee.in diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/tokcaseh.in b/lang/cem/cemcom.ansi/tokcaseh.in similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/tokcaseh.in rename to lang/cem/cemcom.ansi/tokcaseh.in diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/tokenname.c b/lang/cem/cemcom.ansi/tokenname.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/tokenname.c rename to lang/cem/cemcom.ansi/tokenname.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/tokenname.h b/lang/cem/cemcom.ansi/tokenname.h similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/tokenname.h rename to lang/cem/cemcom.ansi/tokenname.h diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/type.c b/lang/cem/cemcom.ansi/type.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/type.c rename to lang/cem/cemcom.ansi/type.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/type.str b/lang/cem/cemcom.ansi/type.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/type.str rename to lang/cem/cemcom.ansi/type.str diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/util.c b/lang/cem/cemcom.ansi/util.c similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/util.c rename to lang/cem/cemcom.ansi/util.c diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/util.str b/lang/cem/cemcom.ansi/util.str similarity index 100% rename from lang/cem/cemcom.ansi/cemcom-ansi/util.str rename to lang/cem/cemcom.ansi/util.str From 964f9cc4fa7ed3346ba585cc6e2b2d5b33c02af2 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 16:36:25 +0100 Subject: [PATCH 06/79] The pc86 libc builds (although I'm not sure how. There is no preprocessor yet?). --- build.py | 6 +- build/ab.mk | 8 - build/ab.py | 26 ++-- build/ack.py | 12 +- build/c.py | 9 +- build/d.py | 82 ---------- lang/cem/cemcom.ansi/build.py | 4 +- lang/cem/cemcom.ansi/cemcom-ansi/build.py | 119 --------------- lang/cem/libcc.ansi/build.py | 173 ++++++++++++++++++++++ mach/i86/libem/build.py | 69 +++++++++ mach/i86/libend/build.py | 14 ++ plat/build.py | 13 ++ plat/pc86/build.py | 8 +- 13 files changed, 314 insertions(+), 229 deletions(-) delete mode 100644 build/d.py delete mode 100644 lang/cem/cemcom.ansi/cemcom-ansi/build.py create mode 100644 lang/cem/libcc.ansi/build.py create mode 100644 mach/i86/libem/build.py create mode 100644 mach/i86/libend/build.py create mode 100644 plat/build.py diff --git a/build.py b/build.py index 842566f2b7..5d227647ee 100644 --- a/build.py +++ b/build.py @@ -1,10 +1,14 @@ from build.ab import export +PLATS=[ + "pc86" +] + export( name="common", deps=[ "util/ack+all", - "lang/cem/cemcom-ansi+all", + "lang/cem/cemcom.ansi+all", "util/amisc+all", "util/arch+all", "util/led+all", diff --git a/build/ab.mk b/build/ab.mk index 26c79affba..00db83f78e 100644 --- a/build/ab.mk +++ b/build/ab.mk @@ -19,20 +19,12 @@ HOSTAR ?= ar HOSTCFLAGS ?= -g -Og HOSTLDFLAGS ?= -g -HOSTDMD ?= ldmd2 -HOSTDFLAGS ?= -g -HOSTDLINKFLAGS ?= - CC ?= $(HOSTCC) CXX ?= $(HOSTCXX) AR ?= $(HOSTAR) CFLAGS ?= $(HOSTCFLAGS) LDFLAGS ?= $(HOSTLDFLAGS) -DMD ?= $(HOSTDMD) -DFLAGS ?= $(HOSTDFLAGS) -DLINKFLAGS ?= $(HOSTDLINKFLAGS) - export PKG_CONFIG export HOST_PKG_CONFIG diff --git a/build/ab.py b/build/ab.py index 06ffa660f7..78fb0d7beb 100644 --- a/build/ab.py +++ b/build/ab.py @@ -19,6 +19,7 @@ import hashlib import re import ast +import os from collections import namedtuple verbose = False @@ -157,7 +158,8 @@ def wrapper(*, name=None, replaces=None, **kwargs): t.callback = func t.traits.add(func.__name__) if "args" in kwargs: - t.args.update(kwargs["args"]) + t.explicit_args = kwargs["args"] + t.args.update(t.explicit_args) del kwargs["args"] if "traits" in kwargs: t.traits |= kwargs["traits"] @@ -406,8 +408,16 @@ def _removesuffix(self, suffix): def loadbuildfile(filename): - filename = _removesuffix(filename.replace("/", "."), ".py") - builtins.__import__(filename) + modulename = _removesuffix(filename.replace("/", "."), ".py") + spec = importlib.util.spec_from_file_location( + name=modulename, + location=filename, + loader=BuildFileLoaderImpl(fullname=modulename, path=filename), + submodule_search_locations=[], + ) + module = importlib.util.module_from_spec(spec) + sys.modules[modulename] = module + spec.loader.exec_module(module) def flatten(items): @@ -557,7 +567,6 @@ def simplerule( def export(self, name=None, items: TargetsMap = {}, deps: Targets = []): ins = [] outs = [] - rules = [] for dest, src in items.items(): dest = self.targetof(dest) outs += [dest] @@ -569,7 +578,7 @@ def export(self, name=None, items: TargetsMap = {}, deps: Targets = []): len(srcs) == 1 ), "a dependency of an exported file must have exactly one output file" - rule = simplerule( + subrule = simplerule( name=f"{self.localname}/{destf}", cwd=self.cwd, ins=[srcs[0]], @@ -577,15 +586,14 @@ def export(self, name=None, items: TargetsMap = {}, deps: Targets = []): commands=["$(CP) -H %s %s" % (srcs[0], destf)], label="", ) - rule.materialise() - rules += [rule] + subrule.materialise() self.ins = [] - self.outs = rules + deps + self.outs = deps + outs emit("") emit(".PHONY:", name) - emit(name, ":", *filenamesof(outs), *filenamesof(deps)) + emit(name, ":", *filenamesof(outs + deps)) def main(): diff --git a/build/ack.py b/build/ack.py index e0ce42fcf6..a579ae5e31 100644 --- a/build/ack.py +++ b/build/ack.py @@ -1,5 +1,5 @@ from build.toolchain import Toolchain -from build.c import cfile +from build.c import cfile, clibrary class AckToolchain(Toolchain): @@ -8,9 +8,19 @@ class AckToolchain(Toolchain): def ackcfile(name, plat=None, **kwargs): + assert plat kwargs["deps"] = kwargs.get("deps", []) + [ f"plat/{plat}+tools", "util/ack+all", ] kwargs["args"] = kwargs.get("args", {}) | {"plat": plat} cfile(name=name, toolchain=AckToolchain, **kwargs) + +def ackclibrary(name, plat=None, **kwargs): + assert plat + kwargs["deps"] = kwargs.get("deps", []) + [ + f"plat/{plat}+tools", + "util/ack+all", + ] + kwargs["args"] = kwargs.get("args", {}) | {"plat": plat} + clibrary(name=name, toolchain=AckToolchain, **kwargs) diff --git a/build/c.py b/build/c.py index a8f89cd06d..973269006e 100644 --- a/build/c.py +++ b/build/c.py @@ -150,7 +150,7 @@ def _removeprefix(self, prefix): return self[:] -def findsources(name, srcs, deps, cflags, filerule, toolchain, cwd): +def findsources(self, srcs, deps, cflags, filerule, toolchain, cwd): for f in filenamesof(srcs): if not is_source_file(f): cflags = cflags + [f"-I{dirname(f)}"] @@ -160,12 +160,13 @@ def findsources(name, srcs, deps, cflags, filerule, toolchain, cwd): for s in flatten(srcs): objs += [ filerule( - name=join(name, _removeprefix(f, "$(OBJ)/")), + name=join(self.localname, _removeprefix(f, "$(OBJ)/")), srcs=[f], deps=deps, cflags=sorted(set(cflags)), toolchain=toolchain, cwd=cwd, + args=getattr(self, "explicit_args", {}), ) for f in filenamesof([s]) if is_source_file(f) @@ -224,7 +225,7 @@ def libraryimpl( if srcs: objs = findsources( - self.localname, + self, srcs, deps + ([hr] if hr else []), cflags + hf, @@ -393,7 +394,7 @@ def programimpl( filerule, ): cfiles = findsources( - self.localname, srcs, deps, cflags, filerule, toolchain, self.cwd + self, srcs, deps, cflags, filerule, toolchain, self.cwd ) lib_deps = [] diff --git a/build/d.py b/build/d.py deleted file mode 100644 index 3d3f43049e..0000000000 --- a/build/d.py +++ /dev/null @@ -1,82 +0,0 @@ -from build.ab import ( - Rule, - Targets, - TargetsMap, - filenameof, - filenamesof, - flatten, - simplerule, - emit, -) -from build.utils import filenamesmatchingof, stripext, collectattrs -from build.toolchain import Toolchain, HostToolchain -from os.path import * - -Toolchain.DMD = [ - "$(DMD) -of $[outs[0]] $[ins[0]] $(DFLAGS) $(DLINKFLAGS) $[dflags] $[dlinkflags]" -] -Toolchain.DMDLIB = [ - "$(DMD) -lib -of $[outs[0]] -Hd $[dir] $[ins] $(DFLAGS) $[dflags]" -] - -Toolchain.HOSTDMD = [ - "$(HOSTDMD) -of $[outs[0]] $[ins[0]] $(HOSTDFLAGS) $(HOSTDLINKFLAGS) $[dflags] $[dlinkflags]" -] -Toolchain.HOSTDMDLIB = [ - "$(HOSTDMD) -lib -of $[outs[0]] -Hf $[outs[1]] $[ins] $(HOSTDFLAGS) $[dflags]" -] - - -def _combine(list1, list2): - r = list(list1) - for i in list2: - if i not in r: - r.append(i) - return r - - -def _indirect(deps, name): - r = [] - for d in deps: - r = _combine(r, d.args.get(name, [d])) - return r - - -@Rule -def dlibrary( - self, - name, - srcs: Targets = None, - deps: Targets = None, - dflags=[], - toolchain=Toolchain, - label="DMDLIB", -): - simplerule( - replaces=self, - ins=srcs + deps, - outs=[f"={self.localname}.a", f"={self.localname}.di"], - commands=toolchain.DMDLIB, - label=label, - ) - - -@Rule -def dprogram( - self, - name, - srcs: Targets = None, - deps: Targets = None, - dflags=[], - dlinkflags=[], - toolchain=Toolchain, - label="DMD", -): - simplerule( - replaces=self, - ins=srcs + deps, - outs=[f"={self.localname}"], - deps=deps, - commands=toolchain.DMD, - label=label, - ) diff --git a/lang/cem/cemcom.ansi/build.py b/lang/cem/cemcom.ansi/build.py index 7ccd28b155..91b1005a49 100644 --- a/lang/cem/cemcom.ansi/build.py +++ b/lang/cem/cemcom.ansi/build.py @@ -95,8 +95,8 @@ cprogram( name="cemcom", srcs=( - glob("lang/cem/cemcom-ansi/*.c") - + glob("lang/cem/cemcom-ansi/*.h") + glob("lang/cem/cemcom.ansi/*.c") + + glob("lang/cem/cemcom.ansi/*.h") + strtargets + [".+parameters", ".+llgen", ".+next-c", ".+symbol2str-c", ".+tabgen"] ), diff --git a/lang/cem/cemcom.ansi/cemcom-ansi/build.py b/lang/cem/cemcom.ansi/cemcom-ansi/build.py deleted file mode 100644 index 7ccd28b155..0000000000 --- a/lang/cem/cemcom.ansi/cemcom-ansi/build.py +++ /dev/null @@ -1,119 +0,0 @@ -from build.ab import export, simplerule -from build.c import cprogram -from glob import glob -from util.LLgen.build import llgen -from util.cmisc.build import tabgen - -str_roots = [ - "code", - "declar", - "def", - "estack", - "expr", - "field", - "idf", - "l_brace", - "l_outdef", - "l_state", - "macro", - "next", - "proto", - "stack", - "stmt", - "struct", - "switch", - "type", - "util", -] - -simplerule( - name="parameters", - ins=["./BigPars"], - outs=["=parameters.h"], - commands=[ - "echo '#ifndef PARAMETERS_H' > $[outs]", - "echo '#define PARAMETERS_H' >> $[outs]", - "grep -v '^!' < $[ins] >> $[outs]", - "echo '#endif' >> $[outs]", - ], -) - -strtargets = [ - simplerule( - name=f"allocd_{str}", - ins=["./make.allocd", f"./{str}.str"], - outs=[f"={str}.h"], - commands=["$[ins[0]] < $[ins[1]] > $[outs]"], - ) - for str in str_roots -] - -simplerule( - name="next-c", - ins=[ - "./make.next", - ] - + [f"./{k}.str" for k in str_roots], - outs=["=next.c"], - commands=["$[ins] > $[outs]"], -) - -simplerule( - name="tokenfile-g", - ins=[ - "./make.tokfile", - "./tokenname.c", - ], - outs=["=tokenfile.g"], - commands=["sh $[ins[0]] < $[ins[1]] > $[outs]"], -) - -simplerule( - name="symbol2str-c", - ins=[ - "./make.tokcase", - "./tokenname.c", - ], - outs=["=symbol2str.c"], - commands=["sh $[ins[0]] < $[ins[1]] > $[outs]"], -) - -llgen( - name="llgen", - srcs=[ - ".+tokenfile-g", # must be first - "./declar.g", - "./expression.g", - "./ival.g", - "./program.g", - "./statement.g", - ], -) - -tabgen(name="tabgen", src="./char.tab") - -cprogram( - name="cemcom", - srcs=( - glob("lang/cem/cemcom-ansi/*.c") - + glob("lang/cem/cemcom-ansi/*.h") - + strtargets - + [".+parameters", ".+llgen", ".+next-c", ".+symbol2str-c", ".+tabgen"] - ), - deps=[ - "h", - "modules/h", - "modules/src/system", - "modules/src/alloc", - "modules/src/em_code+lib_k", - "modules/src/em_data", - "modules/src/em_mes", - "modules/src/flt_arith", - "modules/src/idf", - "modules/src/input", - "modules/src/string", - "modules/src/system", - ], -) - -export(name="all", items={"$(PLATDEP)/em_cemcom.ansi": ".+cemcom"}) diff --git a/lang/cem/libcc.ansi/build.py b/lang/cem/libcc.ansi/build.py new file mode 100644 index 0000000000..b76a3409e7 --- /dev/null +++ b/lang/cem/libcc.ansi/build.py @@ -0,0 +1,173 @@ +from build import PLATS +from build.ack import ackclibrary + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + plat=plat, + srcs=[ + "./core/ctype/tolower.c", + "./core/ctype/toupper.c", + "./core/errno/errlist.c", + "./core/errno/perror.c", + "./core/errno/strerror.c", + "./core/locale/localeconv.c", + "./core/locale/setlocale.c", + "./core/math/asin.c", + "./core/math/atan2.c", + "./core/math/atan.c", + "./core/math/ceil.c", + "./core/math/exp.c", + "./core/math/fabs.c", + "./core/math/floor.c", + "./core/math/fmod.c", + "./core/math/frexp.e", + "./core/math/hugeval.c", + "./core/math/hypot.c", + "./core/math/isnan.c", + "./core/math/ldexp.c", + "./core/math/localmath.h", + "./core/math/log10.c", + "./core/math/log.c", + "./core/math/modf.e", + "./core/math/pow.c", + "./core/math/sin.c", + "./core/math/sinh.c", + "./core/math/sqrt.c", + "./core/math/tan.c", + "./core/math/tanh.c", + "./core/misc/abort.c", + "./core/misc/assert.c", + "./core/misc/getopt.c", + "./core/misc/raise.c", + "./core/misc/termcap.c", + "./core/printf/doprnt.c", + "./core/printf/doprnt.h", + "./core/printf/fltpr.c", + "./core/printf/fprintf.c", + "./core/printf/icompute.c", + "./core/printf/itoa.c", + "./core/printf/printf.c", + "./core/printf/snprintf.c", + "./core/printf/sprintf.c", + "./core/printf/vfprintf.c", + "./core/printf/vprintf.c", + "./core/printf/vsnprintf.c", + "./core/printf/vsprintf.c", + "./core/scanf/doscan.c", + "./core/scanf/doscan.h", + "./core/scanf/fscanf.c", + "./core/scanf/scanf.c", + "./core/scanf/sscanf.c", + "./core/scanf/vfscanf.c", + "./core/setjmp/setjmp.e", + "./core/setjmp/sigmisc.c", + "./core/stdio/clearerr.c", + "./core/stdio/feof.c", + "./core/stdio/ferror.c", + "./core/stdio/fgetc.c", + "./core/stdio/fgetpos.c", + "./core/stdio/fgets.c", + "./core/stdio/fputc.c", + "./core/stdio/fputs.c", + "./core/stdio/fread.c", + "./core/stdio/fsetpos.c", + "./core/stdio/fwrite.c", + "./core/stdio/getc.c", + "./core/stdio/getchar.c", + "./core/stdio/gets.c", + "./core/stdio/getw.c", + "./core/stdio/putc.c", + "./core/stdio/putchar.c", + "./core/stdio/puts.c", + "./core/stdio/putw.c", + "./core/stdio/rewind.c", + "./core/stdlib/abs.c", + "./core/stdlib/atof.c", + "./core/stdlib/atoi.c", + "./core/stdlib/atol.c", + "./core/stdlib/bsearch.c", + "./core/stdlib/div.c", + "./core/stdlib/ecvt.c", + "./core/stdlib/environ.c", + "./core/stdlib/ext_comp.c", + "./core/stdlib/ext_fmt.h", + "./core/stdlib/getenv.c", + "./core/stdlib/labs.c", + "./core/stdlib/ldiv.c", + "./core/stdlib/mblen.c", + "./core/stdlib/mbstowcs.c", + "./core/stdlib/mbtowc.c", + "./core/stdlib/putenv.c", + "./core/stdlib/qsort.c", + "./core/stdlib/rand.c", + "./core/stdlib/setenv.c", + "./core/stdlib/strtod.c", + "./core/stdlib/strtol.c", + "./core/stdlib/wcstombs.c", + "./core/stdlib/wctomb.c", + "./core/string/memchr.c", + "./core/string/memcmp.c", + "./core/string/memcpy.c", + "./core/string/memmove.c", + "./core/string/memset.c", + "./core/string/strcat.c", + "./core/string/strchr.c", + "./core/string/strcmp.c", + "./core/string/strcoll.c", + "./core/string/strcpy.c", + "./core/string/strcspn.c", + "./core/string/strdup.c", + "./core/string/strlen.c", + "./core/string/strncat.c", + "./core/string/strncmp.c", + "./core/string/strncpy.c", + "./core/string/strpbrk.c", + "./core/string/strrchr.c", + "./core/string/strspn.c", + "./core/string/strstr.c", + "./core/string/strtok.c", + "./core/string/strxfrm.c", + "./core/time/asctime.c", + "./core/time/ctime.c", + "./core/time/difftime.c", + "./core/time/gmtime.c", + "./core/time/localtime.c", + "./core/time/loc_time.h", + "./core/time/misc.c", + "./core/time/mktime.c", + "./core/time/strftime.c", + "./core/time/tzset.c", + "./sys/exit/atexit.c", + "./sys/exit/atexits.h", + "./sys/exit/exit.c", + "./sys/malloc/calloc.c", + "./sys/malloc/malloc.c", + "./sys/malloc/malloc.h", + "./sys/malloc/realloc.c", + "./sys/misc/clock.c", + "./sys/misc/getpass.c", + "./sys/misc/isatty.c", + "./sys/misc/mktemp.c", + "./sys/misc/popen.c", + "./sys/misc/remove.c", + "./sys/misc/sleep.c", + "./sys/misc/system.c", + "./sys/misc/time.c", + "./sys/stdio/data.c", + "./sys/stdio/fclose.c", + "./sys/stdio/fdopen.c", + "./sys/stdio/fflush.c", + "./sys/stdio/fileno.c", + "./sys/stdio/fillbuf.c", + "./sys/stdio/flushbuf.c", + "./sys/stdio/fopen.c", + "./sys/stdio/freopen.c", + "./sys/stdio/fseek.c", + "./sys/stdio/ftell.c", + "./sys/stdio/setbuf.c", + "./sys/stdio/setvbuf.c", + "./sys/stdio/tmpfile.c", + "./sys/stdio/tmpnam.c", + "./sys/stdio/ungetc.c", + ]) diff --git a/mach/i86/libem/build.py b/mach/i86/libem/build.py new file mode 100644 index 0000000000..94f367c31b --- /dev/null +++ b/mach/i86/libem/build.py @@ -0,0 +1,69 @@ +from build import PLATS +from build.ack import ackclibrary + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=[ + "./adi.s", + "./and.s", + "./blm.s", + "./cii.s", + "./cmi4.s", + "./cms.s", + "./cmu4.s", + "./com.s", + "./csa2.s", + "./csa4.s", + "./csb2.s", + "./csb4.s", + "./cuu.s", + "./dup.s", + "./dvi4.s", + "./dvi.s", + "./dvu4.s", + "./dvu.s", + "./error.s", + "./exg.s", + "./fat.s", + "./fp8087.s", + "./gto.s", + "./iaar.s", + "./ilar.s", + "./inn.s", + "./ior.s", + "./isar.s", + "./lar2.s", + "./lfr6.s", + "./lfr8.s", + "./loi.s", + "./mli4.s", + "./mli.s", + "./mon.s", + "./ngi.s", + "./nop.s", + "./print.s", + "./rck.s", + "./ret6.s", + "./ret8.s", + "./retarea.s", + "./return.s", + "./rmi4.s", + "./rmi.s", + "./rmu4.s", + "./rmu.s", + "./rol.s", + "./ror.s", + "./sar2.s", + "./sbi.s", + "./set.s", + "./sli.s", + "./sri.s", + "./sti.s", + "./strhp.s", + "./trp.s", + "./unknown.s", + "./xor.s", + ], + plat=plat, + ) diff --git a/mach/i86/libend/build.py b/mach/i86/libend/build.py new file mode 100644 index 0000000000..cdeeb03cb8 --- /dev/null +++ b/mach/i86/libend/build.py @@ -0,0 +1,14 @@ +from build import PLATS +from build.ack import ackclibrary + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=[ + "./edata.s", + "./em_end.s", + "./end.s", + "./etext.s", + ], + plat=plat, + ) diff --git a/plat/build.py b/plat/build.py new file mode 100644 index 0000000000..75167d5d46 --- /dev/null +++ b/plat/build.py @@ -0,0 +1,13 @@ +from build.ab import Rule, simplerule, export + + +@Rule +def build_plat_libs(self, name, arch, plat, is_em=False): + export( + replaces=self, + items={ + f"$(PLATIND)/{plat}/libc.a": f"lang/cem/libcc.ansi+lib_{plat}", + f"$(PLATIND)/{plat}/libend.a": f"mach/{arch}/libend+lib_{plat}", + f"$(PLATIND)/{plat}/libem.a": f"mach/{arch}/libem+lib_{plat}", + }, + ) diff --git a/plat/pc86/build.py b/plat/pc86/build.py index 33eb7489fe..2bb9ead70f 100644 --- a/plat/pc86/build.py +++ b/plat/pc86/build.py @@ -1,12 +1,14 @@ from build.ab import export from build.ack import ackcfile from mach.proto.ncg.build import build_ncg +from plat.build import build_plat_libs import importlib -asm = importlib.import_module("mach.proto.as.build") +build_as = importlib.import_module("mach.proto.as.build").build_as -asm.build_as(name="as", arch="i86") +build_as(name="as", arch="i86") build_ncg(name="ncg", arch="i86") +build_plat_libs(name="plat_libs", arch="i86", plat="pc86") ackcfile(name="boot", srcs=["./boot.s"], plat="pc86") @@ -24,5 +26,5 @@ items={ "$(PLATIND)/pc86/boot.o": ".+boot", }, - deps=[".+tools", "util/ack+all"], + deps=[".+tools", ".+plat_libs", "util/ack+all"], ) From ed667efbeaa4d410c02476b4c4dcbe788b5586fd Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 17:53:41 +0100 Subject: [PATCH 07/79] Realise that I was actually compiling with the system ack and not the one in the build tree; fix this, and add in a lot of missing infrastructure. --- build.py | 7 +- build/ab.py | 19 +- build/ack.py | 15 +- h/build.py | 1 + lang/cem/cpp.ansi/build.py | 86 ++++++ lang/cem/libcc.ansi/build.py | 376 +++++++++++++++------------ lang/cem/libcc.ansi/headers/build.py | 6 + mach/i86/libem/build.py | 118 ++++----- modules/src/em_code/build.py | 19 +- modules/src/read_em/build.py | 62 +++++ plat/build.py | 4 +- plat/pc86/include/build.py | 6 + util/misc/build.py | 40 +++ util/opt/build.py | 90 +++++++ util/opt/scan.l | 2 +- 15 files changed, 603 insertions(+), 248 deletions(-) create mode 100644 lang/cem/cpp.ansi/build.py create mode 100644 lang/cem/libcc.ansi/headers/build.py create mode 100644 modules/src/read_em/build.py create mode 100644 plat/pc86/include/build.py create mode 100644 util/misc/build.py create mode 100644 util/opt/build.py diff --git a/build.py b/build.py index 5d227647ee..70e68c31a6 100644 --- a/build.py +++ b/build.py @@ -1,17 +1,18 @@ from build.ab import export -PLATS=[ - "pc86" -] +PLATS = ["pc86"] export( name="common", deps=[ "util/ack+all", "lang/cem/cemcom.ansi+all", + "lang/cem/cpp.ansi+all", "util/amisc+all", + "util/misc+all", "util/arch+all", "util/led+all", + "util/opt+all", ], ) diff --git a/build/ab.py b/build/ab.py index 78fb0d7beb..f4a36047c6 100644 --- a/build/ab.py +++ b/build/ab.py @@ -409,15 +409,16 @@ def _removesuffix(self, suffix): def loadbuildfile(filename): modulename = _removesuffix(filename.replace("/", "."), ".py") - spec = importlib.util.spec_from_file_location( - name=modulename, - location=filename, - loader=BuildFileLoaderImpl(fullname=modulename, path=filename), - submodule_search_locations=[], - ) - module = importlib.util.module_from_spec(spec) - sys.modules[modulename] = module - spec.loader.exec_module(module) + if modulename not in sys.modules: + spec = importlib.util.spec_from_file_location( + name=modulename, + location=filename, + loader=BuildFileLoaderImpl(fullname=modulename, path=filename), + submodule_search_locations=[], + ) + module = importlib.util.module_from_spec(spec) + sys.modules[modulename] = module + spec.loader.exec_module(module) def flatten(items): diff --git a/build/ack.py b/build/ack.py index a579ae5e31..00732fdf2f 100644 --- a/build/ack.py +++ b/build/ack.py @@ -4,23 +4,36 @@ class AckToolchain(Toolchain): PREFIX = "ACK" - CC = ["$(INSDIR)/bin/ack $(ACKCFLAGS) -m$[plat] -c -o $[outs[0]] $[ins[0]]"] + CC = [ + "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack $(ACKCFLAGS) $[cflags] -m$[plat] -c -o $[outs[0]] $[ins[0]]" + ] def ackcfile(name, plat=None, **kwargs): assert plat kwargs["deps"] = kwargs.get("deps", []) + [ f"plat/{plat}+tools", + f"plat/{plat}/include", "util/ack+all", + "util/misc+all", + "util/opt+all", + "lang/cem/cemcom.ansi+all", + "lang/cem/cpp.ansi+all", ] kwargs["args"] = kwargs.get("args", {}) | {"plat": plat} cfile(name=name, toolchain=AckToolchain, **kwargs) + def ackclibrary(name, plat=None, **kwargs): assert plat kwargs["deps"] = kwargs.get("deps", []) + [ f"plat/{plat}+tools", + f"plat/{plat}/include", "util/ack+all", + "util/misc+all", + "util/opt+all", + "lang/cem/cemcom.ansi+all", + "lang/cem/cpp.ansi+all", ] kwargs["args"] = kwargs.get("args", {}) | {"plat": plat} clibrary(name=name, toolchain=AckToolchain, **kwargs) diff --git a/h/build.py b/h/build.py index 7c126fda4c..90a16b0383 100644 --- a/h/build.py +++ b/h/build.py @@ -31,6 +31,7 @@ "out.h", "arch.h", "ranlib.h", + "em_abs.h", "em_flag.h", "em_ptyp.h", "em_mes.h", diff --git a/lang/cem/cpp.ansi/build.py b/lang/cem/cpp.ansi/build.py new file mode 100644 index 0000000000..fcc2d487be --- /dev/null +++ b/lang/cem/cpp.ansi/build.py @@ -0,0 +1,86 @@ +from build.ab import export, simplerule +from build.c import cprogram +from glob import glob +from util.LLgen.build import llgen +from util.cmisc.build import tabgen + +str_roots = [ + "macro", + "replace", +] + +strtargets = [ + simplerule( + name=f"allocd_{str}", + ins=["./make.allocd", f"./{str}.str"], + outs=[f"={str}.h"], + commands=["$[ins[0]] < $[ins[1]] > $[outs]"], + ) + for str in str_roots +] + +simplerule( + name="next-c", + ins=[ + "./make.next", + ] + + [f"./{k}.str" for k in str_roots], + outs=["=next.c"], + commands=["$[ins] > $[outs]"], +) + +simplerule( + name="tokenfile-g", + ins=[ + "./make.tokfile", + "./tokenname.c", + ], + outs=["=tokenfile.g"], + commands=["sh $[ins[0]] < $[ins[1]] > $[outs]"], +) + +simplerule( + name="symbol2str-c", + ins=[ + "./make.tokcase", + "./tokenname.c", + ], + outs=["=symbol2str.c"], + commands=["sh $[ins[0]] < $[ins[1]] > $[outs]"], +) + +llgen( + name="llgen", + srcs=[ + ".+tokenfile-g", # must be first + "./expression.g", + ], +) + +tabgen(name="tabgen", src="./char.tab") + +cprogram( + name="cpp.ansi", + srcs=( + glob("lang/cem/cpp.ansi/*.c") + + glob("lang/cem/cpp.ansi/*.h") + + strtargets + + [".+llgen", ".+next-c", ".+symbol2str-c", ".+tabgen"] + ), + deps=[ + "h", + "modules/h", + "modules/src/system", + "modules/src/alloc", + "modules/src/em_code+lib_k", + "modules/src/em_data", + "modules/src/em_mes", + "modules/src/flt_arith", + "modules/src/idf", + "modules/src/input", + "modules/src/string", + "modules/src/system", + ], +) + +export(name="all", items={"$(PLATDEP)/cpp.ansi": ".+cpp.ansi"}) diff --git a/lang/cem/libcc.ansi/build.py b/lang/cem/libcc.ansi/build.py index b76a3409e7..3d2e7a6f91 100644 --- a/lang/cem/libcc.ansi/build.py +++ b/lang/cem/libcc.ansi/build.py @@ -1,173 +1,215 @@ from build import PLATS -from build.ack import ackclibrary +from build.ab import simplerule, export +from build.ack import ackclibrary, ackcfile +from util.cmisc.build import tabgen + +tabgen(name="ctype_tab", src="./core/ctype/char.tab") + +simplerule( + name="ctype_files", + ins=["./core/ctype/genfiles"], + outs=[ + "=isalnum.c", + "=isalpha.c", + "=isascii.c", + "=iscntrl.c", + "=isdigit.c", + "=isgraph.c", + "=islower.c", + "=isprint.c", + "=ispunct.c", + "=isspace.c", + "=isupper.c", + "=isxdigit.c", + ], + commands=["sh $[ins] $[dir]"], +) + for plat in PLATS: - ackclibrary( + crt = ackcfile( + name=f"crt_{plat}", srcs=["./head_ac.e"], plat=plat, deps=["h"] + ) + + libc = ackclibrary( name=f"lib_{plat}", plat=plat, srcs=[ - "./core/ctype/tolower.c", - "./core/ctype/toupper.c", - "./core/errno/errlist.c", - "./core/errno/perror.c", - "./core/errno/strerror.c", - "./core/locale/localeconv.c", - "./core/locale/setlocale.c", - "./core/math/asin.c", - "./core/math/atan2.c", - "./core/math/atan.c", - "./core/math/ceil.c", - "./core/math/exp.c", - "./core/math/fabs.c", - "./core/math/floor.c", - "./core/math/fmod.c", - "./core/math/frexp.e", - "./core/math/hugeval.c", - "./core/math/hypot.c", - "./core/math/isnan.c", - "./core/math/ldexp.c", - "./core/math/localmath.h", - "./core/math/log10.c", - "./core/math/log.c", - "./core/math/modf.e", - "./core/math/pow.c", - "./core/math/sin.c", - "./core/math/sinh.c", - "./core/math/sqrt.c", - "./core/math/tan.c", - "./core/math/tanh.c", - "./core/misc/abort.c", - "./core/misc/assert.c", - "./core/misc/getopt.c", - "./core/misc/raise.c", - "./core/misc/termcap.c", - "./core/printf/doprnt.c", - "./core/printf/doprnt.h", - "./core/printf/fltpr.c", - "./core/printf/fprintf.c", - "./core/printf/icompute.c", - "./core/printf/itoa.c", - "./core/printf/printf.c", - "./core/printf/snprintf.c", - "./core/printf/sprintf.c", - "./core/printf/vfprintf.c", - "./core/printf/vprintf.c", - "./core/printf/vsnprintf.c", - "./core/printf/vsprintf.c", - "./core/scanf/doscan.c", - "./core/scanf/doscan.h", - "./core/scanf/fscanf.c", - "./core/scanf/scanf.c", - "./core/scanf/sscanf.c", - "./core/scanf/vfscanf.c", - "./core/setjmp/setjmp.e", - "./core/setjmp/sigmisc.c", - "./core/stdio/clearerr.c", - "./core/stdio/feof.c", - "./core/stdio/ferror.c", - "./core/stdio/fgetc.c", - "./core/stdio/fgetpos.c", - "./core/stdio/fgets.c", - "./core/stdio/fputc.c", - "./core/stdio/fputs.c", - "./core/stdio/fread.c", - "./core/stdio/fsetpos.c", - "./core/stdio/fwrite.c", - "./core/stdio/getc.c", - "./core/stdio/getchar.c", - "./core/stdio/gets.c", - "./core/stdio/getw.c", - "./core/stdio/putc.c", - "./core/stdio/putchar.c", - "./core/stdio/puts.c", - "./core/stdio/putw.c", - "./core/stdio/rewind.c", - "./core/stdlib/abs.c", - "./core/stdlib/atof.c", - "./core/stdlib/atoi.c", - "./core/stdlib/atol.c", - "./core/stdlib/bsearch.c", - "./core/stdlib/div.c", - "./core/stdlib/ecvt.c", - "./core/stdlib/environ.c", - "./core/stdlib/ext_comp.c", - "./core/stdlib/ext_fmt.h", - "./core/stdlib/getenv.c", - "./core/stdlib/labs.c", - "./core/stdlib/ldiv.c", - "./core/stdlib/mblen.c", - "./core/stdlib/mbstowcs.c", - "./core/stdlib/mbtowc.c", - "./core/stdlib/putenv.c", - "./core/stdlib/qsort.c", - "./core/stdlib/rand.c", - "./core/stdlib/setenv.c", - "./core/stdlib/strtod.c", - "./core/stdlib/strtol.c", - "./core/stdlib/wcstombs.c", - "./core/stdlib/wctomb.c", - "./core/string/memchr.c", - "./core/string/memcmp.c", - "./core/string/memcpy.c", - "./core/string/memmove.c", - "./core/string/memset.c", - "./core/string/strcat.c", - "./core/string/strchr.c", - "./core/string/strcmp.c", - "./core/string/strcoll.c", - "./core/string/strcpy.c", - "./core/string/strcspn.c", - "./core/string/strdup.c", - "./core/string/strlen.c", - "./core/string/strncat.c", - "./core/string/strncmp.c", - "./core/string/strncpy.c", - "./core/string/strpbrk.c", - "./core/string/strrchr.c", - "./core/string/strspn.c", - "./core/string/strstr.c", - "./core/string/strtok.c", - "./core/string/strxfrm.c", - "./core/time/asctime.c", - "./core/time/ctime.c", - "./core/time/difftime.c", - "./core/time/gmtime.c", - "./core/time/localtime.c", - "./core/time/loc_time.h", - "./core/time/misc.c", - "./core/time/mktime.c", - "./core/time/strftime.c", - "./core/time/tzset.c", - "./sys/exit/atexit.c", - "./sys/exit/atexits.h", - "./sys/exit/exit.c", - "./sys/malloc/calloc.c", - "./sys/malloc/malloc.c", - "./sys/malloc/malloc.h", - "./sys/malloc/realloc.c", - "./sys/misc/clock.c", - "./sys/misc/getpass.c", - "./sys/misc/isatty.c", - "./sys/misc/mktemp.c", - "./sys/misc/popen.c", - "./sys/misc/remove.c", - "./sys/misc/sleep.c", - "./sys/misc/system.c", - "./sys/misc/time.c", - "./sys/stdio/data.c", - "./sys/stdio/fclose.c", - "./sys/stdio/fdopen.c", - "./sys/stdio/fflush.c", - "./sys/stdio/fileno.c", - "./sys/stdio/fillbuf.c", - "./sys/stdio/flushbuf.c", - "./sys/stdio/fopen.c", - "./sys/stdio/freopen.c", - "./sys/stdio/fseek.c", - "./sys/stdio/ftell.c", - "./sys/stdio/setbuf.c", - "./sys/stdio/setvbuf.c", - "./sys/stdio/tmpfile.c", - "./sys/stdio/tmpnam.c", - "./sys/stdio/ungetc.c", - ]) + ".+ctype_tab", + ".+ctype_files", + "./core/ctype/tolower.c", + "./core/ctype/toupper.c", + "./core/errno/errlist.c", + "./core/errno/perror.c", + "./core/errno/strerror.c", + "./core/locale/localeconv.c", + "./core/locale/setlocale.c", + "./core/math/asin.c", + "./core/math/atan2.c", + "./core/math/atan.c", + "./core/math/ceil.c", + "./core/math/exp.c", + "./core/math/fabs.c", + "./core/math/floor.c", + "./core/math/fmod.c", + "./core/math/frexp.e", + "./core/math/hugeval.c", + "./core/math/hypot.c", + "./core/math/isnan.c", + "./core/math/ldexp.c", + "./core/math/localmath.h", + "./core/math/log10.c", + "./core/math/log.c", + "./core/math/modf.e", + "./core/math/pow.c", + "./core/math/sin.c", + "./core/math/sinh.c", + "./core/math/sqrt.c", + "./core/math/tan.c", + "./core/math/tanh.c", + "./core/misc/abort.c", + "./core/misc/assert.c", + "./core/misc/getopt.c", + "./core/misc/raise.c", + "./core/misc/termcap.c", + "./core/printf/doprnt.c", + "./core/printf/doprnt.h", + "./core/printf/fltpr.c", + "./core/printf/fprintf.c", + "./core/printf/icompute.c", + "./core/printf/itoa.c", + "./core/printf/printf.c", + "./core/printf/snprintf.c", + "./core/printf/sprintf.c", + "./core/printf/vfprintf.c", + "./core/printf/vprintf.c", + "./core/printf/vsnprintf.c", + "./core/printf/vsprintf.c", + "./core/scanf/doscan.c", + "./core/scanf/doscan.h", + "./core/scanf/fscanf.c", + "./core/scanf/scanf.c", + "./core/scanf/sscanf.c", + "./core/scanf/vfscanf.c", + "./core/setjmp/setjmp.e", + "./core/setjmp/sigmisc.c", + "./core/stdio/clearerr.c", + "./core/stdio/feof.c", + "./core/stdio/ferror.c", + "./core/stdio/fgetc.c", + "./core/stdio/fgetpos.c", + "./core/stdio/fgets.c", + "./core/stdio/fputc.c", + "./core/stdio/fputs.c", + "./core/stdio/fread.c", + "./core/stdio/fsetpos.c", + "./core/stdio/fwrite.c", + "./core/stdio/getc.c", + "./core/stdio/getchar.c", + "./core/stdio/gets.c", + "./core/stdio/getw.c", + "./core/stdio/putc.c", + "./core/stdio/putchar.c", + "./core/stdio/puts.c", + "./core/stdio/putw.c", + "./core/stdio/rewind.c", + "./core/stdlib/abs.c", + "./core/stdlib/atof.c", + "./core/stdlib/atoi.c", + "./core/stdlib/atol.c", + "./core/stdlib/bsearch.c", + "./core/stdlib/div.c", + "./core/stdlib/ecvt.c", + "./core/stdlib/environ.c", + "./core/stdlib/ext_comp.c", + "./core/stdlib/ext_fmt.h", + "./core/stdlib/getenv.c", + "./core/stdlib/labs.c", + "./core/stdlib/ldiv.c", + "./core/stdlib/mblen.c", + "./core/stdlib/mbstowcs.c", + "./core/stdlib/mbtowc.c", + "./core/stdlib/putenv.c", + "./core/stdlib/qsort.c", + "./core/stdlib/rand.c", + "./core/stdlib/setenv.c", + "./core/stdlib/strtod.c", + "./core/stdlib/strtol.c", + "./core/stdlib/wcstombs.c", + "./core/stdlib/wctomb.c", + "./core/string/memchr.c", + "./core/string/memcmp.c", + "./core/string/memcpy.c", + "./core/string/memmove.c", + "./core/string/memset.c", + "./core/string/strcat.c", + "./core/string/strchr.c", + "./core/string/strcmp.c", + "./core/string/strcoll.c", + "./core/string/strcpy.c", + "./core/string/strcspn.c", + "./core/string/strdup.c", + "./core/string/strlen.c", + "./core/string/strncat.c", + "./core/string/strncmp.c", + "./core/string/strncpy.c", + "./core/string/strpbrk.c", + "./core/string/strrchr.c", + "./core/string/strspn.c", + "./core/string/strstr.c", + "./core/string/strtok.c", + "./core/string/strxfrm.c", + "./core/time/asctime.c", + "./core/time/ctime.c", + "./core/time/difftime.c", + "./core/time/gmtime.c", + "./core/time/localtime.c", + "./core/time/loc_time.h", + "./core/time/misc.c", + "./core/time/mktime.c", + "./core/time/strftime.c", + "./core/time/tzset.c", + "./sys/exit/atexit.c", + "./sys/exit/atexits.h", + "./sys/exit/exit.c", + "./sys/malloc/calloc.c", + "./sys/malloc/malloc.c", + "./sys/malloc/malloc.h", + "./sys/malloc/realloc.c", + "./sys/misc/clock.c", + "./sys/misc/getpass.c", + "./sys/misc/isatty.c", + "./sys/misc/mktemp.c", + "./sys/misc/popen.c", + "./sys/misc/remove.c", + "./sys/misc/sleep.c", + "./sys/misc/system.c", + "./sys/misc/time.c", + "./sys/stdio/data.c", + "./sys/stdio/fclose.c", + "./sys/stdio/fdopen.c", + "./sys/stdio/fflush.c", + "./sys/stdio/fileno.c", + "./sys/stdio/fillbuf.c", + "./sys/stdio/flushbuf.c", + "./sys/stdio/fopen.c", + "./sys/stdio/freopen.c", + "./sys/stdio/fseek.c", + "./sys/stdio/ftell.c", + "./sys/stdio/setbuf.c", + "./sys/stdio/setvbuf.c", + "./sys/stdio/tmpfile.c", + "./sys/stdio/tmpnam.c", + "./sys/stdio/ungetc.c", + ], + deps=["lang/cem/libcc.ansi/headers"], + ) + + suffix = "k" + export( + name=f"all_{plat}", + items={ + f"$(PLATIND)/lib/{plat}/libc.a": f".+lib_{plat}", + f"$(PLATIND)/{plat}/c-ansi.{suffix}": f".+crt_{plat}", + }, + ) diff --git a/lang/cem/libcc.ansi/headers/build.py b/lang/cem/libcc.ansi/headers/build.py new file mode 100644 index 0000000000..765519c5d3 --- /dev/null +++ b/lang/cem/libcc.ansi/headers/build.py @@ -0,0 +1,6 @@ +from build.c import clibrary +from glob import glob + +headers = glob("**/*.h", root_dir="lang/cem/libcc.ansi/headers", recursive=True) + +clibrary(name="headers", hdrs={k: f"./{k}" for k in headers}) diff --git a/mach/i86/libem/build.py b/mach/i86/libem/build.py index 94f367c31b..68899c7089 100644 --- a/mach/i86/libem/build.py +++ b/mach/i86/libem/build.py @@ -5,65 +5,65 @@ ackclibrary( name=f"lib_{plat}", srcs=[ - "./adi.s", - "./and.s", - "./blm.s", - "./cii.s", - "./cmi4.s", - "./cms.s", - "./cmu4.s", - "./com.s", - "./csa2.s", - "./csa4.s", - "./csb2.s", - "./csb4.s", - "./cuu.s", - "./dup.s", - "./dvi4.s", - "./dvi.s", - "./dvu4.s", - "./dvu.s", - "./error.s", - "./exg.s", - "./fat.s", - "./fp8087.s", - "./gto.s", - "./iaar.s", - "./ilar.s", - "./inn.s", - "./ior.s", - "./isar.s", - "./lar2.s", - "./lfr6.s", - "./lfr8.s", - "./loi.s", - "./mli4.s", - "./mli.s", - "./mon.s", - "./ngi.s", - "./nop.s", - "./print.s", - "./rck.s", - "./ret6.s", - "./ret8.s", - "./retarea.s", - "./return.s", - "./rmi4.s", - "./rmi.s", - "./rmu4.s", - "./rmu.s", - "./rol.s", - "./ror.s", - "./sar2.s", - "./sbi.s", - "./set.s", - "./sli.s", - "./sri.s", - "./sti.s", - "./strhp.s", - "./trp.s", - "./unknown.s", - "./xor.s", + "./adi.s", + "./and.s", + "./blm.s", + "./cii.s", + "./cmi4.s", + "./cms.s", + "./cmu4.s", + "./com.s", + "./csa2.s", + "./csa4.s", + "./csb2.s", + "./csb4.s", + "./cuu.s", + "./dup.s", + "./dvi4.s", + "./dvi.s", + "./dvu4.s", + "./dvu.s", + "./error.s", + "./exg.s", + "./fat.s", + "./fp8087.s", + "./gto.s", + "./iaar.s", + "./ilar.s", + "./inn.s", + "./ior.s", + "./isar.s", + "./lar2.s", + "./lfr6.s", + "./lfr8.s", + "./loi.s", + "./mli4.s", + "./mli.s", + "./mon.s", + "./ngi.s", + "./nop.s", + "./print.s", + "./rck.s", + "./ret6.s", + "./ret8.s", + "./retarea.s", + "./return.s", + "./rmi4.s", + "./rmi.s", + "./rmu4.s", + "./rmu.s", + "./rol.s", + "./ror.s", + "./sar2.s", + "./sbi.s", + "./set.s", + "./sli.s", + "./sri.s", + "./sti.s", + "./strhp.s", + "./trp.s", + "./unknown.s", + "./xor.s", ], plat=plat, ) diff --git a/modules/src/em_code/build.py b/modules/src/em_code/build.py index 61f02fa749..753747e809 100644 --- a/modules/src/em_code/build.py +++ b/modules/src/em_code/build.py @@ -18,6 +18,17 @@ ], ) +clibrary( + name="headers", + hdrs={ + "em_private.h": "./em_private.h", + "em_code.h": "./em_code.h", + "em_codeCE.h": "./em_codeCE.h", + "em_codeO.h": "./em_codeO.h", + "em_codeEK.h": ".+em_codeek_h", + }, +) + def build_variant(name, cflags): clibrary( @@ -76,14 +87,8 @@ def build_variant(name, cflags): "./ucon.c", "modules/src/read_em/em_comp.h", ], - hdrs={ - "em_private.h": "./em_private.h", - "em_code.h": "./em_code.h", - "em_codeCE.h": "./em_codeCE.h", - "em_codeO.h": "./em_codeO.h", - "em_codeEK.h": ".+em_codeek_h", - }, deps=[ + ".+headers", "h", "modules/h", "modules/src/em_data", diff --git a/modules/src/read_em/build.py b/modules/src/read_em/build.py new file mode 100644 index 0000000000..07632b7005 --- /dev/null +++ b/modules/src/read_em/build.py @@ -0,0 +1,62 @@ +from build.ab import simplerule +from build.c import clibrary + +simplerule( + name="c_mnem_narg_h", + ins=[ + "./make_C_mnem_narg_h.lua", + "h/em_table_lib.lua", + "h/em_table", + ], + outs=["=C_mnem_narg.h"], + commands=["$(LUA) $[ins[0]] < $[ins[2]] > $[outs]"], +) + +simplerule( + name="c_mnem_h", + ins=[ + "./make_C_mnem_h.lua", + "h/em_table_lib.lua", + "h/em_table", + ], + outs=["=C_mnem.h"], + commands=["$(LUA) $[ins[0]] < $[ins[2]] > $[outs]"], +) + + +def build_variant(name, cflags): + clibrary( + name=name, + cflags=( + cflags + + [ + "-DPRIVATE=static", + "-DEXPORT=", + "-DNDEBUG", + "-DCHECKING", + ] + ), + srcs=[ + ".+c_mnem_narg_h", + ".+c_mnem_h", + "./EM_vars.c", + "./read_em.c", + "./mkcalls.c", + ], + hdrs={"em_comp.h": "./em_comp.h"}, + deps=[ + "./reade.c", + "./readk.c", + "h", + "modules/h", + "modules/src/alloc", + "modules/src/em_code+headers", + "modules/src/em_data", + "modules/src/string", + "modules/src/system", + ], + ) + + +build_variant("lib_ev", []) +build_variant("lib_kv", ["-DCOMPACT"]) diff --git a/plat/build.py b/plat/build.py index 75167d5d46..0007cf85ff 100644 --- a/plat/build.py +++ b/plat/build.py @@ -6,8 +6,10 @@ def build_plat_libs(self, name, arch, plat, is_em=False): export( replaces=self, items={ - f"$(PLATIND)/{plat}/libc.a": f"lang/cem/libcc.ansi+lib_{plat}", f"$(PLATIND)/{plat}/libend.a": f"mach/{arch}/libend+lib_{plat}", f"$(PLATIND)/{plat}/libem.a": f"mach/{arch}/libem+lib_{plat}", }, + deps=[ + f"lang/cem/libcc.ansi+all_{plat}", + ], ) diff --git a/plat/pc86/include/build.py b/plat/pc86/include/build.py new file mode 100644 index 0000000000..9e0486cf7f --- /dev/null +++ b/plat/pc86/include/build.py @@ -0,0 +1,6 @@ +from build.c import clibrary +from glob import glob + +headers = glob("**/*.h", root_dir="plat/pc86/include", recursive=True) + +clibrary(name="include", hdrs={k: f"./{k}" for k in headers}) diff --git a/util/misc/build.py b/util/misc/build.py new file mode 100644 index 0000000000..bef292a8ed --- /dev/null +++ b/util/misc/build.py @@ -0,0 +1,40 @@ +from build.ab import export +from build.c import cprogram + +cprogram( + name="em_encode", + srcs=["./convert.c"], + deps=[ + "h", + "modules/h", + "modules/src/alloc", + "modules/src/em_code+lib_k", + "modules/src/read_em+lib_ev", + "modules/src/string", + "modules/src/system", + "modules/src/em_data", + ], +) + +cprogram( + name="em_decode", + srcs=["./convert.c"], + deps=[ + "h", + "modules/h", + "modules/src/alloc", + "modules/src/em_code+lib_e", + "modules/src/read_em+lib_kv", + "modules/src/string", + "modules/src/system", + "modules/src/em_data", + ], +) + +export( + name="all", + items={ + "$(PLATDEP)/em_encode": ".+em_encode", + "$(PLATDEP)/em_decode": ".+em_decode", + }, +) diff --git a/util/opt/build.py b/util/opt/build.py new file mode 100644 index 0000000000..ee3f061554 --- /dev/null +++ b/util/opt/build.py @@ -0,0 +1,90 @@ +from build.ab import export, simplerule +from build.c import cprogram, hostcprogram +from build.yacc import bison, flex +from glob import glob + +bison(name="bison", src="./mktab.y") + +flex(name="flex", src="./scan.l") + +hostcprogram( + name="mktab", + srcs=[ + ".+bison", + ".+flex", + "./param.h", + "./types.h", + "./pattern.h", + "./optim.h", + ], + deps=["modules/src/em_data"], +) + +simplerule( + name="pattern_c", + ins=[".+mktab", "./patterns", "lang/cem/cpp.ansi"], + outs=["=pattern.c"], + commands={"$[ins[2]] < $[ins[1]] | $[ins[0]] > $[outs]"}, +) + +simplerule( + name="pop_push_c", + ins=["./pop_push.awk", "h/em_table"], + outs=["=pop_push.c"], + commands=["awk -f $[ins[0]] < $[ins[1]] > $[outs]"], +) + + +def build_variant(name, cflags): + cprogram( + name=name, + srcs=[ + ".+pattern_c", + ".+pop_push_c", + "./alloc.c", + "./backward.c", + "./cleanup.c", + "./flow.c", + "./getline.c", + "./lookup.c", + "./main.c", + "./peephole.c", + "./process.c", + "./putline.c", + "./reg.c", + "./special.c", + "./tes.c", + "./util.c", + "./var.c", + "./alloc.h", + "./ext.h", + "./getline.h", + "./line.h", + "./lookup.h", + "./optim.h", + "./param.h", + "./pattern.h", + "./pop_push.h", + "./proinf.h", + "./putline.h", + "./reg.h", + "./tes.h", + "./types.h", + "./util.h", + ], + cflags=cflags, + deps=["h", "modules/h", "modules/src/em_data", "modules/src/system"], + ) + + +build_variant("em_opt", []) +build_variant("em_opt2", ["-DGLOBAL_OPT"]) + +export( + name="all", + items={ + "$(PLATDEP)/em_opt": ".+em_opt", + "$(PLATDEP)/em_opt2": ".+em_opt2", + "$(INSDIR)/share/man/man6/em_opt.6": "./em_opt.6", + }, +) diff --git a/util/opt/scan.l b/util/opt/scan.l index dc57a6a02e..0ecfef1844 100644 --- a/util/opt/scan.l +++ b/util/opt/scan.l @@ -11,7 +11,7 @@ extern int lino; extern int mlookup(char* name); extern void yyerror(const char *); -#include "y.tab.h" +#include "bison.h" %} %% From 08cd986de7be9039403227bfec801a7bd786de70 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 18:27:23 +0100 Subject: [PATCH 08/79] The Basic compiler and library builds. --- build.py | 6 ++-- build/ab.py | 1 + build/ack.py | 12 ++------ lang/basic/lib/build.py | 55 ++++++++++++++++++++++++++++++++++++ lang/basic/src/build.py | 51 +++++++++++++++++++++++++++++++++ lang/cem/libcc.ansi/build.py | 2 +- plat/build.py | 1 + 7 files changed, 115 insertions(+), 13 deletions(-) create mode 100644 lang/basic/lib/build.py create mode 100644 lang/basic/src/build.py diff --git a/build.py b/build.py index 70e68c31a6..0b6bde650a 100644 --- a/build.py +++ b/build.py @@ -2,16 +2,18 @@ PLATS = ["pc86"] +# This contains the platform-independent host tooling required to build the plats. export( name="common", deps=[ - "util/ack+all", "lang/cem/cemcom.ansi+all", "lang/cem/cpp.ansi+all", + "lang/basic/src+all", + "util/ack+all", "util/amisc+all", - "util/misc+all", "util/arch+all", "util/led+all", + "util/misc+all", "util/opt+all", ], ) diff --git a/build/ab.py b/build/ab.py index f4a36047c6..43922dbf19 100644 --- a/build/ab.py +++ b/build/ab.py @@ -444,6 +444,7 @@ def filenamesof(items): def generate(xs): for x in xs: if isinstance(x, Target): + x.materialise() yield from generate(x.outs) else: yield x diff --git a/build/ack.py b/build/ack.py index 00732fdf2f..2ce6cbb12c 100644 --- a/build/ack.py +++ b/build/ack.py @@ -14,11 +14,7 @@ def ackcfile(name, plat=None, **kwargs): kwargs["deps"] = kwargs.get("deps", []) + [ f"plat/{plat}+tools", f"plat/{plat}/include", - "util/ack+all", - "util/misc+all", - "util/opt+all", - "lang/cem/cemcom.ansi+all", - "lang/cem/cpp.ansi+all", + "+common", ] kwargs["args"] = kwargs.get("args", {}) | {"plat": plat} cfile(name=name, toolchain=AckToolchain, **kwargs) @@ -29,11 +25,7 @@ def ackclibrary(name, plat=None, **kwargs): kwargs["deps"] = kwargs.get("deps", []) + [ f"plat/{plat}+tools", f"plat/{plat}/include", - "util/ack+all", - "util/misc+all", - "util/opt+all", - "lang/cem/cemcom.ansi+all", - "lang/cem/cpp.ansi+all", + "+common", ] kwargs["args"] = kwargs.get("args", {}) | {"plat": plat} clibrary(name=name, toolchain=AckToolchain, **kwargs) diff --git a/lang/basic/lib/build.py b/lang/basic/lib/build.py new file mode 100644 index 0000000000..61a721ea92 --- /dev/null +++ b/lang/basic/lib/build.py @@ -0,0 +1,55 @@ +from build import PLATS +from build.ab import simplerule, export +from build.ack import ackclibrary, ackcfile +from util.cmisc.build import tabgen + +for plat in PLATS: + lib = ackclibrary( + name=f"lib_{plat}", + plat=plat, + srcs=[ + "./abs.c", + "./asc.c", + "./asrt.c", + "./atn.c", + "./bc_io.h", + "./chr.c", + "./conversion.c", + "./error.c", + "./exp.c", + "./fef.e", + "./fif.e", + "./file.c", + "./hlt.c", + "./io.c", + "./lib.h", + "./log.c", + "./mki.c", + "./oct.c", + "./peek.c", + "./power.c", + "./print.c", + "./random.c", + "./read.c", + "./return.c", + "./salloc.c", + "./setline.e", + "./sgn.c", + "./sin.c", + "./sqt.c", + "./stop.c", + "./string.c", + "./swap.c", + "./trace.c", + "./trap.c", + "./write.c", + ], + deps=["lang/cem/libcc.ansi/headers"], + ) + + export( + name=f"all_{plat}", + items={ + f"$(PLATIND)/{plat}/libbasic.a": f".+lib_{plat}", + }, + ) diff --git a/lang/basic/src/build.py b/lang/basic/src/build.py new file mode 100644 index 0000000000..fac8c7409a --- /dev/null +++ b/lang/basic/src/build.py @@ -0,0 +1,51 @@ +from build.ab import simplerule, export, filenamesof +from build.c import cprogram +from build.utils import filenamesmatchingof +from util.LLgen.build import llgen + +lfiles = llgen(name="llgen", srcs=["./basic.g"]) + +simplerule( + name="tokentab_h", + ins=["./maketokentab", filenamesmatchingof([lfiles], "*.h")], + outs=["=tokentab.h"], + commands=["$[ins[0]] < $[ins[1]] > $[outs]"], +) + +cprogram( + name="em_bem", + srcs=[ + ".+llgen", + ".+tokentab_h", + "./basic.lex", + "./bem.c", + "./bem.h", + "./compile.c", + "./eval.c", + "./eval.h", + "./func.c", + "./func.h", + "./gencode.c", + "./gencode.h", + "./graph.c", + "./graph.h", + "./initialize.c", + "./llmess.h", + "./parsepar.c", + "./parsepar.h", + "./symbols.c", + "./symbols.h", + "./util.c", + "./util.h", + "./yylexp.h", + ], + deps=[ + "modules/h", + "modules/src/system", + "modules/src/em_code+lib_k", + "modules/src/em_mes", + ], +) + + +export(name="all", items={"$(PLATDEP)/em_bem": ".+em_bem"}) diff --git a/lang/cem/libcc.ansi/build.py b/lang/cem/libcc.ansi/build.py index 3d2e7a6f91..49049d418a 100644 --- a/lang/cem/libcc.ansi/build.py +++ b/lang/cem/libcc.ansi/build.py @@ -209,7 +209,7 @@ export( name=f"all_{plat}", items={ - f"$(PLATIND)/lib/{plat}/libc.a": f".+lib_{plat}", + f"$(PLATIND)/{plat}/libc.a": f".+lib_{plat}", f"$(PLATIND)/{plat}/c-ansi.{suffix}": f".+crt_{plat}", }, ) diff --git a/plat/build.py b/plat/build.py index 0007cf85ff..be5d7d7a62 100644 --- a/plat/build.py +++ b/plat/build.py @@ -11,5 +11,6 @@ def build_plat_libs(self, name, arch, plat, is_em=False): }, deps=[ f"lang/cem/libcc.ansi+all_{plat}", + f"lang/basic/lib+all_{plat}", ], ) From d04fd11a9fccc123dff123abbb755e179e8f3484 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 19:44:19 +0100 Subject: [PATCH 09/79] Make the M2 compiler build. --- build.py | 1 + lang/m2/comp/build.py | 83 ++++++++++++++++++++++++++++++++++++++++ lang/m2/include/build.py | 5 +++ 3 files changed, 89 insertions(+) create mode 100644 lang/m2/comp/build.py create mode 100644 lang/m2/include/build.py diff --git a/build.py b/build.py index 0b6bde650a..2a38fb6ba4 100644 --- a/build.py +++ b/build.py @@ -9,6 +9,7 @@ "lang/cem/cemcom.ansi+all", "lang/cem/cpp.ansi+all", "lang/basic/src+all", + "lang/m2/comp+all", "util/ack+all", "util/amisc+all", "util/arch+all", diff --git a/lang/m2/comp/build.py b/lang/m2/comp/build.py new file mode 100644 index 0000000000..fa67bfa13e --- /dev/null +++ b/lang/m2/comp/build.py @@ -0,0 +1,83 @@ +from build.ab import export, simplerule +from build.c import cprogram +from glob import glob +from util.LLgen.build import llgen +from util.cmisc.build import tabgen + +simplerule( + name="parameters", + ins=["./BigPars"], + outs=["=parameters.h"], + commands=[ + "echo '#ifndef PARAMETERS_H' > $[outs]", + "echo '#define PARAMETERS_H' >> $[outs]", + "grep -v '^!' < $[ins] >> $[outs]", + "echo '#endif' >> $[outs]", + ], +) + +simplerule( + name="next-c", + ins=["./make.next"], + outs=["=next.c"], + commands=["sh $[ins] > $[outs]"], +) + +simplerule( + name="tokenfile-g", + ins=[ + "./make.tokfile", + "./tokenname.c", + ], + outs=["=tokenfile.g"], + commands=["sh $[ins[0]] < $[ins[1]] > $[outs]"], +) + +simplerule( + name="symbol2str-c", + ins=[ + "./make.tokcase", + "./tokenname.c", + ], + outs=["=symbol2str.c"], + commands=["sh $[ins[0]] < $[ins[1]] > $[outs]"], +) + +llgen( + name="llgen", + srcs=[ + ".+tokenfile-g", # must be first + "./declar.g", + "./expression.g", + "./program.g", + "./statement.g", + ], +) + +tabgen(name="tabgen", src="./char.tab") + +cprogram( + name="em_m2", + srcs=( + glob("lang/m2/comp/*.c") + + glob("lang/m2/comp/*.h") + + [".+parameters", ".+llgen", ".+next-c", ".+symbol2str-c", ".+tabgen"] + ), + deps=[ + "h", + "modules/h", + "modules/src/system", + "modules/src/alloc", + "modules/src/em_code+lib_k", + "modules/src/em_data", + "modules/src/em_mes", + "modules/src/flt_arith", + "modules/src/idf", + "modules/src/input", + "modules/src/string", + "modules/src/system", + "lang/m2/include", + ], +) + +export(name="all", items={"$(PLATDEP)/em_m2": ".+em_m2"}) diff --git a/lang/m2/include/build.py b/lang/m2/include/build.py new file mode 100644 index 0000000000..fd6b4a7d47 --- /dev/null +++ b/lang/m2/include/build.py @@ -0,0 +1,5 @@ +from build.c import clibrary + +clibrary( + name="include", hdrs={"libm2.h": "./libm2.h", "m2_traps.h": "./m2_traps.h"} +) From eb6025e6683174619c260b7936f92bc191631b95 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 19:59:29 +0100 Subject: [PATCH 10/79] The Pascal compiler builds. --- build.py | 1 + lang/pc/comp/build.py | 112 +++++++++++++++++++++++++++++++++++++++ lang/pc/include/build.py | 6 +++ 3 files changed, 119 insertions(+) create mode 100644 lang/pc/comp/build.py create mode 100644 lang/pc/include/build.py diff --git a/build.py b/build.py index 2a38fb6ba4..7ebad3486b 100644 --- a/build.py +++ b/build.py @@ -10,6 +10,7 @@ "lang/cem/cpp.ansi+all", "lang/basic/src+all", "lang/m2/comp+all", + "lang/pc/comp+all", "util/ack+all", "util/amisc+all", "util/arch+all", diff --git a/lang/pc/comp/build.py b/lang/pc/comp/build.py new file mode 100644 index 0000000000..768265fe2f --- /dev/null +++ b/lang/pc/comp/build.py @@ -0,0 +1,112 @@ +from build.ab import export, simplerule +from build.c import cprogram +from glob import glob +from util.LLgen.build import llgen +from util.cmisc.build import tabgen +from os.path import * + +simplerule( + name="parameters", + ins=["./make.parameters", "./Parameters"], + outs=["=parameters.h"], + commands=["sh $[ins[0]] < $[ins[1]] > $[outs]"], +) + +simplerule( + name="tokenfile-g", + ins=[ + "./make.tokfile", + "./tokenname.c", + ], + outs=["=tokenfile.g"], + commands=["sh $[ins[0]] < $[ins[1]] > $[outs]"], +) + +simplerule( + name="symbol2str-c", + ins=[ + "./make.tokcase", + "./tokenname.c", + ], + outs=["=symbol2str.c"], + commands=["sh $[ins[0]] < $[ins[1]] > $[outs]"], +) + +xrules = [] + +for f in ["./def.xh", "./desig.xh", "./node.xh", "./scope.xh", "./type.xh"]: + name = splitext(basename(f))[0] + xrules += [ + simplerule( + name=f"{name}_h", + ins=["./make.allocd", f], + outs=[f"={name}.h"], + commands=["$[ins[0]] < $[ins[1]] > $[outs]"], + ) + ] + +for f in ["./casestat.xc", "./tmpvar.xc"]: + name = splitext(basename(f))[0] + xrules += [ + simplerule( + name=f"{name}_c", + ins=["./make.allocd", f], + outs=[f"={name}.c"], + commands=["$[ins[0]] < $[ins[1]] > $[outs]"], + ) + ] + +simplerule( + name="next-c", + ins=( + ["./make.next"] + glob("lang/pc/comp/*.xh") + glob("lang/pc/comp/*.xc") + ), + outs=["=next.c"], + commands=["sh $[ins] > $[outs]"], +) + +llgen( + name="llgen", + srcs=[ + ".+tokenfile-g", # must be first + "./declar.g", + "./expression.g", + "./program.g", + "./statement.g", + ], +) + +tabgen(name="tabgen", src="./char.tab") + +cprogram( + name="em_pc", + srcs=( + glob("lang/pc/comp/*.c") + + glob("lang/pc/comp/*.h") + + [ + ".+parameters", + ".+llgen", + ".+next-c", + ".+symbol2str-c", + ".+tabgen", + xrules, + ] + ), + deps=[ + "h", + "modules/h", + "modules/src/system", + "modules/src/alloc", + "modules/src/em_code+lib_k", + "modules/src/em_data", + "modules/src/em_mes", + "modules/src/flt_arith", + "modules/src/idf", + "modules/src/input", + "modules/src/string", + "modules/src/system", + "lang/pc/include", + ], +) + +export(name="all", items={"$(PLATDEP)/em_pc": ".+em_pc"}) diff --git a/lang/pc/include/build.py b/lang/pc/include/build.py new file mode 100644 index 0000000000..684230bd6c --- /dev/null +++ b/lang/pc/include/build.py @@ -0,0 +1,6 @@ +from build.c import clibrary + +clibrary( + name="include", + hdrs={k: "./" + k for k in ["pc_err.h", "pc_file.h", "pc_math.h", "pc.h"]}, +) From 9bb8ae2d2f94c1c8753f8997cb304c1ba2901b59 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 20:20:11 +0100 Subject: [PATCH 11/79] The Modula-2 standard library builds. --- build/ack.py | 11 ++++ build/c.py | 26 ++++----- lang/cem/libcc.ansi/build.py | 2 +- lang/m2/libm2/build.py | 105 +++++++++++++++++++++++++++++++++++ plat/build.py | 1 + 5 files changed, 130 insertions(+), 15 deletions(-) create mode 100644 lang/m2/libm2/build.py diff --git a/build/ack.py b/build/ack.py index 2ce6cbb12c..5f436f0f99 100644 --- a/build/ack.py +++ b/build/ack.py @@ -8,6 +8,17 @@ class AckToolchain(Toolchain): "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack $(ACKCFLAGS) $[cflags] -m$[plat] -c -o $[outs[0]] $[ins[0]]" ] + def is_source_file(f): + return ( + f.endswith(".c") + or f.endswith(".S") + or f.endswith(".s") + or f.endswith(".e") + or f.endswith(".mod") + or f.endswith(".p") + or f.endswith(".b") + ) + def ackcfile(name, plat=None, **kwargs): assert plat diff --git a/build/c.py b/build/c.py index 973269006e..718a090792 100644 --- a/build/c.py +++ b/build/c.py @@ -33,6 +33,16 @@ "$(CXX) -o $[outs[0]] $(STARTGROUP) $[ins] $[ldflags] $(LDFLAGS) $(ENDGROUP)" ] +Toolchain.is_source_file = ( + lambda f: f.endswith(".c") + or f.endswith(".cc") + or f.endswith(".cpp") + or f.endswith(".S") + or f.endswith(".s") + or f.endswith(".m") + or f.endswith(".mm") +) + HostToolchain.CC = [ "$(HOSTCC) -c -o $[outs[0]] $[ins[0]] $(HOSTCFLAGS) $[cflags]" @@ -51,18 +61,6 @@ ] -def is_source_file(f): - return ( - f.endswith(".c") - or f.endswith(".cc") - or f.endswith(".cpp") - or f.endswith(".S") - or f.endswith(".s") - or f.endswith(".m") - or f.endswith(".mm") - ) - - def _combine(list1, list2): r = list(list1) for i in list2: @@ -152,7 +150,7 @@ def _removeprefix(self, prefix): def findsources(self, srcs, deps, cflags, filerule, toolchain, cwd): for f in filenamesof(srcs): - if not is_source_file(f): + if not toolchain.is_source_file(f): cflags = cflags + [f"-I{dirname(f)}"] deps = deps + [f] @@ -169,7 +167,7 @@ def findsources(self, srcs, deps, cflags, filerule, toolchain, cwd): args=getattr(self, "explicit_args", {}), ) for f in filenamesof([s]) - if is_source_file(f) + if toolchain.is_source_file(f) ] if any(f.endswith(".o") for f in filenamesof([s])): objs += [s] diff --git a/lang/cem/libcc.ansi/build.py b/lang/cem/libcc.ansi/build.py index 49049d418a..2bd7708857 100644 --- a/lang/cem/libcc.ansi/build.py +++ b/lang/cem/libcc.ansi/build.py @@ -205,7 +205,7 @@ deps=["lang/cem/libcc.ansi/headers"], ) - suffix = "k" + suffix = "m" if plat.startswith("em") else "o" export( name=f"all_{plat}", items={ diff --git a/lang/m2/libm2/build.py b/lang/m2/libm2/build.py new file mode 100644 index 0000000000..a7f8636b66 --- /dev/null +++ b/lang/m2/libm2/build.py @@ -0,0 +1,105 @@ +from build import PLATS +from build.ab import export +from build.ack import ackclibrary, ackcfile + +headers = [ + "Arguments.def", + "ArraySort.def", + "ASCII.def", + "Conversions.def", + "CSP.def", + "EM.def", + "Epilogue.def", + "InOut.def", + "MathLib0.def", + "Mathlib.def", + "PascalIO.def", + "Processes.def", + "random.def", + "RealConversions.def", + "RealInOut.def", + "Semaphores.def", + "Storage.def", + "Streams.def", + "Strings.def", + "StripUnix.def", + "Termcap.def", + "Terminal.def", + "Traps.def", + "Unix.def", + "XXTermcap.def", +] + +for plat in PLATS: + ackclibrary( + name=f"headers_{plat}", plat=plat, hdrs={k: "./" + k for k in headers} + ) + + ackclibrary( + name=f"lib_{plat}", + plat=plat, + srcs=[ + "./absd.c", + "./absi.c", + "./absl.c", + "./Arguments.c", + "./ArraySort.mod", + "./blockmove.c", + "./cap.c", + "./catch.c", + "./confarray.c", + "./Conversions.mod", + "./CSP.mod", + "./dvi.c", + "./halt.c", + "./init.c", + "./InOut.mod", + "./load.c", + "./MathLib0.mod", + "./Mathlib.mod", + "./PascalIO.mod", + "./Processes.mod", + "./random.mod", + "./rcka.c", + "./rcki.c", + "./rckil.c", + "./rcku.c", + "./rckul.c", + "./RealConversions.mod", + "./RealInOut.mod", + "./Semaphores.mod", + "./sigtrp.c", + "./stackprio.c", + "./Storage.mod", + "./store.c", + "./StrAss.c", + "./Streams.mod", + "./Strings.mod", + "./SYSTEM.c", + "./Termcap.mod", + "./Terminal.mod", + "./Traps.mod", + "./ucheck.c", + "./EM.e", + "./LtoUset.e", + "./absf.e", + "./par_misc.e", + ], + deps=[ + f".+headers_{plat}", + "lang/m2/include", + "h", + f"lang/cem/libcc.ansi+lib_{plat}", + ], + ) + + ackcfile(name=f"mrt_{plat}", plat=plat, srcs=["./head_m2.e"], deps=["h"]) + + suffix = "m" if plat.startswith("em") else "o" + export( + name=f"all_{plat}", + items={ + f"$(PLATIND)/{plat}/libmodula2.a": f".+lib_{plat}", + f"$(PLATIND)/{plat}/modula2.{suffix}": f".+mrt_{plat}", + }, + ) diff --git a/plat/build.py b/plat/build.py index be5d7d7a62..b70089ef11 100644 --- a/plat/build.py +++ b/plat/build.py @@ -12,5 +12,6 @@ def build_plat_libs(self, name, arch, plat, is_em=False): deps=[ f"lang/cem/libcc.ansi+all_{plat}", f"lang/basic/lib+all_{plat}", + f"lang/m2/libm2+all_{plat}", ], ) From fec5cb593a2e0a8173c80150ea6122c3c01dc632 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 20:26:04 +0100 Subject: [PATCH 12/79] The Pascal standard library builds. --- lang/pc/libpc/build.py | 96 ++++++++++++++++++++++++++++++++++++++++++ plat/build.py | 1 + 2 files changed, 97 insertions(+) create mode 100644 lang/pc/libpc/build.py diff --git a/lang/pc/libpc/build.py b/lang/pc/libpc/build.py new file mode 100644 index 0000000000..461bec93b3 --- /dev/null +++ b/lang/pc/libpc/build.py @@ -0,0 +1,96 @@ +from build import PLATS +from build.ab import export +from build.ack import ackclibrary, ackcfile + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + plat=plat, + srcs=[ + "./abi.c", + "./abl.c", + "./abr.c", + "./arg.c", + "./ass.c", + "./asz.c", + "./atn.c", + "./bcp.c", + "./buff.c", + "./catch.c", + "./cls.c", + "./cvt.c", + "./diag.c", + "./efl.c", + "./eln.c", + "./exp.c", + "./get.c", + "./hlt.c", + "./incpt.c", + "./ini.c", + "./log.c", + "./mdi.c", + "./mdl.c", + "./new.c", + "./nfa.c", + "./nobuff.c", + "./notext.c", + "./opn.c", + "./outcpt.c", + "./pac.c", + "./pclose.c", + "./pcreat.c", + "./pentry.c", + "./perrno.c", + "./pexit.c", + "./popen.c", + "./put.c", + "./rcka.c", + "./rdc.c", + "./rdi.c", + "./rdl.c", + "./rdr.c", + "./rf.c", + "./rln.c", + "./rnd.c", + "./sin.c", + "./sqt.c", + "./string.c", + "./unp.c", + "./uread.c", + "./uwrite.c", + "./wdw.c", + "./wf.c", + "./wrc.c", + "./wrf.c", + "./wri.c", + "./wrl.c", + "./wrr.c", + "./wrs.c", + "./wrz.c", + "./bts.e", + "./encaps.e", + "./fef.e", + "./fif.e", + "./gto.e", + "./hol0.e", + "./sig.e", + "./trap.e", + "./trp.e", + ], + deps=[ + "lang/pc/include", + "h", + f"lang/cem/libcc.ansi+lib_{plat}", + ], + ) + + ackcfile(name=f"prt_{plat}", plat=plat, srcs=["./head_pc.e"], deps=["h"]) + + suffix = "m" if plat.startswith("em") else "o" + export( + name=f"all_{plat}", + items={ + f"$(PLATIND)/{plat}/libpascal.a": f".+lib_{plat}", + f"$(PLATIND)/{plat}/pascal.{suffix}": f".+prt_{plat}", + }, + ) diff --git a/plat/build.py b/plat/build.py index b70089ef11..1cc33ed440 100644 --- a/plat/build.py +++ b/plat/build.py @@ -13,5 +13,6 @@ def build_plat_libs(self, name, arch, plat, is_em=False): f"lang/cem/libcc.ansi+all_{plat}", f"lang/basic/lib+all_{plat}", f"lang/m2/libm2+all_{plat}", + f"lang/pc/libpc+all_{plat}", ], ) From 495a7f5bb6b3e73d84d2cd9c7bf246ba0e4e155d Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 20:32:36 +0100 Subject: [PATCH 13/79] The pc86 libsys builds. --- plat/pc86/build.py | 1 + plat/pc86/libsys/build.py | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 plat/pc86/libsys/build.py diff --git a/plat/pc86/build.py b/plat/pc86/build.py index 2bb9ead70f..80c898436a 100644 --- a/plat/pc86/build.py +++ b/plat/pc86/build.py @@ -25,6 +25,7 @@ name="all", items={ "$(PLATIND)/pc86/boot.o": ".+boot", + "$(PLATIND)/pc86/libsys.a": "./libsys", }, deps=[".+tools", ".+plat_libs", "util/ack+all"], ) diff --git a/plat/pc86/libsys/build.py b/plat/pc86/libsys/build.py new file mode 100644 index 0000000000..7e7eefffbe --- /dev/null +++ b/plat/pc86/libsys/build.py @@ -0,0 +1,26 @@ +from build.ack import ackclibrary + +ackclibrary( + name="libsys", + plat="pc86", + srcs=[ + "./brk.c", + "./close.c", + "./creat.c", + "./errno.s", + "./getpid.c", + "./_hol0.s", + "./isatty.c", + "./kill.c", + "./lseek.c", + "./open.c", + "./read.c", + "./signal.c", + "./_sys_rawread.s", + "./_sys_rawwrite.s", + "./time.c", + "./write.c", + "./libsys.h", + ], + deps=["lang/cem/libcc.ansi/headers","plat/pc86/include"] +) From 8e3fe4744651e65237ee13ac7a684951c3d057fa Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 20:54:23 +0100 Subject: [PATCH 14/79] Make the cpm plat and the i80 mach build. --- build.py | 12 +-- mach/i80/libem/build.py | 85 +++++++++++++++++++++ mach/i80/libend/build.py | 14 ++++ mach/i80/ncg/build.py | 3 + mach/proto/ncg/build.py | 3 +- plat/cpm/build.py | 31 ++++++++ plat/cpm/include/build.py | 6 ++ plat/cpm/libsys/build.py | 156 ++++++++++++++++++++++++++++++++++++++ plat/pc86/libsys/build.py | 2 +- 9 files changed, 305 insertions(+), 7 deletions(-) create mode 100644 mach/i80/libem/build.py create mode 100644 mach/i80/libend/build.py create mode 100644 mach/i80/ncg/build.py create mode 100644 plat/cpm/build.py create mode 100644 plat/cpm/include/build.py create mode 100644 plat/cpm/libsys/build.py diff --git a/build.py b/build.py index 7ebad3486b..a4f5d7109a 100644 --- a/build.py +++ b/build.py @@ -1,6 +1,6 @@ from build.ab import export -PLATS = ["pc86"] +PLATS = ["pc86", "cpm"] # This contains the platform-independent host tooling required to build the plats. export( @@ -22,8 +22,10 @@ export( name="all", - deps=[ - "plat/pc86+all", - ".+common", - ], + deps=( + [ + ".+common", + ] + + [f"plat/{p}+all" for p in PLATS] + ), ) diff --git a/mach/i80/libem/build.py b/mach/i80/libem/build.py new file mode 100644 index 0000000000..53f310d585 --- /dev/null +++ b/mach/i80/libem/build.py @@ -0,0 +1,85 @@ +from build import PLATS +from build.ab import Rule, simplerule +from build.ack import ackclibrary + + +@Rule +def generate(self, name, body, offset): + simplerule( + replaces=self, + ins=["./generate.sh", f"./{body}"], + outs=[f"={name}.s"], + commands=[f"$[ins[0]] {body} {offset} > $[outs]"], + ) + + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=( + [ + generate(name=f"{k}{i}", body=f"{k}.h", offset=i) + for i in range(1, 128) + for k in [ + "fload", + "floadn", + "fstore", + "fstoren", + "faddr", + "faddrn", + ] + ] + + [ + "./aar2.s", + "./adi4.s", + "./and.s", + "./blm.s", + "./cii.s", + "./cmi4.s", + "./cmps_mag.s", + "./cmpu_mag.s", + "./cms.s", + "./com.s", + "./csa.s", + "./csb.s", + "./dup.s", + "./dvi2.s", + "./dvi4.s", + "./exg.s", + "./flp.s", + "./inn.s", + "./ior.s", + "./lar2.s", + "./loi.s", + "./mli2.s", + "./mli4.s", + "./mlu2.s", + "./ngi4.s", + "./nop.s", + "./pchl.s", + "./pro.s", + "./rck.s", + "./ret.s", + "./rol4.s", + "./ror4.s", + "./rst.s", + "./sar2.s", + "./sbi4.s", + "./set2.s", + "./set.s", + "./sli2.s", + "./sli4.s", + "./sri2.s", + "./sri4.s", + "./sti.s", + "./xor.s", + "./fload.h", + "./floadn.h", + "./fstore.h", + "./fstoren.h", + "./faddr.h", + "./faddrn.h", + ] + ), + plat=plat, + ) diff --git a/mach/i80/libend/build.py b/mach/i80/libend/build.py new file mode 100644 index 0000000000..cdeeb03cb8 --- /dev/null +++ b/mach/i80/libend/build.py @@ -0,0 +1,14 @@ +from build import PLATS +from build.ack import ackclibrary + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=[ + "./edata.s", + "./em_end.s", + "./end.s", + "./etext.s", + ], + plat=plat, + ) diff --git a/mach/i80/ncg/build.py b/mach/i80/ncg/build.py new file mode 100644 index 0000000000..c69132d58c --- /dev/null +++ b/mach/i80/ncg/build.py @@ -0,0 +1,3 @@ +from build.c import clibrary + +clibrary(name="ncg", hdrs={"mach.h": "./mach.h", "mach.c": "./mach.c"}) diff --git a/mach/proto/ncg/build.py b/mach/proto/ncg/build.py index a3a3ccec41..7e71598fc8 100644 --- a/mach/proto/ncg/build.py +++ b/mach/proto/ncg/build.py @@ -4,7 +4,7 @@ @Rule -def build_ncg(self, name, arch, deps: Targets = []): +def build_ncg(self, name, arch, cflags=[], deps: Targets = []): tables = ncgg( name=f"{self.localname}/tables", srcs=[f"mach/{arch}/ncg/table"], @@ -13,6 +13,7 @@ def build_ncg(self, name, arch, deps: Targets = []): cprogram( replaces=self, + cflags=cflags, srcs=[ "mach/proto/ncg/codegen.c", "mach/proto/ncg/compute.c", diff --git a/plat/cpm/build.py b/plat/cpm/build.py new file mode 100644 index 0000000000..478520fdf8 --- /dev/null +++ b/plat/cpm/build.py @@ -0,0 +1,31 @@ +from build.ab import export +from build.ack import ackcfile +from mach.proto.ncg.build import build_ncg +from plat.build import build_plat_libs +import importlib + +build_as = importlib.import_module("mach.proto.as.build").build_as + +build_as(name="as", arch="i80") +build_ncg(name="ncg", arch="i80", cflags=["-DUSE_I80_RSTS"]) +build_plat_libs(name="plat_libs", arch="i80", plat="cpm") + +ackcfile(name="boot", srcs=["./boot.s"], plat="cpm") + +export( + name="tools", + items={ + "$(PLATDEP)/cpm/as": ".+as", + "$(PLATDEP)/cpm/ncg": ".+ncg", + "$(PLATIND)/descr/cpm": "./descr", + }, +) + +export( + name="all", + items={ + "$(PLATIND)/cpm/boot.o": ".+boot", + "$(PLATIND)/cpm/libsys.a": "./libsys", + }, + deps=[".+tools", ".+plat_libs", "util/ack+all"], +) diff --git a/plat/cpm/include/build.py b/plat/cpm/include/build.py new file mode 100644 index 0000000000..8c4359bc87 --- /dev/null +++ b/plat/cpm/include/build.py @@ -0,0 +1,6 @@ +from build.c import clibrary +from glob import glob + +headers = glob("**/*.h", root_dir="plat/cpm/include", recursive=True) + +clibrary(name="include", hdrs={k: f"./{k}" for k in headers}) diff --git a/plat/cpm/libsys/build.py b/plat/cpm/libsys/build.py new file mode 100644 index 0000000000..cddf88a0ea --- /dev/null +++ b/plat/cpm/libsys/build.py @@ -0,0 +1,156 @@ +from build.ab import simplerule +from build.ack import ackclibrary + +bdos_calls = { + 0: "cpm_exit", + 1: "cpm_conin", + 2: "cpm_conout", + 3: "cpm_auxin", + 4: "cpm_auxout", + 5: "cpm_lstout", + 6: "cpm_conio", + 7: "cpm_get_iobyte", + 8: "cpm_set_iobyte", + 9: "cpm_printstring", + 10: "cpm_readline", + 11: "cpm_const", + 12: "cpm_get_version", + 13: "cpm_reset_disk_system", + 14: "cpm_select_drive", + 15: "cpm_open_file", + 16: "cpm_close_file", + 17: "cpm_findfirst", + 18: "cpm_findnext", + 19: "cpm_delete_file", + 20: "cpm_read_sequential", + 21: "cpm_write_sequential", + 22: "cpm_make_file", + 23: "cpm_rename_file", + 24: "cpm_get_login_vector", + 25: "cpm_get_current_drive", + 26: "cpm_set_dma", + 27: "cpm_get_allocation_vector", + 28: "cpm_write_protect_drive", + 29: "cpm_get_readonly_vector", + 30: "cpm_set_file_attributes", + 31: "cpm_get_dpb", + 32: "cpm_get_set_user", + 33: "cpm_read_random", + 34: "cpm_write_random", + 35: "cpm_seek_to_end", + 36: "cpm_seek_to_seq_pos", + 37: "cpm_reset_drives", + 40: "cpm_write_random_filled", +} + +bios_calls = { + 6: "cpm_bios_const", + 9: "cpm_bios_conin", + 12: "cpm_bios_conout", + 15: "cpm_bios_list", + 18: "cpm_bios_punch", + 21: "cpm_bios_reader", + 24: "cpm_bios_home", + # Special: 27 : "cpm_bios_seldsk", + 30: "cpm_bios_settrk", + 33: "cpm_bios_setsec", + 36: "cpm_bios_setdma", + 39: "cpm_bios_read", + 42: "cpm_bios_write", + 45: "cpm_bios_listst", + # Special: 48 : "cpm_bios_sectran", +} + +trap_calls = [ + "EARRAY", + "EBADGTO", + "EBADLAE", + "EBADLIN", + "EBADMON", + "EBADPC", + "EBADPTR", + "ECASE", + "ECONV", + "EFDIVZ", + "EFOVFL", + "EFUND", + "EFUNFL", + "EHEAP", + "EIDIVZ", + "EILLINS", + "EIOVFL", + "EIUND", + "EMEMFLT", + "EODDZ", + "ERANGE", + "ESET", + "ESTACK", + "EUNIMPL", +] + +generated = ( + [ + simplerule( + name=f"{b}", + ins=["./make_bdos_call.sh"], + outs=[f"={b}.s"], + commands=[f"$[ins[0]] {n} {b} > $[outs]"], + ) + for n, b in bdos_calls.items() + ] + + [ + simplerule( + name=f"{b}", + ins=["./make_bios_call.sh"], + outs=[f"={b}.s"], + commands=[f"$[ins[0]] {n} {b} > $[outs]"], + ) + for n, b in bios_calls.items() + ] + + [ + simplerule( + name=f"{t}", + ins=["./make_trap.sh"], + outs=[f"={t}.s"], + commands=[f"$[ins[0]] {t.lower()} {t} > $[outs]"], + ) + for t in trap_calls + ] +) + + +ackclibrary( + name="libsys", + plat="cpm", + srcs=generated + + [ + "./_bdos.s", + "./_bios_raw.s", + "./_bios.s", + "./bios_sectran.s", + "./bios_seldsk.s", + "./brk.c", + "./close.c", + "./cpm_overwrite_ccp.s", + "./cpm_printstring0.s", + "./cpm_read_random_safe.c", + "./creat.c", + "./fcb.c", + "./fd.c", + "./getpid.c", + "./_hol0.s", + "./_inn2.s", + "./isatty.c", + "./kill.c", + "./lseek.c", + "./open.c", + "./read.c", + "./signal.c", + "./time.c", + "./_trap.s", + "./write.c", + "./asm.h", + "./cpmsys.h", + ], + deps=["lang/cem/libcc.ansi/headers", "plat/cpm/include"], +) diff --git a/plat/pc86/libsys/build.py b/plat/pc86/libsys/build.py index 7e7eefffbe..07b0f8da5a 100644 --- a/plat/pc86/libsys/build.py +++ b/plat/pc86/libsys/build.py @@ -22,5 +22,5 @@ "./write.c", "./libsys.h", ], - deps=["lang/cem/libcc.ansi/headers","plat/pc86/include"] + deps=["lang/cem/libcc.ansi/headers", "plat/pc86/include"], ) From 0f335aa2e6a4b8beb1f426b512c40dd0e30a2b0f Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 20:55:44 +0100 Subject: [PATCH 15/79] Typo fix. --- mach/i80/libem/build.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/mach/i80/libem/build.py b/mach/i80/libem/build.py index 53f310d585..a197db115d 100644 --- a/mach/i80/libem/build.py +++ b/mach/i80/libem/build.py @@ -13,22 +13,24 @@ def generate(self, name, body, offset): ) +generated = [ + generate(name=f"{k}{i}", body=f"{k}.h", offset=i) + for i in range(1, 128) + for k in [ + "fload", + "floadn", + "fstore", + "fstoren", + "faddr", + "faddrn", + ] +] + for plat in PLATS: ackclibrary( name=f"lib_{plat}", srcs=( - [ - generate(name=f"{k}{i}", body=f"{k}.h", offset=i) - for i in range(1, 128) - for k in [ - "fload", - "floadn", - "fstore", - "fstoren", - "faddr", - "faddrn", - ] - ] + generated + [ "./aar2.s", "./adi4.s", From 7a115d859cafcc3e2daceeeb570cee1dcfb18ca6 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 22:52:58 +0100 Subject: [PATCH 16/79] M2 and C now export their headers. --- build/ack.py | 28 ++++++++++++++++++++++++++++ lang/cem/libcc.ansi/build.py | 1 + lang/cem/libcc.ansi/headers/build.py | 9 +++++++++ lang/m2/libm2/build.py | 12 +++++++----- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/build/ack.py b/build/ack.py index 5f436f0f99..5c4e8b8fad 100644 --- a/build/ack.py +++ b/build/ack.py @@ -1,5 +1,8 @@ +from build.ab import targetof, filenamesof, filenameof from build.toolchain import Toolchain from build.c import cfile, clibrary +from build.utils import collectattrs +from os.path import * class AckToolchain(Toolchain): @@ -40,3 +43,28 @@ def ackclibrary(name, plat=None, **kwargs): ] kwargs["args"] = kwargs.get("args", {}) | {"plat": plat} clibrary(name=name, toolchain=AckToolchain, **kwargs) + + +def _combine(list1, list2): + r = list(list1) + for i in list2: + if i not in r: + r.append(i) + return r + + +def _indirect(deps, name): + r = [] + for d in deps: + r = _combine(r, d.args.get(name, [d])) + return r + + +def exportheaders(lib, prefix=""): + lib = targetof(lib) + hh = {} + for h in sorted(_indirect([lib], "cheader_files")): + for f in h.outs: + r = relpath(filenameof(f), h.dir) + hh[join(prefix, r)] = f + return hh diff --git a/lang/cem/libcc.ansi/build.py b/lang/cem/libcc.ansi/build.py index 2bd7708857..f527534f73 100644 --- a/lang/cem/libcc.ansi/build.py +++ b/lang/cem/libcc.ansi/build.py @@ -212,4 +212,5 @@ f"$(PLATIND)/{plat}/libc.a": f".+lib_{plat}", f"$(PLATIND)/{plat}/c-ansi.{suffix}": f".+crt_{plat}", }, + deps=["./headers+all"], ) diff --git a/lang/cem/libcc.ansi/headers/build.py b/lang/cem/libcc.ansi/headers/build.py index 765519c5d3..eb6168acac 100644 --- a/lang/cem/libcc.ansi/headers/build.py +++ b/lang/cem/libcc.ansi/headers/build.py @@ -1,6 +1,15 @@ +from build.ab import export from build.c import clibrary +from build.ack import exportheaders from glob import glob headers = glob("**/*.h", root_dir="lang/cem/libcc.ansi/headers", recursive=True) clibrary(name="headers", hdrs={k: f"./{k}" for k in headers}) + +export( + name="all", + items=exportheaders( + "lang/cem/libcc.ansi/headers", prefix="$(PLATIND)/include/ansi" + ), +) diff --git a/lang/m2/libm2/build.py b/lang/m2/libm2/build.py index a7f8636b66..5f94736b59 100644 --- a/lang/m2/libm2/build.py +++ b/lang/m2/libm2/build.py @@ -30,11 +30,12 @@ "XXTermcap.def", ] -for plat in PLATS: - ackclibrary( - name=f"headers_{plat}", plat=plat, hdrs={k: "./" + k for k in headers} - ) +export( + name="headers", + items={f"$(PLATIND)/include/modula2/{k}": f"./{k}" for k in headers}, +) +for plat in PLATS: ackclibrary( name=f"lib_{plat}", plat=plat, @@ -86,7 +87,7 @@ "./par_misc.e", ], deps=[ - f".+headers_{plat}", + ".+headers", "lang/m2/include", "h", f"lang/cem/libcc.ansi+lib_{plat}", @@ -102,4 +103,5 @@ f"$(PLATIND)/{plat}/libmodula2.a": f".+lib_{plat}", f"$(PLATIND)/{plat}/modula2.{suffix}": f".+mrt_{plat}", }, + deps=[".+headers"], ) From e2a5a9c621531ba90a314a7f33e1ccdc000a6dcc Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 23:04:33 +0100 Subject: [PATCH 17/79] Almost have an example building. --- build.py | 4 +++- build/ack.py | 22 +++++++++++++++++----- examples/build.py | 6 ++++++ plat/pc86/build.py | 5 +++-- 4 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 examples/build.py diff --git a/build.py b/build.py index a4f5d7109a..52315b83dc 100644 --- a/build.py +++ b/build.py @@ -21,7 +21,7 @@ ) export( - name="all", + name="compiler", deps=( [ ".+common", @@ -29,3 +29,5 @@ + [f"plat/{p}+all" for p in PLATS] ), ) + +export(name="all", deps=[".+compiler", "examples+all"]) diff --git a/build/ack.py b/build/ack.py index 5c4e8b8fad..9c42a52e31 100644 --- a/build/ack.py +++ b/build/ack.py @@ -1,7 +1,6 @@ -from build.ab import targetof, filenamesof, filenameof +from build.ab import targetof, filenameof from build.toolchain import Toolchain -from build.c import cfile, clibrary -from build.utils import collectattrs +from build.c import cfile, clibrary, cprogram from os.path import * @@ -10,6 +9,9 @@ class AckToolchain(Toolchain): CC = [ "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack $(ACKCFLAGS) $[cflags] -m$[plat] -c -o $[outs[0]] $[ins[0]]" ] + CLINK = [ + "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack $(ACKLDFLAGS) $[ldflags] -m$[plat] -o $[outs[0]] $[ins[0]]" + ] def is_source_file(f): return ( @@ -31,7 +33,7 @@ def ackcfile(name, plat=None, **kwargs): "+common", ] kwargs["args"] = kwargs.get("args", {}) | {"plat": plat} - cfile(name=name, toolchain=AckToolchain, **kwargs) + return cfile(name=name, toolchain=AckToolchain, **kwargs) def ackclibrary(name, plat=None, **kwargs): @@ -42,7 +44,17 @@ def ackclibrary(name, plat=None, **kwargs): "+common", ] kwargs["args"] = kwargs.get("args", {}) | {"plat": plat} - clibrary(name=name, toolchain=AckToolchain, **kwargs) + return clibrary(name=name, toolchain=AckToolchain, **kwargs) + + +def ackcprogram(name, plat=None, **kwargs): + assert plat + kwargs["deps"] = kwargs.get("deps", []) + [ + f"plat/{plat}+all", + "+common", + ] + kwargs["args"] = kwargs.get("args", {}) | {"plat": plat} + return cprogram(name=name, toolchain=AckToolchain, **kwargs) def _combine(list1, list2): diff --git a/examples/build.py b/examples/build.py new file mode 100644 index 0000000000..10a813a155 --- /dev/null +++ b/examples/build.py @@ -0,0 +1,6 @@ +from build import PLATS +from build.ab import export +from build.ack import ackcprogram + +ackcprogram(name="hilo", plat="pc86", srcs=["./hilo.c"]) +export(name="all", items={f"$(PLATIND)/examples/hilo": ".+hilo"}) diff --git a/plat/pc86/build.py b/plat/pc86/build.py index 80c898436a..7694daa11f 100644 --- a/plat/pc86/build.py +++ b/plat/pc86/build.py @@ -1,5 +1,5 @@ from build.ab import export -from build.ack import ackcfile +from build.ack import ackcfile, exportheaders from mach.proto.ncg.build import build_ncg from plat.build import build_plat_libs import importlib @@ -26,6 +26,7 @@ items={ "$(PLATIND)/pc86/boot.o": ".+boot", "$(PLATIND)/pc86/libsys.a": "./libsys", - }, + } + | exportheaders("./include", prefix="$(PLATIND)/include/ansi"), deps=[".+tools", ".+plat_libs", "util/ack+all"], ) From 841a63d570ac9450cccf9164240a114730e2eb36 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 23:25:38 +0100 Subject: [PATCH 18/79] The C examples build. --- build/ack.py | 7 ++++--- build/c.py | 1 + examples/build.py | 11 +++++++++-- plat/cpm/build.py | 5 +++-- plat/pc86/build.py | 2 +- util/led/build.py | 2 +- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/build/ack.py b/build/ack.py index 9c42a52e31..2945b52152 100644 --- a/build/ack.py +++ b/build/ack.py @@ -10,8 +10,9 @@ class AckToolchain(Toolchain): "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack $(ACKCFLAGS) $[cflags] -m$[plat] -c -o $[outs[0]] $[ins[0]]" ] CLINK = [ - "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack $(ACKLDFLAGS) $[ldflags] -m$[plat] -o $[outs[0]] $[ins[0]]" + "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack $(ACKLDFLAGS) $[ldflags] -m$[plat] -.$[lang] -o $[outs[0]] $[ins[0]]" ] + AR = ["$(INSDIR)/bin/aal qc $[outs] $[ins]"] def is_source_file(f): return ( @@ -47,13 +48,13 @@ def ackclibrary(name, plat=None, **kwargs): return clibrary(name=name, toolchain=AckToolchain, **kwargs) -def ackcprogram(name, plat=None, **kwargs): +def ackcprogram(name, lang, plat=None, **kwargs): assert plat kwargs["deps"] = kwargs.get("deps", []) + [ f"plat/{plat}+all", "+common", ] - kwargs["args"] = kwargs.get("args", {}) | {"plat": plat} + kwargs["args"] = kwargs.get("args", {}) | {"plat": plat, "lang": lang} return cprogram(name=name, toolchain=AckToolchain, **kwargs) diff --git a/build/c.py b/build/c.py index 718a090792..1750ae4637 100644 --- a/build/c.py +++ b/build/c.py @@ -236,6 +236,7 @@ def libraryimpl( name=f"{self.localname}_lib", ins=objs, outs=[f"={self.localname}.a"], + deps=deps, label=label, commands=commands, ) diff --git a/examples/build.py b/examples/build.py index 10a813a155..55730fb16e 100644 --- a/examples/build.py +++ b/examples/build.py @@ -2,5 +2,12 @@ from build.ab import export from build.ack import ackcprogram -ackcprogram(name="hilo", plat="pc86", srcs=["./hilo.c"]) -export(name="all", items={f"$(PLATIND)/examples/hilo": ".+hilo"}) +exports={} +for prog in ["hilo.c", "mandelbrot.c", "paranoia.c", "startrek.c"]: + name = prog.replace(".", "_") + exports |= {f"$(PLATIND)/examples/{prog}": f"./{prog}"} + for plat in PLATS: + ackcprogram(name=f"{name}_{plat}", plat=plat, lang="c", srcs=[f"./{prog}"]) + exports[f"$(PLATIND)/examples/{name}_{plat}"] = f".+{name}_{plat}" + +export(name="all", items=exports) diff --git a/plat/cpm/build.py b/plat/cpm/build.py index 478520fdf8..570aea1180 100644 --- a/plat/cpm/build.py +++ b/plat/cpm/build.py @@ -1,5 +1,5 @@ from build.ab import export -from build.ack import ackcfile +from build.ack import ackcfile, exportheaders from mach.proto.ncg.build import build_ncg from plat.build import build_plat_libs import importlib @@ -26,6 +26,7 @@ items={ "$(PLATIND)/cpm/boot.o": ".+boot", "$(PLATIND)/cpm/libsys.a": "./libsys", - }, + } + | exportheaders("./include", prefix="$(PLATIND)/cpm/include"), deps=[".+tools", ".+plat_libs", "util/ack+all"], ) diff --git a/plat/pc86/build.py b/plat/pc86/build.py index 7694daa11f..2866e8580a 100644 --- a/plat/pc86/build.py +++ b/plat/pc86/build.py @@ -27,6 +27,6 @@ "$(PLATIND)/pc86/boot.o": ".+boot", "$(PLATIND)/pc86/libsys.a": "./libsys", } - | exportheaders("./include", prefix="$(PLATIND)/include/ansi"), + | exportheaders("./include", prefix="$(PLATIND)/pc86/include"), deps=[".+tools", ".+plat_libs", "util/ack+all"], ) diff --git a/util/led/build.py b/util/led/build.py index 7280864073..695afb664d 100644 --- a/util/led/build.py +++ b/util/led/build.py @@ -17,7 +17,7 @@ export( name="all", items={ - "$(INSDIR)/bin/led": ".+led", + "$(PLATDEP)/em_led": ".+led", "$(INSDIR)/share/man/man6/led.6": "./led.6", }, ) From 524c6ce453953798a2a6fa3e52a42d4286100969 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 23:40:45 +0100 Subject: [PATCH 19/79] The examples build with optimisation. --- examples/build.py | 12 +++++++++--- mach/proto/top/build.py | 19 +++++++++++++++++++ mach/proto/top/top.c | 2 +- plat/cpm/build.py | 3 +++ util/topgen/build.py | 39 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 mach/proto/top/build.py create mode 100644 util/topgen/build.py diff --git a/examples/build.py b/examples/build.py index 55730fb16e..a50d038330 100644 --- a/examples/build.py +++ b/examples/build.py @@ -2,12 +2,18 @@ from build.ab import export from build.ack import ackcprogram -exports={} +exports = {} for prog in ["hilo.c", "mandelbrot.c", "paranoia.c", "startrek.c"]: name = prog.replace(".", "_") exports |= {f"$(PLATIND)/examples/{prog}": f"./{prog}"} for plat in PLATS: - ackcprogram(name=f"{name}_{plat}", plat=plat, lang="c", srcs=[f"./{prog}"]) - exports[f"$(PLATIND)/examples/{name}_{plat}"] = f".+{name}_{plat}" + ackcprogram( + name=f"{name}_{plat}", + plat=plat, + lang="c", + srcs=[f"./{prog}"], + cflags=["-O"], + ) + exports[f"$(PLATIND)/examples/{name}_{plat}.exe"] = f".+{name}_{plat}" export(name="all", items=exports) diff --git a/mach/proto/top/build.py b/mach/proto/top/build.py new file mode 100644 index 0000000000..437672160b --- /dev/null +++ b/mach/proto/top/build.py @@ -0,0 +1,19 @@ +from build.ab import Rule, Target +from build.c import cprogram +from util.topgen.build import topgen + + +@Rule +def build_top(self, name, arch): + t = topgen(name=f"{self.localname}_topgen", src=f"mach/{arch}/top/table") + + cprogram( + replaces=self, + srcs=[ + "mach/proto/top/queue.c", + "mach/proto/top/queue.h", + "mach/proto/top/top.c", + "mach/proto/top/top.h", + t, + ], + ) diff --git a/mach/proto/top/top.c b/mach/proto/top/top.c index 1431ae585f..849453264c 100644 --- a/mach/proto/top/top.c +++ b/mach/proto/top/top.c @@ -47,7 +47,7 @@ static struct variable ANY; /* ANY symbol matching any instruction */ /* Opcode of first instruction not matched by current pattern */ static char *REST; -#include "gen.c" +#include "gen.c.h" /* Macros for efficiency: */ diff --git a/plat/cpm/build.py b/plat/cpm/build.py index 570aea1180..070a7d9f6a 100644 --- a/plat/cpm/build.py +++ b/plat/cpm/build.py @@ -1,6 +1,7 @@ from build.ab import export from build.ack import ackcfile, exportheaders from mach.proto.ncg.build import build_ncg +from mach.proto.top.build import build_top from plat.build import build_plat_libs import importlib @@ -8,6 +9,7 @@ build_as(name="as", arch="i80") build_ncg(name="ncg", arch="i80", cflags=["-DUSE_I80_RSTS"]) +build_top(name="top", arch="i80") build_plat_libs(name="plat_libs", arch="i80", plat="cpm") ackcfile(name="boot", srcs=["./boot.s"], plat="cpm") @@ -17,6 +19,7 @@ items={ "$(PLATDEP)/cpm/as": ".+as", "$(PLATDEP)/cpm/ncg": ".+ncg", + "$(PLATDEP)/cpm/top": ".+top", "$(PLATIND)/descr/cpm": "./descr", }, ) diff --git a/util/topgen/build.py b/util/topgen/build.py new file mode 100644 index 0000000000..782c9870a3 --- /dev/null +++ b/util/topgen/build.py @@ -0,0 +1,39 @@ +from build.ab import Rule, Target, simplerule +from build.c import hostcprogram +from util.LLgen.build import llgen + +llgen( + name="llgen", + srcs=[ + "./topgen.g", + ], +) + +hostcprogram( + name="topgen", + srcs=[ + ".+llgen", + "./LLlex.c", + "./hash.c", + "./hash.h", + "./main.c", + "./misc.h", + "./pattern.c", + "./pattern.h", + "./symtab.c", + "./symtab.h", + "./token.h", + "./tunable.h", + ], +) + + +@Rule +def topgen(self, name, src: Target): + simplerule( + replaces=self, + ins=["util/topgen", src], + outs=["=gen.c.h", "=gen.h"], + commands=["$[ins] $[dir]", "mv $[dir]/gen.c $[outs[0]]"], + label="TOPGEN", + ) From c50db71492dd76eb2775819f9be87d059ca33d08 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 23:41:40 +0100 Subject: [PATCH 20/79] Update build scripts. --- .github/workflows/ccpp.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 3a73fc9451..8cf0e87127 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: apt - run: sudo apt update && sudo apt install bison flex ninja-build lua5.3 + run: sudo apt update && sudo apt install bison flex lua5.3 - name: make run: make @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: brew - run: brew install ninja lua@5.4 + run: brew install python lua@5.4 - name: make run: | make @@ -41,7 +41,6 @@ jobs: mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-lua mingw-w64-ucrt-x86_64-nsis - ninja bison flex zip From c15abbfa87b1af71f54ee605fc0ec607f1574d29 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 29 Mar 2025 23:42:11 +0100 Subject: [PATCH 21/79] Ubuntu 20 is way too old. --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 8cf0e87127..bf92155230 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -8,7 +8,7 @@ on: [push, pull_request] jobs: build-linux: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: apt From 816372b8c5c11adceb3e6e572120426ca66d04be Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 01:51:26 +0100 Subject: [PATCH 22/79] ego and -O2 works. --- build.py | 1 + examples/build.py | 2 +- h/build.py | 1 + util/ego/bo/bo.c | 24 +++++----- util/ego/build.py | 79 +++++++++++++++++++++++++++++++++ util/ego/ca/ca.c | 16 +++---- util/ego/ca/ca_put.c | 10 ++--- util/ego/cf/cf.c | 24 +++++----- util/ego/cf/cf_idom.c | 8 ++-- util/ego/cf/cf_loop.c | 10 ++--- util/ego/cf/cf_succ.c | 14 +++--- util/ego/cj/cj.c | 26 +++++------ util/ego/cs/cs.c | 8 ++-- util/ego/cs/cs_alloc.c | 4 +- util/ego/cs/cs_aux.c | 10 ++--- util/ego/cs/cs_avail.c | 10 ++--- util/ego/cs/cs_debug.c | 6 +-- util/ego/cs/cs_elim.c | 12 ++--- util/ego/cs/cs_entity.c | 8 ++-- util/ego/cs/cs_getent.c | 8 ++-- util/ego/cs/cs_kill.c | 14 +++--- util/ego/cs/cs_partit.c | 8 ++-- util/ego/cs/cs_profit.c | 12 ++--- util/ego/cs/cs_stack.c | 8 ++-- util/ego/cs/cs_vnm.c | 8 ++-- util/ego/ic/ic.c | 18 ++++---- util/ego/ic/ic_aux.c | 12 ++--- util/ego/ic/ic_io.c | 6 +-- util/ego/ic/ic_lib.c | 8 ++-- util/ego/ic/ic_lookup.c | 8 ++-- util/ego/il/il.c | 20 ++++----- util/ego/il/il1_anal.c | 16 +++---- util/ego/il/il1_aux.c | 10 ++--- util/ego/il/il1_cal.c | 12 ++--- util/ego/il/il1_formal.c | 10 ++--- util/ego/il/il2_aux.c | 16 +++---- util/ego/il/il3_aux.c | 8 ++-- util/ego/il/il3_change.c | 18 ++++---- util/ego/il/il3_subst.c | 12 ++--- util/ego/il/il_aux.c | 16 +++---- util/ego/lv/lv.c | 32 +++++++------- util/ego/ra/build.py | 46 +++++++++++++++++++ util/ego/ra/ra.c | 22 ++++----- util/ego/ra/ra_allocl.c | 18 ++++---- util/ego/ra/ra_aux.c | 12 ++--- util/ego/ra/ra_interv.c | 10 ++--- util/ego/ra/ra_items.c | 14 +++--- util/ego/ra/ra_lifet.c | 14 +++--- util/ego/ra/ra_pack.c | 16 +++---- util/ego/ra/ra_profits.c | 8 ++-- util/ego/ra/ra_xform.c | 14 +++--- util/ego/share/build.py | 96 ++++++++++++++++++++++++++++++++++++++++ util/ego/sp/sp.c | 24 +++++----- util/ego/sr/sr.c | 22 ++++----- util/ego/sr/sr_aux.c | 10 ++--- util/ego/sr/sr_cand.c | 14 +++--- util/ego/sr/sr_expr.c | 10 ++--- util/ego/sr/sr_iv.c | 14 +++--- util/ego/sr/sr_reduce.c | 14 +++--- util/ego/sr/sr_xform.c | 16 +++---- util/ego/ud/ud.c | 30 ++++++------- util/ego/ud/ud_aux.c | 18 ++++---- util/ego/ud/ud_const.c | 18 ++++---- util/ego/ud/ud_copy.c | 18 ++++---- util/ego/ud/ud_defs.c | 18 ++++---- 65 files changed, 636 insertions(+), 413 deletions(-) create mode 100644 util/ego/build.py create mode 100644 util/ego/ra/build.py create mode 100644 util/ego/share/build.py diff --git a/build.py b/build.py index 52315b83dc..279d0c0eff 100644 --- a/build.py +++ b/build.py @@ -14,6 +14,7 @@ "util/ack+all", "util/amisc+all", "util/arch+all", + "util/ego+all", "util/led+all", "util/misc+all", "util/opt+all", diff --git a/examples/build.py b/examples/build.py index a50d038330..0d1a04df9e 100644 --- a/examples/build.py +++ b/examples/build.py @@ -12,7 +12,7 @@ plat=plat, lang="c", srcs=[f"./{prog}"], - cflags=["-O"], + cflags=["-O2"], ) exports[f"$(PLATIND)/examples/{name}_{plat}.exe"] = f".+{name}_{plat}" diff --git a/h/build.py b/h/build.py index 90a16b0383..e33efbbfa8 100644 --- a/h/build.py +++ b/h/build.py @@ -32,6 +32,7 @@ "arch.h", "ranlib.h", "em_abs.h", + "em_ego.h", "em_flag.h", "em_ptyp.h", "em_mes.h", diff --git a/util/ego/bo/bo.c b/util/ego/bo/bo.c index f67b9fa975..a8292dc430 100644 --- a/util/ego/bo/bo.c +++ b/util/ego/bo/bo.c @@ -14,18 +14,18 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/files.h" -#include "../share/get.h" -#include "../share/put.h" -#include "../share/lset.h" -#include "../share/map.h" -#include "../share/alloc.h" -#include "../share/utils.h" -#include "../share/def.h" -#include "../share/go.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/files.h" +#include "ego/share/get.h" +#include "ego/share/put.h" +#include "ego/share/lset.h" +#include "ego/share/map.h" +#include "ego/share/alloc.h" +#include "ego/share/utils.h" +#include "ego/share/def.h" +#include "ego/share/go.h" extern char em_flag[]; diff --git a/util/ego/build.py b/util/ego/build.py new file mode 100644 index 0000000000..2f5cf83d59 --- /dev/null +++ b/util/ego/build.py @@ -0,0 +1,79 @@ +from build.ab import export, simplerule, filenamesof, targetof, filenameof +from build.c import cprogram +from glob import glob +from fnmatch import filter + +em_mnem = filter(filenamesof([targetof("modules/src/em_data")]), "*/em_mnem.h")[ + 0 +] +exports = {} + + +def build_ego_helper(name, srcs=[], deps=[]): + cprogram( + name=name, + srcs=( + glob(f"util/ego/{name}/*.c") + glob(f"util/ego/{name}/*.h") + srcs + ), + deps=[ + "util/ego/share", + "modules/src/em_data", + "modules/src/system", + "h", + ] + + deps, + cflags=["-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"], + ) + exports[f"$(PLATDEP)/ego/{name}"] = f".+{name}" + + +def build_descr(name): + simplerule( + name=f"{name}_descr", + ins=[ + "lang/cem/cpp.ansi", + f"./descr/{name}.descr", + "./descr/descr.sed", + em_mnem, + ], + outs=[f"={name}.descr"], + commands=[ + "$[ins[0]] -P -I$[dirname(filenameof(ins[3]))] $[ins[1]] > $[dir]/temp", + "sed -f $[ins[2]] < $[dir]/temp > $[outs]", + ], + ) + + exports[f"$(PLATIND)/ego/{name}.descr"] = f".+{name}_descr" + + +build_ego_helper("bo") +build_ego_helper("ca") +build_ego_helper("cf") +build_ego_helper("cj") +build_ego_helper("cs") +build_ego_helper("ic") +build_ego_helper("il") +build_ego_helper("lv") +build_ego_helper("sp") +build_ego_helper("sr") +build_ego_helper("ud") + +build_descr("i86") + +cprogram( + name="em_ego", + srcs=["./em_ego/em_ego.c"], + deps=[ + "modules/src/string", + "modules/src/system", + "modules/src/data", + "modules/h", + "h", + ], +) + +export( + name="all", + items={"$(PLATDEP)/em_ego": ".+em_ego", "$(PLATDEP)/ego/ra": "./ra"} + | exports, +) diff --git a/util/ego/ca/ca.c b/util/ego/ca/ca.c index d3d4bab2b5..64d56af48d 100644 --- a/util/ego/ca/ca.c +++ b/util/ego/ca/ca.c @@ -14,15 +14,15 @@ #include #include #include "system.h" -#include "../share/types.h" +#include "ego/share/types.h" #include "ca.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/files.h" -#include "../share/map.h" -#include "../share/alloc.h" -#include "../share/get.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/files.h" +#include "ego/share/map.h" +#include "ego/share/alloc.h" +#include "ego/share/get.h" #include "ca_put.h" /* This phase transforms the Intermediate Code of the global optimizer diff --git a/util/ego/ca/ca_put.c b/util/ego/ca/ca_put.c index e7457809a2..dd25181760 100644 --- a/util/ego/ca/ca_put.c +++ b/util/ego/ca/ca_put.c @@ -9,13 +9,13 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "ca.h" #include "ca_put.h" -#include "../share/debug.h" -#include "../share/def.h" -#include "../share/map.h" -#include "../share/alloc.h" +#include "ego/share/debug.h" +#include "ego/share/def.h" +#include "ego/share/map.h" +#include "ego/share/alloc.h" #define outbyte(b) putc(b, outfile) diff --git a/util/ego/cf/cf.c b/util/ego/cf/cf.c index 86aa8161f0..24b6768fa0 100644 --- a/util/ego/cf/cf.c +++ b/util/ego/cf/cf.c @@ -15,18 +15,18 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/map.h" -#include "../share/files.h" -#include "../share/global.h" -#include "../share/alloc.h" -#include "../share/lset.h" -#include "../share/cset.h" -#include "../share/get.h" -#include "../share/put.h" -#include "../share/def.h" -#include "../share/utils.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/map.h" +#include "ego/share/files.h" +#include "ego/share/global.h" +#include "ego/share/alloc.h" +#include "ego/share/lset.h" +#include "ego/share/cset.h" +#include "ego/share/get.h" +#include "ego/share/put.h" +#include "ego/share/def.h" +#include "ego/share/utils.h" #include "cf.h" #include "cf_succ.h" #include "cf_idom.h" diff --git a/util/ego/cf/cf_idom.c b/util/ego/cf/cf_idom.c index b76487cf0f..cc982e4e65 100644 --- a/util/ego/cf/cf_idom.c +++ b/util/ego/cf/cf_idom.c @@ -8,10 +8,10 @@ * C F _ I D O M . C */ -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/lset.h" -#include "../share/alloc.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/lset.h" +#include "ego/share/alloc.h" #include "cf.h" /* The algorithm for finding dominators in a flowgraph diff --git a/util/ego/cf/cf_loop.c b/util/ego/cf/cf_loop.c index 992495f86f..557d97de05 100644 --- a/util/ego/cf/cf_loop.c +++ b/util/ego/cf/cf_loop.c @@ -9,11 +9,11 @@ */ #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/lset.h" -#include "../share/alloc.h" -#include "../share/utils.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/lset.h" +#include "ego/share/alloc.h" +#include "ego/share/utils.h" #include "cf.h" #define MARK_STRONG(b) b->b_flags |= BF_STRONG diff --git a/util/ego/cf/cf_succ.c b/util/ego/cf/cf_succ.c index 50bd7dc47d..0bce2f6b10 100644 --- a/util/ego/cf/cf_succ.c +++ b/util/ego/cf/cf_succ.c @@ -13,15 +13,15 @@ #include #include #include -#include "../share/types.h" -#include "../share/def.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/cset.h" +#include "ego/share/types.h" +#include "ego/share/def.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/cset.h" #include "cf.h" #include "cf_succ.h" -#include "../share/map.h" +#include "ego/share/map.h" extern char em_flag[]; diff --git a/util/ego/cj/cj.c b/util/ego/cj/cj.c index f5e67cdce7..c229ae71f8 100644 --- a/util/ego/cj/cj.c +++ b/util/ego/cj/cj.c @@ -13,19 +13,19 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/files.h" -#include "../share/get.h" -#include "../share/put.h" -#include "../share/lset.h" -#include "../share/map.h" -#include "../share/alloc.h" -#include "../share/utils.h" -#include "../share/def.h" -#include "../share/stack_chg.h" -#include "../share/go.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/files.h" +#include "ego/share/get.h" +#include "ego/share/put.h" +#include "ego/share/lset.h" +#include "ego/share/map.h" +#include "ego/share/alloc.h" +#include "ego/share/utils.h" +#include "ego/share/def.h" +#include "ego/share/stack_chg.h" +#include "ego/share/go.h" /* Cross jumping performs optimzations like: * diff --git a/util/ego/cs/cs.c b/util/ego/cs/cs.c index 4c7f9b9464..d12492cde1 100644 --- a/util/ego/cs/cs.c +++ b/util/ego/cs/cs.c @@ -8,10 +8,10 @@ #include #include -#include "../share/types.h" -#include "../share/lset.h" -#include "../share/debug.h" -#include "../share/go.h" +#include "ego/share/types.h" +#include "ego/share/lset.h" +#include "ego/share/debug.h" +#include "ego/share/go.h" #include "cs.h" #include "cs_aux.h" #include "cs_avail.h" diff --git a/util/ego/cs/cs_alloc.c b/util/ego/cs/cs_alloc.c index 3b74955c25..cd663c3f86 100644 --- a/util/ego/cs/cs_alloc.c +++ b/util/ego/cs/cs_alloc.c @@ -4,8 +4,8 @@ * See the copyright notice in the ACK home directory, in the file "Copyright". */ #include -#include "../share/types.h" -#include "../share/alloc.h" +#include "ego/share/types.h" +#include "ego/share/alloc.h" #include "cs.h" occur_p newoccur(line_p l1, line_p l2, bblock_p b) diff --git a/util/ego/cs/cs_aux.c b/util/ego/cs/cs_aux.c index 8a0c8afecc..4431032c2b 100644 --- a/util/ego/cs/cs_aux.c +++ b/util/ego/cs/cs_aux.c @@ -3,11 +3,11 @@ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. * See the copyright notice in the ACK home directory, in the file "Copyright". */ -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/utils.h" -#include "../share/global.h" -#include "../share/lset.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/utils.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" #include "cs.h" #include "cs_entity.h" diff --git a/util/ego/cs/cs_avail.c b/util/ego/cs/cs_avail.c index 0582f95523..6c47152c6b 100644 --- a/util/ego/cs/cs_avail.c +++ b/util/ego/cs/cs_avail.c @@ -9,11 +9,11 @@ */ #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/utils.h" -#include "../share/lset.h" -#include "../share/global.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/utils.h" +#include "ego/share/lset.h" +#include "ego/share/global.h" #include "cs.h" #include "cs_aux.h" #include "cs_debug.h" diff --git a/util/ego/cs/cs_debug.c b/util/ego/cs/cs_debug.c index a730d350f1..ba2c0e3055 100644 --- a/util/ego/cs/cs_debug.c +++ b/util/ego/cs/cs_debug.c @@ -5,9 +5,9 @@ */ #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/lset.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/lset.h" #include "cs.h" #include "cs_aux.h" #include "cs_avail.h" diff --git a/util/ego/cs/cs_elim.c b/util/ego/cs/cs_elim.c index e7a6ea7166..ddc0ab6933 100644 --- a/util/ego/cs/cs_elim.c +++ b/util/ego/cs/cs_elim.c @@ -5,12 +5,12 @@ */ #include #include -#include "../share/types.h" -#include "../share/alloc.h" -#include "../share/lset.h" -#include "../share/utils.h" -#include "../share/global.h" -#include "../share/debug.h" +#include "ego/share/types.h" +#include "ego/share/alloc.h" +#include "ego/share/lset.h" +#include "ego/share/utils.h" +#include "ego/share/global.h" +#include "ego/share/debug.h" #include "cs.h" #include "cs_avail.h" #include "cs_alloc.h" diff --git a/util/ego/cs/cs_entity.c b/util/ego/cs/cs_entity.c index 0c0965af3d..3b91ed9507 100644 --- a/util/ego/cs/cs_entity.c +++ b/util/ego/cs/cs_entity.c @@ -8,10 +8,10 @@ * O F E N T I T I E S */ -#include "../share/types.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/debug.h" +#include "ego/share/types.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/debug.h" #include "cs.h" #include "cs_alloc.h" #include "cs_aux.h" diff --git a/util/ego/cs/cs_getent.c b/util/ego/cs/cs_getent.c index cb53b79ac8..82aa7374ea 100644 --- a/util/ego/cs/cs_getent.c +++ b/util/ego/cs/cs_getent.c @@ -4,10 +4,10 @@ * See the copyright notice in the ACK home directory, in the file "Copyright". */ #include -#include "../share/types.h" -#include "../share/utils.h" -#include "../share/debug.h" -#include "../share/global.h" +#include "ego/share/types.h" +#include "ego/share/utils.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" #include "cs.h" #include "cs_aux.h" #include "cs_entity.h" diff --git a/util/ego/cs/cs_kill.c b/util/ego/cs/cs_kill.c index 8bb622eb62..b1b3a65d30 100644 --- a/util/ego/cs/cs_kill.c +++ b/util/ego/cs/cs_kill.c @@ -4,13 +4,13 @@ * See the copyright notice in the ACK home directory, in the file "Copyright". */ #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/cset.h" -#include "../share/utils.h" -#include "../share/map.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/cset.h" +#include "ego/share/utils.h" +#include "ego/share/map.h" #include "cs.h" #include "cs_aux.h" #include "cs_debug.h" diff --git a/util/ego/cs/cs_partit.c b/util/ego/cs/cs_partit.c index 00a4d7f7bc..acfef9f5bd 100644 --- a/util/ego/cs/cs_partit.c +++ b/util/ego/cs/cs_partit.c @@ -9,10 +9,10 @@ #include #include #include -#include "../share/types.h" -#include "../share/utils.h" -#include "../share/debug.h" -#include "../share/global.h" +#include "ego/share/types.h" +#include "ego/share/utils.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" #include "cs.h" #include "cs_stack.h" diff --git a/util/ego/cs/cs_profit.c b/util/ego/cs/cs_profit.c index 42af28ef46..6967587342 100644 --- a/util/ego/cs/cs_profit.c +++ b/util/ego/cs/cs_profit.c @@ -7,12 +7,12 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/utils.h" -#include "../share/cset.h" -#include "../share/lset.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/utils.h" +#include "ego/share/cset.h" +#include "ego/share/lset.h" #include "cs.h" #include "cs_alloc.h" #include "cs_aux.h" diff --git a/util/ego/cs/cs_stack.c b/util/ego/cs/cs_stack.c index 41c667ae16..e647e76572 100644 --- a/util/ego/cs/cs_stack.c +++ b/util/ego/cs/cs_stack.c @@ -6,10 +6,10 @@ /* * S T A C K M O D U L E */ -#include "../share/types.h" -#include "../share/global.h" -#include "../share/debug.h" -#include "../share/utils.h" +#include "ego/share/types.h" +#include "ego/share/global.h" +#include "ego/share/debug.h" +#include "ego/share/utils.h" #include "cs.h" #include "cs_aux.h" diff --git a/util/ego/cs/cs_vnm.c b/util/ego/cs/cs_vnm.c index 42800e6622..e9ba079b9c 100644 --- a/util/ego/cs/cs_vnm.c +++ b/util/ego/cs/cs_vnm.c @@ -7,10 +7,10 @@ /* V A L U E N U M B E R I N G M E T H O D */ #include -#include "../share/types.h" -#include "../share/global.h" -#include "../share/debug.h" -#include "../share/utils.h" +#include "ego/share/types.h" +#include "ego/share/global.h" +#include "ego/share/debug.h" +#include "ego/share/utils.h" #include "cs.h" #include "cs_alloc.h" #include "cs_aux.h" diff --git a/util/ego/ic/ic.c b/util/ego/ic/ic.c index 1a002a56c3..8e131c39ad 100644 --- a/util/ego/ic/ic.c +++ b/util/ego/ic/ic.c @@ -14,20 +14,20 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/def.h" -#include "../share/map.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/def.h" +#include "ego/share/map.h" #include "ic.h" #include "ic_lookup.h" #include "ic_aux.h" #include "ic_io.h" #include "ic_lib.h" -#include "../share/alloc.h" -#include "../share/global.h" -#include "../share/files.h" -#include "../share/put.h" -#include "../share/utils.h" +#include "ego/share/alloc.h" +#include "ego/share/global.h" +#include "ego/share/files.h" +#include "ego/share/put.h" +#include "ego/share/utils.h" /* Global variables */ diff --git a/util/ego/ic/ic_aux.c b/util/ego/ic/ic_aux.c index 0ce108d296..8cbe9bc069 100644 --- a/util/ego/ic/ic_aux.c +++ b/util/ego/ic/ic_aux.c @@ -11,15 +11,15 @@ #include #include #include -#include "../share/types.h" -#include "../share/global.h" -#include "../share/debug.h" -#include "../share/def.h" -#include "../share/utils.h" +#include "ego/share/types.h" +#include "ego/share/global.h" +#include "ego/share/debug.h" +#include "ego/share/def.h" +#include "ego/share/utils.h" #include "ic.h" #include "ic_io.h" #include "ic_lookup.h" -#include "../share/alloc.h" +#include "ego/share/alloc.h" #include "ic_aux.h" /* opr_size */ diff --git a/util/ego/ic/ic_io.c b/util/ego/ic/ic_io.c index 7c74f57f3e..ac10088ca4 100644 --- a/util/ego/ic/ic_io.c +++ b/util/ego/ic/ic_io.c @@ -12,11 +12,11 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" #include "ic.h" #include "ic_lookup.h" -#include "../share/alloc.h" +#include "ego/share/alloc.h" #include "ic_io.h" static short libstate; diff --git a/util/ego/ic/ic_lib.c b/util/ego/ic/ic_lib.c index ea45028e7a..f9ab285bc6 100644 --- a/util/ego/ic/ic_lib.c +++ b/util/ego/ic/ic_lib.c @@ -13,13 +13,13 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" #include "ic.h" #include "ic_lookup.h" #include "ic_io.h" -#include "../share/global.h" -#include "../share/files.h" +#include "ego/share/global.h" +#include "ego/share/files.h" #include "ic_lib.h" static void skip_string(offset n) diff --git a/util/ego/ic/ic_lookup.c b/util/ego/ic/ic_lookup.c index 078793434f..a81cb7e825 100644 --- a/util/ego/ic/ic_lookup.c +++ b/util/ego/ic/ic_lookup.c @@ -12,13 +12,13 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/map.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/map.h" #include "ic.h" #include "ic_io.h" #include "ic_lookup.h" -#include "../share/alloc.h" +#include "ego/share/alloc.h" sym_p symhash[NSYMHASH]; prc_p prochash[NPROCHASH]; diff --git a/util/ego/il/il.c b/util/ego/il/il.c index ccd3620f2c..db569120a2 100644 --- a/util/ego/il/il.c +++ b/util/ego/il/il.c @@ -13,23 +13,23 @@ #include #include #include "system.h" -#include "../share/types.h" +#include "ego/share/types.h" #include "il.h" -#include "../share/debug.h" -#include "../share/alloc.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/files.h" -#include "../share/map.h" +#include "ego/share/debug.h" +#include "ego/share/alloc.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/files.h" +#include "ego/share/map.h" #include "il_aux.h" #include "il1_anal.h" #include "il1_aux.h" #include "il2_aux.h" #include "il3_change.h" #include "il3_subst.h" -#include "../share/get.h" -#include "../share/put.h" -#include "../share/go.h" +#include "ego/share/get.h" +#include "ego/share/put.h" +#include "ego/share/go.h" #include int calnr; diff --git a/util/ego/il/il1_anal.c b/util/ego/il/il1_anal.c index 46a2387d7c..325ca20a05 100644 --- a/util/ego/il/il1_anal.c +++ b/util/ego/il/il1_anal.c @@ -11,20 +11,20 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "il.h" -#include "../share/debug.h" -#include "../share/alloc.h" -#include "../share/cset.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/utils.h" +#include "ego/share/debug.h" +#include "ego/share/alloc.h" +#include "ego/share/cset.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/utils.h" #include "il1_aux.h" #include "il1_formal.h" #include "il1_cal.h" #include "il1_anal.h" #include "il_aux.h" -#include "../share/put.h" +#include "ego/share/put.h" #define ENVIRON(p) (p->p_flags1 & (byte)PF_ENVIRON) #define RETURN_BLOCK(b) (Lnrelems(b->b_succ) == 0) diff --git a/util/ego/il/il1_aux.c b/util/ego/il/il1_aux.c index a576dd4381..d5cd58604d 100644 --- a/util/ego/il/il1_aux.c +++ b/util/ego/il/il1_aux.c @@ -10,12 +10,12 @@ #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "il.h" -#include "../share/debug.h" -#include "../share/alloc.h" -#include "../share/global.h" -#include "../share/lset.h" +#include "ego/share/debug.h" +#include "ego/share/alloc.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" #include "il_aux.h" #include "il1_aux.h" diff --git a/util/ego/il/il1_cal.c b/util/ego/il/il1_cal.c index c5158ecabb..e31ccd0ee1 100644 --- a/util/ego/il/il1_cal.c +++ b/util/ego/il/il1_cal.c @@ -11,16 +11,16 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "il.h" #include "il_aux.h" #include "il1_cal.h" -#include "../share/debug.h" -#include "../share/alloc.h" -#include "../share/global.h" -#include "../share/lset.h" +#include "ego/share/debug.h" +#include "ego/share/alloc.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" #include "il1_aux.h" -#include "../share/parser.h" +#include "ego/share/parser.h" static actual_p acts, *app; diff --git a/util/ego/il/il1_formal.c b/util/ego/il/il1_formal.c index cbd5bd145f..760a8a9dcf 100644 --- a/util/ego/il/il1_formal.c +++ b/util/ego/il/il1_formal.c @@ -8,12 +8,12 @@ * I L 1 _ F O R M A L . C */ -#include "../share/types.h" +#include "ego/share/types.h" #include "il.h" -#include "../share/debug.h" -#include "../share/alloc.h" -#include "../share/global.h" -#include "../share/lset.h" +#include "ego/share/debug.h" +#include "ego/share/alloc.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" #include "il1_aux.h" #include "il1_formal.h" diff --git a/util/ego/il/il2_aux.c b/util/ego/il/il2_aux.c index 1f0659b925..8db450f080 100644 --- a/util/ego/il/il2_aux.c +++ b/util/ego/il/il2_aux.c @@ -12,17 +12,17 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "il.h" -#include "../share/debug.h" -#include "../share/alloc.h" -#include "../share/global.h" -#include "../share/cset.h" -#include "../share/lset.h" +#include "ego/share/debug.h" +#include "ego/share/alloc.h" +#include "ego/share/global.h" +#include "ego/share/cset.h" +#include "ego/share/lset.h" #include "il_aux.h" #include "il2_aux.h" -#include "../share/get.h" -#include "../share/utils.h" +#include "ego/share/get.h" +#include "ego/share/utils.h" #define USE_INDIR(p) (p->p_use->u_flags & UF_INDIR) diff --git a/util/ego/il/il3_aux.c b/util/ego/il/il3_aux.c index c54681dbca..2a2e37ce43 100644 --- a/util/ego/il/il3_aux.c +++ b/util/ego/il/il3_aux.c @@ -8,11 +8,11 @@ * I L 3 _ A U X . C */ -#include "../share/types.h" +#include "ego/share/types.h" #include "il.h" -#include "../share/debug.h" -#include "../share/alloc.h" -#include "../share/global.h" +#include "ego/share/debug.h" +#include "ego/share/alloc.h" +#include "ego/share/global.h" #include "il3_aux.h" line_p last_line(line_p lines) diff --git a/util/ego/il/il3_change.c b/util/ego/il/il3_change.c index 62a5122310..fb6f3cbf4e 100644 --- a/util/ego/il/il3_change.c +++ b/util/ego/il/il3_change.c @@ -14,16 +14,16 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "il.h" -#include "../share/debug.h" -#include "../share/alloc.h" -#include "../share/global.h" -#include "../share/def.h" -#include "../share/lset.h" -#include "../share/utils.h" -#include "../share/get.h" -#include "../share/put.h" +#include "ego/share/debug.h" +#include "ego/share/alloc.h" +#include "ego/share/global.h" +#include "ego/share/def.h" +#include "ego/share/lset.h" +#include "ego/share/utils.h" +#include "ego/share/get.h" +#include "ego/share/put.h" #include "il_aux.h" #include "il3_change.h" #include "il3_aux.h" diff --git a/util/ego/il/il3_subst.c b/util/ego/il/il3_subst.c index 9da0003f37..0a369da0bc 100644 --- a/util/ego/il/il3_subst.c +++ b/util/ego/il/il3_subst.c @@ -10,13 +10,13 @@ #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "il.h" -#include "../share/debug.h" -#include "../share/alloc.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/get.h" +#include "ego/share/debug.h" +#include "ego/share/alloc.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/get.h" #include "il_aux.h" #include "il3_aux.h" #include "il3_change.h" diff --git a/util/ego/il/il_aux.c b/util/ego/il/il_aux.c index e08c564578..14b4f73064 100644 --- a/util/ego/il/il_aux.c +++ b/util/ego/il/il_aux.c @@ -14,15 +14,15 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "il.h" -#include "../share/debug.h" -#include "../share/get.h" -#include "../share/put.h" -#include "../share/alloc.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/map.h" +#include "ego/share/debug.h" +#include "ego/share/get.h" +#include "ego/share/put.h" +#include "ego/share/alloc.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/map.h" #include "il_aux.h" int tsize(int type) diff --git a/util/ego/lv/lv.c b/util/ego/lv/lv.c index 9a18c5b9c5..7cb41f9e42 100644 --- a/util/ego/lv/lv.c +++ b/util/ego/lv/lv.c @@ -13,23 +13,23 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "lv.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/cset.h" -#include "../share/def.h" -#include "../share/files.h" -#include "../share/alloc.h" -#include "../share/map.h" -#include "../share/get.h" -#include "../share/put.h" -#include "../share/utils.h" -#include "../share/init_glob.h" -#include "../share/locals.h" -#include "../share/go.h" -#include "../share/parser.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/cset.h" +#include "ego/share/def.h" +#include "ego/share/files.h" +#include "ego/share/alloc.h" +#include "ego/share/map.h" +#include "ego/share/get.h" +#include "ego/share/put.h" +#include "ego/share/utils.h" +#include "ego/share/init_glob.h" +#include "ego/share/locals.h" +#include "ego/share/go.h" +#include "ego/share/parser.h" #define newlvbx() (bext_p) newstruct(bext_lv) #define oldlvbx(x) oldstruct(bext_lv, x) diff --git a/util/ego/ra/build.py b/util/ego/ra/build.py new file mode 100644 index 0000000000..35d5427fff --- /dev/null +++ b/util/ego/ra/build.py @@ -0,0 +1,46 @@ +from build.ab import simplerule, filenamesof, targetof +from build.c import hostcprogram, cprogram +from fnmatch import filter + +hostcprogram(name="makeitems", srcs=["./makeitems.c"]) + +em_mnem = filter(filenamesof([targetof("modules/src/em_data")]), "*/em_mnem.h")[ + 0 +] +simplerule( + name="itemtab_h", + ins=[".+makeitems", em_mnem, "./itemtab.src"], + outs=["=itemtab.h"], + commands=["$[ins] > $[outs]"], +) + +cprogram( + name="ra", + srcs=[ + "./ra_allocl.c", + "./ra_aux.c", + "./ra.c", + "./ra_interv.c", + "./ra_items.c", + "./ra_lifet.c", + "./ra_pack.c", + "./ra_profits.c", + "./ra_xform.c", + ".+itemtab_h", + "./ra_allocl.h", + "./ra_aux.h", + "./ra.h", + "./ra_interv.h", + "./ra_items.h", + "./ra_lifet.h", + "./ra_pack.h", + "./ra_profits.h", + "./ra_xform.h", + ], + deps={ + "util/ego/share", + "modules/src/em_data", + "h", + }, + cflags=["-DVERBOSE", "-DNOTCOMPACT"], +) diff --git a/util/ego/ra/ra.c b/util/ego/ra/ra.c index 9f39693e5f..c9d8d41432 100644 --- a/util/ego/ra/ra.c +++ b/util/ego/ra/ra.c @@ -12,17 +12,17 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/files.h" -#include "../share/get.h" -#include "../share/put.h" -#include "../share/cset.h" -#include "../share/lset.h" -#include "../share/map.h" -#include "../share/alloc.h" -#include "../share/go.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/files.h" +#include "ego/share/get.h" +#include "ego/share/put.h" +#include "ego/share/cset.h" +#include "ego/share/lset.h" +#include "ego/share/map.h" +#include "ego/share/alloc.h" +#include "ego/share/go.h" #include "ra.h" #include "ra_items.h" #include "ra_allocl.h" diff --git a/util/ego/ra/ra_allocl.c b/util/ego/ra/ra_allocl.c index 95b3d701e2..0f4c5002d2 100644 --- a/util/ego/ra/ra_allocl.c +++ b/util/ego/ra/ra_allocl.c @@ -12,15 +12,15 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/def.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/cset.h" -#include "../share/utils.h" -#include "../share/alloc.h" -#include "../share/map.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/def.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/cset.h" +#include "ego/share/utils.h" +#include "ego/share/alloc.h" +#include "ego/share/map.h" #include "ra.h" #include "ra_aux.h" #include "ra_items.h" diff --git a/util/ego/ra/ra_aux.c b/util/ego/ra/ra_aux.c index 4c447ed34f..0cb0661ce1 100644 --- a/util/ego/ra/ra_aux.c +++ b/util/ego/ra/ra_aux.c @@ -12,12 +12,12 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/def.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/alloc.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/def.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/alloc.h" #include "ra.h" #include "ra_aux.h" diff --git a/util/ego/ra/ra_interv.c b/util/ego/ra/ra_interv.c index 4fda76074d..0f14971b84 100644 --- a/util/ego/ra/ra_interv.c +++ b/util/ego/ra/ra_interv.c @@ -10,11 +10,11 @@ #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/alloc.h" -#include "../share/lset.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/alloc.h" +#include "ego/share/lset.h" #include "ra.h" #include "ra_interv.h" diff --git a/util/ego/ra/ra_items.c b/util/ego/ra/ra_items.c index 61cba14ce9..e1468ad6d8 100644 --- a/util/ego/ra/ra_items.c +++ b/util/ego/ra/ra_items.c @@ -12,13 +12,13 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/def.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/utils.h" -#include "../share/alloc.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/def.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/utils.h" +#include "ego/share/alloc.h" #include "ra.h" #include "ra_aux.h" #include "ra_items.h" diff --git a/util/ego/ra/ra_lifet.c b/util/ego/ra/ra_lifet.c index d4349452b5..122249503d 100644 --- a/util/ego/ra/ra_lifet.c +++ b/util/ego/ra/ra_lifet.c @@ -14,13 +14,13 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/def.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/utils.h" -#include "../share/alloc.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/def.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/utils.h" +#include "ego/share/alloc.h" #include "ra.h" #include "ra_aux.h" #include "ra_interv.h" diff --git a/util/ego/ra/ra_pack.c b/util/ego/ra/ra_pack.c index c1cc81c88d..2a542da985 100644 --- a/util/ego/ra/ra_pack.c +++ b/util/ego/ra/ra_pack.c @@ -10,14 +10,14 @@ #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/def.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/cset.h" -#include "../share/alloc.h" -#include "../share/utils.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/def.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/cset.h" +#include "ego/share/alloc.h" +#include "ego/share/utils.h" #include "ra.h" #include "ra_aux.h" #include "ra_interv.h" diff --git a/util/ego/ra/ra_profits.c b/util/ego/ra/ra_profits.c index 6d08234054..112ee24929 100644 --- a/util/ego/ra/ra_profits.c +++ b/util/ego/ra/ra_profits.c @@ -10,10 +10,10 @@ #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/lset.h" -#include "../share/global.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/lset.h" +#include "ego/share/global.h" #include "ra.h" #include "ra_aux.h" #include "ra_profits.h" diff --git a/util/ego/ra/ra_xform.c b/util/ego/ra/ra_xform.c index 7e1bbb8390..ef7c568be9 100644 --- a/util/ego/ra/ra_xform.c +++ b/util/ego/ra/ra_xform.c @@ -14,13 +14,13 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/def.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/utils.h" -#include "../share/alloc.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/def.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/utils.h" +#include "ego/share/alloc.h" #include "ra.h" #include "ra_interv.h" #include "ra_xform.h" diff --git a/util/ego/share/build.py b/util/ego/share/build.py new file mode 100644 index 0000000000..c23a2a579f --- /dev/null +++ b/util/ego/share/build.py @@ -0,0 +1,96 @@ +from build.ab import simplerule, filenamesof, targetof +from build.c import clibrary, hostcprogram +from fnmatch import filter + +hostcprogram(name="makecldef", srcs=["./makecldef.c"]) + +em_mnem = filter(filenamesof([targetof("modules/src/em_data")]), "*/em_mnem.h")[ + 0 +] +simplerule( + name="classdefs_h", + ins=[ + ".+makecldef", + em_mnem, + "./cldefs.src", + ], + outs=["=classdefs.h"], + commands=["$[ins] > $[outs]"], +) + +simplerule( + name="pop_push_h", + ins=[ + "./pop_push.awk", + "h/em_table", + ], + outs=["=pop_push.h"], + commands=["awk -f $[ins[0]] < $[ins[1]] > $[outs]"], +) + +clibrary( + name="share", + srcs=[ + ".+classdefs_h", + ".+pop_push_h", + "./debug.c", + "./global.c", + "./files.c", + "./go.c", + "./map.c", + "./utils.c", + "./get.c", + "./put.c", + "./alloc.c", + "./lset.c", + "./cset.c", + "./parser.c", + "./stack_chg.c", + "./locals.c", + "./init_glob.c", + "./alloc.h", + "./cset.h", + "./debug.h", + "./def.h", + "./files.h", + "./get.h", + "./global.h", + "./go.h", + "./init_glob.h", + "./locals.h", + "./lset.h", + "./map.h", + "./parser.h", + "./put.h", + "./stack_chg.h", + "./types.h", + "./utils.h", + ], + hdrs={ + f"ego/share/{k}": f"./{k}" + for k in [ + "alloc.h", + "cset.h", + "debug.h", + "def.h", + "files.h", + "get.h", + "global.h", + "go.h", + "init_glob.h", + "locals.h", + "lset.h", + "map.h", + "parser.h", + "put.h", + "stack_chg.h", + "types.h", + "utils.h", + ] + }, + deps=[ + "h", + "modules/src/em_data", + ], + cflags=["-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"], +) diff --git a/util/ego/sp/sp.c b/util/ego/sp/sp.c index e1c6761329..8a0db7a2a8 100644 --- a/util/ego/sp/sp.c +++ b/util/ego/sp/sp.c @@ -13,18 +13,18 @@ #include #include #include -#include "../share/types.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/files.h" -#include "../share/get.h" -#include "../share/put.h" -#include "../share/lset.h" -#include "../share/map.h" -#include "../share/alloc.h" -#include "../share/utils.h" -#include "../share/go.h" -#include "../share/stack_chg.h" +#include "ego/share/types.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/files.h" +#include "ego/share/get.h" +#include "ego/share/put.h" +#include "ego/share/lset.h" +#include "ego/share/map.h" +#include "ego/share/alloc.h" +#include "ego/share/utils.h" +#include "ego/share/go.h" +#include "ego/share/stack_chg.h" /* Stack pollution throws away the ASP instructions after a procedure call. * This saves a lot of code, at the cost of some extra stack space. diff --git a/util/ego/sr/sr.c b/util/ego/sr/sr.c index b3fa72a1a2..ea5ae9ed03 100644 --- a/util/ego/sr/sr.c +++ b/util/ego/sr/sr.c @@ -8,18 +8,18 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "sr.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/files.h" -#include "../share/get.h" -#include "../share/put.h" -#include "../share/lset.h" -#include "../share/map.h" -#include "../share/alloc.h" -#include "../share/go.h" -#include "../share/utils.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/files.h" +#include "ego/share/get.h" +#include "ego/share/put.h" +#include "ego/share/lset.h" +#include "ego/share/map.h" +#include "ego/share/alloc.h" +#include "ego/share/go.h" +#include "ego/share/utils.h" #include "sr_aux.h" #include "sr_iv.h" #include "sr_reduce.h" diff --git a/util/ego/sr/sr_aux.c b/util/ego/sr/sr_aux.c index d59bf2f696..977f665fc5 100644 --- a/util/ego/sr/sr_aux.c +++ b/util/ego/sr/sr_aux.c @@ -11,12 +11,12 @@ #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "sr.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/utils.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/utils.h" #include "sr_aux.h" #include "sr_xform.h" diff --git a/util/ego/sr/sr_cand.c b/util/ego/sr/sr_cand.c index d1f022cb62..a278bba8fa 100644 --- a/util/ego/sr/sr_cand.c +++ b/util/ego/sr/sr_cand.c @@ -10,13 +10,13 @@ #include #include -#include "../share/types.h" -#include "../share/lset.h" -#include "../share/cset.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/map.h" -#include "../share/utils.h" +#include "ego/share/types.h" +#include "ego/share/lset.h" +#include "ego/share/cset.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/map.h" +#include "ego/share/utils.h" #include "sr.h" #include "sr_aux.h" #include "sr_cand.h" diff --git a/util/ego/sr/sr_expr.c b/util/ego/sr/sr_expr.c index 6fbb026f7f..59a017eb75 100644 --- a/util/ego/sr/sr_expr.c +++ b/util/ego/sr/sr_expr.c @@ -11,13 +11,13 @@ #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "sr.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/utils.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/utils.h" #include "sr_aux.h" -#include "../share/lset.h" +#include "ego/share/lset.h" #include "sr_iv.h" #define ME_NONE 0 diff --git a/util/ego/sr/sr_iv.c b/util/ego/sr/sr_iv.c index 4b825c280c..987fb0c1c1 100644 --- a/util/ego/sr/sr_iv.c +++ b/util/ego/sr/sr_iv.c @@ -11,14 +11,14 @@ #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "sr.h" -#include "../share/lset.h" -#include "../share/cset.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/alloc.h" -#include "../share/utils.h" +#include "ego/share/lset.h" +#include "ego/share/cset.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/alloc.h" +#include "ego/share/utils.h" #include "sr_aux.h" #include "sr_cand.h" #include "sr_iv.h" diff --git a/util/ego/sr/sr_reduce.c b/util/ego/sr/sr_reduce.c index 1b6c8d7301..5a7971f946 100644 --- a/util/ego/sr/sr_reduce.c +++ b/util/ego/sr/sr_reduce.c @@ -15,15 +15,15 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "sr.h" -#include "../share/debug.h" -#include "../share/alloc.h" -#include "../share/def.h" -#include "../share/global.h" -#include "../share/utils.h" +#include "ego/share/debug.h" +#include "ego/share/alloc.h" +#include "ego/share/def.h" +#include "ego/share/global.h" +#include "ego/share/utils.h" #include "sr_aux.h" -#include "../share/lset.h" +#include "ego/share/lset.h" #include "sr_xform.h" #include "sr_reduce.h" #include "sr_expr.h" diff --git a/util/ego/sr/sr_xform.c b/util/ego/sr/sr_xform.c index 67bb065b36..1c6584fd0f 100644 --- a/util/ego/sr/sr_xform.c +++ b/util/ego/sr/sr_xform.c @@ -13,16 +13,16 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "sr.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/alloc.h" -#include "../share/def.h" -#include "../share/get.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/alloc.h" +#include "ego/share/def.h" +#include "ego/share/get.h" #include "sr_aux.h" -#include "../share/lset.h" -#include "../share/utils.h" +#include "ego/share/lset.h" +#include "ego/share/utils.h" #include "sr_xform.h" /* Transformations on EM texts */ diff --git a/util/ego/ud/ud.c b/util/ego/ud/ud.c index 26331f29aa..6bda5340c4 100644 --- a/util/ego/ud/ud.c +++ b/util/ego/ud/ud.c @@ -9,22 +9,22 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "ud.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/cset.h" -#include "../share/def.h" -#include "../share/files.h" -#include "../share/map.h" -#include "../share/get.h" -#include "../share/put.h" -#include "../share/alloc.h" -#include "../share/utils.h" -#include "../share/init_glob.h" -#include "../share/locals.h" -#include "../share/go.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/cset.h" +#include "ego/share/def.h" +#include "ego/share/files.h" +#include "ego/share/map.h" +#include "ego/share/get.h" +#include "ego/share/put.h" +#include "ego/share/alloc.h" +#include "ego/share/utils.h" +#include "ego/share/init_glob.h" +#include "ego/share/locals.h" +#include "ego/share/go.h" #include "ud_defs.h" #include "ud_const.h" #include "ud_copy.h" diff --git a/util/ego/ud/ud_aux.c b/util/ego/ud/ud_aux.c index f3db11e294..09bf423873 100644 --- a/util/ego/ud/ud_aux.c +++ b/util/ego/ud/ud_aux.c @@ -11,16 +11,16 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "ud.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/alloc.h" -#include "../share/lset.h" -#include "../share/cset.h" -#include "../share/def.h" -#include "../share/locals.h" -#include "../share/utils.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/alloc.h" +#include "ego/share/lset.h" +#include "ego/share/cset.h" +#include "ego/share/def.h" +#include "ego/share/locals.h" +#include "ego/share/utils.h" #include "ud_defs.h" void repl_line(line_p old, line_p new, bblock_p b) diff --git a/util/ego/ud/ud_const.c b/util/ego/ud/ud_const.c index f6b490cfde..bd4412a91f 100644 --- a/util/ego/ud/ud_const.c +++ b/util/ego/ud/ud_const.c @@ -8,16 +8,16 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "ud.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/alloc.h" -#include "../share/lset.h" -#include "../share/cset.h" -#include "../share/def.h" -#include "../share/utils.h" -#include "../share/locals.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/alloc.h" +#include "ego/share/lset.h" +#include "ego/share/cset.h" +#include "ego/share/def.h" +#include "ego/share/utils.h" +#include "ego/share/locals.h" #include "ud_defs.h" #include "ud_const.h" #include "ud_aux.h" diff --git a/util/ego/ud/ud_copy.c b/util/ego/ud/ud_copy.c index a261997a5c..79492f974e 100644 --- a/util/ego/ud/ud_copy.c +++ b/util/ego/ud/ud_copy.c @@ -8,16 +8,16 @@ #include #include #include -#include "../share/types.h" +#include "ego/share/types.h" #include "ud.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/alloc.h" -#include "../share/lset.h" -#include "../share/cset.h" -#include "../share/def.h" -#include "../share/utils.h" -#include "../share/locals.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/alloc.h" +#include "ego/share/lset.h" +#include "ego/share/cset.h" +#include "ego/share/def.h" +#include "ego/share/utils.h" +#include "ego/share/locals.h" #include "../ud/ud_defs.h" #include "ud_copy.h" #include "ud_const.h" diff --git a/util/ego/ud/ud_defs.c b/util/ego/ud/ud_defs.c index ae188e97ef..877bbb0432 100644 --- a/util/ego/ud/ud_defs.c +++ b/util/ego/ud/ud_defs.c @@ -10,17 +10,17 @@ */ #include -#include "../share/types.h" +#include "ego/share/types.h" #include "ud.h" -#include "../share/debug.h" -#include "../share/global.h" -#include "../share/lset.h" -#include "../share/cset.h" -#include "../share/map.h" -#include "../share/locals.h" +#include "ego/share/debug.h" +#include "ego/share/global.h" +#include "ego/share/lset.h" +#include "ego/share/cset.h" +#include "ego/share/map.h" +#include "ego/share/locals.h" #include "ud_defs.h" -#include "../share/alloc.h" -#include "../share/utils.h" +#include "ego/share/alloc.h" +#include "ego/share/utils.h" short nrdefs; /* total number of definitions */ short nrexpldefs; /* number of explicit definitions */ From e5a0f9c0387b245860195ff7a88fee8bffb249bb Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 18:09:01 +0200 Subject: [PATCH 23/79] The linux386 plat builds. --- build.py | 2 +- mach/i386/libem/build.py | 10 ++++++++++ mach/i386/libend/build.py | 14 +++++++++++++ mach/i386/ncg/build.py | 3 +++ plat/linux/include/build.py | 12 ++++++++++++ plat/linux386/build.py | 36 ++++++++++++++++++++++++++++++++++ plat/linux386/include/build.py | 6 ++++++ plat/linux386/libsys/build.py | 13 ++++++++++++ util/ego/build.py | 3 +++ 9 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 mach/i386/libem/build.py create mode 100644 mach/i386/libend/build.py create mode 100644 mach/i386/ncg/build.py create mode 100644 plat/linux/include/build.py create mode 100644 plat/linux386/build.py create mode 100644 plat/linux386/include/build.py create mode 100644 plat/linux386/libsys/build.py diff --git a/build.py b/build.py index 279d0c0eff..194081872d 100644 --- a/build.py +++ b/build.py @@ -1,6 +1,6 @@ from build.ab import export -PLATS = ["pc86", "cpm"] +PLATS = ["pc86", "cpm", "linux386"] # This contains the platform-independent host tooling required to build the plats. export( diff --git a/mach/i386/libem/build.py b/mach/i386/libem/build.py new file mode 100644 index 0000000000..6f7eb7a403 --- /dev/null +++ b/mach/i386/libem/build.py @@ -0,0 +1,10 @@ +from build import PLATS +from build.ack import ackclibrary +from glob import glob + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=glob("mach/i386/libem/*.s"), + plat=plat, + ) diff --git a/mach/i386/libend/build.py b/mach/i386/libend/build.py new file mode 100644 index 0000000000..cdeeb03cb8 --- /dev/null +++ b/mach/i386/libend/build.py @@ -0,0 +1,14 @@ +from build import PLATS +from build.ack import ackclibrary + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=[ + "./edata.s", + "./em_end.s", + "./end.s", + "./etext.s", + ], + plat=plat, + ) diff --git a/mach/i386/ncg/build.py b/mach/i386/ncg/build.py new file mode 100644 index 0000000000..c69132d58c --- /dev/null +++ b/mach/i386/ncg/build.py @@ -0,0 +1,3 @@ +from build.c import clibrary + +clibrary(name="ncg", hdrs={"mach.h": "./mach.h", "mach.c": "./mach.c"}) diff --git a/plat/linux/include/build.py b/plat/linux/include/build.py new file mode 100644 index 0000000000..865498ae80 --- /dev/null +++ b/plat/linux/include/build.py @@ -0,0 +1,12 @@ +from build.ab import export +from build.ack import exportheaders, clibrary +from glob import glob + +headers = glob("**/*.h", root_dir="plat/linux/include", recursive=True) + +clibrary(name="include", hdrs={k: f"./{k}" for k in headers}) + +export( + name="all", + items=exportheaders(".+include", prefix="$(PLATIND)/linux/include"), +) diff --git a/plat/linux386/build.py b/plat/linux386/build.py new file mode 100644 index 0000000000..529777a278 --- /dev/null +++ b/plat/linux386/build.py @@ -0,0 +1,36 @@ +from build.ab import export +from build.ack import ackcfile, exportheaders +from mach.proto.ncg.build import build_ncg +from plat.build import build_plat_libs +import importlib + +build_as = importlib.import_module("mach.proto.as.build").build_as + +build_as(name="as", arch="i386") +build_ncg(name="ncg", arch="i386") +build_plat_libs(name="plat_libs", arch="i386", plat="linux386") + +ackcfile(name="boot", srcs=["./boot.s"], plat="linux386") + +export( + name="tools", + items={ + "$(PLATDEP)/linux386/as": ".+as", + "$(PLATDEP)/linux386/ncg": ".+ncg", + "$(PLATIND)/descr/linux386": "./descr", + }, +) + +export( + name="all", + items={ + "$(PLATIND)/linux386/boot.o": ".+boot", + "$(PLATIND)/linux386/libsys.a": "./libsys", + }, + deps=[ + ".+tools", + ".+plat_libs", + "util/ack+all", + "plat/linux386/include+all", + ], +) diff --git a/plat/linux386/include/build.py b/plat/linux386/include/build.py new file mode 100644 index 0000000000..cfe225476d --- /dev/null +++ b/plat/linux386/include/build.py @@ -0,0 +1,6 @@ +from build.ab import export +from build.ack import clibrary + +clibrary(name="include", deps=["plat/linux/include"]) + +export(name="all", deps=["plat/linux/include+all"]) diff --git a/plat/linux386/libsys/build.py b/plat/linux386/libsys/build.py new file mode 100644 index 0000000000..2307fce9ed --- /dev/null +++ b/plat/linux386/libsys/build.py @@ -0,0 +1,13 @@ +from build.ack import ackclibrary +from glob import glob + +ackclibrary( + name="libsys", + plat="linux386", + srcs=( + glob("plat/linux386/libsys/*.s") + + glob("plat/linux/libsys/*.c") + + glob("plat/linux/libsys/*.h") + ), + deps=["lang/cem/libcc.ansi/headers", "plat/linux386/include"], +) diff --git a/util/ego/build.py b/util/ego/build.py index 2f5cf83d59..c29b078cb1 100644 --- a/util/ego/build.py +++ b/util/ego/build.py @@ -58,7 +58,10 @@ def build_descr(name): build_ego_helper("sr") build_ego_helper("ud") +build_descr("i386") build_descr("i86") +build_descr("m68020") +build_descr("powerpc") cprogram( name="em_ego", From c43ccd1ef321681b9a580d9492b648e4b65d5199 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 20:18:12 +0200 Subject: [PATCH 24/79] The linux68k plat builds. --- build.py | 2 +- mach/m68020/libem/build.py | 11 ++++++++++ mach/m68020/libend/build.py | 14 ++++++++++++ mach/m68020/ncg/build.py | 10 +++++++++ mach/proto/ncg/build.py | 22 +++++++++++-------- plat/linux386/libsys/build.py | 1 + plat/linux68k/build.py | 40 ++++++++++++++++++++++++++++++++++ plat/linux68k/include/build.py | 6 +++++ plat/linux68k/libsys/build.py | 14 ++++++++++++ util/ncgg/build.py | 6 +++-- 10 files changed, 114 insertions(+), 12 deletions(-) create mode 100644 mach/m68020/libem/build.py create mode 100644 mach/m68020/libend/build.py create mode 100644 mach/m68020/ncg/build.py create mode 100644 plat/linux68k/build.py create mode 100644 plat/linux68k/include/build.py create mode 100644 plat/linux68k/libsys/build.py diff --git a/build.py b/build.py index 194081872d..fe552a3626 100644 --- a/build.py +++ b/build.py @@ -1,6 +1,6 @@ from build.ab import export -PLATS = ["pc86", "cpm", "linux386"] +PLATS = ["pc86", "cpm", "linux386", "linux68k"] # This contains the platform-independent host tooling required to build the plats. export( diff --git a/mach/m68020/libem/build.py b/mach/m68020/libem/build.py new file mode 100644 index 0000000000..128bdfb8f3 --- /dev/null +++ b/mach/m68020/libem/build.py @@ -0,0 +1,11 @@ +from build import PLATS +from build.ack import ackclibrary +from glob import glob + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=(glob("mach/m68020/libem/*.s") + glob("mach/m68020/libem/*.c")), + plat=plat, + deps=["h"], + ) diff --git a/mach/m68020/libend/build.py b/mach/m68020/libend/build.py new file mode 100644 index 0000000000..cdeeb03cb8 --- /dev/null +++ b/mach/m68020/libend/build.py @@ -0,0 +1,14 @@ +from build import PLATS +from build.ack import ackclibrary + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=[ + "./edata.s", + "./em_end.s", + "./end.s", + "./etext.s", + ], + plat=plat, + ) diff --git a/mach/m68020/ncg/build.py b/mach/m68020/ncg/build.py new file mode 100644 index 0000000000..fe9becd61d --- /dev/null +++ b/mach/m68020/ncg/build.py @@ -0,0 +1,10 @@ +from build.c import clibrary + +clibrary( + name="ncg", + hdrs={ + "mach.h": "./mach.h", + "mach.c": "./mach.c", + "instrmacs.h": "./instrmacs.h", + }, +) diff --git a/mach/proto/ncg/build.py b/mach/proto/ncg/build.py index 7e71598fc8..6fb6b5820d 100644 --- a/mach/proto/ncg/build.py +++ b/mach/proto/ncg/build.py @@ -8,7 +8,8 @@ def build_ncg(self, name, arch, cflags=[], deps: Targets = []): tables = ncgg( name=f"{self.localname}/tables", srcs=[f"mach/{arch}/ncg/table"], - deps=deps, + cflags=cflags, + deps=[f"mach/{arch}/ncg"] + deps, ) cprogram( @@ -44,12 +45,15 @@ def build_ncg(self, name, arch, cflags=[], deps: Targets = []): "mach/proto/ncg/xmach.h", tables, ], - deps=[ - "h", - "modules/h", - "modules/src/flt_arith", - "modules/src/object", - "modules/src/em_data", - f"mach/{arch}/ncg", - ], + deps=( + [ + "h", + "modules/h", + "modules/src/flt_arith", + "modules/src/object", + "modules/src/em_data", + f"mach/{arch}/ncg", + ] + + deps + ), ) diff --git a/plat/linux386/libsys/build.py b/plat/linux386/libsys/build.py index 2307fce9ed..b5d75e3ef4 100644 --- a/plat/linux386/libsys/build.py +++ b/plat/linux386/libsys/build.py @@ -7,6 +7,7 @@ srcs=( glob("plat/linux386/libsys/*.s") + glob("plat/linux/libsys/*.c") + + glob("plat/linux/libsys/*.s") + glob("plat/linux/libsys/*.h") ), deps=["lang/cem/libcc.ansi/headers", "plat/linux386/include"], diff --git a/plat/linux68k/build.py b/plat/linux68k/build.py new file mode 100644 index 0000000000..5f6e1b1508 --- /dev/null +++ b/plat/linux68k/build.py @@ -0,0 +1,40 @@ +from build.ab import export +from build.ack import ackcfile, exportheaders +from mach.proto.ncg.build import build_ncg +from plat.build import build_plat_libs +import importlib + +build_as = importlib.import_module("mach.proto.as.build").build_as + +build_as(name="as", arch="m68020") +build_ncg( + name="ncg", + arch="m68020", + cflags=["-DWORD_SIZE=4", "-DTBL68020=1", "-DTBL68881=1"], +) +build_plat_libs(name="plat_libs", arch="m68020", plat="linux68k") + +ackcfile(name="boot", srcs=["./boot.s"], plat="linux68k") + +export( + name="tools", + items={ + "$(PLATDEP)/linux68k/as": ".+as", + "$(PLATDEP)/linux68k/ncg": ".+ncg", + "$(PLATIND)/descr/linux68k": "./descr", + }, +) + +export( + name="all", + items={ + "$(PLATIND)/linux68k/boot.o": ".+boot", + "$(PLATIND)/linux68k/libsys.a": "./libsys", + }, + deps=[ + ".+tools", + ".+plat_libs", + "util/ack+all", + "plat/linux68k/include+all", + ], +) diff --git a/plat/linux68k/include/build.py b/plat/linux68k/include/build.py new file mode 100644 index 0000000000..cfe225476d --- /dev/null +++ b/plat/linux68k/include/build.py @@ -0,0 +1,6 @@ +from build.ab import export +from build.ack import clibrary + +clibrary(name="include", deps=["plat/linux/include"]) + +export(name="all", deps=["plat/linux/include+all"]) diff --git a/plat/linux68k/libsys/build.py b/plat/linux68k/libsys/build.py new file mode 100644 index 0000000000..b05611a79d --- /dev/null +++ b/plat/linux68k/libsys/build.py @@ -0,0 +1,14 @@ +from build.ack import ackclibrary +from glob import glob + +ackclibrary( + name="libsys", + plat="linux68k", + srcs=( + glob("plat/linux68k/libsys/*.s") + + glob("plat/linux/libsys/*.c") + + glob("plat/linux/libsys/*.s") + + glob("plat/linux/libsys/*.h") + ), + deps=["lang/cem/libcc.ansi/headers", "plat/linux68k/include"], +) diff --git a/util/ncgg/build.py b/util/ncgg/build.py index 41853b475d..8cc88009b5 100644 --- a/util/ncgg/build.py +++ b/util/ncgg/build.py @@ -29,8 +29,10 @@ @Rule -def ncgg(self, name, srcs: Targets = [], deps: Targets = []): - cpptable = cppfile(name=f"{self.localname}/cpptable", srcs=srcs, deps=deps) +def ncgg(self, name, srcs: Targets = [], deps: Targets = [], cflags=[]): + cpptable = cppfile( + name=f"{self.localname}/cpptable", srcs=srcs, deps=deps, cflags=cflags + ) simplerule( replaces=self, From ebf24998428abb54fb076587a269ddb93c9574de Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 20:19:39 +0200 Subject: [PATCH 25/79] The Windows build needs pkg-config now. --- .github/workflows/ccpp.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index bf92155230..d868b475f4 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -41,6 +41,7 @@ jobs: mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-lua mingw-w64-ucrt-x86_64-nsis + mingw-w64-ucrt-x86_64-pkg-config bison flex zip From babcc1dff35fa70a09f96bce5c47e1b9e4f451de Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 20:24:29 +0200 Subject: [PATCH 26/79] Fix some more dependencies. --- .github/workflows/ccpp.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index d868b475f4..312dbcd041 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: brew - run: brew install python lua@5.4 + run: brew install python lua@5.4 md5sha1sum coreutils - name: make run: | make @@ -42,6 +42,7 @@ jobs: mingw-w64-ucrt-x86_64-lua mingw-w64-ucrt-x86_64-nsis mingw-w64-ucrt-x86_64-pkg-config + python bison flex zip From eba43f73b53108bf26ade72208d69ed8ba711294 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 20:25:12 +0200 Subject: [PATCH 27/79] Even more dependency fixes. --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 312dbcd041..bcece5f848 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: brew - run: brew install python lua@5.4 md5sha1sum coreutils + run: brew install python lua@5.4 coreutils - name: make run: | make From eca5fd7a70f0134ff6182ffbc7d64317f25bee50 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 21:28:35 +0200 Subject: [PATCH 28/79] Add debugging to Windows build. --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index bcece5f848..57645c9306 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -50,7 +50,7 @@ jobs: - uses: actions/checkout@v3 - name: build run: | - make LDFLAGS="-s -static" CFLAGS="-g -Os" + make V=1 LDFLAGS="-s -static" - name: package run: | make ack-setup.exe From f5dab4cdcf47889b56c2e47bb3292a591c3f6aaa Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 21:28:45 +0200 Subject: [PATCH 29/79] linuxppc now builds. --- build.py | 2 +- mach/powerpc/libem/build.py | 10 +++++++++ mach/powerpc/libend/build.py | 14 ++++++++++++ mach/powerpc/ncg/build.py | 3 +++ plat/linuxppc/build.py | 39 ++++++++++++++++++++++++++++++++++ plat/linuxppc/include/build.py | 6 ++++++ plat/linuxppc/libsys/build.py | 14 ++++++++++++ 7 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 mach/powerpc/libem/build.py create mode 100644 mach/powerpc/libend/build.py create mode 100644 mach/powerpc/ncg/build.py create mode 100644 plat/linuxppc/build.py create mode 100644 plat/linuxppc/include/build.py create mode 100644 plat/linuxppc/libsys/build.py diff --git a/build.py b/build.py index fe552a3626..6ed4a56c5e 100644 --- a/build.py +++ b/build.py @@ -1,6 +1,6 @@ from build.ab import export -PLATS = ["pc86", "cpm", "linux386", "linux68k"] +PLATS = ["pc86", "cpm", "linux386", "linux68k", "linuxppc"] # This contains the platform-independent host tooling required to build the plats. export( diff --git a/mach/powerpc/libem/build.py b/mach/powerpc/libem/build.py new file mode 100644 index 0000000000..537938e29f --- /dev/null +++ b/mach/powerpc/libem/build.py @@ -0,0 +1,10 @@ +from build import PLATS +from build.ack import ackclibrary +from glob import glob + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=glob("mach/powerpc/libem/*.s"), + plat=plat, + ) diff --git a/mach/powerpc/libend/build.py b/mach/powerpc/libend/build.py new file mode 100644 index 0000000000..cdeeb03cb8 --- /dev/null +++ b/mach/powerpc/libend/build.py @@ -0,0 +1,14 @@ +from build import PLATS +from build.ack import ackclibrary + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=[ + "./edata.s", + "./em_end.s", + "./end.s", + "./etext.s", + ], + plat=plat, + ) diff --git a/mach/powerpc/ncg/build.py b/mach/powerpc/ncg/build.py new file mode 100644 index 0000000000..c69132d58c --- /dev/null +++ b/mach/powerpc/ncg/build.py @@ -0,0 +1,3 @@ +from build.c import clibrary + +clibrary(name="ncg", hdrs={"mach.h": "./mach.h", "mach.c": "./mach.c"}) diff --git a/plat/linuxppc/build.py b/plat/linuxppc/build.py new file mode 100644 index 0000000000..a694d92304 --- /dev/null +++ b/plat/linuxppc/build.py @@ -0,0 +1,39 @@ +from build.ab import export +from build.ack import ackcfile +from mach.proto.ncg.build import build_ncg +from mach.proto.top.build import build_top +from plat.build import build_plat_libs +import importlib + +build_as = importlib.import_module("mach.proto.as.build").build_as + +build_as(name="as", arch="powerpc") +build_ncg(name="ncg", arch="powerpc") +build_top(name="top", arch="powerpc") +build_plat_libs(name="plat_libs", arch="powerpc", plat="linuxppc") + +ackcfile(name="boot", srcs=["./boot.s"], plat="linuxppc") + +export( + name="tools", + items={ + "$(PLATDEP)/linuxppc/as": ".+as", + "$(PLATDEP)/linuxppc/ncg": ".+ncg", + "$(PLATDEP)/linuxppc/top": ".+top", + "$(PLATIND)/descr/linuxppc": "./descr", + }, +) + +export( + name="all", + items={ + "$(PLATIND)/linuxppc/boot.o": ".+boot", + "$(PLATIND)/linuxppc/libsys.a": "./libsys", + }, + deps=[ + ".+tools", + ".+plat_libs", + "util/ack+all", + "plat/linuxppc/include+all", + ], +) diff --git a/plat/linuxppc/include/build.py b/plat/linuxppc/include/build.py new file mode 100644 index 0000000000..cfe225476d --- /dev/null +++ b/plat/linuxppc/include/build.py @@ -0,0 +1,6 @@ +from build.ab import export +from build.ack import clibrary + +clibrary(name="include", deps=["plat/linux/include"]) + +export(name="all", deps=["plat/linux/include+all"]) diff --git a/plat/linuxppc/libsys/build.py b/plat/linuxppc/libsys/build.py new file mode 100644 index 0000000000..78e7e82af2 --- /dev/null +++ b/plat/linuxppc/libsys/build.py @@ -0,0 +1,14 @@ +from build.ack import ackclibrary +from glob import glob + +ackclibrary( + name="libsys", + plat="linuxppc", + srcs=( + glob("plat/linuxppc/libsys/*.s") + + glob("plat/linux/libsys/*.c") + + glob("plat/linux/libsys/*.s") + + glob("plat/linux/libsys/*.h") + ), + deps=["lang/cem/libcc.ansi/headers", "plat/linuxppc/include"], +) From d3a3d1729d42bb230c88080c05642bacba1a1675 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 22:10:34 +0200 Subject: [PATCH 30/79] linuxmips (and mcg) build. --- build.py | 2 +- mach/mips/as/build.py | 14 +++++++ mach/mips/libem/build.py | 10 +++++ mach/mips/libend/build.py | 14 +++++++ mach/proto/as/build.py | 12 ++++-- mach/proto/mcg/build.py | 73 +++++++++++++++++++++++++++++++++ plat/linuxmips/build.py | 39 ++++++++++++++++++ plat/linuxmips/include/build.py | 6 +++ plat/linuxmips/libsys/build.py | 14 +++++++ util/mcgg/build.py | 56 +++++++++++++++++++++++++ util/mcgg/scan.l | 2 +- 11 files changed, 237 insertions(+), 5 deletions(-) create mode 100644 mach/mips/as/build.py create mode 100644 mach/mips/libem/build.py create mode 100644 mach/mips/libend/build.py create mode 100644 mach/proto/mcg/build.py create mode 100644 plat/linuxmips/build.py create mode 100644 plat/linuxmips/include/build.py create mode 100644 plat/linuxmips/libsys/build.py create mode 100644 util/mcgg/build.py diff --git a/build.py b/build.py index 6ed4a56c5e..210b2bae39 100644 --- a/build.py +++ b/build.py @@ -1,6 +1,6 @@ from build.ab import export -PLATS = ["pc86", "cpm", "linux386", "linux68k", "linuxppc"] +PLATS = ["pc86", "cpm", "linux386", "linux68k", "linuxppc", "linuxmips"] # This contains the platform-independent host tooling required to build the plats. export( diff --git a/mach/mips/as/build.py b/mach/mips/as/build.py new file mode 100644 index 0000000000..4dc81a5afc --- /dev/null +++ b/mach/mips/as/build.py @@ -0,0 +1,14 @@ +from build.ab import simplerule, filenamesof, targetof +from build.c import clibrary + +simplerule( + name="astables", + ins=["./mktables.lua", "./instructions.dat"], + outs=["=definitions.y", "=tokens.y", "=rules.y"], + commands=["$(LUA) $[ins[0]] $[outs] < $[ins[1]"], +) + +h = filenamesof([targetof(".+astables")]) +clibrary( + name="lib", hdrs={"definitions.y": h[0], "tokens.y": h[1], "rules.y": h[2]} +) diff --git a/mach/mips/libem/build.py b/mach/mips/libem/build.py new file mode 100644 index 0000000000..9d81eb580b --- /dev/null +++ b/mach/mips/libem/build.py @@ -0,0 +1,10 @@ +from build import PLATS +from build.ack import ackclibrary +from glob import glob + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=glob("mach/mips/libem/*.s"), + plat=plat, + ) diff --git a/mach/mips/libend/build.py b/mach/mips/libend/build.py new file mode 100644 index 0000000000..cdeeb03cb8 --- /dev/null +++ b/mach/mips/libend/build.py @@ -0,0 +1,14 @@ +from build import PLATS +from build.ack import ackclibrary + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=[ + "./edata.s", + "./em_end.s", + "./end.s", + "./etext.s", + ], + plat=plat, + ) diff --git a/mach/proto/as/build.py b/mach/proto/as/build.py index 4995d15a63..f0f2f8115e 100644 --- a/mach/proto/as/build.py +++ b/mach/proto/as/build.py @@ -5,7 +5,7 @@ @Rule -def build_as(self, name, arch): +def build_as(self, name, arch, deps: Targets = []): archlib = clibrary( name=f"{self.localname}/arch", hdrs={ @@ -19,12 +19,16 @@ def build_as(self, name, arch): "mach5.c", ] }, + deps=deps, ) preprocessedy = cppfile( name=f"{self.localname}/bisoninput", srcs=["mach/proto/as/comm2.y"], - deps=["mach/proto/as/comm0.h", "mach/proto/as/comm1.h", "h", archlib], + deps=( + ["mach/proto/as/comm0.h", "mach/proto/as/comm1.h", "h", archlib] + + deps + ), ) bisonfiles = bison(name=f"{self.localname}/bison", src=preprocessedy) @@ -42,5 +46,7 @@ def build_as(self, name, arch): "mach/proto/as/comm8.c", bisonfiles, ], - deps=["h", "modules/src/object", "modules/src/flt_arith", archlib], + deps=( + ["h", "modules/src/object", "modules/src/flt_arith", archlib] + deps + ), ) diff --git a/mach/proto/mcg/build.py b/mach/proto/mcg/build.py new file mode 100644 index 0000000000..8edeaf32d1 --- /dev/null +++ b/mach/proto/mcg/build.py @@ -0,0 +1,73 @@ +from build.ab import Rule, Targets +from build.c import cprogram +from util.mcgg.build import mcgg + + +@Rule +def build_mcg(self, name, arch, cflags=[], deps: Targets = []): + tables = mcgg( + name=f"{self.localname}/tables", + srcs=[f"mach/{arch}/mcg/table"], + cflags=cflags, + deps=deps, + ) + + cprogram( + replaces=self, + cflags=cflags, + srcs=[ + "mach/proto/mcg/basicblock.c", + "mach/proto/mcg/data.c", + "mach/proto/mcg/graph.c", + "mach/proto/mcg/hop.c", + "mach/proto/mcg/ir.c", + "mach/proto/mcg/main.c", + "mach/proto/mcg/parse_em.c", + "mach/proto/mcg/pass_convertstackops.c", + "mach/proto/mcg/pass_eliminatetrivialblocks.c", + "mach/proto/mcg/pass_groupirs.c", + "mach/proto/mcg/pass_instructionselection.c", + "mach/proto/mcg/pass_livevreganalysis.c", + "mach/proto/mcg/pass_lowerpushes.c", + "mach/proto/mcg/pass_phigroups.c", + "mach/proto/mcg/pass_prologueepilogue.c", + "mach/proto/mcg/pass_registerallocator.c", + "mach/proto/mcg/pass_removedeadblocks.c", + "mach/proto/mcg/pass_removedeadphis.c", + "mach/proto/mcg/pass_returnvalues.c", + "mach/proto/mcg/pass_splitcriticaledges.c", + "mach/proto/mcg/pass_ssa.c", + "mach/proto/mcg/pass_typeinference.c", + "mach/proto/mcg/predicates.c", + "mach/proto/mcg/procedure.c", + "mach/proto/mcg/reg.c", + "mach/proto/mcg/symbol.c", + "mach/proto/mcg/treebuilder.c", + "mach/proto/mcg/basicblock.h", + "mach/proto/mcg/graph.h", + "mach/proto/mcg/hop.h", + "mach/proto/mcg/ir.h", + "mach/proto/mcg/mcgg_generated_footer.h", + "mach/proto/mcg/mcgg_generated_header.h", + "mach/proto/mcg/mcg.h", + "mach/proto/mcg/procedure.h", + "mach/proto/mcg/reg.h", + f"mach/{arch}/mcg/platform.c", + tables, + ], + deps=( + [ + "h", + "modules/h", + "modules/src/flt_arith", + "modules/src/object", + "modules/src/em_data", + "modules/src/system", + "modules/src/em_code+lib_k", + "modules/src/read_em+lib_kv", + "modules/src/idf", + "util/mcgg+lib", + ] + + deps + ), + ) diff --git a/plat/linuxmips/build.py b/plat/linuxmips/build.py new file mode 100644 index 0000000000..23001acdf0 --- /dev/null +++ b/plat/linuxmips/build.py @@ -0,0 +1,39 @@ +from build.ab import export +from build.ack import ackcfile +from mach.proto.mcg.build import build_mcg +from mach.proto.top.build import build_top +from plat.build import build_plat_libs +import importlib + +build_as = importlib.import_module("mach.proto.as.build").build_as + +build_as(name="as", arch="mips", deps=["mach/mips/as+lib"]) +build_mcg(name="mcg", arch="mips") +build_top(name="top", arch="mips") +build_plat_libs(name="plat_libs", arch="mips", plat="linuxmips") + +ackcfile(name="boot", srcs=["./boot.s"], plat="linuxmips") + +export( + name="tools", + items={ + "$(PLATDEP)/linuxmips/as": ".+as", + "$(PLATDEP)/linuxmips/mcg": ".+mcg", + "$(PLATDEP)/linuxmips/top": ".+top", + "$(PLATIND)/descr/linuxmips": "./descr", + }, +) + +export( + name="all", + items={ + "$(PLATIND)/linuxmips/boot.o": ".+boot", + "$(PLATIND)/linuxmips/libsys.a": "./libsys", + }, + deps=[ + ".+tools", + ".+plat_libs", + "util/ack+all", + "plat/linuxmips/include+all", + ], +) diff --git a/plat/linuxmips/include/build.py b/plat/linuxmips/include/build.py new file mode 100644 index 0000000000..cfe225476d --- /dev/null +++ b/plat/linuxmips/include/build.py @@ -0,0 +1,6 @@ +from build.ab import export +from build.ack import clibrary + +clibrary(name="include", deps=["plat/linux/include"]) + +export(name="all", deps=["plat/linux/include+all"]) diff --git a/plat/linuxmips/libsys/build.py b/plat/linuxmips/libsys/build.py new file mode 100644 index 0000000000..52640d6ec6 --- /dev/null +++ b/plat/linuxmips/libsys/build.py @@ -0,0 +1,14 @@ +from build.ack import ackclibrary +from glob import glob + +ackclibrary( + name="libsys", + plat="linuxmips", + srcs=( + glob("plat/linuxmips/libsys/*.s") + + glob("plat/linux/libsys/*.c") + + glob("plat/linux/libsys/*.s") + + glob("plat/linux/libsys/*.h") + ), + deps=["lang/cem/libcc.ansi/headers", "plat/linuxmips/include"], +) diff --git a/util/mcgg/build.py b/util/mcgg/build.py new file mode 100644 index 0000000000..379974dd35 --- /dev/null +++ b/util/mcgg/build.py @@ -0,0 +1,56 @@ +from build.ab import simplerule, Targets, Rule, filenamesof, targetof +from build.c import cprogram, cppfile, clibrary +from build.yacc import bison, flex +from glob import glob + +bison(name="cggparser", src="./gram.y") +flex(name="cgglexer", src="./scan.l") + +simplerule( + name="ircodes", + ins=["./ircodes.sh", "./ir.dat"], + outs=["=ircodes-dyn.h", "=ircodes.c"], + commands=["$[ins] $[outs]"], +) + +clibrary( + name="lib", + srcs=[".+ircodes", "./ircodes.h"], + hdrs={ + "ircodes.h": "./ircodes.h", + "mcgg.h": "./mcgg.h", + "ircodes-dyn.h": filenamesof([targetof(".+ircodes")])[0], + }, +) + +cprogram( + name="mcgg", + srcs=( + glob("util/mcgg/*.c") + + glob("util/mcgg/*.h") + + [".+cggparser", ".+cgglexer"] + ), + deps=[ + ".+lib", + "h", + "modules/h", + "modules/src/em_data", + "modules/src/data", + "modules/src/system", + ], +) + + +@Rule +def mcgg(self, name, srcs: Targets = [], deps: Targets = [], cflags=[]): + cpptable = cppfile( + name=f"{self.localname}/cpptable", srcs=srcs, deps=deps, cflags=cflags + ) + + simplerule( + replaces=self, + ins=["util/mcgg", cpptable], + outs=["=tables.c", "=tables.h"], + commands=["$[ins[0]] -i $[ins[1]] -o $[outs[0]] -h $[outs[1]]"], + label="MCGG", + ) diff --git a/util/mcgg/scan.l b/util/mcgg/scan.l index 5e61f31f99..528e1356a6 100644 --- a/util/mcgg/scan.l +++ b/util/mcgg/scan.l @@ -2,7 +2,7 @@ #include #include #include "iburg.h" -#include "y.tab.h" +#include "cggparser.h" static int braces = 0; From ff9999150ba72250ccff826e9c564129cd78dedf Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 22:32:40 +0200 Subject: [PATCH 31/79] minix68k builds. --- Makefile | 3 ++- build.py | 10 ++++++++- mach/m68k2/libem/build.py | 11 +++++++++ mach/m68k2/libend/build.py | 14 ++++++++++++ plat/minix/include/build.py | 12 ++++++++++ plat/minix68k/build.py | 41 ++++++++++++++++++++++++++++++++++ plat/minix68k/cv/build.py | 7 ++++++ plat/minix68k/include/build.py | 18 +++++++++++++++ plat/minix68k/libsys/build.py | 16 +++++++++++++ 9 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 mach/m68k2/libem/build.py create mode 100644 mach/m68k2/libend/build.py create mode 100644 plat/minix/include/build.py create mode 100644 plat/minix68k/build.py create mode 100644 plat/minix68k/cv/build.py create mode 100644 plat/minix68k/include/build.py create mode 100644 plat/minix68k/libsys/build.py diff --git a/Makefile b/Makefile index b65307ad7b..af433ac539 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ BUILDDIR ?= $(ACK_TEMP_DIR)/ack-build # What build flags do you want to use for native code? -CFLAGS ?= -g \ +CFLAGS ?= -g -Os \ -Werror=return-type \ -Werror=implicit-function-declaration \ -Werror=strict-prototypes \ @@ -42,6 +42,7 @@ CFLAGS ?= -g \ -DNORETURN=_Noreturn HOSTCFLAGS = $(CFLAGS) +ACKCFLAGS = -O LDFLAGS ?= -g diff --git a/build.py b/build.py index 210b2bae39..73902191a1 100644 --- a/build.py +++ b/build.py @@ -1,6 +1,14 @@ from build.ab import export -PLATS = ["pc86", "cpm", "linux386", "linux68k", "linuxppc", "linuxmips"] +PLATS = [ + "pc86", + "cpm", + "linux386", + "linux68k", + "linuxppc", + "linuxmips", + "minix68k", +] # This contains the platform-independent host tooling required to build the plats. export( diff --git a/mach/m68k2/libem/build.py b/mach/m68k2/libem/build.py new file mode 100644 index 0000000000..401f44828d --- /dev/null +++ b/mach/m68k2/libem/build.py @@ -0,0 +1,11 @@ +from build import PLATS +from build.ack import ackclibrary +from glob import glob + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=(glob("mach/m68k2/libem/*.s") + glob("mach/m68k2/libem/*.c")), + plat=plat, + deps=["h"], + ) diff --git a/mach/m68k2/libend/build.py b/mach/m68k2/libend/build.py new file mode 100644 index 0000000000..cdeeb03cb8 --- /dev/null +++ b/mach/m68k2/libend/build.py @@ -0,0 +1,14 @@ +from build import PLATS +from build.ack import ackclibrary + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=[ + "./edata.s", + "./em_end.s", + "./end.s", + "./etext.s", + ], + plat=plat, + ) diff --git a/plat/minix/include/build.py b/plat/minix/include/build.py new file mode 100644 index 0000000000..6c00eec6cc --- /dev/null +++ b/plat/minix/include/build.py @@ -0,0 +1,12 @@ +from build.ab import export +from build.ack import exportheaders, clibrary +from glob import glob + +headers = glob("**/*.h", root_dir="plat/minix/include", recursive=True) + +clibrary(name="include", hdrs={k: f"./{k}" for k in headers}) + +export( + name="all", + items=exportheaders(".+include", prefix="$(PLATIND)/minix/include"), +) diff --git a/plat/minix68k/build.py b/plat/minix68k/build.py new file mode 100644 index 0000000000..9bfd4a8b95 --- /dev/null +++ b/plat/minix68k/build.py @@ -0,0 +1,41 @@ +from build.ab import export +from build.ack import ackcfile, exportheaders +from mach.proto.ncg.build import build_ncg +from plat.build import build_plat_libs +import importlib + +build_as = importlib.import_module("mach.proto.as.build").build_as + +build_as(name="as", arch="m68k2") +build_ncg( + name="ncg", + arch="m68020", + cflags=["-DWORD_SIZE=2", "-DTBL68000=1"], +) +build_plat_libs(name="plat_libs", arch="m68k2", plat="minix68k") + +ackcfile(name="boot", srcs=["./boot.s"], plat="minix68k") + +export( + name="tools", + items={ + "$(PLATDEP)/minix68k/as": ".+as", + "$(PLATDEP)/minix68k/ncg": ".+ncg", + "$(PLATDEP)/minix68k/cv": "./cv", + "$(PLATIND)/descr/minix68k": "./descr", + }, +) + +export( + name="all", + items={ + "$(PLATIND)/minix68k/boot.o": ".+boot", + "$(PLATIND)/minix68k/libsys.a": "./libsys", + }, + deps=[ + ".+tools", + ".+plat_libs", + "util/ack+all", + "plat/minix68k/include+all", + ], +) diff --git a/plat/minix68k/cv/build.py b/plat/minix68k/cv/build.py new file mode 100644 index 0000000000..ea5c250462 --- /dev/null +++ b/plat/minix68k/cv/build.py @@ -0,0 +1,7 @@ +from build.c import cprogram + +cprogram( + name="cv", + srcs=["./cv.c"], + deps=["h", "modules/src/data", "modules/src/object"], +) diff --git a/plat/minix68k/include/build.py b/plat/minix68k/include/build.py new file mode 100644 index 0000000000..2e3fdf2c02 --- /dev/null +++ b/plat/minix68k/include/build.py @@ -0,0 +1,18 @@ +from build.ab import export +from build.c import clibrary +from glob import glob +from build.ack import exportheaders + +headers = glob("**/*.h", root_dir="plat/minix68k/include", recursive=True) + +clibrary( + name="include", + hdrs={k: f"./{k}" for k in headers}, + deps=["plat/minix/include"], +) + +export( + name="all", + items=exportheaders(".+include", prefix="$(PLATIND)/minix68k/include"), + deps=["plat/minix/include+all"], +) diff --git a/plat/minix68k/libsys/build.py b/plat/minix68k/libsys/build.py new file mode 100644 index 0000000000..c6b9ad5e7b --- /dev/null +++ b/plat/minix68k/libsys/build.py @@ -0,0 +1,16 @@ +from build.ack import ackclibrary +from glob import glob + +ackclibrary( + name="libsys", + plat="minix68k", + srcs=( + glob("plat/minix68k/libsys/*.s") + + glob("plat/minix68k/libsys/*.c") + + glob("plat/minix68k/libsys/*.h") + + glob("plat/minix/libsys/*.c") + + glob("plat/minix/libsys/*.s") + + glob("plat/minix/libsys/*.h") + ), + deps=["lang/cem/libcc.ansi/headers", "plat/minix68k/include"], +) From 7e203509f1a3632564b35c0923eda2a45252a820 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 22:41:38 +0200 Subject: [PATCH 32/79] msdos86 builds. --- build.py | 1 + plat/msdos/include/build.py | 12 ++++++++++++ plat/msdos86/build.py | 36 +++++++++++++++++++++++++++++++++++ plat/msdos86/include/build.py | 18 ++++++++++++++++++ plat/msdos86/libsys/build.py | 16 ++++++++++++++++ 5 files changed, 83 insertions(+) create mode 100644 plat/msdos/include/build.py create mode 100644 plat/msdos86/build.py create mode 100644 plat/msdos86/include/build.py create mode 100644 plat/msdos86/libsys/build.py diff --git a/build.py b/build.py index 73902191a1..4155b0f39b 100644 --- a/build.py +++ b/build.py @@ -8,6 +8,7 @@ "linuxppc", "linuxmips", "minix68k", + "msdos86", ] # This contains the platform-independent host tooling required to build the plats. diff --git a/plat/msdos/include/build.py b/plat/msdos/include/build.py new file mode 100644 index 0000000000..261c628139 --- /dev/null +++ b/plat/msdos/include/build.py @@ -0,0 +1,12 @@ +from build.ab import export +from build.ack import exportheaders, clibrary +from glob import glob + +headers = glob("**/*.h", root_dir="plat/msdos/include", recursive=True) + +clibrary(name="include", hdrs={k: f"./{k}" for k in headers}) + +export( + name="all", + items=exportheaders(".+include", prefix="$(PLATIND)/msdos/include"), +) diff --git a/plat/msdos86/build.py b/plat/msdos86/build.py new file mode 100644 index 0000000000..607d30859c --- /dev/null +++ b/plat/msdos86/build.py @@ -0,0 +1,36 @@ +from build.ab import export +from build.ack import ackcfile +from mach.proto.ncg.build import build_ncg +from plat.build import build_plat_libs +import importlib + +build_as = importlib.import_module("mach.proto.as.build").build_as + +build_as(name="as", arch="i86") +build_ncg(name="ncg", arch="i86") +build_plat_libs(name="plat_libs", arch="i86", plat="msdos86") + +ackcfile(name="boot", srcs=["./boot.s"], plat="msdos86") + +export( + name="tools", + items={ + "$(PLATDEP)/msdos86/as": ".+as", + "$(PLATDEP)/msdos86/ncg": ".+ncg", + "$(PLATIND)/descr/msdos86": "./descr", + }, +) + +export( + name="all", + items={ + "$(PLATIND)/msdos86/boot.o": ".+boot", + "$(PLATIND)/msdos86/libsys.a": "./libsys", + }, + deps=[ + ".+tools", + ".+plat_libs", + "util/ack+all", + "plat/msdos86/include+all", + ], +) diff --git a/plat/msdos86/include/build.py b/plat/msdos86/include/build.py new file mode 100644 index 0000000000..0bb95f4ec5 --- /dev/null +++ b/plat/msdos86/include/build.py @@ -0,0 +1,18 @@ +from build.ab import export +from build.c import clibrary +from glob import glob +from build.ack import exportheaders + +headers = glob("**/*.h", root_dir="plat/msdos86/include", recursive=True) + +clibrary( + name="include", + hdrs={k: f"./{k}" for k in headers}, + deps=["plat/msdos/include"], +) + +export( + name="all", + items=exportheaders(".+include", prefix="$(PLATIND)/msdos86/include"), + deps=["plat/msdos/include+all"], +) diff --git a/plat/msdos86/libsys/build.py b/plat/msdos86/libsys/build.py new file mode 100644 index 0000000000..f24050e78f --- /dev/null +++ b/plat/msdos86/libsys/build.py @@ -0,0 +1,16 @@ +from build.ack import ackclibrary +from glob import glob + +ackclibrary( + name="libsys", + plat="msdos86", + srcs=( + glob("plat/msdos86/libsys/*.s") + + glob("plat/msdos86/libsys/*.c") + + glob("plat/msdos86/libsys/*.h") + + glob("plat/msdos/libsys/*.c") + + glob("plat/msdos/libsys/*.s") + + glob("plat/msdos/libsys/*.h") + ), + deps=["lang/cem/libcc.ansi/headers", "plat/msdos86/include"], +) From c5be28867d4e75bbebc629a415173299595c4f83 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 23:00:07 +0200 Subject: [PATCH 33/79] msdos386 builds. --- build.py | 1 + plat/msdos386/build.py | 54 ++++++++++++++++++++++++++++++++++ plat/msdos386/include/build.py | 18 ++++++++++++ plat/msdos386/libsys/build.py | 19 ++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 plat/msdos386/build.py create mode 100644 plat/msdos386/include/build.py create mode 100644 plat/msdos386/libsys/build.py diff --git a/build.py b/build.py index 4155b0f39b..1ec6bfac5e 100644 --- a/build.py +++ b/build.py @@ -9,6 +9,7 @@ "linuxmips", "minix68k", "msdos86", + "msdos386", ] # This contains the platform-independent host tooling required to build the plats. diff --git a/plat/msdos386/build.py b/plat/msdos386/build.py new file mode 100644 index 0000000000..63d7b26ab4 --- /dev/null +++ b/plat/msdos386/build.py @@ -0,0 +1,54 @@ +from build.ab import export, simplerule +from build.ack import ackcfile +from mach.proto.ncg.build import build_ncg +from plat.build import build_plat_libs +import importlib + +build_as = importlib.import_module("mach.proto.as.build").build_as + +build_as(name="as", arch="i386") +build_ncg(name="ncg", arch="i386") +build_plat_libs(name="plat_libs", arch="i386", plat="msdos386") + +ackcfile(name="boot", srcs=["./boot.s"], plat="msdos386") +ackcfile( + name="stub", srcs=["./stub.s"], plat="msdos386", deps=["./libsys+headers"] +) + +simplerule( + name="stub_aout", + ins=["util/led", ".+stub"], + outs=["=stub.aout"], + commands=["$[ins[0]] $[ins[1]] -o $[outs[0]]"], +) + +simplerule( + name="stub_exe", + ins=["util/amisc+aslod", ".+stub_aout"], + outs=["=stub.exe"], + commands=["$[ins[0]] $[ins[1]] $[outs[0]]"], +) + +export( + name="tools", + items={ + "$(PLATDEP)/msdos386/as": ".+as", + "$(PLATDEP)/msdos386/ncg": ".+ncg", + "$(PLATIND)/descr/msdos386": "./descr", + }, +) + +export( + name="all", + items={ + "$(PLATIND)/msdos386/boot.o": ".+boot", + "$(PLATIND)/msdos386/libsys.a": "./libsys", + "$(PLATIND)/msdos386/stub.exe": ".+stub_exe", + }, + deps=[ + ".+tools", + ".+plat_libs", + "util/ack+all", + "plat/msdos386/include+all", + ], +) diff --git a/plat/msdos386/include/build.py b/plat/msdos386/include/build.py new file mode 100644 index 0000000000..bf1751cdbb --- /dev/null +++ b/plat/msdos386/include/build.py @@ -0,0 +1,18 @@ +from build.ab import export +from build.c import clibrary +from glob import glob +from build.ack import exportheaders + +headers = glob("**/*.h", root_dir="plat/msdos386/include", recursive=True) + +clibrary( + name="include", + hdrs={k: f"./{k}" for k in headers}, + deps=["plat/msdos/include"], +) + +export( + name="all", + items=exportheaders(".+include", prefix="$(PLATIND)/msdos386/include"), + deps=["plat/msdos/include+all"], +) diff --git a/plat/msdos386/libsys/build.py b/plat/msdos386/libsys/build.py new file mode 100644 index 0000000000..6f79014417 --- /dev/null +++ b/plat/msdos386/libsys/build.py @@ -0,0 +1,19 @@ +from build.ack import ackclibrary +from build.c import clibrary +from glob import glob + +clibrary(name="headers", hdrs={"libsysasm.h": "./libsysasm.h"}) + +ackclibrary( + name="libsys", + plat="msdos386", + srcs=( + glob("plat/msdos386/libsys/*.s") + + glob("plat/msdos386/libsys/*.c") + + glob("plat/msdos386/libsys/*.h") + + glob("plat/msdos/libsys/*.c") + + glob("plat/msdos/libsys/*.s") + + glob("plat/msdos/libsys/*.h") + ), + deps=["lang/cem/libcc.ansi/headers", "plat/msdos386/include"], +) From 5638bd1b802194d189f0980b76eb79fda6310d3e Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 23:31:29 +0200 Subject: [PATCH 34/79] osx386 builds. --- build.py | 1 + plat/osx/cvmach/build.py | 13 +++++++++++++ plat/osx/include/build.py | 12 ++++++++++++ plat/osx386/build.py | 37 ++++++++++++++++++++++++++++++++++++ plat/osx386/include/build.py | 6 ++++++ plat/osx386/libsys/build.py | 15 +++++++++++++++ 6 files changed, 84 insertions(+) create mode 100644 plat/osx/cvmach/build.py create mode 100644 plat/osx/include/build.py create mode 100644 plat/osx386/build.py create mode 100644 plat/osx386/include/build.py create mode 100644 plat/osx386/libsys/build.py diff --git a/build.py b/build.py index 1ec6bfac5e..af2210bd5a 100644 --- a/build.py +++ b/build.py @@ -10,6 +10,7 @@ "minix68k", "msdos86", "msdos386", + "osx386", ] # This contains the platform-independent host tooling required to build the plats. diff --git a/plat/osx/cvmach/build.py b/plat/osx/cvmach/build.py new file mode 100644 index 0000000000..18d0cdb756 --- /dev/null +++ b/plat/osx/cvmach/build.py @@ -0,0 +1,13 @@ +from build.ab import export +from build.c import cprogram + +cprogram( + name="cvmach", + srcs=["./cvmach.c"], + deps=[ + "h", + "modules/src/object", + ], +) + +export(name="all", items={"$(PLATDEP)/cvmach": ".+cvmach"}) diff --git a/plat/osx/include/build.py b/plat/osx/include/build.py new file mode 100644 index 0000000000..053dc9eab5 --- /dev/null +++ b/plat/osx/include/build.py @@ -0,0 +1,12 @@ +from build.ab import export +from build.ack import exportheaders, clibrary +from glob import glob + +headers = glob("**/*.h", root_dir="plat/osx/include", recursive=True) + +clibrary(name="include", hdrs={k: f"./{k}" for k in headers}) + +export( + name="all", + items=exportheaders(".+include", prefix="$(PLATIND)/osx/include"), +) diff --git a/plat/osx386/build.py b/plat/osx386/build.py new file mode 100644 index 0000000000..def94b74dd --- /dev/null +++ b/plat/osx386/build.py @@ -0,0 +1,37 @@ +from build.ab import export +from build.ack import ackcfile, exportheaders +from mach.proto.ncg.build import build_ncg +from plat.build import build_plat_libs +import importlib + +build_as = importlib.import_module("mach.proto.as.build").build_as + +build_as(name="as", arch="i386") +build_ncg(name="ncg", arch="i386") +build_plat_libs(name="plat_libs", arch="i386", plat="osx386") + +ackcfile(name="boot", srcs=["./boot.s"], plat="osx386") + +export( + name="tools", + items={ + "$(PLATDEP)/osx386/as": ".+as", + "$(PLATDEP)/osx386/ncg": ".+ncg", + "$(PLATIND)/descr/osx386": "./descr", + }, +) + +export( + name="all", + items={ + "$(PLATIND)/osx386/boot.o": ".+boot", + "$(PLATIND)/osx386/libsys.a": "./libsys", + }, + deps=[ + ".+tools", + ".+plat_libs", + "util/ack+all", + "plat/osx386/include+all", + "plat/osx/cvmach+all", + ], +) diff --git a/plat/osx386/include/build.py b/plat/osx386/include/build.py new file mode 100644 index 0000000000..ca7311df9e --- /dev/null +++ b/plat/osx386/include/build.py @@ -0,0 +1,6 @@ +from build.ab import export +from build.ack import clibrary + +clibrary(name="include", deps=["plat/osx/include"]) + +export(name="all", deps=["plat/osx/include+all"]) diff --git a/plat/osx386/libsys/build.py b/plat/osx386/libsys/build.py new file mode 100644 index 0000000000..b153298dc0 --- /dev/null +++ b/plat/osx386/libsys/build.py @@ -0,0 +1,15 @@ +from build.ack import ackclibrary +from glob import glob + +ackclibrary( + name="libsys", + plat="osx386", + srcs=( + glob("plat/osx386/libsys/*.s") + + glob("plat/osx/libsys/*.c") + + glob("plat/osx/libsys/*.s") + + glob("plat/osx/libsys/*.h") + + ["plat/linux/libsys/_hol0.s", "plat/linux386/libsys/trapno.s"] + ), + deps=["lang/cem/libcc.ansi/headers", "plat/osx386/include"], +) From 22c4c1dac413ddd1e11c5e4783178ae07c25575b Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 30 Mar 2025 23:50:31 +0200 Subject: [PATCH 35/79] osxppc builds. --- build.py | 1 + plat/osxppc/build.py | 40 ++++++++++++++++++++++++++++++++++++ plat/osxppc/include/build.py | 6 ++++++ plat/osxppc/libsys/build.py | 15 ++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 plat/osxppc/build.py create mode 100644 plat/osxppc/include/build.py create mode 100644 plat/osxppc/libsys/build.py diff --git a/build.py b/build.py index af2210bd5a..3c65673e61 100644 --- a/build.py +++ b/build.py @@ -11,6 +11,7 @@ "msdos86", "msdos386", "osx386", + "osxppc", ] # This contains the platform-independent host tooling required to build the plats. diff --git a/plat/osxppc/build.py b/plat/osxppc/build.py new file mode 100644 index 0000000000..1bbb48fc25 --- /dev/null +++ b/plat/osxppc/build.py @@ -0,0 +1,40 @@ +from build.ab import export +from build.ack import ackcfile, exportheaders +from mach.proto.ncg.build import build_ncg +from mach.proto.top.build import build_top +from plat.build import build_plat_libs +import importlib + +build_as = importlib.import_module("mach.proto.as.build").build_as + +build_as(name="as", arch="powerpc") +build_ncg(name="ncg", arch="powerpc") +build_top(name="top", arch="powerpc") +build_plat_libs(name="plat_libs", arch="powerpc", plat="osxppc") + +ackcfile(name="boot", srcs=["./boot.s"], plat="osxppc") + +export( + name="tools", + items={ + "$(PLATDEP)/osxppc/as": ".+as", + "$(PLATDEP)/osxppc/ncg": ".+ncg", + "$(PLATDEP)/osxppc/top": ".+top", + "$(PLATIND)/descr/osxppc": "./descr", + }, +) + +export( + name="all", + items={ + "$(PLATIND)/osxppc/boot.o": ".+boot", + "$(PLATIND)/osxppc/libsys.a": "./libsys", + }, + deps=[ + ".+tools", + ".+plat_libs", + "util/ack+all", + "plat/osxppc/include+all", + "plat/osx/cvmach+all", + ], +) diff --git a/plat/osxppc/include/build.py b/plat/osxppc/include/build.py new file mode 100644 index 0000000000..ca7311df9e --- /dev/null +++ b/plat/osxppc/include/build.py @@ -0,0 +1,6 @@ +from build.ab import export +from build.ack import clibrary + +clibrary(name="include", deps=["plat/osx/include"]) + +export(name="all", deps=["plat/osx/include+all"]) diff --git a/plat/osxppc/libsys/build.py b/plat/osxppc/libsys/build.py new file mode 100644 index 0000000000..8c179cf158 --- /dev/null +++ b/plat/osxppc/libsys/build.py @@ -0,0 +1,15 @@ +from build.ack import ackclibrary +from glob import glob + +ackclibrary( + name="libsys", + plat="osxppc", + srcs=( + glob("plat/osxppc/libsys/*.s") + + glob("plat/osx/libsys/*.c") + + glob("plat/osx/libsys/*.s") + + glob("plat/osx/libsys/*.h") + + ["plat/linux/libsys/_hol0.s"] + ), + deps=["lang/cem/libcc.ansi/headers", "plat/osxppc/include"], +) From 2929e2118b25ff1ac036e6229916c3f2a0b8cb6b Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 31 Mar 2025 00:07:08 +0200 Subject: [PATCH 36/79] The rpi plat now builds. --- build.py | 7 ++++--- mach/vc4/as/build.py | 3 +++ mach/vc4/libem/build.py | 10 ++++++++++ mach/vc4/libend/build.py | 14 ++++++++++++++ mach/vc4/ncg/build.py | 3 +++ plat/rpi/build.py | 32 ++++++++++++++++++++++++++++++++ plat/rpi/include/build.py | 6 ++++++ plat/rpi/libsys/build.py | 14 ++++++++++++++ 8 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 mach/vc4/as/build.py create mode 100644 mach/vc4/libem/build.py create mode 100644 mach/vc4/libend/build.py create mode 100644 mach/vc4/ncg/build.py create mode 100644 plat/rpi/build.py create mode 100644 plat/rpi/include/build.py create mode 100644 plat/rpi/libsys/build.py diff --git a/build.py b/build.py index 3c65673e61..b83d9cdad3 100644 --- a/build.py +++ b/build.py @@ -1,17 +1,18 @@ from build.ab import export PLATS = [ - "pc86", "cpm", "linux386", "linux68k", - "linuxppc", "linuxmips", + "linuxppc", "minix68k", - "msdos86", "msdos386", + "msdos86", "osx386", "osxppc", + "pc86", + "rpi", ] # This contains the platform-independent host tooling required to build the plats. diff --git a/mach/vc4/as/build.py b/mach/vc4/as/build.py new file mode 100644 index 0000000000..b430adea6d --- /dev/null +++ b/mach/vc4/as/build.py @@ -0,0 +1,3 @@ +from build.c import clibrary + +clibrary(name="lib", hdrs={"binary.h": "./binary.h"}) diff --git a/mach/vc4/libem/build.py b/mach/vc4/libem/build.py new file mode 100644 index 0000000000..af15f0cb9b --- /dev/null +++ b/mach/vc4/libem/build.py @@ -0,0 +1,10 @@ +from build import PLATS +from build.ack import ackclibrary +from glob import glob + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=(glob("mach/vc4/libem/*.s") + ["./videocore.h"]), + plat=plat, + ) diff --git a/mach/vc4/libend/build.py b/mach/vc4/libend/build.py new file mode 100644 index 0000000000..cdeeb03cb8 --- /dev/null +++ b/mach/vc4/libend/build.py @@ -0,0 +1,14 @@ +from build import PLATS +from build.ack import ackclibrary + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=[ + "./edata.s", + "./em_end.s", + "./end.s", + "./etext.s", + ], + plat=plat, + ) diff --git a/mach/vc4/ncg/build.py b/mach/vc4/ncg/build.py new file mode 100644 index 0000000000..c69132d58c --- /dev/null +++ b/mach/vc4/ncg/build.py @@ -0,0 +1,3 @@ +from build.c import clibrary + +clibrary(name="ncg", hdrs={"mach.h": "./mach.h", "mach.c": "./mach.c"}) diff --git a/plat/rpi/build.py b/plat/rpi/build.py new file mode 100644 index 0000000000..62af29fd1e --- /dev/null +++ b/plat/rpi/build.py @@ -0,0 +1,32 @@ +from build.ab import export +from build.ack import ackcfile, exportheaders +from mach.proto.ncg.build import build_ncg +from plat.build import build_plat_libs +import importlib + +build_as = importlib.import_module("mach.proto.as.build").build_as + +build_as(name="as", arch="vc4", deps=["mach/vc4/as+lib"]) +build_ncg(name="ncg", arch="vc4") +build_plat_libs(name="plat_libs", arch="vc4", plat="rpi") + +ackcfile(name="boot", srcs=["./boot.s"], plat="rpi") + +export( + name="tools", + items={ + "$(PLATDEP)/rpi/as": ".+as", + "$(PLATDEP)/rpi/ncg": ".+ncg", + "$(PLATIND)/descr/rpi": "./descr", + }, +) + +export( + name="all", + items={ + "$(PLATIND)/rpi/boot.o": ".+boot", + "$(PLATIND)/rpi/libsys.a": "./libsys", + } + | exportheaders("./include", prefix="$(PLATIND)/rpi/include"), + deps=[".+tools", ".+plat_libs", "util/ack+all"], +) diff --git a/plat/rpi/include/build.py b/plat/rpi/include/build.py new file mode 100644 index 0000000000..1f6a3809de --- /dev/null +++ b/plat/rpi/include/build.py @@ -0,0 +1,6 @@ +from build.c import clibrary +from glob import glob + +headers = glob("**/*.h", root_dir="plat/rpi/include", recursive=True) + +clibrary(name="include", hdrs={k: f"./{k}" for k in headers}) diff --git a/plat/rpi/libsys/build.py b/plat/rpi/libsys/build.py new file mode 100644 index 0000000000..53b150c7fa --- /dev/null +++ b/plat/rpi/libsys/build.py @@ -0,0 +1,14 @@ +from build.ab import simplerule +from build.ack import ackclibrary +from glob import glob + +ackclibrary( + name="libsys", + plat="rpi", + srcs=( + glob("plat/rpi/libsys/*.c") + + glob("plat/rpi/libsys/*.h") + + glob("plat/rpi/libsys/*.s") + ), + deps=["lang/cem/libcc.ansi/headers", "plat/rpi/include"], +) From d23069a82ea8be9b1c7b2c1121a0bc7361f34963 Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 31 Mar 2025 00:47:07 +0200 Subject: [PATCH 37/79] The pdpv7 plat builds (and cg). --- build.py | 1 + h/build.py | 11 +++-- mach/pdp/cg/build.py | 3 ++ mach/pdp/libem/build.py | 11 +++++ mach/pdp/libend/build.py | 14 ++++++ mach/proto/cg/build.py | 63 ++++++++++++++++++++++++++ plat/pdpv7/build.py | 35 ++++++++++++++ {mach/pdp => plat/pdpv7}/cv/build.lua | 0 plat/pdpv7/cv/build.py | 11 +++++ {mach/pdp => plat/pdpv7}/cv/cv.c | 0 {mach/pdp => plat/pdpv7}/cv/proto.make | 0 plat/pdpv7/include/build.py | 16 +++++++ plat/pdpv7/libsys/build.py | 13 ++++++ util/cgg/bootlex.l | 2 +- util/cgg/build.py | 28 ++++++++++++ 15 files changed, 202 insertions(+), 6 deletions(-) create mode 100644 mach/pdp/cg/build.py create mode 100644 mach/pdp/libem/build.py create mode 100644 mach/pdp/libend/build.py create mode 100644 mach/proto/cg/build.py create mode 100644 plat/pdpv7/build.py rename {mach/pdp => plat/pdpv7}/cv/build.lua (100%) create mode 100644 plat/pdpv7/cv/build.py rename {mach/pdp => plat/pdpv7}/cv/cv.c (100%) rename {mach/pdp => plat/pdpv7}/cv/proto.make (100%) create mode 100644 plat/pdpv7/include/build.py create mode 100644 plat/pdpv7/libsys/build.py create mode 100644 util/cgg/build.py diff --git a/build.py b/build.py index b83d9cdad3..92c01cc237 100644 --- a/build.py +++ b/build.py @@ -13,6 +13,7 @@ "osxppc", "pc86", "rpi", + "pdpv7", ] # This contains the platform-independent host tooling required to build the plats. diff --git a/h/build.py b/h/build.py index e33efbbfa8..c03f5abf3b 100644 --- a/h/build.py +++ b/h/build.py @@ -28,18 +28,19 @@ hdrs={ k: f"./{k}" for k in [ - "out.h", "arch.h", - "ranlib.h", + "cg_pattern.h", + "cgg_cg.h", + "con_float", "em_abs.h", "em_ego.h", "em_flag.h", - "em_ptyp.h", "em_mes.h", - "cgg_cg.h", + "em_ptyp.h", "em_reg.h", + "out.h", + "ranlib.h", "stb.h", - "con_float", ] } | {"local.h": ".+local", "em_path.h": ".+em_path"}, diff --git a/mach/pdp/cg/build.py b/mach/pdp/cg/build.py new file mode 100644 index 0000000000..5a4f60f954 --- /dev/null +++ b/mach/pdp/cg/build.py @@ -0,0 +1,3 @@ +from build.c import clibrary + +clibrary(name="cg", hdrs={"mach.h": "./mach.h", "mach.c": "./mach.c"}) diff --git a/mach/pdp/libem/build.py b/mach/pdp/libem/build.py new file mode 100644 index 0000000000..8411d72c8a --- /dev/null +++ b/mach/pdp/libem/build.py @@ -0,0 +1,11 @@ +from build import PLATS +from build.ack import ackclibrary +from glob import glob + + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=glob("mach/pdp/libem/*.s"), + plat=plat, + ) diff --git a/mach/pdp/libend/build.py b/mach/pdp/libend/build.py new file mode 100644 index 0000000000..cdeeb03cb8 --- /dev/null +++ b/mach/pdp/libend/build.py @@ -0,0 +1,14 @@ +from build import PLATS +from build.ack import ackclibrary + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=[ + "./edata.s", + "./em_end.s", + "./end.s", + "./etext.s", + ], + plat=plat, + ) diff --git a/mach/proto/cg/build.py b/mach/proto/cg/build.py new file mode 100644 index 0000000000..d64fc33080 --- /dev/null +++ b/mach/proto/cg/build.py @@ -0,0 +1,63 @@ +from build.ab import Rule, simplerule, Targets +from build.c import cprogram +from util.cgg.build import cgg + + +@Rule +def build_cg(self, name, arch, cflags=[], deps: Targets = []): + tables = cgg( + name=f"{self.localname}/tables", + srcs=[f"mach/{arch}/cg/table"], + cflags=cflags, + deps=[f"mach/{arch}/cg"] + deps, + ) + + cprogram( + replaces=self, + cflags=cflags, + srcs=[ + "mach/proto/cg/assert.h", + "mach/proto/cg/codegen.h", + "mach/proto/cg/data.h", + "mach/proto/cg/equiv.h", + "mach/proto/cg/extern.h", + "mach/proto/cg/fillem.h", + "mach/proto/cg/gencode.h", + "mach/proto/cg/glosym.h", + "mach/proto/cg/param.h", + "mach/proto/cg/reg.h", + "mach/proto/cg/regvar.h", + "mach/proto/cg/result.h", + "mach/proto/cg/salloc.h", + "mach/proto/cg/state.h", + "mach/proto/cg/subr.h", + "mach/proto/cg/types.h", + "mach/proto/cg/codegen.c", + "mach/proto/cg/compute.c", + "mach/proto/cg/equiv.c", + "mach/proto/cg/fillem.c", + "mach/proto/cg/gencode.c", + "mach/proto/cg/glosym.c", + "mach/proto/cg/main.c", + "mach/proto/cg/move.c", + "mach/proto/cg/nextem.c", + "mach/proto/cg/reg.c", + "mach/proto/cg/regvar.c", + "mach/proto/cg/salloc.c", + "mach/proto/cg/state.c", + "mach/proto/cg/subr.c", + "mach/proto/cg/var.c", + tables, + ], + deps=( + [ + "h", + "modules/h", + "modules/src/flt_arith", + "modules/src/object", + "modules/src/em_data", + f"mach/{arch}/cg", + ] + + deps + ), + ) diff --git a/plat/pdpv7/build.py b/plat/pdpv7/build.py new file mode 100644 index 0000000000..d7c5cf3a58 --- /dev/null +++ b/plat/pdpv7/build.py @@ -0,0 +1,35 @@ +from build.ab import export +from build.ack import ackcfile +from mach.proto.cg.build import build_cg +from mach.proto.top.build import build_top +from plat.build import build_plat_libs +import importlib + +build_as = importlib.import_module("mach.proto.as.build").build_as + +build_as(name="as", arch="pdp") +build_cg(name="cg", arch="pdp") +build_top(name="top", arch="pdp") +build_plat_libs(name="plat_libs", arch="pdp", plat="pdpv7") + +ackcfile(name="boot", srcs=["./boot.s"], plat="pdpv7") + +export( + name="tools", + items={ + "$(PLATDEP)/pdpv7/as": ".+as", + "$(PLATDEP)/pdpv7/cg": ".+cg", + "$(PLATDEP)/pdpv7/top": ".+top", + "$(PLATDEP)/pdpv7/cv": "./cv", + "$(PLATIND)/descr/pdpv7": "./descr", + }, +) + +export( + name="all", + items={ + "$(PLATIND)/pdpv7/boot.o": ".+boot", + "$(PLATIND)/pdpv7/libsys.a": "./libsys", + }, + deps=[".+tools", ".+plat_libs", "util/ack+all", "./include+all"], +) diff --git a/mach/pdp/cv/build.lua b/plat/pdpv7/cv/build.lua similarity index 100% rename from mach/pdp/cv/build.lua rename to plat/pdpv7/cv/build.lua diff --git a/plat/pdpv7/cv/build.py b/plat/pdpv7/cv/build.py new file mode 100644 index 0000000000..415bf04ca5 --- /dev/null +++ b/plat/pdpv7/cv/build.py @@ -0,0 +1,11 @@ +from build.ab import export +from build.c import cprogram + +cprogram( + name="cv", + srcs=["./cv.c"], + deps=[ + "h", + "modules/src/object", + ], +) diff --git a/mach/pdp/cv/cv.c b/plat/pdpv7/cv/cv.c similarity index 100% rename from mach/pdp/cv/cv.c rename to plat/pdpv7/cv/cv.c diff --git a/mach/pdp/cv/proto.make b/plat/pdpv7/cv/proto.make similarity index 100% rename from mach/pdp/cv/proto.make rename to plat/pdpv7/cv/proto.make diff --git a/plat/pdpv7/include/build.py b/plat/pdpv7/include/build.py new file mode 100644 index 0000000000..37c756bfe4 --- /dev/null +++ b/plat/pdpv7/include/build.py @@ -0,0 +1,16 @@ +from build.ab import export +from build.c import clibrary +from glob import glob +from build.ack import exportheaders + +headers = glob("**/*.h", root_dir="plat/pdpv7/include", recursive=True) + +clibrary( + name="include", + hdrs={k: f"./{k}" for k in headers}, +) + +export( + name="all", + items=exportheaders(".+include", prefix="$(PLATIND)/pdpv7/include"), +) diff --git a/plat/pdpv7/libsys/build.py b/plat/pdpv7/libsys/build.py new file mode 100644 index 0000000000..315fdef9aa --- /dev/null +++ b/plat/pdpv7/libsys/build.py @@ -0,0 +1,13 @@ +from build.ack import ackclibrary +from glob import glob + +ackclibrary( + name="libsys", + plat="pdpv7", + srcs=( + glob("plat/pdpv7/libsys/*.s") + + glob("plat/pdpv7/libsys/*.c") + + glob("plat/pdpv7/libsys/*.h") + ), + deps=["lang/cem/libcc.ansi/headers", "plat/pdpv7/include"], +) diff --git a/util/cgg/bootlex.l b/util/cgg/bootlex.l index 4f392b3a2c..e15fbea8e8 100644 --- a/util/cgg/bootlex.l +++ b/util/cgg/bootlex.l @@ -19,7 +19,7 @@ #define EXTERN extern #include "booth.h" #undef EXTERN -#include "y.tab.h" +#include "cggparser.h" int lineno = 1; extern char *iname; diff --git a/util/cgg/build.py b/util/cgg/build.py new file mode 100644 index 0000000000..2e24ab2ced --- /dev/null +++ b/util/cgg/build.py @@ -0,0 +1,28 @@ +from build.ab import simplerule, Targets, Rule +from build.c import cprogram, cppfile +from build.yacc import bison, flex +from glob import glob + +bison(name="cggparser", src="./bootgram.y") +flex(name="cgglexer", src="./bootlex.l") + +cprogram( + name="cgg", + srcs=(["./main.c", "./booth.h", ".+cggparser", ".+cgglexer"]), + deps=["h", "modules/src/em_data"], +) + + +@Rule +def cgg(self, name, srcs: Targets = [], deps: Targets = [], cflags=[]): + cpptable = cppfile( + name=f"{self.localname}/cpptable", srcs=srcs, deps=deps, cflags=cflags + ) + + simplerule( + replaces=self, + ins=["util/cgg", cpptable], + outs=["=tables.c", "=tables.h"], + commands=["$[ins]", "mv tables.c tables.h $[dir]"], + label="CGG", + ) From 01eb2e72ccbc95c1480d0faffe194259eeb3bba0 Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 31 Mar 2025 01:25:00 +0200 Subject: [PATCH 38/79] The em22 plat builds (and ass). --- build.py | 1 + h/build.py | 2 ++ mach/em22/libem/build.lua | 8 ------ mach/em22/libem/dummy.e | 7 ----- mach/em22/libend/build.py | 14 ++++++++++ plat/build.py | 14 +++++++--- plat/em/include/build.py | 12 +++++++++ plat/em22/build.py | 29 ++++++++++++++++++++ plat/em22/include/build.py | 6 +++++ plat/em22/libsys/build.py | 13 +++++++++ util/ass/build.py | 55 ++++++++++++++++++++++++++++++++++++++ util/ego/build.py | 1 + 12 files changed, 143 insertions(+), 19 deletions(-) delete mode 100644 mach/em22/libem/build.lua delete mode 100644 mach/em22/libem/dummy.e create mode 100644 mach/em22/libend/build.py create mode 100644 plat/em/include/build.py create mode 100644 plat/em22/build.py create mode 100644 plat/em22/include/build.py create mode 100644 plat/em22/libsys/build.py create mode 100644 util/ass/build.py diff --git a/build.py b/build.py index 92c01cc237..bd3dd092ff 100644 --- a/build.py +++ b/build.py @@ -14,6 +14,7 @@ "pc86", "rpi", "pdpv7", + "em22", ] # This contains the platform-independent host tooling required to build the plats. diff --git a/h/build.py b/h/build.py index c03f5abf3b..412d1cbd84 100644 --- a/h/build.py +++ b/h/build.py @@ -29,6 +29,8 @@ k: f"./{k}" for k in [ "arch.h", + "as_spec.h", + "ip_spec.h", "cg_pattern.h", "cgg_cg.h", "con_float", diff --git a/mach/em22/libem/build.lua b/mach/em22/libem/build.lua deleted file mode 100644 index f7a23933bd..0000000000 --- a/mach/em22/libem/build.lua +++ /dev/null @@ -1,8 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { "./dummy.e", }, - vars = { plat = plat }, - } -end - diff --git a/mach/em22/libem/dummy.e b/mach/em22/libem/dummy.e deleted file mode 100644 index 45307ed6f1..0000000000 --- a/mach/em22/libem/dummy.e +++ /dev/null @@ -1,7 +0,0 @@ -# - - mes 2,_EM_WSIZE,_EM_PSIZE - - pro $__this_function_is_never_called,0 - end 0 - diff --git a/mach/em22/libend/build.py b/mach/em22/libend/build.py new file mode 100644 index 0000000000..e9d3411d8e --- /dev/null +++ b/mach/em22/libend/build.py @@ -0,0 +1,14 @@ +from build import PLATS +from build.ack import ackclibrary + +for plat in PLATS: + ackclibrary( + name=f"lib_{plat}", + srcs=[ + "./edata.e", + "./em_end.e", + "./end.e", + "./etext.e", + ], + plat=plat, + ) diff --git a/plat/build.py b/plat/build.py index 1cc33ed440..c959608c12 100644 --- a/plat/build.py +++ b/plat/build.py @@ -5,10 +5,16 @@ def build_plat_libs(self, name, arch, plat, is_em=False): export( replaces=self, - items={ - f"$(PLATIND)/{plat}/libend.a": f"mach/{arch}/libend+lib_{plat}", - f"$(PLATIND)/{plat}/libem.a": f"mach/{arch}/libem+lib_{plat}", - }, + items=( + {f"$(PLATIND)/{plat}/libend.a": f"mach/{arch}/libend+lib_{plat}"} + | ( + {} + if is_em + else { + f"$(PLATIND)/{plat}/libem.a": f"mach/{arch}/libem+lib_{plat}" + } + ) + ), deps=[ f"lang/cem/libcc.ansi+all_{plat}", f"lang/basic/lib+all_{plat}", diff --git a/plat/em/include/build.py b/plat/em/include/build.py new file mode 100644 index 0000000000..135d4555c0 --- /dev/null +++ b/plat/em/include/build.py @@ -0,0 +1,12 @@ +from build.ab import export +from build.c import clibrary +from build.ack import exportheaders +from glob import glob + +headers = glob("**/*.h", root_dir="plat/em/include", recursive=True) + +clibrary(name="include", hdrs={k: f"./{k}" for k in headers}) +export( + name="all", + items=exportheaders(".+include", prefix="$(PLATIND)/em/include"), +) diff --git a/plat/em22/build.py b/plat/em22/build.py new file mode 100644 index 0000000000..da0e30a709 --- /dev/null +++ b/plat/em22/build.py @@ -0,0 +1,29 @@ +from build.ab import export, simplerule +from build.ack import ackcfile +from mach.proto.ncg.build import build_ncg +from plat.build import build_plat_libs +import importlib + +build_as = importlib.import_module("mach.proto.as.build").build_as + +build_plat_libs(name="plat_libs", arch="em22", plat="em22", is_em=True) + +export( + name="tools", + items={"$(PLATIND)/descr/em22": "./descr"}, + deps=["util/ass"], +) + +export( + name="all", + items={ + "$(PLATIND)/em22/libsys.a": "./libsys", + }, + deps=[ + ".+tools", + ".+plat_libs", + "util/ack+all", + "util/ass+all", + "plat/em22/include+all", + ], +) diff --git a/plat/em22/include/build.py b/plat/em22/include/build.py new file mode 100644 index 0000000000..eb055c0f86 --- /dev/null +++ b/plat/em22/include/build.py @@ -0,0 +1,6 @@ +from build.ab import export +from build.ack import clibrary + +clibrary(name="include", deps=["plat/em/include"]) + +export(name="all", deps=["plat/em/include+all"]) diff --git a/plat/em22/libsys/build.py b/plat/em22/libsys/build.py new file mode 100644 index 0000000000..c1967bee89 --- /dev/null +++ b/plat/em22/libsys/build.py @@ -0,0 +1,13 @@ +from build.ack import ackclibrary +from glob import glob + +ackclibrary( + name="libsys", + plat="em22", + srcs=( + glob("plat/em/libsys/*.c") + + glob("plat/em/libsys/*.e") + + glob("plat/em/libsys/*.h") + ), + deps=["lang/cem/libcc.ansi/headers", "plat/em/include", "h"], +) diff --git a/util/ass/build.py b/util/ass/build.py new file mode 100644 index 0000000000..6669880130 --- /dev/null +++ b/util/ass/build.py @@ -0,0 +1,55 @@ +from build.ab import export, simplerule +from build.c import cprogram, hostcprogram + +hostcprogram( + name="maktab", + srcs=["./maktab.c"], + deps=[ + "h", + "modules/src/em_data", + ], +) + +simplerule( + name="asstb", + ins=[".+maktab", "etc/ip_spec.t"], + outs=["=asstb.c"], + commands=["$[ins] $[outs]"], +) + +cprogram( + name="ass", + srcs=[ + "./ass00.c", + "./ass30.c", + "./ass40.c", + "./ass50.c", + "./ass60.c", + "./ass70.c", + "./ass80.c", + "./assci.c", + "./asscm.c", + "./assda.c", + "./assrl.c", + "./ass00.h", + "./assci.h", + "./asscm.h", + "./assex.h", + "./assrl.h", + ".+asstb", + ], + deps=[ + "h", + "modules/src/em_data", + "modules/src/data", + "modules/src/system", + ], +) + +export( + name="all", + items={ + "$(PLATDEP)/em_ass": ".+ass", + "$(INSDIR)/share/man/man6/em_ass.6": "./em_ass.6", + }, +) diff --git a/util/ego/build.py b/util/ego/build.py index c29b078cb1..1de7b04105 100644 --- a/util/ego/build.py +++ b/util/ego/build.py @@ -62,6 +62,7 @@ def build_descr(name): build_descr("i86") build_descr("m68020") build_descr("powerpc") +build_descr("em22") cprogram( name="em_ego", From 7f208179b61e3bc525afecac84785ddeeb15669e Mon Sep 17 00:00:00 2001 From: David Given Date: Tue, 1 Apr 2025 01:00:55 +0200 Subject: [PATCH 39/79] Make the non-C examples build. --- build.py | 34 +++++++++---------- build/ack.py | 2 +- examples/build.py | 74 ++++++++++++++++++++++++++++++++++------- mach/i80/libem/build.py | 2 +- 4 files changed, 79 insertions(+), 33 deletions(-) diff --git a/build.py b/build.py index bd3dd092ff..e65c7371bc 100644 --- a/build.py +++ b/build.py @@ -1,20 +1,21 @@ from build.ab import export +# This is the list of which plats to build. PLATS = [ "cpm", - "linux386", - "linux68k", - "linuxmips", - "linuxppc", - "minix68k", - "msdos386", - "msdos86", - "osx386", - "osxppc", - "pc86", - "rpi", - "pdpv7", - "em22", +# "linux386", +# "linux68k", +# "linuxmips", +# "linuxppc", +# "minix68k", +# "msdos386", +# "msdos86", +# "osx386", +# "osxppc", +# "pc86", +# "rpi", +# "pdpv7", +# "em22", ] # This contains the platform-independent host tooling required to build the plats. @@ -38,12 +39,7 @@ export( name="compiler", - deps=( - [ - ".+common", - ] - + [f"plat/{p}+all" for p in PLATS] - ), + deps=([".+common"] + [f"plat/{p}+all" for p in PLATS]), ) export(name="all", deps=[".+compiler", "examples+all"]) diff --git a/build/ack.py b/build/ack.py index 2945b52152..a77324fa83 100644 --- a/build/ack.py +++ b/build/ack.py @@ -21,8 +21,8 @@ def is_source_file(f): or f.endswith(".s") or f.endswith(".e") or f.endswith(".mod") + or f.endswith(".bas") or f.endswith(".p") - or f.endswith(".b") ) diff --git a/examples/build.py b/examples/build.py index 0d1a04df9e..304ea790c1 100644 --- a/examples/build.py +++ b/examples/build.py @@ -1,19 +1,69 @@ from build import PLATS from build.ab import export from build.ack import ackcprogram +from os.path import * + +ALL = [ + "hilo.bas", + "hilo.c", + "hilo.mod", + "hilo.p", + "mandelbrot.c", + "paranoia.c", + "startrek.c", +] +PROGRAMS = { + "cpm": ALL, + "linux386": ALL, + "linux68k": ALL, + "linuxmips": ALL, + "linuxppc": ALL, + "minix68k": ALL, + "msdos386": ALL, + "msdos86": ALL, + "osx386": ALL, + "osxppc": ALL, + "pc86": ALL, + "pdpv7": ALL, + "rpi": [ + # The rpi plat only supports C. + "hilo.c", + "mandelbrot.c", + "paranoia.c", + "startrek.c", + ], + "em22": [ + "hilo.bas", + "hilo.c", + "hilo.mod", + # Pascal doesn't work in em22 yet; AFAICT ass doesn't allow you to + # have multiple libraries defining the same symbol like led does, so + # some libc symbols conflict with libpc symbols. + # "hilo.p", + "mandelbrot.c", + "paranoia.c", + "startrek.c", + ], +} exports = {} -for prog in ["hilo.c", "mandelbrot.c", "paranoia.c", "startrek.c"]: - name = prog.replace(".", "_") - exports |= {f"$(PLATIND)/examples/{prog}": f"./{prog}"} - for plat in PLATS: - ackcprogram( - name=f"{name}_{plat}", - plat=plat, - lang="c", - srcs=[f"./{prog}"], - cflags=["-O2"], - ) - exports[f"$(PLATIND)/examples/{name}_{plat}.exe"] = f".+{name}_{plat}" +for plat, progs in PROGRAMS.items(): + if plat in PLATS: + for prog in progs: + fullname, *args = prog.split(",") + name = fullname.replace(".", "_") + lang = splitext(fullname)[1][1:] + exports[f"$(PLATIND)/examples/{fullname}"] = f"./{fullname}" + ackcprogram( + name=f"{name}_{plat}", + plat=plat, + lang=lang, + srcs=[f"./{fullname}"], + cflags=["-O2"] + args, + ldflags=args, + ) + exports[f"$(PLATIND)/examples/{name}_{plat}.exe"] = ( + f".+{name}_{plat}" + ) export(name="all", items=exports) diff --git a/mach/i80/libem/build.py b/mach/i80/libem/build.py index a197db115d..a6b6ae9b86 100644 --- a/mach/i80/libem/build.py +++ b/mach/i80/libem/build.py @@ -15,7 +15,7 @@ def generate(self, name, body, offset): generated = [ generate(name=f"{k}{i}", body=f"{k}.h", offset=i) - for i in range(1, 128) + for i in range(1, 129) for k in [ "fload", "floadn", From a6593afc82af1074c89c758a6ad1b76a3bafdede Mon Sep 17 00:00:00 2001 From: David Given Date: Tue, 1 Apr 2025 01:03:34 +0200 Subject: [PATCH 40/79] Remember to turn all the plats on! --- build.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/build.py b/build.py index e65c7371bc..e93e1549dd 100644 --- a/build.py +++ b/build.py @@ -3,19 +3,19 @@ # This is the list of which plats to build. PLATS = [ "cpm", -# "linux386", -# "linux68k", -# "linuxmips", -# "linuxppc", -# "minix68k", -# "msdos386", -# "msdos86", -# "osx386", -# "osxppc", -# "pc86", -# "rpi", -# "pdpv7", -# "em22", + "linux386", + "linux68k", + "linuxmips", + "linuxppc", + "minix68k", + "msdos386", + "msdos86", + "osx386", + "osxppc", + "pc86", + "rpi", + "pdpv7", + "em22", ] # This contains the platform-independent host tooling required to build the plats. From 40ba6a0902e75e77dcc71d7b5e3761d6a9631227 Mon Sep 17 00:00:00 2001 From: David Given Date: Wed, 2 Apr 2025 00:14:12 +0200 Subject: [PATCH 41/79] Update ab. --- Makefile | 1 + build/ab.mk | 23 ++++++++++++++++------- build/ab.py | 36 ++++++++++++++++-------------------- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index af433ac539..6368898644 100644 --- a/Makefile +++ b/Makefile @@ -56,4 +56,5 @@ all: +all PLATIND = $(INSDIR)/share/ack PLATDEP = $(INSDIR)/lib/ack +AB_ENABLE_PROGRESS_INFO = false include build/ab.mk diff --git a/build/ab.mk b/build/ab.mk index 00db83f78e..5f029f92b4 100644 --- a/build/ab.mk +++ b/build/ab.mk @@ -38,6 +38,11 @@ else endif endif +# If enabled, shows a nice display of how far through the build you are. This +# doubles Make startup time. Also, on Make 4.3 and above, rebuilds don't show +# correct progress information. +AB_ENABLE_PROGRESS_INFO ?= true + WINDOWS := no OSX := no LINUX := no @@ -60,13 +65,17 @@ EXT ?= CWD=$(shell pwd) -ifeq ($(PROGRESSINFO),) -# The first make invocation here has to have its output discarded or else it -# produces spurious 'Leaving directory' messages... don't know why. -rulecount := $(strip $(shell $(MAKE) --no-print-directory -q $(OBJ)/build.mk PROGRESSINFO=1 > /dev/null \ - && $(MAKE) --no-print-directory -n $(MAKECMDGOALS) PROGRESSINFO=XXXPROGRESSINFOXXX | grep XXXPROGRESSINFOXXX | wc -l)) -ruleindex := 1 -PROGRESSINFO = "[$(ruleindex)/$(rulecount)]$(eval ruleindex := $(shell expr $(ruleindex) + 1))" +ifeq ($(AB_ENABLE_PROGRESS_INFO),true) + ifeq ($(PROGRESSINFO),) + # The first make invocation here has to have its output discarded or else it + # produces spurious 'Leaving directory' messages... don't know why. + rulecount := $(strip $(shell $(MAKE) --no-print-directory -q $(OBJ)/build.mk PROGRESSINFO=1 > /dev/null \ + && $(MAKE) --no-print-directory -n $(MAKECMDGOALS) PROGRESSINFO=XXXPROGRESSINFOXXX | grep XXXPROGRESSINFOXXX | wc -l)) + ruleindex := 1 + PROGRESSINFO = "[$(ruleindex)/$(rulecount)]$(eval ruleindex := $(shell expr $(ruleindex) + 1)) " + endif +else + PROGRESSINFO = "" endif PKG_CONFIG_HASHES = $(OBJ)/.pkg-config-hashes/target-$(word 1, $(shell $(PKG_CONFIG) --list-all | md5sum)) diff --git a/build/ab.py b/build/ab.py index 43922dbf19..2633704cc5 100644 --- a/build/ab.py +++ b/build/ab.py @@ -470,7 +470,8 @@ def emit(*args, into=None): def emit_rule(self, ins, outs, cmds=[], label=None): name = self.name - fins = set(filenamesof(ins)) + fins_list = filenamesof(ins) + fins = set(fins_list) fouts = filenamesof(outs) nonobjs = [f for f in fouts if not f.startswith("$(OBJ)")] @@ -481,21 +482,22 @@ def emit_rule(self, ins, outs, cmds=[], label=None): emit("clean::", into=lines) emit("\t$(hide) rm -f", *nonobjs, into=lines) + hashable = cmds + fins_list + fouts + hash = hashlib.sha1(bytes("\n".join(hashable), "utf-8")).hexdigest() + hashfile = join(self.dir, f"hash_{hash}") + emit(".PHONY:", name, into=lines) if outs: - emit(name, ":", *fouts, into=lines) - if len(fouts) == 1: - emit(*fouts, ":", *fins, "\x01", into=lines) - else: - emit("ifeq ($(MAKE4.3),yes)", into=lines) - emit(*fouts, "&:", *fins, "\x01", into=lines) - emit("else", into=lines) - emit(*(fouts[1:]), ":", fouts[0], into=lines) - emit(fouts[0], ":", *fins, "\x01", into=lines) - emit("endif", into=lines) + emit(name, ":", hashfile, *fouts, into=lines) + emit("ifeq ($(MAKE4.3),yes)", into=lines) + emit(hashfile, *fouts, "&:", *fins, into=lines) + emit("else", into=lines) + emit(*fouts, ":", hashfile, into=lines) + emit(hashfile, ":", *fins, into=lines) + emit("endif", into=lines) if label: - emit("\t$(hide)", "$(ECHO) $(PROGRESSINFO)", label, into=lines) + emit("\t$(hide)", "$(ECHO) $(PROGRESSINFO)" + label, into=lines) sandbox = join(self.dir, "sandbox") emit("\t$(hide)", f"rm -rf {sandbox}", into=lines) @@ -517,16 +519,10 @@ def emit_rule(self, ins, outs, cmds=[], label=None): assert len(cmds) == 0, "rules with no outputs cannot have commands" emit(name, ":", *fins, into=lines) - cmd = "".join(lines) - hash = hashlib.sha1(bytes(cmd, "utf-8")).hexdigest() - - outputFp.write(cmd.replace("\x01", f"$(OBJ)/.hashes/{hash}")) + outputFp.write("".join(lines)) if outs: - emit(f"$(OBJ)/.hashes/{hash}:") - emit( - f"\t$(hide) mkdir -p $(OBJ)/.hashes && touch $(OBJ)/.hashes/{hash}" - ) + emit(f"\t$(hide) touch {hashfile}") emit("") From 6040ba79354f639992f83e2b285d0d3dbe7384e7 Mon Sep 17 00:00:00 2001 From: David Given Date: Wed, 2 Apr 2025 00:30:29 +0200 Subject: [PATCH 42/79] The M2 build uses a build script which doesn't work properly and isn't necessary, so remove it. --- lang/m2/comp/build.py | 17 ++++++++--------- lang/m2/comp/make.next | 7 ------- 2 files changed, 8 insertions(+), 16 deletions(-) delete mode 100755 lang/m2/comp/make.next diff --git a/lang/m2/comp/build.py b/lang/m2/comp/build.py index fa67bfa13e..d6e0a0e814 100644 --- a/lang/m2/comp/build.py +++ b/lang/m2/comp/build.py @@ -16,13 +16,6 @@ ], ) -simplerule( - name="next-c", - ins=["./make.next"], - outs=["=next.c"], - commands=["sh $[ins] > $[outs]"], -) - simplerule( name="tokenfile-g", ins=[ @@ -61,7 +54,7 @@ srcs=( glob("lang/m2/comp/*.c") + glob("lang/m2/comp/*.h") - + [".+parameters", ".+llgen", ".+next-c", ".+symbol2str-c", ".+tabgen"] + + [".+parameters", ".+llgen", ".+symbol2str-c", ".+tabgen"] ), deps=[ "h", @@ -80,4 +73,10 @@ ], ) -export(name="all", items={"$(PLATDEP)/em_m2": ".+em_m2"}) +export( + name="all", + items={ + "$(PLATDEP)/em_m2": ".+em_m2", + "$(INSDIR)/share/man/man6/em_m2.6": "./em_m2.6", + }, +) diff --git a/lang/m2/comp/make.next b/lang/m2/comp/make.next deleted file mode 100755 index 7278675944..0000000000 --- a/lang/m2/comp/make.next +++ /dev/null @@ -1,7 +0,0 @@ -echo '#include "debug.h"' -sed -n ' -s:^.*[ ]ALLOCDEF[ ].*"\(.*\)".*$:struct \1 *h_\1 = 0;\ -#ifdef DEBUG\ -int cnt_\1 = 0;\ -#endif:p -' $* From 302f546fefaa9f3e4fb78a8ec9b268003140c9df Mon Sep 17 00:00:00 2001 From: David Given Date: Wed, 2 Apr 2025 00:32:33 +0200 Subject: [PATCH 43/79] Try using gmake on OSX. --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 57645c9306..66cb23c4f8 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -24,7 +24,7 @@ jobs: run: brew install python lua@5.4 coreutils - name: make run: | - make + gmake build-windows: runs-on: windows-latest From 1d29f47dd38446be838b5101ba9aa3f1acc1712a Mon Sep 17 00:00:00 2001 From: David Given Date: Wed, 2 Apr 2025 00:33:45 +0200 Subject: [PATCH 44/79] Remember to install gmake. --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 66cb23c4f8..a3c9262663 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: brew - run: brew install python lua@5.4 coreutils + run: brew install python lua@5.4 coreutils make - name: make run: | gmake From 2784860b913db7103dfd116ce9deb5f922948460 Mon Sep 17 00:00:00 2001 From: David Given Date: Wed, 2 Apr 2025 21:17:04 +0200 Subject: [PATCH 45/79] Update ab. --- build/ab.py | 84 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 66 insertions(+), 18 deletions(-) diff --git a/build/ab.py b/build/ab.py index 2633704cc5..566e6696a0 100644 --- a/build/ab.py +++ b/build/ab.py @@ -29,6 +29,8 @@ unmaterialisedTargets = {} # dict, not set, to get consistent ordering materialisingStack = [] defaultGlobals = {} +globalId = 1 +wordCache = {} RE_FORMAT_SPEC = re.compile( r"(?:(?P[\s\S])?(?P[<>=^]))?" @@ -221,13 +223,16 @@ def format_field(self, value, format_spec): if not value: return "" if type(value) == str: - return value + return compressf(value) if _isiterable(value): value = list(value) if type(value) != list: value = [value] return " ".join( - [selfi.templateexpand(f) for f in filenamesof(value)] + [ + compressf(selfi.templateexpand(f)) + for f in filenamesof(value) + ] ) return Formatter().format(s) @@ -460,6 +465,27 @@ def filenameof(x): return xs[0] +def compressf(a): + global globalId + if len(a) > 5: + if a not in wordCache: + wordCache[a] = globalId + outputFp.write(f"f{globalId}={a}\n") + globalId = globalId + 1 + a = f"$(f{wordCache[a]})" + return a + + +def compress(args): + global globalId + + compressed = [] + for a in args: + compressed += [compressf(a)] + + return compressed + + def emit(*args, into=None): s = " ".join(args) + "\n" if into is not None: @@ -480,49 +506,71 @@ def emit_rule(self, ins, outs, cmds=[], label=None): lines = [] if nonobjs: emit("clean::", into=lines) - emit("\t$(hide) rm -f", *nonobjs, into=lines) + emit("\t$(hide) rm -f", *compress(nonobjs), into=lines) hashable = cmds + fins_list + fouts hash = hashlib.sha1(bytes("\n".join(hashable), "utf-8")).hexdigest() hashfile = join(self.dir, f"hash_{hash}") - emit(".PHONY:", name, into=lines) + global globalId + emit(".PHONY:", compressf(name), into=lines) if outs: - emit(name, ":", hashfile, *fouts, into=lines) + outsn = globalId + globalId = globalId + 1 + insn = globalId + globalId = globalId + 1 + + emit(f"OUTS_{outsn}", "=", *compress(fouts), into=lines) + emit(f"INS_{insn}", "=", *compress(fins), into=lines) + emit( + compressf(name), + ":", + compressf(hashfile), + f"$(OUTS_{outsn})", + into=lines, + ) emit("ifeq ($(MAKE4.3),yes)", into=lines) - emit(hashfile, *fouts, "&:", *fins, into=lines) + emit( + compressf(hashfile), + f"$(OUTS_{outsn})", + "&:", + f"$(INS_{insn})", + into=lines, + ) emit("else", into=lines) - emit(*fouts, ":", hashfile, into=lines) - emit(hashfile, ":", *fins, into=lines) + emit(f"$(OUTS_{outsn})", ":", compressf(hashfile), into=lines) + emit(compressf(hashfile), ":", f"$(INS_{insn})", into=lines) emit("endif", into=lines) if label: emit("\t$(hide)", "$(ECHO) $(PROGRESSINFO)" + label, into=lines) sandbox = join(self.dir, "sandbox") - emit("\t$(hide)", f"rm -rf {sandbox}", into=lines) + emit("\t$(hide)", f"rm -rf {compressf(sandbox)}", into=lines) emit( "\t$(hide)", - f"$(PYTHON) build/_sandbox.py --link -s {sandbox}", - *fins, + compressf("$(PYTHON) build/_sandbox.py --link -s"), + compressf(sandbox), + f"$(INS_{insn})", into=lines, ) for c in cmds: - emit(f"\t$(hide) cd {sandbox} && (", c, ")", into=lines) + emit(f"\t$(hide) cd {compressf(sandbox)} && (", c, ")", into=lines) emit( "\t$(hide)", - f"$(PYTHON) build/_sandbox.py --export -s {sandbox}", - *fouts, + compressf("$(PYTHON) build/_sandbox.py --export -s"), + compressf(sandbox), + f"$(OUTS_{outsn})", into=lines, ) else: assert len(cmds) == 0, "rules with no outputs cannot have commands" - emit(name, ":", *fins, into=lines) + emit(compressf(name), ":", *compress(fins), into=lines) outputFp.write("".join(lines)) if outs: - emit(f"\t$(hide) touch {hashfile}") + emit(f"\t$(hide) touch {compressf(hashfile)}") emit("") @@ -590,8 +638,8 @@ def export(self, name=None, items: TargetsMap = {}, deps: Targets = []): self.outs = deps + outs emit("") - emit(".PHONY:", name) - emit(name, ":", *filenamesof(outs + deps)) + emit(".PHONY:", compressf(name)) + emit(compressf(name), ":", *compress(filenamesof(outs + deps))) def main(): From 74079e884a95b0fd0be6e6d8851a72ac153bec21 Mon Sep 17 00:00:00 2001 From: David Given Date: Wed, 2 Apr 2025 21:17:19 +0200 Subject: [PATCH 46/79] Remove Windows verbose logging. --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index a3c9262663..0a0d524009 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -50,7 +50,7 @@ jobs: - uses: actions/checkout@v3 - name: build run: | - make V=1 LDFLAGS="-s -static" + make LDFLAGS="-s -static" - name: package run: | make ack-setup.exe From c2c5565989f9191ce20c1c7ef67cd376b304fa23 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 3 Apr 2025 00:24:38 +0200 Subject: [PATCH 47/79] Got the first tests building (but not running yet). --- build.py | 36 ++++++----- build/ack.py | 4 +- plat/cpm/emu/biosbdos.c | 4 +- plat/cpm/emu/build.py | 44 +++++++++++++ plat/cpm/emu/globals.h | 6 -- plat/cpm/tests/build.py | 8 +++ .../cpm/tests/{parsefcb_c.c => parsefcb,c,.c} | 0 ...0-varargs_c.c => bug-157-i80-varargs,c,.c} | 0 ...bug-164-faddrn_c.c => bug-164-faddrn,c,.c} | 0 ...-ego-sr_c-O3.c => bug-203-ego-sr,c,-O3,.c} | 0 ...bug-22-inn_mod.mod => bug-22-inn,mod,.mod} | 0 ...c => bug-310-cpp-no-trailing-newline,c,.c} | 0 ...-notvar_var_e.c => bug-62-notvar_var,e,.c} | 0 tests/plat/build.py | 63 +++++++++++++++++++ 14 files changed, 142 insertions(+), 23 deletions(-) create mode 100644 plat/cpm/emu/build.py create mode 100644 plat/cpm/tests/build.py rename plat/cpm/tests/{parsefcb_c.c => parsefcb,c,.c} (100%) rename tests/plat/bugs/{bug-157-i80-varargs_c.c => bug-157-i80-varargs,c,.c} (100%) rename tests/plat/bugs/{bug-164-faddrn_c.c => bug-164-faddrn,c,.c} (100%) rename tests/plat/bugs/{bug-203-ego-sr_c-O3.c => bug-203-ego-sr,c,-O3,.c} (100%) rename tests/plat/bugs/{bug-22-inn_mod.mod => bug-22-inn,mod,.mod} (100%) rename tests/plat/bugs/{bug-310-cpp-no-trailing-newline_c.c => bug-310-cpp-no-trailing-newline,c,.c} (100%) rename tests/plat/bugs/{bug-62-notvar_var_e.c => bug-62-notvar_var,e,.c} (100%) create mode 100644 tests/plat/build.py diff --git a/build.py b/build.py index e93e1549dd..42a493e318 100644 --- a/build.py +++ b/build.py @@ -3,21 +3,24 @@ # This is the list of which plats to build. PLATS = [ "cpm", - "linux386", - "linux68k", - "linuxmips", - "linuxppc", - "minix68k", - "msdos386", - "msdos86", - "osx386", - "osxppc", - "pc86", - "rpi", - "pdpv7", - "em22", + # "linux386", + # "linux68k", + # "linuxmips", + # "linuxppc", + # "minix68k", + # "msdos386", + # "msdos86", + # "osx386", + # "osxppc", + # "pc86", + # "rpi", + # "pdpv7", + # "em22", ] +# This is the list of which plats to test. +TEST_PLATS = ["cpm"] + # This contains the platform-independent host tooling required to build the plats. export( name="common", @@ -42,4 +45,9 @@ deps=([".+common"] + [f"plat/{p}+all" for p in PLATS]), ) -export(name="all", deps=[".+compiler", "examples+all"]) +export( + name="all", + deps=( + [".+compiler", "examples+all"] + [f"plat/{p}/tests" for p in TEST_PLATS] + ), +) diff --git a/build/ack.py b/build/ack.py index a77324fa83..1b29eedb85 100644 --- a/build/ack.py +++ b/build/ack.py @@ -7,10 +7,10 @@ class AckToolchain(Toolchain): PREFIX = "ACK" CC = [ - "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack $(ACKCFLAGS) $[cflags] -m$[plat] -c -o $[outs[0]] $[ins[0]]" + "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack $(ACKCFLAGS) $[cflags] -m$[plat] -c -o $[outs[0]] $[ins]" ] CLINK = [ - "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack $(ACKLDFLAGS) $[ldflags] -m$[plat] -.$[lang] -o $[outs[0]] $[ins[0]]" + "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack -m$[plat] -.$[lang] -o $[outs[0]] $[ins] $(ACKLDFLAGS) $[ldflags]" ] AR = ["$(INSDIR)/bin/aal qc $[outs] $[ins]"] diff --git a/plat/cpm/emu/biosbdos.c b/plat/cpm/emu/biosbdos.c index 91cb166387..905b4e7345 100644 --- a/plat/cpm/emu/biosbdos.c +++ b/plat/cpm/emu/biosbdos.c @@ -20,6 +20,8 @@ static uint16_t dma; static int exitcode = 0; +#include "bdos.img.h" + struct fcb { cpm_filename_t filename; /* includes drive */ @@ -82,7 +84,7 @@ static void set_result(uint16_t result) void bios_coldboot(void) { - memcpy(&ram[FBASE], bdos_data, bdos_len); + memcpy(&ram[FBASE], bdos_data, bdos_data_len); i8080_write_reg16(PC, COLDSTART); } diff --git a/plat/cpm/emu/build.py b/plat/cpm/emu/build.py new file mode 100644 index 0000000000..426b31fbd9 --- /dev/null +++ b/plat/cpm/emu/build.py @@ -0,0 +1,44 @@ +from build.ab import simplerule +from build.c import hostcprogram +from build.ack import ackcfile +from build.utils import objectify + +ackcfile(name="bdos_o", srcs=["./bdos.s"], plat="cpm") + +simplerule( + name="bdos_out", + ins=[ + "util/led", + ".+bdos_o", + ], + outs=["=bdos.out"], + commands=["$[ins[0]] -b0:0xff00 $[ins[1]] -o $[outs]"], +) + +simplerule( + name="bdos_img", + ins=[ + "util/amisc+aslod", + ".+bdos_out", + ], + outs=["bdos.img"], + commands=["$[ins] $[outs]"], +) + +objectify(name="bdos_c", src=".+bdos_img", symbol="bdos_data") + +hostcprogram( + name="emu", + srcs=[ + ".+bdos_c", + "./biosbdos.c", + "./dis8080.c", + "./dis8080.h", + "./emulator.c", + "./fileio.c", + "./intel_8080_emulator.c", + "./intel_8080_emulator.h", + "./main.c", + "./globals.h", + ], +) diff --git a/plat/cpm/emu/globals.h b/plat/cpm/emu/globals.h index 2ac41438f3..544e1f70f8 100644 --- a/plat/cpm/emu/globals.h +++ b/plat/cpm/emu/globals.h @@ -11,12 +11,6 @@ extern void emulator_init(void); extern void emulator_run(void); extern void showregs(void); -extern const uint8_t ccp_data[]; -extern const int ccp_len; - -extern const uint8_t bdos_data[]; -extern const int bdos_len; - extern void bios_coldboot(void); extern void biosbdos_entry(int syscall); diff --git a/plat/cpm/tests/build.py b/plat/cpm/tests/build.py new file mode 100644 index 0000000000..b03b389fa5 --- /dev/null +++ b/plat/cpm/tests/build.py @@ -0,0 +1,8 @@ +from tests.plat.build import plat_testsuite + +plat_testsuite( + name="tests", + plat="cpm", + method="plat/cpm/emu", + extratests=["./parsefcb,c,.c"], +) diff --git a/plat/cpm/tests/parsefcb_c.c b/plat/cpm/tests/parsefcb,c,.c similarity index 100% rename from plat/cpm/tests/parsefcb_c.c rename to plat/cpm/tests/parsefcb,c,.c diff --git a/tests/plat/bugs/bug-157-i80-varargs_c.c b/tests/plat/bugs/bug-157-i80-varargs,c,.c similarity index 100% rename from tests/plat/bugs/bug-157-i80-varargs_c.c rename to tests/plat/bugs/bug-157-i80-varargs,c,.c diff --git a/tests/plat/bugs/bug-164-faddrn_c.c b/tests/plat/bugs/bug-164-faddrn,c,.c similarity index 100% rename from tests/plat/bugs/bug-164-faddrn_c.c rename to tests/plat/bugs/bug-164-faddrn,c,.c diff --git a/tests/plat/bugs/bug-203-ego-sr_c-O3.c b/tests/plat/bugs/bug-203-ego-sr,c,-O3,.c similarity index 100% rename from tests/plat/bugs/bug-203-ego-sr_c-O3.c rename to tests/plat/bugs/bug-203-ego-sr,c,-O3,.c diff --git a/tests/plat/bugs/bug-22-inn_mod.mod b/tests/plat/bugs/bug-22-inn,mod,.mod similarity index 100% rename from tests/plat/bugs/bug-22-inn_mod.mod rename to tests/plat/bugs/bug-22-inn,mod,.mod diff --git a/tests/plat/bugs/bug-310-cpp-no-trailing-newline_c.c b/tests/plat/bugs/bug-310-cpp-no-trailing-newline,c,.c similarity index 100% rename from tests/plat/bugs/bug-310-cpp-no-trailing-newline_c.c rename to tests/plat/bugs/bug-310-cpp-no-trailing-newline,c,.c diff --git a/tests/plat/bugs/bug-62-notvar_var_e.c b/tests/plat/bugs/bug-62-notvar_var,e,.c similarity index 100% rename from tests/plat/bugs/bug-62-notvar_var_e.c rename to tests/plat/bugs/bug-62-notvar_var,e,.c diff --git a/tests/plat/build.py b/tests/plat/build.py new file mode 100644 index 0000000000..157e6581fa --- /dev/null +++ b/tests/plat/build.py @@ -0,0 +1,63 @@ +from build.ab import Rule, Target, Targets, export, filenamesof +from build.ack import ackclibrary, ackcprogram +from glob import glob +from os.path import * + +allsets = { + "core": [], + "bugs": [ + "tests/plat/bugs/bug-157-i80-varargs,c,.c", + "tests/plat/bugs/bug-164-faddrn,c,.c", + "tests/plat/bugs/bug-203-ego-sr,c,-O3,.c", + "tests/plat/bugs/bug-22-inn,mod,.mod", + "tests/plat/bugs/bug-62-notvar_var,e,.c", + "tests/plat/bugs/bug-310-cpp-no-trailing-newline,c,.c", + ], + "m2": [], + "floats": [], + "long-long": [], +} + + +@Rule +def plat_testsuite( + self, + name, + plat, + method: Target, + sets=["core", "bugs", "m2", "floats", "long-long"], + extratests: Targets = [], +): + lib = ackclibrary( + name="lib", + srcs=["tests/plat/lib/test.c"], + hdrs={ + "test.h": "tests/plat/lib/test.h", + "Test.def": "tests/plat/lib/Test.def", + }, + deps=[f"lang/cem/libcc.ansi+lib_{plat}"], + plat=plat, + ) + + testfiles = filenamesof(extratests) + for set in sets: + testfiles += allsets[set] + + tests = [] + for test in testfiles: + filename, lang, *flags = test.split(",") + flags = flags[0:-1] + fs = basename(filename) + + tests += [ + ackcprogram( + name=f"{fs}_bin", + srcs=[test], + lang=lang, + plat=plat, + cflags=flags, + deps=[lib], + ) + ] + + export(replaces=self, deps=tests) From bc752c75d40ef599f6bc40a6782f8f19799ab030 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 3 Apr 2025 02:01:26 +0200 Subject: [PATCH 48/79] Tests now run --- but Pascal is broken, somehow. --- build.py | 26 +++++++++++++------------- examples/build.py | 2 +- plat/cpm/build.py | 6 ++++-- tests/plat/build.py | 28 +++++++++++++++++++--------- util/build/build.py | 5 +++++ 5 files changed, 42 insertions(+), 25 deletions(-) create mode 100644 util/build/build.py diff --git a/build.py b/build.py index 42a493e318..92e45fe874 100644 --- a/build.py +++ b/build.py @@ -3,19 +3,19 @@ # This is the list of which plats to build. PLATS = [ "cpm", - # "linux386", - # "linux68k", - # "linuxmips", - # "linuxppc", - # "minix68k", - # "msdos386", - # "msdos86", - # "osx386", - # "osxppc", - # "pc86", - # "rpi", - # "pdpv7", - # "em22", + "linux386", + "linux68k", + "linuxmips", + "linuxppc", + "minix68k", + "msdos386", + "msdos86", + "osx386", + "osxppc", + "pc86", + "rpi", + "pdpv7", + "em22", ] # This is the list of which plats to test. diff --git a/examples/build.py b/examples/build.py index 304ea790c1..2ee8259543 100644 --- a/examples/build.py +++ b/examples/build.py @@ -7,7 +7,7 @@ "hilo.bas", "hilo.c", "hilo.mod", - "hilo.p", + # "hilo.p", "mandelbrot.c", "paranoia.c", "startrek.c", diff --git a/plat/cpm/build.py b/plat/cpm/build.py index 070a7d9f6a..e8f5cac387 100644 --- a/plat/cpm/build.py +++ b/plat/cpm/build.py @@ -7,12 +7,14 @@ build_as = importlib.import_module("mach.proto.as.build").build_as +cflags = ["-DUSE_I80_RSTS"] + build_as(name="as", arch="i80") -build_ncg(name="ncg", arch="i80", cflags=["-DUSE_I80_RSTS"]) +build_ncg(name="ncg", arch="i80", cflags=cflags) build_top(name="top", arch="i80") build_plat_libs(name="plat_libs", arch="i80", plat="cpm") -ackcfile(name="boot", srcs=["./boot.s"], plat="cpm") +ackcfile(name="boot", srcs=["./boot.s"], plat="cpm", cflags=cflags) export( name="tools", diff --git a/tests/plat/build.py b/tests/plat/build.py index 157e6581fa..cb88cfca4c 100644 --- a/tests/plat/build.py +++ b/tests/plat/build.py @@ -1,5 +1,6 @@ from build.ab import Rule, Target, Targets, export, filenamesof from build.ack import ackclibrary, ackcprogram +from build.utils import test from glob import glob from os.path import * @@ -44,19 +45,28 @@ def plat_testsuite( testfiles += allsets[set] tests = [] - for test in testfiles: - filename, lang, *flags = test.split(",") + for t in testfiles: + filename, lang, *flags = t.split(",") flags = flags[0:-1] fs = basename(filename) tests += [ - ackcprogram( - name=f"{fs}_bin", - srcs=[test], - lang=lang, - plat=plat, - cflags=flags, - deps=[lib], + test( + name=f"{fs}_test", + ins=[ + "tests/plat/testdriver.sh", + method, + "util/build+testrunner", + ackcprogram( + name=f"{fs}_bin", + srcs=[t], + lang=lang, + plat=plat, + cflags=flags, + deps=[lib], + ), + ], + commands=["$[ins[0]] $[ins[1]] $[ins[3]] 15 $[ins[2]]"], ) ] diff --git a/util/build/build.py b/util/build/build.py new file mode 100644 index 0000000000..653fd8f2b0 --- /dev/null +++ b/util/build/build.py @@ -0,0 +1,5 @@ +from build.c import hostcprogram + +hostcprogram( + name="testrunner", srcs=["./testrunner.c"], deps=["modules/src/data"] +) From 37604406a23a7814545c6d0e3895741bf291fdb7 Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 4 Apr 2025 18:43:20 +0200 Subject: [PATCH 49/79] Fix a nasty bug in exportheaders where it just didn't work. --- build/ack.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build/ack.py b/build/ack.py index 1b29eedb85..4e9a8558f3 100644 --- a/build/ack.py +++ b/build/ack.py @@ -1,6 +1,7 @@ -from build.ab import targetof, filenameof +from build.ab import targetof, filenameof, filenamesof from build.toolchain import Toolchain from build.c import cfile, clibrary, cprogram +from build.utils import collectattrs from os.path import * @@ -75,9 +76,10 @@ def _indirect(deps, name): def exportheaders(lib, prefix=""): lib = targetof(lib) + hdrdeps = collectattrs(targets=[lib], name="cheader_deps") hh = {} - for h in sorted(_indirect([lib], "cheader_files")): - for f in h.outs: - r = relpath(filenameof(f), h.dir) + for h in collectattrs(targets=hdrdeps, name="cheader_files"): + for f in filenamesof([h]): + r = relpath(f, h.dir) hh[join(prefix, r)] = f return hh From b6456f77b330a93b43099860dda8e22c0df021f1 Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 4 Apr 2025 21:51:17 +0200 Subject: [PATCH 50/79] Update ab. --- build/ab.py | 9 +++++++- build/c.py | 65 +++++++++++++++++++++++++++++++++++++++------------- build/pkg.py | 5 ++-- 3 files changed, 60 insertions(+), 19 deletions(-) diff --git a/build/ab.py b/build/ab.py index 566e6696a0..00e1f96b6f 100644 --- a/build/ab.py +++ b/build/ab.py @@ -22,6 +22,8 @@ import os from collections import namedtuple +COMPRESS_MK_FILE = True + verbose = False quiet = False cwdStack = [""] @@ -466,6 +468,8 @@ def filenameof(x): def compressf(a): + if not COMPRESS_MK_FILE: + return a global globalId if len(a) > 5: if a not in wordCache: @@ -477,7 +481,8 @@ def compressf(a): def compress(args): - global globalId + if not COMPRESS_MK_FILE: + return args compressed = [] for a in args: @@ -502,6 +507,8 @@ def emit_rule(self, ins, outs, cmds=[], label=None): nonobjs = [f for f in fouts if not f.startswith("$(OBJ)")] emit("") + for k, v in self.args.items(): + emit(f"# {k} = {v}") lines = [] if nonobjs: diff --git a/build/c.py b/build/c.py index 1750ae4637..2105039341 100644 --- a/build/c.py +++ b/build/c.py @@ -44,6 +44,32 @@ ) +# Given a set of dependencies, finds the set of relevant library targets (i.e. +# contributes *.a files) for compiling C programs. The actual list of libraries +# is in dep.clibrary_files. +def _toolchain_find_library_targets(deps): + lib_deps = [] + for d in deps: + lib_deps = _combine(lib_deps, d.args.get("clibrary_deps", [])) + return lib_deps + + +Toolchain.find_c_library_targets = _toolchain_find_library_targets + + +# Given a set of dependencies, finds the set of relevant header targets (i.e. +# contributes *.h files) for compiling C programs. The actual list of libraries +# is in dep.cheader_files. +def _toolchain_find_header_targets(deps, initial=[]): + hdr_deps = initial + for d in deps: + hdr_deps = _combine(hdr_deps, d.args.get("cheader_deps", [])) + return hdr_deps + + +Toolchain.find_c_header_targets = _toolchain_find_header_targets + + HostToolchain.CC = [ "$(HOSTCC) -c -o $[outs[0]] $[ins[0]] $(HOSTCFLAGS) $[cflags]" ] @@ -76,10 +102,18 @@ def _indirect(deps, name): return r -def cfileimpl(self, name, srcs, deps, suffix, commands, label, cflags): +def cfileimpl( + self, name, srcs, deps, suffix, commands, label, toolchain, cflags +): outleaf = "=" + stripext(basename(filenameof(srcs[0]))) + suffix - hdr_deps = _indirect(deps, "cheader_deps") + hdr_deps = toolchain.find_c_header_targets(deps) + other_deps = [ + d + for d in deps + if ("cheader_deps" not in d.args) and ("clibrary_deps" not in d.args) + ] + hdr_files = collectattrs(targets=hdr_deps, name="cheader_files") cflags = collectattrs( targets=hdr_deps, name="caller_cflags", initial=cflags ) @@ -87,7 +121,7 @@ def cfileimpl(self, name, srcs, deps, suffix, commands, label, cflags): t = simplerule( replaces=self, ins=srcs, - deps=sorted(_indirect(hdr_deps, "cheader_files")), + deps=other_deps + hdr_files, outs=[outleaf], label=label, commands=commands, @@ -114,6 +148,7 @@ def cfile( suffix, toolchain.CC, toolchain.PREFIX + label, + toolchain, cflags, ) @@ -137,6 +172,7 @@ def cxxfile( suffix, toolchain.CXX, toolchain.PREFIX + label, + toolchain, cflags, ) @@ -190,8 +226,8 @@ def libraryimpl( label, filerule, ): - hdr_deps = _combine(_indirect(deps, "cheader_deps"), [self]) - lib_deps = _combine(_indirect(deps, "clibrary_deps"), [self]) + hdr_deps = toolchain.find_c_header_targets(deps) + [self] + lib_deps = toolchain.find_c_library_targets(deps) + [self] hr = None hf = [] @@ -218,10 +254,13 @@ def libraryimpl( commands=cs, label=toolchain.PREFIX + "CHEADERS", ) - hr.materialise() + hr.args["cheader_deps"] = [hr] + hr.args["cheader_files"] = [hr] hf = [f"-I{hr.dir}"] if srcs: + # Can't depend on the current target to get the library headers, because + # if we do it'll cause a dependency loop. objs = findsources( self, srcs, @@ -396,10 +435,8 @@ def programimpl( self, srcs, deps, cflags, filerule, toolchain, self.cwd ) - lib_deps = [] - for d in deps: - lib_deps = _combine(lib_deps, d.args.get("clibrary_deps", {d})) - libs = filenamesmatchingof(lib_deps, "*.a") + lib_deps = toolchain.find_c_library_targets(deps) + libs = collectattrs(targets=lib_deps, name="clibrary_files") ldflags = collectattrs( targets=lib_deps, name="caller_ldflags", initial=ldflags ) @@ -408,14 +445,10 @@ def programimpl( replaces=self, ins=cfiles + libs, outs=[f"={self.localname}$(EXT)"], - deps=_indirect(lib_deps, "clibrary_files"), + deps=deps, label=label, commands=commands, - args={ - "ldflags": collectattrs( - targets=lib_deps, name="caller_ldflags", initial=ldflags - ) - }, + args={"ldflags": ldflags}, ) diff --git a/build/pkg.py b/build/pkg.py index c5d53a2122..6103e716d4 100644 --- a/build/pkg.py +++ b/build/pkg.py @@ -44,8 +44,9 @@ def _package(self, name, package, fallback, pkgconfig): self.args["caller_cflags"] = [cflags] if ldflags: self.args["caller_ldflags"] = [ldflags] - self.traits.add("clibrary") - self.traits.add("cheaders") + self.args["clibrary_deps"] = [self] + self.args["cheader_deps"] = [self] + self.traits.update({"clibrary", "cxxlibrary"}) return assert ( From 9ecb2d6fec44178b7914ba8f63366e1d289062b2 Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 4 Apr 2025 21:51:57 +0200 Subject: [PATCH 51/79] Pascal builds again. --- examples/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/build.py b/examples/build.py index 2ee8259543..304ea790c1 100644 --- a/examples/build.py +++ b/examples/build.py @@ -7,7 +7,7 @@ "hilo.bas", "hilo.c", "hilo.mod", - # "hilo.p", + "hilo.p", "mandelbrot.c", "paranoia.c", "startrek.c", From 14e2ac1c372a15ec2312e181373cd3559652777f Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 4 Apr 2025 22:00:54 +0200 Subject: [PATCH 52/79] Enable the core tests. --- build.py | 26 +++++++------- tests/plat/build.py | 35 +++++++++++++++++++ tests/plat/core/{_dummy_e.c => _dummy,e,.c} | 0 tests/plat/core/{aar_e.e => aar,e,.e} | 0 tests/plat/core/{and_e.e => and,e,.e} | 0 tests/plat/core/{andv_e.e => andv,e,.e} | 0 tests/plat/core/{brk_c.c => brk,c,.c} | 0 tests/plat/core/{bss_e.c => bss,e,.c} | 0 tests/plat/core/{calloc_c.c => calloc,c,.c} | 0 tests/plat/core/{cii_e.e => cii,e,.e} | 0 tests/plat/core/{cmi_e.e => cmi,e,.e} | 0 tests/plat/core/{cms_e.e => cms,e,.e} | 0 tests/plat/core/{cmu_e.e => cmu,e,.e} | 0 tests/plat/core/{csa_e.c => csa,e,.c} | 0 tests/plat/core/{csb_e.c => csb,e,.c} | 0 tests/plat/core/{dup_e.e => dup,e,.e} | 0 tests/plat/core/{exg_e.e => exg,e,.e} | 0 tests/plat/core/{inn_e.e => inn,e,.e} | 0 tests/plat/core/{intadd_e.c => intadd,e,.c} | 0 tests/plat/core/{intcmp_e.c => intcmp,e,.c} | 0 tests/plat/core/{intdiv_e.c => intdiv,e,.c} | 0 tests/plat/core/{intrem_e.c => intrem,e,.c} | 0 .../plat/core/{intshift_e.c => intshift,e,.c} | 0 tests/plat/core/{intsub_e.c => intsub,e,.c} | 0 tests/plat/core/{ior_e.e => ior,e,.e} | 0 tests/plat/core/{iorv_e.e => iorv,e,.e} | 0 tests/plat/core/{lar_e.e => lar,e,.e} | 0 .../core/{newdispose_p.p => newdispose,p,.p} | 0 .../core/{pascalsets_p.p => pascalsets,p,.p} | 0 tests/plat/core/{rck_e.e => rck,e,.e} | 0 tests/plat/core/{rotate_e.e => rotate,e,.e} | 0 tests/plat/core/{sar_e.e => sar,e,.e} | 0 tests/plat/core/{set_e.e => set,e,.e} | 0 tests/plat/core/{setjmp_c.c => setjmp,c,.c} | 0 .../core/{structcopy_e.c => structcopy,e,.c} | 0 tests/plat/core/{xor_e.e => xor,e,.e} | 0 tests/plat/core/{xorv_e.e => xorv,e,.e} | 0 37 files changed, 48 insertions(+), 13 deletions(-) rename tests/plat/core/{_dummy_e.c => _dummy,e,.c} (100%) rename tests/plat/core/{aar_e.e => aar,e,.e} (100%) rename tests/plat/core/{and_e.e => and,e,.e} (100%) rename tests/plat/core/{andv_e.e => andv,e,.e} (100%) rename tests/plat/core/{brk_c.c => brk,c,.c} (100%) rename tests/plat/core/{bss_e.c => bss,e,.c} (100%) rename tests/plat/core/{calloc_c.c => calloc,c,.c} (100%) rename tests/plat/core/{cii_e.e => cii,e,.e} (100%) rename tests/plat/core/{cmi_e.e => cmi,e,.e} (100%) rename tests/plat/core/{cms_e.e => cms,e,.e} (100%) rename tests/plat/core/{cmu_e.e => cmu,e,.e} (100%) rename tests/plat/core/{csa_e.c => csa,e,.c} (100%) rename tests/plat/core/{csb_e.c => csb,e,.c} (100%) rename tests/plat/core/{dup_e.e => dup,e,.e} (100%) rename tests/plat/core/{exg_e.e => exg,e,.e} (100%) rename tests/plat/core/{inn_e.e => inn,e,.e} (100%) rename tests/plat/core/{intadd_e.c => intadd,e,.c} (100%) rename tests/plat/core/{intcmp_e.c => intcmp,e,.c} (100%) rename tests/plat/core/{intdiv_e.c => intdiv,e,.c} (100%) rename tests/plat/core/{intrem_e.c => intrem,e,.c} (100%) rename tests/plat/core/{intshift_e.c => intshift,e,.c} (100%) rename tests/plat/core/{intsub_e.c => intsub,e,.c} (100%) rename tests/plat/core/{ior_e.e => ior,e,.e} (100%) rename tests/plat/core/{iorv_e.e => iorv,e,.e} (100%) rename tests/plat/core/{lar_e.e => lar,e,.e} (100%) rename tests/plat/core/{newdispose_p.p => newdispose,p,.p} (100%) rename tests/plat/core/{pascalsets_p.p => pascalsets,p,.p} (100%) rename tests/plat/core/{rck_e.e => rck,e,.e} (100%) rename tests/plat/core/{rotate_e.e => rotate,e,.e} (100%) rename tests/plat/core/{sar_e.e => sar,e,.e} (100%) rename tests/plat/core/{set_e.e => set,e,.e} (100%) rename tests/plat/core/{setjmp_c.c => setjmp,c,.c} (100%) rename tests/plat/core/{structcopy_e.c => structcopy,e,.c} (100%) rename tests/plat/core/{xor_e.e => xor,e,.e} (100%) rename tests/plat/core/{xorv_e.e => xorv,e,.e} (100%) diff --git a/build.py b/build.py index 92e45fe874..9b54fc32e2 100644 --- a/build.py +++ b/build.py @@ -3,19 +3,19 @@ # This is the list of which plats to build. PLATS = [ "cpm", - "linux386", - "linux68k", - "linuxmips", - "linuxppc", - "minix68k", - "msdos386", - "msdos86", - "osx386", - "osxppc", - "pc86", - "rpi", - "pdpv7", - "em22", + # "linux386", + # "linux68k", + # "linuxmips", + # "linuxppc", + # "minix68k", + # "msdos386", + # "msdos86", + # "osx386", + # "osxppc", + # "pc86", + # "rpi", + # "pdpv7", + # "em22", ] # This is the list of which plats to test. diff --git a/tests/plat/build.py b/tests/plat/build.py index cb88cfca4c..f3f3f16eae 100644 --- a/tests/plat/build.py +++ b/tests/plat/build.py @@ -13,6 +13,41 @@ "tests/plat/bugs/bug-22-inn,mod,.mod", "tests/plat/bugs/bug-62-notvar_var,e,.c", "tests/plat/bugs/bug-310-cpp-no-trailing-newline,c,.c", + "tests/plat/core/aar,e,.e", + "tests/plat/core/and,e,.e", + "tests/plat/core/andv,e,.e", + "tests/plat/core/brk,c,.c", + "tests/plat/core/bss,e,.c", + "tests/plat/core/calloc,c,.c", + "tests/plat/core/cii,e,.e", + "tests/plat/core/cmi,e,.e", + "tests/plat/core/cms,e,.e", + "tests/plat/core/cmu,e,.e", + "tests/plat/core/csa,e,.c", + "tests/plat/core/csb,e,.c", + "tests/plat/core/_dummy,e,.c", + "tests/plat/core/dup,e,.e", + "tests/plat/core/exg,e,.e", + "tests/plat/core/inn,e,.e", + "tests/plat/core/intadd,e,.c", + "tests/plat/core/intcmp,e,.c", + "tests/plat/core/intdiv,e,.c", + "tests/plat/core/intrem,e,.c", + "tests/plat/core/intshift,e,.c", + "tests/plat/core/intsub,e,.c", + "tests/plat/core/ior,e,.e", + "tests/plat/core/iorv,e,.e", + "tests/plat/core/lar,e,.e", + "tests/plat/core/newdispose,p,.p", + "tests/plat/core/pascalsets,p,.p", + "tests/plat/core/rck,e,.e", + "tests/plat/core/rotate,e,.e", + "tests/plat/core/sar,e,.e", + "tests/plat/core/set,e,.e", + "tests/plat/core/setjmp,c,.c", + "tests/plat/core/structcopy,e,.c", + "tests/plat/core/xor,e,.e", + "tests/plat/core/xorv,e,.e", ], "m2": [], "floats": [], diff --git a/tests/plat/core/_dummy_e.c b/tests/plat/core/_dummy,e,.c similarity index 100% rename from tests/plat/core/_dummy_e.c rename to tests/plat/core/_dummy,e,.c diff --git a/tests/plat/core/aar_e.e b/tests/plat/core/aar,e,.e similarity index 100% rename from tests/plat/core/aar_e.e rename to tests/plat/core/aar,e,.e diff --git a/tests/plat/core/and_e.e b/tests/plat/core/and,e,.e similarity index 100% rename from tests/plat/core/and_e.e rename to tests/plat/core/and,e,.e diff --git a/tests/plat/core/andv_e.e b/tests/plat/core/andv,e,.e similarity index 100% rename from tests/plat/core/andv_e.e rename to tests/plat/core/andv,e,.e diff --git a/tests/plat/core/brk_c.c b/tests/plat/core/brk,c,.c similarity index 100% rename from tests/plat/core/brk_c.c rename to tests/plat/core/brk,c,.c diff --git a/tests/plat/core/bss_e.c b/tests/plat/core/bss,e,.c similarity index 100% rename from tests/plat/core/bss_e.c rename to tests/plat/core/bss,e,.c diff --git a/tests/plat/core/calloc_c.c b/tests/plat/core/calloc,c,.c similarity index 100% rename from tests/plat/core/calloc_c.c rename to tests/plat/core/calloc,c,.c diff --git a/tests/plat/core/cii_e.e b/tests/plat/core/cii,e,.e similarity index 100% rename from tests/plat/core/cii_e.e rename to tests/plat/core/cii,e,.e diff --git a/tests/plat/core/cmi_e.e b/tests/plat/core/cmi,e,.e similarity index 100% rename from tests/plat/core/cmi_e.e rename to tests/plat/core/cmi,e,.e diff --git a/tests/plat/core/cms_e.e b/tests/plat/core/cms,e,.e similarity index 100% rename from tests/plat/core/cms_e.e rename to tests/plat/core/cms,e,.e diff --git a/tests/plat/core/cmu_e.e b/tests/plat/core/cmu,e,.e similarity index 100% rename from tests/plat/core/cmu_e.e rename to tests/plat/core/cmu,e,.e diff --git a/tests/plat/core/csa_e.c b/tests/plat/core/csa,e,.c similarity index 100% rename from tests/plat/core/csa_e.c rename to tests/plat/core/csa,e,.c diff --git a/tests/plat/core/csb_e.c b/tests/plat/core/csb,e,.c similarity index 100% rename from tests/plat/core/csb_e.c rename to tests/plat/core/csb,e,.c diff --git a/tests/plat/core/dup_e.e b/tests/plat/core/dup,e,.e similarity index 100% rename from tests/plat/core/dup_e.e rename to tests/plat/core/dup,e,.e diff --git a/tests/plat/core/exg_e.e b/tests/plat/core/exg,e,.e similarity index 100% rename from tests/plat/core/exg_e.e rename to tests/plat/core/exg,e,.e diff --git a/tests/plat/core/inn_e.e b/tests/plat/core/inn,e,.e similarity index 100% rename from tests/plat/core/inn_e.e rename to tests/plat/core/inn,e,.e diff --git a/tests/plat/core/intadd_e.c b/tests/plat/core/intadd,e,.c similarity index 100% rename from tests/plat/core/intadd_e.c rename to tests/plat/core/intadd,e,.c diff --git a/tests/plat/core/intcmp_e.c b/tests/plat/core/intcmp,e,.c similarity index 100% rename from tests/plat/core/intcmp_e.c rename to tests/plat/core/intcmp,e,.c diff --git a/tests/plat/core/intdiv_e.c b/tests/plat/core/intdiv,e,.c similarity index 100% rename from tests/plat/core/intdiv_e.c rename to tests/plat/core/intdiv,e,.c diff --git a/tests/plat/core/intrem_e.c b/tests/plat/core/intrem,e,.c similarity index 100% rename from tests/plat/core/intrem_e.c rename to tests/plat/core/intrem,e,.c diff --git a/tests/plat/core/intshift_e.c b/tests/plat/core/intshift,e,.c similarity index 100% rename from tests/plat/core/intshift_e.c rename to tests/plat/core/intshift,e,.c diff --git a/tests/plat/core/intsub_e.c b/tests/plat/core/intsub,e,.c similarity index 100% rename from tests/plat/core/intsub_e.c rename to tests/plat/core/intsub,e,.c diff --git a/tests/plat/core/ior_e.e b/tests/plat/core/ior,e,.e similarity index 100% rename from tests/plat/core/ior_e.e rename to tests/plat/core/ior,e,.e diff --git a/tests/plat/core/iorv_e.e b/tests/plat/core/iorv,e,.e similarity index 100% rename from tests/plat/core/iorv_e.e rename to tests/plat/core/iorv,e,.e diff --git a/tests/plat/core/lar_e.e b/tests/plat/core/lar,e,.e similarity index 100% rename from tests/plat/core/lar_e.e rename to tests/plat/core/lar,e,.e diff --git a/tests/plat/core/newdispose_p.p b/tests/plat/core/newdispose,p,.p similarity index 100% rename from tests/plat/core/newdispose_p.p rename to tests/plat/core/newdispose,p,.p diff --git a/tests/plat/core/pascalsets_p.p b/tests/plat/core/pascalsets,p,.p similarity index 100% rename from tests/plat/core/pascalsets_p.p rename to tests/plat/core/pascalsets,p,.p diff --git a/tests/plat/core/rck_e.e b/tests/plat/core/rck,e,.e similarity index 100% rename from tests/plat/core/rck_e.e rename to tests/plat/core/rck,e,.e diff --git a/tests/plat/core/rotate_e.e b/tests/plat/core/rotate,e,.e similarity index 100% rename from tests/plat/core/rotate_e.e rename to tests/plat/core/rotate,e,.e diff --git a/tests/plat/core/sar_e.e b/tests/plat/core/sar,e,.e similarity index 100% rename from tests/plat/core/sar_e.e rename to tests/plat/core/sar,e,.e diff --git a/tests/plat/core/set_e.e b/tests/plat/core/set,e,.e similarity index 100% rename from tests/plat/core/set_e.e rename to tests/plat/core/set,e,.e diff --git a/tests/plat/core/setjmp_c.c b/tests/plat/core/setjmp,c,.c similarity index 100% rename from tests/plat/core/setjmp_c.c rename to tests/plat/core/setjmp,c,.c diff --git a/tests/plat/core/structcopy_e.c b/tests/plat/core/structcopy,e,.c similarity index 100% rename from tests/plat/core/structcopy_e.c rename to tests/plat/core/structcopy,e,.c diff --git a/tests/plat/core/xor_e.e b/tests/plat/core/xor,e,.e similarity index 100% rename from tests/plat/core/xor_e.e rename to tests/plat/core/xor,e,.e diff --git a/tests/plat/core/xorv_e.e b/tests/plat/core/xorv,e,.e similarity index 100% rename from tests/plat/core/xorv_e.e rename to tests/plat/core/xorv,e,.e From a6abc32a2c2237e74b34811a8665c56a546b9114 Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 4 Apr 2025 22:09:44 +0200 Subject: [PATCH 53/79] Convert the float tests. --- plat/cpm/tests/build.py | 1 + tests/plat/build.py | 63 ++++++++++--------- .../floats/{doublecmp_e.c => doublecmp,e,.c} | 0 .../{from_d_to_si_e.c => from_d_to_si,e,.c} | 0 .../{from_d_to_ui_e.c => from_d_to_ui,e,.c} | 0 .../{from_si_to_d_e.c => from_si_to_d,e,.c} | 0 .../{from_ui_to_d_e.c => from_ui_to_d,e,.c} | 0 7 files changed, 35 insertions(+), 29 deletions(-) rename tests/plat/floats/{doublecmp_e.c => doublecmp,e,.c} (100%) rename tests/plat/floats/{from_d_to_si_e.c => from_d_to_si,e,.c} (100%) rename tests/plat/floats/{from_d_to_ui_e.c => from_d_to_ui,e,.c} (100%) rename tests/plat/floats/{from_si_to_d_e.c => from_si_to_d,e,.c} (100%) rename tests/plat/floats/{from_ui_to_d_e.c => from_ui_to_d,e,.c} (100%) diff --git a/plat/cpm/tests/build.py b/plat/cpm/tests/build.py index b03b389fa5..ce13d9a602 100644 --- a/plat/cpm/tests/build.py +++ b/plat/cpm/tests/build.py @@ -5,4 +5,5 @@ plat="cpm", method="plat/cpm/emu", extratests=["./parsefcb,c,.c"], + sets=["core", "bugs", "m2", "long-long"], ) diff --git a/tests/plat/build.py b/tests/plat/build.py index f3f3f16eae..44f4e93cac 100644 --- a/tests/plat/build.py +++ b/tests/plat/build.py @@ -5,7 +5,6 @@ from os.path import * allsets = { - "core": [], "bugs": [ "tests/plat/bugs/bug-157-i80-varargs,c,.c", "tests/plat/bugs/bug-164-faddrn,c,.c", @@ -13,6 +12,8 @@ "tests/plat/bugs/bug-22-inn,mod,.mod", "tests/plat/bugs/bug-62-notvar_var,e,.c", "tests/plat/bugs/bug-310-cpp-no-trailing-newline,c,.c", + ], + "core": [ "tests/plat/core/aar,e,.e", "tests/plat/core/and,e,.e", "tests/plat/core/andv,e,.e", @@ -49,9 +50,15 @@ "tests/plat/core/xor,e,.e", "tests/plat/core/xorv,e,.e", ], - "m2": [], - "floats": [], + "floats": [ + "tests/plat/floats/doublecmp,e,.c", + "tests/plat/floats/from_d_to_si,e,.c", + "tests/plat/floats/from_d_to_ui,e,.c", + "tests/plat/floats/from_si_to_d,e,.c", + "tests/plat/floats/from_ui_to_d,e,.c", + ], "long-long": [], + "m2": [], } @@ -75,34 +82,32 @@ def plat_testsuite( plat=plat, ) + tests = [] testfiles = filenamesof(extratests) for set in sets: - testfiles += allsets[set] - - tests = [] - for t in testfiles: - filename, lang, *flags = t.split(",") - flags = flags[0:-1] - fs = basename(filename) + for t in allsets[set]: + filename, lang, *flags = t.split(",") + flags = flags[0:-1] + fs = basename(filename) - tests += [ - test( - name=f"{fs}_test", - ins=[ - "tests/plat/testdriver.sh", - method, - "util/build+testrunner", - ackcprogram( - name=f"{fs}_bin", - srcs=[t], - lang=lang, - plat=plat, - cflags=flags, - deps=[lib], - ), - ], - commands=["$[ins[0]] $[ins[1]] $[ins[3]] 15 $[ins[2]]"], - ) - ] + tests += [ + test( + name=f"{set}/{fs}_test", + ins=[ + "tests/plat/testdriver.sh", + method, + "util/build+testrunner", + ackcprogram( + name=f"{set}/{fs}_bin", + srcs=[t], + lang=lang, + plat=plat, + cflags=flags, + deps=[lib], + ), + ], + commands=["$[ins[0]] $[ins[1]] $[ins[3]] 15 $[ins[2]]"], + ) + ] export(replaces=self, deps=tests) diff --git a/tests/plat/floats/doublecmp_e.c b/tests/plat/floats/doublecmp,e,.c similarity index 100% rename from tests/plat/floats/doublecmp_e.c rename to tests/plat/floats/doublecmp,e,.c diff --git a/tests/plat/floats/from_d_to_si_e.c b/tests/plat/floats/from_d_to_si,e,.c similarity index 100% rename from tests/plat/floats/from_d_to_si_e.c rename to tests/plat/floats/from_d_to_si,e,.c diff --git a/tests/plat/floats/from_d_to_ui_e.c b/tests/plat/floats/from_d_to_ui,e,.c similarity index 100% rename from tests/plat/floats/from_d_to_ui_e.c rename to tests/plat/floats/from_d_to_ui,e,.c diff --git a/tests/plat/floats/from_si_to_d_e.c b/tests/plat/floats/from_si_to_d,e,.c similarity index 100% rename from tests/plat/floats/from_si_to_d_e.c rename to tests/plat/floats/from_si_to_d,e,.c diff --git a/tests/plat/floats/from_ui_to_d_e.c b/tests/plat/floats/from_ui_to_d,e,.c similarity index 100% rename from tests/plat/floats/from_ui_to_d_e.c rename to tests/plat/floats/from_ui_to_d,e,.c From 258b4be0e2aa91432989ea0b8aa70603111e7d29 Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 4 Apr 2025 22:13:22 +0200 Subject: [PATCH 54/79] Convert the long-long tests. --- plat/cpm/tests/build.py | 2 +- tests/plat/build.py | 13 +++++++++++-- .../plat/long-long/{lladdsub_e.c => lladdsub,e,.c} | 0 .../plat/long-long/{llbitset_e.c => llbitset,e,.c} | 0 tests/plat/long-long/{llcmp_e.c => llcmp,e,.c} | 0 .../long-long/{llconvert_e.c => llconvert,e,.c} | 0 .../plat/long-long/{lldivrem_e.c => lldivrem,e,.c} | 0 tests/plat/long-long/{llmul_e.c => llmul,e,.c} | 0 tests/plat/long-long/{llshift_e.c => llshift,e,.c} | 0 .../plat/long-long/{llswitch_e.c => llswitch,e,.c} | 0 10 files changed, 12 insertions(+), 3 deletions(-) rename tests/plat/long-long/{lladdsub_e.c => lladdsub,e,.c} (100%) rename tests/plat/long-long/{llbitset_e.c => llbitset,e,.c} (100%) rename tests/plat/long-long/{llcmp_e.c => llcmp,e,.c} (100%) rename tests/plat/long-long/{llconvert_e.c => llconvert,e,.c} (100%) rename tests/plat/long-long/{lldivrem_e.c => lldivrem,e,.c} (100%) rename tests/plat/long-long/{llmul_e.c => llmul,e,.c} (100%) rename tests/plat/long-long/{llshift_e.c => llshift,e,.c} (100%) rename tests/plat/long-long/{llswitch_e.c => llswitch,e,.c} (100%) diff --git a/plat/cpm/tests/build.py b/plat/cpm/tests/build.py index ce13d9a602..0bc2bb5a31 100644 --- a/plat/cpm/tests/build.py +++ b/plat/cpm/tests/build.py @@ -5,5 +5,5 @@ plat="cpm", method="plat/cpm/emu", extratests=["./parsefcb,c,.c"], - sets=["core", "bugs", "m2", "long-long"], + sets=["core", "bugs", "m2"], ) diff --git a/tests/plat/build.py b/tests/plat/build.py index 44f4e93cac..1eb37944f2 100644 --- a/tests/plat/build.py +++ b/tests/plat/build.py @@ -57,7 +57,16 @@ "tests/plat/floats/from_si_to_d,e,.c", "tests/plat/floats/from_ui_to_d,e,.c", ], - "long-long": [], + "long-long": [ + "tests/plat/long-long/lladdsub,e,.c", + "tests/plat/long-long/llbitset,e,.c", + "tests/plat/long-long/llcmp,e,.c", + "tests/plat/long-long/llconvert,e,.c", + "tests/plat/long-long/lldivrem,e,.c", + "tests/plat/long-long/llmul,e,.c", + "tests/plat/long-long/llshift,e,.c", + "tests/plat/long-long/llswitch,e,.c", + ], "m2": [], } @@ -68,7 +77,7 @@ def plat_testsuite( name, plat, method: Target, - sets=["core", "bugs", "m2", "floats", "long-long"], + sets=["core", "bugs", "m2", "floats"], extratests: Targets = [], ): lib = ackclibrary( diff --git a/tests/plat/long-long/lladdsub_e.c b/tests/plat/long-long/lladdsub,e,.c similarity index 100% rename from tests/plat/long-long/lladdsub_e.c rename to tests/plat/long-long/lladdsub,e,.c diff --git a/tests/plat/long-long/llbitset_e.c b/tests/plat/long-long/llbitset,e,.c similarity index 100% rename from tests/plat/long-long/llbitset_e.c rename to tests/plat/long-long/llbitset,e,.c diff --git a/tests/plat/long-long/llcmp_e.c b/tests/plat/long-long/llcmp,e,.c similarity index 100% rename from tests/plat/long-long/llcmp_e.c rename to tests/plat/long-long/llcmp,e,.c diff --git a/tests/plat/long-long/llconvert_e.c b/tests/plat/long-long/llconvert,e,.c similarity index 100% rename from tests/plat/long-long/llconvert_e.c rename to tests/plat/long-long/llconvert,e,.c diff --git a/tests/plat/long-long/lldivrem_e.c b/tests/plat/long-long/lldivrem,e,.c similarity index 100% rename from tests/plat/long-long/lldivrem_e.c rename to tests/plat/long-long/lldivrem,e,.c diff --git a/tests/plat/long-long/llmul_e.c b/tests/plat/long-long/llmul,e,.c similarity index 100% rename from tests/plat/long-long/llmul_e.c rename to tests/plat/long-long/llmul,e,.c diff --git a/tests/plat/long-long/llshift_e.c b/tests/plat/long-long/llshift,e,.c similarity index 100% rename from tests/plat/long-long/llshift_e.c rename to tests/plat/long-long/llshift,e,.c diff --git a/tests/plat/long-long/llswitch_e.c b/tests/plat/long-long/llswitch,e,.c similarity index 100% rename from tests/plat/long-long/llswitch_e.c rename to tests/plat/long-long/llswitch,e,.c From 678eac057f3eac243e2dbef7bf967cb221831ed2 Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 4 Apr 2025 22:15:46 +0200 Subject: [PATCH 55/79] Convert the M2 tests. --- tests/plat/build.py | 9 ++++++++- tests/plat/m2/{ConvTest_mod.mod => ConvTest,mod,.mod} | 0 tests/plat/m2/{NestProc_mod.mod => NestProc,mod,.mod} | 0 tests/plat/m2/{OpenArray_mod.mod => OpenArray,mod,.mod} | 0 tests/plat/m2/{SemaTest_mod.mod => SemaTest,mod,.mod} | 0 tests/plat/m2/{Set100_mod.mod => Set100,mod,.mod} | 0 .../plat/m2/{StringTest_mod.mod => StringTest,mod,.mod} | 0 7 files changed, 8 insertions(+), 1 deletion(-) rename tests/plat/m2/{ConvTest_mod.mod => ConvTest,mod,.mod} (100%) rename tests/plat/m2/{NestProc_mod.mod => NestProc,mod,.mod} (100%) rename tests/plat/m2/{OpenArray_mod.mod => OpenArray,mod,.mod} (100%) rename tests/plat/m2/{SemaTest_mod.mod => SemaTest,mod,.mod} (100%) rename tests/plat/m2/{Set100_mod.mod => Set100,mod,.mod} (100%) rename tests/plat/m2/{StringTest_mod.mod => StringTest,mod,.mod} (100%) diff --git a/tests/plat/build.py b/tests/plat/build.py index 1eb37944f2..30bdb962b1 100644 --- a/tests/plat/build.py +++ b/tests/plat/build.py @@ -67,7 +67,14 @@ "tests/plat/long-long/llshift,e,.c", "tests/plat/long-long/llswitch,e,.c", ], - "m2": [], + "m2": [ + "tests/plat/m2/ConvTest,mod,.mod", + "tests/plat/m2/NestProc,mod,.mod", + "tests/plat/m2/OpenArray,mod,.mod", + "tests/plat/m2/SemaTest,mod,.mod", + "tests/plat/m2/Set100,mod,.mod", + "tests/plat/m2/StringTest,mod,.mod", + ], } diff --git a/tests/plat/m2/ConvTest_mod.mod b/tests/plat/m2/ConvTest,mod,.mod similarity index 100% rename from tests/plat/m2/ConvTest_mod.mod rename to tests/plat/m2/ConvTest,mod,.mod diff --git a/tests/plat/m2/NestProc_mod.mod b/tests/plat/m2/NestProc,mod,.mod similarity index 100% rename from tests/plat/m2/NestProc_mod.mod rename to tests/plat/m2/NestProc,mod,.mod diff --git a/tests/plat/m2/OpenArray_mod.mod b/tests/plat/m2/OpenArray,mod,.mod similarity index 100% rename from tests/plat/m2/OpenArray_mod.mod rename to tests/plat/m2/OpenArray,mod,.mod diff --git a/tests/plat/m2/SemaTest_mod.mod b/tests/plat/m2/SemaTest,mod,.mod similarity index 100% rename from tests/plat/m2/SemaTest_mod.mod rename to tests/plat/m2/SemaTest,mod,.mod diff --git a/tests/plat/m2/Set100_mod.mod b/tests/plat/m2/Set100,mod,.mod similarity index 100% rename from tests/plat/m2/Set100_mod.mod rename to tests/plat/m2/Set100,mod,.mod diff --git a/tests/plat/m2/StringTest_mod.mod b/tests/plat/m2/StringTest,mod,.mod similarity index 100% rename from tests/plat/m2/StringTest_mod.mod rename to tests/plat/m2/StringTest,mod,.mod From 1219d8d70d081a8cc56fc170f37fa7e92fc50593 Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 4 Apr 2025 23:51:59 +0200 Subject: [PATCH 56/79] The linux68k tests run. --- build.py | 33 +++++----- plat/linux68k/emu/build.py | 63 +++++++++++++++++++ .../emu/musashi/softfloat/softfloat.c | 2 +- plat/linux68k/tests/build.py | 8 +++ 4 files changed, 91 insertions(+), 15 deletions(-) create mode 100644 plat/linux68k/emu/build.py create mode 100644 plat/linux68k/tests/build.py diff --git a/build.py b/build.py index 9b54fc32e2..74edac9843 100644 --- a/build.py +++ b/build.py @@ -3,23 +3,28 @@ # This is the list of which plats to build. PLATS = [ "cpm", - # "linux386", - # "linux68k", - # "linuxmips", - # "linuxppc", - # "minix68k", - # "msdos386", - # "msdos86", - # "osx386", - # "osxppc", - # "pc86", - # "rpi", - # "pdpv7", - # "em22", + "linux386", + "linux68k", + "linuxmips", + "linuxppc", + "minix68k", + "msdos386", + "msdos86", + "osx386", + "osxppc", + "pc86", + "rpi", + "pdpv7", + "em22", ] # This is the list of which plats to test. -TEST_PLATS = ["cpm"] +TEST_PLATS = [ + "cpm", + "linux68k", + # "linuxppc", + # "pc86", +] # This contains the platform-independent host tooling required to build the plats. export( diff --git a/plat/linux68k/emu/build.py b/plat/linux68k/emu/build.py new file mode 100644 index 0000000000..9ccdb7bad5 --- /dev/null +++ b/plat/linux68k/emu/build.py @@ -0,0 +1,63 @@ +from build.ab import simplerule +from build.c import hostcprogram, hostclibrary +from build.ack import ackcfile +from build.utils import objectify + +hostcprogram(name="m68kmake", srcs=["./musashi/m68kmake.c"]) + +simplerule( + name="m68k_engine", + ins=[ + ".+m68kmake", + "./musashi/m68k_in.c", + "./musashi/m68kcpu.h", + "./musashi/m68kmmu.h", + "./m68kconf.h", + "./musashi/m68kcpu.c", + "./musashi/m68kfpu.c", + "./musashi/m68kdasm.c", + "./musashi/m68k.h", + # "./musashi/softfloat/mamesf.h", + # "./musashi/softfloat/milieu.h", + # "./musashi/softfloat/softfloat.c", + # "./musashi/softfloat/softfloat.h", + ], + outs=[ + "=m68kops.c", + "=m68kops.h", + "=m68kcpu.h", + "=m68kconf.h", + "=m68kcpu.c", + "=m68kdasm.c", + "=m68k.h", + ], + commands=["cp -R $[ins] $[dir]", "cd $[dir] && ./m68kmake"], +) + +hostclibrary( + name="support", + hdrs={ + "softfloat/milieu.h": "./musashi/softfloat/milieu.h", + "softfloat/mamesf.h": "./musashi/softfloat/mamesf.h", + "softfloat/softfloat.h": "./musashi/softfloat/softfloat.h", + "m68kfpu.c": "./musashi/m68kfpu.c", + "m68kmmu.h": "./musashi/m68kmmu.h", + }, +) + +hostcprogram( + name="emu", + srcs=[ + ".+m68k_engine", + "./sim.c", + "./musashi/softfloat/softfloat.c", + "./musashi/softfloat/softfloat-macros", + "./musashi/softfloat/softfloat-specialize", + "./sim.h", + "./m68kconf.h", + ], + deps=[ + ".+support", + ], + cflags=["-DM68K_COMPILE_FOR_MAME=0"], +) diff --git a/plat/linux68k/emu/musashi/softfloat/softfloat.c b/plat/linux68k/emu/musashi/softfloat/softfloat.c index 4669b08a9c..c8fb29f162 100644 --- a/plat/linux68k/emu/musashi/softfloat/softfloat.c +++ b/plat/linux68k/emu/musashi/softfloat/softfloat.c @@ -30,7 +30,7 @@ these four paragraphs for those parts of this code that are retained. =============================================================================*/ -#include "../m68kcpu.h" // which includes softfloat.h after defining the basic types +#include "m68kcpu.h" // which includes softfloat.h after defining the basic types /*---------------------------------------------------------------------------- | Floating-point rounding mode, extended double-precision rounding precision, diff --git a/plat/linux68k/tests/build.py b/plat/linux68k/tests/build.py new file mode 100644 index 0000000000..63dfc72183 --- /dev/null +++ b/plat/linux68k/tests/build.py @@ -0,0 +1,8 @@ +from tests.plat.build import plat_testsuite + +plat_testsuite( + name="tests", + plat="linux68k", + method="plat/linux68k/emu", + sets=["core", "bugs", "m2"], +) From 150864a6991fda180b549c13db3f36f0ea27d08b Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 5 Apr 2025 00:05:33 +0200 Subject: [PATCH 57/79] The linuxppc tests run. --- build.py | 2 +- plat/linuxppc/emu/build.py | 13 +++++++++++++ plat/linuxppc/tests/build.py | 8 ++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 plat/linuxppc/emu/build.py create mode 100644 plat/linuxppc/tests/build.py diff --git a/build.py b/build.py index 74edac9843..571e0def2e 100644 --- a/build.py +++ b/build.py @@ -22,7 +22,7 @@ TEST_PLATS = [ "cpm", "linux68k", - # "linuxppc", + "linuxppc", # "pc86", ] diff --git a/plat/linuxppc/emu/build.py b/plat/linuxppc/emu/build.py new file mode 100644 index 0000000000..1c4f232a9c --- /dev/null +++ b/plat/linuxppc/emu/build.py @@ -0,0 +1,13 @@ +from build.ab import simplerule +from build.c import hostcprogram + +simplerule( + name="dispatcher", + ins=["./mkdispatcher.lua", "./instructions.dat"], + outs=["=dispatcher.h"], + commands=["$(LUA) $[ins[0]] < $[ins[1]] > $[outs]"], +) + +hostcprogram( + name="emu", srcs=[".+dispatcher", "./emu.c", "./emu.h", "./main.c"] +) diff --git a/plat/linuxppc/tests/build.py b/plat/linuxppc/tests/build.py new file mode 100644 index 0000000000..1000dba0c3 --- /dev/null +++ b/plat/linuxppc/tests/build.py @@ -0,0 +1,8 @@ +from tests.plat.build import plat_testsuite + +plat_testsuite( + name="tests", + plat="linuxppc", + method="plat/linuxppc/emu", + sets=["core", "bugs", "m2", "floats"], +) From 010047c1546323ea1649dec6127c78b42492996b Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 5 Apr 2025 00:28:14 +0200 Subject: [PATCH 58/79] The pc86 tests run. --- build.py | 2 +- plat/pc86/emu/build.py | 36 ++++++++++++++++++++++++++++++++++++ plat/pc86/tests/build.py | 8 ++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 plat/pc86/emu/build.py create mode 100644 plat/pc86/tests/build.py diff --git a/build.py b/build.py index 571e0def2e..1d7ed2f71f 100644 --- a/build.py +++ b/build.py @@ -23,7 +23,7 @@ "cpm", "linux68k", "linuxppc", - # "pc86", + "pc86", ] # This contains the platform-independent host tooling required to build the plats. diff --git a/plat/pc86/emu/build.py b/plat/pc86/emu/build.py new file mode 100644 index 0000000000..dfd4f6edfe --- /dev/null +++ b/plat/pc86/emu/build.py @@ -0,0 +1,36 @@ +from build.c import hostclibrary, hostcprogram + +hostclibrary( + name="x86emu", + srcs=[ + "./x86emu/debug.c", + "./x86emu/decode.c", + "./x86emu/fpu.c", + "./x86emu/ops2.c", + "./x86emu/ops.c", + "./x86emu/prim_ops.c", + "./x86emu/sys.c", + ], + hdrs={ + "x86emu.h": "./x86emu/x86emu.h", + "x86emu/debug.h": "./x86emu/x86emu/debug.h", + "x86emu/decode.h": "./x86emu/x86emu/decode.h", + "x86emu/fpu_regs.h": "./x86emu/x86emu/fpu_regs.h", + "x86emu/fpu.h": "./x86emu/x86emu/fpu.h", + "x86emu/ops.h": "./x86emu/x86emu/ops.h", + "x86emu/prim_asm.h": "./x86emu/x86emu/prim_asm.h", + "x86emu/prim_ops.h": "./x86emu/x86emu/prim_ops.h", + "x86emu/prim_x86_gcc.h": "./x86emu/x86emu/prim_x86_gcc.h", + "x86emu/regs.h": "./x86emu/x86emu/regs.h", + "x86emu/types.h": "./x86emu/x86emu/types.h", + "x86emu/x86emui.h": "./x86emu/x86emu/x86emui.h", + }, + cflags=["-DDEBUG"], +) + +hostcprogram( + name="emu", + srcs=["./main.c"], + cflags=["-DDEBUG"], + deps=[".+x86emu"], +) diff --git a/plat/pc86/tests/build.py b/plat/pc86/tests/build.py new file mode 100644 index 0000000000..c85f05b83a --- /dev/null +++ b/plat/pc86/tests/build.py @@ -0,0 +1,8 @@ +from tests.plat.build import plat_testsuite + +plat_testsuite( + name="tests", + plat="pc86", + method="plat/pc86/emu", + sets=["core", "bugs", "m2"], +) From 414bbe1e656e75a8be04944d839f6562bbb88c1f Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 5 Apr 2025 00:29:46 +0200 Subject: [PATCH 59/79] Finally delete ackbuilder! --- build.lua | 111 ---- examples/build.lua | 60 -- first/ackbuilder.lua | 925 -------------------------- first/ackbuilder.md | 351 ---------- first/bison.lua | 44 -- first/build.lua | 263 -------- first/testsummary.sh | 60 -- h/build.lua | 48 -- lang/basic/lib/build.lua | 59 -- lang/basic/src/build.lua | 66 -- lang/build.lua | 0 lang/cem/cemcom.ansi/build.lua | 194 ------ lang/cem/cpp.ansi/build.lua | 130 ---- lang/cem/libcc.ansi/build.lua | 225 ------- lang/cem/libcc.ansi/headers/build.lua | 55 -- lang/m2/comp/build.lua | 123 ---- lang/m2/include/build.lua | 7 - lang/m2/libm2/build.lua | 126 ---- lang/pc/comp/build.lua | 174 ----- lang/pc/include/build.lua | 9 - lang/pc/libpc/build.lua | 107 --- mach/em22/libend/build.lua | 13 - mach/i386/as/build.lua | 12 - mach/i386/libem/build.lua | 60 -- mach/i386/libend/build.lua | 13 - mach/i386/ncg/build.lua | 8 - mach/i80/as/build.lua | 12 - mach/i80/libem/build.lua | 113 ---- mach/i80/libend/build.lua | 13 - mach/i80/ncg/build.lua | 8 - mach/i86/as/build.lua | 12 - mach/i86/libem/build.lua | 68 -- mach/i86/libend/build.lua | 13 - mach/i86/libsys/build.lua | 8 - mach/i86/ncg/build.lua | 8 - mach/m68020/as/build.lua | 12 - mach/m68020/libem/build.lua | 43 -- mach/m68020/libend/build.lua | 13 - mach/m68020/ncg/build.lua | 9 - mach/m68k2/as/build.lua | 12 - mach/m68k2/libem/build.lua | 46 -- mach/m68k2/libend/build.lua | 13 - mach/mips/as/build.lua | 19 - mach/mips/libem/build.lua | 43 -- mach/mips/libend/build.lua | 13 - mach/mips/mcg/build.lua | 7 - mach/pdp/as/build.lua | 12 - mach/pdp/libem/build.lua | 80 --- mach/pdp/libend/build.lua | 13 - mach/powerpc/as/build.lua | 12 - mach/powerpc/libem/build.lua | 45 -- mach/powerpc/libend/build.lua | 13 - mach/powerpc/mcg/build.lua | 7 - mach/powerpc/ncg/build.lua | 8 - mach/proto/as/build.lua | 57 -- mach/proto/cg/build.lua | 71 -- mach/proto/fp/build.lua | 98 --- mach/proto/mcg/build.lua | 84 --- mach/proto/ncg/build.lua | 74 --- mach/proto/top/build.lua | 22 - mach/vc4/as/build.lua | 13 - mach/vc4/libem/build.lua | 11 - mach/vc4/libend/build.lua | 13 - mach/vc4/ncg/build.lua | 8 - modules/build.lua | 12 - modules/src/alloc/build.lua | 14 - modules/src/data/build.lua | 25 - modules/src/em_code/build.lua | 103 --- modules/src/em_data/build.lua | 44 -- modules/src/em_mes/build.lua | 24 - modules/src/flt_arith/build.lua | 41 -- modules/src/idf/build.lua | 10 - modules/src/input/build.lua | 13 - modules/src/object/build.lua | 29 - modules/src/read_em/build.lua | 63 -- modules/src/string/build.lua | 8 - modules/src/system/build.lua | 16 - plat/build.lua | 154 ----- plat/cpm/build-pkg.lua | 29 - plat/cpm/build-tools.lua | 31 - plat/cpm/emu/build.lua | 51 -- plat/cpm/include/build.lua | 26 - plat/cpm/libsys/build.lua | 168 ----- plat/cpm/tests/build.lua | 15 - plat/em/include/build.lua | 27 - plat/em/libsys/build.lua | 74 --- plat/em22/build-pkg.lua | 18 - plat/em22/build-tools.lua | 10 - plat/em22/include/build.lua | 4 - plat/em22/libsys/build.lua | 16 - plat/linux/include/build.lua | 27 - plat/linux/libsys/build.lua | 35 - plat/linux386/build-pkg.lua | 25 - plat/linux386/build-tools.lua | 22 - plat/linux386/include/build.lua | 4 - plat/linux386/libsys/build.lua | 18 - plat/linux68k/build-pkg.lua | 25 - plat/linux68k/build-tools.lua | 25 - plat/linux68k/emu/build.lua | 58 -- plat/linux68k/include/build.lua | 4 - plat/linux68k/libsys/build.lua | 16 - plat/linux68k/tests/build.lua | 10 - plat/linuxmips/build-pkg.lua | 25 - plat/linuxmips/build-tools.lua | 29 - plat/linuxmips/include/build.lua | 4 - plat/linuxmips/libsys/build.lua | 36 - plat/linuxppc/build-pkg.lua | 25 - plat/linuxppc/build-tools.lua | 34 - plat/linuxppc/emu/build.lua | 31 - plat/linuxppc/include/build.lua | 4 - plat/linuxppc/libsys/build.lua | 38 -- plat/linuxppc/tests/build.lua | 10 - plat/minix/include/build.lua | 36 - plat/minix68k/build-pkg.lua | 25 - plat/minix68k/build-tools.lua | 25 - plat/minix68k/cv/build.lua | 9 - plat/minix68k/include/build.lua | 27 - plat/minix68k/libsys/build.lua | 142 ---- plat/msdos/include/build.lua | 24 - plat/msdos/libsys/build.lua | 28 - plat/msdos386/build-pkg.lua | 53 -- plat/msdos386/build-tools.lua | 22 - plat/msdos386/include/build.lua | 24 - plat/msdos386/libsys/build.lua | 44 -- plat/msdos86/build-pkg.lua | 25 - plat/msdos86/build-tools.lua | 22 - plat/msdos86/include/build.lua | 24 - plat/msdos86/libsys/build.lua | 33 - plat/osx/cvmach/build.lua | 15 - plat/osx/include/build.lua | 28 - plat/osx386/build-pkg.lua | 24 - plat/osx386/build-tools.lua | 22 - plat/osx386/include/build.lua | 4 - plat/osx386/libsys/build.lua | 36 - plat/osxppc/build-pkg.lua | 24 - plat/osxppc/build-tools.lua | 28 - plat/osxppc/include/build.lua | 4 - plat/osxppc/libsys/build.lua | 35 - plat/pc86/build-pkg.lua | 25 - plat/pc86/build-tools.lua | 21 - plat/pc86/emu/build.lua | 27 - plat/pc86/include/build.lua | 24 - plat/pc86/libsys/build.lua | 29 - plat/pc86/tests/build.lua | 11 - plat/pdpv7/build-pkg.lua | 25 - plat/pdpv7/build-tools.lua | 28 - plat/pdpv7/cv/build.lua | 8 - plat/pdpv7/include/build.lua | 26 - plat/pdpv7/libsys/build.lua | 95 --- plat/qemuppc/build-pkg.lua | 26 - plat/qemuppc/build-tools.lua | 33 - plat/qemuppc/include/build.lua | 24 - plat/qemuppc/libsys/build.lua | 16 - plat/qemuppc/tests/build.lua | 7 - plat/rpi/build-pkg.lua | 25 - plat/rpi/build-tools.lua | 22 - plat/rpi/include/build.lua | 27 - plat/rpi/libsys/build.lua | 34 - tests/plat/bugs/build.lua | 13 - tests/plat/build.lua | 95 --- tests/plat/core/build.lua | 42 -- tests/plat/floats/build.lua | 12 - tests/plat/lib/build.lua | 7 - tests/plat/long-long/build.lua | 15 - tests/plat/m2/build.lua | 13 - util/LLgen/build.lua | 90 --- util/ack/build.lua | 56 -- util/amisc/build.lua | 41 -- util/arch/build.lua | 22 - util/ass/build.lua | 65 -- util/build/build.lua | 8 - util/cgg/build.lua | 62 -- util/cmisc/build.lua | 31 - util/ego/build.lua | 303 --------- util/ego/descr/build.lua | 31 - util/ego/ra/build.lua | 51 -- util/ego/share/build.lua | 76 --- util/int/build.lua | 149 ----- util/led/build.lua | 37 -- util/mcgg/build.lua | 95 --- util/misc/build.lua | 45 -- util/ncgg/build.lua | 94 --- util/opt/build.lua | 106 --- util/topgen/build.lua | 49 -- 184 files changed, 8823 deletions(-) delete mode 100644 build.lua delete mode 100644 examples/build.lua delete mode 100644 first/ackbuilder.lua delete mode 100644 first/ackbuilder.md delete mode 100644 first/bison.lua delete mode 100644 first/build.lua delete mode 100755 first/testsummary.sh delete mode 100644 h/build.lua delete mode 100644 lang/basic/lib/build.lua delete mode 100644 lang/basic/src/build.lua delete mode 100644 lang/build.lua delete mode 100644 lang/cem/cemcom.ansi/build.lua delete mode 100644 lang/cem/cpp.ansi/build.lua delete mode 100644 lang/cem/libcc.ansi/build.lua delete mode 100644 lang/cem/libcc.ansi/headers/build.lua delete mode 100644 lang/m2/comp/build.lua delete mode 100644 lang/m2/include/build.lua delete mode 100644 lang/m2/libm2/build.lua delete mode 100644 lang/pc/comp/build.lua delete mode 100644 lang/pc/include/build.lua delete mode 100644 lang/pc/libpc/build.lua delete mode 100644 mach/em22/libend/build.lua delete mode 100644 mach/i386/as/build.lua delete mode 100644 mach/i386/libem/build.lua delete mode 100644 mach/i386/libend/build.lua delete mode 100644 mach/i386/ncg/build.lua delete mode 100644 mach/i80/as/build.lua delete mode 100644 mach/i80/libem/build.lua delete mode 100644 mach/i80/libend/build.lua delete mode 100644 mach/i80/ncg/build.lua delete mode 100644 mach/i86/as/build.lua delete mode 100644 mach/i86/libem/build.lua delete mode 100644 mach/i86/libend/build.lua delete mode 100644 mach/i86/libsys/build.lua delete mode 100644 mach/i86/ncg/build.lua delete mode 100644 mach/m68020/as/build.lua delete mode 100644 mach/m68020/libem/build.lua delete mode 100644 mach/m68020/libend/build.lua delete mode 100644 mach/m68020/ncg/build.lua delete mode 100644 mach/m68k2/as/build.lua delete mode 100644 mach/m68k2/libem/build.lua delete mode 100644 mach/m68k2/libend/build.lua delete mode 100644 mach/mips/as/build.lua delete mode 100644 mach/mips/libem/build.lua delete mode 100644 mach/mips/libend/build.lua delete mode 100644 mach/mips/mcg/build.lua delete mode 100644 mach/pdp/as/build.lua delete mode 100644 mach/pdp/libem/build.lua delete mode 100644 mach/pdp/libend/build.lua delete mode 100644 mach/powerpc/as/build.lua delete mode 100644 mach/powerpc/libem/build.lua delete mode 100644 mach/powerpc/libend/build.lua delete mode 100644 mach/powerpc/mcg/build.lua delete mode 100644 mach/powerpc/ncg/build.lua delete mode 100644 mach/proto/as/build.lua delete mode 100644 mach/proto/cg/build.lua delete mode 100644 mach/proto/fp/build.lua delete mode 100644 mach/proto/mcg/build.lua delete mode 100644 mach/proto/ncg/build.lua delete mode 100644 mach/proto/top/build.lua delete mode 100644 mach/vc4/as/build.lua delete mode 100644 mach/vc4/libem/build.lua delete mode 100644 mach/vc4/libend/build.lua delete mode 100644 mach/vc4/ncg/build.lua delete mode 100644 modules/build.lua delete mode 100644 modules/src/alloc/build.lua delete mode 100644 modules/src/data/build.lua delete mode 100644 modules/src/em_code/build.lua delete mode 100644 modules/src/em_data/build.lua delete mode 100644 modules/src/em_mes/build.lua delete mode 100644 modules/src/flt_arith/build.lua delete mode 100644 modules/src/idf/build.lua delete mode 100644 modules/src/input/build.lua delete mode 100644 modules/src/object/build.lua delete mode 100644 modules/src/read_em/build.lua delete mode 100644 modules/src/string/build.lua delete mode 100644 modules/src/system/build.lua delete mode 100644 plat/build.lua delete mode 100644 plat/cpm/build-pkg.lua delete mode 100644 plat/cpm/build-tools.lua delete mode 100644 plat/cpm/emu/build.lua delete mode 100644 plat/cpm/include/build.lua delete mode 100644 plat/cpm/libsys/build.lua delete mode 100644 plat/cpm/tests/build.lua delete mode 100644 plat/em/include/build.lua delete mode 100644 plat/em/libsys/build.lua delete mode 100644 plat/em22/build-pkg.lua delete mode 100644 plat/em22/build-tools.lua delete mode 100644 plat/em22/include/build.lua delete mode 100644 plat/em22/libsys/build.lua delete mode 100644 plat/linux/include/build.lua delete mode 100644 plat/linux/libsys/build.lua delete mode 100644 plat/linux386/build-pkg.lua delete mode 100644 plat/linux386/build-tools.lua delete mode 100644 plat/linux386/include/build.lua delete mode 100644 plat/linux386/libsys/build.lua delete mode 100644 plat/linux68k/build-pkg.lua delete mode 100644 plat/linux68k/build-tools.lua delete mode 100644 plat/linux68k/emu/build.lua delete mode 100644 plat/linux68k/include/build.lua delete mode 100644 plat/linux68k/libsys/build.lua delete mode 100644 plat/linux68k/tests/build.lua delete mode 100644 plat/linuxmips/build-pkg.lua delete mode 100644 plat/linuxmips/build-tools.lua delete mode 100644 plat/linuxmips/include/build.lua delete mode 100644 plat/linuxmips/libsys/build.lua delete mode 100644 plat/linuxppc/build-pkg.lua delete mode 100644 plat/linuxppc/build-tools.lua delete mode 100644 plat/linuxppc/emu/build.lua delete mode 100644 plat/linuxppc/include/build.lua delete mode 100644 plat/linuxppc/libsys/build.lua delete mode 100644 plat/linuxppc/tests/build.lua delete mode 100644 plat/minix/include/build.lua delete mode 100644 plat/minix68k/build-pkg.lua delete mode 100644 plat/minix68k/build-tools.lua delete mode 100644 plat/minix68k/cv/build.lua delete mode 100644 plat/minix68k/include/build.lua delete mode 100644 plat/minix68k/libsys/build.lua delete mode 100644 plat/msdos/include/build.lua delete mode 100644 plat/msdos/libsys/build.lua delete mode 100644 plat/msdos386/build-pkg.lua delete mode 100644 plat/msdos386/build-tools.lua delete mode 100644 plat/msdos386/include/build.lua delete mode 100644 plat/msdos386/libsys/build.lua delete mode 100644 plat/msdos86/build-pkg.lua delete mode 100644 plat/msdos86/build-tools.lua delete mode 100644 plat/msdos86/include/build.lua delete mode 100644 plat/msdos86/libsys/build.lua delete mode 100644 plat/osx/cvmach/build.lua delete mode 100644 plat/osx/include/build.lua delete mode 100644 plat/osx386/build-pkg.lua delete mode 100644 plat/osx386/build-tools.lua delete mode 100644 plat/osx386/include/build.lua delete mode 100644 plat/osx386/libsys/build.lua delete mode 100644 plat/osxppc/build-pkg.lua delete mode 100644 plat/osxppc/build-tools.lua delete mode 100644 plat/osxppc/include/build.lua delete mode 100644 plat/osxppc/libsys/build.lua delete mode 100644 plat/pc86/build-pkg.lua delete mode 100644 plat/pc86/build-tools.lua delete mode 100644 plat/pc86/emu/build.lua delete mode 100644 plat/pc86/include/build.lua delete mode 100644 plat/pc86/libsys/build.lua delete mode 100644 plat/pc86/tests/build.lua delete mode 100644 plat/pdpv7/build-pkg.lua delete mode 100644 plat/pdpv7/build-tools.lua delete mode 100644 plat/pdpv7/cv/build.lua delete mode 100644 plat/pdpv7/include/build.lua delete mode 100644 plat/pdpv7/libsys/build.lua delete mode 100644 plat/qemuppc/build-pkg.lua delete mode 100644 plat/qemuppc/build-tools.lua delete mode 100644 plat/qemuppc/include/build.lua delete mode 100644 plat/qemuppc/libsys/build.lua delete mode 100644 plat/qemuppc/tests/build.lua delete mode 100644 plat/rpi/build-pkg.lua delete mode 100644 plat/rpi/build-tools.lua delete mode 100644 plat/rpi/include/build.lua delete mode 100644 plat/rpi/libsys/build.lua delete mode 100644 tests/plat/bugs/build.lua delete mode 100644 tests/plat/build.lua delete mode 100644 tests/plat/core/build.lua delete mode 100644 tests/plat/floats/build.lua delete mode 100644 tests/plat/lib/build.lua delete mode 100644 tests/plat/long-long/build.lua delete mode 100644 tests/plat/m2/build.lua delete mode 100644 util/LLgen/build.lua delete mode 100644 util/ack/build.lua delete mode 100644 util/amisc/build.lua delete mode 100644 util/arch/build.lua delete mode 100644 util/ass/build.lua delete mode 100644 util/build/build.lua delete mode 100644 util/cgg/build.lua delete mode 100644 util/cmisc/build.lua delete mode 100644 util/ego/build.lua delete mode 100644 util/ego/descr/build.lua delete mode 100644 util/ego/ra/build.lua delete mode 100644 util/ego/share/build.lua delete mode 100644 util/int/build.lua delete mode 100644 util/led/build.lua delete mode 100644 util/mcgg/build.lua delete mode 100644 util/misc/build.lua delete mode 100644 util/ncgg/build.lua delete mode 100644 util/opt/build.lua delete mode 100644 util/topgen/build.lua diff --git a/build.lua b/build.lua deleted file mode 100644 index 716b7990d0..0000000000 --- a/build.lua +++ /dev/null @@ -1,111 +0,0 @@ -vars.cflags = { - "$(CFLAGS)" -} -vars.ackcflags = { - "-O6" -} -vars.ackldflags = {} -vars.plats = { - "cpm", - "linux386", - "linux68k", - "linuxppc", - "linuxmips", - "minix68k", - "msdos86", - "msdos386", - "osx386", - "osxppc", - "pc86", - "rpi", - "pdpv7", - "em22", -} -vars.plats_with_tests = { - "cpm", - "linux68k", - --"linux386", - "linuxppc", - --"linuxmips", - "pc86", -} - -local is_windows = os.getenv("OS") == "Windows_NT" - -local int = {} -if not is_windows then - int[#int+1] = "util/int+pkg" -end - -installable { - name = "ack-common", - map = { - "lang/basic/src+pkg", - "lang/cem/cemcom.ansi+pkg", - "lang/m2/comp+pkg", - "lang/pc/comp+pkg", - "util/ack+pkg", - "util/amisc+pkg", - "util/arch+pkg", - "util/ass+pkg", - "util/ego+pkg", - "util/led+pkg", - "util/misc+pkg", - "util/opt+pkg", - int - }, -} - -local plat_packages = {} -local test_packages = {} -for _, p in ipairs(vars.plats) do - local pkg = "plat/"..p.."+pkg" - plat_packages[#plat_packages+1] = pkg - - installable { - name = "ack-"..p, - map = { - "+ack-common", - pkg, - }, - } -end -for _, p in ipairs(vars.plats_with_tests) do - test_packages[#test_packages+1] = "plat/"..p.."/tests+tests" -end - -installable { - name = "ack", - map = { - "+ack-common", - "examples+pkg", - plat_packages - }, -} - -if not is_windows then - normalrule { - name = "tests", - ins = { - "first/testsummary.sh", - test_packages - }, - outleaves = { - "stamp" - }, - commands = { - "%{ins}" - } - } -else - normalrule { - name = "tests", - ins = {}, - outleaves = { - "stamp" - }, - commands = { - "touch %{outs}" - } - } -end diff --git a/examples/build.lua b/examples/build.lua deleted file mode 100644 index 4e4aa92777..0000000000 --- a/examples/build.lua +++ /dev/null @@ -1,60 +0,0 @@ -include("plat/build.lua") - -local conly = { - rpi = true -} - -local softfp = { - cpm = true, -} - -local sourcefiles = filenamesof( - "./hilo.bas", - "./hilo.c", - "./hilo.mod", - "./hilo.p", - "./mandelbrot.c", - "./paranoia.c", - "./startrek.c" -) - -local usesfp = { - ["mandelbrot.c"] = true, - ["startrek.c"] = true, -} - -local installmap = {} -for _, file in ipairs(sourcefiles) do - local b = basename(file) - local be = replace(b, "%.", "_") - 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, - srcs = { file }, - vars = { - plat = plat, - lang = e, - ["+ackldflags"] = flags, - } - } - - installmap["$(PLATIND)/examples/"..be.."."..plat] = exe - end - end - installmap["$(PLATIND)/examples/"..b] = file -end - -installable { - name = "pkg", - map = installmap -} - diff --git a/first/ackbuilder.lua b/first/ackbuilder.lua deleted file mode 100644 index b2b41cf628..0000000000 --- a/first/ackbuilder.lua +++ /dev/null @@ -1,925 +0,0 @@ --- Targets: --- --- { --- fullname = full name of target --- dir = target's build directory --- outs = target's object files --- is = { set of rule types which made the target } --- } - -local emitter = {} -local rules = {} -local targets = {} -local buildfiles = {} -local globals -local cwd = "." -local vars = {} -local parente = {} -local loadingstack = {} - --- Forward references -local loadtarget - --- Compatibility polyfill for load -local function loadf(text, source, mode, env) - if rawget(_G, "loadstring") and rawget(_G, "setfenv") then - local chunk, e = loadstring(text, "@"..source) - if chunk then - setfenv(chunk, env) - end - return chunk, e - else - return load(text, source, mode, env) - end -end - --- Compatibility polyfill for unpack -if not rawget(_G, "unpack") then - unpack = table.unpack -end - -local function print(...) - local function print_no_nl(list) - for _, s in ipairs(list) do - if (type(s) == "table") then - io.stderr:write("{") - for k, v in pairs(s) do - print_no_nl({k}) - io.stderr:write("=") - print_no_nl({v}) - io.stderr:write(" ") - end - io.stderr:write("}") - else - io.stderr:write(tostring(s)) - end - end - end - - print_no_nl({...}) - io.stderr:write("\n") -end - -local function assertString(s, i) - if (type(s) ~= "string") then - error(string.format("parameter %d must be a string", i)) - end -end - -local function concat(...) - local r = {} - - local function process(list) - for _, t in ipairs(list) do - if (type(t) == "table") and not t.is then - process(t) - else - r[#r+1] = t - end - end - end - process({...}) - - return r -end - --- Test table membership (crudely). -local function contains(needle, haystack) - for _, k in ipairs(haystack) do - if (k == needle) then - return true - end - end - return false -end - -local function inherit(high, low) - local o = {} - setmetatable(o, { - __index = function(self, k) - local x = high[k] - if x then - return x - end - return low[k] - end - }) - for k, v in pairs(high) do - local _, _, kk = k:find("^%+(.*)$") - if kk then - o[kk] = concat(low[kk], v) - end - end - return o -end - -local function asstring(o) - local t = type(o) - if (t == "nil") then - return "" - elseif (t == "string") then - return o - elseif (t == "number") then - return o - elseif (t == "table") then - if o.is then - return asstring(o.outs) - else - local s = {} - for _, v in pairs(o) do - s[#s+1] = asstring(v) - end - return table.concat(s, " ") - end - else - error(string.format("can't turn values of type '%s' into strings", t)) - end -end - -local function concatpath(...) - local p = table.concat({...}, "/") - return (p:gsub("/+", "/"):gsub("^%./", ""):gsub("/%./", "/")) -end - --- Returns a list of the targets within the given collection; the keys of any --- keyed items are lost. Lists are expanded. -local function targetsof(...) - local o = {} - - local function process(items) - for _, item in pairs(items) do - if (type(item) == "table") then - if item.is then - -- This is a target. - o[#o+1] = item - else - -- This is a list. - process(item) - end - elseif (type(item) == "string") then - -- Filename! - if item:find("^%+") then - item = cwd..item - elseif item:find("^%./") then - item = concatpath(cwd, item) - end - o[#o+1] = loadtarget(item) - else - error(string.format("member of target list is not a string or a target")) - end - end - end - - process({...}) - return o -end - -local function filenamesof(...) - local targets = targetsof(...) - - local f = {} - for _, r in ipairs(targets) do - if (type(r) == "table") and r.is then - if r.outs then - for _, o in ipairs(r.outs) do - f[#f+1] = o - end - end - elseif (type(r) == "string") then - f[#f+1] = r - else - error(string.format("list of targets contains a %s which isn't a target", - type(r))) - end - end - return f -end - -local function targetnamesof(...) - local targets = targetsof(...) - - local f - for _, r in pairs(targets) do - if (type(r) == "table") and r.is then - f[#f+1] = r.fullname - elseif (type(r) == "string") then - f[#f+1] = r - else - error(string.format("list of targets contains a %s which isn't a target", - type(r))) - end - end - return f -end - -local function dotocollection(files, callback) - if (#files == 1) and (type(files[1]) == "string") then - return callback(files[1]) - end - - local o = {} - local function process(files) - for _, s in ipairs(files) do - if (type(s) == "table") then - if s.is then - error("passed target to a filename manipulation function") - else - process(s) - end - else - local b = callback(s) - if (b ~= "") then - o[#o+1] = b - end - end - end - end - process(files) - return o -end - - -local function abspath(...) - return dotocollection({...}, - function(filename) - assertString(filename, 1) - return filename - end - ) -end - - -local function basename(...) - return dotocollection({...}, - function(filename) - assertString(filename, 1) - local _, _, b = filename:find("^.*/([^/]*)$") - if not b then - return filename - end - return b - end - ) -end - - -local function dirname(...) - return dotocollection({...}, - function(filename) - assertString(filename, 1) - local _, _, b = filename:find("^(.*)/[^/]*$") - if not b then - return "" - end - return b - end - ) -end - -local function replace(files, pattern, repl) - return dotocollection({files}, - function(filename) - return filename:gsub(pattern, repl) - end - ) -end - -local function fpairs(...) - return ipairs(filenamesof(...)) -end - -local function matching(collection, pattern) - local o = {} - dotocollection(collection, - function(filename) - if filename:find(pattern) then - o[#o+1] = filename - end - end - ) - return o -end - --- Selects all targets containing at least one output file that matches --- the pattern (or all, if the pattern is nil). -local function selectof(targets, pattern) - local targets = targetsof(targets) - local o = {} - for k, v in pairs(targets) do - if v.is and v.outs then - local matches = false - for _, f in pairs(v.outs) do - if f:find(pattern) then - matches = true - break - end - end - if matches then - o[#o+1] = v - end - end - end - return o -end - -local function uniquify(...) - local s = {} - return dotocollection({...}, - function(filename) - if not s[filename] then - s[filename] = true - return filename - end - end - ) -end - -local function startswith(needle, haystack) - return haystack:sub(1, #needle) == needle -end - -local function emit(...) - local n = select("#", ...) - local args = {...} - - for i=1, n do - local s = asstring(args[i]) - io.stdout:write(s) - if not s:find("\n$") then - io.stdout:write(" ") - end - end -end - -local function templateexpand(list, vars) - vars = inherit(vars, globals) - - local o = {} - for _, s in ipairs(list) do - o[#o+1] = s:gsub("%%%b{}", - function(expr) - expr = expr:sub(3, -2) - local chunk, e = loadf("return ("..expr..")", expr, nil, vars) - if e then - error(string.format("error evaluating expression: %s", e)) - end - local value = chunk() - if (value == nil) then - error(string.format("template expression '%s' expands to nil (probably an undefined variable)", expr)) - end - return asstring(value) - end - ) - end - return o -end - -local function loadbuildfile(filename) - if contains(filename, loadingstack) then - error(string.format("build file cycle; '%s' refers to itself indirectly; stack is: %s %s", - filename, asstring(loadingstack), filename)) - end - - loadingstack[#loadingstack+1] = filename - if not buildfiles[filename] then - buildfiles[filename] = true - - local fp, data, chunk, e - io.stderr:write("loading ", filename, "\n") - fp, e = io.open(filename) - if not e then - data, e = fp:read("*a") - fp:close() - if not e then - local thisglobals = {} - thisglobals._G = thisglobals - setmetatable(thisglobals, {__index = globals}) - chunk, e = loadf(data, filename, nil, thisglobals) - end - end - if e then - error(string.format("couldn't load '%s': %s", filename, e)) - end - - local oldcwd = cwd - cwd = dirname(filename) - chunk() - cwd = oldcwd - end - loadingstack[#loadingstack] = nil -end - -local function loadbuildfilefor(filepart, targetpart) - local normalname = concatpath(filepart, "/build.lua") - local fp = io.open(normalname, "r") - if fp then - fp:close() - loadbuildfile(normalname) - return - end - - local extendedname = concatpath(filepart, "/build-"..targetpart..".lua") - fp = io.open(extendedname, "r") - if fp then - fp:close() - loadbuildfile(extendedname) - return - end - - error(string.format("could not access either '%s' or '%s'", normalname, extendedname)) -end - -loadtarget = function(targetname) - if targets[targetname] then - return targets[targetname] - end - - local target - if not targetname:find("%+") then - local files - if targetname:find("[?*]") then - error("wildcards not supported") - else - files = {targetname} - end - - target = { - outs = files, - is = { - __implicitfile = true - } - } - targets[targetname] = target - else - local _, _, filepart, targetpart = targetname:find("^([^+]*)%+([%w-_]+)$") - if not filepart or not targetpart then - error(string.format("malformed target name '%s'", targetname)) - end - if (filepart == "") then - filepart = cwd - end - loadbuildfilefor(filepart, targetpart) - - target = targets[targetname] - if not target then - error(string.format("build file '%s' contains no target '%s'", - filepart, targetpart)) - end - end - - return target -end - -local typeconverters = { - targets = function(propname, i) - if (type(i) == "string") then - i = {i} - elseif (type(i) ~= "table") then - error(string.format("property '%s' must be a target list", propname)) - end - - local m = {} - for k, v in pairs(i) do - local ts = targetsof(v) - if (type(k) == "number") then - for _, t in ipairs(ts) do - m[#m+1] = t - end - else - if (#ts ~= 1) then - error(string.format("named target '%s' can only be assigned from a single target", k)) - else - m[k] = ts[1] - end - end - end - return m - end, - - strings = function(propname, i) - if (type(i) == "string") then - i = {i} - elseif (type(i) ~= "table") then - error(string.format("property '%s' must be a string list", propname)) - end - return concat(i) - end, - - boolean = function(propname, i) - if (type(i) ~= "boolean") then - error(string.format("property '%s' must be a boolean", propname)) - end - return i - end, - - string = function(propname, i) - if (type(i) ~= "string") then - error(string.format("property '%s' must be a string", propname)) - end - return i - end, - - table = function(propname, i) - if (type(i) ~= "table") then - error(string.format("property '%s' must be a table", propname)) - end - return i - end, - - object = function(propname, i) - return i - end, -} - -local function definerule(rulename, types, cb) - if rulename and rules[rulename] then - error(string.format("rule '%s' is already defined", rulename)) - end - - types.name = { type="string" } - types.cwd = { type="string", optional=true } - types.vars = { type="table", default={} } - - for propname, typespec in pairs(types) do - if not typeconverters[typespec.type] then - error(string.format("property '%s' has unrecognised type '%s'", - propname, typespec.type)) - end - end - - local rulecwd = cwd - local rule = function(e) - local definedprops = {} - for propname, _ in pairs(e) do - definedprops[propname] = true - end - - local args = {} - for propname, typespec in pairs(types) do - if e[propname] == nil then - if not typespec.optional and (typespec.default == nil) then - error(string.format("missing mandatory property '%s'", propname)) - end - - args[propname] = typespec.default - else - args[propname] = typeconverters[typespec.type](propname, e[propname]) - definedprops[propname] = nil - end - end - - local propname, _ = next(definedprops) - if propname then - error(string.format("don't know what to do with property '%s'", propname)) - end - - if not args.cwd then - args.cwd = cwd - end - args.fullname = args.cwd.."+"..args.name - - local oldparente = parente - parente = args - args.vars = inherit(args.vars, oldparente.vars) - local result = cb(args) or {} - parente = oldparente - - result.is = result.is or {} - if rulename then - result.is[rulename] = true - end - result.fullname = args.fullname - - if targets[arg.fullname] and (targets[arg.fullname] ~= result) then - error(string.format("target '%s' is already defined", args.fullname)) - end - targets[result.fullname] = result - return result - end - - if rulename then - if rules[rulename] then - error(string.format("rule '%s' is already defined", rulename)) - end - rules[rulename] = rule - end - return rule -end - ------------------------------------------------------------------------------ --- DEFAULT RULES -- ------------------------------------------------------------------------------ - -local function install_make_emitter() - emit("hide = @\n") - - function emitter:var(name, value) - -- Don't let emit insert spaces. - emit(name.."="..value.."\n") - end - - function emitter:rule(name, ins, outs) - if (#outs == 0) then - local n = name.."-IMAGINARY-OUT" - emit(".INTERMEDIATE:", n, "\n") - outs = {n} - end - - local impl = name.."-IMPL" - emit(".INTERMEDIATE:", name, "\n") - emit(".INTERMEDIATE:", impl, "\n") - - for i = 1, #outs do - emit(name..":", outs[i], "\n") - end - for i = 1, #outs do - emit(outs[i]..":", impl, ";\n") - end - - for i = 1, #ins do - emit(impl..":", ins[i], "\n") - end - - emit(impl..":", "\n") - local dirs = uniquify(dirname(outs)) - if (#dirs > 0) then - emit("\t@mkdir -p", dirs, "\n") - end - end - - function emitter:phony(name, ins, outs) - emit(".PHONY:", name, "\n") - self:rule(name, ins, outs) - end - - function emitter:label(...) - local s = table.concat({...}, " ") - emit("\t@echo", s, "\n") - end - - function emitter:exec(commands) - for _, s in ipairs(commands) do - emit("\t$(hide)", s, "\n") - end - end - - function emitter:endrule() - emit("\n") - end -end - -local function install_ninja_emitter() - emit("rule build\n") - emit(" command = $command\n") - emit("\n") - - local function unmake(collection) - return dotocollection({collection}, - function(s) - return s:gsub("%$%b()", - function(expr) - return "${"..expr:sub(3, -2).."}" - end - ) - end - ) - end - - function emitter:var(name, value) - -- Don't let emit insert spaces. - emit(name.."="..unmake(value).."\n") - end - - function emitter:rule(name, ins, outs) - if (#outs == 0) then - emit("build", name, ": phony", unmake(ins), "\n") - else - emit("build", name, ": phony", unmake(outs), "\n") - emit("build", unmake(outs), ": build", unmake(ins), "\n") - end - end - - function emitter:label(...) - end - - function emitter:exec(commands) - emit(" command =", table.concat(unmake(commands), " && "), "\n") - end - - function emitter:endrule() - emit("\n") - end -end - -definerule("simplerule", - { - ins = { type="targets" }, - outs = { type="strings" }, - deps = { type="targets", default={} }, - label = { type="string", optional=true }, - commands = { type="strings" }, - vars = { type="table", default={} }, - }, - function (e) - emitter:rule(e.fullname, filenamesof(e.ins, e.deps), e.outs) - emitter:label(e.fullname, " ", e.label or "") - - local vars = inherit(e.vars, { - ins = filenamesof(e.ins), - outs = filenamesof(e.outs) - }) - - emitter:exec(templateexpand(e.commands, vars)) - emitter:endrule() - - return { - outs = e.outs - } - end -) - -definerule("installable", - { - map = { type="targets", default={} }, - deps = { type="targets", default={} }, - }, - function (e) - local deps = filenamesof(e.deps) - local commands = {} - local srcs = {} - local outs = {} - local dests = {} - for dest, src in pairs(e.map) do - if src.is.installable then - if (type(dest) ~= "number") then - error("can't specify a destination filename when installing an installable") - end - deps[#deps+1] = src.fullname - outs = concat(outs, filenamesof(src)) - elseif (type(dest) == "number") then - error("only references to other installables can be missing a destination") - else - local f = filenamesof(src) - if (#f ~= 1) then - error("installable can only cope with targets emitting single files") - end - - deps[#deps+1] = f - dests[#dests+1] = dest - outs[#outs+1] = dest - commands[#commands+1] = "cp "..f[1].." "..dest - end - end - - emitter:rule(e.fullname, deps, dests) - emitter:label(e.fullname, " ", e.label or "") - if (#commands > 0) then - emitter:exec(commands) - end - emitter:endrule() - - return { - outs = outs - } - end -) - ------------------------------------------------------------------------------ --- MAIN PROGRAM -- ------------------------------------------------------------------------------ - -local function parse_arguments(argmap, arg) - local i = 1 - local files = {} - - local function unrecognisedarg(arg) - argmap[" unrecognised"](arg) - end - - while (i <= #arg) do - local o = arg[i] - local op - - if (o:byte(1) == 45) then - -- This is an option. - if (o:byte(2) == 45) then - -- ...with a -- prefix. - o = o:sub(3) - local fn = argmap[o] - if not fn then - unrecognisedarg("--"..o) - end - i = i + fn(arg[i+1], arg[i+2]) - else - -- ...without a -- prefix. - local od = o:sub(2, 2) - local fn = argmap[od] - if not fn then - unrecognisedarg("-"..od) - end - op = o:sub(3) - if (op == "") then - i = i + fn(arg[i+1], arg[i+2]) - else - fn(op) - end - end - else - files[#files+1] = o - end - i = i + 1 - end - - argmap[" files"](files) -end - -globals = { - abspath = abspath, - asstring = asstring, - basename = basename, - concat = concat, - concatpath = concatpath, - cwd = function() return cwd end, - definerule = definerule, - dirname = dirname, - emit = emit, - filenamesof = filenamesof, - fpairs = fpairs, - include = loadbuildfile, - inherit = inherit, - print = print, - replace = replace, - matching = matching, - selectof = selectof, - startswith = startswith, - uniquify = uniquify, - vars = vars, -} -setmetatable(globals, - { - __index = function(self, k) - local rule = rules[k] - if rule then - return rule - else - return _G[k] - end - end - } -) - -vars.cflags = {} -parente.vars = vars - -setmetatable(_G, - { - __index = function(self, k) - local value = rawget(_G, k) - if not value then - error(string.format("access of undefined variable '%s'", k)) - end - return value - end - } -) - -do - local emitter_type = install_make_emitter - parse_arguments( - { - ["make"] = function() - emitter_type = install_make_emitter - return 0 - end, - - ["ninja"] = function() - emitter_type = install_ninja_emitter - return 0 - end, - - - [" unrecognised"] = function(arg) - error(string.format("unrecognised argument '%s'", arg)) - end, - - [" files"] = function(files) - emitter_type() - - for _, f in ipairs(files) do - local _, _, name, value = f:find("^([%w_]+)=(.*)$") - if name then - emitter:var(name, value) - end - end - - for _, f in ipairs(files) do - if not f:find("=") then - loadbuildfile(f) - end - end - end - }, - {...} - ) -end - diff --git a/first/ackbuilder.md b/first/ackbuilder.md deleted file mode 100644 index 27ca6d70b8..0000000000 --- a/first/ackbuilder.md +++ /dev/null @@ -1,351 +0,0 @@ -# ackbuilder - -## What is it? - -ackbuilder is a very small build tool inspired by [bazel](https://bazel.io/) -which uses either make or [ninja](https://ninja-build.org/) as a backend. - -It supports fully parallelisable builds (in both make and ninja), as well as -hopefully-robust support for rules which generate more than one output file, -which is something make is very, very bad at. - -It was written because the ACK is a really horribly complex thing to build and -there wasn't anything else. ackbuilder is pretty rough and ready but it does -sort of work. Be prepared for bugs. - -This document is a very rapid brain dump of how the build file works. It -doesn't cover actually running the tool (because that bit's pretty nasty) --- -go look at the top level Makefile to see that for now. - -## Basic concepts - -Complete example, using the built-in C rules. This should be saved in a file -called `build.lua`: - - cprogram { - name = 'prog', - srcs = { "./*.c" }, - } - -This defines a rule `prog` which, when built, compiles all the source files in -the same directory as the `build.lua` file into an executable. - -Slightly more complex example: - - clibrary { - name = "library", - srcs = { "./library.c" }, - hdrs = { "./library.h" }, - } - - cprogram { - name = 'prog2', - srcs = { "./prog2.c" }, - deps = { "+library" } - } - -If we move the library into another directory, we can invoke it like this: - - cprogram { - name = 'prog3', - srcs = { "./prog3.c" }, - deps = { "path/to/library+library" } - } - - * Targets starting with `./` are relative to **the current directory** (i.e. - the one the build file is in). - - * Targets starting with a path are relative to the top directory of the - project. - - * Targets containing a `+` refer to a named target in another build file. So, - on encountering the library in `prog3` above, ackbuilder will look for - `path/to/library/build.lua`, load it, and then try to find a target in it - called `library`. - -**Warning**: files are interpreted from top to bottom; every time a target -referring to another build file is seen for the first time, that file is -interpreted then and there. You can't have circular dependencies (these are -caught and an error is generated). You can't refer to a target defined below -you in the same source file (these are not caught, and just won't be found). - -Build files each get their own private global scope. If you randomly set a -variable, it won't be seen by other build files. (Use `vars` for that; see -below.) Build files are only loaded once. - -The `cprogram` and `clibrary` rules, by the way, are sophisticated enough to -automatically handle library and header paths. The exported headers by the -library are automatically imported into the program. - -## `simplerule` and `normalrule` - -These are the building blocks out of which all other rules are made. If you -want to run your own programs, you will be using these. - -`simplerule` is the simplest. You give it inputs, and outputs, and commands, -and it does it. - - simplerule { - name = 'sorted-input', - ins = { './input.txt' }, - outs = { './output.txt' }, - commands = { - "sort < %{ins} > %{outs}" - } - } - -In a command block, `%{...}` will evaluate the Lua expression between the -braces; various useful things are in scope, including the list of inputs and -outputs. - -However, this ends up leaving the output file lying around in the project -directory, which we don't want, so we usually use `normalrule` instead. -(`normalrule` is not strictly part of the ackbuilder core; it's in the standard -library along with `cprogram` and `clibrary`.) - - normalrule { - name = 'sorted-input', - ins = { './input.txt' }, - outleaves = { 'output.txt' }, - commands = { - "sort < %{ins} > %{outs}" - } - } - -Note `outleaves`; there is no `./`. This is a list of leaf filenames. The rule -will create a directory in the object tree and put the files specified in it, -somewhere; you don't care where. You can refer to the output file via the -target name, so: - - normalrule { - name = 'reversed', - ins = { '+sorted-input' }, - outleaves = { 'reversed.txt' }, - commands = { - "rev < %{ins} > %{outs}" - } - } - -One common use for this is to generate C header or source files. - - normalrule { - name = 'reversed_h', - ins = { '+reversed' }, - outleaves = { 'reversed.h' }, - commands = { - 'xxd -i %{ins} > %{outs}' - } - } - - cprogram { - name = 'prog', - srcs = { './*.c' }, - deps = { '+reversed_h' } - } - -Now you can refer to `reversed.h` in one of your C files and it'll just work -(`+reversed_h`'s output directory gets added to the include path -automatically). - -## Defining your own rules - -Like this: - - definerule("sort", - { - srcs = { type="targets" }, - }, - function(e) - return normalrule { - name = e.name, - ins = e.srcs, - outleaves = { 'sorted.txt' }, - commands = { - "sort < %{ins} > %{outs}" - } - } - } - ) - - sort { - name = 'sorted', - srcs = { './input.txt' } - } - -You give `definerule()` the name of the rule you want to define, a description -of the properties the rule will take, and a callback that does the work. - -You can do anything you like in the callback, including defining as many -targets as you like; but remember that all targets must have unique names, so -for any temporary files you probably want something like `name = -e.name.."/intermediate"` to ensure uniqueness. - -The callback should end by returning an invocation of another rule, with `name -= e.name` as above. - -Rules are defined whenever a build file containing them is seen. Letting this -happen automatically doesn't always work so you probably want to explicitly -include it: - - include("foo/bar/baz/build.lua") - -Rule properties are typed and can be specified to be required or optional (or -have a default value). If you try to invoke a rule with a property which isn't -declared, or missing a property which should be declared, you'll get an error. - - definerule("sort", - { - srcs = { type="targets" }, - numeric = { type="boolean", optional=true, default=false } - } - ...omitted... - -(The `optional=true` part can be omitted if you specify a default which isn't -`nil`.) - -Types include: - - * `targets`: the most common one. When the rule is invoked, ackbuilder will - resolve these for you so that when your callback fires, the property is a - flattened list of target objects. - - * `strings`: a Lua table of strings. If the invoker supplies a single string - which isn't a table, it'll get wrapped in one. - - * `string`: a string. - - * `boolean`: a boolean (either `true` or `false`; nothing else is allowed). - - * `table`: a Lua table. - - * `object`: any Lua value. - -## Target objects - -When a rule callback is run, any targets it needs will be resolved into target -objects. These are Lua objects with assorted useful stuff in them. - - * `object.is`: contains a set telling you which rules made the object. e.g. - `object.is.cprogram` is true if `object` was built with `cprogram`. Bear in - mind that `object.is.normalrule` is _also_ going to be true. - - * `object.dir`: the object's build directory. Only exists if the object was - built with `normalrule`. - -There are other properties (`fullname` and `outs`). Please don't use these; use -`targetnamesof()` and `filenamesof()` as described below. - -## The standard library - -Your build files are supplied a pile of useful functions. - -### Manipulating target lists - -A target list is a possibly nested set of tables containing either target -objects or strings. All of these functions will implicitly flatten the list and -resolve any strings into target objects before doing anything else to them. -Most of these functions can be supplied with varargs parameters. - -e.g. `targetsof(a, b)` is equivalent to `targetsof({a, b})` is equivalent to -`targetsof({a, {b}})`. - - * `targetsof(...)`: just flattens the list and resolves any string target - names. - - * `filenamesof(...)`: returns a list of output files for all the supplied - targets. - - * `targetnamesof(...)`: returns a list of fully qualified target names for - all the supplied stargets. - - * `selectof(targets, pattern)`: returns only those targets whose outputs - contain at least one file matching the pattern. - -### Manipulating filename lists - -Like the target list functions, all of these implicitly flatten any nested -tables. They all return lists; however, as a special exception, if any of the -functions which take varargs parameters have a single parameter which is a -string, they return just a string. - -e.g. `abspath({f})` returns a table; `abspath(f)` returns a string. - - * `abspath(...)`: attempts to return the absolute path of its arguments. This - isn't always possible due to variable references. - - * `basename(...)`: returns the basenames of its arguments (the file part of - the path). - - * `dirname(...)`: returns the directory name of its arguments. - - * `matching(files, pattern)`: returns only those files which match a Lua - pattern. - - * `replace(files, pattern, repl)`: performs a Lua pattern replace on the list - of files. - - * `uniquify(...)`: removes duplicates. - -### Other things - - * `include(file)`: loads another build file, if it hasn't been loaded before. - -## Variables - -There are two types of variable, mostly for hysterical reasons. - -### Makefile variables - -(Despite the name, these work on ninja too.) - -Filenames can contain variable references of the form `$(FOO)`. These are -expanded at build time based on definitions supplied on the ackbuilder command -line. - -ackbuilder assumes that these are absolute paths and won't attempt to -manipulate them much. - -I want to get rid of these at some point. - -### ackbuilder variables - -These are expanded by ackbuilder itself. - -Every rule invocation contains a magic property, `vars`. When a rule's commands -are executed, the variables provided in the template expansion are calculated -by combining all `vars` settings in the call stack (including the top level -build file). - -Easiest to explain with an example: - - cprogram { - name = 'another_test', - srcs = { './*.c' }, - vars = { - cflags = { '-g', '-O3' } - } - } - -When `cprogram` builds each C file, the command will refer to `%{cflags}`. The -value above will be flattened into a space-separated string and substituted in. - -Setting a variable this way will _override_ any definition further up the call -stack. However, you can do this: - - vars.cflags = { '-g' } - - cprogram { - name = 'another_test', - srcs = { './*.c' }, - vars = { - ["+cflags"] = { '-O3' } - } - } - -Now `cflags` will default to `-g` everywhere, because it's set at the top -level; but when `another_test` is built, it'll be `-g -O3`. - -ackbuilder variables are only expanded in command templates, not in filenames. - - - diff --git a/first/bison.lua b/first/bison.lua deleted file mode 100644 index b55ccef8e3..0000000000 --- a/first/bison.lua +++ /dev/null @@ -1,44 +0,0 @@ -definerule("bison", - { - srcs = { type="targets" }, - commands = { - type="strings", - default={ - "bison -t -b %{dir}/y -d %{ins}" - } - }, - }, - function (e) - return normalrule { - name = e.name, - cwd = e.cwd, - ins = e.srcs, - outleaves = { "y.tab.c", "y.tab.h" }, - label = e.label, - commands = e.commands, - } - end -) - -definerule("flex", - { - srcs = { type="targets" }, - commands = { - type="strings", - default={ - "flex -s -t %{ins} > %{outs[1]}" - } - } - }, - function (e) - return normalrule { - name = e.name, - cwd = e.cwd, - ins = e.srcs, - outleaves = { "lex.yy.c" }, - label = e.label, - commands = e.commands - } - end -) - diff --git a/first/build.lua b/first/build.lua deleted file mode 100644 index 5f514c5931..0000000000 --- a/first/build.lua +++ /dev/null @@ -1,263 +0,0 @@ -local function objdir(e) - return concatpath("$(OBJDIR)", e.cwd, e.name) -end - -definerule("normalrule", - { - ins = { type="targets" }, - deps = { type="targets", default={} }, - outleaves = { type="strings" }, - label = { type="string", optional=true }, - objdir = { type="string", optional=true }, - commands = { type="strings" }, - }, - function (e) - local dir = e.objdir or objdir(e) - local realouts = {} - for _, v in pairs(e.outleaves) do - realouts[#realouts+1] = concatpath(dir, v) - end - - local vars = inherit(e.vars, { - dir = dir - }) - - local result = simplerule { - name = e.name, - ins = e.ins, - deps = e.deps, - outs = realouts, - label = e.label, - commands = e.commands, - vars = vars, - } - result.dir = dir - return result - end -) - -definerule("cfile", - { - srcs = { type="targets" }, - deps = { type="targets", default={} }, - suffix = { type="string", default=".o" }, - commands = { - type="strings", - default={ - "$(CC) -c -o %{outs[1]} %{ins[1]} %{hdrpaths} %{cflags}" - }, - } - }, - function (e) - local hdrpaths = {} - for _, t in pairs(e.deps) do - if t.dir then - hdrpaths[#hdrpaths+1] = "-I"..t.dir - end - end - hdrpaths = uniquify(hdrpaths) - - local outleaf = basename(e.name)..e.suffix - - return normalrule { - name = e.name, - cwd = e.cwd, - ins = e.srcs, - deps = e.deps, - outleaves = {outleaf}, - label = e.label, - commands = e.commands, - vars = { - hdrpaths = hdrpaths, - } - } - end -) - -definerule("cppfile", - { - srcs = { type="targets" }, - deps = { type="targets", default={} }, - outleaf = { type="string" }, - commands = { - type="strings", - default={ - "$(CC) -E -P -o %{outs[1]} %{hdrpaths} %{cflags} -x c %{ins}" - } - }, - }, - function (e) - if (#e.srcs ~= 1) then - error("you must have exactly one input file") - end - - local hdrpaths = {} - for _, t in pairs(e.deps) do - if t.dir then - hdrpaths[#hdrpaths+1] = "-I"..t.dir - end - end - hdrpaths = uniquify(hdrpaths) - - return normalrule { - name = e.name, - cwd = e.cwd, - ins = e.srcs, - deps = e.deps, - outleaves = {e.outleaf}, - label = e.label, - commands = e.commands, - vars = { - hdrpaths = hdrpaths, - } - } - end -) - -definerule("bundle", - { - srcs = { type="targets" }, - commands = { - type="strings", - default={ - "tar cf - %{ins} | (cd %{dir} && tar xf -)" - } - } - }, - function (e) - local outleaves = {} - local commands = {} - for _, f in fpairs(e.srcs) do - local localf = basename(f) - outleaves[#outleaves+1] = localf - commands[#commands+1] = "cp "..f.." %{dir}/"..localf - end - - return normalrule { - name = e.name, - cwd = e.cwd, - ins = e.srcs, - outleaves = outleaves, - label = e.label, - commands = commands - } - end -) - -definerule("clibrary", - { - srcs = { type="targets", default={} }, - hdrs = { type="targets", default={} }, - deps = { type="targets", default={} }, - _cfile = { type="object", default=cfile }, - suffix = { type="string", default=".o" }, - commands = { - type="strings", - default={ - "rm -f %{outs[1]}", - "$(AR) cqs %{outs[1]} %{ins}", - }, - } - }, - function (e) - local ins = {} - for _, src in fpairs(e.srcs) do - local n = basename(src):gsub("%.%w*$", "") - ins[#ins+1] = e._cfile { - name = e.name.."/"..n, - cwd = e.cwd, - srcs = {src}, - deps = e.deps, - suffix = e.suffix, - vars = { - ["+cflags"] = { "-I"..e.cwd, }, - }, - } - end - - local commands = {} - local outleaves = {} - if (#e.srcs > 0) then - for _, s in ipairs(e.commands) do - commands[#commands+1] = s - end - outleaves[#outleaves+1] = e.name..".a" - end - - local hdrsin = {} - for dest, src in pairs(e.hdrs) do - if (type(dest) == "number") then - for _, f in ipairs(filenamesof(src)) do - hdrsin[#hdrsin+1] = f - outleaves[#outleaves+1] = basename(f) - commands[#commands+1] = "cp "..asstring(f).." %{dir}" - end - else - local fs = filenamesof(src) - if (#fs ~= 1) then - error(string.format("keyed header '%s' can only be a single file", dest)) - end - local f = fs[1] - - hdrsin[#hdrsin+1] = f - outleaves[#outleaves+1] = dest - commands[#commands+1] = "cp "..asstring(f).." %{dir}/"..dest - end - end - - return normalrule { - name = e.name, - cwd = e.cwd, - ins = ins, - deps = {hdrsin, e.deps}, - outleaves = outleaves, - label = e.label, - commands = commands, - } - end -) - -definerule("cprogram", - { - srcs = { type="targets", default={} }, - deps = { type="targets", default={} }, - _clibrary = { type="object", default=clibrary }, - commands = { - type="strings", - default={ - "$(CC) $(LDFLAGS) -o %{outs[1]} %{ins} %{ins}" - }, - } - }, - function (e) - local libs = matching(filenamesof(e.deps), "%.a$") - local srcs = {} - if (#e.srcs > 0) then - for _, f in pairs( - matching( - filenamesof( - e._clibrary { - name = e.name .. "/main", - cwd = e.cwd, - srcs = e.srcs, - deps = e.deps, - } - ), - "%.a$" - ) - ) do - srcs[#srcs+1] = f - end - end - - return normalrule { - name = e.name, - cwd = e.cwd, - deps = e.deps, - ins = { srcs, libs }, - outleaves = { e.name }, - commands = e.commands, - } - end -) - diff --git a/first/testsummary.sh b/first/testsummary.sh deleted file mode 100755 index 20cdc66ae4..0000000000 --- a/first/testsummary.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -echo "" - -if [ "$1" = "" ]; then - echo "No tests." - exit 0 -fi - -succeeding="$(find "$@" -size 0)" -notsucceeding="$(find "$@" ! -size 0)" -if [ "$notsucceeding" != "" ]; then - skipped="$(grep -l @@SKIPPED $notsucceeding)" - timedout="$(grep -l @@TIMEDOUT $notsucceeding)" - failed="$(grep -l @@FAIL $notsucceeding)" -else - skipped= - timedout= - failed= -fi - -for a in $failed $timedout; do - echo "**** $a" - cat $a - echo "" -done - -echo "$(echo "$succeeding" | wc -w) tests passed" -echo "$(echo "$notsucceeding" | wc -w) tests failed to pass" -echo "$(echo "$skipped" | wc -w) were skipped (see build log for details)" -echo "$(echo "$timedout" | wc -w) timed out" -echo "$(echo "$failed" | wc -w) failed" -echo "" - -if [ "$failed" != "" ]; then - echo "Failing test logs:" - for t in $failed; do - echo $t - done -fi -if [ "$timedout" != "" ]; then - echo "Timed-out test logs:" - for t in $timedout; do - echo $t - done -fi -if [ "$failed" != "" -o "$timedout" != "" ]; then - echo "Test status: SAD FACE (tests are failing)" - exit 1 -fi -if [ "$succeeding" = "" ]; then - echo "Test status: PUZZLED FACE (all tests were skipped)" - exit 0 -fi -if [ "$skipped" != "" ]; then - echo "Test status: MILDLY PLEASED FACE (some tests were skipped, but the rest pass)" - exit 0 -fi -echo "Test status: HAPPY FACE (all tests are passing)" -exit 0 - diff --git a/h/build.lua b/h/build.lua deleted file mode 100644 index 93b1715d8b..0000000000 --- a/h/build.lua +++ /dev/null @@ -1,48 +0,0 @@ -normalrule { - name = "em_path", - ins = {}, - outleaves = { "em_path.h" }, - commands = { - "echo '#define EM_DIR \"$(PREFIX)\"' > %{outs}", - "echo '#define ACK_PATH \"share/ack/descr\"' >> %{outs}", - } -} - -normalrule { - name = "local", - ins = {}, - outleaves = { "local.h" }, - commands = { - "echo '#define VERSION 3' > %{outs}", - "echo '#define ACKM \"$(DEFAULT_PLATFORM)\"' >> %{outs}", - "echo '#define BIGMACHINE 1' >> %{outs}", - "echo '#define SYS_5' >> %{outs}", - } -} - -clibrary { - name = "emheaders", - hdrs = { - "./arch.h", - "./as_spec.h", - "./cgg_cg.h", - "./cg_pattern.h", - "./em_abs.h", - "./em_ego.h", - "./em_flag.h", - "./em_mes.h", - "./em_ptyp.h", - "./em_reg.h", - "./ip_spec.h", - "./ocm_chan.h", - "./ocm_parco.h", - "./ocm_proc.h", - "./out.h", - "./ranlib.h", - "./stb.h", - "./con_float", - "+em_path", - "+local", - } -} - diff --git a/lang/basic/lib/build.lua b/lang/basic/lib/build.lua deleted file mode 100644 index d48879f753..0000000000 --- a/lang/basic/lib/build.lua +++ /dev/null @@ -1,59 +0,0 @@ -include("plat/build.lua") - -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./abs.c", - "./asc.c", - "./asrt.c", - "./atn.c", - "./chr.c", - "./conversion.c", - "./error.c", - "./exp.c", - "./file.c", - "./hlt.c", - "./io.c", - "./log.c", - "./mki.c", - "./oct.c", - "./peek.c", - "./power.c", - "./print.c", - "./random.c", - "./read.c", - "./return.c", - "./salloc.c", - "./sgn.c", - "./sin.c", - "./sqt.c", - "./stop.c", - "./string.c", - "./swap.c", - "./trace.c", - "./trap.c", - "./write.c", - "./fef.e", - "./fif.e", - "./setline.e", - }, - hdrs = {}, -- must be empty - deps = { - "h+emheaders", - "lang/cem/libcc.ansi/headers+pkg", - "plat/"..plat.."/include+pkg", - "./bc_io.h", - "./lib.h", - }, - vars = { plat = plat } - } - - installable { - name = "pkg_"..plat, - map = { - ["$(PLATIND)/"..plat.."/libbasic.a"] = "+lib_"..plat, - } - } -end - diff --git a/lang/basic/src/build.lua b/lang/basic/src/build.lua deleted file mode 100644 index 4d88da3ebb..0000000000 --- a/lang/basic/src/build.lua +++ /dev/null @@ -1,66 +0,0 @@ -include("util/LLgen/build.lua") - -llgen { - name = "llgen", - srcs = { "./basic.g" } -} - -normalrule { - name = "tokentab_h", - ins = { - "./maketokentab", - matching(filenamesof("+llgen"), "/Lpars.h$"), - }, - outleaves = { "tokentab.h" }, - commands = { - "%{ins[1]} < %{ins[2]} > %{outs}" - } -} - -cprogram { - name = "em_bem", - srcs = { - "./bem.c", - "./compile.c", - "./eval.c", - "./func.c", - "./gencode.c", - "./graph.c", - "./initialize.c", - "./parsepar.c", - "./symbols.c", - "./util.c", - matching(filenamesof("+llgen"), "%.c$"), - }, - deps = { - "./bem.h", - "./eval.h", - "./func.h", - "./gencode.h", - "./graph.h", - "./llmess.h", - "./parsepar.h", - "./symbols.h", - "./util.h", - "./yylexp.h", - "./basic.lex", - "+llgen", - "+tokentab_h", - "h+emheaders", - "modules+headers", - "modules/src/alloc+lib", - "modules/src/em_code+lib_k", - "modules/src/em_data+lib", - "modules/src/em_mes+lib", - "modules/src/string+lib", - "modules/src/system+lib", - } -} - -installable { - name = "pkg", - map = { - ["$(PLATDEP)/em_bem"] = "+em_bem" - } -} - diff --git a/lang/build.lua b/lang/build.lua deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lang/cem/cemcom.ansi/build.lua b/lang/cem/cemcom.ansi/build.lua deleted file mode 100644 index 4d941cc880..0000000000 --- a/lang/cem/cemcom.ansi/build.lua +++ /dev/null @@ -1,194 +0,0 @@ -include("util/LLgen/build.lua") -include("util/cmisc/build.lua") - -normalrule { - name = "parameters", - ins = { "./BigPars" }, - outleaves = { "parameters.h" }, - commands = { - "echo '#ifndef PARAMETERS_H' > %{outs}", - "echo '#define PARAMETERS_H' >> %{outs}", - "grep -v '^!' < %{ins} >> %{outs}", - "echo '#endif' >> %{outs}" - } -} - -local str_files = { - "./code.str", - "./declar.str", - "./def.str", - "./estack.str", - "./expr.str", - "./field.str", - "./idf.str", - "./l_brace.str", - "./l_outdef.str", - "./l_state.str", - "./macro.str", - "./next.str", - "./proto.str", - "./stack.str", - "./stmt.str", - "./struct.str", - "./switch.str", - "./type.str", - "./util.str" -} - -local str_bases = basename(filenamesof(str_files)) - -local str_targets = {} - -for _, f in ipairs(str_bases) do - local bf = f:gsub("%.str$", ""):gsub("^$./", "") - str_targets[#str_targets+1] = normalrule { - name = "allocd_header/"..bf, - ins = { "./make.allocd", "./"..f }, - outleaves = { bf..".h" }, - commands = { - "%{ins[1]} < %{ins[2]} > %{outs}" - } - } -end - -normalrule { - name = "next-c", - ins = { - "./make.next", - str_files - }, - outleaves = { "next.c" }, - commands = { - "%{ins} > %{outs[1]}" - } -} - -clibrary { - name = "nextlib", - srcs = { "+next-c" }, - hdrs = str_targets, - deps = { - "+parameters", - str_targets - } -} - -normalrule { - name = "tokenfile-g", - ins = { - "./make.tokfile", - "./tokenname.c", - }, - outleaves = { "tokenfile.g" }, - commands = { - "sh %{ins[1]} < %{ins[2]} > %{outs}", - } -} - -normalrule { - name = "symbol2str-c", - ins = { - "./make.tokcase", - "./tokenname.c", - }, - outleaves = { "symbol2str.c" }, - commands = { - "sh %{ins[1]} < %{ins[2]} > %{outs}", - } -} - -llgen { - name = "llgen", - srcs = { - "+tokenfile-g", -- must be first - "./declar.g", - "./expression.g", - "./ival.g", - "./program.g", - "./statement.g", - }, -} - -tabgen { - name = "tabgen", - srcs = { "./char.tab" } -} - -cprogram { - name = "cemcom", - srcs = { - "./LLlex.c", - "./LLmessage.c", - "./arith.c", - "./blocks.c", - "./ch3.c", - "./ch3bin.c", - "./ch3mon.c", - "./code.c", - "./conversion.c", - "./cstoper.c", - "./dataflow.c", - "./declarator.c", - "./decspecs.c", - "./domacro.c", - "./dumpidf.c", - "./error.c", - "./eval.c", - "./expr.c", - "./field.c", - "./fltcstoper.c", - "./idf.c", - "./input.c", - "./l_comment.c", - "./l_ev_ord.c", - "./l_lint.c", - "./l_misc.c", - "./l_outdef.c", - "./l_states.c", - "./label.c", - "./main.c", - "./options.c", - "./pragma.c", - "./proto.c", - "./skip.c", - "./stab.c", - "./stack.c", - "./struct.c", - "./switch.c", - "./tokenname.c", - "./type.c", - "./util.c", - "+symbol2str-c", - "+tabgen", - matching(filenamesof("+llgen"), "%.c$"), - }, - deps = { - "./LLlex.h", "./align.h", "./arith.h", "./atw.h", - "./class.h", "./decspecs.h", "./file_info.h", - "./input.h", "./interface.h", "./l_class.h", - "./l_comment.h", "./l_em.h", "./l_lint.h", - "./label.h", "./level.h", "./mes.h", "./sizes.h", - "./specials.h", "./tokenname.h", - "+llgen", - "+nextlib", - "+parameters", - "h+emheaders", - "modules+headers", - "modules/src/alloc+lib", - "modules/src/em_code+lib_k", - "modules/src/em_data+lib", - "modules/src/em_mes+lib", - "modules/src/flt_arith+lib", - "modules/src/idf+lib", - "modules/src/input+lib", - "modules/src/string+lib", - "modules/src/system+lib", - }, -} - -installable { - name = "pkg", - map = { - ["$(PLATDEP)/em_cemcom.ansi"] = "+cemcom" - } -} diff --git a/lang/cem/cpp.ansi/build.lua b/lang/cem/cpp.ansi/build.lua deleted file mode 100644 index 1c4050b428..0000000000 --- a/lang/cem/cpp.ansi/build.lua +++ /dev/null @@ -1,130 +0,0 @@ -include("util/cmisc/build.lua") -include("util/LLgen/build.lua") - -local allocd_header = definerule(nil, - { - srcs = { type="targets" } - }, - function (e) - return normalrule { - name = e.name, - ins = { - "./make.allocd", - e.srcs - }, - outleaves = basename(filenamesof(e.srcs)[1]):gsub("%.str$", ".h"), - commands = { - "%{ins[1]} < %{ins[2]} > %{outs}" - } - } - end -) - -allocd_header { - name = "macro_h", - srcs = { "./macro.str" } -} - -allocd_header { - name = "replace_h", - srcs = { "./replace.str" } -} - -normalrule { - name = "tokenfile_g", - ins = { - "./make.tokfile", - "./tokenname.c", - }, - outleaves = { "tokenfile.g" }, - commands = { - "sh %{ins[1]} < %{ins[2]} > %{outs}" - } -} - -normalrule { - name = "symbol2str_c", - ins = { - "./make.tokcase", - "./tokenname.c", - }, - outleaves = { "symbol2str.c" }, - commands = { - "sh %{ins[1]} < %{ins[2]} > %{outs}" - } -} - -normalrule { - name = "next_c", - ins = { - "./make.next", - "./macro.str", - "./replace.str", - }, - outleaves = { "next.c" }, - commands = { - "sh %{ins} > %{outs}" - } -} - -local llgen = llgen { - name = "llgen", - srcs = { - "+tokenfile_g", - "./expression.g" - } -} - -tabgen { - name = "tabgen_c", - srcs = { "./char.tab" } -} - -cprogram { - name = "cpp", - srcs = concat( - "./ch3bin.c", - "./ch3mon.c", - "./domacro.c", - "./error.c", - "./expr.c", - "./idf.c", - "./init.c", - "./input.c", - "./LLlex.c", - "./LLmessage.c", - "./main.c", - "./options.c", - "./preprocess.c", - "./replace.c", - "./skip.c", - "./tokenname.c", - matching(filenamesof(llgen), "%.c$"), - "+next_c", - "+symbol2str_c", - "+tabgen_c" - ), - deps = { - "./LLlex.h", "./arith.h", "./bits.h", "./class.h", - "./file_info.h", "./idf.h", "./input.h", - "./parameters.h", - "+llgen", - "+macro_h", - "+replace_h", - "modules+headers", - "modules/src/alloc+lib", - "modules/src/idf+lib", - "modules/src/input+lib", - "modules/src/string+lib", - "modules/src/system+lib", - } -} - -installable { - name = "pkg", - map = { - ["$(PLATDEP)/cpp.ansi"] = "+cpp", - ["$(INSDIR)/share/man/man6/cpp.ansi.6"] = "./ncpp.6", - } -} - diff --git a/lang/cem/libcc.ansi/build.lua b/lang/cem/libcc.ansi/build.lua deleted file mode 100644 index 7b38d82e5c..0000000000 --- a/lang/cem/libcc.ansi/build.lua +++ /dev/null @@ -1,225 +0,0 @@ -include("plat/build.lua") - -tabgen { - name = "ctype_tab", - srcs = { "./core/ctype/char.tab" } -} - -normalrule { - name = "ctype_files", - ins = { "./core/ctype/genfiles" }, - outleaves = { - "isalnum.c", - "isalpha.c", - "isascii.c", - "iscntrl.c", - "isdigit.c", - "isgraph.c", - "islower.c", - "isprint.c", - "ispunct.c", - "isspace.c", - "isupper.c", - "isxdigit.c", - }, - commands = { - "sh %{ins[1]} %{dir}" - } -} - -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "+ctype_files", - "+ctype_tab", - "./core/ctype/tolower.c", - "./core/ctype/toupper.c", - "./core/errno/errlist.c", - "./core/errno/perror.c", - "./core/errno/strerror.c", - "./core/locale/localeconv.c", - "./core/locale/setlocale.c", - "./core/math/asin.c", - "./core/math/atan2.c", - "./core/math/atan.c", - "./core/math/ceil.c", - "./core/math/exp.c", - "./core/math/fabs.c", - "./core/math/floor.c", - "./core/math/fmod.c", - "./core/math/frexp.e", - "./core/math/hugeval.c", - "./core/math/hypot.c", - "./core/math/isnan.c", - "./core/math/ldexp.c", - "./core/math/log10.c", - "./core/math/log.c", - "./core/math/modf.e", - "./core/math/pow.c", - "./core/math/sin.c", - "./core/math/sinh.c", - "./core/math/sqrt.c", - "./core/math/tan.c", - "./core/math/tanh.c", - "./core/misc/abort.c", - "./core/misc/assert.c", - "./core/misc/getopt.c", - "./core/misc/raise.c", - "./core/misc/termcap.c", - "./core/printf/doprnt.c", - "./core/printf/fltpr.c", - "./core/printf/fprintf.c", - "./core/printf/icompute.c", - "./core/printf/itoa.c", - "./core/printf/printf.c", - "./core/printf/snprintf.c", - "./core/printf/sprintf.c", - "./core/printf/vfprintf.c", - "./core/printf/vprintf.c", - "./core/printf/vsnprintf.c", - "./core/printf/vsprintf.c", - "./core/scanf/doscan.c", - "./core/scanf/fscanf.c", - "./core/scanf/scanf.c", - "./core/scanf/sscanf.c", - "./core/scanf/vfscanf.c", - "./core/setjmp/setjmp.e", - "./core/setjmp/sigmisc.c", - "./core/stdio/clearerr.c", - "./core/stdio/feof.c", - "./core/stdio/ferror.c", - "./core/stdio/fgetc.c", - "./core/stdio/fgetpos.c", - "./core/stdio/fgets.c", - "./core/stdio/fputc.c", - "./core/stdio/fputs.c", - "./core/stdio/fread.c", - "./core/stdio/fsetpos.c", - "./core/stdio/fwrite.c", - "./core/stdio/getc.c", - "./core/stdio/getchar.c", - "./core/stdio/gets.c", - "./core/stdio/getw.c", - "./core/stdio/putc.c", - "./core/stdio/putchar.c", - "./core/stdio/puts.c", - "./core/stdio/putw.c", - "./core/stdio/rewind.c", - "./core/stdlib/abs.c", - "./core/stdlib/atof.c", - "./core/stdlib/atoi.c", - "./core/stdlib/atol.c", - "./core/stdlib/bsearch.c", - "./core/stdlib/div.c", - "./core/stdlib/ecvt.c", - "./core/stdlib/environ.c", - "./core/stdlib/ext_comp.c", - "./core/stdlib/getenv.c", - "./core/stdlib/labs.c", - "./core/stdlib/ldiv.c", - "./core/stdlib/mblen.c", - "./core/stdlib/mbstowcs.c", - "./core/stdlib/mbtowc.c", - "./core/stdlib/putenv.c", - "./core/stdlib/qsort.c", - "./core/stdlib/rand.c", - "./core/stdlib/setenv.c", - "./core/stdlib/strtod.c", - "./core/stdlib/strtol.c", - "./core/stdlib/wcstombs.c", - "./core/stdlib/wctomb.c", - "./core/string/memchr.c", - "./core/string/memcmp.c", - "./core/string/memcpy.c", - "./core/string/memmove.c", - "./core/string/memset.c", - "./core/string/strcat.c", - "./core/string/strchr.c", - "./core/string/strcmp.c", - "./core/string/strcoll.c", - "./core/string/strcpy.c", - "./core/string/strcspn.c", - "./core/string/strdup.c", - "./core/string/strlen.c", - "./core/string/strncat.c", - "./core/string/strncmp.c", - "./core/string/strncpy.c", - "./core/string/strpbrk.c", - "./core/string/strrchr.c", - "./core/string/strspn.c", - "./core/string/strstr.c", - "./core/string/strtok.c", - "./core/string/strxfrm.c", - "./core/time/asctime.c", - "./core/time/ctime.c", - "./core/time/difftime.c", - "./core/time/gmtime.c", - "./core/time/localtime.c", - "./core/time/misc.c", - "./core/time/mktime.c", - "./core/time/strftime.c", - "./core/time/tzset.c", - "./sys/exit/atexit.c", - "./sys/exit/exit.c", - "./sys/malloc/calloc.c", - "./sys/malloc/malloc.c", - "./sys/malloc/realloc.c", - "./sys/misc/clock.c", - "./sys/misc/getpass.c", - "./sys/misc/isatty.c", - "./sys/misc/mktemp.c", - "./sys/misc/popen.c", - "./sys/misc/remove.c", - "./sys/misc/sleep.c", - "./sys/misc/system.c", - "./sys/misc/time.c", - "./sys/stdio/data.c", - "./sys/stdio/fclose.c", - "./sys/stdio/fdopen.c", - "./sys/stdio/fflush.c", - "./sys/stdio/fileno.c", - "./sys/stdio/fillbuf.c", - "./sys/stdio/flushbuf.c", - "./sys/stdio/fopen.c", - "./sys/stdio/freopen.c", - "./sys/stdio/fseek.c", - "./sys/stdio/ftell.c", - "./sys/stdio/setbuf.c", - "./sys/stdio/setvbuf.c", - "./sys/stdio/tmpfile.c", - "./sys/stdio/tmpnam.c", - "./sys/stdio/ungetc.c", - }, - hdrs = {}, -- must be empty - deps = { - "lang/cem/libcc.ansi/headers+pkg", - "plat/"..plat.."/include+pkg", - "./core/math/localmath.h", - "./core/stdlib/ext_fmt.h", - "./core/time/loc_time.h", - "./sys/malloc/malloc.h", - }, - vars = { plat = plat } - } - - ackfile { - name = "crt_"..plat, - srcs = { "./head_ac.e" }, - vars = { plat = plat }, - deps = { - "h+emheaders" - } - } - - local suffix = plat:find("^em") and "m" or "o" - installable { - name = "pkg_"..plat, - map = { - "lang/cem/libcc.ansi/headers+pkg", - ["$(PLATIND)/"..plat.."/c-ansi."..suffix] = "+crt_"..plat, - ["$(PLATIND)/"..plat.."/libc.a"] = "+lib_"..plat, - } - } -end - diff --git a/lang/cem/libcc.ansi/headers/build.lua b/lang/cem/libcc.ansi/headers/build.lua deleted file mode 100644 index 99c4162eb2..0000000000 --- a/lang/cem/libcc.ansi/headers/build.lua +++ /dev/null @@ -1,55 +0,0 @@ -include("plat/build.lua") - -local headers = {} -local installmap = {} - -local function addheader(dir, list) - for _, f in ipairs(list) do - local b = basename(f) - headers[dir..b] = f - installmap[concatpath("$(PLATIND)/include/ansi/", dir, b)] = f - end -end - -addheader("", filenamesof( - "./assert.h", - "./ctype.h", - "./errno.h", - "./fcntl.h", - "./float.h", - "./iso646.h", - "./limits.h", - "./locale.h", - "./math.h", - "./setjmp.h", - "./signal.h", - "./stdarg.h", - "./stdbool.h", - "./stddef.h", - "./stdint.h", - "./stdio.h", - "./stdlib.h", - "./string.h", - "./time.h", - "./unistd.h" - )) - -addheader("sys/", filenamesof( - "./sys/time.h", - "./sys/times.h" - )) - -addheader("ack/", filenamesof( - "./ack/config.h", - "./ack/emufile.h" - )) - -acklibrary { - name = "headers", - hdrs = headers -} - -installable { - name = "pkg", - map = installmap -} diff --git a/lang/m2/comp/build.lua b/lang/m2/comp/build.lua deleted file mode 100644 index 1dd19beeb8..0000000000 --- a/lang/m2/comp/build.lua +++ /dev/null @@ -1,123 +0,0 @@ -normalrule { - name = "tokenfile_g", - ins = { - "./make.tokfile", - "./tokenname.c" - }, - outleaves = { "tokenfile.g" }, - commands = { - "sh %{ins[1]} < %{ins[2]} > %{outs}" - } -} - -llgen { - name = "llgen", - srcs = { - -- order here is important - "+tokenfile_g", - "./declar.g", - "./expression.g", - "./program.g", - "./statement.g", - } -} - -normalrule { - name = "parameters_h", - ins = { - "./make.parameters", - "./BigPars", - }, - outleaves = { "parameters.h" }, - commands = { - "sh %{ins[1]} < %{ins[2]} > %{outs}" - } -} - -normalrule { - name = "next_c", - ins = { - "./make.next", - }, - outleaves = { "next.c" }, - commands = { - "sh %{ins} > %{outs}" - } -} - -normalrule { - name = "symbol2str_c", - ins = { - "./make.tokcase", - "./tokenname.c", - }, - outleaves = { "symbol2str.c" }, - commands = { - "%{ins[1]} < %{ins[2]} > %{outs}" - } -} - -tabgen { - name = "chartab_c", - srcs = { "./char.tab" }, -} - -cprogram { - name = "em_m2", - srcs = { - "+chartab_c", - "+next_c", - "+symbol2str_c", - "./LLlex.c", - "./LLmessage.c", - "./casestat.c", - "./chk_expr.c", - "./code.c", - "./cstoper.c", - "./def.c", - "./defmodule.c", - "./desig.c", - "./enter.c", - "./error.c", - "./idf.c", - "./input.c", - "./lookup.c", - "./main.c", - "./misc.c", - "./node.c", - "./options.c", - "./scope.c", - "./stab.c", - "./tmpvar.c", - "./tokenname.c", - "./type.c", - "./typequiv.c", - "./walk.c", - matching(filenamesof("+llgen"), "%.c$"), - }, - deps = { - "+llgen", - "+parameters_h", - "h+emheaders", - "lang/m2/include+headers", - "modules+headers", - "modules/src/alloc+lib", - "modules/src/data+lib", - "modules/src/em_code+lib_k", - "modules/src/em_data+lib", - "modules/src/em_mes+lib", - "modules/src/flt_arith+lib", - "modules/src/idf+lib", - "modules/src/input+lib", - "modules/src/string+lib", - "modules/src/system+lib", - } -} - -installable { - name = "pkg", - map = { - ["$(PLATDEP)/em_m2"] = "+em_m2", - ["$(INSDIR)/share/man/man6/em_m2.6"] = "./em_m2.6" - } -} diff --git a/lang/m2/include/build.lua b/lang/m2/include/build.lua deleted file mode 100644 index 096e9441c9..0000000000 --- a/lang/m2/include/build.lua +++ /dev/null @@ -1,7 +0,0 @@ -clibrary { - name = "headers", - hdrs = { - "./libm2.h", - "./m2_traps.h", - } -} diff --git a/lang/m2/libm2/build.lua b/lang/m2/libm2/build.lua deleted file mode 100644 index 90bad0f4c2..0000000000 --- a/lang/m2/libm2/build.lua +++ /dev/null @@ -1,126 +0,0 @@ -include("plat/build.lua") - -local installmap = {} - -local function addheader(dir, list) - for _, f in ipairs(list) do - local b = basename(f) - installmap[concatpath("$(PLATIND)/include/modula2/", dir, b)] = f - end -end - -addheader("", filenamesof( - "./Arguments.def", - "./ArraySort.def", - "./ASCII.def", - "./Conversions.def", - "./CSP.def", - "./EM.def", - "./Epilogue.def", - "./InOut.def", - "./MathLib0.def", - "./Mathlib.def", - "./PascalIO.def", - "./Processes.def", - "./random.def", - "./RealConversions.def", - "./RealInOut.def", - "./Semaphores.def", - "./Storage.def", - "./Streams.def", - "./Strings.def", - "./StripUnix.def", - "./Termcap.def", - "./Terminal.def", - "./Traps.def", - "./Unix.def", - "./XXTermcap.def" - )) - - -installable { - name = "headers", - map = installmap -} - -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./absd.c", - "./absi.c", - "./absl.c", - "./Arguments.c", - "./ArraySort.mod", - "./blockmove.c", - "./cap.c", - "./catch.c", - "./confarray.c", - "./Conversions.mod", - "./CSP.mod", - "./dvi.c", - "./halt.c", - "./init.c", - "./InOut.mod", - "./load.c", - "./MathLib0.mod", - "./Mathlib.mod", - "./PascalIO.mod", - "./Processes.mod", - "./random.mod", - "./rcka.c", - "./rcki.c", - "./rckil.c", - "./rcku.c", - "./rckul.c", - "./RealConversions.mod", - "./RealInOut.mod", - "./Semaphores.mod", - "./sigtrp.c", - "./stackprio.c", - "./Storage.mod", - "./store.c", - "./StrAss.c", - "./Streams.mod", - "./Strings.mod", - "./SYSTEM.c", - "./Termcap.mod", - "./Terminal.mod", - "./Traps.mod", - "./ucheck.c", - "./EM.e", - "./LtoUset.e", - "./absf.e", - "./par_misc.e", - }, - hdrs = {}, -- must be empty - deps = { - "lang/cem/libcc.ansi/headers+pkg", - "plat/"..plat.."/include+pkg", - "h+emheaders", - "lang/m2/include+headers", - }, - vars = { plat = plat } - } - - ackfile { - name = "mrt_"..plat, - srcs = { "./head_m2.e" }, - vars = { plat = plat }, - deps = { - "h+emheaders" - } - } - - local suffix = plat:find("^em") and "m" or "o" - installable { - name = "pkg_"..plat, - map = { - ["$(PLATIND)/"..plat.."/modula2."..suffix] = "+mrt_"..plat, - ["$(PLATIND)/"..plat.."/libmodula2.a"] = "+lib_"..plat, - "+headers", - } - } -end - - diff --git a/lang/pc/comp/build.lua b/lang/pc/comp/build.lua deleted file mode 100644 index d8bf331697..0000000000 --- a/lang/pc/comp/build.lua +++ /dev/null @@ -1,174 +0,0 @@ -normalrule { - name = "tokenfile_g", - ins = { - "./make.tokfile", - "./tokenname.c" - }, - outleaves = { "tokenfile.g" }, - commands = { - "sh %{ins[1]} < %{ins[2]} > %{outs}" - } -} - -llgen { - name = "llgen", - srcs = { - -- order here is important - "+tokenfile_g", - "./declar.g", - "./expression.g", - "./program.g", - "./statement.g", - } -} - -normalrule { - name = "parameters_h", - ins = { - "./make.parameters", - "./Parameters", - }, - outleaves = { "parameters.h" }, - commands = { - "sh %{ins[1]} < %{ins[2]} > %{outs}" - } -} - -local xh_files = { - "./def.xh", - "./desig.xh", - "./node.xh", - "./scope.xh", - "./type.xh", -} - -for _, f in ipairs(filenamesof(xh_files)) do - local name = replace(basename(f), "%.xh$", "") - normalrule { - name = name.."_h", - ins = { - "./make.allocd", - f - }, - outleaves = { name..".h" }, - commands = { - "%{ins[1]} < %{ins[2]} > %{outs}" - } - } -end - -local xc_files = { - "./casestat.xc", - "./tmpvar.xc", -} - -for _, f in ipairs(filenamesof(xc_files)) do - local name = replace(basename(f), "%.xc$", "") - normalrule { - name = name.."_c", - ins = { - "./make.allocd", - f - }, - outleaves = { name..".c" }, - commands = { - "%{ins[1]} < %{ins[2]} > %{outs}" - } - } -end - -normalrule { - name = "next_c", - ins = { - "./make.next", - xh_files, - xc_files - }, - outleaves = { "next.c" }, - commands = { - "sh %{ins} > %{outs}" - } -} - -normalrule { - name = "symbol2str_c", - ins = { - "./make.tokcase", - "./tokenname.c", - }, - outleaves = { "symbol2str.c" }, - commands = { - "%{ins[1]} < %{ins[2]} > %{outs}" - } -} - -tabgen { - name = "chartab_c", - srcs = { "./char.tab" }, -} - -cprogram { - name = "em_pc", - srcs = { - "./body.c", - "./chk_expr.c", - "./code.c", - "./cstoper.c", - "./def.c", - "./desig.c", - "./enter.c", - "./error.c", - "./idf.c", - "./input.c", - "./label.c", - "./LLlex.c", - "./LLmessage.c", - "./lookup.c", - "./main.c", - "./misc.c", - "./node.c", - "./options.c", - "./progs.c", - "./readwrite.c", - "./scope.c", - "./stab.c", - "./tokenname.c", - "./type.c", - "./typequiv.c", - "+casestat_c", - "+chartab_c", - "+next_c", - "+symbol2str_c", - "+tmpvar_c", - matching(filenamesof("+llgen"), "%.c$"), - }, - deps = { - "+def_h", - "+desig_h", - "+llgen", - "+node_h", - "+parameters_h", - "+scope_h", - "+type_h", - "h+emheaders", - "lang/pc/include+headers", - "modules+headers", - "modules/src/alloc+lib", - "modules/src/em_code+lib_k", - "modules/src/em_data+lib", - "modules/src/em_mes+lib", - "modules/src/flt_arith+lib", - "modules/src/idf+lib", - "modules/src/input+lib", - "modules/src/string+lib", - "modules/src/system+lib", - }, -} - -installable { - name = "pkg", - map = { - ["$(PLATDEP)/em_pc"] = "+em_pc", - ["$(INSDIR)/share/man/man6/em_pc.6"] = "./em_pc.6" - } -} diff --git a/lang/pc/include/build.lua b/lang/pc/include/build.lua deleted file mode 100644 index d4fac62033..0000000000 --- a/lang/pc/include/build.lua +++ /dev/null @@ -1,9 +0,0 @@ -clibrary { - name = "headers", - hdrs = { - "./pc_err.h", - "./pc_file.h", - "./pc.h", - "./pc_math.h", - } -} diff --git a/lang/pc/libpc/build.lua b/lang/pc/libpc/build.lua deleted file mode 100644 index 42fe7a5c8e..0000000000 --- a/lang/pc/libpc/build.lua +++ /dev/null @@ -1,107 +0,0 @@ -include("plat/build.lua") - -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./abi.c", - "./abl.c", - "./abr.c", - "./arg.c", - "./ass.c", - "./asz.c", - "./atn.c", - "./bcp.c", - "./buff.c", - "./catch.c", - "./cls.c", - "./cvt.c", - "./diag.c", - "./efl.c", - "./eln.c", - "./exp.c", - "./get.c", - "./hlt.c", - "./incpt.c", - "./ini.c", - "./log.c", - "./mdi.c", - "./mdl.c", - "./new.c", - "./nfa.c", - "./nobuff.c", - "./notext.c", - "./opn.c", - "./outcpt.c", - "./pac.c", - "./pclose.c", - "./pcreat.c", - "./pentry.c", - "./perrno.c", - "./pexit.c", - "./popen.c", - "./put.c", - "./rcka.c", - "./rdc.c", - "./rdi.c", - "./rdl.c", - "./rdr.c", - "./rf.c", - "./rln.c", - "./rnd.c", - "./sin.c", - "./sqt.c", - "./string.c", - "./unp.c", - "./uread.c", - "./uwrite.c", - "./wdw.c", - "./wf.c", - "./wrc.c", - "./wrf.c", - "./wri.c", - "./wrl.c", - "./wrr.c", - "./wrs.c", - "./wrz.c", - "./bts.e", - "./encaps.e", - "./fef.e", - "./fif.e", - "./gto.e", - "./hol0.e", - "./sig.e", - "./trap.e", - "./trp.e", - }, - hdrs = {}, -- must be empty - deps = { - "h+emheaders", - "lang/cem/libcc.ansi/headers+pkg", - "lang/pc/include+headers", - "plat/"..plat.."/include+pkg", - }, - vars = { plat = plat } - } - - ackfile { - name = "prt_"..plat, - srcs = { "./head_pc.e" }, - vars = { plat = plat }, - deps = { - "h+emheaders", - "lang/pc/include+headers", - } - } - - local suffix = plat:find("^em") and "m" or "o" - installable { - name = "pkg_"..plat, - map = { - ["$(PLATIND)/"..plat.."/pascal."..suffix] = "+prt_"..plat, - ["$(PLATIND)/"..plat.."/libpascal.a"] = "+lib_"..plat, - } - } -end - - diff --git a/mach/em22/libend/build.lua b/mach/em22/libend/build.lua deleted file mode 100644 index 05ab3319dc..0000000000 --- a/mach/em22/libend/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./edata.e", - "./em_end.e", - "./end.e", - "./etext.e", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/i386/as/build.lua b/mach/i386/as/build.lua deleted file mode 100644 index 788b768630..0000000000 --- a/mach/i386/as/build.lua +++ /dev/null @@ -1,12 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach0.c", - "./mach1.c", - "./mach2.c", - "./mach3.c", - "./mach4.c", - "./mach5.c", - } -} - diff --git a/mach/i386/libem/build.lua b/mach/i386/libem/build.lua deleted file mode 100644 index 9dfe8b85b0..0000000000 --- a/mach/i386/libem/build.lua +++ /dev/null @@ -1,60 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./adi.s", - "./and.s", - "./blm.s", - "./cii.s", - "./cms.s", - "./com.s", - "./csa4.s", - "./csa8.s", - "./csb4.s", - "./csb8.s", - "./cuu.s", - "./divrem8.s", - "./dup.s", - "./dvi8.s", - "./dvi.s", - "./dvu8.s", - "./dvu.s", - "./error.s", - "./exg.s", - "./fat.s", - "./fp8087.s", - "./gto.s", - "./iaar.s", - "./ilar.s", - "./inn.s", - "./ior.s", - "./isar.s", - "./lar4.s", - "./loi.s", - "./mli8.s", - "./mli.s", - "./mon.s", - "./ngi.s", - "./nop.s", - "./print.s", - "./rck.s", - "./rmi8.s", - "./rmi.s", - "./rmu.s", - "./rol.s", - "./ror.s", - "./sar4.s", - "./sbi.s", - "./set.s", - "./sli.s", - "./sri.s", - "./sti.s", - "./strhp.s", - "./trp.s", - "./unknown.s", - "./xor.s", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/i386/libend/build.lua b/mach/i386/libend/build.lua deleted file mode 100644 index bfbf21cd00..0000000000 --- a/mach/i386/libend/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./edata.s", - "./em_end.s", - "./end.s", - "./etext.s", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/i386/ncg/build.lua b/mach/i386/ncg/build.lua deleted file mode 100644 index cc47f9b7b8..0000000000 --- a/mach/i386/ncg/build.lua +++ /dev/null @@ -1,8 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach.c", - "./mach.h" - } -} - diff --git a/mach/i80/as/build.lua b/mach/i80/as/build.lua deleted file mode 100644 index 788b768630..0000000000 --- a/mach/i80/as/build.lua +++ /dev/null @@ -1,12 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach0.c", - "./mach1.c", - "./mach2.c", - "./mach3.c", - "./mach4.c", - "./mach5.c", - } -} - diff --git a/mach/i80/libem/build.lua b/mach/i80/libem/build.lua deleted file mode 100644 index f809b94f4c..0000000000 --- a/mach/i80/libem/build.lua +++ /dev/null @@ -1,113 +0,0 @@ -local generated = {} - -definerule("generate", - { - body = { type="string" }, - offset = { type="object" }, - }, - function(e) - return normalrule { - name = e.name, - ins = { "./generate.sh", "./"..e.body }, - outleaves = { e.name..".s" }, - commands = { - "%{ins[1]} "..e.body.." "..e.offset.." > %{outs}" - } - } - end -) - -for i = 1, 128 do - generated[#generated+1] = generate { - name = "fload"..i, - body = "fload.h", - offset = i - } - - generated[#generated+1] = generate { - name = "floadn"..i, - body = "floadn.h", - offset = i - } - - generated[#generated+1] = generate { - name = "fstore"..i, - body = "fstore.h", - offset = i - } - - generated[#generated+1] = generate { - name = "fstoren"..i, - body = "fstoren.h", - offset = i - } - - generated[#generated+1] = generate { - name = "faddr"..i, - body = "faddr.h", - offset = i - } - - generated[#generated+1] = generate { - name = "faddrn"..i, - body = "faddrn.h", - offset = i - } -end - -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./aar2.s", - "./adi4.s", - "./and.s", - "./blm.s", - "./cii.s", - "./cmi4.s", - "./cmps_mag.s", - "./cmpu_mag.s", - "./cms.s", - "./com.s", - "./csa.s", - "./csb.s", - "./dup.s", - "./dvi2.s", - "./dvi4.s", - "./exg.s", - "./flp.s", - "./inn.s", - "./ior.s", - "./lar2.s", - "./loi.s", - "./mli2.s", - "./mli4.s", - "./mlu2.s", - "./ngi4.s", - "./nop.s", - "./pchl.s", - "./pro.s", - "./rck.s", - "./ret.s", - "./rol4.s", - "./ror4.s", - "./rst.s", - "./sar2.s", - "./sbi4.s", - "./set2.s", - "./set.s", - "./sli2.s", - "./sli4.s", - "./sri2.s", - "./sri4.s", - "./sti.s", - "./xor.s", - generated - }, - vars = { - plat = plat, - ["+ackcflags"] = {"-Imach/i80/libem"} - }, - } -end - diff --git a/mach/i80/libend/build.lua b/mach/i80/libend/build.lua deleted file mode 100644 index bfbf21cd00..0000000000 --- a/mach/i80/libend/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./edata.s", - "./em_end.s", - "./end.s", - "./etext.s", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/i80/ncg/build.lua b/mach/i80/ncg/build.lua deleted file mode 100644 index cc47f9b7b8..0000000000 --- a/mach/i80/ncg/build.lua +++ /dev/null @@ -1,8 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach.c", - "./mach.h" - } -} - diff --git a/mach/i86/as/build.lua b/mach/i86/as/build.lua deleted file mode 100644 index 788b768630..0000000000 --- a/mach/i86/as/build.lua +++ /dev/null @@ -1,12 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach0.c", - "./mach1.c", - "./mach2.c", - "./mach3.c", - "./mach4.c", - "./mach5.c", - } -} - diff --git a/mach/i86/libem/build.lua b/mach/i86/libem/build.lua deleted file mode 100644 index db45ca763a..0000000000 --- a/mach/i86/libem/build.lua +++ /dev/null @@ -1,68 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./adi.s", - "./and.s", - "./blm.s", - "./cii.s", - "./cmi4.s", - "./cms.s", - "./cmu4.s", - "./com.s", - "./csa2.s", - "./csa4.s", - "./csb2.s", - "./csb4.s", - "./cuu.s", - "./dup.s", - "./dvi4.s", - "./dvi.s", - "./dvu4.s", - "./dvu.s", - "./error.s", - "./exg.s", - "./fat.s", - "./fp8087.s", - "./gto.s", - "./iaar.s", - "./ilar.s", - "./inn.s", - "./ior.s", - "./isar.s", - "./lar2.s", - "./lfr6.s", - "./lfr8.s", - "./loi.s", - "./mli4.s", - "./mli.s", - "./mon.s", - "./ngi.s", - "./nop.s", - "./print.s", - "./rck.s", - "./ret6.s", - "./ret8.s", - "./retarea.s", - "./return.s", - "./rmi4.s", - "./rmi.s", - "./rmu4.s", - "./rmu.s", - "./rol.s", - "./ror.s", - "./sar2.s", - "./sbi.s", - "./set.s", - "./sli.s", - "./sri.s", - "./sti.s", - "./strhp.s", - "./trp.s", - "./unknown.s", - "./xor.s", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/i86/libend/build.lua b/mach/i86/libend/build.lua deleted file mode 100644 index bfbf21cd00..0000000000 --- a/mach/i86/libend/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./edata.s", - "./em_end.s", - "./end.s", - "./etext.s", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/i86/libsys/build.lua b/mach/i86/libsys/build.lua deleted file mode 100644 index ca5a13c658..0000000000 --- a/mach/i86/libsys/build.lua +++ /dev/null @@ -1,8 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { "./*.s" }, - vars = { plat = plat }, - } -end - diff --git a/mach/i86/ncg/build.lua b/mach/i86/ncg/build.lua deleted file mode 100644 index cc47f9b7b8..0000000000 --- a/mach/i86/ncg/build.lua +++ /dev/null @@ -1,8 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach.c", - "./mach.h" - } -} - diff --git a/mach/m68020/as/build.lua b/mach/m68020/as/build.lua deleted file mode 100644 index 788b768630..0000000000 --- a/mach/m68020/as/build.lua +++ /dev/null @@ -1,12 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach0.c", - "./mach1.c", - "./mach2.c", - "./mach3.c", - "./mach4.c", - "./mach5.c", - } -} - diff --git a/mach/m68020/libem/build.lua b/mach/m68020/libem/build.lua deleted file mode 100644 index 2c56f2a372..0000000000 --- a/mach/m68020/libem/build.lua +++ /dev/null @@ -1,43 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./aar.s", - "./cii.s", - "./cmi.s", - "./cms.s", - "./cmu.s", - "./csa8.s", - "./csa.s", - "./csb8.s", - "./csb.s", - "./cuu.s", - "./cvf.s", - "./dia.s", - "./divrem8.s", - "./dvi8.s", - "./dvu8.s", - "./exg.s", - "./fat.s", - "./fp68881.s", - "./inn.s", - "./lar.s", - "./los.s", - "./mon.s", - "./nop.s", - "./rmi8.s", - "./rmu8.s", - "./sar.s", - "./set.s", - "./shp.s", - "./sts.s", - "./trp.s", - "./trpstr.c", - }, - vars = { plat = plat }, - deps = { - "h+emheaders" - } - } -end - diff --git a/mach/m68020/libend/build.lua b/mach/m68020/libend/build.lua deleted file mode 100644 index bfbf21cd00..0000000000 --- a/mach/m68020/libend/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./edata.s", - "./em_end.s", - "./end.s", - "./etext.s", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/m68020/ncg/build.lua b/mach/m68020/ncg/build.lua deleted file mode 100644 index f940b072d7..0000000000 --- a/mach/m68020/ncg/build.lua +++ /dev/null @@ -1,9 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach.c", - "./mach.h", - "./instrmacs.h" - } -} - diff --git a/mach/m68k2/as/build.lua b/mach/m68k2/as/build.lua deleted file mode 100644 index 788b768630..0000000000 --- a/mach/m68k2/as/build.lua +++ /dev/null @@ -1,12 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach0.c", - "./mach1.c", - "./mach2.c", - "./mach3.c", - "./mach4.c", - "./mach5.c", - } -} - diff --git a/mach/m68k2/libem/build.lua b/mach/m68k2/libem/build.lua deleted file mode 100644 index 96e08292fe..0000000000 --- a/mach/m68k2/libem/build.lua +++ /dev/null @@ -1,46 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./ara.s", - "./cii.s", - "./cmi.s", - "./cmp.s", - "./cmu.s", - "./csa2.s", - "./csa4.s", - "./csb2.s", - "./csb4.s", - "./cuu.s", - "./exg.s", - "./inn.s", - "./los.s", - "./rck.s", - "./ret.s", - "./set.s", - "./sts.s", - "./nop.s", - "./mon.s", - "./dvi.s", - "./dvu.s", - "./mli.s", - "./mlu.s", - "./shp.s", - "./sig.s", - "./cms.s", - "./gto.s", - "./fp68881.s", - "./fat.s", - "./trp.s", - "./dia.s", - "./lxl.s", - "./lxa.s", - "./lpb.s", - }, - vars = { plat = plat }, - deps = { - "h+emheaders" - } - } -end - diff --git a/mach/m68k2/libend/build.lua b/mach/m68k2/libend/build.lua deleted file mode 100644 index bfbf21cd00..0000000000 --- a/mach/m68k2/libend/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./edata.s", - "./em_end.s", - "./end.s", - "./etext.s", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/mips/as/build.lua b/mach/mips/as/build.lua deleted file mode 100644 index d330957a0c..0000000000 --- a/mach/mips/as/build.lua +++ /dev/null @@ -1,19 +0,0 @@ -normalrule { - name = "astables", - outleaves = {"definitions.y", "tokens.y", "rules.y"}, - ins = {"./mktables.lua", "./instructions.dat"}, - commands = {"$(LUA) %{ins[1]} %{outs} < %{ins[2]}"} -} - -bundle { - name = "headers", - srcs = { - "./mach0.c", - "./mach1.c", - "./mach2.c", - "./mach3.c", - "./mach4.c", - "./mach5.c", - } -} - diff --git a/mach/mips/libem/build.lua b/mach/mips/libem/build.lua deleted file mode 100644 index 9145f6730e..0000000000 --- a/mach/mips/libem/build.lua +++ /dev/null @@ -1,43 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "headers_"..plat, - } - - acklibrary { - name = "lib_"..plat, - srcs = { - "./aar4.s", - "./and.s", - "./bls4.s", - "./cms.s", - "./compareul.s", - "./com.s", - "./csa.s", - "./csb.s", - "./c_ud_i.s", - "./c_uf_i.s", - "./c_ui_d.s", - "./c_ui_f.s", - "./dus4.s", - "./exg.s", - "./fef8.s", - "./fif8.s", - "./inn.s", - "./ior.s", - "./lar4.s", - "./los4.s", - "./rck.s", - "./sar4.s", - "./set.s", - "./sts4.s", - "./trp.s", - "./xor.s", - "./zer.s", - }, - vars = { plat = plat }, - deps = { - "h+emheaders", - "+headers_"..plat, - } - } -end diff --git a/mach/mips/libend/build.lua b/mach/mips/libend/build.lua deleted file mode 100644 index bfbf21cd00..0000000000 --- a/mach/mips/libend/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./edata.s", - "./em_end.s", - "./end.s", - "./etext.s", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/mips/mcg/build.lua b/mach/mips/mcg/build.lua deleted file mode 100644 index ed2d2687c1..0000000000 --- a/mach/mips/mcg/build.lua +++ /dev/null @@ -1,7 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./platform.c", - } -} - diff --git a/mach/pdp/as/build.lua b/mach/pdp/as/build.lua deleted file mode 100644 index 788b768630..0000000000 --- a/mach/pdp/as/build.lua +++ /dev/null @@ -1,12 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach0.c", - "./mach1.c", - "./mach2.c", - "./mach3.c", - "./mach4.c", - "./mach5.c", - } -} - diff --git a/mach/pdp/libem/build.lua b/mach/pdp/libem/build.lua deleted file mode 100644 index e70ba80ced..0000000000 --- a/mach/pdp/libem/build.lua +++ /dev/null @@ -1,80 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./aar.s", - "./adf.s", - "./adi.s", - "./and.s", - "./cff.s", - "./cfi.s", - "./cif.s", - "./cii.s", - "./ciu.s", - "./cmf.s", - "./cmi4.s", - "./cmi.s", - "./cms.s", - "./cmu4.s", - "./cmu.s", - "./csa.s", - "./csb.s", - "./dup.s", - "./dvf.s", - "./dvi4.s", - "./dvi.s", - "./dvu2.s", - "./dvu4.s", - "./dvu.s", - "./eret.s", - "./exg.s", - "./fef.s", - "./fif.s", - "./gto.s", - "./iaar.s", - "./ilar.s", - "./inn.s", - "./isar.s", - "./lar.s", - "./los2.s", - "./mlf.s", - "./mli4.s", - "./mli.s", - "./mlu4.s", - "./mlu.s", - "./mon.s", - "./ngf.s", - "./ngi.s", - "./nop.s", - "./prf.s", - "./printf.s", - "./rck.s", - "./ret.s", - "./rmi4.s", - "./rmi.s", - "./rmu2.s", - "./rmu4.s", - "./rmu.s", - "./rol.s", - "./ror.s", - "./RT.s", - "./sar.s", - "./save.s", - "./sbf.s", - "./sbi.s", - "./setfl.s", - "./set.s", - "./sim.s", - "./sli.s", - "./sri.s", - "./sru.s", - "./sto2.s", - "./strhp.s", - "./trp.s", - "./unknown.s", - "./xor.s", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/pdp/libend/build.lua b/mach/pdp/libend/build.lua deleted file mode 100644 index bfbf21cd00..0000000000 --- a/mach/pdp/libend/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./edata.s", - "./em_end.s", - "./end.s", - "./etext.s", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/powerpc/as/build.lua b/mach/powerpc/as/build.lua deleted file mode 100644 index 788b768630..0000000000 --- a/mach/powerpc/as/build.lua +++ /dev/null @@ -1,12 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach0.c", - "./mach1.c", - "./mach2.c", - "./mach3.c", - "./mach4.c", - "./mach5.c", - } -} - diff --git a/mach/powerpc/libem/build.lua b/mach/powerpc/libem/build.lua deleted file mode 100644 index 832f3cf593..0000000000 --- a/mach/powerpc/libem/build.lua +++ /dev/null @@ -1,45 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "headers_"..plat, - } - - acklibrary { - name = "lib_"..plat, - srcs = { - "./aar4.s", - "./and.s", - "./bls4.s", - "./cfi8.s", - "./cfu8.s", - "./cif8.s", - "./cms.s", - "./com.s", - "./csa.s", - "./csb.s", - "./cuf8.s", - -- "./dus4.s", - "./exg.s", - "./fd_00000000.s", - "./fef4.s", - "./fef8.s", - "./fif4.s", - "./fif8.s", - "./inn.s", - "./ior.s", - "./lar4.s", - "./los4.s", - "./rck.s", - "./sar4.s", - "./set.s", - "./sts4.s", - "./trp.s", - "./xor.s", - "./zer.s", - }, - vars = { plat = plat }, - deps = { - "h+emheaders", - "+headers_"..plat, - } - } -end diff --git a/mach/powerpc/libend/build.lua b/mach/powerpc/libend/build.lua deleted file mode 100644 index bfbf21cd00..0000000000 --- a/mach/powerpc/libend/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./edata.s", - "./em_end.s", - "./end.s", - "./etext.s", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/powerpc/mcg/build.lua b/mach/powerpc/mcg/build.lua deleted file mode 100644 index ed2d2687c1..0000000000 --- a/mach/powerpc/mcg/build.lua +++ /dev/null @@ -1,7 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./platform.c", - } -} - diff --git a/mach/powerpc/ncg/build.lua b/mach/powerpc/ncg/build.lua deleted file mode 100644 index cc47f9b7b8..0000000000 --- a/mach/powerpc/ncg/build.lua +++ /dev/null @@ -1,8 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach.c", - "./mach.h" - } -} - diff --git a/mach/proto/as/build.lua b/mach/proto/as/build.lua deleted file mode 100644 index 1b959e2d50..0000000000 --- a/mach/proto/as/build.lua +++ /dev/null @@ -1,57 +0,0 @@ -include("first/bison.lua") - - - { - arch = { type="string" }, - deps = { type="targets", default={} }, - }, - function(e) - -- Remember this is executed from the caller's directory; local - -- target names will resolve there - local archlib = clibrary { - name = e.name.."/archlib", - srcs = {}, - hdrs = { "mach/"..e.arch.."/as+headers" }, - } - - local preprocessedy = cppfile { - name = e.name.."/bisoninput", - srcs = { "mach/proto/as/comm2.y" }, - outleaf = "comm2.y", - deps = { - "mach/proto/as/comm0.h", - "mach/proto/as/comm1.h", - "h+emheaders", - archlib, - e.deps, - }, - } - - local bisonfiles = bison { - name = e.name.."/bison", - srcs = { preprocessedy } - } - - return cprogram { - name = e.name, - srcs = concat( - "mach/proto/as/comm3.c", - "mach/proto/as/comm4.c", - "mach/proto/as/comm5.c", - "mach/proto/as/comm6.c", - "mach/proto/as/comm7.c", - "mach/proto/as/comm8.c", - matching(filenamesof(bisonfiles), "%.c$") - ), - deps = { - "h+emheaders", - "modules/src/object+lib", - "modules/src/flt_arith+lib", - archlib, - bisonfiles, - e.deps - } - } - end -) - diff --git a/mach/proto/cg/build.lua b/mach/proto/cg/build.lua deleted file mode 100644 index d9b0fb240c..0000000000 --- a/mach/proto/cg/build.lua +++ /dev/null @@ -1,71 +0,0 @@ -include("util/cgg/build.lua") - -definerule("build_cg", - { - arch = { type="string" } - }, - function(e) - -- Remember this is executed from the caller's directory; local - -- target names will resolve there - local headers = clibrary { - name = e.name.."/headers", - srcs = {}, - hdrs = { - "mach/proto/cg/assert.h", - "mach/proto/cg/codegen.h", - "mach/proto/cg/data.h", - "mach/proto/cg/equiv.h", - "mach/proto/cg/extern.h", - "mach/proto/cg/fillem.h", - "mach/proto/cg/gencode.h", - "mach/proto/cg/glosym.h", - "mach/proto/cg/param.h", - "mach/proto/cg/reg.h", - "mach/proto/cg/regvar.h", - "mach/proto/cg/result.h", - "mach/proto/cg/salloc.h", - "mach/proto/cg/state.h", - "mach/proto/cg/subr.h", - "mach/proto/cg/types.h", - "mach/"..e.arch.."/cg/mach.c", - "mach/"..e.arch.."/cg/mach.h", - } - } - - local tables = cgg { - name = e.name.."/tables", - srcs = { "mach/"..e.arch.."/cg/table" } - } - - return cprogram { - name = e.name, - srcs = { - "mach/proto/cg/codegen.c", - "mach/proto/cg/compute.c", - "mach/proto/cg/equiv.c", - "mach/proto/cg/fillem.c", - "mach/proto/cg/gencode.c", - "mach/proto/cg/glosym.c", - "mach/proto/cg/main.c", - "mach/proto/cg/move.c", - "mach/proto/cg/nextem.c", - "mach/proto/cg/reg.c", - "mach/proto/cg/regvar.c", - "mach/proto/cg/salloc.c", - "mach/proto/cg/state.c", - "mach/proto/cg/subr.c", - "mach/proto/cg/var.c", - matching(filenamesof(tables), "%.c$") - }, - deps = { - "h+emheaders", - "modules+headers", - "modules/src/em_data+lib", - "modules/src/flt_arith+lib", - headers, - tables, -- for .h file - } - } - end -) - diff --git a/mach/proto/fp/build.lua b/mach/proto/fp/build.lua deleted file mode 100644 index 63668e6685..0000000000 --- a/mach/proto/fp/build.lua +++ /dev/null @@ -1,98 +0,0 @@ -include("plat/build.lua") - --- For now, all floats are little-endian. -local byte_order = "mach/i86/libfp/byte_order.h" - -local srcs = { - "./adder.c", - "./add_ext.c", - "./adf4.c", - "./adf8.c", - "./cff4.c", - "./cff8.c", - "./cfi.c", - "./cfu.c", - "./cif4.c", - "./cif8.c", - "./cmf4.c", - "./cmf8.c", - "./compact.c", - "./cuf4.c", - "./cuf8.c", - "./div_ext.c", - "./dvf4.c", - "./dvf8.c", - "./extend.c", - "./fef4.c", - "./fef8.c", - "./fif4.c", - "./fif8.c", - "./fptrp.e", - "./mlf4.c", - "./mlf8.c", - "./mul_ext.c", - "./ngf4.c", - "./ngf8.c", - "./nrm_ext.c", - "./sbf4.c", - "./sbf8.c", - "./sft_ext.c", - "./shifter.c", - "./sub_ext.c", - "./zrf4.c", - "./zrf8.c", - "./zrf_ext.c", -} - --- For now, only cpm uses software floating-point. -for _, plat in ipairs({"cpm"}) do - local edits = {} - for _, src in fpairs(srcs) do - - -- Compile each src file into assembly code. - local n = basename(src):gsub("%.%w*$", "") - local assembly = ackfile { - name = "s_"..plat.."/"..n, - srcs = { src }, - deps = { - "./FP_bias.h", - "./FP_shift.h", - "./FP_trap.h", - "./FP_types.h", - "./get_put.h", - byte_order, - }, - suffix = ".s", - vars = { - ["+ackcflags"] = { "-I"..dirname(byte_order) }, - plat = plat - } - } - - -- Run massage_s.lua to edit the assembly code. - edits[#edits+1] = normalrule { - name = "ed_"..plat.."/"..n, - ins = { - "./massage_s.lua", - assembly, - }, - outleaves = { n..".s" }, - commands = { - "$(LUA) %{ins[1]} <%{ins[2]} >%{outs}" - } - } - end - - acklibrary { - name = "lib_"..plat, - srcs = { edits }, - vars = { plat = plat } - } - - installable { - name = "pkg_"..plat, - map = { - ["$(PLATIND)/"..plat.."/libfp.a"] = "+lib_"..plat, - } - } -end diff --git a/mach/proto/mcg/build.lua b/mach/proto/mcg/build.lua deleted file mode 100644 index b8a2440349..0000000000 --- a/mach/proto/mcg/build.lua +++ /dev/null @@ -1,84 +0,0 @@ -include("util/mcgg/build.lua") - -definerule("build_mcg", - { - arch = { type="string" } - }, - function(e) - -- Remember this is executed from the caller's directory; local - -- target names will resolve there - local headers = clibrary { - name = e.name.."/headers", - srcs = {}, - hdrs = { - "mach/proto/mcg/basicblock.h", - "mach/proto/mcg/graph.h", - "mach/proto/mcg/hop.h", - "mach/proto/mcg/ir.h", - "mach/proto/mcg/mcgg_generated_footer.h", - "mach/proto/mcg/mcgg_generated_header.h", - "mach/proto/mcg/mcg.h", - "mach/proto/mcg/procedure.h", - "mach/proto/mcg/reg.h", - "mach/"..e.arch.."/mcg+headers", - } - } - - local tables = mcgg { - name = e.name.."/tables", - srcs = { "mach/"..e.arch.."/mcg/table" } - } - - return cprogram { - name = e.name, - srcs = { - "mach/proto/mcg/basicblock.c", - "mach/proto/mcg/data.c", - "mach/proto/mcg/graph.c", - "mach/proto/mcg/hop.c", - "mach/proto/mcg/ir.c", - "mach/proto/mcg/main.c", - "mach/proto/mcg/parse_em.c", - "mach/proto/mcg/pass_convertstackops.c", - "mach/proto/mcg/pass_eliminatetrivialblocks.c", - "mach/proto/mcg/pass_groupirs.c", - "mach/proto/mcg/pass_instructionselection.c", - "mach/proto/mcg/pass_livevreganalysis.c", - "mach/proto/mcg/pass_lowerpushes.c", - "mach/proto/mcg/pass_phigroups.c", - "mach/proto/mcg/pass_prologueepilogue.c", - "mach/proto/mcg/pass_registerallocator.c", - "mach/proto/mcg/pass_removedeadblocks.c", - "mach/proto/mcg/pass_removedeadphis.c", - "mach/proto/mcg/pass_returnvalues.c", - "mach/proto/mcg/pass_splitcriticaledges.c", - "mach/proto/mcg/pass_ssa.c", - "mach/proto/mcg/pass_typeinference.c", - "mach/proto/mcg/predicates.c", - "mach/proto/mcg/procedure.c", - "mach/proto/mcg/reg.c", - "mach/proto/mcg/symbol.c", - "mach/proto/mcg/treebuilder.c", - "mach/"..e.arch.."/mcg/platform.c", - matching(filenamesof(tables), "%.c$") - }, - deps = { - "h+emheaders", - "modules+headers", - "modules/src/alloc+lib", - "modules/src/data+lib", - "modules/src/em_code+lib_k", - "modules/src/em_data+lib", - "modules/src/idf+lib", - "modules/src/object+lib", - "modules/src/read_em+lib_kv", - "modules/src/string+lib", - "modules/src/system+lib", - "util/mcgg+lib", - headers, - tables, -- for .h file - } - } - end -) - diff --git a/mach/proto/ncg/build.lua b/mach/proto/ncg/build.lua deleted file mode 100644 index 01312aec07..0000000000 --- a/mach/proto/ncg/build.lua +++ /dev/null @@ -1,74 +0,0 @@ -include("util/ncgg/build.lua") - -definerule("build_ncg", - { - arch = { type="string" }, - deps = { type="table", default={} }, - }, - function(e) - -- Remember this is executed from the caller's directory; local - -- target names will resolve there - local headers = clibrary { - name = e.name.."/headers", - srcs = {}, - hdrs = { - "mach/proto/ncg/data.h", - "mach/proto/ncg/equiv.h", - "mach/proto/ncg/glosym.h", - "mach/proto/ncg/label.h", - "mach/proto/ncg/param.h", - "mach/proto/ncg/regvar.h", - "mach/proto/ncg/result.h", - "mach/proto/ncg/state.h", - "mach/proto/ncg/types.h", - "mach/proto/ncg/xmach.h", - "mach/"..e.arch.."/ncg+headers", - }, - vars = { - ["+cflags"] = { "-I." }, - }, - } - - local tables = ncgg { - name = e.name.."/tables", - srcs = { "mach/"..e.arch.."/ncg/table" }, - deps = e.deps - } - - return cprogram { - name = e.name, - srcs = { - "mach/proto/ncg/codegen.c", - "mach/proto/ncg/compute.c", - "mach/proto/ncg/equiv.c", - "mach/proto/ncg/fillem.c", - "mach/proto/ncg/gencode.c", - "mach/proto/ncg/glosym.c", - "mach/proto/ncg/label.c", - "mach/proto/ncg/main.c", - "mach/proto/ncg/move.c", - "mach/proto/ncg/nextem.c", - "mach/proto/ncg/reg.c", - "mach/proto/ncg/regvar.c", - "mach/proto/ncg/salloc.c", - "mach/proto/ncg/state.c", - "mach/proto/ncg/subr.c", - "mach/proto/ncg/var.c", - matching(filenamesof(tables), "%.c$") - }, - vars = { - ["+cflags"] = { "-I." }, - }, - deps = { - "h+emheaders", - "modules+headers", - "modules/src/flt_arith+lib", - "modules/src/object+lib", - "modules/src/em_data+lib", - headers, - tables, -- for .h file - } - } - end -) - diff --git a/mach/proto/top/build.lua b/mach/proto/top/build.lua deleted file mode 100644 index 525083d34a..0000000000 --- a/mach/proto/top/build.lua +++ /dev/null @@ -1,22 +0,0 @@ -include("util/topgen/build.lua") - -definerule("build_top", - { - arch = { type="string" }, - }, - function(e) - local t = topgen { - name = e.name.."_topgen", - srcs = { "mach/"..e.arch.."/top/table" } - } - - return cprogram { - name = e.name, - srcs = { - "mach/proto/top/queue.c", - "mach/proto/top/top.c", - }, - deps = { t }, - } - end -) diff --git a/mach/vc4/as/build.lua b/mach/vc4/as/build.lua deleted file mode 100644 index 2c2d450316..0000000000 --- a/mach/vc4/as/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach0.c", - "./mach1.c", - "./mach2.c", - "./mach3.c", - "./mach4.c", - "./mach5.c", - "./binary.h", - } -} - diff --git a/mach/vc4/libem/build.lua b/mach/vc4/libem/build.lua deleted file mode 100644 index 61cd461b2b..0000000000 --- a/mach/vc4/libem/build.lua +++ /dev/null @@ -1,11 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./csa.s", - "./csb.s", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/vc4/libend/build.lua b/mach/vc4/libend/build.lua deleted file mode 100644 index bfbf21cd00..0000000000 --- a/mach/vc4/libend/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -for _, plat in ipairs(vars.plats) do - acklibrary { - name = "lib_"..plat, - srcs = { - "./edata.s", - "./em_end.s", - "./end.s", - "./etext.s", - }, - vars = { plat = plat }, - } -end - diff --git a/mach/vc4/ncg/build.lua b/mach/vc4/ncg/build.lua deleted file mode 100644 index cc47f9b7b8..0000000000 --- a/mach/vc4/ncg/build.lua +++ /dev/null @@ -1,8 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./mach.c", - "./mach.h" - } -} - diff --git a/modules/build.lua b/modules/build.lua deleted file mode 100644 index 2838eb7c81..0000000000 --- a/modules/build.lua +++ /dev/null @@ -1,12 +0,0 @@ -clibrary { - name = "headers", - hdrs = { - "./h/ansi.h", - "./h/em_arith.h", - "./h/em.h", - "./h/em_label.h", - "./h/em_mesX.h", - "./h/emO_code.h", - } -} - diff --git a/modules/src/alloc/build.lua b/modules/src/alloc/build.lua deleted file mode 100644 index 847d5a8321..0000000000 --- a/modules/src/alloc/build.lua +++ /dev/null @@ -1,14 +0,0 @@ -clibrary { - name = "lib", - srcs = { - "./st_alloc.c", - "./std_alloc.c", - }, - hdrs = { "./alloc.h" }, - deps = { - "modules+headers", - "modules/src/system+lib", - "./alloc.h" - }, -} - diff --git a/modules/src/data/build.lua b/modules/src/data/build.lua deleted file mode 100644 index cec9415d20..0000000000 --- a/modules/src/data/build.lua +++ /dev/null @@ -1,25 +0,0 @@ -local hfiles = { - "./array.h", - "./astring.h", - "./warnings.h", - "./imap.h", - "./pmap.h", - "./smap.h", - "./stringlist.h", -} - -clibrary { - name = "lib", - srcs = { - "./array.c", - "./astring.c", - "./warnings.c", - "./imap.c", - "./pmap.c", - "./smap.c", - "./stringlist.c", - }, - hdrs = hfiles, - deps = hfiles, -} - diff --git a/modules/src/em_code/build.lua b/modules/src/em_code/build.lua deleted file mode 100644 index edfa413796..0000000000 --- a/modules/src/em_code/build.lua +++ /dev/null @@ -1,103 +0,0 @@ -normalrule { - name = "em_code_ek_h", - ins = { - "./make_codeek_h.lua", - "h/em_table_lib.lua", - "h/em_table", - "./em.nogen", - }, - outleaves = { "em_codeEK.h" }, - commands = { - "$(LUA) %{ins[1]} < %{ins[3]} > %{outs}", - "cat %{ins[4]} >> %{outs}" - } -} - -clibrary { - name = "headers", - srcs = {}, - hdrs = { - "+em_code_ek_h", - "./em_code.h", - "./em_codeCE.h", - "./em_codeO.h", - } -} - -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 = { - "+headers" - }, - deps = { - "+headers", - "h+emheaders", - "h+local", - "modules+headers", - "modules/src/alloc+lib", - "modules/src/em_data+lib", - "modules/src/system+lib", - "modules/src/string+lib", - }, - vars = { - ["+cflags"] = cflags - }, - } -end - -build_variant("e", { "-DREADABLE_EM" }) -build_variant("k", { }) - diff --git a/modules/src/em_data/build.lua b/modules/src/em_data/build.lua deleted file mode 100644 index 826af9933e..0000000000 --- a/modules/src/em_data/build.lua +++ /dev/null @@ -1,44 +0,0 @@ -local GENFILES = { - "flag.c", - "mnem.c", - "mnem.h", - "pseu.c", - "pseu.h", - "spec.h" -} - -local generated = {} -for _, f in ipairs(GENFILES) do - generated[#generated+1] = normalrule { - name = "em_"..f:gsub("%.", "_"), - ins = { - "./make_"..f:gsub("%.", "_")..".lua", - "h/em_table_lib.lua", - "h/em_table", -- relative to root, which is a bit evil - }, - outleaves = { - "em_"..f - }, - deps = { - "h+emheaders" - }, - commands = { - "$(LUA) %{ins[1]} < %{ins[3]} > %{outs}" - } - } -end - -clibrary { - name = "lib", - srcs = concat( - "./em_ptyp.c", - matching(filenamesof(generated), "%.c$") - ), - hdrs = { - generated, -- so we export the H files - }, - deps = { - generated, -- so we can see the H files - "h+emheaders" - } -} diff --git a/modules/src/em_mes/build.lua b/modules/src/em_mes/build.lua deleted file mode 100644 index 1b4680b0e7..0000000000 --- a/modules/src/em_mes/build.lua +++ /dev/null @@ -1,24 +0,0 @@ -clibrary { - name = "lib", - srcs = { - "./C_ms_com.c", - "./C_ms_ego.c", - "./C_ms_emx.c", - "./C_ms_err.c", - "./C_ms_flt.c", - "./C_ms_gto.c", - "./C_ms_opt.c", - "./C_ms_par.c", - "./C_ms_reg.c", - "./C_ms_src.c", - "./C_ms_stb.c", - "./C_ms_std.c", - }, - deps = { - "h+emheaders", - "modules+headers", - "modules/src/em_code+headers", - "modules/src/em_data+lib", - } -} - diff --git a/modules/src/flt_arith/build.lua b/modules/src/flt_arith/build.lua deleted file mode 100644 index e248f90032..0000000000 --- a/modules/src/flt_arith/build.lua +++ /dev/null @@ -1,41 +0,0 @@ -clibrary { - name = "lib", - srcs = { - "./flt_ar2flt.c", - "./flt_div.c", - "./flt_flt2ar.c", - "./flt_modf.c", - "./flt_str2fl.c", - "./flt_cmp.c", - "./flt_add.c", - "./b64_add.c", - "./flt_mul.c", - "./flt_nrm.c", - "./b64_sft.c", - "./flt_umin.c", - "./flt_chk.c", - "./split.c", - }, - hdrs = { "./flt_arith.h" }, - deps = { - "modules+headers", - "./flt_arith.h", - "./flt_misc.h", - } -} - --- The test program isn't built by default. Here is a target --- modules/src/flt_arith+pkg to install it as flt_test - -cprogram { - name = "test", - srcs = { "./test.c" }, - deps = { "+lib" }, -} - -installable { - name = "pkg", - map = { - ["$(INSDIR)/bin/flt_test"] = "+test", - }, -} diff --git a/modules/src/idf/build.lua b/modules/src/idf/build.lua deleted file mode 100644 index 04e5019978..0000000000 --- a/modules/src/idf/build.lua +++ /dev/null @@ -1,10 +0,0 @@ -clibrary { - name = "lib", - srcs = {}, - hdrs = { - "./idf_pkg.body", - "./idf_pkg.spec", - } -} - - diff --git a/modules/src/input/build.lua b/modules/src/input/build.lua deleted file mode 100644 index bb6c5ac0ea..0000000000 --- a/modules/src/input/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -clibrary { - name = "lib", - srcs = { - "./AtEoIF.c", - "./AtEoIT.c", - }, - hdrs = { - "./inp_pkg.body", - "./inp_pkg.spec", - } -} - - diff --git a/modules/src/object/build.lua b/modules/src/object/build.lua deleted file mode 100644 index f6c32aadcf..0000000000 --- a/modules/src/object/build.lua +++ /dev/null @@ -1,29 +0,0 @@ -clibrary { - name = "lib", - srcs = { - "./rd_arhdr.c", - "./rd_bytes.c", - "./rd.c", - "./rd_int2.c", - "./rd_int4.c", - "./rd_ranlib.c", - "./rd_unsig2.c", - "./wr_arhdr.c", - "./wr_bytes.c", - "./wr.c", - "./wr_int2.c", - "./wr_int4.c", - "./wr_putc.c", - "./wr_ranlib.c", - }, - hdrs = { "./object.h" }, - deps = { - "modules+headers", - "h+local", - "h+emheaders", - "./object.h", - "./obj.h", - }, -} - - diff --git a/modules/src/read_em/build.lua b/modules/src/read_em/build.lua deleted file mode 100644 index cc94904ddd..0000000000 --- a/modules/src/read_em/build.lua +++ /dev/null @@ -1,63 +0,0 @@ -normalrule { - name = "c_mnem_narg_h", - ins = { - "./make_C_mnem_narg_h.lua", - "h/em_table_lib.lua", - "h/em_table", - }, - outleaves = "C_mnem_narg.h", - commands = { - "$(LUA) %{ins[1]} < %{ins[3]} > %{outs}" - } -} - -normalrule { - name = "c_mnem_h", - ins = { - "./make_C_mnem_h.lua", - "h/em_table_lib.lua", - "h/em_table", - }, - outleaves = "C_mnem.h", - commands = { - "$(LUA) %{ins[1]} < %{ins[3]} > %{outs}" - } -} - -local function variant(name, cflags) - clibrary { - name = name, - vars = { - ["+cflags"] = { - "-DPRIVATE=static", - "-DEXPORT=", - "-DNDEBUG", - "-DCHECKING", - unpack(cflags) - }, - }, - 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+headers", - "modules/src/em_data+lib", - "modules/src/string+lib", - "modules/src/system+lib", - "./em_comp.h", - } - } -end - -variant("lib_ev", {}) -variant("lib_kv", { "-DCOMPACT" }) diff --git a/modules/src/string/build.lua b/modules/src/string/build.lua deleted file mode 100644 index 8c74df2f25..0000000000 --- a/modules/src/string/build.lua +++ /dev/null @@ -1,8 +0,0 @@ -clibrary { - name = "lib", - srcs = { - "./bts2str.c", - "./long2str.c", - }, - hdrs = { "./ack_string.h", }, -} diff --git a/modules/src/system/build.lua b/modules/src/system/build.lua deleted file mode 100644 index 30a64c1feb..0000000000 --- a/modules/src/system/build.lua +++ /dev/null @@ -1,16 +0,0 @@ -clibrary { - name = "lib", - srcs = { - "./basename.c", - "./filesize.c", - "./maketempfile.c", - "./setbinarymode.c", - "./strndup.c", - "./syssystem.c", - "./tmpdir.c", - }, - hdrs = { "./system.h" }, - deps = { - "modules/src/data+lib", - } -} diff --git a/plat/build.lua b/plat/build.lua deleted file mode 100644 index de2fada163..0000000000 --- a/plat/build.lua +++ /dev/null @@ -1,154 +0,0 @@ -include("mach/proto/as/build.lua") -include("mach/proto/cg/build.lua") -include("mach/proto/ncg/build.lua") -include("mach/proto/mcg/build.lua") -include("mach/proto/top/build.lua") - -definerule("ackfile", - { - srcs = { type="targets" }, - deps = { type="targets", default={} }, - suffix = { type="string", optional=true }, - }, - function (e) - local em = (e.vars.plat or ""):find("^em") - local suffix = e.suffix or (em and ".m" or ".o") - local c = "-c"..suffix - local plat = e.vars.plat - - return cfile { - name = e.name, - srcs = e.srcs, - deps = { - "lang/basic/src+pkg", - "lang/cem/cemcom.ansi+pkg", - "lang/cem/cpp.ansi+pkg", - "lang/m2/comp+pkg", - "lang/pc/comp+pkg", - "plat/"..plat.."+tools", - "util/ack+pkg", - "util/ego+pkg", - "util/misc+pkg", - e.deps - }, - suffix = suffix, - commands = { - "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack -m%{plat} "..c.." -o %{outs} %{ins} %{hdrpaths} %{ackcflags}" - } - } - end -) - -definerule("acklibrary", - { - srcs = { type="targets", default={} }, - hdrs = { type="targets", default={} }, - deps = { type="targets", default={} }, - }, - function (e) - local em = (e.vars.plat or ""):find("^em") - - local function splitter(srcs, num, cmd) - local commands = { - } - local t = {} - local function flush() - commands[#commands+1] = cmd:gsub("%%%%", asstring(t)) - t = {} - end - for _, target in ipairs(srcs) do - t[#t+1] = target - if #t == num then - flush() - end - end - if #t ~= 0 then - flush() - end - return table.concat(commands, " && ") - end - - return clibrary { - name = e.name, - srcs = e.srcs, - hdrs = e.hdrs, - deps = { - "util/arch+pkg", - e.deps - }, - vars = { - splitter = splitter - }, - _cfile = ackfile, - suffix = em and ".m" or ".o", - commands = { - "rm -f %{outs[1]}", - "%{splitter(ins, 100, 'ACKDIR=$(INSDIR) $(INSDIR)/bin/aal qc '..tostring(outs[1])..' %%')}" - } - } - end -) - -definerule("ackprogram", - { - srcs = { type="targets", default={} }, - deps = { type="targets", default={} }, - }, - function (e) - -- This bit is a hack. We *don't* want to link the language libraries here, - -- because the ack driver is going to pick the appropriate library itself and - -- we don't want more than one. But we still need to depend on them, so we use - -- a nasty hack. - - local platstamp = normalrule { - name = e.name.."/platstamp", - ins = { "plat/"..e.vars.plat.."+pkg" }, - outleaves = { "stamp" }, - commands = { "touch %{outs}" } - } - - return cprogram { - name = e.name, - srcs = e.srcs, - deps = { - platstamp, - "util/ack+pkg", - "util/led+pkg", - e.deps - }, - _clibrary = acklibrary, - commands = { - "ACKDIR=$(INSDIR) $(INSDIR)/bin/ack -m%{plat} -.%{lang} -o %{outs} %{ins} %{ackldflags}" - } - } - end -) - -definerule("build_plat_libs", - { - arch = { type="string" }, - plat = { type="string" }, - em = { type="boolean", default=false }, - }, - function(e) - local installmap = { - "lang/basic/lib+pkg_"..e.plat, - "lang/cem/libcc.ansi+pkg_"..e.plat, - "lang/m2/libm2+pkg_"..e.plat, - "lang/pc/libpc+pkg_"..e.plat, - ["$(PLATIND)/"..e.plat.."/libem.a"] = "mach/"..e.arch.."/libem+lib_"..e.plat, - ["$(PLATIND)/"..e.plat.."/libend.a"] = "mach/"..e.arch.."/libend+lib_"..e.plat, - } - - -- For now, only cpm uses software floating-point. - if e.plat == "cpm" then - installmap[#installmap+1] = "mach/proto/fp+pkg_"..e.plat - end - - return installable { - name = e.name, - map = installmap, - } - end -) - diff --git a/plat/cpm/build-pkg.lua b/plat/cpm/build-pkg.lua deleted file mode 100644 index 59c9f806a7..0000000000 --- a/plat/cpm/build-pkg.lua +++ /dev/null @@ -1,29 +0,0 @@ -include("plat/build.lua") -include("lang/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { - plat = "cpm", - ["+ackcflags"] = "-DUSE_I80_RSTS", - } -} - -build_plat_libs { - name = "libs", - arch = "i80", - plat = "cpm", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "./include+pkg", - ["$(PLATIND)/cpm/boot.o"] = "+boot", - ["$(PLATIND)/cpm/libsys.a"] = "./libsys+lib", - } -} - diff --git a/plat/cpm/build-tools.lua b/plat/cpm/build-tools.lua deleted file mode 100644 index 0a595f9712..0000000000 --- a/plat/cpm/build-tools.lua +++ /dev/null @@ -1,31 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "i80", -} - -build_ncg { - name = "ncg", - arch = "i80", - vars = { - ["+cflags"] = "-DUSE_I80_RSTS" - } -} - -build_top { - name = "top", - arch = "i80", -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/cpm/as"] = "+as", - ["$(PLATDEP)/cpm/ncg"] = "+ncg", - ["$(PLATDEP)/cpm/top"] = "+top", - ["$(PLATIND)/descr/cpm"] = "./descr", - "util/opt+pkg", - "util/amisc+aslod-pkg", - } -} diff --git a/plat/cpm/emu/build.lua b/plat/cpm/emu/build.lua deleted file mode 100644 index 158e8f152c..0000000000 --- a/plat/cpm/emu/build.lua +++ /dev/null @@ -1,51 +0,0 @@ -ackfile { - name = "bdos_o", - srcs = { - "./bdos.s", - }, - vars = { plat = "cpm" }, -} - -normalrule { - name = "bdos_out", - ins = { - "util/led+led", - "+bdos_o", - }, - outleaves = { "bdos.out" }, - commands = { "%{ins[1]} -b0:0xff00 %{ins[2]} -o %{outs[1]}" } -} - -normalrule { - name = "bdos_img", - ins = { - "util/amisc+aslod", - "+bdos_out", - }, - outleaves = { "bdos.img" }, - commands = { "%{ins[1]} %{ins[2]} %{outs[1]}" } -} - -normalrule { - name = "bdos_c", - ins = { - "util/cmisc+objectify", - "+bdos_img", - }, - outleaves = { "bdos.c" }, - commands = { "%{ins[1]} bdos < %{ins[2]} > %{outs[1]}" } -} - -cprogram { - name = "emu", - srcs = { - "+bdos_c", - "./biosbdos.c", - "./dis8080.c", - "./emulator.c", - "./fileio.c", - "./intel_8080_emulator.c", - "./main.c", - }, -} - diff --git a/plat/cpm/include/build.lua b/plat/cpm/include/build.lua deleted file mode 100644 index ea35db386b..0000000000 --- a/plat/cpm/include/build.lua +++ /dev/null @@ -1,26 +0,0 @@ -include("plat/build.lua") - -headermap = {} -packagemap = {} - -local function addheader(h) - headermap[h] = "./"..h - packagemap["$(PLATIND)/cpm/include/"..h] = "./"..h -end - -addheader("ack/plat.h") -addheader("ack/file.h") -addheader("sys/types.h") -addheader("cpm.h") - -acklibrary { - name = "headers", - hdrs = headermap -} - -installable { - name = "pkg", - map = packagemap -} - - diff --git a/plat/cpm/libsys/build.lua b/plat/cpm/libsys/build.lua deleted file mode 100644 index 1159e07780..0000000000 --- a/plat/cpm/libsys/build.lua +++ /dev/null @@ -1,168 +0,0 @@ -acklibrary { - name = "internal", - hdrs = { - "./asm.h", - "./cpmsys.h", - } -} - -local bdos_calls = { - [ 0] = "cpm_exit", - [ 1] = "cpm_conin", - [ 2] = "cpm_conout", - [ 3] = "cpm_auxin", - [ 4] = "cpm_auxout", - [ 5] = "cpm_lstout", - [ 6] = "cpm_conio", - [ 7] = "cpm_get_iobyte", - [ 8] = "cpm_set_iobyte", - [ 9] = "cpm_printstring", - [10] = "cpm_readline", - [11] = "cpm_const", - [12] = "cpm_get_version", - [13] = "cpm_reset_disk_system", - [14] = "cpm_select_drive", - [15] = "cpm_open_file", - [16] = "cpm_close_file", - [17] = "cpm_findfirst", - [18] = "cpm_findnext", - [19] = "cpm_delete_file", - [20] = "cpm_read_sequential", - [21] = "cpm_write_sequential", - [22] = "cpm_make_file", - [23] = "cpm_rename_file", - [24] = "cpm_get_login_vector", - [25] = "cpm_get_current_drive", - [26] = "cpm_set_dma", - [27] = "cpm_get_allocation_vector", - [28] = "cpm_write_protect_drive", - [29] = "cpm_get_readonly_vector", - [30] = "cpm_set_file_attributes", - [31] = "cpm_get_dpb", - [32] = "cpm_get_set_user", - [33] = "cpm_read_random", - [34] = "cpm_write_random", - [35] = "cpm_seek_to_end", - [36] = "cpm_seek_to_seq_pos", - [37] = "cpm_reset_drives", - [40] = "cpm_write_random_filled", -} - -local bios_calls = { - [ 6] = "cpm_bios_const", - [ 9] = "cpm_bios_conin", - [12] = "cpm_bios_conout", - [15] = "cpm_bios_list", - [18] = "cpm_bios_punch", - [21] = "cpm_bios_reader", - [24] = "cpm_bios_home", - -- Special: [27] = "cpm_bios_seldsk", - [30] = "cpm_bios_settrk", - [33] = "cpm_bios_setsec", - [36] = "cpm_bios_setdma", - [39] = "cpm_bios_read", - [42] = "cpm_bios_write", - [45] = "cpm_bios_listst", - -- Special: [48] = "cpm_bios_sectran", -} - -local trap_calls = { - "EARRAY", - "EBADGTO", - "EBADLAE", - "EBADLIN", - "EBADMON", - "EBADPC", - "EBADPTR", - "ECASE", - "ECONV", - "EFDIVZ", - "EFOVFL", - "EFUND", - "EFUNFL", - "EHEAP", - "EIDIVZ", - "EILLINS", - "EIOVFL", - "EIUND", - "EMEMFLT", - "EODDZ", - "ERANGE", - "ESET", - "ESTACK", - "EUNIMPL", -} - -local generated = {} -for n, name in pairs(bdos_calls) do - generated[#generated+1] = normalrule { - name = name, - ins = { "./make_bdos_call.sh" }, - outleaves = { name..".s" }, - commands = { - "%{ins[1]} "..n.." "..name.." > %{outs}" - } - } -end -for n, name in pairs(bios_calls) do - generated[#generated+1] = normalrule { - name = name, - ins = { "./make_bios_call.sh" }, - outleaves = { name..".s" }, - commands = { - "%{ins[1]} "..n.." "..name.." > %{outs}" - } - } -end -for _, name in pairs(trap_calls) do - generated[#generated+1] = normalrule { - name = name, - ins = { "./make_trap.sh" }, - outleaves = { name..".s" }, - commands = { - "%{ins[1]} "..name:lower().." "..name.." > %{outs}" - } - } -end - -acklibrary { - name = "lib", - srcs = { - "./_bdos.s", - "./_bios_raw.s", - "./_bios.s", - "./bios_sectran.s", - "./bios_seldsk.s", - "./brk.c", - "./close.c", - "./cpm_overwrite_ccp.s", - "./cpm_printstring0.s", - "./cpm_read_random_safe.c", - "./creat.c", - -- "./errno.s", - "./fcb.c", - "./fd.c", - "./getpid.c", - "./_hol0.s", - "./_inn2.s", - "./isatty.c", - "./kill.c", - "./lseek.c", - "./open.c", - "./read.c", - "./signal.c", - "./time.c", - "./_trap.s", - "./write.c", - generated - }, - deps = { - "lang/cem/libcc.ansi/headers+headers", - "plat/cpm/include+headers", - "+internal", - }, - vars = { - plat = "cpm" - } -} - diff --git a/plat/cpm/tests/build.lua b/plat/cpm/tests/build.lua deleted file mode 100644 index a17dfa47ab..0000000000 --- a/plat/cpm/tests/build.lua +++ /dev/null @@ -1,15 +0,0 @@ -include("tests/plat/build.lua") - -plat_testsuite { - name = "tests", - plat = "cpm", - method = "plat/cpm/emu+emu", - skipsets = { - "b", -- B is broken on i80 - "floats", -- floats aren't supported - "long-long", - }, - tests = { - "./parsefcb_c.c", - } -} diff --git a/plat/em/include/build.lua b/plat/em/include/build.lua deleted file mode 100644 index b59e64dea6..0000000000 --- a/plat/em/include/build.lua +++ /dev/null @@ -1,27 +0,0 @@ -include("plat/build.lua") - -headermap = {} -packagemap = {} - -local function addheader(h) - headermap[h] = "./"..h - packagemap["$(PLATIND)/em/include/"..h] = "./"..h -end - -addheader("ack/plat.h") -addheader("sys/types.h") -addheader("sys/timeb.h") -addheader("ack/signal.h") -addheader("sgtty.h") - -acklibrary { - name = "headers", - hdrs = headermap -} - -installable { - name = "pkg", - map = packagemap -} - - diff --git a/plat/em/libsys/build.lua b/plat/em/libsys/build.lua deleted file mode 100644 index 3ba351631b..0000000000 --- a/plat/em/libsys/build.lua +++ /dev/null @@ -1,74 +0,0 @@ -bundle { - name = "srcs", - srcs = { - "./access.e", - "./acct.e", - "./alarm.e", - "./brk.e", - "./chdir.e", - "./chmod.e", - "./chown.e", - "./chroot.e", - "./close.e", - "./creat.e", - "./dup2.e", - "./dup.e", - "./errno.e", - "./execl.e", - "./execle.e", - "./execv.e", - "./execve.e", - "./_exit.e", - "./fork.e", - "./fstat.e", - "./ftime.e", - "./getegid.e", - "./geteuid.e", - "./getgid.e", - "./getpid.e", - "./getuid.e", - "./gtty.c", - "./ioctl.e", - "./isatty.c", - "./kill.e", - "./link.e", - "./lock.e", - "./lseek.e", - "./mknod.e", - "./mount.e", - "./mpxcall.e", - "./nice.e", - "./open.e", - "./pause.e", - "./pipe.e", - "./prof.e", - "./ptrace.e", - "./read.e", - "./sbrk.e", - "./setgid.e", - "./setsig.e", - "./setuid.e", - "./signal.c", - "./sigtrp.e", - "./stat.e", - "./stime.e", - "./stty.c", - "./sync.e", - "./tell.c", - "./time.c", - "./times.e", - "./umask.e", - "./umount.e", - "./unlink.e", - "./utime.e", - "./wait.e", - "./write.e", - } -} - -bundle { - name = "headers", - srcs = { - } -} - diff --git a/plat/em22/build-pkg.lua b/plat/em22/build-pkg.lua deleted file mode 100644 index 5d65ed707d..0000000000 --- a/plat/em22/build-pkg.lua +++ /dev/null @@ -1,18 +0,0 @@ -include("plat/build.lua") - -build_plat_libs { - name = "libs", - arch = "em22", - plat = "em22", - em = true, -} - -installable { - name = "pkg", - map = { - "+libs", - "./include+pkg", - ["$(PLATIND)/em22/libsys.a"] = "./libsys+lib", - } -} - diff --git a/plat/em22/build-tools.lua b/plat/em22/build-tools.lua deleted file mode 100644 index ccdb28d9e5..0000000000 --- a/plat/em22/build-tools.lua +++ /dev/null @@ -1,10 +0,0 @@ -include("plat/build.lua") - -return installable { - name = "tools", - map = { - ["$(PLATIND)/descr/em22"] = "./descr", - "util/opt+pkg", - "util/ass+pkg", - } -} diff --git a/plat/em22/include/build.lua b/plat/em22/include/build.lua deleted file mode 100644 index 0a2c69de16..0000000000 --- a/plat/em22/include/build.lua +++ /dev/null @@ -1,4 +0,0 @@ -installable { - name = "pkg", - map = { "plat/em/include+pkg" } -} diff --git a/plat/em22/libsys/build.lua b/plat/em22/libsys/build.lua deleted file mode 100644 index 919285da3d..0000000000 --- a/plat/em22/libsys/build.lua +++ /dev/null @@ -1,16 +0,0 @@ -acklibrary { - name = "lib", - srcs = { - "plat/em/libsys+srcs", - }, - deps = { - "plat/em/libsys+headers", - "lang/cem/libcc.ansi/headers+headers", - "plat/em22/include+pkg", - "h+emheaders", - }, - vars = { - plat = "em22" - } -} - diff --git a/plat/linux/include/build.lua b/plat/linux/include/build.lua deleted file mode 100644 index f6fb7ebd40..0000000000 --- a/plat/linux/include/build.lua +++ /dev/null @@ -1,27 +0,0 @@ -include("plat/build.lua") - -headermap = {} -packagemap = {} - -local function addheader(h) - headermap[h] = "plat/linux/include/"..h - packagemap["$(PLATIND)/linux/include/"..h] = "plat/linux/include/"..h -end - -addheader("ack/plat.h") -addheader("ack/fcntl.h") -addheader("ack/signal.h") -addheader("sys/ioctl.h") -addheader("sys/types.h") -addheader("sys/wait.h") - - -acklibrary { - name = "headers", - hdrs = headermap -} - -installable { - name = "pkg", - map = packagemap -} diff --git a/plat/linux/libsys/build.lua b/plat/linux/libsys/build.lua deleted file mode 100644 index b18eb4ec0c..0000000000 --- a/plat/linux/libsys/build.lua +++ /dev/null @@ -1,35 +0,0 @@ -bundle { - name = "srcs", - srcs = { - "./close.c", - "./creat.c", - "./execve.c", - "./_exit.c", - "./fork.c", - "./getpid.c", - "./gettimeofday.c", - "./_hol0.s", - "./ioctl.c", - "./isatty.c", - "./kill.c", - "./lseek.c", - "./open.c", - "./read.c", - "./sbrk.c", - "./signal.c", - "./sigprocmask.c", - "./unlink.c", - "./wait.c", - "./waitpid.c", - "./write.c", - } -} - -bundle { - name = "headers", - srcs = { - "./libsys.h", - "./syscalls.h", - } -} - diff --git a/plat/linux386/build-pkg.lua b/plat/linux386/build-pkg.lua deleted file mode 100644 index 14251ee8ac..0000000000 --- a/plat/linux386/build-pkg.lua +++ /dev/null @@ -1,25 +0,0 @@ -include("plat/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { plat = "linux386" } -} - -build_plat_libs { - name = "libs", - arch = "i386", - plat = "linux386", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "./include+pkg", - ["$(PLATIND)/linux386/boot.o"] = "+boot", - ["$(PLATIND)/linux386/libsys.a"] = "./libsys+lib", - } -} - diff --git a/plat/linux386/build-tools.lua b/plat/linux386/build-tools.lua deleted file mode 100644 index 31b8a73885..0000000000 --- a/plat/linux386/build-tools.lua +++ /dev/null @@ -1,22 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "i386", -} - -build_ncg { - name = "ncg", - arch = "i386", -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/linux386/as"] = "+as", - ["$(PLATDEP)/linux386/ncg"] = "+ncg", - ["$(PLATIND)/descr/linux386"] = "./descr", - "util/amisc+aelflod-pkg", - "util/opt+pkg", - } -} diff --git a/plat/linux386/include/build.lua b/plat/linux386/include/build.lua deleted file mode 100644 index 747e52089a..0000000000 --- a/plat/linux386/include/build.lua +++ /dev/null @@ -1,4 +0,0 @@ -installable { - name = "pkg", - map = { "plat/linux/include+pkg" } -} diff --git a/plat/linux386/libsys/build.lua b/plat/linux386/libsys/build.lua deleted file mode 100644 index 63fa3370ac..0000000000 --- a/plat/linux386/libsys/build.lua +++ /dev/null @@ -1,18 +0,0 @@ -acklibrary { - name = "lib", - srcs = { - "./execl.s", - "./_syscall.s", - "./trapno.s", - "plat/linux/libsys+srcs", - }, - deps = { - "plat/linux/libsys+headers", - "lang/cem/libcc.ansi/headers+headers", - "plat/linux386/include+pkg", - }, - vars = { - plat = "linux386" - } -} - diff --git a/plat/linux68k/build-pkg.lua b/plat/linux68k/build-pkg.lua deleted file mode 100644 index 34925f15c6..0000000000 --- a/plat/linux68k/build-pkg.lua +++ /dev/null @@ -1,25 +0,0 @@ -include("plat/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { plat = "linux68k" } -} - -build_plat_libs { - name = "libs", - arch = "m68020", - plat = "linux68k", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "./include+pkg", - ["$(PLATIND)/linux68k/boot.o"] = "+boot", - ["$(PLATIND)/linux68k/libsys.a"] = "./libsys+lib", - } -} - diff --git a/plat/linux68k/build-tools.lua b/plat/linux68k/build-tools.lua deleted file mode 100644 index cda2a332cd..0000000000 --- a/plat/linux68k/build-tools.lua +++ /dev/null @@ -1,25 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "m68020", -} - -build_ncg { - name = "ncg", - arch = "m68020", - vars = { - ["+cflags"] = "-DWORD_SIZE=4 -DTBL68020=1 -DTBL68881=1" - } -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/linux68k/as"] = "+as", - ["$(PLATDEP)/linux68k/ncg"] = "+ncg", - ["$(PLATIND)/descr/linux68k"] = "./descr", - "util/amisc+aelflod-pkg", - "util/opt+pkg", - } -} diff --git a/plat/linux68k/emu/build.lua b/plat/linux68k/emu/build.lua deleted file mode 100644 index 6579ef929a..0000000000 --- a/plat/linux68k/emu/build.lua +++ /dev/null @@ -1,58 +0,0 @@ -cprogram { - name = "m68kmake", - srcs = { - "./musashi/m68kmake.c" - } -} - -normalrule { - name = "m68k_engine", - ins = { - "+m68kmake", - "./musashi/m68k_in.c", - "./musashi/m68kcpu.h", - "./musashi/m68kmmu.h", - "./m68kconf.h", - "./musashi/m68kcpu.c", - "./musashi/m68kfpu.c", - "./musashi/m68kdasm.c", - "./musashi/m68k.h", - "./musashi/softfloat", - }, - outleaves = { - "m68kops.c", - "m68kops.h", - "m68kcpu.h", - "m68kconf.h", - "m68kcpu.c", - "m68kdasm.c", - "m68k.h", - }, - commands = { - "cp -R %{ins[2]} %{ins[3]} %{ins[4]} %{ins[5]} %{ins[6]} %{ins[7]} %{ins[8]} %{ins[9]} %{ins[10]} %{dir}", - "cd %{dir} && %{ins[1]}" - } -} - -clibrary { - name = "headers", - srcs = {}, - hdrs = { - matching(filenamesof("+m68k_engine"), "%.h$"), - } -} - -cprogram { - name = "emu68k", - vars = { - ["+cflags"] = {"-DM68K_COMPILE_FOR_MAME=0"} - }, - srcs = { - "./sim.c", - matching(filenamesof("+m68k_engine"), "%.c$"), - "./musashi/softfloat/softfloat.c", - }, - deps = { - "+headers", - } -} diff --git a/plat/linux68k/include/build.lua b/plat/linux68k/include/build.lua deleted file mode 100644 index 747e52089a..0000000000 --- a/plat/linux68k/include/build.lua +++ /dev/null @@ -1,4 +0,0 @@ -installable { - name = "pkg", - map = { "plat/linux/include+pkg" } -} diff --git a/plat/linux68k/libsys/build.lua b/plat/linux68k/libsys/build.lua deleted file mode 100644 index 5b16cba3aa..0000000000 --- a/plat/linux68k/libsys/build.lua +++ /dev/null @@ -1,16 +0,0 @@ -acklibrary { - name = "lib", - srcs = { - "./_syscall.s", - "plat/linux/libsys+srcs", - }, - deps = { - "plat/linux/libsys+headers", - "lang/cem/libcc.ansi/headers+headers", - "plat/linux68k/include+pkg", - }, - vars = { - plat = "linux68k" - } -} - diff --git a/plat/linux68k/tests/build.lua b/plat/linux68k/tests/build.lua deleted file mode 100644 index 37edfaadac..0000000000 --- a/plat/linux68k/tests/build.lua +++ /dev/null @@ -1,10 +0,0 @@ -include("tests/plat/build.lua") - -plat_testsuite { - name = "tests", - plat = "linux68k", - method = "plat/linux68k/emu+emu68k", - skipsets = { - "floats", -- FPU instructions not supported by emulator - }, -} diff --git a/plat/linuxmips/build-pkg.lua b/plat/linuxmips/build-pkg.lua deleted file mode 100644 index 73f73e68ef..0000000000 --- a/plat/linuxmips/build-pkg.lua +++ /dev/null @@ -1,25 +0,0 @@ -include("plat/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { plat = "linuxmips" } -} - -build_plat_libs { - name = "libs", - arch = "mips", - plat = "linuxmips", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "./include+pkg", - ["$(PLATIND)/linuxmips/boot.o"] = "+boot", - ["$(PLATIND)/linuxmips/libsys.a"] = "./libsys+lib", - } -} - diff --git a/plat/linuxmips/build-tools.lua b/plat/linuxmips/build-tools.lua deleted file mode 100644 index 92167ba63b..0000000000 --- a/plat/linuxmips/build-tools.lua +++ /dev/null @@ -1,29 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "mips", - deps = { "mach/mips/as+astables" } -} - -build_mcg { - name = "mcg", - arch = "mips", -} - -build_top { - name = "top", - arch = "mips", -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/linuxmips/as"] = "+as", - ["$(PLATDEP)/linuxmips/mcg"] = "+mcg", - ["$(PLATDEP)/linuxmips/top"] = "+top", - ["$(PLATIND)/descr/linuxmips"] = "./descr", - "util/amisc+aelflod-pkg", - "util/opt+pkg", - } -} diff --git a/plat/linuxmips/include/build.lua b/plat/linuxmips/include/build.lua deleted file mode 100644 index 747e52089a..0000000000 --- a/plat/linuxmips/include/build.lua +++ /dev/null @@ -1,4 +0,0 @@ -installable { - name = "pkg", - map = { "plat/linux/include+pkg" } -} diff --git a/plat/linuxmips/libsys/build.lua b/plat/linuxmips/libsys/build.lua deleted file mode 100644 index 462f687fca..0000000000 --- a/plat/linuxmips/libsys/build.lua +++ /dev/null @@ -1,36 +0,0 @@ -acklibrary { - name = "lib", - srcs = { - "./_syscall.s", - "plat/linux/libsys/_exit.c", - "plat/linux/libsys/_hol0.s", - "plat/linux/libsys/close.c", - "plat/linux/libsys/creat.c", - "plat/linux/libsys/execve.c", - "plat/linux/libsys/fork.c", - "plat/linux/libsys/getpid.c", - "plat/linux/libsys/gettimeofday.c", - "plat/linux/libsys/ioctl.c", - "plat/linux/libsys/isatty.c", - "plat/linux/libsys/kill.c", - "plat/linux/libsys/lseek.c", - "plat/linux/libsys/open.c", - "plat/linux/libsys/read.c", - "plat/linux/libsys/sbrk.c", - "plat/linux/libsys/signal.c", - "plat/linux/libsys/sigprocmask.c", - "plat/linux/libsys/unlink.c", - "plat/linux/libsys/wait.c", - "plat/linux/libsys/waitpid.c", - "plat/linux/libsys/write.c", - }, - deps = { - "plat/linux/libsys+headers", - "lang/cem/libcc.ansi/headers+headers", - "plat/linuxmips/include+pkg", - }, - vars = { - plat = "linuxmips" - } -} - diff --git a/plat/linuxppc/build-pkg.lua b/plat/linuxppc/build-pkg.lua deleted file mode 100644 index cac205ea39..0000000000 --- a/plat/linuxppc/build-pkg.lua +++ /dev/null @@ -1,25 +0,0 @@ -include("plat/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { plat = "linuxppc" } -} - -build_plat_libs { - name = "libs", - arch = "powerpc", - plat = "linuxppc", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "./include+pkg", - ["$(PLATIND)/linuxppc/boot.o"] = "+boot", - ["$(PLATIND)/linuxppc/libsys.a"] = "./libsys+lib", - } -} - diff --git a/plat/linuxppc/build-tools.lua b/plat/linuxppc/build-tools.lua deleted file mode 100644 index ef9afb38e9..0000000000 --- a/plat/linuxppc/build-tools.lua +++ /dev/null @@ -1,34 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "powerpc", -} - -build_mcg { - name = "mcg", - arch = "powerpc", -} - -build_ncg { - name = "ncg", - arch = "powerpc", -} - -build_top { - name = "top", - arch = "powerpc", -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/linuxppc/as"] = "+as", - ["$(PLATDEP)/linuxppc/ncg"] = "+ncg", - --["$(PLATDEP)/linuxppc/mcg"] = "+mcg", - ["$(PLATDEP)/linuxppc/top"] = "+top", - ["$(PLATIND)/descr/linuxppc"] = "./descr", - "util/amisc+aelflod-pkg", - "util/opt+pkg", - } -} diff --git a/plat/linuxppc/emu/build.lua b/plat/linuxppc/emu/build.lua deleted file mode 100644 index 0f19e59d88..0000000000 --- a/plat/linuxppc/emu/build.lua +++ /dev/null @@ -1,31 +0,0 @@ -normalrule { - name = "dispatcher", - ins = { - "./mkdispatcher.lua", - "./instructions.dat" - }, - outleaves = { - "dispatcher.h" - }, - commands = { - "$(LUA) %{ins[1]} < %{ins[2]} > %{outs}" - } -} - -clibrary { - name = "dispatcher_lib", - srcs = {}, - hdrs = { "+dispatcher" } -} - -cprogram { - name = "emuppc", - srcs = { - "./emu.c", - "./main.c", - }, - deps = { - "+dispatcher_lib" - } -} - diff --git a/plat/linuxppc/include/build.lua b/plat/linuxppc/include/build.lua deleted file mode 100644 index 747e52089a..0000000000 --- a/plat/linuxppc/include/build.lua +++ /dev/null @@ -1,4 +0,0 @@ -installable { - name = "pkg", - map = { "plat/linux/include+pkg" } -} diff --git a/plat/linuxppc/libsys/build.lua b/plat/linuxppc/libsys/build.lua deleted file mode 100644 index be5658cd29..0000000000 --- a/plat/linuxppc/libsys/build.lua +++ /dev/null @@ -1,38 +0,0 @@ -acklibrary { - name = "lib", - srcs = { - "./_syscall.s", - "./sigaction.s", - "./signal.c", - "plat/linux/libsys/_exit.c", - "plat/linux/libsys/_hol0.s", - "plat/linux/libsys/close.c", - "plat/linux/libsys/creat.c", - "plat/linux/libsys/fork.c", - "plat/linux/libsys/execve.c", - "plat/linux/libsys/getpid.c", - "plat/linux/libsys/gettimeofday.c", - "plat/linux/libsys/ioctl.c", - "plat/linux/libsys/isatty.c", - "plat/linux/libsys/kill.c", - "plat/linux/libsys/lseek.c", - "plat/linux/libsys/open.c", - "plat/linux/libsys/read.c", - "plat/linux/libsys/sbrk.c", - -- omit signal.c - "plat/linux/libsys/sigprocmask.c", - "plat/linux/libsys/unlink.c", - "plat/linux/libsys/wait.c", - "plat/linux/libsys/waitpid.c", - "plat/linux/libsys/write.c", - }, - deps = { - "plat/linux/libsys+headers", - "lang/cem/libcc.ansi/headers+headers", - "plat/linuxppc/include+pkg", - }, - vars = { - plat = "linuxppc" - } -} - diff --git a/plat/linuxppc/tests/build.lua b/plat/linuxppc/tests/build.lua deleted file mode 100644 index fe89558a69..0000000000 --- a/plat/linuxppc/tests/build.lua +++ /dev/null @@ -1,10 +0,0 @@ -include("tests/plat/build.lua") - -plat_testsuite { - name = "tests", - plat = "linuxppc", - method = "plat/linuxppc/emu+emuppc", - skipsets = { - "long-long", - }, -} diff --git a/plat/minix/include/build.lua b/plat/minix/include/build.lua deleted file mode 100644 index 54138b3417..0000000000 --- a/plat/minix/include/build.lua +++ /dev/null @@ -1,36 +0,0 @@ -include("plat/build.lua") - -headermap = {} -packagemap = {} - -local function addheader(h) - headermap[h] = "plat/minix/include/"..h - packagemap["$(PLATIND)/minix/include/"..h] = "plat/minix/include/"..h -end - --- addheader("unistd.h") -addheader("ansi.h") -addheader("ack/fcntl.h") -addheader("ack/signal.h") -addheader("ack/limits.h") -addheader("minix/callnr.h") -addheader("minix/const.h") -addheader("minix/type.h") -addheader("minix/com.h") -addheader("utime.h") -addheader("sgtty.h") -addheader("sys/dir.h") -addheader("sys/types.h") -addheader("sys/errno.h") -addheader("sys/stat.h") -addheader("sys/wait.h") - -acklibrary { - name = "headers", - hdrs = headermap -} - -installable { - name = "pkg", - map = packagemap -} diff --git a/plat/minix68k/build-pkg.lua b/plat/minix68k/build-pkg.lua deleted file mode 100644 index bbe8a1cbeb..0000000000 --- a/plat/minix68k/build-pkg.lua +++ /dev/null @@ -1,25 +0,0 @@ -include("plat/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { plat = "minix68k" } -} - -build_plat_libs { - name = "libs", - arch = "m68k2", - plat = "minix68k", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "./include+pkg", - ["$(PLATIND)/minix68k/boot.o"] = "+boot", - ["$(PLATIND)/minix68k/libsys.a"] = "./libsys+lib", - } -} - diff --git a/plat/minix68k/build-tools.lua b/plat/minix68k/build-tools.lua deleted file mode 100644 index dbe127a075..0000000000 --- a/plat/minix68k/build-tools.lua +++ /dev/null @@ -1,25 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "m68k2", -} - -build_ncg { - name = "ncg", - arch = "m68020", - vars = { - ["+cflags"] = "-DWORD_SIZE=2 -DTBL68000=1" - } -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/minix68k/as"] = "+as", - ["$(PLATDEP)/minix68k/ncg"] = "+ncg", - ["$(PLATDEP)/minix68k/cv"] = "plat/minix68k/cv+cv", - ["$(PLATIND)/descr/minix68k"] = "./descr", - "util/opt+pkg", - } -} diff --git a/plat/minix68k/cv/build.lua b/plat/minix68k/cv/build.lua deleted file mode 100644 index 2ee9190d62..0000000000 --- a/plat/minix68k/cv/build.lua +++ /dev/null @@ -1,9 +0,0 @@ -cprogram { - name = "cv", - srcs = { "./cv.c" }, - deps = { - "h+emheaders", - "modules/src/data+lib", - "modules/src/object+lib" - } -} diff --git a/plat/minix68k/include/build.lua b/plat/minix68k/include/build.lua deleted file mode 100644 index e78fb08691..0000000000 --- a/plat/minix68k/include/build.lua +++ /dev/null @@ -1,27 +0,0 @@ -include("plat/build.lua") - -headermap = { - "plat/minix/include+headers", -} -packagemap = { - "plat/minix/include+pkg", -} - -local function addheader(h) - headermap[h] = "./"..h - packagemap["$(PLATIND)/minix68k/include/"..h] = "./"..h -end - -addheader("ack/plat.h") -addheader("minix/config.h") -addheader("a.out.h") - -acklibrary { - name = "headers", - hdrs = headermap -} - -installable { - name = "pkg", - map = packagemap -} diff --git a/plat/minix68k/libsys/build.lua b/plat/minix68k/libsys/build.lua deleted file mode 100644 index 34de855cb4..0000000000 --- a/plat/minix68k/libsys/build.lua +++ /dev/null @@ -1,142 +0,0 @@ -acklibrary { - name = "lib", - srcs = { - "./_access.c", - "./access.s", - "./_alarm.c", - "./alarm.s", - "./_brk.c", - "./brk.s", - "./call.c", - "./_chdir.c", - "./chdir.s", - "./_chmod.c", - "./chmod.s", - "./_chown.c", - "./chown.s", - "./_chroot.c", - "./chroot.s", - "./cleanup.c", - "./_close.c", - "./close.s", - "./_creat.c", - "./creat.s", - "./_dup2.c", - "./dup2.s", - "./_dup.c", - "./dup.s", - "./errno.c", - "./_exec.c", - "./_execn.c", - "./_execnl.c", - "./execnl.s", - "./execn.s", - "./exec.s", - "./_exit.c", - "./exit.c", - "./_fcntl.c", - "./fcntl.s", - "./_fork.c", - "./fork.s", - "./fpathconf.c", - "./_fstat.c", - "./fstat.s", - "./_getcwd.c", - "./getcwd.s", - "./_getegid.c", - "./getegid.s", - "./_geteuid.c", - "./geteuid.s", - "./_getgid.c", - "./getgid.s", - "./_getpid.c", - "./getpid.s", - "./_getppid.c", - "./getppid.s", - "./_getuid.c", - "./getuid.s", - "./_gtty.c", - "./gtty.s", - "./head_em.s", - "./_ioctl.c", - "./ioctl.s", - "./isatty.c", - "./_kill.c", - "./kill.s", - "./_link.c", - "./link.s", - "./_lseek.c", - "./lseek.s", - "./message.c", - "./_mkdir.c", - "./mkdir.s", - "./_mkfifo.c", - "./mkfifo.s", - "./_mknod4.c", - "./mknod4.s", - "./_mknod.c", - "./mknod.s", - "./_mount.c", - "./mount.s", - "./_open.c", - "./open.s", - "./pathconf.c", - "./_pause.c", - "./pause.s", - "./_pipe.c", - "./pipe.s", - "./_ptrace.c", - "./ptrace.s", - "./_read.c", - "./read.s", - "./_rename.c", - "./rename.s", - "./_rmdir.c", - "./rmdir.s", - "./_setgid.c", - "./setgid.s", - "./_setuid.c", - "./setuid.s", - "./_signal.c", - "./signal.s", - "./_stat.c", - "./stat.s", - "./stbrksz.s", - "./stcatch.s", - "./_stime.c", - "./stime.s", - "./_stsndrec.s", - "./stsndrec.s", - "./_stty.c", - "./stty.s", - "./_sync.c", - "./sync.s", - "./syslib.c", - "./_time.c", - "./time.s", - "./_times.c", - "./times.s", - "./_umask.c", - "./umask.s", - "./_umount.c", - "./umount.s", - "./_unlink.c", - "./unlink.s", - "./_utime.c", - "./utime.s", - "./vectab.c", - "./_wait.c", - "./wait.s", - "./_write.c", - "./write.s", - }, - deps = { - "lang/cem/libcc.ansi/headers+headers", - "plat/minix68k/include+headers", - "./lib.h", - }, - vars = { - plat = "minix68k" - } -} - diff --git a/plat/msdos/include/build.lua b/plat/msdos/include/build.lua deleted file mode 100644 index 6ae4800418..0000000000 --- a/plat/msdos/include/build.lua +++ /dev/null @@ -1,24 +0,0 @@ -include("plat/build.lua") - -headermap = {} -packagemap = {} - -local function addheader(h) - headermap[h] = "./"..h - packagemap["$(PLATIND)/msdos86/include/"..h] = "./"..h -end - -addheader("ack/plat.h") -addheader("sys/types.h") - -acklibrary { - name = "headers", - hdrs = headermap -} - -installable { - name = "pkg", - map = packagemap -} - - diff --git a/plat/msdos/libsys/build.lua b/plat/msdos/libsys/build.lua deleted file mode 100644 index d808fe8949..0000000000 --- a/plat/msdos/libsys/build.lua +++ /dev/null @@ -1,28 +0,0 @@ -bundle { - name = "srcs", - srcs = { - "./creat.c", - "./gettimeofday.c", - "./kill.c", - "./lseek.c", - "./open.c", - "./read.c", - "./setmode.c", - "./signal.c", - "./sys_fdmodes.c", - "./sys_getmode.c", - "./sys_initmain.c", - "./sys_iseof.c", - "./sys_seteof.c", - "./sys_seterrno.c", - "./sys_setmode.c", - "./write.c", - } -} - -bundle { - name = "headers", - srcs = { - "./libsys.h" - } -} diff --git a/plat/msdos386/build-pkg.lua b/plat/msdos386/build-pkg.lua deleted file mode 100644 index 8b3195afb9..0000000000 --- a/plat/msdos386/build-pkg.lua +++ /dev/null @@ -1,53 +0,0 @@ -include("plat/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { plat = "msdos386" } -} - -ackfile { - name = "stub", - srcs = { "./stub.s" }, - deps = { "plat/msdos386/libsys+headers" }, - vars = { plat = "msdos386" } -} - -normalrule { - name = "stub_aout", - ins = { - "util/led+led", - "+stub" - }, - outleaves = { "stub.aout" }, - commands = { "%{ins[1]} %{ins[2]} -o %{outs[1]}" } -} - -normalrule { - name = "stub_exe", - ins = { - "util/amisc+aslod", - "+stub_aout" - }, - outleaves = { "stub.exe" }, - commands = { "%{ins[1]} %{ins[2]} %{outs[1]}" } -} - -build_plat_libs { - name = "libs", - arch = "i386", - plat = "msdos386", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "./include+pkg", - ["$(PLATIND)/msdos386/boot.o"] = "+boot", - ["$(PLATIND)/msdos386/stub.exe"] = "+stub_exe", - ["$(PLATIND)/msdos386/libsys.a"] = "./libsys+lib", - } -} - diff --git a/plat/msdos386/build-tools.lua b/plat/msdos386/build-tools.lua deleted file mode 100644 index 8a9707cec1..0000000000 --- a/plat/msdos386/build-tools.lua +++ /dev/null @@ -1,22 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "i386", -} - -build_ncg { - name = "ncg", - arch = "i386", -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/msdos386/as"] = "+as", - ["$(PLATDEP)/msdos386/ncg"] = "+ncg", - ["$(PLATIND)/descr/msdos386"] = "./descr", - "util/opt+pkg", - "util/amisc+aslod-pkg", - } -} diff --git a/plat/msdos386/include/build.lua b/plat/msdos386/include/build.lua deleted file mode 100644 index 693abd0c12..0000000000 --- a/plat/msdos386/include/build.lua +++ /dev/null @@ -1,24 +0,0 @@ -include("plat/build.lua") - -headermap = {} -packagemap = {} - -local function addheader(h) - headermap[h] = "./"..h - packagemap["$(PLATIND)/msdos386/include/"..h] = "./"..h -end - -addheader("ack/plat.h") -addheader("sys/types.h") - -acklibrary { - name = "headers", - hdrs = headermap -} - -installable { - name = "pkg", - map = packagemap -} - - diff --git a/plat/msdos386/libsys/build.lua b/plat/msdos386/libsys/build.lua deleted file mode 100644 index e972365e60..0000000000 --- a/plat/msdos386/libsys/build.lua +++ /dev/null @@ -1,44 +0,0 @@ -bundle { - name = "headers", - srcs = { - "./libsysasm.h" - } -} - -acklibrary { - name = "lib", - srcs = { - "./_hol0.s", - "./brk.s", - "./close.s", - "./errno.s", - "./getpid.s", - "./isatty.s", - "./rename.s", - "./sbrk.c", - "./sys_cpyin.s", - "./sys_cpyout.s", - "./sys_dpmidos.s", - "./sys_exists.s", - "./sys_getdate.s", - "./sys_gettime.s", - "./sys_isopen.s", - "./sys_isreadyr.s", - "./sys_rawcreat.s", - "./sys_rawlseek.s", - "./sys_rawopen.s", - "./sys_rawread.s", - "./sys_rawwrite.s", - "./sys_scpyout.s", - "./sys_xret.s", - "./unlink.s", - "plat/msdos/libsys+srcs", - }, - deps = { - "plat/msdos/libsys+headers", - "+headers" - }, - vars = { - plat = "msdos386" - } -} diff --git a/plat/msdos86/build-pkg.lua b/plat/msdos86/build-pkg.lua deleted file mode 100644 index 29e141c4c5..0000000000 --- a/plat/msdos86/build-pkg.lua +++ /dev/null @@ -1,25 +0,0 @@ -include("plat/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { plat = "msdos86" } -} - -build_plat_libs { - name = "libs", - arch = "i86", - plat = "msdos86", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "./include+pkg", - ["$(PLATIND)/msdos86/boot.o"] = "+boot", - ["$(PLATIND)/msdos86/libsys.a"] = "./libsys+lib", - } -} - diff --git a/plat/msdos86/build-tools.lua b/plat/msdos86/build-tools.lua deleted file mode 100644 index 03e6010d26..0000000000 --- a/plat/msdos86/build-tools.lua +++ /dev/null @@ -1,22 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "i86", -} - -build_ncg { - name = "ncg", - arch = "i86", -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/msdos86/as"] = "+as", - ["$(PLATDEP)/msdos86/ncg"] = "+ncg", - ["$(PLATIND)/descr/msdos86"] = "./descr", - "util/opt+pkg", - "util/amisc+aslod-pkg", - } -} diff --git a/plat/msdos86/include/build.lua b/plat/msdos86/include/build.lua deleted file mode 100644 index 6ae4800418..0000000000 --- a/plat/msdos86/include/build.lua +++ /dev/null @@ -1,24 +0,0 @@ -include("plat/build.lua") - -headermap = {} -packagemap = {} - -local function addheader(h) - headermap[h] = "./"..h - packagemap["$(PLATIND)/msdos86/include/"..h] = "./"..h -end - -addheader("ack/plat.h") -addheader("sys/types.h") - -acklibrary { - name = "headers", - hdrs = headermap -} - -installable { - name = "pkg", - map = packagemap -} - - diff --git a/plat/msdos86/libsys/build.lua b/plat/msdos86/libsys/build.lua deleted file mode 100644 index 96988002da..0000000000 --- a/plat/msdos86/libsys/build.lua +++ /dev/null @@ -1,33 +0,0 @@ -acklibrary { - name = "lib", - srcs = { - "./brk.c", - "./close.s", - "./errno.s", - "./getpid.s", - "./_hol0.s", - "./isatty.s", - "./rename.s", - "./sys_exists.s", - "./sys_getdate.s", - "./sys_gettime.s", - "./sys_isopen.s", - "./sys_isreadyr.s", - "./sys_rawcreat.s", - "./sys_rawlseek.s", - "./sys_rawopen.s", - "./sys_rawrw.s", - "./sys_xret.s", - "./unlink.s", - "plat/msdos/libsys+srcs", - }, - deps = { - "lang/cem/libcc.ansi/headers+headers", - "plat/msdos86/include+headers", - "plat/msdos/libsys+headers", - }, - vars = { - plat = "msdos86" - } -} - diff --git a/plat/osx/cvmach/build.lua b/plat/osx/cvmach/build.lua deleted file mode 100644 index 8076546c19..0000000000 --- a/plat/osx/cvmach/build.lua +++ /dev/null @@ -1,15 +0,0 @@ -cprogram { - name = "cvmach", - srcs = { "./cvmach.c" }, - deps = { - "h+emheaders", - "modules/src/object+lib", - } -} - -installable { - name = "pkg", - map = { - ["$(PLATDEP)/cvmach"] = "+cvmach", - } -} diff --git a/plat/osx/include/build.lua b/plat/osx/include/build.lua deleted file mode 100644 index 78ac3246f4..0000000000 --- a/plat/osx/include/build.lua +++ /dev/null @@ -1,28 +0,0 @@ -include("plat/build.lua") - -headermap = {} -packagemap = {} - -local function addheader(h) - headermap[h] = "plat/osx/include/"..h - packagemap["$(PLATIND)/osx/include/"..h] = "plat/osx/include/"..h -end - -addheader("ack/plat.h") -addheader("ack/signal.h") -addheader("ack/fcntl.h") -addheader("sys/dirent.h") -addheader("sys/mman.h") -addheader("sys/stat.h") -addheader("sys/types.h") -addheader("sys/ioctl.h") - -acklibrary { - name = "headers", - hdrs = headermap -} - -installable { - name = "pkg", - map = packagemap -} diff --git a/plat/osx386/build-pkg.lua b/plat/osx386/build-pkg.lua deleted file mode 100644 index 6dfe1561c1..0000000000 --- a/plat/osx386/build-pkg.lua +++ /dev/null @@ -1,24 +0,0 @@ -include("plat/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { plat = "osx386" } -} - -build_plat_libs { - name = "libs", - arch = "i386", - plat = "osx386", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "plat/osx/include+pkg", - ["$(PLATIND)/osx386/boot.o"] = "+boot", - ["$(PLATIND)/osx386/libsys.a"] = "./libsys+lib", - } -} diff --git a/plat/osx386/build-tools.lua b/plat/osx386/build-tools.lua deleted file mode 100644 index a1a9a8e2b5..0000000000 --- a/plat/osx386/build-tools.lua +++ /dev/null @@ -1,22 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "i386", -} - -build_ncg { - name = "ncg", - arch = "i386", -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/osx386/as"] = "+as", - ["$(PLATDEP)/osx386/ncg"] = "+ncg", - ["$(PLATIND)/descr/osx386"] = "./descr", - "plat/osx/cvmach+pkg", - "util/opt+pkg", - } -} diff --git a/plat/osx386/include/build.lua b/plat/osx386/include/build.lua deleted file mode 100644 index c2a1050c25..0000000000 --- a/plat/osx386/include/build.lua +++ /dev/null @@ -1,4 +0,0 @@ -installable { - name = "pkg", - map = { "plat/osx/include+pkg" } -} diff --git a/plat/osx386/libsys/build.lua b/plat/osx386/libsys/build.lua deleted file mode 100644 index 3c2e96c3a1..0000000000 --- a/plat/osx386/libsys/build.lua +++ /dev/null @@ -1,36 +0,0 @@ -acklibrary { - name = "lib", - srcs = { - "./_exit.s", - "./close.s", - "./fstat.s", - "./getdirentries.s", - "./getpid.s", - "./gettimeofday.s", - "./ioctl.s", - "./kill.s", - "./lseek.s", - "./lstat.s", - "./mmap.s", - "./mprotect.s", - "./open.s", - "./read.s", - "./set_errno.s", - "./sigaction.s", - "./stat.s", - "./write.s", - "plat/linux/libsys/_hol0.s", - "plat/linux386/libsys/trapno.s", - "plat/osx/libsys/brk.c", - "plat/osx/libsys/creat.c", - "plat/osx/libsys/isatty.c", - "plat/osx/libsys/signal.c", - }, - deps = { - "lang/cem/libcc.ansi/headers+headers", - "plat/osx386/include+pkg", - }, - vars = { - plat = "osx386" - } -} diff --git a/plat/osxppc/build-pkg.lua b/plat/osxppc/build-pkg.lua deleted file mode 100644 index c94ad6ef0f..0000000000 --- a/plat/osxppc/build-pkg.lua +++ /dev/null @@ -1,24 +0,0 @@ -include("plat/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { plat = "osxppc" } -} - -build_plat_libs { - name = "libs", - arch = "powerpc", - plat = "osxppc", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "plat/osx/include+pkg", - ["$(PLATIND)/osxppc/boot.o"] = "+boot", - ["$(PLATIND)/osxppc/libsys.a"] = "./libsys+lib", - } -} diff --git a/plat/osxppc/build-tools.lua b/plat/osxppc/build-tools.lua deleted file mode 100644 index eddeea85ad..0000000000 --- a/plat/osxppc/build-tools.lua +++ /dev/null @@ -1,28 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "powerpc", -} - -build_ncg { - name = "ncg", - arch = "powerpc", -} - -build_top { - name = "top", - arch = "powerpc", -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/osxppc/as"] = "+as", - ["$(PLATDEP)/osxppc/ncg"] = "+ncg", - ["$(PLATDEP)/osxppc/top"] = "+top", - ["$(PLATIND)/descr/osxppc"] = "./descr", - "plat/osx/cvmach+pkg", - "util/opt+pkg", - } -} diff --git a/plat/osxppc/include/build.lua b/plat/osxppc/include/build.lua deleted file mode 100644 index 0fe204eced..0000000000 --- a/plat/osxppc/include/build.lua +++ /dev/null @@ -1,4 +0,0 @@ -installable { - name = "pkg", - map = { "plat/osx/include+pkg" } -} \ No newline at end of file diff --git a/plat/osxppc/libsys/build.lua b/plat/osxppc/libsys/build.lua deleted file mode 100644 index cff10f29b5..0000000000 --- a/plat/osxppc/libsys/build.lua +++ /dev/null @@ -1,35 +0,0 @@ -acklibrary { - name = "lib", - srcs = { - "./_exit.s", - "./close.s", - "./fstat.s", - "./getdirentries.s", - "./getpid.s", - "./gettimeofday.s", - "./ioctl.s", - "./kill.s", - "./lseek.s", - "./lstat.s", - "./mmap.s", - "./mprotect.s", - "./open.s", - "./read.s", - "./set_errno.s", - "./sigaction.s", - "./stat.s", - "./write.s", - "plat/linux/libsys/_hol0.s", - "plat/osx/libsys/brk.c", - "plat/osx/libsys/creat.c", - "plat/osx/libsys/isatty.c", - "plat/osx/libsys/signal.c", - }, - deps = { - "lang/cem/libcc.ansi/headers+headers", - "plat/osxppc/include+pkg", - }, - vars = { - plat = "osxppc" - } -} diff --git a/plat/pc86/build-pkg.lua b/plat/pc86/build-pkg.lua deleted file mode 100644 index b4ff7b7670..0000000000 --- a/plat/pc86/build-pkg.lua +++ /dev/null @@ -1,25 +0,0 @@ -include("plat/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { plat = "pc86" } -} - -build_plat_libs { - name = "libs", - arch = "i86", - plat = "pc86", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "./include+pkg", - ["$(PLATIND)/pc86/boot.o"] = "+boot", - ["$(PLATIND)/pc86/libsys.a"] = "./libsys+lib", - } -} - diff --git a/plat/pc86/build-tools.lua b/plat/pc86/build-tools.lua deleted file mode 100644 index fbb34bd3af..0000000000 --- a/plat/pc86/build-tools.lua +++ /dev/null @@ -1,21 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "i86", -} - -build_ncg { - name = "ncg", - arch = "i86", -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/pc86/as"] = "+as", - ["$(PLATDEP)/pc86/ncg"] = "+ncg", - ["$(PLATIND)/descr/pc86"] = "./descr", - "util/opt+pkg", - } -} diff --git a/plat/pc86/emu/build.lua b/plat/pc86/emu/build.lua deleted file mode 100644 index c8a970861d..0000000000 --- a/plat/pc86/emu/build.lua +++ /dev/null @@ -1,27 +0,0 @@ -clibrary { - name = "x86emu", - vars = { - ["+cflags"] = {"-Iplat/pc86/emu/x86emu", "-DDEBUG"} - }, - srcs = { - "./x86emu/debug.c", - "./x86emu/decode.c", - "./x86emu/fpu.c", - "./x86emu/ops2.c", - "./x86emu/ops.c", - "./x86emu/prim_ops.c", - "./x86emu/sys.c", - } -} - -cprogram { - name = "pc86emu", - srcs = {"./main.c"}, - vars = { - ["+cflags"] = {"-Iplat/pc86/emu/x86emu", "-DDEBUG"} - }, - deps = { - "+x86emu" - } -} - diff --git a/plat/pc86/include/build.lua b/plat/pc86/include/build.lua deleted file mode 100644 index 3ae81836ab..0000000000 --- a/plat/pc86/include/build.lua +++ /dev/null @@ -1,24 +0,0 @@ -include("plat/build.lua") - -headermap = {} -packagemap = {} - -local function addheader(h) - headermap[h] = "./"..h - packagemap["$(PLATIND)/pc86/include/"..h] = "./"..h -end - -addheader("ack/plat.h") -addheader("sys/types.h") - -acklibrary { - name = "headers", - hdrs = headermap -} - -installable { - name = "pkg", - map = packagemap -} - - diff --git a/plat/pc86/libsys/build.lua b/plat/pc86/libsys/build.lua deleted file mode 100644 index 285db8f126..0000000000 --- a/plat/pc86/libsys/build.lua +++ /dev/null @@ -1,29 +0,0 @@ -acklibrary { - name = "lib", - srcs = { - "./brk.c", - "./close.c", - "./creat.c", - "./errno.s", - "./getpid.c", - "./_hol0.s", - "./isatty.c", - "./kill.c", - "./lseek.c", - "./open.c", - "./read.c", - "./signal.c", - "./_sys_rawread.s", - "./_sys_rawwrite.s", - "./time.c", - "./write.c", - }, - deps = { - "lang/cem/libcc.ansi/headers+headers", - "plat/pc86/include+headers", - }, - vars = { - plat = "pc86" - } -} - diff --git a/plat/pc86/tests/build.lua b/plat/pc86/tests/build.lua deleted file mode 100644 index e4d8286fe7..0000000000 --- a/plat/pc86/tests/build.lua +++ /dev/null @@ -1,11 +0,0 @@ -include("tests/plat/build.lua") - -plat_testsuite { - name = "tests", - plat = "pc86", - method = "plat/pc86/emu+pc86emu", - skipsets = { - "floats", -- FPU instructions not supported by emulator - "long-long", - }, -} diff --git a/plat/pdpv7/build-pkg.lua b/plat/pdpv7/build-pkg.lua deleted file mode 100644 index 4afe82dc72..0000000000 --- a/plat/pdpv7/build-pkg.lua +++ /dev/null @@ -1,25 +0,0 @@ -include("plat/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { plat = "pdpv7" } -} - -build_plat_libs { - name = "libs", - arch = "pdp", - plat = "pdpv7", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "./include+pkg", - ["$(PLATIND)/pdpv7/boot.o"] = "+boot", - ["$(PLATIND)/pdpv7/libsys.a"] = "./libsys+lib", - } -} - diff --git a/plat/pdpv7/build-tools.lua b/plat/pdpv7/build-tools.lua deleted file mode 100644 index 353ae49c9f..0000000000 --- a/plat/pdpv7/build-tools.lua +++ /dev/null @@ -1,28 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "pdp", -} - -build_cg { - name = "cg", - arch = "pdp", -} - -build_top { - name = "top", - arch = "pdp" -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/pdpv7/as"] = "+as", - ["$(PLATDEP)/pdpv7/cg"] = "+cg", - ["$(PLATDEP)/pdpv7/cv"] = "mach/pdp/cv+cv", - ["$(PLATDEP)/pdpv7/top"] = "+top", - ["$(PLATIND)/descr/pdpv7"] = "./descr", - "util/opt+pkg", - } -} diff --git a/plat/pdpv7/cv/build.lua b/plat/pdpv7/cv/build.lua deleted file mode 100644 index 58df93b430..0000000000 --- a/plat/pdpv7/cv/build.lua +++ /dev/null @@ -1,8 +0,0 @@ -cprogram { - name = "cv", - srcs = { "./cv.c" }, - deps = { - "h+emheaders", - "modules/src/object+lib", - } -} diff --git a/plat/pdpv7/include/build.lua b/plat/pdpv7/include/build.lua deleted file mode 100644 index f785644b42..0000000000 --- a/plat/pdpv7/include/build.lua +++ /dev/null @@ -1,26 +0,0 @@ -include("plat/build.lua") - -headermap = {} -packagemap = {} - -local function addheader(h) - headermap[h] = "./"..h - packagemap["$(PLATIND)/pdpv7/include/"..h] = "./"..h -end - -addheader("ack/plat.h") -addheader("sys/select.h") -addheader("sys/types.h") -addheader("termios.h") - -acklibrary { - name = "headers", - hdrs = headermap -} - -installable { - name = "pkg", - map = packagemap -} - - diff --git a/plat/pdpv7/libsys/build.lua b/plat/pdpv7/libsys/build.lua deleted file mode 100644 index ae51150f98..0000000000 --- a/plat/pdpv7/libsys/build.lua +++ /dev/null @@ -1,95 +0,0 @@ -acklibrary { - name = "lib", - srcs = { - "./access.s", - "./acct.s", - "./alarm.s", - "./chdir.s", - "./chmod.s", - "./chown.s", - "./chroot.s", - "./cleanup.c", - "./close.s", - "./creat.s", - "./dup.s", - "./errno.s", - "./execle.s", - "./execl.s", - "./execve.s", - "./execv.s", - "./exit.c", - "./_exit.s", - "./fetchi.s", - "./fork.s", - "./fperr.s", - "./fstat.s", - "./ftime.s", - "./getgid.s", - "./getgrp.s", - "./getpid.s", - "./getppid.s", - "./getuid.s", - "./gldav.s", - "./gtty.c", - "./ioctl.s", - "./isatty.c", - "./killbkg.s", - "./killpg.s", - "./kill.s", - "./link.s", - "./lock.s", - "./login.s", - "./lseek.s", - "./lstat.s", - "./mknod.s", - "./mount.s", - "./mpxcall.s", - "./nice.s", - "./nostk.s", - "./open.s", - "./pause.s", - "./phys.s", - "./pipe.s", - "./profil.s", - "./ptrace.s", - "./qfstat.s", - "./qstat.s", - "./quota.s", - "./readlink.s", - "./read.s", - "./reboot.s", - "./renice.s", - "./rtp.s", - "./sbrk.s", - "./setgid.s", - "./setgrp.s", - "./setuid.s", - "./signal.s", - "./stat.s", - "./stime.s", - "./stty.c", - "./submit.s", - "./symlink.s", - "./sync.s", - "./time.s", - "./times.s", - "./ucall.s", - "./umask.s", - "./umount.s", - "./unlink.s", - "./utime.s", - "./vfork.s", - "./vhangup.s", - "./wait.s", - "./write.s", - }, - deps = { - "lang/cem/libcc.ansi/headers+headers", - "plat/pdpv7/include+headers", - }, - vars = { - plat = "pdpv7" - } -} - --- /tmp/ack-build/staging/lib/ack/cpp.ansi -D__unix -I/tmp/ack-build/obj/lang/cem/libcc.ansi/headers/headers -I/tmp/ack-build/obj/plat/rpi/include/headers -D__vc4 -D__rpi -D__ACK -I/tmp/ack-build/staging/share/ack/rpi/include -I/tmp/ack-build/staging/share/ack/include/ansi -Dvc4 -DEM_WSIZE=4 -DEM_PSIZE=4 -DEM_SSIZE=2 -DEM_LSIZE=4 -DEM_FSIZE=4 -DEM_DSIZE=4 -D_EM_WSIZE=4 -D_EM_PSIZE=4 -D_EM_SSIZE=2 -D_EM_LSIZE=4 -D_EM_FSIZE=4 -D_EM_DSIZE=4 plat/rpi/libsys/pi_user_to_phys.s diff --git a/plat/qemuppc/build-pkg.lua b/plat/qemuppc/build-pkg.lua deleted file mode 100644 index 0478bbd4db..0000000000 --- a/plat/qemuppc/build-pkg.lua +++ /dev/null @@ -1,26 +0,0 @@ -include("plat/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { plat = "qemuppc" } -} - -build_plat_libs { - name = "libs", - arch = "powerpc", - plat = "qemuppc", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "./include+pkg", - "util/amisc+aslod-pkg", - ["$(PLATIND)/qemuppc/boot.o"] = "+boot", - ["$(PLATIND)/qemuppc/libsys.a"] = "./libsys+lib", - } -} - diff --git a/plat/qemuppc/build-tools.lua b/plat/qemuppc/build-tools.lua deleted file mode 100644 index e4f3f534bc..0000000000 --- a/plat/qemuppc/build-tools.lua +++ /dev/null @@ -1,33 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "powerpc", -} - -build_mcg { - name = "mcg", - arch = "powerpc", -} - -build_ncg { - name = "ncg", - arch = "powerpc", -} - -build_top { - name = "top", - arch = "powerpc", -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/qemuppc/as"] = "+as", - ["$(PLATDEP)/qemuppc/ncg"] = "+ncg", - ["$(PLATDEP)/qemuppc/mcg"] = "+mcg", - ["$(PLATDEP)/qemuppc/top"] = "+top", - ["$(PLATIND)/descr/qemuppc"] = "./descr", - "util/opt+pkg", - } -} diff --git a/plat/qemuppc/include/build.lua b/plat/qemuppc/include/build.lua deleted file mode 100644 index 896043e63a..0000000000 --- a/plat/qemuppc/include/build.lua +++ /dev/null @@ -1,24 +0,0 @@ -include("plat/build.lua") - -headermap = {} -packagemap = {} - -local function addheader(h) - headermap[h] = "./"..h - packagemap["$(PLATIND)/qemuppc/include/"..h] = "./"..h -end - -addheader("ack/plat.h") -addheader("sys/ioctl.h") -addheader("unistd.h") - -acklibrary { - name = "headers", - hdrs = headermap -} - -installable { - name = "pkg", - map = packagemap -} - diff --git a/plat/qemuppc/libsys/build.lua b/plat/qemuppc/libsys/build.lua deleted file mode 100644 index 7281bbc619..0000000000 --- a/plat/qemuppc/libsys/build.lua +++ /dev/null @@ -1,16 +0,0 @@ -acklibrary { - name = "lib", - srcs = { - "./*.s", - "./*.c", - }, - deps = { - "lang/cem/libcc.ansi/headers+headers", - "plat/qemuppc/include+headers", - "mach/powerpc/libem+headers_qemuppc", - }, - vars = { - plat = "qemuppc" - } -} - \ No newline at end of file diff --git a/plat/qemuppc/tests/build.lua b/plat/qemuppc/tests/build.lua deleted file mode 100644 index 6581d93efb..0000000000 --- a/plat/qemuppc/tests/build.lua +++ /dev/null @@ -1,7 +0,0 @@ -include("tests/plat/build.lua") - -plat_testsuite { - name = "tests", - plat = "qemuppc", - method = "qemu-system-ppc" -} diff --git a/plat/rpi/build-pkg.lua b/plat/rpi/build-pkg.lua deleted file mode 100644 index b6bc4ab56a..0000000000 --- a/plat/rpi/build-pkg.lua +++ /dev/null @@ -1,25 +0,0 @@ -include("plat/build.lua") - -ackfile { - name = "boot", - srcs = { "./boot.s" }, - vars = { plat = "rpi" } -} - -build_plat_libs { - name = "libs", - arch = "vc4", - plat = "rpi", -} - -installable { - name = "pkg", - map = { - "+tools", - "+libs", - "./include+pkg", - ["$(PLATIND)/rpi/boot.o"] = "+boot", - ["$(PLATIND)/rpi/libsys.a"] = "./libsys+lib", - } -} - diff --git a/plat/rpi/build-tools.lua b/plat/rpi/build-tools.lua deleted file mode 100644 index 831d929951..0000000000 --- a/plat/rpi/build-tools.lua +++ /dev/null @@ -1,22 +0,0 @@ -include("plat/build.lua") - -build_as { - name = "as", - arch = "vc4", -} - -build_ncg { - name = "ncg", - arch = "vc4", -} - -return installable { - name = "tools", - map = { - ["$(PLATDEP)/rpi/as"] = "+as", - ["$(PLATDEP)/rpi/ncg"] = "+ncg", - ["$(PLATIND)/descr/rpi"] = "./descr", - "util/opt+pkg", - "util/amisc+aslod-pkg", - } -} diff --git a/plat/rpi/include/build.lua b/plat/rpi/include/build.lua deleted file mode 100644 index e568b6a5e5..0000000000 --- a/plat/rpi/include/build.lua +++ /dev/null @@ -1,27 +0,0 @@ -include("plat/build.lua") - -headermap = {} -packagemap = {} - -local function addheader(h) - headermap[h] = "./"..h - packagemap["$(PLATIND)/rpi/include/"..h] = "./"..h -end - -addheader("ack/plat.h") -addheader("pi.h") -addheader("sys/select.h") -addheader("sys/types.h") -addheader("termios.h") - -acklibrary { - name = "headers", - hdrs = headermap -} - -installable { - name = "pkg", - map = packagemap -} - - diff --git a/plat/rpi/libsys/build.lua b/plat/rpi/libsys/build.lua deleted file mode 100644 index 114df87513..0000000000 --- a/plat/rpi/libsys/build.lua +++ /dev/null @@ -1,34 +0,0 @@ -acklibrary { - name = "lib", - srcs = { - "./brk.c", - "./close.c", - "./creat.c", - "./errno.s", - "./getpid.c", - "./_hol0.s", - "./isatty.c", - "./kill.c", - "./lseek.c", - "./open.c", - "./pi_fast_mode.s", - "./pi_phys_to_user.s", - "./pi_uart.s", - "./pi_user_to_phys.s", - "./read.c", - "./select.c", - "./signal.c", - "./tcgetattr.c", - "./tcsetattr.c", - "./time.c", - "./write.c", - }, - deps = { - "lang/cem/libcc.ansi/headers+headers", - "plat/rpi/include+headers", - }, - vars = { - plat = "rpi" - } -} - diff --git a/tests/plat/bugs/build.lua b/tests/plat/bugs/build.lua deleted file mode 100644 index bb0dbdfd06..0000000000 --- a/tests/plat/bugs/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -bundle { - name = "srcs", - srcs = { - "./bug-157-i80-varargs_c.c", - "./bug-164-faddrn_c.c", - "./bug-203-ego-sr_c-O3.c", - "./bug-22-inn_mod.mod", - "./bug-62-notvar_var_e.c", - "./bug-310-cpp-no-trailing-newline_c.c", - } -} - - diff --git a/tests/plat/build.lua b/tests/plat/build.lua deleted file mode 100644 index d95e554a6b..0000000000 --- a/tests/plat/build.lua +++ /dev/null @@ -1,95 +0,0 @@ - -include("plat/build.lua") - -definerule("plat_testsuite", - { - plat = { type="string" }, - method = { type="string" }, - -- added bugs/bug-203-ego-sr_c-O3.c - sets = { type="table", default={"core", "bugs", "m2", "floats", "long-long"}}, - skipsets = { type="table", default={}}, - tests = { type="targets", default={} }, - }, - function(e) - -- Remember this is executed from the caller's directory; local - -- target names will resolve there. - local testfiles = filenamesof(e.tests) - local skipsets = {} - for _, set in ipairs(e.skipsets) do - skipsets[set] = true - end - for _, set in ipairs(e.sets) do - if not skipsets[set] then - local fs = filenamesof("tests/plat/"..set.."+srcs") - for _, f in ipairs(fs) do - testfiles[#testfiles+1] = f - end - end - end - - acklibrary { - name = "lib", - srcs = { - "tests/plat/lib/test.c", - }, - hdrs = { - "tests/plat/lib/test.h", - "tests/plat/lib/Test.def" - }, - vars = { plat = e.plat }, - } - - local tests = {} - for _, f in ipairs(testfiles) do - local fs = replace(basename(f), "%.[^.]+$", "") - local _, _, lang = fs:find("_([^_]+)$") - if not lang then - lang = "e" - end - - -- If lang is "c-O3", then build with -O3. - local _, _, optimize = lang:find("(-O[^-]*)$") - if optimize then - lang = lang:sub(1, -1 - #optimize) - else - optimize = "-O0" - end - - local bin = ackprogram { - name = fs.."_bin", - srcs = { f }, - deps = { "+lib" }, - vars = { - plat = e.plat, - lang = lang, - ackcflags = optimize.." -Bmain" - } - } - - local methoddep = nil - local methodpath = e.method - if e.method:find("%+") then - methoddep = e.method - methodpath = "%{ins[4]}" - end - tests[#tests+1] = normalrule { - name = fs, - outleaves = { e.plat.."-"..fs.."-testlog.txt" }, - ins = { - bin, - "tests/plat/testdriver.sh", - "util/build+testrunner", - methoddep, - }, - commands = { - "%{ins[2]} "..methodpath.." %{ins[1]} 15 %{ins[3]} > %{outs}; true", - } - } - end - - return bundle { - name = e.name, - srcs = tests, - } - end -) diff --git a/tests/plat/core/build.lua b/tests/plat/core/build.lua deleted file mode 100644 index f6a60cf902..0000000000 --- a/tests/plat/core/build.lua +++ /dev/null @@ -1,42 +0,0 @@ -bundle { - name = "srcs", - srcs = { - "./aar_e.e", - "./and_e.e", - "./andv_e.e", - "./brk_c.c", - "./bss_e.c", - "./calloc_c.c", - "./cii_e.e", - "./cmi_e.e", - "./cms_e.e", - "./cmu_e.e", - "./csa_e.c", - "./csb_e.c", - "./_dummy_e.c", - "./dup_e.e", - "./exg_e.e", - "./inn_e.e", - "./intadd_e.c", - "./intcmp_e.c", - "./intdiv_e.c", - "./intrem_e.c", - "./intshift_e.c", - "./intsub_e.c", - "./ior_e.e", - "./iorv_e.e", - "./lar_e.e", - "./newdispose_p.p", - "./pascalsets_p.p", - "./rck_e.e", - "./rotate_e.e", - "./sar_e.e", - "./set_e.e", - "./setjmp_c.c", - "./structcopy_e.c", - "./xor_e.e", - "./xorv_e.e", - } -} - - diff --git a/tests/plat/floats/build.lua b/tests/plat/floats/build.lua deleted file mode 100644 index 066bc32ded..0000000000 --- a/tests/plat/floats/build.lua +++ /dev/null @@ -1,12 +0,0 @@ -bundle { - name = "srcs", - srcs = { - "./doublecmp_e.c", - "./from_d_to_si_e.c", - "./from_d_to_ui_e.c", - "./from_si_to_d_e.c", - "./from_ui_to_d_e.c", - } -} - - diff --git a/tests/plat/lib/build.lua b/tests/plat/lib/build.lua deleted file mode 100644 index bdfa15edc4..0000000000 --- a/tests/plat/lib/build.lua +++ /dev/null @@ -1,7 +0,0 @@ -bundle { - name = "srcs", - srcs = { - } -} - - diff --git a/tests/plat/long-long/build.lua b/tests/plat/long-long/build.lua deleted file mode 100644 index e1fb5f3b11..0000000000 --- a/tests/plat/long-long/build.lua +++ /dev/null @@ -1,15 +0,0 @@ -bundle { - name = "srcs", - srcs = { - "./lladdsub_e.c", - "./llbitset_e.c", - "./llcmp_e.c", - "./llconvert_e.c", - "./lldivrem_e.c", - "./llmul_e.c", - "./llshift_e.c", - "./llswitch_e.c", - } -} - - diff --git a/tests/plat/m2/build.lua b/tests/plat/m2/build.lua deleted file mode 100644 index c212d5f5cb..0000000000 --- a/tests/plat/m2/build.lua +++ /dev/null @@ -1,13 +0,0 @@ -bundle { - name = "srcs", - srcs = { - "./ConvTest_mod.mod", - "./NestProc_mod.mod", - "./OpenArray_mod.mod", - "./SemaTest_mod.mod", - "./Set100_mod.mod", - "./StringTest_mod.mod", - } -} - - diff --git a/util/LLgen/build.lua b/util/LLgen/build.lua deleted file mode 100644 index 533d10b8e5..0000000000 --- a/util/LLgen/build.lua +++ /dev/null @@ -1,90 +0,0 @@ -clibrary { - name = "headers", - hdrs = { - "./src/cclass.h", - "./src/extern.h", - "./src/fileio.h", - "./src/Lpars.h", - "./src/sets.h", - "./src/types.h", - } -} - -cprogram { - name = "llgen", - - -- These use pre-LLgen'd versions of LLgen.c, Lpars.c, Lpars.h, and - -- tokens.c. If LLgen.g or tokens.g gets updated, they need - -- rebuilding. Use the bootstrap target to do this. - - srcs = { - "./src/LLgen.c", - "./src/Lpars.c", - "./src/alloc.c", - "./src/cclass.c", - "./src/check.c", - "./src/compute.c", - "./src/gencode.c", - "./src/global.c", - "./src/machdep.c", - "./src/main.c", - "./src/name.c", - "./src/reach.c", - "./src/savegram.c", - "./src/sets.c", - "./src/tokens.c", - "./src/utils.c", - }, - deps = { "+headers" }, - vars = { - ["+cflags"] = { - "-DLIBDIR=\\\""..cwd().."/lib\\\"", - "-DNON_CORRECTING" - }, - } -} - --- This bootstrap target rebuilds LLgen's own parser with LLgen. --- It acts like ./bootstrap.sh but without installing LLgen in PATH. -normalrule { - name = "bootstrap", - ins = "+llgen", - outleaves = { "phony" }, - commands = { - "cd %{abspath(cwd()..\"/src\")}", - "%{abspath(ins)} -vvv -x tokens.g LLgen.g", - "echo", - "echo You should now be able to rebuild LLgen with the new parser.", - } -} - -definerule("llgen", - { - srcs = { type="targets" }, - }, - function(e) - -- Remember this is executed from the caller's directory; local - -- target names will resolve there - local fs = replace(basename(filenamesof(e.srcs)), "%.g$", "") - - return normalrule { - name = e.name, - cwd = e.cwd, - outleaves = { - "Lpars.c", - "Lpars.h", - replace(fs, "$", ".c") - }, - ins = { - "util/LLgen+llgen", - e.srcs, - }, - vars = { - srcs = e.srcs - }, - commands = { - "rm -f %{outs} && %{ins[1]} -o%{dirname(outs[1])} %{srcs}" - } - } - end -) diff --git a/util/ack/build.lua b/util/ack/build.lua deleted file mode 100644 index cd865332b2..0000000000 --- a/util/ack/build.lua +++ /dev/null @@ -1,56 +0,0 @@ -cprogram { - name = "mktables", - srcs = { "./mktables.c" }, -} - -normalrule { - name = "tables", - outleaves = { "dmach.c", "intable.c" }, - ins = { - "+mktables", - "lib/descr/fe", - }, - commands = { - "(cd %{dir} && %{abspath(ins[1])} lib)" - } -} - -cprogram { - name = "ack", - srcs = { - "./data.c", - "./files.c", - "./grows.c", - "./list.c", - "./main.c", - "./rmach.c", - "./run.c", - "./scan.c", - "./svars.c", - "./trans.c", - "./util.c", - "+tables", - }, - deps = { - "h+emheaders", - "h+local", - "modules/src/data+lib", - "modules/src/system+lib", - "./ack.h", - "./data.h", - "./dmach.h", - "./grows.h", - "./list.h", - "./trans.h", - } -} - -installable { - name = "pkg", - map = { - ["$(INSDIR)/bin/ack"] = "+ack", - ["$(INSDIR)/share/man/man1/ack.1"] = "./ack.1.X", - ["$(PLATIND)/descr/fe"] = "lib/descr/fe", - } -} - diff --git a/util/amisc/build.lua b/util/amisc/build.lua deleted file mode 100644 index e06bf83a16..0000000000 --- a/util/amisc/build.lua +++ /dev/null @@ -1,41 +0,0 @@ -local function simpleprogram(name) - cprogram { - name = name, - srcs = { "./"..name..".c" }, - deps = { - "h+emheaders", - "modules/src/alloc+lib", - "modules/src/data+lib", - "modules/src/object+lib", - "modules/src/system+lib", - } - } - - installable { - name = name.."-pkg", - map = { - ["$(INSDIR)/bin/"..name] = "+"..name, - ["$(INSDIR)/share/man/man1/"..name..".1"] = "./"..name..".1", - } - } -end - -simpleprogram("aelflod") -simpleprogram("anm") -simpleprogram("ashow") -simpleprogram("asize") -simpleprogram("aslod") -simpleprogram("astrip") - -installable { - name = "pkg", - map = { - "+aelflod-pkg", - "+anm-pkg", - "+ashow-pkg", - "+asize-pkg", - "+aslod-pkg", - "+astrip-pkg", - } -} - diff --git a/util/arch/build.lua b/util/arch/build.lua deleted file mode 100644 index 83ec95cb66..0000000000 --- a/util/arch/build.lua +++ /dev/null @@ -1,22 +0,0 @@ -cprogram { - name = "aal", - srcs = { "./archiver.c" }, - deps = { - "h+emheaders", - "modules/src/data+lib", - "modules/src/object+lib", - "modules/src/string+lib", - "modules/src/system+lib" - }, - vars = { - ["+cflags"] = "-DAAL" - } -} - -installable { - name = "pkg", - map = { - ["$(INSDIR)/bin/aal"] = "+aal", - ["$(INSDIR)/share/man/man1/aal.1"] = "./aal.1" - } -} diff --git a/util/ass/build.lua b/util/ass/build.lua deleted file mode 100644 index f46668cc86..0000000000 --- a/util/ass/build.lua +++ /dev/null @@ -1,65 +0,0 @@ -cprogram { - name = "maktab", - srcs = { - "./maktab.c" - }, - deps = { - "h+emheaders", - "modules/src/em_data+lib", - } -} - -normalrule { - name = "asstb", - ins = { - "+maktab", - "etc/ip_spec.t" - }, - outleaves = { - "asstb.c" - }, - commands = { - "%{ins} %{outs}" - } -} - -cprogram { - name = "em_ass", - srcs = { - "./ass00.c", - "./ass30.c", - "./ass40.c", - "./ass50.c", - "./ass60.c", - "./ass70.c", - "./ass80.c", - "./assci.c", - "./asscm.c", - "./assda.c", - "./assrl.c", - "+asstb", - }, - deps = { - "h+emheaders", - "h+local", - --"modules/src/alloc+lib", - "modules/src/em_data+lib", - "modules/src/data+lib", - --"modules/src/object+lib", - "modules/src/system+lib", - "./ass00.h", - "./assci.h", - "./asscm.h", - "./assex.h", - "./assrl.h", - } -} - -installable { - name = "pkg", - map = { - ["$(PLATDEP)/em_ass"] = "+em_ass", - ["$(INSDIR)/share/man/man6/em_ass.6"] = "./em_ass.6", - } -} - diff --git a/util/build/build.lua b/util/build/build.lua deleted file mode 100644 index 41bd0b6ad2..0000000000 --- a/util/build/build.lua +++ /dev/null @@ -1,8 +0,0 @@ -cprogram { - name = "testrunner", - srcs = { "./testrunner.c" }, - deps = { - "modules/src/data+lib" - } -} - diff --git a/util/cgg/build.lua b/util/cgg/build.lua deleted file mode 100644 index 186583d5cd..0000000000 --- a/util/cgg/build.lua +++ /dev/null @@ -1,62 +0,0 @@ -include("first/bison.lua") - -local cggparser = bison { - name = "cggparser", - srcs = { "./bootgram.y" } -} - -local cgglexer = flex { - name = "cgglexer", - srcs = { "./bootlex.l" } -} - -cprogram { - name = "cgg", - srcs = concat( - "./main.c", - matching(filenamesof(cggparser), "%.c$"), - matching(filenamesof(cgglexer), "%.c$") - ), - deps = { - "./booth.h", - "+cggparser", -- for .h file - "+cgglexer", -- for .h file - "h+emheaders", - "modules/src/em_data+lib", - } -} - -definerule("cgg", - { - srcs = { type="targets" } - }, - function(e) - -- Remember this is executed from the caller's directory; local - -- target names will resolve there - if (#e.srcs ~= 1) then - error("you must supply exactly one input file") - end - - local cpptable = cppfile { - name = e.name.."/cpptable", - outleaf = "cpptable", - srcs = e.srcs - } - - return normalrule { - name = e.name, - cwd = e.cwd, - outleaves = { - "tables.c", - "tables.h", - }, - ins = { - "util/cgg+cgg", - cpptable - }, - commands = { - "cd %{dir} && %{ins}", - } - } - end -) diff --git a/util/cmisc/build.lua b/util/cmisc/build.lua deleted file mode 100644 index d1767959e1..0000000000 --- a/util/cmisc/build.lua +++ /dev/null @@ -1,31 +0,0 @@ -cprogram { - name = "tabgen", - srcs = { "./tabgen.c" } -} - -definerule("tabgen", - { - srcs = { type="targets" }, - }, - function(e) - local symname = basename(filenamesof(e.srcs)[1]):gsub("%.tab$", "") - - return normalrule { - name = e.name, - ins = { - "util/cmisc+tabgen", - e.srcs - }, - outleaves = { symname..".c" }, - commands = { - "%{ins[1]} -f%{ins[2]} > %{outs}" - } - } - end -) - -cprogram { - name = "objectify", - srcs = { "./objectify.c" } -} - diff --git a/util/ego/build.lua b/util/ego/build.lua deleted file mode 100644 index 5ddf2d2adc..0000000000 --- a/util/ego/build.lua +++ /dev/null @@ -1,303 +0,0 @@ -local function build_ego(name) - cprogram { - name = name, - srcs = { "./"..name.."/*.c" }, - deps = { - "./"..name.."/*.h", - "util/ego/share+lib", - "modules/src/em_data+lib", - "h+emheaders", - }, - vars = { - ["+cflags"] = {"-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"} - } - } -end - -cprogram { - name = "bo", - srcs = { - "./bo/bo.c", - }, - deps = { - "util/ego/share+lib", - "modules/src/em_data+lib", - "h+emheaders", - }, - vars = { - ["+cflags"] = {"-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"} - } -} - -cprogram { - name = "ca", - srcs = { - "./ca/ca.c", - "./ca/ca_put.c", - }, - deps = { - "./ca/ca.h", - "./ca/ca_put.h", - "util/ego/share+lib", - "modules/src/em_data+lib", - "modules/src/data+lib", - "modules/src/system+lib", - "h+emheaders", - }, - vars = { - ["+cflags"] = {"-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"} - } -} - -cprogram { - name = "cf", - srcs = { - "./cf/cf.c", - "./cf/cf_idom.c", - "./cf/cf_loop.c", - "./cf/cf_succ.c", - - }, - deps = { - "./cf/cf.h", - "./cf/cf_idom.h", - "./cf/cf_loop.h", - "./cf/cf_succ.h", - "util/ego/share+lib", - "modules/src/em_data+lib", - "h+emheaders", - }, - vars = { - ["+cflags"] = {"-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"} - } -} - -cprogram { - name = "cj", - srcs = { - "./cj/cj.c", - }, - deps = { - "util/ego/share+lib", - "modules/src/em_data+lib", - "h+emheaders", - }, - vars = { - ["+cflags"] = {"-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"} - } -} - -cprogram { - name = "cs", - srcs = { - "./cs/cs_alloc.c", - "./cs/cs_aux.c", - "./cs/cs_avail.c", - "./cs/cs.c", - "./cs/cs_debug.c", - "./cs/cs_elim.c", - "./cs/cs_entity.c", - "./cs/cs_getent.c", - "./cs/cs_kill.c", - "./cs/cs_partit.c", - "./cs/cs_profit.c", - "./cs/cs_stack.c", - "./cs/cs_vnm.c", - }, - deps = { - "./cs/cs_alloc.h", - "./cs/cs_aux.h", - "./cs/cs_avail.h", - "./cs/cs_debug.h", - "./cs/cs_elim.h", - "./cs/cs_entity.h", - "./cs/cs_getent.h", - "./cs/cs.h", - "./cs/cs_kill.h", - "./cs/cs_partit.h", - "./cs/cs_profit.h", - "./cs/cs_stack.h", - "./cs/cs_vnm.h", - "util/ego/share+lib", - "modules/src/em_data+lib", - "h+emheaders", - }, - vars = { - ["+cflags"] = {"-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"} - } -} - -cprogram { - name = "ic", - srcs = { - "./ic/ic_aux.c", - "./ic/ic.c", - "./ic/ic_io.c", - "./ic/ic_lib.c", - "./ic/ic_lookup.c", - }, - deps = { - "./ic/ic_aux.h", - "./ic/ic.h", - "./ic/ic_io.h", - "./ic/ic_lib.h", - "./ic/ic_lookup.h", - "util/ego/share+lib", - "modules/src/em_data+lib", - "h+emheaders", - }, - vars = { - ["+cflags"] = {"-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"} - } -} - -cprogram { - name = "il", - srcs = { - "./il/il1_anal.c", - "./il/il1_aux.c", - "./il/il1_cal.c", - "./il/il1_formal.c", - "./il/il2_aux.c", - "./il/il3_aux.c", - "./il/il3_change.c", - "./il/il3_subst.c", - "./il/il_aux.c", - "./il/il.c", - }, - deps = { - "./il/il1_anal.h", - "./il/il1_aux.h", - "./il/il1_cal.h", - "./il/il1_formal.h", - "./il/il2_aux.h", - "./il/il3_aux.h", - "./il/il3_change.h", - "./il/il3_subst.h", - "./il/il_aux.h", - "./il/il.h", - "util/ego/share+lib", - "modules/src/em_data+lib", - "modules/src/data+lib", - "modules/src/system+lib", - "h+emheaders", - }, - vars = { - ["+cflags"] = {"-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"} - } -} - -cprogram { - name = "lv", - srcs = { - "./lv/lv.c", - }, - deps = { - "./lv/lv.h", - "util/ego/share+lib", - "modules/src/em_data+lib", - "h+emheaders", - }, - vars = { - ["+cflags"] = {"-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"} - } -} - -cprogram { - name = "sp", - srcs = { - "./sp/sp.c", - }, - deps = { - "util/ego/share+lib", - "modules/src/em_data+lib", - "h+emheaders", - }, - vars = { - ["+cflags"] = {"-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"} - } -} - -cprogram { - name = "sr", - srcs = { - "./sr/sr_aux.c", - "./sr/sr.c", - "./sr/sr_cand.c", - "./sr/sr_expr.c", - "./sr/sr_iv.c", - "./sr/sr_reduce.c", - "./sr/sr_xform.c", - }, - deps = { - "./sr/sr_aux.h", - "./sr/sr_cand.h", - "./sr/sr_expr.h", - "./sr/sr.h", - "./sr/sr_iv.h", - "./sr/sr_reduce.h", - "./sr/sr_xform.h", - "util/ego/share+lib", - "modules/src/em_data+lib", - "h+emheaders", - }, - vars = { - ["+cflags"] = {"-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"} - } -} - -cprogram { - name = "ud", - srcs = { - "./ud/ud_aux.c", - "./ud/ud.c", - "./ud/ud_const.c", - "./ud/ud_copy.c", - "./ud/ud_defs.c", - }, - deps = { - "./ud/ud_aux.h", - "./ud/ud_const.h", - "./ud/ud_copy.h", - "./ud/ud_defs.h", - "./ud/ud.h", - "util/ego/share+lib", - "modules/src/em_data+lib", - "h+emheaders", - }, - vars = { - ["+cflags"] = {"-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"} - } -} - -cprogram { - name = "em_ego", - srcs = { "./em_ego/em_ego.c" }, - deps = { - "modules/src/string+lib", - "modules/src/system+lib", - "modules/src/data+lib", - "modules+headers", - "h+emheaders", - } -} - -installable { - name = "pkg", - map = { - ["$(PLATDEP)/em_ego"] = "+em_ego", - ["$(PLATDEP)/ego/bo"] = "+bo", - ["$(PLATDEP)/ego/ca"] = "+ca", - ["$(PLATDEP)/ego/cf"] = "+cf", - ["$(PLATDEP)/ego/cj"] = "+cj", - ["$(PLATDEP)/ego/cs"] = "+cs", - ["$(PLATDEP)/ego/ic"] = "+ic", - ["$(PLATDEP)/ego/il"] = "+il", - ["$(PLATDEP)/ego/lv"] = "+lv", - ["$(PLATDEP)/ego/ra"] = "./ra+ra", - ["$(PLATDEP)/ego/sp"] = "+sp", - ["$(PLATDEP)/ego/sr"] = "+sr", - ["$(PLATDEP)/ego/ud"] = "+ud", - "./descr+pkg", - } -} diff --git a/util/ego/descr/build.lua b/util/ego/descr/build.lua deleted file mode 100644 index e9a008cc51..0000000000 --- a/util/ego/descr/build.lua +++ /dev/null @@ -1,31 +0,0 @@ -local installmap = {} - -local function build_descr(name) - local descr = normalrule { - name = name, - ins = { - "lang/cem/cpp.ansi+cpp", - "./"..name..".descr", - "./descr.sed", - matching(filenamesof("modules/src/em_data+lib"), "em_mnem%.h$"), - }, - outleaves = { name..".descr" }, - commands = { - "%{ins[1]} -P -I%{dirname(ins[4])} %{ins[2]} > %{dir}/temp", - "sed -f %{ins[3]} < %{dir}/temp > %{outs}" - } - } - - installmap["$(PLATIND)/ego/"..name..".descr"] = descr -end - -build_descr("i386") -build_descr("i86") -build_descr("m68020") -build_descr("powerpc") - -installable { - name = "pkg", - map = installmap -} - diff --git a/util/ego/ra/build.lua b/util/ego/ra/build.lua deleted file mode 100644 index 21a149110e..0000000000 --- a/util/ego/ra/build.lua +++ /dev/null @@ -1,51 +0,0 @@ -cprogram { - name = "makeitems", - srcs = { "./makeitems.c" } -} - -normalrule { - name = "itemtab_h", - ins = { - "+makeitems", - matching(filenamesof("modules/src/em_data+lib"), "em_mnem%.h$"), - "./itemtab.src" - }, - outleaves = { "itemtab.h" }, - commands = { - "%{ins} > %{outs}" - } -} - -cprogram { - name = "ra", - srcs = { - "./ra_allocl.c", - "./ra_aux.c", - "./ra.c", - "./ra_interv.c", - "./ra_items.c", - "./ra_lifet.c", - "./ra_pack.c", - "./ra_profits.c", - "./ra_xform.c", - }, - deps = { - "util/ego/share+lib", - "modules/src/em_data+lib", - "h+emheaders", - "+itemtab_h", - "./ra_allocl.h", - "./ra_aux.h", - "./ra.h", - "./ra_interv.h", - "./ra_items.h", - "./ra_lifet.h", - "./ra_pack.h", - "./ra_profits.h", - "./ra_xform.h", - }, - vars = { - ["+cflags"] = {"-DVERBOSE", "-DNOTCOMPACT"} - } -} - diff --git a/util/ego/share/build.lua b/util/ego/share/build.lua deleted file mode 100644 index bc3fda27fc..0000000000 --- a/util/ego/share/build.lua +++ /dev/null @@ -1,76 +0,0 @@ -cprogram { - name = "makecldef", - srcs = { "./makecldef.c" } -} - -normalrule { - name = "classdefs_h", - ins = { - "+makecldef", - matching(filenamesof("modules/src/em_data+lib"), "em_mnem%.h$"), - "./cldefs.src" - }, - outleaves = { "classdefs.h" }, - commands = { - "%{ins} > %{outs}" - } -} - -normalrule { - name = "pop_push_h", - ins = { - "./pop_push.awk", - "h/em_table", - }, - outleaves = { "pop_push.h" }, - commands = { - "awk -f %{ins[1]} < %{ins[2]} > %{outs}" - } -} - -clibrary { - name = "lib", - srcs = { - "./debug.c", - "./global.c", - "./files.c", - "./go.c", - "./map.c", - "./utils.c", - "./get.c", - "./put.c", - "./alloc.c", - "./lset.c", - "./cset.c", - "./parser.c", - "./stack_chg.c", - "./locals.c", - "./init_glob.c", - }, - deps = { - "./alloc.h", - "./cset.h", - "./debug.h", - "./def.h", - "./files.h", - "./get.h", - "./global.h", - "./go.h", - "./init_glob.h", - "./locals.h", - "./lset.h", - "./map.h", - "./parser.h", - "./put.h", - "./stack_chg.h", - "./types.h", - "./utils.h", - "+classdefs_h", - "+pop_push_h", - "h+emheaders", - "modules/src/em_data+lib", - }, - vars = { - ["+cflags"] = {"-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"} - } -} diff --git a/util/int/build.lua b/util/int/build.lua deleted file mode 100644 index f1b5264f7c..0000000000 --- a/util/int/build.lua +++ /dev/null @@ -1,149 +0,0 @@ -normalrule { - name = "trap_msg", - ins = { - "./M.trap_msg", - "etc/traps" - }, - outleaves = {"trap_msg"}, - commands = { - "%{ins} > %{outs}" - } -} - -normalrule { - name = "warn_msg", - ins = { - "./M.warn_msg", - "etc/traps" - }, - outleaves = {"warn_msg"}, - commands = { - "%{ins} > %{outs}" - } -} - -normalrule { - name = "warn_h", - ins = { - "./M.warn_h", - "doc/int/appA" -- there's a 1991 comment saying this needs to be moved - }, - outleaves = {"warn.h"}, - commands = { - "%{ins} > %{outs}" - } -} - -cprogram { - name = "mkiswitch", - srcs = {"./switch/mkiswitch.c"}, - deps = { - "h+emheaders", - "modules/src/em_data+lib", - } -} - -normalrule { - name = "docases", - ins = { - "+mkiswitch", - "etc/ip_spec.t" - }, - outleaves = {"DoCases"}, - commands = { - "%{ins[1]} Do %{ins[2]} %{outs}" - } -} - -cprogram { - name = "mkswitch", - srcs = {"./switch/mkswitch.c"} -} - -normalrule { - name = "prcases", - ins = { - "+mkswitch", - "etc/ip_spec.t" - }, - outleaves = {"PrCases"}, - commands = { - "%{ins[1]} Pr %{ins[2]} %{outs}" - } -} - -clibrary { - name = "generated", - srcs = {}, - hdrs = { - "+warn_msg", - "+trap_msg", - "+warn_h", - "+docases", - "+prcases", - } -} - -cprogram { - name = "int", - srcs = { - "./alloc.c", - "./core.c", - "./data.c", - "./disassemble.c", - "./do_array.c", - "./do_branch.c", - "./do_comp.c", - "./do_conv.c", - "./do_fpar.c", - "./do_incdec.c", - "./do_intar.c", - "./do_load.c", - "./do_logic.c", - "./do_misc.c", - "./do_proc.c", - "./do_ptrar.c", - "./do_sets.c", - "./do_store.c", - "./do_unsar.c", - "./dump.c", - "./fra.c", - "./global.c", - "./init.c", - "./io.c", - "./log.c", - "./main.c", - "./m_ioctl.c", - "./moncalls.c", - "./monstruct.c", - "./m_sigtrp.c", - "./proctab.c", - "./read.c", - "./rsb.c", - "./segment.c", - "./stack.c", - "./switch.c", - "./tally.c", - "./text.c", - "./trap.c", - "./warn.c", - }, - deps = { - "h+emheaders", - "+generated", - "modules/src/em_data+lib", - }, - vars = { - ["+cflags"] = {"-Wno-implicit-int"} - } -} - -installable { - name = "pkg", - map = { - ["$(INSDIR)/bin/int"] = "+int", - ["$(INSDIR)/share/man/man1/int.1"] = "./int.1", - } -} - - diff --git a/util/led/build.lua b/util/led/build.lua deleted file mode 100644 index d4a2e6a060..0000000000 --- a/util/led/build.lua +++ /dev/null @@ -1,37 +0,0 @@ -cprogram -{ - name = "led", - srcs = { - "./archive.c", - "./error.c", - "./extract.c", - "./finish.c", - "./main.c", - "./memory.c", - "./output.c", - "./read.c", - "./relocate.c", - "./save.c", - "./scan.c", - "./sym.c", - "./write.c", - }, - deps = { - "./archive.h", "./const.h", "./debug.h", "./defs.h", - "./error.h", "./extract.h", "./finish.h", "./mach.h", - "./memory.h", "./orig.h", "./output.h", "./relocate.h", - "./save.h", "./scan.h", "./sym.h", "./write.h", - "modules/src/string+lib", - "modules/src/object+lib", - "h+emheaders", - } -} - -installable -{ - name = "pkg", map = { - ["$(INSDIR)/share/man/man5/ack.out.5"] = "./ack.out.5", - ["$(INSDIR)/share/man/man6/led.6"] = "./led.6", - ["$(PLATDEP)/em_led"] = "+led", - } -} diff --git a/util/mcgg/build.lua b/util/mcgg/build.lua deleted file mode 100644 index ef90683fdb..0000000000 --- a/util/mcgg/build.lua +++ /dev/null @@ -1,95 +0,0 @@ -include("first/bison.lua") - -flex { - name = "flex", - srcs = { - "./scan.l", - } -} - -bison { - name = "bison", - srcs = { - "./gram.y", - } -} - -normalrule { - name = "ircodes", - outleaves = { "ircodes-dyn.h", "ircodes.c" }, - ins = { - "./ircodes.sh", - "./ir.dat" - }, - commands = { - "%{ins[1]} %{ins[2]} %{outs[1]} %{outs[2]}" - } -} - -clibrary { - name = "lib", - srcs = { - matching(filenamesof("+ircodes"), "%.c$"), - }, - deps = { - "+ircodes", - "./ircodes.h" - }, - hdrs = { - matching(filenamesof("+ircodes"), "%.h$"), - "./ircodes.h", - "./mcgg.h" - } -} - -cprogram { - name = "mcgg", - srcs = { - "./iburg.c", - matching(filenamesof("+flex"), "%.c$"), - matching(filenamesof("+bison"), "%.c$") - }, - deps = { - "./iburg.h", - "+lib", - "+bison", - "modules/src/data+lib", - "modules+headers", - } -} - -definerule("mcgg", - { - srcs = { type="targets" } - }, - function(e) - -- Remember this is executed from the caller's directory; local - -- target names will resolve there - if (#e.srcs ~= 1) then - error("you must supply exactly one input file") - end - - local cpptable = cppfile { - name = e.name.."/cpptable", - outleaf = "cpptable", - srcs = e.srcs - } - - return normalrule { - name = e.name, - cwd = e.cwd, - outleaves = { - "tables.c", - "tables.h", - }, - ins = { - "util/mcgg+mcgg", - cpptable - }, - commands = { - "%{ins[1]} -i %{ins[2]} -o %{outs[1]} -h %{outs[2]}", - } - } - end -) - diff --git a/util/misc/build.lua b/util/misc/build.lua deleted file mode 100644 index 7b6b110677..0000000000 --- a/util/misc/build.lua +++ /dev/null @@ -1,45 +0,0 @@ -cprogram { - name = "esize", - srcs = { "./esize.c" }, -} - -cprogram { - name = "encode", - srcs = { "./convert.c" }, - deps = { - "h+emheaders", - "modules+headers", - "modules/src/alloc+lib", - "modules/src/em_code+lib_k", - "modules/src/read_em+lib_ev", - "modules/src/string+lib", - "modules/src/system+lib", - "modules/src/em_data+lib", - } -} - -cprogram { - name = "decode", - srcs = { "./convert.c" }, - deps = { - "h+emheaders", - "modules+headers", - "modules/src/alloc+lib", - "modules/src/em_code+lib_e", - "modules/src/read_em+lib_kv", - "modules/src/string+lib", - "modules/src/system+lib", - "modules/src/em_data+lib", - } -} - -installable { - name = "pkg", - map = { - ["$(PLATDEP)/em_encode"] = "+encode", - ["$(PLATDEP)/em_decode"] = "+decode", - ["$(INSDIR)/bin/esize"] = "+esize", - ["$(INSDIR)/share/man/man1/esize.1"] = "./esize.1", - ["$(INSDIR)/share/man/man6/em_decode.6"] = "./em_decode.6" - } -} diff --git a/util/ncgg/build.lua b/util/ncgg/build.lua deleted file mode 100644 index 08246624e8..0000000000 --- a/util/ncgg/build.lua +++ /dev/null @@ -1,94 +0,0 @@ -include("first/bison.lua") - -local cggparser = bison { - name = "cggparser", - srcs = { "./cgg.y" } -} - -local cgglexer = flex { - name = "cgglexer", - srcs = { "./scan.l" } -} - -normalrule { - name = "keywords", - ins = { - "./make_enterkeyw_c.lua", - "./keywords", - }, - outleaves = { "enterkeyw.c" }, - commands = { - "$(LUA) %{ins[1]} < %{ins[2]} > %{outs[1]}" - } -} - -cprogram { - name = "ncgg", - srcs = concat( - "./coerc.c", - "./emlookup.c", - "./error.c", - "./expr.c", - "./hall.c", - "./instruct.c", - "./iocc.c", - "./lookup.c", - "./main.c", - "./output.c", - "./set.c", - "./strlookup.c", - "./subr.c", - "./var.c", - matching(filenamesof(cggparser), "%.c$"), - matching(filenamesof(cgglexer), "%.c$"), - "+keywords" - ), - deps = { - "./cost.h", "./expr.h", "./extern.h", "./instruct.h", - "./iocc.h", "./lookup.h", "./param.h", "./property.h", - "./pseudo.h", "./reg.h", "./regvar.h", "./set.h", - "./token.h", "./varinfo.h", - "+cggparser", -- for .h file - "+cgglexer", -- for .h file - "h+emheaders", - "modules/src/em_data+lib", - } -} - -definerule("ncgg", - { - srcs = { type="targets" }, - deps = { type="table", default={} } - }, - function(e) - -- Remember this is executed from the caller's directory; local - -- target names will resolve there - if (#e.srcs ~= 1) then - error("you must supply exactly one input file") - end - - local cpptable = cppfile { - name = e.name.."/cpptable", - outleaf = "cpptable", - srcs = e.srcs, - deps = e.deps - } - - return normalrule { - name = e.name, - cwd = e.cwd, - outleaves = { - "tables.c", - "tables.h", - }, - ins = { - "util/ncgg+ncgg", - cpptable - }, - commands = { - "cd %{dir} && %{ins}", - "mv %{dir}/tables.H %{dir}/tables.h" - } - } - end -) diff --git a/util/opt/build.lua b/util/opt/build.lua deleted file mode 100644 index 780fdae8de..0000000000 --- a/util/opt/build.lua +++ /dev/null @@ -1,106 +0,0 @@ -include("first/bison.lua") - -bison { - name = "bison", - srcs = { "./mktab.y" } -} - -flex { - name = "flex", - srcs = { "./scan.l" } -} - -local headers = { - "./alloc.h", "./ext.h", "./getline.h", "./line.h", "./lookup.h", "./optim.h", - "./param.h", "./pattern.h", "./pop_push.h", "./proinf.h","./putline.h", - "./reg.h","./tes.h", "./types.h","./util.h" -} - -cprogram { - name = "mktab", - srcs = { - matching(filenamesof("+bison"), "%.c$"), - matching(filenamesof("+flex"), "%.c$"), - }, - deps = concat( - headers, - "+flex", - "+bison", - "modules/src/em_data+lib" - ) -} - -normalrule { - name = "pattern_c", - ins = { - "+mktab", - "./patterns", - "lang/cem/cpp.ansi+cpp" - }, - outleaves = { "pattern.c" }, - commands = { - "%{ins[3]} < %{ins[2]} | %{ins[1]} > %{outs}" - } -} - -normalrule { - name = "pop_push_c", - ins = { - "./pop_push.awk", - "h/em_table" - }, - outleaves = { "pop_push.c" }, - commands = { - "awk -f %{ins[1]} < %{ins[2]} > %{outs}" - } -} - -local function variant(name, cflags) - cprogram { - name = name, - srcs = { - "+pattern_c", - "+pop_push_c", - "./alloc.c", - "./backward.c", - "./cleanup.c", - "./flow.c", - "./getline.c", - "./lookup.c", - "./main.c", - "./peephole.c", - "./process.c", - "./putline.c", - "./reg.c", - "./special.c", - "./tes.c", - "./util.c", - "./var.c", - }, - deps = concat( - headers, - "h+emheaders", - "modules/src/alloc+lib", - "modules/src/string+lib", - "modules/src/system+lib", - "modules/src/data+lib", - "modules/src/em_data+lib" - ), - vars = { - ["+cflags"] = cflags - } - } -end - -variant("em_opt", {}) -variant("em_opt2", {"-DGLOBAL_OPT"}) - -installable { - name = "pkg", - map = { - ["$(PLATDEP)/em_opt"] = "+em_opt", - ["$(PLATDEP)/em_opt2"] = "+em_opt2", - ["$(INSDIR)/share/man/man6/em_opt.6"] = "./em_opt.6", - } -} - diff --git a/util/topgen/build.lua b/util/topgen/build.lua deleted file mode 100644 index d0ff6513f7..0000000000 --- a/util/topgen/build.lua +++ /dev/null @@ -1,49 +0,0 @@ -include("util/LLgen/build.lua") - -llgen { - name = "llgen", - srcs = { - "./topgen.g", - } -} - -cprogram { - name = "topgen", - srcs = { - "./hash.c", - "./LLlex.c", - "./main.c", - "./pattern.c", - "./symtab.c", - matching(filenamesof("+llgen"), "%.c$"), - }, - deps = { - "+llgen", - } -} - -definerule("topgen", - { - srcs = { type="targets" }, - }, - function(e) - -- Remember this is executed from the caller's directory; local - -- target names will resolve there - - return normalrule { - name = e.name, - outleaves = { - "gen.c", - "gen.h", - }, - ins = { - "util/topgen+topgen", - e.srcs, - }, - commands = { - "%{ins[1]} %{ins[2]} %{dir}" - } - } - end -) - From 1f012be25d5304742252210453026c18c8d52179 Mon Sep 17 00:00:00 2001 From: David Given Date: Wed, 9 Apr 2025 23:16:08 +0200 Subject: [PATCH 60/79] Only run the tests if we're not on Windows (because Windows doesn't have alarm()). --- build.py | 4 +++- build/config.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 build/config.py diff --git a/build.py b/build.py index 1d7ed2f71f..6263bde799 100644 --- a/build.py +++ b/build.py @@ -1,4 +1,5 @@ from build.ab import export +from build.config import IS_WINDOWS # This is the list of which plats to build. PLATS = [ @@ -53,6 +54,7 @@ export( name="all", deps=( - [".+compiler", "examples+all"] + [f"plat/{p}/tests" for p in TEST_PLATS] + [".+compiler", "examples+all"] + + ([] if IS_WINDOWS else [f"plat/{p}/tests" for p in TEST_PLATS]) ), ) diff --git a/build/config.py b/build/config.py new file mode 100644 index 0000000000..f859ee7bd7 --- /dev/null +++ b/build/config.py @@ -0,0 +1,4 @@ +import platform + +IS_WINDOWS = platform.system() == "Windows" + From 59be1474ee21e1c6642441941423581d67c20a5a Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 10 Apr 2025 19:41:40 +0200 Subject: [PATCH 61/79] Import a Dhrystone benchmark. --- examples/build.py | 9 + examples/dhry.h | 464 ++++++++++++++++++++++++ examples/dhry_1.c | 410 +++++++++++++++++++++ examples/dhry_2.c | 192 ++++++++++ lang/cem/libcc.ansi/headers/sys/times.h | 2 + 5 files changed, 1077 insertions(+) create mode 100644 examples/dhry.h create mode 100644 examples/dhry_1.c create mode 100644 examples/dhry_2.c diff --git a/examples/build.py b/examples/build.py index 304ea790c1..d03aa47c6e 100644 --- a/examples/build.py +++ b/examples/build.py @@ -49,6 +49,15 @@ exports = {} for plat, progs in PROGRAMS.items(): if plat in PLATS: + ackcprogram( + name=f"dhrystone_{plat}", + plat=plat, + lang="c", + srcs=["./dhry.h", "./dhry_1.c", "./dhry_2.c"], + cflags=["-O3", "-DTIME"], + ) + exports[f"$(PLATIND)/examples/dhrystone_{plat}.exe"] = f".+dhrystone_{plat}" + for prog in progs: fullname, *args = prog.split(",") name = fullname.replace(".", "_") diff --git a/examples/dhry.h b/examples/dhry.h new file mode 100644 index 0000000000..0651f063a2 --- /dev/null +++ b/examples/dhry.h @@ -0,0 +1,464 @@ +/* + **************************************************************************** + * + * "DHRYSTONE" Benchmark Program + * ----------------------------- + * + * Version: C, Version 2.1 + * + * File: dhry.h (part 1 of 3) + * + * Date: May 25, 1988 + * + * Author: Reinhold P. Weicker + * Siemens AG, E STE 35 + * Postfach 3240 + * 8520 Erlangen + * Germany (West) + * Phone: [xxx-49]-9131-7-20330 + * (8-17 Central European Time) + * Usenet: ..!mcvax!unido!estevax!weicker + * + * Original Version (in Ada) published in + * "Communications of the ACM" vol. 27., no. 10 (Oct. 1984), + * pp. 1013 - 1030, together with the statistics + * on which the distribution of statements etc. is based. + * + * In this C version, the following C library functions are used: + * - strcpy, strcmp (inside the measurement loop) + * - printf, scanf (outside the measurement loop) + * In addition, Berkeley UNIX system calls "times ()" or "time ()" + * are used for execution time measurement. For measurements + * on other systems, these calls have to be changed. + * + * Collection of Results: + * Reinhold Weicker (address see above) and + * + * Rick Richardson + * PC Research. Inc. + * 94 Apple Orchard Drive + * Tinton Falls, NJ 07724 + * Phone: (201) 389-8963 (9-17 EST) + * Usenet: ...!uunet!pcrat!rick + * + * Please send results to Rick Richardson and/or Reinhold Weicker. + * Complete information should be given on hardware and software used. + * Hardware information includes: Machine type, CPU, type and size + * of caches; for microprocessors: clock frequency, memory speed + * (number of wait states). + * Software information includes: Compiler (and runtime library) + * manufacturer and version, compilation switches, OS version. + * The Operating System version may give an indication about the + * compiler; Dhrystone itself performs no OS calls in the measurement loop. + * + * The complete output generated by the program should be mailed + * such that at least some checks for correctness can be made. + * + *************************************************************************** + * + * History: This version C/2.1 has been made for two reasons: + * + * 1) There is an obvious need for a common C version of + * Dhrystone, since C is at present the most popular system + * programming language for the class of processors + * (microcomputers, minicomputers) where Dhrystone is used most. + * There should be, as far as possible, only one C version of + * Dhrystone such that results can be compared without + * restrictions. In the past, the C versions distributed + * by Rick Richardson (Version 1.1) and by Reinhold Weicker + * had small (though not significant) differences. + * + * 2) As far as it is possible without changes to the Dhrystone + * statistics, optimizing compilers should be prevented from + * removing significant statements. + * + * This C version has been developed in cooperation with + * Rick Richardson (Tinton Falls, NJ), it incorporates many + * ideas from the "Version 1.1" distributed previously by + * him over the UNIX network Usenet. + * I also thank Chaim Benedelac (National Semiconductor), + * David Ditzel (SUN), Earl Killian and John Mashey (MIPS), + * Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley) + * for their help with comments on earlier versions of the + * benchmark. + * + * Changes: In the initialization part, this version follows mostly + * Rick Richardson's version distributed via Usenet, not the + * version distributed earlier via floppy disk by Reinhold Weicker. + * As a concession to older compilers, names have been made + * unique within the first 8 characters. + * Inside the measurement loop, this version follows the + * version previously distributed by Reinhold Weicker. + * + * At several places in the benchmark, code has been added, + * but within the measurement loop only in branches that + * are not executed. The intention is that optimizing compilers + * should be prevented from moving code out of the measurement + * loop, or from removing code altogether. Since the statements + * that are executed within the measurement loop have NOT been + * changed, the numbers defining the "Dhrystone distribution" + * (distribution of statements, operand types and locality) + * still hold. Except for sophisticated optimizing compilers, + * execution times for this version should be the same as + * for previous versions. + * + * Since it has proven difficult to subtract the time for the + * measurement loop overhead in a correct way, the loop check + * has been made a part of the benchmark. This does have + * an impact - though a very minor one - on the distribution + * statistics which have been updated for this version. + * + * All changes within the measurement loop are described + * and discussed in the companion paper "Rationale for + * Dhrystone version 2". + * + * Because of the self-imposed limitation that the order and + * distribution of the executed statements should not be + * changed, there are still cases where optimizing compilers + * may not generate code for some statements. To a certain + * degree, this is unavoidable for small synthetic benchmarks. + * Users of the benchmark are advised to check code listings + * whether code is generated for all statements of Dhrystone. + * + * Version 2.1 is identical to version 2.0 distributed via + * the UNIX network Usenet in March 1988 except that it corrects + * some minor deficiencies that were found by users of version 2.0. + * The only change within the measurement loop is that a + * non-executed "else" part was added to the "if" statement in + * Func_3, and a non-executed "else" part removed from Proc_3. + * + *************************************************************************** + * + * Defines: The following "Defines" are possible: + * -DREG=register (default: Not defined) + * As an approximation to what an average C programmer + * might do, the "register" storage class is applied + * (if enabled by -DREG=register) + * - for local variables, if they are used (dynamically) + * five or more times + * - for parameters if they are used (dynamically) + * six or more times + * Note that an optimal "register" strategy is + * compiler-dependent, and that "register" declarations + * do not necessarily lead to faster execution. + * -DNOSTRUCTASSIGN (default: Not defined) + * Define if the C compiler does not support + * assignment of structures. + * -DNOENUMS (default: Not defined) + * Define if the C compiler does not support + * enumeration types. + * -DTIMES (default) + * -DTIME + * The "times" function of UNIX (returning process times) + * or the "time" function (returning wallclock time) + * is used for measurement. + * For single user machines, "time ()" is adequate. For + * multi-user machines where you cannot get single-user + * access, use the "times ()" function. If you have + * neither, use a stopwatch in the dead of night. + * "printf"s are provided marking the points "Start Timer" + * and "Stop Timer". DO NOT use the UNIX "time(1)" + * command, as this will measure the total time to + * run this program, which will (erroneously) include + * the time to allocate storage (malloc) and to perform + * the initialization. + * -DDHRY_HZ=nnn + * In Berkeley UNIX, the function "times" returns process + * time in 1/HZ seconds, with HZ = 60 for most systems. + * CHECK YOUR SYSTEM DESCRIPTION BEFORE YOU JUST APPLY + * A VALUE. + * + *************************************************************************** + * + * Compilation model and measurement (IMPORTANT): + * + * This C version of Dhrystone consists of three files: + * - dhry.h (this file, containing global definitions and comments) + * - dhry_1.c (containing the code corresponding to Ada package Pack_1) + * - dhry_2.c (containing the code corresponding to Ada package Pack_2) + * + * The following "ground rules" apply for measurements: + * - Separate compilation + * - No procedure merging + * - Otherwise, compiler optimizations are allowed but should be indicated + * - Default results are those without register declarations + * See the companion paper "Rationale for Dhrystone Version 2" for a more + * detailed discussion of these ground rules. + * + * For 16-Bit processors (e.g. 80186, 80286), times for all compilation + * models ("small", "medium", "large" etc.) should be given if possible, + * together with a definition of these models for the compiler system used. + * + ************************************************************************** + * + * Dhrystone (C version) statistics: + * + * [Comment from the first distribution, updated for version 2. + * Note that because of language differences, the numbers are slightly + * different from the Ada version.] + * + * The following program contains statements of a high level programming + * language (here: C) in a distribution considered representative: + * + * assignments 52 (51.0 %) + * control statements 33 (32.4 %) + * procedure, function calls 17 (16.7 %) + * + * 103 statements are dynamically executed. The program is balanced with + * respect to the three aspects: + * + * - statement type + * - operand type + * - operand locality + * operand global, local, parameter, or constant. + * + * The combination of these three aspects is balanced only approximately. + * + * 1. Statement Type: + * ----------------- number + * + * V1 = V2 9 + * (incl. V1 = F(..) + * V = Constant 12 + * Assignment, 7 + * with array element + * Assignment, 6 + * with record component + * -- + * 34 34 + * + * X = Y +|-|"&&"|"|" Z 5 + * X = Y +|-|"==" Constant 6 + * X = X +|- 1 3 + * X = Y *|/ Z 2 + * X = Expression, 1 + * two operators + * X = Expression, 1 + * three operators + * -- + * 18 18 + * + * if .... 14 + * with "else" 7 + * without "else" 7 + * executed 3 + * not executed 4 + * for ... 7 | counted every time + * while ... 4 | the loop condition + * do ... while 1 | is evaluated + * switch ... 1 + * break 1 + * declaration with 1 + * initialization + * -- + * 34 34 + * + * P (...) procedure call 11 + * user procedure 10 + * library procedure 1 + * X = F (...) + * function call 6 + * user function 5 + * library function 1 + * -- + * 17 17 + * --- + * 103 + * + * The average number of parameters in procedure or function calls + * is 1.82 (not counting the function values aX * + * + * 2. Operators + * ------------ + * number approximate + * percentage + * + * Arithmetic 32 50.8 + * + * + 21 33.3 + * - 7 11.1 + * * 3 4.8 + * / (int div) 1 1.6 + * + * Comparison 27 42.8 + * + * == 9 14.3 + * /= 4 6.3 + * > 1 1.6 + * < 3 4.8 + * >= 1 1.6 + * <= 9 14.3 + * + * Logic 4 6.3 + * + * && (AND-THEN) 1 1.6 + * | (OR) 1 1.6 + * ! (NOT) 2 3.2 + * + * -- ----- + * 63 100.1 + * + * + * 3. Operand Type (counted once per operand reference): + * --------------- + * number approximate + * percentage + * + * Integer 175 72.3 % + * Character 45 18.6 % + * Pointer 12 5.0 % + * String30 6 2.5 % + * Array 2 0.8 % + * Record 2 0.8 % + * --- ------- + * 242 100.0 % + * + * When there is an access path leading to the final operand (e.g. a record + * component), only the final data type on the access path is counted. + * + * + * 4. Operand Locality: + * ------------------- + * number approximate + * percentage + * + * local variable 114 47.1 % + * global variable 22 9.1 % + * parameter 45 18.6 % + * value 23 9.5 % + * reference 22 9.1 % + * function result 6 2.5 % + * constant 55 22.7 % + * --- ------- + * 242 100.0 % + * + * + * The program does not compute anything meaningful, but it is syntactically + * and semantically correct. All variables have a value assigned to them + * before they are used as a source operand. + * + * There has been no explicit effort to account for the effects of a + * cache, or to balance the use of long or short displacements for code or + * data. + * + *************************************************************************** + */ + +/* General definitions: */ +#include + /* for exit */ +#include +#include + /* for strcpy, strcmp */ + +/* Compiler and system dependent definitions: */ + +/* AIX-specific definitions */ +#ifdef _AIX +#ifndef _H_M_PARAM +#ifndef HZ +#define HZ DHRY_HZ +#endif +#endif +#endif + +#ifndef TIME +#undef TIMES +#define TIMES +#endif + /* Use times(2) time function unless */ + /* explicitly defined otherwise */ + +#ifdef MSC_CLOCK +#undef HZ +#undef TIMES +#include +#define HZ CLK_TCK +#endif + /* Use Microsoft C hi-res clock */ + +#ifndef HZ +#define HZ DHRY_HZ +#endif + +#ifdef TIMES +#include +#include + /* for "times" */ +#endif + +#define Mic_secs_Per_Second 1000000.0 + /* Berkeley UNIX C returns process times in seconds/HZ */ + +#ifdef NOSTRUCTASSIGN +#define structassign(d, s) memcpy(&(d), &(s), sizeof(d)) +#else +#define structassign(d, s) d = s +#endif + +#ifdef NOENUM +#define Ident_1 0 +#define Ident_2 1 +#define Ident_3 2 +#define Ident_4 3 +#define Ident_5 4 + typedef int Enumeration; +#else + typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5} + Enumeration; +#endif + /* for boolean and enumeration types in Ada, Pascal */ + +/* Switchable double/float type as an experiment to improve result accuracy */ +#ifndef FLOAT +typedef double measure; +#else +typedef float measure; +#endif + + +#define Null 0 + /* Value of a Null pointer */ +#define true 1 +#define false 0 + +typedef int One_Thirty; +typedef int One_Fifty; +typedef char Capital_Letter; +typedef int Boolean; +typedef char Str_30 [31]; +typedef int Arr_1_Dim [50]; +typedef int Arr_2_Dim [50] [50]; + +typedef struct record + { + struct record *Ptr_Comp; + Enumeration Discr; + union { + struct { + Enumeration Enum_Comp; + int Int_Comp; + char Str_Comp [31]; + } var_1; + struct { + Enumeration E_Comp_2; + char Str_2_Comp [31]; + } var_2; + struct { + char Ch_1_Comp; + char Ch_2_Comp; + } var_3; + } variant; + } Rec_Type, *Rec_Pointer; + +/* ANSI Function Prototypes */ +void Proc_2 (One_Fifty *Int_Par_Ref); +void Proc_3 (Rec_Pointer *Ptr_Ref_Par); +void Proc_4 (void); +void Proc_5 (void); +void Proc_6 (Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par); +void Proc_7 (One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val, One_Fifty *Int_Par_Ref); +void Proc_8 (Arr_1_Dim Arr_1_Par_Ref, Arr_2_Dim Arr_2_Par_Ref, int Int_1_Par_Val, int Int_2_Par_Val); +Boolean Func_2 (Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref); +Boolean Func_3 (Enumeration Enum_Par_Val); + diff --git a/examples/dhry_1.c b/examples/dhry_1.c new file mode 100644 index 0000000000..713458446a --- /dev/null +++ b/examples/dhry_1.c @@ -0,0 +1,410 @@ +/* + **************************************************************************** + * + * "DHRYSTONE" Benchmark Program + * ----------------------------- + * + * Version: C, Version 2.2 + * + * File: dhry_1.c (part 2 of 3) + * + * Date: May 25, 1988 + * July 26, 2022 (modified for strict ANSI C compliance) + * + * Author: Reinhold P. Weicker + * + **************************************************************************** + */ + +#include "dhry.h" + +/* Global Variables: */ + +Rec_Pointer Ptr_Glob, + Next_Ptr_Glob; +int Int_Glob; +Boolean Bool_Glob; +char Ch_1_Glob, + Ch_2_Glob; +int Arr_1_Glob [50]; +int Arr_2_Glob [50] [50]; + + /* forward declaration necessary since Enumeration may not simply be int */ + +#ifndef REG + Boolean Reg = false; +#define REG + /* REG becomes defined as empty */ + /* i.e. no register variables */ +#else + Boolean Reg = true; +#endif + +/* variables for time measurement: */ + +#ifdef TIMES +struct tms time_info; +extern int times (); + /* see library function "times" */ +#define Too_Small_Time (2*HZ) + /* Measurements should last at least about 2 seconds */ +#endif +#ifdef TIME +extern long time(); + /* see library function "time" */ +#define Too_Small_Time 2 + /* Measurements should last at least 2 seconds */ +#endif +#ifdef MSC_CLOCK +extern clock_t clock(); +#define Too_Small_Time (2*HZ) +#endif + +#ifndef FLOAT + Boolean Float_Rating = false; +#else + Boolean Float_Rating = true; +#endif + +long Begin_Time, + End_Time, + User_Time; +measure Microseconds, + Dhrystones_Per_Second; + +/* end of variables for time measurement */ + +/* ANSI function prototypes */ +Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val); +void Proc_1 (REG Rec_Pointer Ptr_Val_Par); + +int main (int argc, char **argv) +/*****/ + + /* main program, corresponds to procedures */ + /* Main and Proc_0 in the Ada version */ +{ + One_Fifty Int_1_Loc; + REG One_Fifty Int_2_Loc; + One_Fifty Int_3_Loc; + REG char Ch_Index; + Enumeration Enum_Loc; + Str_30 Str_1_Loc; + Str_30 Str_2_Loc; + REG int Run_Index; + REG int Number_Of_Runs; + + /* Initializations */ + + Next_Ptr_Glob = (Rec_Pointer) (char *) malloc (sizeof (Rec_Type)); + Ptr_Glob = (Rec_Pointer) (char *) malloc (sizeof (Rec_Type)); + + Ptr_Glob->Ptr_Comp = Next_Ptr_Glob; + Ptr_Glob->Discr = Ident_1; + Ptr_Glob->variant.var_1.Enum_Comp = Ident_3; + Ptr_Glob->variant.var_1.Int_Comp = 40; + strcpy (Ptr_Glob->variant.var_1.Str_Comp, + "DHRYSTONE PROGRAM, SOME STRING"); + strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING"); + + Arr_2_Glob [8][7] = 10; + /* Was missing in published program. Without this statement, */ + /* Arr_2_Glob [8][7] would have an undefined value. */ + /* Warning: With 16-Bit processors and Number_Of_Runs > 32000, */ + /* overflow may occur for this array element. */ + + printf ("\n"); + printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n"); + if (Reg) + { + printf ("Program compiled with 'register' attribute\n"); + } + else + { + printf ("Program compiled without 'register' attribute\n"); + } + if (Float_Rating) + { + printf ("Ratings using 'float' datatype (%d bytes)\n",sizeof(float)); + } + else + { + printf ("Ratings using 'double' datatype (%d bytes)\n",sizeof(double)); + } + printf ("\n"); + if (argc < 2) { + printf ("Please give the number of runs through the benchmark: "); + { + int n; + scanf ("%d", &n); + Number_Of_Runs = n; + } + printf ("\n"); + } else { + Number_Of_Runs = atoi(argv[1]); + } + printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs); + + /***************/ + /* Start timer */ + /***************/ + +#ifdef TIMES + times (&time_info); + Begin_Time = (long) time_info.tms_utime; +#endif +#ifdef TIME + Begin_Time = time ( (long *) 0); +#endif +#ifdef MSC_CLOCK + Begin_Time = clock(); +#endif + + for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index) + { + + Proc_5(); + Proc_4(); + /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */ + Int_1_Loc = 2; + Int_2_Loc = 3; + strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING"); + Enum_Loc = Ident_2; + Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc); + /* Bool_Glob == 1 */ + while (Int_1_Loc < Int_2_Loc) /* loop body executed once */ + { + Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc; + /* Int_3_Loc == 7 */ + Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc); + /* Int_3_Loc == 7 */ + Int_1_Loc += 1; + } /* while */ + /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */ + Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc); + /* Int_Glob == 5 */ + Proc_1 (Ptr_Glob); + for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index) + /* loop body executed twice */ + { + if (Enum_Loc == Func_1 (Ch_Index, 'C')) + /* then, not executed */ + { + Proc_6 (Ident_1, &Enum_Loc); + strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING"); + Int_2_Loc = Run_Index; + Int_Glob = Run_Index; + } + } + /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */ + Int_2_Loc = Int_2_Loc * Int_1_Loc; + Int_1_Loc = Int_2_Loc / Int_3_Loc; + Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc; + /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */ + Proc_2 (&Int_1_Loc); + /* Int_1_Loc == 5 */ + + } /* loop "for Run_Index" */ + + /**************/ + /* Stop timer */ + /**************/ + +#ifdef TIMES + times (&time_info); + End_Time = (long) time_info.tms_utime; +#endif +#ifdef TIME + End_Time = time ( (long *) 0); +#endif +#ifdef MSC_CLOCK + End_Time = clock(); +#endif + + printf ("Execution ends\n"); + printf ("\n"); + printf ("Final values of the variables used in the benchmark:\n"); + printf ("\n"); + printf ("Int_Glob: %d\n", Int_Glob); + printf (" should be: %d\n", 5); + printf ("Bool_Glob: %d\n", Bool_Glob); + printf (" should be: %d\n", 1); + printf ("Ch_1_Glob: %c\n", Ch_1_Glob); + printf (" should be: %c\n", 'A'); + printf ("Ch_2_Glob: %c\n", Ch_2_Glob); + printf (" should be: %c\n", 'B'); + printf ("Arr_1_Glob[8]: %d\n", Arr_1_Glob[8]); + printf (" should be: %d\n", 7); + printf ("Arr_2_Glob[8][7]: %d\n", Arr_2_Glob[8][7]); + printf (" should be: Number_Of_Runs + 10\n"); + printf ("Ptr_Glob->\n"); + printf (" Discr: %d\n", Ptr_Glob->Discr); + printf (" should be: %d\n", 0); + printf (" Enum_Comp: %d\n", Ptr_Glob->variant.var_1.Enum_Comp); + printf (" should be: %d\n", 2); + printf (" Int_Comp: %d\n", Ptr_Glob->variant.var_1.Int_Comp); + printf (" should be: %d\n", 17); + printf (" Str_Comp: %s\n", Ptr_Glob->variant.var_1.Str_Comp); + printf (" should be: DHRYSTONE PROGRAM, SOME STRING\n"); + printf ("Next_Ptr_Glob->\n"); + printf (" Discr: %d\n", Next_Ptr_Glob->Discr); + printf (" should be: %d\n", 0); + printf (" Enum_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp); + printf (" should be: %d\n", 1); + printf (" Int_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp); + printf (" should be: %d\n", 18); + printf (" Str_Comp: %s\n", + Next_Ptr_Glob->variant.var_1.Str_Comp); + printf (" should be: DHRYSTONE PROGRAM, SOME STRING\n"); + printf ("Int_1_Loc: %d\n", Int_1_Loc); + printf (" should be: %d\n", 5); + printf ("Int_2_Loc: %d\n", Int_2_Loc); + printf (" should be: %d\n", 13); + printf ("Int_3_Loc: %d\n", Int_3_Loc); + printf (" should be: %d\n", 7); + printf ("Enum_Loc: %d\n", Enum_Loc); + printf (" should be: %d\n", 1); + printf ("Str_1_Loc: %s\n", Str_1_Loc); + printf (" should be: DHRYSTONE PROGRAM, 1'ST STRING\n"); + printf ("Str_2_Loc: %s\n", Str_2_Loc); + printf (" should be: DHRYSTONE PROGRAM, 2'ND STRING\n"); + printf ("\n"); + + User_Time = End_Time - Begin_Time; + + if (User_Time < Too_Small_Time) + { + printf ("Measured time too small to obtain meaningful results\n"); + printf ("Please increase number of runs\n"); + printf ("\n"); + } + else + { +#ifdef TIME + Microseconds = (measure) User_Time * Mic_secs_Per_Second + / (measure) Number_Of_Runs; + Dhrystones_Per_Second = (measure) Number_Of_Runs / (measure) User_Time; +#else + Microseconds = (measure) User_Time * Mic_secs_Per_Second + / ((measure) HZ * ((measure) Number_Of_Runs)); + Dhrystones_Per_Second = ((measure) HZ * (measure) Number_Of_Runs) + / (measure) User_Time; +#endif + printf ("Microseconds for one run through Dhrystone: "); + printf ("%12.1f \n", Microseconds); + printf ("Dhrystones per Second: "); + printf ("%12.1f \n", Dhrystones_Per_Second); + printf ("VAX MIPS: "); + printf ("%12.1f \n", Dhrystones_Per_Second/1757); + printf ("\n"); + } + return 0; +} + + +void Proc_1 (Ptr_Val_Par) +/******************/ + +REG Rec_Pointer Ptr_Val_Par; + /* executed once */ +{ + REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp; + /* == Ptr_Glob_Next */ + /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp, */ + /* corresponds to "rename" in Ada, "with" in Pascal */ + + structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob); + Ptr_Val_Par->variant.var_1.Int_Comp = 5; + Next_Record->variant.var_1.Int_Comp + = Ptr_Val_Par->variant.var_1.Int_Comp; + Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp; + Proc_3 (&Next_Record->Ptr_Comp); + /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp + == Ptr_Glob->Ptr_Comp */ + if (Next_Record->Discr == Ident_1) + /* then, executed */ + { + Next_Record->variant.var_1.Int_Comp = 6; + Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp, + &Next_Record->variant.var_1.Enum_Comp); + Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp; + Proc_7 (Next_Record->variant.var_1.Int_Comp, 10, + &Next_Record->variant.var_1.Int_Comp); + } + else /* not executed */ + structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp); +} /* Proc_1 */ + + +void Proc_2 (Int_Par_Ref) +/******************/ + /* executed once */ + /* *Int_Par_Ref == 1, becomes 4 */ + +One_Fifty *Int_Par_Ref; +{ + One_Fifty Int_Loc; + Enumeration Enum_Loc; + + Int_Loc = *Int_Par_Ref + 10; + do /* executed once */ + if (Ch_1_Glob == 'A') + /* then, executed */ + { + Int_Loc -= 1; + *Int_Par_Ref = Int_Loc - Int_Glob; + Enum_Loc = Ident_1; + } /* if */ + while (Enum_Loc != Ident_1); /* true */ +} /* Proc_2 */ + + +void Proc_3 (Ptr_Ref_Par) +/******************/ + /* executed once */ + /* Ptr_Ref_Par becomes Ptr_Glob */ + +Rec_Pointer *Ptr_Ref_Par; + +{ + if (Ptr_Glob != Null) + /* then, executed */ + *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp; + Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp); +} /* Proc_3 */ + + +void Proc_4 () /* without parameters */ +/*******/ + /* executed once */ +{ + Boolean Bool_Loc; + + Bool_Loc = Ch_1_Glob == 'A'; + Bool_Glob = Bool_Loc | Bool_Glob; + Ch_2_Glob = 'B'; +} /* Proc_4 */ + + +void Proc_5 () /* without parameters */ +/*******/ + /* executed once */ +{ + Ch_1_Glob = 'A'; + Bool_Glob = false; +} /* Proc_5 */ + + + /* Procedure for the assignment of structures, */ + /* if the C compiler doesn't support this feature */ +#ifdef NOSTRUCTASSIGN +memcpy (d, s, l) +register char *d; +register char *s; +register int l; +{ + while (l--) *d++ = *s++; +} +#endif + + diff --git a/examples/dhry_2.c b/examples/dhry_2.c new file mode 100644 index 0000000000..f94e3369c6 --- /dev/null +++ b/examples/dhry_2.c @@ -0,0 +1,192 @@ +/* + **************************************************************************** + * + * "DHRYSTONE" Benchmark Program + * ----------------------------- + * + * Version: C, Version 2.1 + * + * File: dhry_2.c (part 3 of 3) + * + * Date: May 25, 1988 + * + * Author: Reinhold P. Weicker + * + **************************************************************************** + */ + +#include "dhry.h" + +#ifndef REG +#define REG + /* REG becomes defined as empty */ + /* i.e. no register variables */ +#endif + +extern int Int_Glob; +extern char Ch_1_Glob; + + +void Proc_6 (Enum_Val_Par, Enum_Ref_Par) +/*********************************/ + /* executed once */ + /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */ + +Enumeration Enum_Val_Par; +Enumeration *Enum_Ref_Par; +{ + *Enum_Ref_Par = Enum_Val_Par; + if (! Func_3 (Enum_Val_Par)) + /* then, not executed */ + *Enum_Ref_Par = Ident_4; + switch (Enum_Val_Par) + { + case Ident_1: + *Enum_Ref_Par = Ident_1; + break; + case Ident_2: + if (Int_Glob > 100) + /* then */ + *Enum_Ref_Par = Ident_1; + else *Enum_Ref_Par = Ident_4; + break; + case Ident_3: /* executed */ + *Enum_Ref_Par = Ident_2; + break; + case Ident_4: break; + case Ident_5: + *Enum_Ref_Par = Ident_3; + break; + } /* switch */ +} /* Proc_6 */ + + +void Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref) +/**********************************************/ + /* executed three times */ + /* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */ + /* Int_Par_Ref becomes 7 */ + /* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */ + /* Int_Par_Ref becomes 17 */ + /* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */ + /* Int_Par_Ref becomes 18 */ +One_Fifty Int_1_Par_Val; +One_Fifty Int_2_Par_Val; +One_Fifty *Int_Par_Ref; +{ + One_Fifty Int_Loc; + + Int_Loc = Int_1_Par_Val + 2; + *Int_Par_Ref = Int_2_Par_Val + Int_Loc; +} /* Proc_7 */ + + +void Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val) +/*********************************************************************/ + /* executed once */ + /* Int_Par_Val_1 == 3 */ + /* Int_Par_Val_2 == 7 */ +Arr_1_Dim Arr_1_Par_Ref; +Arr_2_Dim Arr_2_Par_Ref; +int Int_1_Par_Val; +int Int_2_Par_Val; +{ + REG One_Fifty Int_Index; + REG One_Fifty Int_Loc; + + Int_Loc = Int_1_Par_Val + 5; + Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val; + Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc]; + Arr_1_Par_Ref [Int_Loc+30] = Int_Loc; + for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index) + Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc; + Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1; + Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc]; + Int_Glob = 5; +} /* Proc_8 */ + + +Enumeration Func_1 (Ch_1_Par_Val, Ch_2_Par_Val) +/*************************************************/ + /* executed three times */ + /* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */ + /* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */ + /* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */ + +Capital_Letter Ch_1_Par_Val; +Capital_Letter Ch_2_Par_Val; +{ + Capital_Letter Ch_1_Loc; + Capital_Letter Ch_2_Loc; + + Ch_1_Loc = Ch_1_Par_Val; + Ch_2_Loc = Ch_1_Loc; + if (Ch_2_Loc != Ch_2_Par_Val) + /* then, executed */ + return (Ident_1); + else /* not executed */ + { + Ch_1_Glob = Ch_1_Loc; + return (Ident_2); + } +} /* Func_1 */ + + +Boolean Func_2 (Str_1_Par_Ref, Str_2_Par_Ref) +/*************************************************/ + /* executed once */ + /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */ + /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */ + +Str_30 Str_1_Par_Ref; +Str_30 Str_2_Par_Ref; +{ + REG One_Thirty Int_Loc; + Capital_Letter Ch_Loc; + + Int_Loc = 2; + while (Int_Loc <= 2) /* loop body executed once */ + if (Func_1 (Str_1_Par_Ref[Int_Loc], + Str_2_Par_Ref[Int_Loc+1]) == Ident_1) + /* then, executed */ + { + Ch_Loc = 'A'; + Int_Loc += 1; + } /* if, while */ + if (Ch_Loc >= 'W' && Ch_Loc < 'Z') + /* then, not executed */ + Int_Loc = 7; + if (Ch_Loc == 'R') + /* then, not executed */ + return (true); + else /* executed */ + { + if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0) + /* then, not executed */ + { + Int_Loc += 7; + Int_Glob = Int_Loc; + return (true); + } + else /* executed */ + return (false); + } /* if Ch_Loc */ +} /* Func_2 */ + + +Boolean Func_3 (Enum_Par_Val) +/***************************/ + /* executed once */ + /* Enum_Par_Val == Ident_3 */ +Enumeration Enum_Par_Val; +{ + Enumeration Enum_Loc; + + Enum_Loc = Enum_Par_Val; + if (Enum_Loc == Ident_3) + /* then, executed */ + return (true); + else /* not executed */ + return (false); +} /* Func_3 */ + diff --git a/lang/cem/libcc.ansi/headers/sys/times.h b/lang/cem/libcc.ansi/headers/sys/times.h index 8311a807d7..f6fa26dd8c 100644 --- a/lang/cem/libcc.ansi/headers/sys/times.h +++ b/lang/cem/libcc.ansi/headers/sys/times.h @@ -1,6 +1,8 @@ #ifndef _SYS_TIMES_H #define _SYS_TIMES_H +#include + struct tms { clock_t tms_utime; /* user time */ clock_t tms_stime; /* system time */ From a95682bf008a20b77fa7c8161a51e8625981e095 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 10 Apr 2025 22:14:57 +0200 Subject: [PATCH 62/79] Use the mingw python instead of the msys python. --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 0a0d524009..0e2da3d91d 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -42,7 +42,7 @@ jobs: mingw-w64-ucrt-x86_64-lua mingw-w64-ucrt-x86_64-nsis mingw-w64-ucrt-x86_64-pkg-config - python + mingw-w64-ucrt-x86_64-python bison flex zip From 50fef3abbd0d03d7ab9475ec4b842f145526bee8 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 10 Apr 2025 23:17:21 +0200 Subject: [PATCH 63/79] Eliminate ansi.h and all the _PROTOTYPE nonsense. --- build/config.py | 2 +- lang/pc/comp/def.c | 1 + lang/pc/comp/desig.c | 1 + lang/pc/comp/lookup.c | 1 + lang/pc/comp/node.c | 1 + lang/pc/comp/options.c | 1 + lang/pc/comp/progs.c | 1 + lang/pc/comp/readwrite.c | 1 + lang/pc/comp/scope.c | 1 + lang/pc/comp/tmpvar.xc | 1 + lang/pc/comp/tokenname.c | 1 + lang/pc/comp/type.c | 1 + lang/pc/comp/typequiv.c | 1 + lib/minix/include/sys/times.h | 5 - lib/minix/include/time.h | 5 - lib/minix/include/unistd.h | 7 +- mach/minix/libsys/_exec.c | 23 +- mach/minix/libsys/_execn.c | 2 +- mach/minix/libsys/_fcntl.c | 17 - mach/minix/libsys/_open.c | 12 - mach/minix/libsys/_signal.c | 6 +- mach/minix/libsys/syslib.c | 28 +- mach/minix/libsys/vectab.c | 2 +- mach/proto/fp/FP_types.h | 80 ++--- mach/sparc/ce/cache.c.x | 10 +- mach/sparc/ce/misc.h | 2 +- mach/sparc/ce/ms_reg.h | 2 +- mach/sparc/ce/push_pop.h | 66 ++-- modules/h/ansi.h | 29 -- modules/h/build.py | 1 - modules/src/em_code/em.nogen | 112 +++---- modules/src/em_code/em_code.h | 33 +- modules/src/em_code/em_codeCE.h | 530 +++++++++++++++---------------- modules/src/em_code/em_private.h | 2 - modules/src/em_opt/nopt.h | 79 +++-- modules/src/idf/idf_pkg.spec | 2 - modules/src/input/inp_pkg.spec | 14 +- modules/src/read_em/em_comp.h | 1 - plat/minix/include/ack/signal.h | 18 +- plat/minix/include/ansi.h | 54 ---- plat/minix/include/minix/type.h | 9 - plat/minix/include/sgtty.h | 8 +- plat/minix/include/sys/stat.h | 17 +- plat/minix/include/sys/wait.h | 9 +- plat/minix68k/libsys/_chmod.c | 2 +- plat/minix68k/libsys/_creat.c | 2 +- plat/minix68k/libsys/_exec.c | 2 +- plat/minix68k/libsys/_execn.c | 2 +- plat/minix68k/libsys/_execnl.c | 6 +- plat/minix68k/libsys/_getcwd.c | 2 +- plat/minix68k/libsys/_link.c | 2 +- plat/minix68k/libsys/_mkdir.c | 4 +- plat/minix68k/libsys/_mkfifo.c | 4 +- plat/minix68k/libsys/_mknod.c | 2 +- plat/minix68k/libsys/_mknod4.c | 2 +- plat/minix68k/libsys/_open.c | 11 - plat/minix68k/libsys/_rename.c | 2 +- plat/minix68k/libsys/_rmdir.c | 2 +- plat/minix68k/libsys/_signal.c | 6 +- plat/minix68k/libsys/_stat.c | 2 +- plat/minix68k/libsys/_umount.c | 2 +- plat/minix68k/libsys/_unlink.c | 2 +- plat/minix68k/libsys/call.c | 4 +- plat/minix68k/libsys/lib.h | 36 +-- plat/minix68k/libsys/syslib.c | 35 +- plat/minix68k/libsys/vectab.c | 2 +- util/grind/misc.h | 8 +- 67 files changed, 574 insertions(+), 767 deletions(-) delete mode 100644 modules/h/ansi.h delete mode 100644 plat/minix/include/ansi.h diff --git a/build/config.py b/build/config.py index f859ee7bd7..169e3ec3e9 100644 --- a/build/config.py +++ b/build/config.py @@ -1,4 +1,4 @@ import platform -IS_WINDOWS = platform.system() == "Windows" +IS_WINDOWS = (platform.system() == "Windows") diff --git a/lang/pc/comp/def.c b/lang/pc/comp/def.c index 76d7e68ce7..d7d0628537 100644 --- a/lang/pc/comp/def.c +++ b/lang/pc/comp/def.c @@ -3,6 +3,7 @@ #include "parameters.h" #include "debug.h" +#include #include #include #include diff --git a/lang/pc/comp/desig.c b/lang/pc/comp/desig.c index 4417907f3e..2ff6272cc2 100644 --- a/lang/pc/comp/desig.c +++ b/lang/pc/comp/desig.c @@ -10,6 +10,7 @@ #include "parameters.h" #include "debug.h" +#include #include #include diff --git a/lang/pc/comp/lookup.c b/lang/pc/comp/lookup.c index 480015f852..6d4a21ab50 100644 --- a/lang/pc/comp/lookup.c +++ b/lang/pc/comp/lookup.c @@ -1,5 +1,6 @@ /* L O O K U P R O U T I N E S */ +#include #include #include #include diff --git a/lang/pc/comp/node.c b/lang/pc/comp/node.c index ee672f0b3a..48b095c498 100644 --- a/lang/pc/comp/node.c +++ b/lang/pc/comp/node.c @@ -3,6 +3,7 @@ #include "parameters.h" #include "debug.h" +#include #include #include #include diff --git a/lang/pc/comp/options.c b/lang/pc/comp/options.c index ce372023e5..c3aa378e9c 100644 --- a/lang/pc/comp/options.c +++ b/lang/pc/comp/options.c @@ -1,5 +1,6 @@ /* U S E R O P T I O N - H A N D L I N G */ +#include #include #include #include diff --git a/lang/pc/comp/progs.c b/lang/pc/comp/progs.c index 0f0dcc6fa1..f6ffc19aff 100644 --- a/lang/pc/comp/progs.c +++ b/lang/pc/comp/progs.c @@ -1,6 +1,7 @@ #include "parameters.h" #include "debug.h" +#include #include #include diff --git a/lang/pc/comp/readwrite.c b/lang/pc/comp/readwrite.c index d5a1aaa816..dd1deb354e 100644 --- a/lang/pc/comp/readwrite.c +++ b/lang/pc/comp/readwrite.c @@ -4,6 +4,7 @@ #include "parameters.h" #include "debug.h" +#include #include #include diff --git a/lang/pc/comp/scope.c b/lang/pc/comp/scope.c index e7040ecf3a..b46cb61fd0 100644 --- a/lang/pc/comp/scope.c +++ b/lang/pc/comp/scope.c @@ -3,6 +3,7 @@ #include "parameters.h" #include "debug.h" +#include #include #include #include diff --git a/lang/pc/comp/tmpvar.xc b/lang/pc/comp/tmpvar.xc index 60b79366f5..d22c9df3fd 100644 --- a/lang/pc/comp/tmpvar.xc +++ b/lang/pc/comp/tmpvar.xc @@ -9,6 +9,7 @@ #include "debug.h" +#include #include #include #include diff --git a/lang/pc/comp/tokenname.c b/lang/pc/comp/tokenname.c index 2310059a8d..58c137fa09 100644 --- a/lang/pc/comp/tokenname.c +++ b/lang/pc/comp/tokenname.c @@ -1,6 +1,7 @@ /* T O K E N D E F I N I T I O N S */ #include "parameters.h" +#include #include "Lpars.h" #include "LLlex.h" #include "idf.h" diff --git a/lang/pc/comp/type.c b/lang/pc/comp/type.c index e58ed2f1ff..0455dc090c 100644 --- a/lang/pc/comp/type.c +++ b/lang/pc/comp/type.c @@ -3,6 +3,7 @@ #include "parameters.h" #include "debug.h" +#include #include #include #include diff --git a/lang/pc/comp/typequiv.c b/lang/pc/comp/typequiv.c index 4f5518ffd3..a8e8534b56 100644 --- a/lang/pc/comp/typequiv.c +++ b/lang/pc/comp/typequiv.c @@ -6,6 +6,7 @@ #include "parameters.h" #include "debug.h" +#include #include #include #include diff --git a/lib/minix/include/sys/times.h b/lib/minix/include/sys/times.h index d27dc4c65d..b7b7dae5ee 100644 --- a/lib/minix/include/sys/times.h +++ b/lib/minix/include/sys/times.h @@ -16,11 +16,6 @@ struct tms { }; -/* Function Prototypes. */ -#ifndef _ANSI_H -#include -#endif - _PROTOTYPE( clock_t times, (struct tms *_buffer) ); #endif /* _TIMES_H */ diff --git a/lib/minix/include/time.h b/lib/minix/include/time.h index 2db1d4a27f..632448ce99 100644 --- a/lib/minix/include/time.h +++ b/lib/minix/include/time.h @@ -39,11 +39,6 @@ struct tm { int tm_isdst; /* Daylight Saving Time flag */ }; -/* Function Prototypes. */ -#ifndef _ANSI_H -#include -#endif - _PROTOTYPE( clock_t clock, (void) ); _PROTOTYPE( double difftime, (time_t _time1, time_t _time0) ); _PROTOTYPE( time_t mktime, (struct tm *_timeptr) ); diff --git a/lib/minix/include/unistd.h b/lib/minix/include/unistd.h index 1da63178bd..fc678a3dec 100644 --- a/lib/minix/include/unistd.h +++ b/lib/minix/include/unistd.h @@ -61,11 +61,6 @@ extern char** environ; #define _POSIX_VDISABLE '\t' /* can't set any control char to tab */ -/* Function Prototypes. */ -#ifndef _ANSI_H -#include -#endif - _PROTOTYPE( void _exit, (int _status) ); _PROTOTYPE( int access, (char *_path, int _amode) ); _PROTOTYPE( int chdir, (char *_path) ); @@ -121,7 +116,7 @@ _PROTOTYPE( int mknod4, (const char *_name, int _mode, int _addr, _PROTOTYPE( char *mktemp, (char *_template) ); _PROTOTYPE( char *sbrk, (int _incr) ); _PROTOTYPE( int chroot, (const char *_name) ); -_PROTOTYPE( int mount, (char *_spec, char *_name, int _flag)); + int mount(char *_spec, char *_name, int _flag); _PROTOTYPE( long ptrace, (int _req, int _pid, long _addr, long _data) ); _PROTOTYPE( int stime, (long *top) ); _PROTOTYPE( int sync, (void) ); diff --git a/mach/minix/libsys/_exec.c b/mach/minix/libsys/_exec.c index de72ea5e7a..f77cf6fc42 100644 --- a/mach/minix/libsys/_exec.c +++ b/mach/minix/libsys/_exec.c @@ -8,9 +8,8 @@ extern char **environ; /* environment pointer */ #define PTRSIZE (sizeof(char *)) -_PROTOTYPE( char *_sbrk, (int _incr) ); +extern char *_sbrk(int _incr); -#if _ANSI #include PUBLIC int execl(char *name, ...) @@ -23,16 +22,7 @@ PUBLIC int execl(char *name, ...) va_end(ap); return retval; } -#else -PUBLIC int execl(name, arg0) -char *name; -char *arg0; -{ - return(execve(name, &arg0, environ)); -} -#endif -#if _ANSI PUBLIC int execle(char *name, ...) { int retval; @@ -50,17 +40,6 @@ PUBLIC int execle(char *name, ...) va_end(ap); return retval; } -#else -PUBLIC int execle(name, argv) -char *name, *argv; -{ - char **p; - p = (char **) &argv; - while (*p++) /* null statement */ - ; - return(execve(name, &argv, (char **) *p)); -} -#endif PUBLIC int execv(name, argv) char *name, *argv[]; diff --git a/mach/minix/libsys/_execn.c b/mach/minix/libsys/_execn.c index 1ac59ec15d..17abab126f 100644 --- a/mach/minix/libsys/_execn.c +++ b/mach/minix/libsys/_execn.c @@ -1,7 +1,7 @@ #include #define PTRSIZE sizeof(char *) -_PROTOTYPE( int _execn, (char * name)); + int _execn(char * name); PUBLIC int _execn(name) char *name; /* pointer to file to be exec'd */ diff --git a/mach/minix/libsys/_fcntl.c b/mach/minix/libsys/_fcntl.c index f96eebf6f3..52273614ad 100644 --- a/mach/minix/libsys/_fcntl.c +++ b/mach/minix/libsys/_fcntl.c @@ -1,32 +1,15 @@ #include #define fcntl _fcntl #include -#if _ANSI -#endif -#if _ANSI #include PUBLIC int fcntl(int fd, int cmd, ...) { -#else -#include -PUBLIC int fcntl(va_alist) -va_dcl -{ -int fd; -int cmd; -#endif va_list ap; int int3; /* third integer parameter for callm1 */ char *ptr1; /* first pointer parameter for callm1 */ -#if _ANSI va_start(ap, cmd); -#else - va_start(ap); - fd = va_arg(ap, int); - cmd = va_arg(ap, int); -#endif /* Set up for the sensible case where there is no variable parameter. This * covers F_GETFD, F_GETFL and invalid commands. diff --git a/mach/minix/libsys/_open.c b/mach/minix/libsys/_open.c index 5f0f94ae35..6b868beae1 100644 --- a/mach/minix/libsys/_open.c +++ b/mach/minix/libsys/_open.c @@ -3,7 +3,6 @@ #define open _open #include -#if _ANSI #include PUBLIC int open(const char *name, int flags, ...) @@ -21,14 +20,3 @@ PUBLIC int open(const char *name, int flags, ...) } return _callm3(FS, OPEN, flags, name); } -#else -PUBLIC int open(name, flags, mode) -_CONST char *name; -int flags, mode; -{ - if (flags & O_CREAT) - return _callm1(FS, OPEN, _len(name), flags, mode, - (char *)name, NIL_PTR, NIL_PTR); - return(_callm3(FS, OPEN, flags, name)); -} -#endif diff --git a/mach/minix/libsys/_signal.c b/mach/minix/libsys/_signal.c index 1b5e8e1e7a..8767b71398 100644 --- a/mach/minix/libsys/_signal.c +++ b/mach/minix/libsys/_signal.c @@ -2,7 +2,7 @@ #define signal _signal #include -extern _PROTOTYPE(void (*_vectab[_NSIG]), (int)); /* array of funcs to catch signals */ +extern void (*_vectab[_NSIG])(int); /* array of funcs to catch signals */ /* The definition of signal really should be * PUBLIC void (*signal(signr, func))() @@ -15,10 +15,10 @@ extern _PROTOTYPE(void (*_vectab[_NSIG]), (int)); /* array of funcs to catch sig PUBLIC void (*signal(signr, func))() int signr; /* which signal is being set */ -_PROTOTYPE( void (*func), (int)); /* pointer to function that catches signal */ + void (*func)(int); /* pointer to function that catches signal */ { int r; - _PROTOTYPE( void (*old), (int)); + void (*old)(int); old = _vectab[signr - 1]; _M.m6_i1 = signr; diff --git a/mach/minix/libsys/syslib.c b/mach/minix/libsys/syslib.c index fe86f3b06b..73ef9f476d 100644 --- a/mach/minix/libsys/syslib.c +++ b/mach/minix/libsys/syslib.c @@ -8,32 +8,32 @@ PUBLIC _PROTOTYPE( void sys_xit, (int parent, int proc, phys_clicks *basep, phys_clicks *sizep)); #else -PUBLIC _PROTOTYPE( void sys_xit, (int parent, int proc)); +PUBLIC void sys_xit(int parent, int proc); #endif -PUBLIC _PROTOTYPE( void sys_getsp, (int proc, vir_bytes *newsp)); -PUBLIC _PROTOTYPE( void sys_sig, (int proc, int sig, void (*sighandler)(int))); +PUBLIC void sys_getsp(int proc, vir_bytes *newsp); +PUBLIC void sys_sig(int proc, int sig, void (*sighandler)(int)); #if (CHIP == M68000) #ifdef ALCYON_C_BUG_FIXED -PUBLIC _PROTOTYPE( void sys_fork, (int prnt, int chld, int pd, phys_clicks shdw)); +PUBLIC void sys_fork(int prnt, int chld, int pd, phys_clicks shdw); #else -PUBLIC _PROTOTYPE( void sys_fork, (int parent, int child, int pid, int shadow)); +PUBLIC void sys_fork(int parent, int child, int pid, int shadow); #endif #else -PUBLIC _PROTOTYPE( void sys_fork, (int parent, int child, int pid)); +PUBLIC void sys_fork(int parent, int child, int pid); #endif -PUBLIC _PROTOTYPE( void sys_exec, (int proc, char *ptr, int traced)); -PUBLIC _PROTOTYPE( void sys_newmap, (int proc, char *ptr)); -PUBLIC _PROTOTYPE( void sys_copy, (message *mptr)); -PUBLIC _PROTOTYPE( void sys_times, (int proc, time_t ptr[4])); -PUBLIC _PROTOTYPE( void sys_abort, (void)); +PUBLIC void sys_exec(int proc, char *ptr, int traced); +PUBLIC void sys_newmap(int proc, char *ptr); +PUBLIC void sys_copy(message *mptr); +PUBLIC void sys_times(int proc, time_t ptr[4]); +PUBLIC void sys_abort(void); #if (CHIP == M68000) PUBLIC _PROTOTYPE( void sys_fresh, (int proc, char *ptr, phys_clicks dc, phys_clicks *basep, phys_clicks *sizep)); #endif -PUBLIC _PROTOTYPE( void sys_kill, (int proc, int sig)); +PUBLIC void sys_kill(int proc, int sig); PUBLIC _PROTOTYPE( int sys_trace, (int req, int procnr, long addr, long *data_p)); -PUBLIC _PROTOTYPE( void tell_fs, ( int what, int p1, int p2, int p3)); +PUBLIC void tell_fs( int what, int p1, int p2, int p3); #if (CHIP == M68000) @@ -70,7 +70,7 @@ vir_bytes *newsp; /* place to put sp read from kernel */ PUBLIC void sys_sig(proc, sig, sighandler) int proc; /* which proc has exited */ int sig; /* signal number: 1 - 16 */ -_PROTOTYPE(void (*sighandler), (int));/* pointer to signal handler in user space */ +void (*sighandler)(int);/* pointer to signal handler in user space */ { /* A proc has to be signaled. Tell the kernel. */ diff --git a/mach/minix/libsys/vectab.c b/mach/minix/libsys/vectab.c index 54eed904ac..73d2ea6e8f 100644 --- a/mach/minix/libsys/vectab.c +++ b/mach/minix/libsys/vectab.c @@ -7,4 +7,4 @@ #include /* array of functions to catch signals */ -_PROTOTYPE( void (*_vectab[_NSIG]), (int)); + void (*_vectab[_NSIG])(int); diff --git a/mach/proto/fp/FP_types.h b/mach/proto/fp/FP_types.h index 281c863f32..1b8cc34cdb 100644 --- a/mach/proto/fp/FP_types.h +++ b/mach/proto/fp/FP_types.h @@ -69,45 +69,45 @@ struct fif8_returns { #else #define _PROTOTYPE(function, params) function() #endif -_PROTOTYPE( void add_ext, (EXTEND *e1, EXTEND *e2)); -_PROTOTYPE( void mul_ext, (EXTEND *e1, EXTEND *e2)); -_PROTOTYPE( void div_ext, (EXTEND *e1, EXTEND *e2)); -_PROTOTYPE( void sub_ext, (EXTEND *e1, EXTEND *e2)); -_PROTOTYPE( void sft_ext, (EXTEND *e1, EXTEND *e2)); -_PROTOTYPE( void nrm_ext, (EXTEND *e1)); -_PROTOTYPE( void zrf_ext, (EXTEND *e1)); -_PROTOTYPE( void extend, (unsigned long *from, EXTEND *to, int size)); -_PROTOTYPE( void compact, (EXTEND *from, unsigned long *to, int size)); -_PROTOTYPE( void _fptrp, (int)); -_PROTOTYPE( void adf4, (SINGLE s2, SINGLE s1)); -_PROTOTYPE( void adf8, (DOUBLE s2, DOUBLE s1)); -_PROTOTYPE( void sbf4, (SINGLE s2, SINGLE s1)); -_PROTOTYPE( void sbf8, (DOUBLE s2, DOUBLE s1)); -_PROTOTYPE( void dvf4, (SINGLE s2, SINGLE s1)); -_PROTOTYPE( void dvf8, (DOUBLE s2, DOUBLE s1)); -_PROTOTYPE( void mlf4, (SINGLE s2, SINGLE s1)); -_PROTOTYPE( void mlf8, (DOUBLE s2, DOUBLE s1)); -_PROTOTYPE( void ngf4, (SINGLE f)); -_PROTOTYPE( void ngf8, (DOUBLE f)); -_PROTOTYPE( void zrf4, (SINGLE *l)); -_PROTOTYPE( void zrf8, (DOUBLE *z)); -_PROTOTYPE( void cff4, (DOUBLE src)); -_PROTOTYPE( void cff8, (SINGLE src)); -_PROTOTYPE( void cif4, (int ss, long src)); -_PROTOTYPE( void cif8, (int ss, long src)); -_PROTOTYPE( void cuf4, (int ss, long src)); -_PROTOTYPE( void cuf8, (int ss, long src)); -_PROTOTYPE( long cfu, (int ds, int ss, DOUBLE src)); -_PROTOTYPE( long cfi, (int ds, int ss, DOUBLE src)); -_PROTOTYPE( int cmf4, (SINGLE s2, SINGLE s1)); -_PROTOTYPE( int cmf8, (DOUBLE d1, DOUBLE d2)); -_PROTOTYPE( void fef4, (struct fef4_returns *r, SINGLE s1)); -_PROTOTYPE( void fef8, (struct fef8_returns *r, DOUBLE s1)); -_PROTOTYPE( void fif4, (struct fif4_returns *p, SINGLE x, SINGLE y)); -_PROTOTYPE( void fif8, (struct fif8_returns *p, DOUBLE x, DOUBLE y)); + void add_ext(EXTEND *e1, EXTEND *e2); + void mul_ext(EXTEND *e1, EXTEND *e2); + void div_ext(EXTEND *e1, EXTEND *e2); + void sub_ext(EXTEND *e1, EXTEND *e2); + void sft_ext(EXTEND *e1, EXTEND *e2); + void nrm_ext(EXTEND *e1); + void zrf_ext(EXTEND *e1); + void extend(unsigned long *from, EXTEND *to, int size); + void compact(EXTEND *from, unsigned long *to, int size); + void _fptrp(int); + void adf4(SINGLE s2, SINGLE s1); + void adf8(DOUBLE s2, DOUBLE s1); + void sbf4(SINGLE s2, SINGLE s1); + void sbf8(DOUBLE s2, DOUBLE s1); + void dvf4(SINGLE s2, SINGLE s1); + void dvf8(DOUBLE s2, DOUBLE s1); + void mlf4(SINGLE s2, SINGLE s1); + void mlf8(DOUBLE s2, DOUBLE s1); + void ngf4(SINGLE f); + void ngf8(DOUBLE f); + void zrf4(SINGLE *l); + void zrf8(DOUBLE *z); + void cff4(DOUBLE src); + void cff8(SINGLE src); + void cif4(int ss, long src); + void cif8(int ss, long src); + void cuf4(int ss, long src); + void cuf8(int ss, long src); + long cfu(int ds, int ss, DOUBLE src); + long cfi(int ds, int ss, DOUBLE src); + int cmf4(SINGLE s2, SINGLE s1); + int cmf8(DOUBLE d1, DOUBLE d2); + void fef4(struct fef4_returns *r, SINGLE s1); + void fef8(struct fef8_returns *r, DOUBLE s1); + void fif4(struct fif4_returns *p, SINGLE x, SINGLE y); + void fif8(struct fif8_returns *p, DOUBLE x, DOUBLE y); -_PROTOTYPE( void b64_sft, (B64 *, int)); -_PROTOTYPE( void b64_lsft, (B64 *)); -_PROTOTYPE( void b64_rsft, (B64 *)); -_PROTOTYPE( int b64_add, (B64 *, B64 *)); + void b64_sft(B64 *, int); + void b64_lsft(B64 *); + void b64_rsft(B64 *); + int b64_add(B64 *, B64 *); #endif diff --git a/mach/sparc/ce/cache.c.x b/mach/sparc/ce/cache.c.x index cbffb7cf08..ea6e73baea 100644 --- a/mach/sparc/ce/cache.c.x +++ b/mach/sparc/ce/cache.c.x @@ -107,11 +107,11 @@ static struct cache_elt cache[CACHE_SIZE], *tos = 0; static int c_count = 0; static const_str_t s; -_PROTOTYPE(static void panic, (char*)); -_PROTOTYPE(static void dump_cache, (FILE* stream)); -_PROTOTYPE(static int cache_read, (int n, int i)); -_PROTOTYPE(static void flush_part_cache, (int c, int r, int f, int d)); -_PROTOTYPE(static void subst_reg, (reg_t, reg_t)); +static void panic(char*); +static void dump_cache(FILE* stream); +static int cache_read(int n, int i); +static void flush_part_cache(int c, int r, int f, int d); +static void subst_reg(reg_t, reg_t); static void panic(s) char *s; diff --git a/mach/sparc/ce/misc.h b/mach/sparc/ce/misc.h index 0612a21d3b..2c03520efe 100644 --- a/mach/sparc/ce/misc.h +++ b/mach/sparc/ce/misc.h @@ -8,7 +8,7 @@ misc.h #define power_of_2 B_power_of_2 #define uns_power_of_2 B_uns_power_of_2 -_PROTOTYPE( int power_of_2, (int n, int *ref_exp)); + int power_of_2(int n, int *ref_exp); #endif /* MISC_H */ diff --git a/mach/sparc/ce/ms_reg.h b/mach/sparc/ce/ms_reg.h index 95f717d797..2b5e045f68 100644 --- a/mach/sparc/ce/ms_reg.h +++ b/mach/sparc/ce/ms_reg.h @@ -11,6 +11,6 @@ #define load_float_regs B_load_float_regs #define find_local B_find_local -_PROTOTYPE(reg_t find_local, (int, reg_t*)); +reg_t find_local(int, reg_t*); #endif diff --git a/mach/sparc/ce/push_pop.h b/mach/sparc/ce/push_pop.h index 9a94fc9331..d05a5809ae 100644 --- a/mach/sparc/ce/push_pop.h +++ b/mach/sparc/ce/push_pop.h @@ -34,42 +34,40 @@ extern reg_t reg_f0; extern reg_t reg_sp, reg_lb, reg_gap; extern reg_t reg_tmp; -#include "ansi.h" +int const13(int); +void init_cache(void); +void free_reg(reg_t); +void free_double(reg_t); /* ..._reg */ +void forced_alloc_reg(reg_t); +void soft_alloc_reg(reg_t); +void change_reg(reg_t); +int type_of_tos(void); +void inc_tos(arith); +void inc_tos_reg(reg_t); +void push_const(arith); +void push_reg(reg_t); +void push_ext(char *); +void flush_cache(void); +void cache_need(int); +void pop_nop(int); -_PROTOTYPE(int const13, (int)); -_PROTOTYPE(void init_cache, (void)); -_PROTOTYPE(void free_reg, (reg_t)); -_PROTOTYPE(void free_double, (reg_t)); /* ..._reg */ -_PROTOTYPE(void forced_alloc_reg, (reg_t)); -_PROTOTYPE(void soft_alloc_reg, (reg_t)); -_PROTOTYPE(void change_reg, (reg_t)); -_PROTOTYPE(int type_of_tos, (void)); -_PROTOTYPE(void inc_tos, (arith)); -_PROTOTYPE(void inc_tos_reg, (reg_t)); -_PROTOTYPE(void push_const, (arith)); -_PROTOTYPE(void push_reg, (reg_t)); -_PROTOTYPE(void push_ext, (char *)); -_PROTOTYPE(void flush_cache, (void)); -_PROTOTYPE(void cache_need, (int)); -_PROTOTYPE(void pop_nop, (int)); +reg_t alloc_reg(void); +reg_t alloc_reg_var(void); +reg_t alloc_float(void); +reg_t alloc_float_var(void); +reg_t alloc_double(reg_t *sub_reg); +reg_t alloc_double_var(reg_t *sub_reg); +reg_t pop_reg(void); +reg_t pop_reg_c13(char*); +reg_t pop_reg_reg(reg_t*); +reg_t pop_float(void); +reg_t pop_double(reg_t *sub_reg); +void pop_reg_as(reg_t r); -_PROTOTYPE(reg_t alloc_reg, (void)); -_PROTOTYPE(reg_t alloc_reg_var, (void)); -_PROTOTYPE(reg_t alloc_float, (void)); -_PROTOTYPE(reg_t alloc_float_var, (void)); -_PROTOTYPE(reg_t alloc_double, (reg_t *sub_reg)); -_PROTOTYPE(reg_t alloc_double_var, (reg_t *sub_reg)); -_PROTOTYPE(reg_t pop_reg, (void)); -_PROTOTYPE(reg_t pop_reg_c13, (char*)); -_PROTOTYPE(reg_t pop_reg_reg, (reg_t*)); -_PROTOTYPE(reg_t pop_float, (void)); -_PROTOTYPE(reg_t pop_double, (reg_t *sub_reg)); -_PROTOTYPE(void pop_reg_as, (reg_t r)); - -_PROTOTYPE(arith pop_const, (char *n_str)); -_PROTOTYPE(arith top_const, (void)); -_PROTOTYPE(void dup_tos, (int n)); -_PROTOTYPE(void exg_top, (int n)); +arith pop_const(char *n_str); +arith top_const(void); +void dup_tos(int n); +void exg_top(int n); #define code_combiner(x) x diff --git a/modules/h/ansi.h b/modules/h/ansi.h deleted file mode 100644 index d68af3b0d3..0000000000 --- a/modules/h/ansi.h +++ /dev/null @@ -1,29 +0,0 @@ -/* (c) copyright 1992 by the Vrije Universiteit, Amsterdam, The Netherlands. -*/ - -#ifndef __ANSI_H__INCLUDED -#define __ANSI_H__INCLUDED - -/* T O A N S I O R N O T T O A N S I ? */ - -/* $Id$ */ - -/* Define the * _PROTOTYPE macro to either expand both of its arguments - (ANSI prototypes), or only the function name (K&R prototypes). - */ - -#if __STDC__ -#include - -#define _PROTOTYPE(function, params) function params -#define _SIZET size_t -#define _CONST const - -#else - -#define _PROTOTYPE(function, params) function() -#define _SIZET unsigned int -#define _CONST - -#endif /* __STDC__ */ -#endif /* __ANSI_H__INCLUDED */ diff --git a/modules/h/build.py b/modules/h/build.py index 4ad9c569a5..00361a4c14 100644 --- a/modules/h/build.py +++ b/modules/h/build.py @@ -5,7 +5,6 @@ hdrs={ k: f"./{k}" for k in [ - "ansi.h", "em_arith.h", "em_label.h", "em_label.h", diff --git a/modules/src/em_code/em.nogen b/modules/src/em_code/em.nogen index f0f8866774..36e161a9a1 100644 --- a/modules/src/em_code/em.nogen +++ b/modules/src/em_code/em.nogen @@ -89,59 +89,59 @@ #endif /* prototypes, also hand written. */ -_PROTOTYPE(void CC_bhcst, (int, arith, arith, int)); -_PROTOTYPE(void CC_bhdlb, (int, arith, label, arith, int)); -_PROTOTYPE(void CC_bhdnam, (int, arith, char *, arith, int)); -_PROTOTYPE(void CC_bhfcon, (int, arith, char *, arith, int)); -_PROTOTYPE(void CC_bhicon, (int, arith, char *, arith, int)); -_PROTOTYPE(void CC_bhilb, (int, arith, label, int)); -_PROTOTYPE(void CC_bhpnam, (int, arith, char *, int)); -_PROTOTYPE(void CC_bhucon, (int, arith, char *, arith, int)); -_PROTOTYPE(void CC_crcst, (int, arith)); -_PROTOTYPE(void CC_crdlb, (int, label, arith)); -_PROTOTYPE(void CC_crdnam, (int, char *, arith)); -_PROTOTYPE(void CC_crilb, (int, label)); -_PROTOTYPE(void CC_crpnam, (int, char *)); -_PROTOTYPE(void CC_crscon, (int, char *, arith)); -_PROTOTYPE(void CC_crxcon, (int, int, char *, arith)); -_PROTOTYPE(void CC_cst, (arith)); -_PROTOTYPE(void CC_dfdlb, (label)); -_PROTOTYPE(void CC_dfdnam, (char *)); -_PROTOTYPE(void CC_dfilb, (label)); -_PROTOTYPE(void CC_dlb, (label, arith)); -_PROTOTYPE(void CC_dnam, (char *, arith)); -_PROTOTYPE(void CC_end, (arith)); -_PROTOTYPE(void CC_endnarg, (void)); -_PROTOTYPE(void CC_exc, (arith, arith)); -_PROTOTYPE(void CC_fcon, (char *, arith)); -_PROTOTYPE(void CC_icon, (char *, arith)); -_PROTOTYPE(void CC_ilb, (label)); -_PROTOTYPE(void CC_msend, (void)); -_PROTOTYPE(void CC_msstart, (int)); -_PROTOTYPE(void CC_op, (int)); -_PROTOTYPE(void CC_opcst, (int, arith)); -_PROTOTYPE(void CC_opdlb, (int, label, arith)); -_PROTOTYPE(void CC_opdnam, (int, char *, arith)); -_PROTOTYPE(void CC_opilb, (int, label)); -_PROTOTYPE(void CC_opnarg, (int)); -_PROTOTYPE(void CC_oppnam, (int, char *)); -_PROTOTYPE(void CC_pnam, (char *)); -_PROTOTYPE(void CC_pro, (char *, arith)); -_PROTOTYPE(void CC_pronarg, (char *)); -_PROTOTYPE(void CC_psdlb, (int, label)); -_PROTOTYPE(void CC_psdnam, (int, char *)); -_PROTOTYPE(void CC_pspnam, (int, char *)); -_PROTOTYPE(void CC_scon, (char *, arith)); -_PROTOTYPE(void CC_ucon, (char *, arith)); - -_PROTOTYPE(void C_init, (arith, arith)); -_PROTOTYPE(void C_failed, (void)); -_PROTOTYPE(void C_internal_error, (void)); -_PROTOTYPE(int C_open, (char *)); -_PROTOTYPE(void C_close, (void)); -_PROTOTYPE(int C_busy, (void)); -_PROTOTYPE(void C_magic, (void)); -_PROTOTYPE(int C_getid, (void)); -_PROTOTYPE(void C_insertpart, (int)); -_PROTOTYPE(void C_beginpart, (int)); -_PROTOTYPE(void C_endpart, (int)); +void CC_bhcst(int, arith, arith, int); +void CC_bhdlb(int, arith, label, arith, int); +void CC_bhdnam(int, arith, char *, arith, int); +void CC_bhfcon(int, arith, char *, arith, int); +void CC_bhicon(int, arith, char *, arith, int); +void CC_bhilb(int, arith, label, int); +void CC_bhpnam(int, arith, char *, int); +void CC_bhucon(int, arith, char *, arith, int); +void CC_crcst(int, arith); +void CC_crdlb(int, label, arith); +void CC_crdnam(int, char *, arith); +void CC_crilb(int, label); +void CC_crpnam(int, char *); +void CC_crscon(int, char *, arith); +void CC_crxcon(int, int, char *, arith); +void CC_cst(arith); +void CC_dfdlb(label); +void CC_dfdnam(char *); +void CC_dfilb(label); +void CC_dlb(label, arith); +void CC_dnam(char *, arith); +void CC_end(arith); +void CC_endnarg(void); +void CC_exc(arith, arith); +void CC_fcon(char *, arith); +void CC_icon(char *, arith); +void CC_ilb(label); +void CC_msend(void); +void CC_msstart(int); +void CC_op(int); +void CC_opcst(int, arith); +void CC_opdlb(int, label, arith); +void CC_opdnam(int, char *, arith); +void CC_opilb(int, label); +void CC_opnarg(int); +void CC_oppnam(int, char *); +void CC_pnam(char *); +void CC_pro(char *, arith); +void CC_pronarg(char *); +void CC_psdlb(int, label); +void CC_psdnam(int, char *); +void CC_pspnam(int, char *); +void CC_scon(char *, arith); +void CC_ucon(char *, arith); + +void C_init(arith, arith); +void C_failed(void); +void C_internal_error(void); +int C_open(char *); +void C_close(void); +int C_busy(void); +void C_magic(void); +int C_getid(void); +void C_insertpart(int); +void C_beginpart(int); +void C_endpart(int); diff --git a/modules/src/em_code/em_code.h b/modules/src/em_code/em_code.h index 028e5ba14c..6ec3870b76 100644 --- a/modules/src/em_code/em_code.h +++ b/modules/src/em_code/em_code.h @@ -6,24 +6,23 @@ #include "em_mesX.h" #include "em_arith.h" -#include "ansi.h" -_PROTOTYPE(void C_ms_com, (char *)); -_PROTOTYPE(void C_ms_ego, (int, arith, arith, int)); -_PROTOTYPE(void C_ms_emx, ( arith, arith)); -_PROTOTYPE(void C_ms_err, (void)); -_PROTOTYPE(void C_ms_flt, (void)); -_PROTOTYPE(void C_ms_gto, (void)); -_PROTOTYPE(void C_ms_opt, (void)); -_PROTOTYPE(void C_ms_par, (arith)); -_PROTOTYPE(void C_ms_reg, (arith, arith, int, int)); -_PROTOTYPE(void C_ms_src, (int, char *)); -_PROTOTYPE(void C_ms_stb_cst, (char *, int, int, arith)); -_PROTOTYPE(void C_ms_stb_dlb, (char *, int, int, label, arith)); -_PROTOTYPE(void C_ms_stb_dnam, (char *, int, int, char *, arith)); -_PROTOTYPE(void C_ms_stb_ilb, (char *, int, int, label)); -_PROTOTYPE(void C_ms_stb_pnam, (char *, int, int, char *)); -_PROTOTYPE(void C_ms_std, (char *, int, int)); +void C_ms_com(char *); +void C_ms_ego(int, arith, arith, int); +void C_ms_emx( arith, arith); +void C_ms_err(void); +void C_ms_flt(void); +void C_ms_gto(void); +void C_ms_opt(void); +void C_ms_par(arith); +void C_ms_reg(arith, arith, int, int); +void C_ms_src(int, char *); +void C_ms_stb_cst(char *, int, int, arith); +void C_ms_stb_dlb(char *, int, int, label, arith); +void C_ms_stb_dnam(char *, int, int, char *, arith); +void C_ms_stb_ilb(char *, int, int, label); +void C_ms_stb_pnam(char *, int, int, char *); +void C_ms_std(char *, int, int); diff --git a/modules/src/em_code/em_codeCE.h b/modules/src/em_code/em_codeCE.h index bf56b0dedd..0ac75d5143 100644 --- a/modules/src/em_code/em_codeCE.h +++ b/modules/src/em_code/em_codeCE.h @@ -39,268 +39,268 @@ #define C_dee_dnam _39_C_dee_dnam #define C_dee_dlb _40_C_dee_dlb -_PROTOTYPE(void C_insertpart, ( int id)); -_PROTOTYPE(void C_beginpart, ( int id)); -_PROTOTYPE(void C_endpart, ( int id)); -_PROTOTYPE(void C_pro, ( char * s, arith l)); -_PROTOTYPE(void C_pro_narg, ( char * s)); -_PROTOTYPE(void C_end, ( arith l)); -_PROTOTYPE(void C_end_narg, (void)); -_PROTOTYPE(void C_df_dlb, ( label l)); -_PROTOTYPE(void C_df_dnam, ( char * s)); -_PROTOTYPE(void C_exa_dnam, ( char * s)); -_PROTOTYPE(void C_exa_dlb, ( label l)); -_PROTOTYPE(void C_exp, ( char * s)); -_PROTOTYPE(void C_ina_dnam, ( char * s)); -_PROTOTYPE(void C_ina_dlb, ( label l)); -_PROTOTYPE(void C_inp, ( char * s)); -_PROTOTYPE(void C_bss_cst, ( arith n, arith w, int i)); -_PROTOTYPE(void C_bss_icon, ( arith n, char* s, arith sz, int i)); -_PROTOTYPE(void C_bss_ucon, ( arith n, char* s, arith sz, int i)); -_PROTOTYPE(void C_bss_fcon, ( arith n, char* s, arith sz, int i)); -_PROTOTYPE(void C_bss_dnam, ( arith n, char* s, arith offs, int i)); -_PROTOTYPE(void C_bss_dlb, ( arith n, label l, arith offs, int i)); -_PROTOTYPE(void C_bss_ilb, ( arith n, label l, int i)); -_PROTOTYPE(void C_bss_pnam, ( arith n, char* s, int i)); -_PROTOTYPE(void C_hol_cst, ( arith n, arith w, int i)); -_PROTOTYPE(void C_hol_icon, ( arith n, char* s, arith sz, int i)); -_PROTOTYPE(void C_hol_ucon, ( arith n, char* s, arith sz, int i)); -_PROTOTYPE(void C_hol_fcon, ( arith n, char* s, arith sz, int i)); -_PROTOTYPE(void C_hol_dnam, ( arith n, char* s, arith offs, int i)); -_PROTOTYPE(void C_hol_dlb, ( arith n, label l, arith offs, int i)); -_PROTOTYPE(void C_hol_ilb, ( arith n, label l, int i)); -_PROTOTYPE(void C_hol_pnam, ( arith n, char* s, int i)); -_PROTOTYPE(void C_con_cst, ( arith l)); -_PROTOTYPE(void C_con_icon, ( char * val, arith siz)); -_PROTOTYPE(void C_con_ucon, ( char * val, arith siz)); -_PROTOTYPE(void C_con_fcon, ( char * val, arith siz)); -_PROTOTYPE(void C_con_scon, ( char * str, arith siz)); -_PROTOTYPE(void C_con_dnam, ( char * str, arith val)); -_PROTOTYPE(void C_con_dlb, ( label l, arith val)); -_PROTOTYPE(void C_con_ilb, ( label l)); -_PROTOTYPE(void C_con_pnam, ( char * str)); -_PROTOTYPE(void C_rom_cst, ( arith l)); -_PROTOTYPE(void C_rom_icon, ( char * val, arith siz)); -_PROTOTYPE(void C_rom_ucon, ( char * val, arith siz)); -_PROTOTYPE(void C_rom_fcon, ( char * val, arith siz)); -_PROTOTYPE(void C_rom_scon, ( char * str, arith siz)); -_PROTOTYPE(void C_rom_dnam, ( char * str, arith val)); -_PROTOTYPE(void C_rom_dlb, ( label l, arith val)); -_PROTOTYPE(void C_rom_ilb, ( label l)); -_PROTOTYPE(void C_rom_pnam, ( char * str)); -_PROTOTYPE(void C_cst, ( arith l)); -_PROTOTYPE(void C_icon, ( char * val, arith siz)); -_PROTOTYPE(void C_ucon, ( char * val, arith siz)); -_PROTOTYPE(void C_fcon, ( char * val, arith siz)); -_PROTOTYPE(void C_scon, ( char * str, arith siz)); -_PROTOTYPE(void C_dnam, ( char * str, arith val)); -_PROTOTYPE(void C_dlb, ( label l, arith val)); -_PROTOTYPE(void C_ilb, ( label l)); -_PROTOTYPE(void C_pnam, ( char * str)); -_PROTOTYPE(void C_mes_begin, ( int ms)); -_PROTOTYPE(void C_mes_end, (void)); -_PROTOTYPE(void C_exc, ( arith c1, arith c2)); -_PROTOTYPE(void C_zrl, ( arith n)); -_PROTOTYPE(void C_zrf_narg, (void)); -_PROTOTYPE(void C_zrf, ( arith n)); -_PROTOTYPE(void C_zre, ( arith n)); -_PROTOTYPE(void C_zre_dnam, ( char * s, arith n)); -_PROTOTYPE(void C_zre_dlb, ( label l, arith n)); -_PROTOTYPE(void C_zne, ( label l)); -_PROTOTYPE(void C_zlt, ( label l)); -_PROTOTYPE(void C_zle, ( label l)); -_PROTOTYPE(void C_zgt, ( label l)); -_PROTOTYPE(void C_zge, ( label l)); -_PROTOTYPE(void C_zer_narg, (void)); -_PROTOTYPE(void C_zer, ( arith n)); -_PROTOTYPE(void C_zeq, ( label l)); -_PROTOTYPE(void C_xor_narg, (void)); -_PROTOTYPE(void C_xor, ( arith n)); -_PROTOTYPE(void C_trp, (void)); -_PROTOTYPE(void C_tne, (void)); -_PROTOTYPE(void C_tlt, (void)); -_PROTOTYPE(void C_tle, (void)); -_PROTOTYPE(void C_tgt, (void)); -_PROTOTYPE(void C_tge, (void)); -_PROTOTYPE(void C_teq, (void)); -_PROTOTYPE(void C_sts_narg, (void)); -_PROTOTYPE(void C_sts, ( arith n)); -_PROTOTYPE(void C_str, ( arith n)); -_PROTOTYPE(void C_stl, ( arith n)); -_PROTOTYPE(void C_sti, ( arith n)); -_PROTOTYPE(void C_stf, ( arith n)); -_PROTOTYPE(void C_ste, ( arith n)); -_PROTOTYPE(void C_ste_dnam, ( char * s, arith n)); -_PROTOTYPE(void C_ste_dlb, ( label l, arith n)); -_PROTOTYPE(void C_sru_narg, (void)); -_PROTOTYPE(void C_sru, ( arith n)); -_PROTOTYPE(void C_sri_narg, (void)); -_PROTOTYPE(void C_sri, ( arith n)); -_PROTOTYPE(void C_slu_narg, (void)); -_PROTOTYPE(void C_slu, ( arith n)); -_PROTOTYPE(void C_sli_narg, (void)); -_PROTOTYPE(void C_sli, ( arith n)); -_PROTOTYPE(void C_sim, (void)); -_PROTOTYPE(void C_sil, ( arith n)); -_PROTOTYPE(void C_sig, (void)); -_PROTOTYPE(void C_set_narg, (void)); -_PROTOTYPE(void C_set, ( arith n)); -_PROTOTYPE(void C_sdl, ( arith n)); -_PROTOTYPE(void C_sdf, ( arith n)); -_PROTOTYPE(void C_sde, ( arith n)); -_PROTOTYPE(void C_sde_dnam, ( char * s, arith n)); -_PROTOTYPE(void C_sde_dlb, ( label l, arith n)); -_PROTOTYPE(void C_sbu_narg, (void)); -_PROTOTYPE(void C_sbu, ( arith n)); -_PROTOTYPE(void C_sbs_narg, (void)); -_PROTOTYPE(void C_sbs, ( arith n)); -_PROTOTYPE(void C_sbi_narg, (void)); -_PROTOTYPE(void C_sbi, ( arith n)); -_PROTOTYPE(void C_sbf_narg, (void)); -_PROTOTYPE(void C_sbf, ( arith n)); -_PROTOTYPE(void C_sar_narg, (void)); -_PROTOTYPE(void C_sar, ( arith n)); -_PROTOTYPE(void C_rtt, (void)); -_PROTOTYPE(void C_ror_narg, (void)); -_PROTOTYPE(void C_ror, ( arith n)); -_PROTOTYPE(void C_rol_narg, (void)); -_PROTOTYPE(void C_rol, ( arith n)); -_PROTOTYPE(void C_rmu_narg, (void)); -_PROTOTYPE(void C_rmu, ( arith n)); -_PROTOTYPE(void C_rmi_narg, (void)); -_PROTOTYPE(void C_rmi, ( arith n)); -_PROTOTYPE(void C_ret, ( arith n)); -_PROTOTYPE(void C_rck_narg, (void)); -_PROTOTYPE(void C_rck, ( arith n)); -_PROTOTYPE(void C_nop, (void)); -_PROTOTYPE(void C_ngi_narg, (void)); -_PROTOTYPE(void C_ngi, ( arith n)); -_PROTOTYPE(void C_ngf_narg, (void)); -_PROTOTYPE(void C_ngf, ( arith n)); -_PROTOTYPE(void C_mon, (void)); -_PROTOTYPE(void C_mlu_narg, (void)); -_PROTOTYPE(void C_mlu, ( arith n)); -_PROTOTYPE(void C_mli_narg, (void)); -_PROTOTYPE(void C_mli, ( arith n)); -_PROTOTYPE(void C_mlf_narg, (void)); -_PROTOTYPE(void C_mlf, ( arith n)); -_PROTOTYPE(void C_lxl, ( arith n)); -_PROTOTYPE(void C_lxa, ( arith n)); -_PROTOTYPE(void C_lpi, ( char * s)); -_PROTOTYPE(void C_lpb, (void)); -_PROTOTYPE(void C_los_narg, (void)); -_PROTOTYPE(void C_los, ( arith n)); -_PROTOTYPE(void C_lor, ( arith n)); -_PROTOTYPE(void C_lol, ( arith n)); -_PROTOTYPE(void C_loi, ( arith n)); -_PROTOTYPE(void C_lof, ( arith n)); -_PROTOTYPE(void C_loe, ( arith n)); -_PROTOTYPE(void C_loe_dnam, ( char * s, arith n)); -_PROTOTYPE(void C_loe_dlb, ( label l, arith n)); -_PROTOTYPE(void C_loc, ( arith n)); -_PROTOTYPE(void C_lni, (void)); -_PROTOTYPE(void C_lin, ( arith n)); -_PROTOTYPE(void C_lim, (void)); -_PROTOTYPE(void C_lil, ( arith n)); -_PROTOTYPE(void C_lfr, ( arith n)); -_PROTOTYPE(void C_ldl, ( arith n)); -_PROTOTYPE(void C_ldf, ( arith n)); -_PROTOTYPE(void C_lde, ( arith n)); -_PROTOTYPE(void C_lde_dnam, ( char * s, arith n)); -_PROTOTYPE(void C_lde_dlb, ( label l, arith n)); -_PROTOTYPE(void C_ldc, ( arith n)); -_PROTOTYPE(void C_lar_narg, (void)); -_PROTOTYPE(void C_lar, ( arith n)); -_PROTOTYPE(void C_lal, ( arith n)); -_PROTOTYPE(void C_lae, ( arith n)); -_PROTOTYPE(void C_lae_dnam, ( char * s, arith n)); -_PROTOTYPE(void C_lae_dlb, ( label l, arith n)); -_PROTOTYPE(void C_ior_narg, (void)); -_PROTOTYPE(void C_ior, ( arith n)); -_PROTOTYPE(void C_inn_narg, (void)); -_PROTOTYPE(void C_inn, ( arith n)); -_PROTOTYPE(void C_inl, ( arith n)); -_PROTOTYPE(void C_ine, ( arith n)); -_PROTOTYPE(void C_ine_dnam, ( char * s, arith n)); -_PROTOTYPE(void C_ine_dlb, ( label l, arith n)); -_PROTOTYPE(void C_inc, (void)); -_PROTOTYPE(void C_gto, ( arith n)); -_PROTOTYPE(void C_gto_dnam, ( char * s, arith n)); -_PROTOTYPE(void C_gto_dlb, ( label l, arith n)); -_PROTOTYPE(void C_fil, ( arith n)); -_PROTOTYPE(void C_fil_dnam, ( char * s, arith n)); -_PROTOTYPE(void C_fil_dlb, ( label l, arith n)); -_PROTOTYPE(void C_fif_narg, (void)); -_PROTOTYPE(void C_fif, ( arith n)); -_PROTOTYPE(void C_fef_narg, (void)); -_PROTOTYPE(void C_fef, ( arith n)); -_PROTOTYPE(void C_exg_narg, (void)); -_PROTOTYPE(void C_exg, ( arith n)); -_PROTOTYPE(void C_dvu_narg, (void)); -_PROTOTYPE(void C_dvu, ( arith n)); -_PROTOTYPE(void C_dvi_narg, (void)); -_PROTOTYPE(void C_dvi, ( arith n)); -_PROTOTYPE(void C_dvf_narg, (void)); -_PROTOTYPE(void C_dvf, ( arith n)); -_PROTOTYPE(void C_dus_narg, (void)); -_PROTOTYPE(void C_dus, ( arith n)); -_PROTOTYPE(void C_dup, ( arith n)); -_PROTOTYPE(void C_del, ( arith n)); -_PROTOTYPE(void C_dee, ( arith n)); -_PROTOTYPE(void C_dee_dnam, ( char * s, arith n)); -_PROTOTYPE(void C_dee_dlb, ( label l, arith n)); -_PROTOTYPE(void C_dec, (void)); -_PROTOTYPE(void C_dch, (void)); -_PROTOTYPE(void C_cuu, (void)); -_PROTOTYPE(void C_cui, (void)); -_PROTOTYPE(void C_cuf, (void)); -_PROTOTYPE(void C_csb_narg, (void)); -_PROTOTYPE(void C_csb, ( arith n)); -_PROTOTYPE(void C_csa_narg, (void)); -_PROTOTYPE(void C_csa, ( arith n)); -_PROTOTYPE(void C_com_narg, (void)); -_PROTOTYPE(void C_com, ( arith n)); -_PROTOTYPE(void C_cmu_narg, (void)); -_PROTOTYPE(void C_cmu, ( arith n)); -_PROTOTYPE(void C_cms_narg, (void)); -_PROTOTYPE(void C_cms, ( arith n)); -_PROTOTYPE(void C_cmp, (void)); -_PROTOTYPE(void C_cmi_narg, (void)); -_PROTOTYPE(void C_cmi, ( arith n)); -_PROTOTYPE(void C_cmf_narg, (void)); -_PROTOTYPE(void C_cmf, ( arith n)); -_PROTOTYPE(void C_ciu, (void)); -_PROTOTYPE(void C_cii, (void)); -_PROTOTYPE(void C_cif, (void)); -_PROTOTYPE(void C_cfu, (void)); -_PROTOTYPE(void C_cfi, (void)); -_PROTOTYPE(void C_cff, (void)); -_PROTOTYPE(void C_cal, ( char * s)); -_PROTOTYPE(void C_cai, (void)); -_PROTOTYPE(void C_bra, ( label l)); -_PROTOTYPE(void C_bne, ( label l)); -_PROTOTYPE(void C_blt, ( label l)); -_PROTOTYPE(void C_bls_narg, (void)); -_PROTOTYPE(void C_bls, ( arith n)); -_PROTOTYPE(void C_blm, ( arith n)); -_PROTOTYPE(void C_ble, ( label l)); -_PROTOTYPE(void C_bgt, ( label l)); -_PROTOTYPE(void C_bge, ( label l)); -_PROTOTYPE(void C_beq, ( label l)); -_PROTOTYPE(void C_ass_narg, (void)); -_PROTOTYPE(void C_ass, ( arith n)); -_PROTOTYPE(void C_asp, ( arith n)); -_PROTOTYPE(void C_and_narg, (void)); -_PROTOTYPE(void C_and, ( arith n)); -_PROTOTYPE(void C_adu_narg, (void)); -_PROTOTYPE(void C_adu, ( arith n)); -_PROTOTYPE(void C_ads_narg, (void)); -_PROTOTYPE(void C_ads, ( arith n)); -_PROTOTYPE(void C_adp, ( arith n)); -_PROTOTYPE(void C_adi_narg, (void)); -_PROTOTYPE(void C_adi, ( arith n)); -_PROTOTYPE(void C_adf_narg, (void)); -_PROTOTYPE(void C_adf, ( arith n)); -_PROTOTYPE(void C_aar_narg, (void)); -_PROTOTYPE(void C_aar, ( arith n)); -_PROTOTYPE(void C_df_ilb, ( label l)); +void C_insertpart( int id); +void C_beginpart( int id); +void C_endpart( int id); +void C_pro( char * s, arith l); +void C_pro_narg( char * s); +void C_end( arith l); +void C_end_narg(void); +void C_df_dlb( label l); +void C_df_dnam( char * s); +void C_exa_dnam( char * s); +void C_exa_dlb( label l); +void C_exp( char * s); +void C_ina_dnam( char * s); +void C_ina_dlb( label l); +void C_inp( char * s); +void C_bss_cst( arith n, arith w, int i); +void C_bss_icon( arith n, char* s, arith sz, int i); +void C_bss_ucon( arith n, char* s, arith sz, int i); +void C_bss_fcon( arith n, char* s, arith sz, int i); +void C_bss_dnam( arith n, char* s, arith offs, int i); +void C_bss_dlb( arith n, label l, arith offs, int i); +void C_bss_ilb( arith n, label l, int i); +void C_bss_pnam( arith n, char* s, int i); +void C_hol_cst( arith n, arith w, int i); +void C_hol_icon( arith n, char* s, arith sz, int i); +void C_hol_ucon( arith n, char* s, arith sz, int i); +void C_hol_fcon( arith n, char* s, arith sz, int i); +void C_hol_dnam( arith n, char* s, arith offs, int i); +void C_hol_dlb( arith n, label l, arith offs, int i); +void C_hol_ilb( arith n, label l, int i); +void C_hol_pnam( arith n, char* s, int i); +void C_con_cst( arith l); +void C_con_icon( char * val, arith siz); +void C_con_ucon( char * val, arith siz); +void C_con_fcon( char * val, arith siz); +void C_con_scon( char * str, arith siz); +void C_con_dnam( char * str, arith val); +void C_con_dlb( label l, arith val); +void C_con_ilb( label l); +void C_con_pnam( char * str); +void C_rom_cst( arith l); +void C_rom_icon( char * val, arith siz); +void C_rom_ucon( char * val, arith siz); +void C_rom_fcon( char * val, arith siz); +void C_rom_scon( char * str, arith siz); +void C_rom_dnam( char * str, arith val); +void C_rom_dlb( label l, arith val); +void C_rom_ilb( label l); +void C_rom_pnam( char * str); +void C_cst( arith l); +void C_icon( char * val, arith siz); +void C_ucon( char * val, arith siz); +void C_fcon( char * val, arith siz); +void C_scon( char * str, arith siz); +void C_dnam( char * str, arith val); +void C_dlb( label l, arith val); +void C_ilb( label l); +void C_pnam( char * str); +void C_mes_begin( int ms); +void C_mes_end(void); +void C_exc( arith c1, arith c2); +void C_zrl( arith n); +void C_zrf_narg(void); +void C_zrf( arith n); +void C_zre( arith n); +void C_zre_dnam( char * s, arith n); +void C_zre_dlb( label l, arith n); +void C_zne( label l); +void C_zlt( label l); +void C_zle( label l); +void C_zgt( label l); +void C_zge( label l); +void C_zer_narg(void); +void C_zer( arith n); +void C_zeq( label l); +void C_xor_narg(void); +void C_xor( arith n); +void C_trp(void); +void C_tne(void); +void C_tlt(void); +void C_tle(void); +void C_tgt(void); +void C_tge(void); +void C_teq(void); +void C_sts_narg(void); +void C_sts( arith n); +void C_str( arith n); +void C_stl( arith n); +void C_sti( arith n); +void C_stf( arith n); +void C_ste( arith n); +void C_ste_dnam( char * s, arith n); +void C_ste_dlb( label l, arith n); +void C_sru_narg(void); +void C_sru( arith n); +void C_sri_narg(void); +void C_sri( arith n); +void C_slu_narg(void); +void C_slu( arith n); +void C_sli_narg(void); +void C_sli( arith n); +void C_sim(void); +void C_sil( arith n); +void C_sig(void); +void C_set_narg(void); +void C_set( arith n); +void C_sdl( arith n); +void C_sdf( arith n); +void C_sde( arith n); +void C_sde_dnam( char * s, arith n); +void C_sde_dlb( label l, arith n); +void C_sbu_narg(void); +void C_sbu( arith n); +void C_sbs_narg(void); +void C_sbs( arith n); +void C_sbi_narg(void); +void C_sbi( arith n); +void C_sbf_narg(void); +void C_sbf( arith n); +void C_sar_narg(void); +void C_sar( arith n); +void C_rtt(void); +void C_ror_narg(void); +void C_ror( arith n); +void C_rol_narg(void); +void C_rol( arith n); +void C_rmu_narg(void); +void C_rmu( arith n); +void C_rmi_narg(void); +void C_rmi( arith n); +void C_ret( arith n); +void C_rck_narg(void); +void C_rck( arith n); +void C_nop(void); +void C_ngi_narg(void); +void C_ngi( arith n); +void C_ngf_narg(void); +void C_ngf( arith n); +void C_mon(void); +void C_mlu_narg(void); +void C_mlu( arith n); +void C_mli_narg(void); +void C_mli( arith n); +void C_mlf_narg(void); +void C_mlf( arith n); +void C_lxl( arith n); +void C_lxa( arith n); +void C_lpi( char * s); +void C_lpb(void); +void C_los_narg(void); +void C_los( arith n); +void C_lor( arith n); +void C_lol( arith n); +void C_loi( arith n); +void C_lof( arith n); +void C_loe( arith n); +void C_loe_dnam( char * s, arith n); +void C_loe_dlb( label l, arith n); +void C_loc( arith n); +void C_lni(void); +void C_lin( arith n); +void C_lim(void); +void C_lil( arith n); +void C_lfr( arith n); +void C_ldl( arith n); +void C_ldf( arith n); +void C_lde( arith n); +void C_lde_dnam( char * s, arith n); +void C_lde_dlb( label l, arith n); +void C_ldc( arith n); +void C_lar_narg(void); +void C_lar( arith n); +void C_lal( arith n); +void C_lae( arith n); +void C_lae_dnam( char * s, arith n); +void C_lae_dlb( label l, arith n); +void C_ior_narg(void); +void C_ior( arith n); +void C_inn_narg(void); +void C_inn( arith n); +void C_inl( arith n); +void C_ine( arith n); +void C_ine_dnam( char * s, arith n); +void C_ine_dlb( label l, arith n); +void C_inc(void); +void C_gto( arith n); +void C_gto_dnam( char * s, arith n); +void C_gto_dlb( label l, arith n); +void C_fil( arith n); +void C_fil_dnam( char * s, arith n); +void C_fil_dlb( label l, arith n); +void C_fif_narg(void); +void C_fif( arith n); +void C_fef_narg(void); +void C_fef( arith n); +void C_exg_narg(void); +void C_exg( arith n); +void C_dvu_narg(void); +void C_dvu( arith n); +void C_dvi_narg(void); +void C_dvi( arith n); +void C_dvf_narg(void); +void C_dvf( arith n); +void C_dus_narg(void); +void C_dus( arith n); +void C_dup( arith n); +void C_del( arith n); +void C_dee( arith n); +void C_dee_dnam( char * s, arith n); +void C_dee_dlb( label l, arith n); +void C_dec(void); +void C_dch(void); +void C_cuu(void); +void C_cui(void); +void C_cuf(void); +void C_csb_narg(void); +void C_csb( arith n); +void C_csa_narg(void); +void C_csa( arith n); +void C_com_narg(void); +void C_com( arith n); +void C_cmu_narg(void); +void C_cmu( arith n); +void C_cms_narg(void); +void C_cms( arith n); +void C_cmp(void); +void C_cmi_narg(void); +void C_cmi( arith n); +void C_cmf_narg(void); +void C_cmf( arith n); +void C_ciu(void); +void C_cii(void); +void C_cif(void); +void C_cfu(void); +void C_cfi(void); +void C_cff(void); +void C_cal( char * s); +void C_cai(void); +void C_bra( label l); +void C_bne( label l); +void C_blt( label l); +void C_bls_narg(void); +void C_bls( arith n); +void C_blm( arith n); +void C_ble( label l); +void C_bgt( label l); +void C_bge( label l); +void C_beq( label l); +void C_ass_narg(void); +void C_ass( arith n); +void C_asp( arith n); +void C_and_narg(void); +void C_and( arith n); +void C_adu_narg(void); +void C_adu( arith n); +void C_ads_narg(void); +void C_ads( arith n); +void C_adp( arith n); +void C_adi_narg(void); +void C_adi( arith n); +void C_adf_narg(void); +void C_adf( arith n); +void C_aar_narg(void); +void C_aar( arith n); +void C_df_ilb( label l); diff --git a/modules/src/em_code/em_private.h b/modules/src/em_code/em_private.h index f259972b16..bbc148f77b 100644 --- a/modules/src/em_code/em_private.h +++ b/modules/src/em_code/em_private.h @@ -14,8 +14,6 @@ #include "em_mnem.h" #include "em_reg.h" -#include "ansi.h" - #include "em_codeEK.h" #ifdef READABLE_EM diff --git a/modules/src/em_opt/nopt.h b/modules/src/em_opt/nopt.h index 2e8b0cfd2f..938d061aa2 100644 --- a/modules/src/em_opt/nopt.h +++ b/modules/src/em_opt/nopt.h @@ -11,7 +11,6 @@ #include #include #include -#include #define MAXBUFFER 200 #define MAXSTRING 1000 @@ -59,47 +58,47 @@ extern int OO_wrstats; /* statistics output */ #define DEFILB(p) (p.em_ilb) #define DEFINED(p) (p.em_argtype) -_PROTOTYPE(void EM_mkop, (p_instr, int)); -_PROTOTYPE(void EM_mknarg, (p_instr, int)); -_PROTOTYPE(void EM_mkilb, (p_instr, int, label)); -_PROTOTYPE(void EM_mknof, (p_instr, int, label, arith)); -_PROTOTYPE(void EM_mksof, (p_instr, int, char *, arith)); -_PROTOTYPE(void EM_mkcst, (p_instr, int, arith)); -_PROTOTYPE(void EM_mkpro, (p_instr, int, char *)); -_PROTOTYPE(void EM_mkdefilb, (p_instr, int, label)); -_PROTOTYPE(void EM_Nop, (int)); -_PROTOTYPE(void EM_Nnarg, (int)); -_PROTOTYPE(void EM_Nilb, (int, label)); -_PROTOTYPE(void EM_Nnof, (int, label, arith)); -_PROTOTYPE(void EM_Nsof, (int, char *, arith)); -_PROTOTYPE(void EM_Ncst, (int, arith)); -_PROTOTYPE(void EM_Npro, (int, char *)); -_PROTOTYPE(void EM_Ndefilb, (int, label)); -_PROTOTYPE(void EM_Rop, (int)); -_PROTOTYPE(void EM_Rnarg, (int)); -_PROTOTYPE(void EM_Rilb, (int, label)); -_PROTOTYPE(void EM_Rnof, (int, label, arith)); -_PROTOTYPE(void EM_Rsof, (int, char *, arith)); -_PROTOTYPE(void EM_Rcst, (int, arith)); -_PROTOTYPE(void EM_Rpro, (int, char *)); -_PROTOTYPE(void EM_Rdefilb, (int, label)); +void EM_mkop(p_instr, int); +void EM_mknarg(p_instr, int); +void EM_mkilb(p_instr, int, label); +void EM_mknof(p_instr, int, label, arith); +void EM_mksof(p_instr, int, char *, arith); +void EM_mkcst(p_instr, int, arith); +void EM_mkpro(p_instr, int, char *); +void EM_mkdefilb(p_instr, int, label); +void EM_Nop(int); +void EM_Nnarg(int); +void EM_Nilb(int, label); +void EM_Nnof(int, label, arith); +void EM_Nsof(int, char *, arith); +void EM_Ncst(int, arith); +void EM_Npro(int, char *); +void EM_Ndefilb(int, label); +void EM_Rop(int); +void EM_Rnarg(int); +void EM_Rilb(int, label); +void EM_Rnof(int, label, arith); +void EM_Rsof(int, char *, arith); +void EM_Rcst(int, arith); +void EM_Rpro(int, char *); +void EM_Rdefilb(int, label); -_PROTOTYPE(arith OO_rotate, (arith, arith)); -_PROTOTYPE(int OO_signsame, (arith, arith)); -_PROTOTYPE(int OO_sfit, (arith, arith)); -_PROTOTYPE(int OO_ufit, (arith, arith)); -_PROTOTYPE(int OO_extsame, (p_instr, p_instr)); -_PROTOTYPE(int OO_namsame, (p_instr, p_instr)); -_PROTOTYPE(arith OO_offset, (p_instr)); +arith OO_rotate(arith, arith); +int OO_signsame(arith, arith); +int OO_sfit(arith, arith); +int OO_ufit(arith, arith); +int OO_extsame(p_instr, p_instr); +int OO_namsame(p_instr, p_instr); +arith OO_offset(p_instr); -_PROTOTYPE(char *OO_freestr, (char *)); -_PROTOTYPE(void OO_dfa, (int)); -_PROTOTYPE(void OO_flush, (void)); -_PROTOTYPE(p_instr OO_halfflush, (void)); -_PROTOTYPE(void OO_mkext, (p_instr, int, p_instr, arith)); -_PROTOTYPE(void OO_mkrepl, (int, int, int)); +char *OO_freestr(char *); +void OO_dfa(int); +void OO_flush(void); +p_instr OO_halfflush(void); +void OO_mkext(p_instr, int, p_instr, arith); +void OO_mkrepl(int, int, int); #ifdef DEBUG -_PROTOTYPE(void dumpstate, (char *)); -_PROTOTYPE(void prtinst, (p_instr)); +void dumpstate(char *); +void prtinst(p_instr); #endif diff --git a/modules/src/idf/idf_pkg.spec b/modules/src/idf/idf_pkg.spec index eb7b634973..6b375d5338 100644 --- a/modules/src/idf/idf_pkg.spec +++ b/modules/src/idf/idf_pkg.spec @@ -1,8 +1,6 @@ /* $Id$ */ /* IDENTIFIER DESCRIPTOR */ -#include - /* This a generic package for maintaining a name list */ /* Instantiation parameters, supplied by #define, are : diff --git a/modules/src/input/inp_pkg.spec b/modules/src/input/inp_pkg.spec index e33264e80f..623f758706 100644 --- a/modules/src/input/inp_pkg.spec +++ b/modules/src/input/inp_pkg.spec @@ -16,8 +16,6 @@ to work. Its default value is 1. */ -#include - /* INPUT PRIMITIVES */ #define LoadChar(dest) (dest = loadchar()) @@ -34,12 +32,12 @@ extern void INP_pushback(void); extern char *_ipp; -_PROTOTYPE(int loadchar, (void)); -_PROTOTYPE(int loadbuf, (void)); -_PROTOTYPE(int AtEoIT, (void)); -_PROTOTYPE(int AtEoIF, (void)); -_PROTOTYPE(int InsertFile, (char *, char **, char **)); -_PROTOTYPE(int InsertText, (char *, int)); +int loadchar(void); +int loadbuf(void); +int AtEoIT(void); +int AtEoIF(void); +int InsertFile(char *, char **, char **); +int InsertText(char *, int); /* int InsertFile(filename, table, result) char *filename; diff --git a/modules/src/read_em/em_comp.h b/modules/src/read_em/em_comp.h index 80f3e1c120..66ed83ed37 100644 --- a/modules/src/read_em/em_comp.h +++ b/modules/src/read_em/em_comp.h @@ -13,7 +13,6 @@ #ifndef __EMCOMP_INCLUDED__ #define __EMCOMP_INCLUDED__ -#include #include "em_arith.h" #include "em_label.h" diff --git a/plat/minix/include/ack/signal.h b/plat/minix/include/ack/signal.h index 24f9afd57c..7da6d74f35 100644 --- a/plat/minix/include/ack/signal.h +++ b/plat/minix/include/ack/signal.h @@ -59,10 +59,6 @@ typedef unsigned short sigset_t; #define SIG_UNBLOCK 1 /* for unblocking signals */ #define SIG_SETMASK 2 /* for setting the signal mask */ -#ifndef _ANSI_H -#include -#endif - /* Macros used as function pointers and one awful prototype. */ #define SIG_DFL ((void (*)(int))0) /* default signal handling */ #define SIG_IGN ((void (*)(int))1) /* ignore signal */ @@ -80,13 +76,13 @@ struct sigaction #endif #ifdef _POSIX_SOURCE -_PROTOTYPE(int sigaddset, (sigset_t * _set)); -_PROTOTYPE(int sigdelset, (sigset_t * _set)); -_PROTOTYPE(int sigemptyset, (sigset_t * _set)); -_PROTOTYPE(int sigfillset, (sigset_t * _set)); -_PROTOTYPE(int sigismember, (sigset_t * _set, int _signo)); -_PROTOTYPE(int sigpending, (sigset_t * set)); -_PROTOTYPE(int sigsuspend, (sigset_t * _sigmask)); +int sigaddset(sigset_t * _set); +int sigdelset(sigset_t * _set); +int sigemptyset(sigset_t * _set); +int sigfillset(sigset_t * _set); +int sigismember(sigset_t * _set, int _signo); +int sigpending(sigset_t * set); +int sigsuspend(sigset_t * _sigmask); #endif #endif /* _SIGNAL_H */ diff --git a/plat/minix/include/ansi.h b/plat/minix/include/ansi.h deleted file mode 100644 index cd6ece2729..0000000000 --- a/plat/minix/include/ansi.h +++ /dev/null @@ -1,54 +0,0 @@ -/* The header checks whether the compiler claims conformance to ANSI - * Standard C. If so, the symbol _ANSI is defined as 1, otherwise it is - * defined as 0. Based on the result, a macro - * - * _PROTOTYPE(function, params) - * - * is defined. This macro expands in different ways, generating either - * ANSI Standard C prototypes or old-style K&R (Kernighan & Ritchie) - * prototypes, as needed. Finally, some programs use _CONST, _VOIDSTAR etc - * in such a way that they are portable over both ANSI and K&R compilers. - * The appropriate macros are defined here. - */ - -#ifndef _ANSI_H -#define _ANSI_H - -/* ANSI C requires __STDC__ to be defined as 1 for an ANSI C compiler. - * Some half-ANSI compilers define it as 0. Get around this here. - */ - -#define _ANSI 0 /* 0 if compiler is not ANSI C, 1 if it is */ - -#ifdef __STDC__ /* __STDC__ defined for (near) ANSI compilers*/ -#if __STDC__ == 1 /* __STDC__ == 1 for conformant compilers */ -#undef _ANSI /* get rid of above definition */ -#define _ANSI 1 /* _ANSI = 1 for ANSI C compilers */ -#endif -#endif - -/* At this point, _ANSI has been set correctly to 0 or 1. Define the - * _PROTOTYPE macro to either expand both of its arguments (ANSI prototypes), - * only the function name (K&R prototypes). - */ - -#if _ANSI -#define _PROTOTYPE(function, params) function params -#define _VOIDSTAR void* -#define _VOID void -#define _CONST const -#define _VOLATILE volatile -#define _SIZET size_t - -#else - -#define _PROTOTYPE(function, params) function() -#define _VOIDSTAR void* -#define _VOID void -#define _CONST -#define _VOLATILE -#define _SIZET int - -#endif /* _ANSI */ - -#endif /* ANSI_H */ diff --git a/plat/minix/include/minix/type.h b/plat/minix/include/minix/type.h index b87adafa49..9da3fb0308 100644 --- a/plat/minix/include/minix/type.h +++ b/plat/minix/include/minix/type.h @@ -69,21 +69,12 @@ typedef struct int m5i1, m5i2; long m5l1, m5l2, m5l3; } mess_5; -#if _ANSI typedef struct { int m6i1, m6i2, m6i3; long m6l1; void (*m6f1)(int); } mess_6; -#else -typedef struct -{ - int m6i1, m6i2, m6i3; - long m6l1; - void (*m6f1)(); -} mess_6; -#endif typedef struct { diff --git a/plat/minix/include/sgtty.h b/plat/minix/include/sgtty.h index d54da1c80c..8dcac4b340 100644 --- a/plat/minix/include/sgtty.h +++ b/plat/minix/include/sgtty.h @@ -89,10 +89,8 @@ struct tchars #define DC_WBMS200 (DCLOCK | 9) #endif -#include - -_PROTOTYPE(int gtty, (int _fd, struct sgttyb* _argp)); -_PROTOTYPE(int ioctl, (int _fd, int _request, struct sgttyb* _argp)); -_PROTOTYPE(int stty, (int _fd, struct sgttyb* _argp)); +int gtty(int _fd, struct sgttyb* _argp); +int ioctl(int _fd, int _request, struct sgttyb* _argp); +int stty(int _fd, struct sgttyb* _argp); #endif /* _SGTTY_H */ diff --git a/plat/minix/include/sys/stat.h b/plat/minix/include/sys/stat.h index 424e0bd7a5..37b2f43208 100644 --- a/plat/minix/include/sys/stat.h +++ b/plat/minix/include/sys/stat.h @@ -61,16 +61,11 @@ struct stat #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* is a block spec */ #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* is a pipe/FIFO */ -/* Function Prototypes. */ -#ifndef _ANSI_H -#include -#endif - -_PROTOTYPE(int chmod, (const char* _path, mode_t _mode)); -_PROTOTYPE(int fstat, (int _fildes, struct stat* _buf)); -_PROTOTYPE(int mkdir, (const char* _path, int _mode)); -_PROTOTYPE(int mkfifo, (const char* _path, int _mode)); -_PROTOTYPE(int stat, (const char* _path, struct stat* _buf)); -_PROTOTYPE(mode_t umask, (int _cmask)); +int chmod(const char* _path, mode_t _mode); +int fstat(int _fildes, struct stat* _buf); +int mkdir(const char* _path, int _mode); +int mkfifo(const char* _path, int _mode); +int stat(const char* _path, struct stat* _buf); +mode_t umask(int _cmask); #endif /* _STAT_H */ diff --git a/plat/minix/include/sys/wait.h b/plat/minix/include/sys/wait.h index f1ec55572d..fa9e75fd7c 100644 --- a/plat/minix/include/sys/wait.h +++ b/plat/minix/include/sys/wait.h @@ -29,12 +29,7 @@ #define WIFSTOPPED(s) (_LOW(s) == 0177) /* stopped */ #define WSTOPSIG(s) (_HIGH(s) & 0377) /* stop signal */ -/* Function Prototypes. */ -#ifndef _ANSI_H -#include -#endif - -_PROTOTYPE(pid_t wait, (int* _stat_loc)); -_PROTOTYPE(pid_t waitpid, (pid_t _pid, int* _stat_loc, int _options)); +pid_t wait(int* _stat_loc); +pid_t waitpid(pid_t _pid, int* _stat_loc, int _options); #endif /* _WAIT_H */ diff --git a/plat/minix68k/libsys/_chmod.c b/plat/minix68k/libsys/_chmod.c index b5d995921e..3293f22aa7 100644 --- a/plat/minix68k/libsys/_chmod.c +++ b/plat/minix68k/libsys/_chmod.c @@ -2,7 +2,7 @@ #define chmod _chmod #include -PUBLIC int chmod(_CONST char* name, mode_t mode) +PUBLIC int chmod(const char* name, mode_t mode) { return (_callm3(FS, CHMOD, mode, name)); } diff --git a/plat/minix68k/libsys/_creat.c b/plat/minix68k/libsys/_creat.c index 5f2f12b36b..779e3ae221 100644 --- a/plat/minix68k/libsys/_creat.c +++ b/plat/minix68k/libsys/_creat.c @@ -2,7 +2,7 @@ #define creat _creat #include -PUBLIC int creat(_CONST char* name, mode_t mode) +PUBLIC int creat(const char* name, mode_t mode) { return (_callm3(FS, CREAT, mode, name)); } diff --git a/plat/minix68k/libsys/_exec.c b/plat/minix68k/libsys/_exec.c index f962b5b88a..2ca33ea792 100644 --- a/plat/minix68k/libsys/_exec.c +++ b/plat/minix68k/libsys/_exec.c @@ -9,7 +9,7 @@ extern char** environ; /* environment pointer */ #define PTRSIZE (sizeof(char*)) -_PROTOTYPE(char* _sbrk, (int _incr)); +char* _sbrk(int _incr); #if 0 // dtrg --- this is all very wrong and needs rewriting PUBLIC int execl(const char* name, const char* arg, ...) diff --git a/plat/minix68k/libsys/_execn.c b/plat/minix68k/libsys/_execn.c index c4015906db..4d8513dc3e 100644 --- a/plat/minix68k/libsys/_execn.c +++ b/plat/minix68k/libsys/_execn.c @@ -1,7 +1,7 @@ #include "lib.h" #define PTRSIZE sizeof(char*) -_PROTOTYPE(int _execn, (char* name)); +int _execn(char* name); PUBLIC int _execn(name) char* name; /* pointer to file to be exec'd */ diff --git a/plat/minix68k/libsys/_execnl.c b/plat/minix68k/libsys/_execnl.c index 25a0b53766..86257726d2 100644 --- a/plat/minix68k/libsys/_execnl.c +++ b/plat/minix68k/libsys/_execnl.c @@ -10,9 +10,9 @@ #define MAXSTK 256 /* maximum EXEC stack size */ #define PTRSIZE sizeof(char*) -_PROTOTYPE(int _execn, (char* name)); -_PROTOTYPE(int _execnl, (char* name, char* arg0)); -static _PROTOTYPE(int _nexec, (char* name, char* argv[])); +int _execn(char* name); +int _execnl(char* name, char* arg0); +static int _nexec(char* name, char* argv[]); PUBLIC int _execn(name) char* name; /* pointer to file to be exec'd */ diff --git a/plat/minix68k/libsys/_getcwd.c b/plat/minix68k/libsys/_getcwd.c index 66a483a2e0..7fa1e7e009 100644 --- a/plat/minix68k/libsys/_getcwd.c +++ b/plat/minix68k/libsys/_getcwd.c @@ -14,7 +14,7 @@ #define DIRECT_SIZE (sizeof(struct direct)) -static _PROTOTYPE(void go_back, (char* path)); +static void go_back(char* path); char* getcwd(char* buffer, int size) /* Get current working directory. */ diff --git a/plat/minix68k/libsys/_link.c b/plat/minix68k/libsys/_link.c index 2ea924461a..07c9410728 100644 --- a/plat/minix68k/libsys/_link.c +++ b/plat/minix68k/libsys/_link.c @@ -2,7 +2,7 @@ #define link _link #include -PUBLIC int link(_CONST char* name, _CONST char* name2) +PUBLIC int link(const char* name, const char* name2) { return (_callm1( FS, LINK, _len(name), _len(name2), 0, (char*)name, diff --git a/plat/minix68k/libsys/_mkdir.c b/plat/minix68k/libsys/_mkdir.c index 1d10129242..404eade359 100644 --- a/plat/minix68k/libsys/_mkdir.c +++ b/plat/minix68k/libsys/_mkdir.c @@ -2,9 +2,7 @@ #define mkdir _mkdir #include -PUBLIC int mkdir(name, mode) -_CONST char* name; -int mode; +PUBLIC int mkdir(const char* name, int mode) { return (_callm1(FS, MKDIR, _len(name), mode, 0, (char*)name, NIL_PTR, NIL_PTR)); } diff --git a/plat/minix68k/libsys/_mkfifo.c b/plat/minix68k/libsys/_mkfifo.c index 52df71b1f2..e4b8ac628d 100644 --- a/plat/minix68k/libsys/_mkfifo.c +++ b/plat/minix68k/libsys/_mkfifo.c @@ -3,9 +3,7 @@ #define mkfifo _mkfifo #include -PUBLIC int mkfifo(name, mode) -_CONST char* name; -int mode; +PUBLIC int mkfifo(const char* name, int mode) { mode = (mode & 0777) | S_IFIFO; return (_callm1(FS, MKNOD, _len(name), (int)mode, 0, (char*)name, NIL_PTR, NIL_PTR)); diff --git a/plat/minix68k/libsys/_mknod.c b/plat/minix68k/libsys/_mknod.c index cc7ebb1162..1393951e4b 100644 --- a/plat/minix68k/libsys/_mknod.c +++ b/plat/minix68k/libsys/_mknod.c @@ -2,7 +2,7 @@ #define mknod _mknod #include -PUBLIC int mknod(_CONST char* name, int mode, int addr) +PUBLIC int mknod(const char* name, int mode, int addr) { return (_callm1(FS, MKNOD, _len(name), mode, addr, (char*)name, (char*)0, NIL_PTR)); } diff --git a/plat/minix68k/libsys/_mknod4.c b/plat/minix68k/libsys/_mknod4.c index 207c032c77..034bae8340 100644 --- a/plat/minix68k/libsys/_mknod4.c +++ b/plat/minix68k/libsys/_mknod4.c @@ -2,7 +2,7 @@ #define mknod4 _mknod4 #include -PUBLIC int mknod4(_CONST char* name, int mode, int addr, unsigned int size) +PUBLIC int mknod4(const char* name, int mode, int addr, unsigned int size) { return (_callm1(FS, MKNOD, _len(name), mode, addr, (char*)name, (char*)size, NIL_PTR)); } diff --git a/plat/minix68k/libsys/_open.c b/plat/minix68k/libsys/_open.c index 06cf89882c..a4138a58e1 100644 --- a/plat/minix68k/libsys/_open.c +++ b/plat/minix68k/libsys/_open.c @@ -3,7 +3,6 @@ #define open _open #include -#if _ANSI #include PUBLIC int open(const char* name, int flags, ...) @@ -21,13 +20,3 @@ PUBLIC int open(const char* name, int flags, ...) } return _callm3(FS, OPEN, flags, name); } -#else -PUBLIC int open(name, flags, mode) -_CONST char* name; -int flags, mode; -{ - if (flags & O_CREAT) - return _callm1(FS, OPEN, _len(name), flags, mode, (char*)name, NIL_PTR, NIL_PTR); - return (_callm3(FS, OPEN, flags, name)); -} -#endif diff --git a/plat/minix68k/libsys/_rename.c b/plat/minix68k/libsys/_rename.c index c8f118fb7a..8c1d7e5c83 100644 --- a/plat/minix68k/libsys/_rename.c +++ b/plat/minix68k/libsys/_rename.c @@ -3,7 +3,7 @@ #include PUBLIC int rename(name, name2) -_CONST char *name, *name2; +const char *name, *name2; { return (_callm1( FS, RENAME, _len(name), _len(name2), 0, (char*)name, diff --git a/plat/minix68k/libsys/_rmdir.c b/plat/minix68k/libsys/_rmdir.c index 9b7c870981..d77f1153d5 100644 --- a/plat/minix68k/libsys/_rmdir.c +++ b/plat/minix68k/libsys/_rmdir.c @@ -2,7 +2,7 @@ #define rmdir _rmdir #include -PUBLIC int rmdir(_CONST char* name) +PUBLIC int rmdir(const char* name) { return (_callm3(FS, RMDIR, 0, name)); } diff --git a/plat/minix68k/libsys/_signal.c b/plat/minix68k/libsys/_signal.c index 1871d4e94c..7fa4627395 100644 --- a/plat/minix68k/libsys/_signal.c +++ b/plat/minix68k/libsys/_signal.c @@ -2,7 +2,7 @@ #define signal _signal #include -extern _PROTOTYPE(void(*_vectab[_NSIG]), (int)); /* array of funcs to catch signals */ +extern void(*_vectab[_NSIG])(int); /* array of funcs to catch signals */ /* The definition of signal really should be * PUBLIC void (*signal(signr, func))() @@ -14,10 +14,10 @@ extern _PROTOTYPE(void(*_vectab[_NSIG]), (int)); /* array of funcs to catch sign */ PUBLIC void (*signal(signr, func))() int signr; /* which signal is being set */ -_PROTOTYPE(void(*func), (int)); /* pointer to function that catches signal */ +void(*func)(int); /* pointer to function that catches signal */ { int r; - _PROTOTYPE(void(*old), (int)); + void(*old)(int); old = _vectab[signr - 1]; _M.m6_i1 = signr; diff --git a/plat/minix68k/libsys/_stat.c b/plat/minix68k/libsys/_stat.c index a2fe60aee7..b88d15f181 100644 --- a/plat/minix68k/libsys/_stat.c +++ b/plat/minix68k/libsys/_stat.c @@ -3,7 +3,7 @@ #include PUBLIC int stat(name, buffer) -_CONST char* name; +const char* name; struct stat* buffer; { return (_callm1(FS, STAT, _len(name), 0, 0, (char*)name, (char*)buffer, NIL_PTR)); diff --git a/plat/minix68k/libsys/_umount.c b/plat/minix68k/libsys/_umount.c index f844751c1b..4d970457d8 100644 --- a/plat/minix68k/libsys/_umount.c +++ b/plat/minix68k/libsys/_umount.c @@ -2,7 +2,7 @@ #define umount _umount #include -PUBLIC int umount(_CONST char* name) +PUBLIC int umount(const char* name) { return (_callm3(FS, UMOUNT, 0, name)); } diff --git a/plat/minix68k/libsys/_unlink.c b/plat/minix68k/libsys/_unlink.c index f791930d2d..9da509e54a 100644 --- a/plat/minix68k/libsys/_unlink.c +++ b/plat/minix68k/libsys/_unlink.c @@ -3,7 +3,7 @@ #include PUBLIC int unlink(name) -_CONST char* name; +const char* name; { return (_callm3(FS, UNLINK, 0, name)); } diff --git a/plat/minix68k/libsys/call.c b/plat/minix68k/libsys/call.c index 976ac91593..3224ad30aa 100644 --- a/plat/minix68k/libsys/call.c +++ b/plat/minix68k/libsys/call.c @@ -26,7 +26,7 @@ PUBLIC int _callm3(proc, syscallnr, int1, name) int proc; /* FS or MM */ int syscallnr; /* which system call */ int int1; /* integer parameter */ -_CONST char* name; /* string */ +const char* name; /* string */ { /* This form of system call is used for those calls that contain at most * one integer parameter along with a string. If the string fits in the @@ -67,7 +67,7 @@ int syscallnr; /* which system call */ } PUBLIC int _len(s) -_CONST register char* s; /* character string whose length is needed */ +const register char* s; /* character string whose length is needed */ { /* Return the length of a character string, including the 0 at the end. */ int k; diff --git a/plat/minix68k/libsys/lib.h b/plat/minix68k/libsys/lib.h index 41f00b113c..79e64349ce 100644 --- a/plat/minix68k/libsys/lib.h +++ b/plat/minix68k/libsys/lib.h @@ -7,14 +7,13 @@ /* First come the defines. */ #define _POSIX_SOURCE 1 /* tell headers to include POSIX stuff */ -#define _MINIX 1 /* tell headers to include MINIX stuff */ +#define _MINIX 1 /* tell headers to include MINIX stuff */ /* The following are so basic, all the lib files get them automatically. */ #include /* must be first */ #include #include #include -#include #include #include @@ -25,23 +24,22 @@ extern message _M; #define MM 0 #define FS 1 -_PROTOTYPE(int __execve, (char* _path, char** _argv, char** _envp, int _nargs, int _nenvps)); -_PROTOTYPE( - int _callm1, - (int _proc, - int _syscallnr, - int _int1, - int _int2, - int _int3, - char* _ptr1, - char* _ptr2, - char* _ptr3)); -_PROTOTYPE(int _callm3, (int _proc, int _syscallnr, int _int1, const char* _name)); -_PROTOTYPE(int _callx, (int _proc, int _syscallnr)); -_PROTOTYPE(int _len, (const char* _s)); -_PROTOTYPE(void panic, (const char* _message, int _errnum)); -_PROTOTYPE(int _sendrec, (int _src_dest, message* _m_ptr)); -_PROTOTYPE(void _begsig, (int _dummy)); +int __execve(char* _path, char** _argv, char** _envp, int _nargs, int _nenvps); +int _callm1( + int _proc, + int _syscallnr, + int _int1, + int _int2, + int _int3, + char* _ptr1, + char* _ptr2, + char* _ptr3); +int _callm3(int _proc, int _syscallnr, int _int1, const char* _name); +int _callx(int _proc, int _syscallnr); +int _len(const char* _s); +void panic(const char* _message, int _errnum); +int _sendrec(int _src_dest, message* _m_ptr); +void _begsig(int _dummy); extern void _cleanup(void); diff --git a/plat/minix68k/libsys/syslib.c b/plat/minix68k/libsys/syslib.c index 603847f22b..1048fe93b1 100644 --- a/plat/minix68k/libsys/syslib.c +++ b/plat/minix68k/libsys/syslib.c @@ -5,33 +5,32 @@ Messages to systask (special calls) ----------------------------------------------------------------------------*/ #if (CHIP == M68000) -PUBLIC _PROTOTYPE(void sys_xit, (int parent, int proc, phys_clicks* basep, phys_clicks* sizep)); +PUBLIC void sys_xit(int parent, int proc, phys_clicks* basep, phys_clicks* sizep); #else -PUBLIC _PROTOTYPE(void sys_xit, (int parent, int proc)); +PUBLIC void sys_xit(int parent, int proc); #endif -PUBLIC _PROTOTYPE(void sys_getsp, (int proc, vir_bytes* newsp)); -PUBLIC _PROTOTYPE(void sys_sig, (int proc, int sig, void (*sighandler)(int))); +PUBLIC void sys_getsp(int proc, vir_bytes* newsp); +PUBLIC void sys_sig(int proc, int sig, void (*sighandler)(int)); #if (CHIP == M68000) #ifdef ALCYON_C_BUG_FIXED -PUBLIC _PROTOTYPE(void sys_fork, (int prnt, int chld, int pd, phys_clicks shdw)); +PUBLIC void sys_fork(int prnt, int chld, int pd, phys_clicks shdw); #else -PUBLIC _PROTOTYPE(void sys_fork, (int parent, int child, int pid, int shadow)); +PUBLIC void sys_fork(int parent, int child, int pid, int shadow); #endif #else -PUBLIC _PROTOTYPE(void sys_fork, (int parent, int child, int pid)); +PUBLIC void sys_fork(int parent, int child, int pid); #endif -PUBLIC _PROTOTYPE(void sys_exec, (int proc, char* ptr, int traced)); -PUBLIC _PROTOTYPE(void sys_newmap, (int proc, char* ptr)); -PUBLIC _PROTOTYPE(void sys_copy, (message * mptr)); -PUBLIC _PROTOTYPE(void sys_times, (int proc, time_t ptr[4])); -PUBLIC _PROTOTYPE(void sys_abort, (void)); +PUBLIC void sys_exec(int proc, char* ptr, int traced); +PUBLIC void sys_newmap(int proc, char* ptr); +PUBLIC void sys_copy(message * mptr); +PUBLIC void sys_times(int proc, time_t ptr[4]); +PUBLIC void sys_abort(void); #if (CHIP == M68000) -PUBLIC _PROTOTYPE( - void sys_fresh, (int proc, char* ptr, phys_clicks dc, phys_clicks* basep, phys_clicks* sizep)); +PUBLIC void sys_fresh(int proc, char* ptr, phys_clicks dc, phys_clicks* basep, phys_clicks* sizep); #endif -PUBLIC _PROTOTYPE(void sys_kill, (int proc, int sig)); -PUBLIC _PROTOTYPE(int sys_trace, (int req, int procnr, long addr, long* data_p)); -PUBLIC _PROTOTYPE(void tell_fs, (int what, int p1, int p2, int p3)); +PUBLIC void sys_kill(int proc, int sig); +PUBLIC int sys_trace(int req, int procnr, long addr, long* data_p); +PUBLIC void tell_fs(int what, int p1, int p2, int p3); #if (CHIP == M68000) PUBLIC void sys_xit(parent, proc, basep, sizep) phys_clicks *basep, *sizep; @@ -61,7 +60,7 @@ vir_bytes* newsp; /* place to put sp read from kernel */ PUBLIC void sys_sig(proc, sig, sighandler) int proc; /* which proc has exited */ int sig; /* signal number: 1 - 16 */ -_PROTOTYPE(void(*sighandler), (int)); /* pointer to signal handler in user space */ +void(*sighandler)(int); /* pointer to signal handler in user space */ { /* A proc has to be signaled. Tell the kernel. */ diff --git a/plat/minix68k/libsys/vectab.c b/plat/minix68k/libsys/vectab.c index b41b410a6f..a5c2fd1007 100644 --- a/plat/minix68k/libsys/vectab.c +++ b/plat/minix68k/libsys/vectab.c @@ -7,4 +7,4 @@ #include /* array of functions to catch signals */ -_PROTOTYPE(void(*_vectab[_NSIG]), (int)); +void(*_vectab[_NSIG])(int); diff --git a/util/grind/misc.h b/util/grind/misc.h index 8001bf2cd5..22c4ddae97 100644 --- a/util/grind/misc.h +++ b/util/grind/misc.h @@ -1,7 +1,5 @@ /* $Id$ */ -#include - -_PROTOTYPE(void fatal, (char *, ...)); -_PROTOTYPE(void error, (char *, ...)); -_PROTOTYPE(void warning, (char *, ...)); +void fatal(char *, ...); +void error(char *, ...); +void warning(char *, ...); From 7ddbb78a2cf12ee5a373c7f46ed8f2fbee18949c Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 11 Apr 2025 19:18:13 +0200 Subject: [PATCH 64/79] Enable copious build tracing. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6368898644..c7c8980df8 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ CFLAGS ?= -g -Os \ -DNORETURN=_Noreturn HOSTCFLAGS = $(CFLAGS) -ACKCFLAGS = -O +ACKCFLAGS = -O -v -v -v LDFLAGS ?= -g From 43051972ed502ebe2a3681345ad88629e91508e6 Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 14 Apr 2025 23:11:37 +0200 Subject: [PATCH 65/79] Try and build Windows stuff with the WIN32 flag set. --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index c7c8980df8..78f09572cc 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,10 @@ CFLAGS ?= -g -Os \ -DUNREACHABLE_CODE='__builtin_unreachable()' \ -DNORETURN=_Noreturn +ifeq ($(OS),Windows_NT) +CFLAGS += -DWIN32 +endif + HOSTCFLAGS = $(CFLAGS) ACKCFLAGS = -O -v -v -v From 01a552404d340444b8f966cc6a7ede37f850d82f Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 01:59:50 +0200 Subject: [PATCH 66/79] i80 doesn't build on Windows due to there being too many files on a command line. --- build.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build.py b/build.py index 6263bde799..6d52beebf6 100644 --- a/build.py +++ b/build.py @@ -2,8 +2,7 @@ from build.config import IS_WINDOWS # This is the list of which plats to build. -PLATS = [ - "cpm", +PLATS = ([ "linux386", "linux68k", "linuxmips", @@ -17,7 +16,10 @@ "rpi", "pdpv7", "em22", -] +] + + # The i80 mach doesn't build on Windows because the ludicrous number of + # object files blows the Windows command line limit. + (["cpm"] if not IS_WINDOWS else [])) # This is the list of which plats to test. TEST_PLATS = [ @@ -55,6 +57,6 @@ name="all", deps=( [".+compiler", "examples+all"] + - ([] if IS_WINDOWS else [f"plat/{p}/tests" for p in TEST_PLATS]) + ([] if IS_WINDOWS else [f"plat/{p}/tests" for p in TEST_PLATS if p in PLATS]) ), ) From dacf4f852f0610c0a68740364c5f90881f5f5ffc Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 02:00:38 +0200 Subject: [PATCH 67/79] Try and get things building on Windows. --- Makefile | 2 +- build/_sandbox.py | 7 ++++++- build/ab.py | 2 ++ build/c.py | 2 +- build/toolchain.py | 5 +++++ lang/basic/src/build.py | 2 +- lang/cem/cemcom.ansi/build.py | 2 +- lang/cem/cpp.ansi/build.py | 2 +- lang/m2/comp/build.py | 2 +- lang/pc/comp/build.py | 2 +- modules/src/system/syssystem.c | 26 ++++++++++++++++++++++++-- plat/cpm/build.py | 6 +++--- plat/linux386/build.py | 4 ++-- plat/linux68k/build.py | 4 ++-- plat/linuxmips/build.py | 6 +++--- plat/linuxppc/build.py | 6 +++--- plat/minix68k/build.py | 6 +++--- plat/msdos386/build.py | 4 ++-- plat/msdos86/build.py | 4 ++-- plat/osx/cvmach/build.py | 2 +- plat/osx386/build.py | 4 ++-- plat/osxppc/build.py | 6 +++--- plat/pc86/build.py | 4 ++-- plat/pdpv7/build.py | 6 +++--- plat/rpi/build.py | 4 ++-- util/ack/build.py | 2 +- util/amisc/build.py | 2 +- util/arch/build.py | 2 +- util/ass/build.py | 2 +- util/ego/build.py | 4 ++-- util/led/build.py | 2 +- util/misc/build.py | 4 ++-- util/opt/build.py | 4 ++-- 33 files changed, 88 insertions(+), 54 deletions(-) diff --git a/Makefile b/Makefile index 78f09572cc..0866bd773b 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ CFLAGS += -DWIN32 endif HOSTCFLAGS = $(CFLAGS) -ACKCFLAGS = -O -v -v -v +ACKCFLAGS = -O LDFLAGS ?= -g diff --git a/build/_sandbox.py b/build/_sandbox.py index 2450c537e7..f7667a6870 100644 --- a/build/_sandbox.py +++ b/build/_sandbox.py @@ -26,7 +26,7 @@ def main(): print("link", sf) os.makedirs(dirname(sf), exist_ok=True) try: - os.link(abspath(f), sf) + os.symlink(abspath(f), sf) except PermissionError: shutil.copy(f, sf) @@ -38,6 +38,11 @@ def main(): df = dirname(f) if df: os.makedirs(df, exist_ok=True) + + try: + os.remove(f) + except FileNotFoundError: + pass os.rename(sf, f) diff --git a/build/ab.py b/build/ab.py index 00e1f96b6f..ca02621c8e 100644 --- a/build/ab.py +++ b/build/ab.py @@ -22,6 +22,8 @@ import os from collections import namedtuple +SANDBOX_ARG_COUNT = 500 + COMPRESS_MK_FILE = True verbose = False diff --git a/build/c.py b/build/c.py index 2105039341..1a07a3e84e 100644 --- a/build/c.py +++ b/build/c.py @@ -444,7 +444,7 @@ def programimpl( simplerule( replaces=self, ins=cfiles + libs, - outs=[f"={self.localname}$(EXT)"], + outs=[f"={self.localname}{toolchain.EXE}"], deps=deps, label=label, commands=commands, diff --git a/build/toolchain.py b/build/toolchain.py index b47d3e8a64..021ad76dde 100644 --- a/build/toolchain.py +++ b/build/toolchain.py @@ -1,5 +1,10 @@ +import platform + +_is_windows = (platform.system() == "Windows") + class Toolchain: PREFIX = "" + EXE = ".exe" if _is_windows else "" class HostToolchain(Toolchain): diff --git a/lang/basic/src/build.py b/lang/basic/src/build.py index fac8c7409a..a89ca57cea 100644 --- a/lang/basic/src/build.py +++ b/lang/basic/src/build.py @@ -48,4 +48,4 @@ ) -export(name="all", items={"$(PLATDEP)/em_bem": ".+em_bem"}) +export(name="all", items={"$(PLATDEP)/em_bem$(EXT)": ".+em_bem"}) diff --git a/lang/cem/cemcom.ansi/build.py b/lang/cem/cemcom.ansi/build.py index 91b1005a49..609a7dc1f4 100644 --- a/lang/cem/cemcom.ansi/build.py +++ b/lang/cem/cemcom.ansi/build.py @@ -116,4 +116,4 @@ ], ) -export(name="all", items={"$(PLATDEP)/em_cemcom.ansi": ".+cemcom"}) +export(name="all", items={"$(PLATDEP)/em_cemcom.ansi$(EXT)": ".+cemcom"}) diff --git a/lang/cem/cpp.ansi/build.py b/lang/cem/cpp.ansi/build.py index fcc2d487be..6a986c38a3 100644 --- a/lang/cem/cpp.ansi/build.py +++ b/lang/cem/cpp.ansi/build.py @@ -83,4 +83,4 @@ ], ) -export(name="all", items={"$(PLATDEP)/cpp.ansi": ".+cpp.ansi"}) +export(name="all", items={"$(PLATDEP)/cpp.ansi$(EXT)": ".+cpp.ansi"}) diff --git a/lang/m2/comp/build.py b/lang/m2/comp/build.py index d6e0a0e814..005b1f39bc 100644 --- a/lang/m2/comp/build.py +++ b/lang/m2/comp/build.py @@ -76,7 +76,7 @@ export( name="all", items={ - "$(PLATDEP)/em_m2": ".+em_m2", + "$(PLATDEP)/em_m2$(EXT)": ".+em_m2", "$(INSDIR)/share/man/man6/em_m2.6": "./em_m2.6", }, ) diff --git a/lang/pc/comp/build.py b/lang/pc/comp/build.py index 768265fe2f..f0aae9fc57 100644 --- a/lang/pc/comp/build.py +++ b/lang/pc/comp/build.py @@ -109,4 +109,4 @@ ], ) -export(name="all", items={"$(PLATDEP)/em_pc": ".+em_pc"}) +export(name="all", items={"$(PLATDEP)/em_pc$(EXT)": ".+em_pc"}) diff --git a/modules/src/system/syssystem.c b/modules/src/system/syssystem.c index 6013ade8d3..132b0a437d 100644 --- a/modules/src/system/syssystem.c +++ b/modules/src/system/syssystem.c @@ -56,18 +56,40 @@ static char* append_escaped(char* buffer, const char* word) return buffer; } +#if defined WIN32 +static char* append_exename(char* buffer, const char* word) +{ + for (;;) + { + char c = *word++; + if (!c) + break; + if (c == '/') + c = '\\'; + if (needs_escaping(c)) + *buffer++ = ESCAPECHAR; + *buffer++ = c; + } + strcpy(buffer, ".exe"); + buffer += 4; + return buffer; +} +#else +#define append_exename append_escaped +#endif + int sys_system(const char* prog, const char* const* arglist) { /* Calculate the maximum length of the command line. */ - int len = strlen(prog) * 2 + 1; + int len = strlen(prog) * 2 + 4; for (const char* const* arg = arglist+1; *arg; arg++) len += strlen(*arg) * 2 + 1; /* Now actually build the command line. */ char* cmdline = malloc(len + 1); - char* p = append_escaped(cmdline, prog); + char* p = append_exename(cmdline, prog); for (const char* const* arg = arglist+1; *arg; arg++) { diff --git a/plat/cpm/build.py b/plat/cpm/build.py index e8f5cac387..68003b6c71 100644 --- a/plat/cpm/build.py +++ b/plat/cpm/build.py @@ -19,9 +19,9 @@ export( name="tools", items={ - "$(PLATDEP)/cpm/as": ".+as", - "$(PLATDEP)/cpm/ncg": ".+ncg", - "$(PLATDEP)/cpm/top": ".+top", + "$(PLATDEP)/cpm/as$(EXT)": ".+as", + "$(PLATDEP)/cpm/ncg$(EXT)": ".+ncg", + "$(PLATDEP)/cpm/top$(EXT)": ".+top", "$(PLATIND)/descr/cpm": "./descr", }, ) diff --git a/plat/linux386/build.py b/plat/linux386/build.py index 529777a278..23e9fa7462 100644 --- a/plat/linux386/build.py +++ b/plat/linux386/build.py @@ -15,8 +15,8 @@ export( name="tools", items={ - "$(PLATDEP)/linux386/as": ".+as", - "$(PLATDEP)/linux386/ncg": ".+ncg", + "$(PLATDEP)/linux386/as$(EXT)": ".+as", + "$(PLATDEP)/linux386/ncg$(EXT)": ".+ncg", "$(PLATIND)/descr/linux386": "./descr", }, ) diff --git a/plat/linux68k/build.py b/plat/linux68k/build.py index 5f6e1b1508..b0c6ff4570 100644 --- a/plat/linux68k/build.py +++ b/plat/linux68k/build.py @@ -19,8 +19,8 @@ export( name="tools", items={ - "$(PLATDEP)/linux68k/as": ".+as", - "$(PLATDEP)/linux68k/ncg": ".+ncg", + "$(PLATDEP)/linux68k/as$(EXT)": ".+as", + "$(PLATDEP)/linux68k/ncg$(EXT)": ".+ncg", "$(PLATIND)/descr/linux68k": "./descr", }, ) diff --git a/plat/linuxmips/build.py b/plat/linuxmips/build.py index 23001acdf0..6b66658b25 100644 --- a/plat/linuxmips/build.py +++ b/plat/linuxmips/build.py @@ -17,9 +17,9 @@ export( name="tools", items={ - "$(PLATDEP)/linuxmips/as": ".+as", - "$(PLATDEP)/linuxmips/mcg": ".+mcg", - "$(PLATDEP)/linuxmips/top": ".+top", + "$(PLATDEP)/linuxmips/as$(EXT)": ".+as", + "$(PLATDEP)/linuxmips/mcg$(EXT)": ".+mcg", + "$(PLATDEP)/linuxmips/top$(EXT)": ".+top", "$(PLATIND)/descr/linuxmips": "./descr", }, ) diff --git a/plat/linuxppc/build.py b/plat/linuxppc/build.py index a694d92304..09bc47d969 100644 --- a/plat/linuxppc/build.py +++ b/plat/linuxppc/build.py @@ -17,9 +17,9 @@ export( name="tools", items={ - "$(PLATDEP)/linuxppc/as": ".+as", - "$(PLATDEP)/linuxppc/ncg": ".+ncg", - "$(PLATDEP)/linuxppc/top": ".+top", + "$(PLATDEP)/linuxppc/as$(EXT)": ".+as", + "$(PLATDEP)/linuxppc/ncg$(EXT)": ".+ncg", + "$(PLATDEP)/linuxppc/top$(EXT)": ".+top", "$(PLATIND)/descr/linuxppc": "./descr", }, ) diff --git a/plat/minix68k/build.py b/plat/minix68k/build.py index 9bfd4a8b95..6fecef2a7d 100644 --- a/plat/minix68k/build.py +++ b/plat/minix68k/build.py @@ -19,9 +19,9 @@ export( name="tools", items={ - "$(PLATDEP)/minix68k/as": ".+as", - "$(PLATDEP)/minix68k/ncg": ".+ncg", - "$(PLATDEP)/minix68k/cv": "./cv", + "$(PLATDEP)/minix68k/as$(EXT)": ".+as", + "$(PLATDEP)/minix68k/ncg$(EXT)": ".+ncg", + "$(PLATDEP)/minix68k/cv$(EXT)": "./cv", "$(PLATIND)/descr/minix68k": "./descr", }, ) diff --git a/plat/msdos386/build.py b/plat/msdos386/build.py index 63d7b26ab4..893a88e026 100644 --- a/plat/msdos386/build.py +++ b/plat/msdos386/build.py @@ -32,8 +32,8 @@ export( name="tools", items={ - "$(PLATDEP)/msdos386/as": ".+as", - "$(PLATDEP)/msdos386/ncg": ".+ncg", + "$(PLATDEP)/msdos386/as$(EXT)": ".+as", + "$(PLATDEP)/msdos386/ncg$(EXT)": ".+ncg", "$(PLATIND)/descr/msdos386": "./descr", }, ) diff --git a/plat/msdos86/build.py b/plat/msdos86/build.py index 607d30859c..83c888485f 100644 --- a/plat/msdos86/build.py +++ b/plat/msdos86/build.py @@ -15,8 +15,8 @@ export( name="tools", items={ - "$(PLATDEP)/msdos86/as": ".+as", - "$(PLATDEP)/msdos86/ncg": ".+ncg", + "$(PLATDEP)/msdos86/as$(EXT)": ".+as", + "$(PLATDEP)/msdos86/ncg$(EXT)": ".+ncg", "$(PLATIND)/descr/msdos86": "./descr", }, ) diff --git a/plat/osx/cvmach/build.py b/plat/osx/cvmach/build.py index 18d0cdb756..d0812c8477 100644 --- a/plat/osx/cvmach/build.py +++ b/plat/osx/cvmach/build.py @@ -10,4 +10,4 @@ ], ) -export(name="all", items={"$(PLATDEP)/cvmach": ".+cvmach"}) +export(name="all", items={"$(PLATDEP)/cvmach$(EXT)": ".+cvmach"}) diff --git a/plat/osx386/build.py b/plat/osx386/build.py index def94b74dd..ceb9e40989 100644 --- a/plat/osx386/build.py +++ b/plat/osx386/build.py @@ -15,8 +15,8 @@ export( name="tools", items={ - "$(PLATDEP)/osx386/as": ".+as", - "$(PLATDEP)/osx386/ncg": ".+ncg", + "$(PLATDEP)/osx386/as$(EXT)": ".+as", + "$(PLATDEP)/osx386/ncg$(EXT)": ".+ncg", "$(PLATIND)/descr/osx386": "./descr", }, ) diff --git a/plat/osxppc/build.py b/plat/osxppc/build.py index 1bbb48fc25..25729aa075 100644 --- a/plat/osxppc/build.py +++ b/plat/osxppc/build.py @@ -17,9 +17,9 @@ export( name="tools", items={ - "$(PLATDEP)/osxppc/as": ".+as", - "$(PLATDEP)/osxppc/ncg": ".+ncg", - "$(PLATDEP)/osxppc/top": ".+top", + "$(PLATDEP)/osxppc/as$(EXT)": ".+as", + "$(PLATDEP)/osxppc/ncg$(EXT)": ".+ncg", + "$(PLATDEP)/osxppc/top$(EXT)": ".+top", "$(PLATIND)/descr/osxppc": "./descr", }, ) diff --git a/plat/pc86/build.py b/plat/pc86/build.py index 2866e8580a..269f85c9ad 100644 --- a/plat/pc86/build.py +++ b/plat/pc86/build.py @@ -15,8 +15,8 @@ export( name="tools", items={ - "$(PLATDEP)/pc86/as": ".+as", - "$(PLATDEP)/pc86/ncg": ".+ncg", + "$(PLATDEP)/pc86/as$(EXT)": ".+as", + "$(PLATDEP)/pc86/ncg$(EXT)": ".+ncg", "$(PLATIND)/descr/pc86": "./descr", }, ) diff --git a/plat/pdpv7/build.py b/plat/pdpv7/build.py index d7c5cf3a58..b644ffcb83 100644 --- a/plat/pdpv7/build.py +++ b/plat/pdpv7/build.py @@ -17,9 +17,9 @@ export( name="tools", items={ - "$(PLATDEP)/pdpv7/as": ".+as", - "$(PLATDEP)/pdpv7/cg": ".+cg", - "$(PLATDEP)/pdpv7/top": ".+top", + "$(PLATDEP)/pdpv7/as$(EXT)": ".+as", + "$(PLATDEP)/pdpv7/cg$(EXT)": ".+cg", + "$(PLATDEP)/pdpv7/top$(EXT)": ".+top", "$(PLATDEP)/pdpv7/cv": "./cv", "$(PLATIND)/descr/pdpv7": "./descr", }, diff --git a/plat/rpi/build.py b/plat/rpi/build.py index 62af29fd1e..7bbc420aea 100644 --- a/plat/rpi/build.py +++ b/plat/rpi/build.py @@ -15,8 +15,8 @@ export( name="tools", items={ - "$(PLATDEP)/rpi/as": ".+as", - "$(PLATDEP)/rpi/ncg": ".+ncg", + "$(PLATDEP)/rpi/as$(EXT)": ".+as", + "$(PLATDEP)/rpi/ncg$(EXT)": ".+ncg", "$(PLATIND)/descr/rpi": "./descr", }, ) diff --git a/util/ack/build.py b/util/ack/build.py index 260dfecf97..ac609561dc 100644 --- a/util/ack/build.py +++ b/util/ack/build.py @@ -48,7 +48,7 @@ export( name="all", items={ - "$(INSDIR)/bin/ack": ".+ack", + "$(INSDIR)/bin/ack$(EXT)": ".+ack", "$(INSDIR)/share/man/man1/ack.1": "./ack.1.X", "$(PLATIND)/descr/fe": "lib/descr/fe", }, diff --git a/util/amisc/build.py b/util/amisc/build.py index b8bcca2be9..9f84f1a031 100644 --- a/util/amisc/build.py +++ b/util/amisc/build.py @@ -11,7 +11,7 @@ def simpleprogram(name): deps=["h", "modules/src/object", "modules/src/system"], ) - i[f"$(INSDIR)/bin/{name}"] = p + i[f"$(INSDIR)/bin/{name}$(EXT)"] = p i[f"$(INSDIR)/share/man/man1/{name}.1"] = f"./{name}.1" diff --git a/util/arch/build.py b/util/arch/build.py index d213917534..1c2502728e 100644 --- a/util/arch/build.py +++ b/util/arch/build.py @@ -17,7 +17,7 @@ export( name="all", items={ - "$(INSDIR)/bin/aal": ".+aal", + "$(INSDIR)/bin/aal$(EXT)": ".+aal", "$(INSDIR)/share/man/man1/aal.1": "./aal.1", }, ) diff --git a/util/ass/build.py b/util/ass/build.py index 6669880130..974de138fb 100644 --- a/util/ass/build.py +++ b/util/ass/build.py @@ -49,7 +49,7 @@ export( name="all", items={ - "$(PLATDEP)/em_ass": ".+ass", + "$(PLATDEP)/em_ass$(EXT)": ".+ass", "$(INSDIR)/share/man/man6/em_ass.6": "./em_ass.6", }, ) diff --git a/util/ego/build.py b/util/ego/build.py index 1de7b04105..1f41872b6c 100644 --- a/util/ego/build.py +++ b/util/ego/build.py @@ -24,7 +24,7 @@ def build_ego_helper(name, srcs=[], deps=[]): + deps, cflags=["-DDEBUG", "-DVERBOSE", "-DNOTCOMPACT"], ) - exports[f"$(PLATDEP)/ego/{name}"] = f".+{name}" + exports[f"$(PLATDEP)/ego/{name}$(EXT)"] = f".+{name}" def build_descr(name): @@ -78,6 +78,6 @@ def build_descr(name): export( name="all", - items={"$(PLATDEP)/em_ego": ".+em_ego", "$(PLATDEP)/ego/ra": "./ra"} + items={"$(PLATDEP)/em_ego$(EXT)": ".+em_ego", "$(PLATDEP)/ego/ra$(EXT)": "./ra"} | exports, ) diff --git a/util/led/build.py b/util/led/build.py index 695afb664d..f3bef33ca9 100644 --- a/util/led/build.py +++ b/util/led/build.py @@ -17,7 +17,7 @@ export( name="all", items={ - "$(PLATDEP)/em_led": ".+led", + "$(PLATDEP)/em_led$(EXT)": ".+led", "$(INSDIR)/share/man/man6/led.6": "./led.6", }, ) diff --git a/util/misc/build.py b/util/misc/build.py index bef292a8ed..317a9828e7 100644 --- a/util/misc/build.py +++ b/util/misc/build.py @@ -34,7 +34,7 @@ export( name="all", items={ - "$(PLATDEP)/em_encode": ".+em_encode", - "$(PLATDEP)/em_decode": ".+em_decode", + "$(PLATDEP)/em_encode$(EXT)": ".+em_encode", + "$(PLATDEP)/em_decode$(EXT)": ".+em_decode", }, ) diff --git a/util/opt/build.py b/util/opt/build.py index ee3f061554..1f021477d8 100644 --- a/util/opt/build.py +++ b/util/opt/build.py @@ -83,8 +83,8 @@ def build_variant(name, cflags): export( name="all", items={ - "$(PLATDEP)/em_opt": ".+em_opt", - "$(PLATDEP)/em_opt2": ".+em_opt2", + "$(PLATDEP)/em_opt$(EXT)": ".+em_opt", + "$(PLATDEP)/em_opt2$(EXT)": ".+em_opt2", "$(INSDIR)/share/man/man6/em_opt.6": "./em_opt.6", }, ) From 026c3aa9628e494af7b504c87f09a72a0ecb0921 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 13:07:49 +0200 Subject: [PATCH 68/79] Format. --- build.py | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/build.py b/build.py index 6d52beebf6..b219c06f10 100644 --- a/build.py +++ b/build.py @@ -2,31 +2,34 @@ from build.config import IS_WINDOWS # This is the list of which plats to build. -PLATS = ([ - "linux386", - "linux68k", - "linuxmips", - "linuxppc", - "minix68k", - "msdos386", - "msdos86", - "osx386", - "osxppc", - "pc86", - "rpi", - "pdpv7", - "em22", -] + +PLATS = ( + [ + "linux386", + "linux68k", + "linuxmips", + "linuxppc", + "minix68k", + "msdos386", + "msdos86", + "osx386", + "osxppc", + "pc86", + "rpi", + "pdpv7", + "em22", + ] + + # The i80 mach doesn't build on Windows because the ludicrous number of # object files blows the Windows command line limit. - (["cpm"] if not IS_WINDOWS else [])) + (["cpm"] if not IS_WINDOWS else []) +) # This is the list of which plats to test. TEST_PLATS = [ "cpm", "linux68k", "linuxppc", - "pc86", + "pc86", ] # This contains the platform-independent host tooling required to build the plats. @@ -56,7 +59,11 @@ export( name="all", deps=( - [".+compiler", "examples+all"] + - ([] if IS_WINDOWS else [f"plat/{p}/tests" for p in TEST_PLATS if p in PLATS]) + [".+compiler", "examples+all"] + + ( + [] + if IS_WINDOWS + else [f"plat/{p}/tests" for p in TEST_PLATS if p in PLATS] + ) ), ) From 10bfea9e48c200b1fbcc17e1898472953b4e64e3 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 13:12:57 +0200 Subject: [PATCH 69/79] Remember to put the extension on the pdpv7 ext. --- plat/pdpv7/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plat/pdpv7/build.py b/plat/pdpv7/build.py index b644ffcb83..b7766684d4 100644 --- a/plat/pdpv7/build.py +++ b/plat/pdpv7/build.py @@ -20,7 +20,7 @@ "$(PLATDEP)/pdpv7/as$(EXT)": ".+as", "$(PLATDEP)/pdpv7/cg$(EXT)": ".+cg", "$(PLATDEP)/pdpv7/top$(EXT)": ".+top", - "$(PLATDEP)/pdpv7/cv": "./cv", + "$(PLATDEP)/pdpv7/cv$(EXT)": "./cv", "$(PLATIND)/descr/pdpv7": "./descr", }, ) From 13bb02241cc21406f68e4a6d7076aac9a0a350c2 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 14:00:02 +0200 Subject: [PATCH 70/79] Eliminate most 'compression' as it just slows stuff down. --- build/ab.py | 80 +++++++++++++++++------------------------------------ 1 file changed, 25 insertions(+), 55 deletions(-) diff --git a/build/ab.py b/build/ab.py index ca02621c8e..561d39275b 100644 --- a/build/ab.py +++ b/build/ab.py @@ -6,7 +6,6 @@ from copy import copy import functools import importlib -import importlib.abc import importlib.util from importlib.machinery import ( SourceFileLoader, @@ -19,12 +18,9 @@ import hashlib import re import ast -import os from collections import namedtuple -SANDBOX_ARG_COUNT = 500 - -COMPRESS_MK_FILE = True +VERBOSE_MK_FILE = False verbose = False quiet = False @@ -227,16 +223,13 @@ def format_field(self, value, format_spec): if not value: return "" if type(value) == str: - return compressf(value) + return value if _isiterable(value): value = list(value) if type(value) != list: value = [value] return " ".join( - [ - compressf(selfi.templateexpand(f)) - for f in filenamesof(value) - ] + [selfi.templateexpand(f) for f in filenamesof(value)] ) return Formatter().format(s) @@ -469,30 +462,6 @@ def filenameof(x): return xs[0] -def compressf(a): - if not COMPRESS_MK_FILE: - return a - global globalId - if len(a) > 5: - if a not in wordCache: - wordCache[a] = globalId - outputFp.write(f"f{globalId}={a}\n") - globalId = globalId + 1 - a = f"$(f{wordCache[a]})" - return a - - -def compress(args): - if not COMPRESS_MK_FILE: - return args - - compressed = [] - for a in args: - compressed += [compressf(a)] - - return compressed - - def emit(*args, into=None): s = " ".join(args) + "\n" if into is not None: @@ -509,77 +478,78 @@ def emit_rule(self, ins, outs, cmds=[], label=None): nonobjs = [f for f in fouts if not f.startswith("$(OBJ)")] emit("") - for k, v in self.args.items(): - emit(f"# {k} = {v}") + if VERBOSE_MK_FILE: + for k, v in self.args.items(): + emit(f"# {k} = {v}") lines = [] if nonobjs: emit("clean::", into=lines) - emit("\t$(hide) rm -f", *compress(nonobjs), into=lines) + emit("\t$(hide) rm -f", *nonobjs, into=lines) hashable = cmds + fins_list + fouts hash = hashlib.sha1(bytes("\n".join(hashable), "utf-8")).hexdigest() hashfile = join(self.dir, f"hash_{hash}") global globalId - emit(".PHONY:", compressf(name), into=lines) + emit(".PHONY:", name, into=lines) if outs: outsn = globalId globalId = globalId + 1 insn = globalId globalId = globalId + 1 - emit(f"OUTS_{outsn}", "=", *compress(fouts), into=lines) - emit(f"INS_{insn}", "=", *compress(fins), into=lines) + emit(f"OUTS_{outsn}", "=", *fouts, into=lines) + emit(f"INS_{insn}", "=", *fins, into=lines) emit( - compressf(name), + name, ":", - compressf(hashfile), + hashfile, f"$(OUTS_{outsn})", into=lines, ) emit("ifeq ($(MAKE4.3),yes)", into=lines) emit( - compressf(hashfile), + hashfile, f"$(OUTS_{outsn})", "&:", f"$(INS_{insn})", into=lines, ) emit("else", into=lines) - emit(f"$(OUTS_{outsn})", ":", compressf(hashfile), into=lines) - emit(compressf(hashfile), ":", f"$(INS_{insn})", into=lines) + emit(f"$(OUTS_{outsn})", ":", hashfile, into=lines) + emit(hashfile, ":", f"$(INS_{insn})", into=lines) emit("endif", into=lines) if label: emit("\t$(hide)", "$(ECHO) $(PROGRESSINFO)" + label, into=lines) sandbox = join(self.dir, "sandbox") - emit("\t$(hide)", f"rm -rf {compressf(sandbox)}", into=lines) + emit("\t$(hide)", f"rm -rf {sandbox}", into=lines) emit( "\t$(hide)", - compressf("$(PYTHON) build/_sandbox.py --link -s"), - compressf(sandbox), + "$(PYTHON) build/_sandbox.py --link -s", + sandbox, f"$(INS_{insn})", into=lines, ) for c in cmds: - emit(f"\t$(hide) cd {compressf(sandbox)} && (", c, ")", into=lines) + emit(f"\t$(hide) cd {sandbox} && (", c, ")", into=lines) emit( "\t$(hide)", - compressf("$(PYTHON) build/_sandbox.py --export -s"), - compressf(sandbox), + "$(PYTHON) build/_sandbox.py --export -s", + sandbox, f"$(OUTS_{outsn})", into=lines, ) else: assert len(cmds) == 0, "rules with no outputs cannot have commands" - emit(compressf(name), ":", *compress(fins), into=lines) + emit(name, ":", *fins, into=lines) outputFp.write("".join(lines)) if outs: - emit(f"\t$(hide) touch {compressf(hashfile)}") + emit(f"\t$(hide) touch {hashfile}") emit("") @@ -647,8 +617,8 @@ def export(self, name=None, items: TargetsMap = {}, deps: Targets = []): self.outs = deps + outs emit("") - emit(".PHONY:", compressf(name)) - emit(compressf(name), ":", *compress(filenamesof(outs + deps))) + emit(".PHONY:", name) + emit(name, ":", *filenamesof(outs + deps)) def main(): From 6fe04bf2e5f94e5e246b3e7212e5aa8ffbcc561c Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 15:44:24 +0200 Subject: [PATCH 71/79] Fix some bad extern declarations causing crashes on OSX. --- util/led/archive.c | 1 - util/led/main.c | 1 - util/led/memory.c | 3 +-- util/led/read.c | 2 -- util/led/scan.c | 5 ++--- util/led/scan.h | 5 ++++- 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/util/led/archive.c b/util/led/archive.c index 9608c6dbe0..b4cf692e0c 100644 --- a/util/led/archive.c +++ b/util/led/archive.c @@ -45,7 +45,6 @@ static long getsymdeftable(void) struct ranlib* ran; long count; long nran, nchar; - extern FILE* infile; count = nran = rd_int4(infile); debug("%ld ranlib structs, ", nran, 0, 0, 0); diff --git a/util/led/main.c b/util/led/main.c index 8daf6633a0..62bfba47a6 100644 --- a/util/led/main.c +++ b/util/led/main.c @@ -93,7 +93,6 @@ static void do_statistics(void) #endif char* progname; /* Name this program was invoked with. */ -int passnumber; /* Pass we are in. */ struct outhead outhead; /* Header of final output file. */ struct outsect outsect[MAXSECT]; /* Its section table. */ diff --git a/util/led/memory.c b/util/led/memory.c index fb573ff71f..2fd7bf53a4 100644 --- a/util/led/memory.c +++ b/util/led/memory.c @@ -42,6 +42,7 @@ static char rcsid[] = "$Id$"; #include "sym.h" #include "finish.h" #include "write.h" +#include "scan.h" #ifndef USEMALLOC static void copy_down(struct memory* mem, ind_t dist); @@ -267,8 +268,6 @@ static ind_t move_up(int piece, ind_t incr) #endif /* ndef USEMALLOC */ } -extern int passnumber; - /* * This routine is called if `piece' needs `incr' bytes and the system won't * give them. We first steal the free bytes of all lower pieces and move them diff --git a/util/led/read.c b/util/led/read.c index 181178f17f..9078ed1c7f 100644 --- a/util/led/read.c +++ b/util/led/read.c @@ -12,8 +12,6 @@ static char rcsid[] = "$Id$"; #include #include "error.h" -int infile; /* The current input file. */ - void rd_fatal(void) { fatal("read error"); diff --git a/util/led/scan.c b/util/led/scan.c index 3a098add89..f6289f15fc 100644 --- a/util/led/scan.c +++ b/util/led/scan.c @@ -35,11 +35,10 @@ static char rcsid[] = "$Id$"; #define IND_DBUG(x) (IND_RELO(x) + sizeof(ind_t)) #endif /* SYMDBUG */ -extern FILE* infile; -extern int passnumber; - +FILE* infile; /* Current input stream */ char* archname; /* Name of archive, if reading from archive. */ char* modulname; /* Name of object module. */ +int passnumber; /* Current pass */ #ifdef SYMDBUG long objectsize; #endif /* SYMDBUG */ diff --git a/util/led/scan.h b/util/led/scan.h index 2895834cd6..acb87c594e 100644 --- a/util/led/scan.h +++ b/util/led/scan.h @@ -37,6 +37,9 @@ extern void endemit(char* emit); * In case of a plain file, the file pointer is repositioned after the * examination. Otherwise it is at the beginning of the table of contents. */ -int getfile(char* filename); +extern int getfile(char* filename); + +extern FILE* infile; +extern int passnumber; #endif /* __SCAN_H_INCLUDED__ */ From 95c83e20bda4ba107f19d0852eb79b4b02110d1d Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 15:44:59 +0200 Subject: [PATCH 72/79] Fix typo preventing the OSX bad make check from working. --- build/ab.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ab.mk b/build/ab.mk index 5f029f92b4..b1a58994c7 100644 --- a/build/ab.mk +++ b/build/ab.mk @@ -2,7 +2,7 @@ MAKENOT4 := $(if $(findstring 3.9999, $(lastword $(sort 3.9999 $(MAKE_VERSION))) MAKE4.3 := $(if $(findstring 4.3, $(firstword $(sort 4.3 $(MAKE_VERSION)))),yes,no) MAKE4.1 := $(if $(findstring no_no,$(MAKENOT4)_$(MAKE4.3)),yes,no) -ifeq ($(MAKENOT3),yes) +ifeq ($(MAKENOT4),yes) $(error You need GNU Make 4.x for this (if you're on OSX, use gmake).) endif From aa9f81fe8f9f5dd4a841267ad1c6b4458b91e094 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 15:46:26 +0200 Subject: [PATCH 73/79] Remember to build the Windows installer. --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 0866bd773b..74e0eb306e 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,11 @@ ACKCFLAGS = -O LDFLAGS ?= -g +# Custom rule to build the installer. + +ack-setup.exe: etc/windows-installer.nsi + makensis -dBUILDDIR=$(BUILDDIR)/staging -dOUTFILE="$$(realpath $@)" $< + # Various commands. LUA ?= lua From fdadbf2baefce38ca7518c96b781b54bed607d0c Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 15:53:42 +0200 Subject: [PATCH 74/79] Remember that 'all' must come first... --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 74e0eb306e..9d34d97d73 100644 --- a/Makefile +++ b/Makefile @@ -50,11 +50,6 @@ ACKCFLAGS = -O LDFLAGS ?= -g -# Custom rule to build the installer. - -ack-setup.exe: etc/windows-installer.nsi - makensis -dBUILDDIR=$(BUILDDIR)/staging -dOUTFILE="$$(realpath $@)" $< - # Various commands. LUA ?= lua @@ -62,6 +57,11 @@ LUA ?= lua .PHONY: all all: +all +# Custom rule to build the installer. + +ack-setup.exe: etc/windows-installer.nsi all + makensis -dBUILDDIR=$(BUILDDIR)/staging -dOUTFILE="$$(realpath $@)" $< + PLATIND = $(INSDIR)/share/ack PLATDEP = $(INSDIR)/lib/ack From 59e7d86dbf1399cbcf56ef85d756fdb684aa7f34 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 17:39:31 +0200 Subject: [PATCH 75/79] Point the windows installer at a more correct location... --- Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 9d34d97d73..62995142f1 100644 --- a/Makefile +++ b/Makefile @@ -28,10 +28,6 @@ PREFIX ?= /opt/pkg/ack #PREFIX = $(INSDIR) endif -# Where do you want to put the object files used when building? - -BUILDDIR ?= $(ACK_TEMP_DIR)/ack-build - # What build flags do you want to use for native code? CFLAGS ?= -g -Os \ @@ -60,7 +56,7 @@ all: +all # Custom rule to build the installer. ack-setup.exe: etc/windows-installer.nsi all - makensis -dBUILDDIR=$(BUILDDIR)/staging -dOUTFILE="$$(realpath $@)" $< + makensis -dBUILDDIR=$(INSDIR) -dOUTFILE="$$(realpath $@)" $< PLATIND = $(INSDIR)/share/ack PLATDEP = $(INSDIR)/lib/ack From 36ee2e35edc0db5733a806ed877f5b48f16ed8ab Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 19:48:46 +0200 Subject: [PATCH 76/79] makensis only understands backslash paths. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 62995142f1..6758c32001 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ all: +all # Custom rule to build the installer. ack-setup.exe: etc/windows-installer.nsi all - makensis -dBUILDDIR=$(INSDIR) -dOUTFILE="$$(realpath $@)" $< + makensis -dBUILDDIR="$$(realpath $(INSDIR))" -dOUTFILE="$$(realpath $@)" $< PLATIND = $(INSDIR)/share/ack PLATDEP = $(INSDIR)/lib/ack From c9e05bc7f6a16f879c8c686f610db621d46f8343 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 23:14:26 +0200 Subject: [PATCH 77/79] Building all plats takes a while, so make the user select which plats to build. --- Makefile | 8 ++++++++ build.py | 35 +++++++++++++---------------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 6758c32001..54ce7fadf7 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,13 @@ DEFAULT_PLATFORM ?= pc86 +# Which architectures should get built? + +PLATS = +# PLATS = all +# PLATS = linux386 linuxppc linuxmips +$(if $(PLATS),, $(error Supply PLATS='something' to specify which architectures to build for. (Use 'all' for all of them.) (Edit the Makefile to set the default.)) + # Where should the ACK put its temporary files? ifeq ($(TMPDIR),) @@ -60,6 +67,7 @@ ack-setup.exe: etc/windows-installer.nsi all PLATIND = $(INSDIR)/share/ack PLATDEP = $(INSDIR)/lib/ack +export PLATS AB_ENABLE_PROGRESS_INFO = false include build/ab.mk diff --git a/build.py b/build.py index b219c06f10..2c94443d93 100644 --- a/build.py +++ b/build.py @@ -1,28 +1,19 @@ from build.ab import export from build.config import IS_WINDOWS +import os +from os.path import * +from glob import glob -# This is the list of which plats to build. -PLATS = ( - [ - "linux386", - "linux68k", - "linuxmips", - "linuxppc", - "minix68k", - "msdos386", - "msdos86", - "osx386", - "osxppc", - "pc86", - "rpi", - "pdpv7", - "em22", - ] - + - # The i80 mach doesn't build on Windows because the ludicrous number of - # object files blows the Windows command line limit. - (["cpm"] if not IS_WINDOWS else []) -) +_plats = os.getenv("PLATS") +if _plats == "all": + PLATS = {dirname(p) for p in glob("*/build.py", root_dir="plat")} +else: + PLATS = _plats.split(" ") + +if IS_WINDOWS and ("cpm" in PLATS): + print("Warning: the cpm plat can't be built on Windows because of reasons; skipping.") + PLATS.discard("cpm") +print("Building plats: " + (" ".join(PLATS))) # This is the list of which plats to test. TEST_PLATS = [ From 9a9f8ee1de4aea3f93570959687cd48cfae9f9fc Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 23:30:45 +0200 Subject: [PATCH 78/79] No, variables set on the command line don't trigger a build.mk regeneration. --- Makefile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 54ce7fadf7..2c95711d83 100644 --- a/Makefile +++ b/Makefile @@ -9,10 +9,9 @@ DEFAULT_PLATFORM ?= pc86 # Which architectures should get built? -PLATS = -# PLATS = all +$(if $(PLATS), $(error Don't set PLATS on the command line, because reasons. Edit the Makefile instead.)) +PLATS = all # PLATS = linux386 linuxppc linuxmips -$(if $(PLATS),, $(error Supply PLATS='something' to specify which architectures to build for. (Use 'all' for all of them.) (Edit the Makefile to set the default.)) # Where should the ACK put its temporary files? @@ -44,10 +43,6 @@ CFLAGS ?= -g -Os \ -DUNREACHABLE_CODE='__builtin_unreachable()' \ -DNORETURN=_Noreturn -ifeq ($(OS),Windows_NT) -CFLAGS += -DWIN32 -endif - HOSTCFLAGS = $(CFLAGS) ACKCFLAGS = -O From a3589cf35ba7e724f9144fc58d019dab10161179 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 17 Apr 2025 22:10:14 +0200 Subject: [PATCH 79/79] Update README. --- README | 55 +++++++++++++++++++++++-------------------------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/README b/README index b28adc6f85..d3c200d2b6 100644 --- a/README +++ b/README @@ -1,8 +1,8 @@ - THE AMSTERDAM COMPILER KIT V6.1pre1 - =================================== + THE AMSTERDAM COMPILER KIT V6.2+ + ================================ © 1987-2005 Vrije Universiteit, Amsterdam - 2022-08-19 + 2025-04-17 INTRODUCTION @@ -13,11 +13,6 @@ front end compilers for a number of different languages, code generators, support libraries, and all the tools necessary to go from source code to executable on any of the platforms it supports. -This is an early prerelease of the apocryphal version 6.1 release. Not a -lot is supported, the build mechanism needs work, and a lot of things are -probably broken. However, what's there should be sufficient to get things -done and to evaluate how the full 6.1 release should work. - SUPPORT @@ -25,30 +20,33 @@ SUPPORT Languages: -ANSI C, B, Pascal, Modula 2, Basic. K&R is supported via the ANSI C compiler. +ANSI C, Pascal, Modula 2, Basic. K&R is supported via the ANSI C compiler. Platforms: -pc86 produces bootable floppy disk images for 8086 PCs +cpm produces i80 CP/M .COM files +em22 produces EM22 bytecode files linux386 produces ELF executables for PC Linux systems linux68k produces ELF executables for m68020 Linux systems -linuxppc produces ELF executables for PowerPC Linux systems linuxmips produces ELF executables for little-endian MIPS32r2 Linux systems +linuxppc produces ELF executables for PowerPC Linux systems minix68k produces Minix executables for m68000 Minix systems -cpm produces i80 CP/M .COM files -rpi produces Raspberry Pi GPU binaries -pdpv7 produces PDP/11 V7 Unix binaries -msdos86 produces i86 MS-DOS .COM files msdos386 produces i386 MS-DOS 32-bit DPMI .EXE files +msdos86 produces i86 MS-DOS .COM files +osx386 produces i386 OSX MachO executables +osxppc produces PowerPC OSX MachO executables +pc86 produces bootable floppy disk images for 8086 PCs +pdpv7 produces PDP/11 V7 Unix binaries +rpi produces Raspberry Pi GPU binaries INSTALLATION ============ -The version 5.0 build mechanism has been completely rewritten. Installation -ought to be fairly straightforward. It will build on Unixishes including Linux, -OSX, and Windows using MSYS2 and mingw32. +The version 5.0 build mechanism has been completely rewritten (twice). +Installation ought to be fairly straightforward. It will build on Unixishes +including Linux, OSX, and Windows using MSYS2 and mingw32. Requirements: @@ -61,18 +59,16 @@ Requirements: - Lua (any version) with the lua-posix library installed. -- (optionally) ninja; if you've got this, this will be autodetected and give - you faster builds. - -- about 115MB free in /tmp (or some other temporary directory). +- Python 3.4 or above. -- about 15MB in the target directory. +- about 1GB in the target directory. Instructions: - edit the Makefile. There's a small section at the top where you can change the configuration. Probably the only one you may want to edit is PREFIX, - which changes where the ACK installs to. + which changes where the ACK installs to, and PLATS, which changes which + architectures are built. Look in `plat/*` to see what plats there are. - Run: @@ -80,13 +76,8 @@ Instructions: ...from the command line. This will do the build. - The make system is fully parallelisable. If you have a multicore system, - install ninja and it'll use all your cores. If you don't have ninja, you - can still use make for parallel builds with: - - make -r -j8 # or however many cores you have - - ...but frankly, I recommend ninja. + The make system is fully parallelisable by default, but does take a while + to start up. - Run: @@ -192,4 +183,4 @@ Please enjoy. David Given (davidgiven on Github) dg@cowlark.com -2018-09-18 +2025-04-17