shithub: femtolisp

Download patch

ref: dcefc02be84f75919752787fe81b66c9dbe982fc
parent: 171ae9573303fe9129baf8453fb44ea088b4bb2f
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Nov 6 20:15:41 EST 2024

plan9: use aux/data2s to include flisp.boot

--- a/main_plan9.c
+++ b/main_plan9.c
@@ -1,8 +1,7 @@
 #include "llt.h"
 
-static uint8_t boot[] =
-#include "flisp.boot.h"
-;
+extern uchar bootcode[];
+extern ulong bootlen;
 
 void
 main(int argc, char **argv)
@@ -16,5 +15,5 @@
 	*(uint32_t*)&F_PINF = 0x7f800000;
 	*(uint32_t*)&F_NINF = 0xff800000;
 
-	flmain(boot, sizeof(boot), argc, argv);
+	flmain(bootcode, bootlen, argc, argv);
 }
--- a/mkfile
+++ b/mkfile
@@ -3,7 +3,7 @@
 BIN=/$objtype/bin
 TARG=flisp
 CFLAGS=$CFLAGS -p -D__plan9__ -D__${objtype}__ -I3rd -Iplan9
-CLEANFILES=plan9/flisp.boot.h plan9/builtin_fns.h
+CLEANFILES=plan9/flisp.boot.s plan9/builtin_fns.h
 
 HFILES=\
 	equalhash.h\
@@ -21,6 +21,7 @@
 	equal.$O\
 	equalhash.$O\
 	flisp.$O\
+	flisp.boot.$O\
 	flmain.$O\
 	hashing.$O\
 	htable.$O\
@@ -44,15 +45,18 @@
 
 </sys/src/cmd/mkone
 
-plan9/flisp.boot.h: flisp.boot
-	sed 's,\\,\\\\,g;s,",\\",g;s,^,",g;s,$,\\n",g' $prereq >$target
-
 plan9/builtin_fns.h:
 	sed -n 's/^BUILTIN[_]?(\(".*)/BUILTIN_FN\1/gp' `{echo $OFILES | sed 's/\.'$O'/.c/g'} | sort >$target
 
-main_plan9.$O: plan9/flisp.boot.h plan9/builtin_fns.h
+main_plan9.$O: plan9/builtin_fns.h
 flisp.$O: maxstack.inc opcodes.h plan9/builtin_fns.h
 builtins.$O: plan9/builtin_fns.h
+
+plan9/flisp.boot.s: flisp.boot
+	aux/data2s boot <flisp.boot >$target
+
+flisp.boot.$O: plan9/flisp.boot.s
+	$AS -o $target plan9/flisp.boot.s
 
 %.$O: %.c
 	$CC $CFLAGS -o $target $stem.c