1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-06 03:40:54 +11:00
collapseos/tools/emul/Makefile
Virgil Dupras 22e990ed89 Parametrize zasm linux bin's include CFS file
... instead of embedding it in the binary itself. Additionally, add a
"zasm.sh" wrapper to faciliate zasm calls on a linux machine.
2019-06-02 15:50:59 -04:00

60 lines
1.9 KiB
Makefile

TARGETS = shell/shell zasm/zasm runbin/runbin
CFSPACK = ../cfspack/cfspack
KERNEL = ../../kernel
APPS = ../../apps
ZASMBIN = zasm/zasm
INCCFS = zasm/includes.cfs
.PHONY: all
all: $(TARGETS)
shell/kernel.h: shell/shell_.asm $(ZASMBIN) $(INCCFS)
$(ZASMBIN) $(INCCFS) < $< | ./bin2c.sh KERNEL | tee $@ > /dev/null
zasm/kernel.h: zasm/kernel.bin
./bin2c.sh KERNEL < $< | tee $@ > /dev/null
zasm/user.h: zasm/zasm.bin
./bin2c.sh USERSPACE < $< | tee $@ > /dev/null
$(INCCFS): $(CFSPACK)
rm -rf zasm/includes
cp -r $(KERNEL) zasm/includes
cp -r $(APPS)/zasm zasm/includes/zasm
find zasm/includes -name *.md -o -name *.example -o -name glue.asm -delete
find zasm/includes -type f -exec sed -i -e 's/;.*//g' {} \;
cp user.h zasm/includes
$(CFSPACK) zasm/includes > $@
rm -rf zasm/includes
shell/shell: shell/shell.c libz80/libz80.o shell/kernel.h $(CFSPACK)
$(ZASMBIN): zasm/zasm.c libz80/libz80.o zasm/kernel.h zasm/user.h
runbin/runbin: runbin/runbin.c libz80/libz80.o
$(TARGETS):
$(CC) $< libz80/libz80.o -o $@
libz80/libz80.o: libz80/z80.c
make -C libz80/codegen opcodes
$(CC) -Wall -ansi -g -c -o libz80/libz80.o libz80/z80.c
$(CFSPACK):
make -C ../cfspack
.PHONY: updatebootstrap
updatebootstrap: $(ZASMBIN) $(INCCFS)
$(ZASMBIN) $(INCCFS) < zasm/glue.asm > zasm/kernel.bin
$(ZASMBIN) $(INCCFS) < $(APPS)/zasm/glue.asm > zasm/zasm.bin
# Sometimes, when developing zasm, stuff get messed up and it's hard to unmess
# because zasm's brake-up ends up in its bootstrap bins. Sure, we can revert
# from git, but if we're in the middle of some work, it's inconvenient. As long
# as we don't diverge from scas's syntax, it can come to the recue!
.PHONY: rescue
rescue:
scas -o zasm/kernel.bin -I $(KERNEL) zasm/glue.asm
scas -o zasm/zasm.bin -I $(APPS) -I $(KERNEL) $(APPS)/zasm/glue.asm
.PHONY: clean
clean:
rm -f $(TARGETS) zasm/{kernel,user}.h shell/kernel.h zasm/includes.*