Add alt code to 2004/gavin for QEMU

Based on the remarks for QEMU one has to have the macro K defined as 1
so in the alt code it does an #undef K and then a #define K 1. The other
macros are defined if not defined (#ifndef .. #endif).

The instructions could be improved upon. As of now it only tells how to
compile it and that use is similar to the main entry except that one
uses QEMU instead. The file names like kernel, vi etc. are still those
names with the alt version build. I have no good way to test this out
but unless I made a typo in the Makefile everything should be good
assuming that it still works.

This should (if all is good with the Makefile rules) complete
2004/gavin.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-20 08:39:09 -08:00
1 parent a9fbaf593f
commit 86b6b2e41e
5 files changed
+251 -8

No files matched your search

+23 -2
View File
@@ -122,8 +122,8 @@ OBJ= ${PROG}.o
DATA= boot.b lilo.conf prim gavin.md
TARGET= ${PROG} kernel sh vi fs.tar
#
ALT_OBJ=
ALT_TARGET=
ALT_OBJ= ${PROG}.alt.o
ALT_TARGET= ${PROG}.alt kernel.alt sh.alt vi.alt fs.alt.tar
#################
@@ -165,6 +165,27 @@ fs.tar: sh vi gavin.c README.md prim
alt: data ${ALT_TARGET}
@${TRUE}
${PROG}.alt: ${PROG}.alt.c
${CC} ${CFLAGS} -UK -DK=1 $< -o $@ ${LDFLAGS}
kernel.alt: ${PROG}.alt
${RM} -f kernel
./${PROG}.alt > kernel
sh.alt: ${PROG}.alt.c
${RM} -f ${PROG}.alt.o
${CC} ${CFLAGS} -DB=_start '-Dputchar(a)=' $< -c
@echo "NOTE: this entry will not work with any platform other than x86/linux."
${LD} -static -o sh ${PROG}.alt.o
vi.alt: sh.alt
${RM} -f vi
${CP} $< vi
fs.alt.tar: sh.alt vi.alt gavin.alt.c README.md prim
${RM} -f $@
${TAR} -cvf fs.tar sh vi gavin.alt.c README.md prim
# data files
#
data: ${DATA}